From 7e0740d03af155004b27b2000cadda1e0101c366 Mon Sep 17 00:00:00 2001 From: a dinosaur Date: Thu, 26 Sep 2019 22:06:51 +1000 Subject: [PATCH] adpcm decoders compiling on loonix --- neotools/.gitignore | 4 +++ neotools/adpcm.Makefile | 64 +++++++++------------------------------- neotools/adpcm.c | 11 +++---- neotools/adpcmb.Makefile | 2 +- 4 files changed, 25 insertions(+), 56 deletions(-) diff --git a/neotools/.gitignore b/neotools/.gitignore index 66f2fcc..e19e313 100644 --- a/neotools/.gitignore +++ b/neotools/.gitignore @@ -4,3 +4,7 @@ *.log *.pcm *.wav + +*.o +adpcm +adpcmb diff --git a/neotools/adpcm.Makefile b/neotools/adpcm.Makefile index abab6f9..bb97bb0 100644 --- a/neotools/adpcm.Makefile +++ b/neotools/adpcm.Makefile @@ -1,70 +1,34 @@ -# Standard makefile to use as a base for DJGPP projects +# Standard makefile to use as a base for DJGPP projects (not anymore lol) # By MARTINEZ Fabrice aka SNK of SUPREMACY # Programs to use during make -AR = ar -CC = gcc -LD = gcc -ASM = nasm -PACKER = upx +LD := $(CC) -# Flags for debugging -#DEBUG=1 -#SYMBOLS=1 +TARGET := adpcm +SOURCE := adpcm.c # Flags for compilation -ASMFLAGS = -f coff -ifdef SYMBOLS -CFLAGS = -o -mpentium -Wall -Werror -g -LDFLAGS = -s -else -CFLAGS = -fomit-frame-pointer -O3 -mpentium -Werror -Wall \ +CFLAGS := -fomit-frame-pointer -O3 -Werror -Wall \ -W -Wno-sign-compare -Wno-unused \ -Wpointer-arith -Wbad-function-cast -Wcast-align -Waggregate-return \ -pedantic \ -Wshadow \ -Wstrict-prototypes -LDFLAGS = -endif -CDEFS = -ASMDEFS = +LDFLAGS := -lm # Object files -MAINOBJS = - -# Library files -MAINLIBS = obj/adpcm.a +OBJECT := $(SOURCE:%.c=%.o) # Make rules -all: adpcm.exe +all: $(TARGET) -adpcm.exe: $(MAINOBJS) $(MAINLIBS) - $(LD) $(LDFLAGS) $(MAINOBJS) $(MAINLIBS) -o $@ +$(TARGET): $(OBJECT) + $(LD) $(CFLAGS) $(LDFLAGS) $^ -o $@ -src/%.asm: - -obj/%.o: src/%.c - $(CC) $(CDEFS) $(CFLAGS) -c $< -o $@ - -obj/%.oa: src/%.asm - $(ASM) -o $@ $(ASMFLAGS) $(ASMDEFS) $< - -obj/%.a: - $(AR) cr $@ $^ +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ # Rules to manage files -pack: adpcm.exe - $(PACKER) adpcm.exe - -mkdir: - md obj - +.PHONY: clean clean: - del obj\*.o - del obj\*.a - del obj\*.oa - del *.exe - -# Rules to make libraries -obj/adpcm.a: obj/adpcm.o -# obj/decode.oa \ \ No newline at end of file + rm -f $(TARGET) $(OBJECT) diff --git a/neotools/adpcm.c b/neotools/adpcm.c index 1a27e51..e778de3 100644 --- a/neotools/adpcm.c +++ b/neotools/adpcm.c @@ -1,8 +1,6 @@ -#include #include -#include +#include #include -#include #define BUFFER_SIZE 1024*256 #define ADPCMA_VOLUME_RATE 1 @@ -70,8 +68,11 @@ int main(int argc, char *argv[]) } adpcm_init(); - - Filelen = filelength(fileno(Fp1)); + + fseek(Fp1, 0, SEEK_END); + Filelen = ftell(Fp1); + fseek(Fp1, 0, SEEK_SET); + *((unsigned int*)(&RiffWave[4])) = Filelen*4 + 0x2C; *((unsigned int*)(&RiffWave[0x28])) = Filelen*4; diff --git a/neotools/adpcmb.Makefile b/neotools/adpcmb.Makefile index 0dbfcca..e6677be 100644 --- a/neotools/adpcmb.Makefile +++ b/neotools/adpcmb.Makefile @@ -4,7 +4,7 @@ CFLAGS = -O3 SRC = . OBJ = . -OUT_OBJ = $(OBJ)/adpcmb.exe +OUT_OBJ = $(OBJ)/adpcmb all: $(OUT_OBJ)