mirror of
https://github.com/gmcn42/mt32-pi-control.git
synced 2026-09-22 18:37:58 +00:00
Fixed file handling, first steps for win32 and linux version
This commit is contained in:
1 parent
888f1b243a
commit
8320a2e6b0
11 files changed
+209
-9
No files matched your search
+1
-1
@@ -9,7 +9,7 @@ AS = $(PREFIX)/m68k-amigaos-as
|
||||
|
||||
VPATH = .:../common_src
|
||||
INCLUDE = -I../common_src
|
||||
DEFINE = -DPROGRAM_NAME='"$(PROGRAM_NAME)"'
|
||||
DEFINE = -DPROGRAM_NAME='"$(PROGRAM_NAME)"' -DREPLACE_GETOPT
|
||||
|
||||
#CFLAGS = $(INCLUDE) -Os -s -m68000 -fomit-frame-pointer -mcrt=nix13 -msmall-code -fbaserel -mregparm -Wall -Werror -Wno-pointer-sign -std=gnu99
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ AS = m68k-atari-mint-as
|
||||
|
||||
VPATH = .:../common_src
|
||||
INCLUDE = -I../common_src
|
||||
DEFINE = -DARGV_NO_BASENAME -DNO_ERROR_ON_HELP -DATARI_ST_QUOTING -DUSE_CUSTOM_DELAY -DPROGRAM_NAME='"$(PROGRAM_NAME)"'
|
||||
DEFINE = -DARGV_NO_BASENAME -DNO_ERROR_ON_HELP -DATARI_ST_QUOTING -DUSE_CUSTOM_DELAY -DPROGRAM_NAME='"$(PROGRAM_NAME)"' -DREPLACE_GETOPT
|
||||
|
||||
CFLAGS = $(INCLUDE) -Os -s -m68000 -fomit-frame-pointer -Wall -Werror -Wno-pointer-sign -std=c99 $(DEFINE)
|
||||
CXXFLAGS = $(INCLUDE) -Os -s -m68000 -fomit-frame-pointer -Wall -Werror $(DEFINE)
|
||||
|
||||
@@ -63,13 +63,13 @@
|
||||
static int fio_open(struct file_t *f, const char *fname, int mode) {
|
||||
switch(mode) {
|
||||
case FIO_OPEN_RD:
|
||||
f->fh = fopen(fname, "r");
|
||||
f->fh = fopen(fname, "rb");
|
||||
break;
|
||||
case FIO_OPEN_WR:
|
||||
f->fh = fopen(fname, "w");
|
||||
f->fh = fopen(fname, "wb");
|
||||
break;
|
||||
case FIO_OPEN_RW:
|
||||
f->fh = fopen(fname, "r+");
|
||||
f->fh = fopen(fname, "rb+");
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
|
||||
@@ -57,9 +57,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
|
||||
|
||||
|
||||
int opterr = 1; /* if error message should be printed */
|
||||
int optind = 1; /* index into parent argv vector */
|
||||
int optopt = '?'; /* character checked for validity */
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ MODE = s
|
||||
all: mt32-pi.exe
|
||||
|
||||
mt32-pi.exe: ..\COMMON~1\mt32-pi.c mpu401.c midi_dev.c ..\COMMON~1\getopt.c
|
||||
*wcl -i=..\COMMON~1\ -zp2 -lr -we -d0 -y -0 -s -m$(MODE) -wx -dUSE_CUSTOM_FILE_IO -dUSE_CUSTOM_DELAY -fe=mt32-pi.exe -fm=mt32-pi.map *.c ..\COMMON~1\*.c
|
||||
*wcl -i=..\COMMON~1\ -zp2 -lr -we -d0 -y -0 -s -m$(MODE) -wx -dUSE_CUSTOM_FILE_IO -dUSE_CUSTOM_DELAY -dREPLACE_GETOPT -fe=mt32-pi.exe -fm=mt32-pi.map *.c ..\COMMON~1\*.c
|
||||
|
||||
dist: mt32-pi.exe .symbolic
|
||||
UPXCOMP.BAT
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
PROGRAM_NAME := mt32-pi-ctl
|
||||
|
||||
CXX = g++
|
||||
CC = gcc
|
||||
AR = ar
|
||||
AS = as
|
||||
|
||||
VPATH = .:../common_src
|
||||
INCLUDE = -I../common_src
|
||||
DEFINE = -DPROGRAM_NAME='"$(PROGRAM_NAME)"' -DUSE_CUSTOM_DELAY
|
||||
|
||||
#CFLAGS = $(INCLUDE) -Os -s -m68000 -fomit-frame-pointer -mcrt=nix13 -msmall-code -fbaserel -mregparm -Wall -Werror -Wno-pointer-sign -std=gnu99
|
||||
|
||||
CFLAGS = $(INCLUDE) -O2 -ffunction-sections -fdata-sections -Wl,--gc-sections -Wall -Werror -Wno-pointer-sign -std=gnu99 $(DEFINE)
|
||||
|
||||
CXXFLAGS = $(INCLUDE) -O2 -ffunction-sections -fdata-sections -Wl,--gc-sections -Wall -Werror $(DEFINE)
|
||||
|
||||
LIBS = -lasound
|
||||
|
||||
OBJ = mt32-pi.o midi_dev.o delay.o
|
||||
|
||||
%.o : %.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
%.o : %.C
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
|
||||
$(PROGRAM_NAME) : $(OBJ)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
.PHONY: clean
|
||||
clean :
|
||||
rm -f $(OBJ) $(PROGRAM_NAME)
|
||||
|
||||
.PHONY: dist
|
||||
dist: $(PROGRAM_NAME)
|
||||
cp -v $(PROGRAM_NAME) ../amiga_bin/
|
||||
cp -v *.bmp ../amiga_bin/
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "delay.h"
|
||||
|
||||
void delay_ms(unsigned int delay) {
|
||||
struct timespec ts, tr;
|
||||
ts.tv_sec = (time_t)(delay/1000);
|
||||
ts.tv_nsec = (long) ((delay%1000)*1000000);
|
||||
while((clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &tr))==EINTR) {
|
||||
ts = tr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* mt32-pi-control
|
||||
*
|
||||
* An mt32-pi control program for DOS PCs, Atari ST,
|
||||
* and Amiga computers
|
||||
*
|
||||
* Copyright (C) 2021 Andreas Zdziarstek
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int mididev_init(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mididev_deinit(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int mididev_send_bytes(const unsigned char *buf, int len) {
|
||||
if(len==0) return 0;
|
||||
|
||||
if((buf[0] == 0xF0 && buf[len-1] == 0xF7) || len==3) {
|
||||
for(int i=0; i<len; i++) {
|
||||
fprintf(stderr, "%02X ", buf[i]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
} else {
|
||||
fprintf(stderr, "Error: Non-SysEx message with more than 3 bytes.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//fprintf(stderr, "len:%d end:%02X\n", len, buf[len-1]);
|
||||
// for(int i=0; i<len; i++) {
|
||||
// fprintf(stderr, "%02X ", buf[i]);
|
||||
// }
|
||||
//fprintf(stderr, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mididev_print_usage(void) {}
|
||||
|
||||
void mididev_add_optstr(char *optstr) {}
|
||||
|
||||
int mididev_parse_arg(int c, const char *optarg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
PROGRAM_NAME := mt32-pi-ctl.exe
|
||||
|
||||
CXX = i686-w64-mingw32-g++
|
||||
CC = i686-w64-mingw32-gcc
|
||||
AR = i686-w64-mingw32-ar
|
||||
AS = i686-w64-mingw32-as
|
||||
|
||||
VPATH = .:../common_src
|
||||
INCLUDE = -I../common_src
|
||||
DEFINE = -DPROGRAM_NAME='"$(PROGRAM_NAME)"' -DUSE_CUSTOM_DELAY
|
||||
|
||||
#CFLAGS = $(INCLUDE) -Os -s -m68000 -fomit-frame-pointer -mcrt=nix13 -msmall-code -fbaserel -mregparm -Wall -Werror -Wno-pointer-sign -std=gnu99
|
||||
|
||||
CFLAGS = $(INCLUDE) -O2 -ffunction-sections -fdata-sections -static-libgcc -static-libstdc++ -Wl,--gc-sections -Wall -Werror -Wno-pointer-sign -std=gnu99 $(DEFINE)
|
||||
|
||||
CXXFLAGS = $(INCLUDE) -O2 -ffunction-sections -fdata-sections -static-libgcc -static-libstdc++ -Wl,--gc-sections -Wall -Werror $(DEFINE)
|
||||
|
||||
LIBS =
|
||||
|
||||
OBJ = mt32-pi.o midi_dev.o delay.o
|
||||
|
||||
%.o : %.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
%.o : %.C
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
|
||||
$(PROGRAM_NAME) : $(OBJ)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
.PHONY: clean
|
||||
clean :
|
||||
rm -f $(OBJ) $(PROGRAM_NAME)
|
||||
|
||||
.PHONY: dist
|
||||
dist: $(PROGRAM_NAME)
|
||||
cp -v $(PROGRAM_NAME) ../amiga_bin/
|
||||
cp -v *.bmp ../amiga_bin/
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "windows.h"
|
||||
#include "delay.h"
|
||||
|
||||
void delay_ms(unsigned int delay) {
|
||||
Sleep(delay);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* mt32-pi-control
|
||||
*
|
||||
* An mt32-pi control program for DOS PCs, Atari ST,
|
||||
* and Amiga computers
|
||||
*
|
||||
* Copyright (C) 2021 Andreas Zdziarstek
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int mididev_init(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mididev_deinit(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int mididev_send_bytes(const unsigned char *buf, int len) {
|
||||
if(len==0) return 0;
|
||||
|
||||
if((buf[0] == 0xF0 && buf[len-1] == 0xF7) || len==3) {
|
||||
for(int i=0; i<len; i++) {
|
||||
fprintf(stderr, "%02X ", buf[i]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
} else {
|
||||
fprintf(stderr, "Error: Non-SysEx message with more than 3 bytes.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//fprintf(stderr, "len:%d end:%02X\n", len, buf[len-1]);
|
||||
// for(int i=0; i<len; i++) {
|
||||
// fprintf(stderr, "%02X ", buf[i]);
|
||||
// }
|
||||
//fprintf(stderr, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mididev_print_usage(void) {}
|
||||
|
||||
void mididev_add_optstr(char *optstr) {}
|
||||
|
||||
int mididev_parse_arg(int c, const char *optarg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user