From 44f731a2447ae814f7ea5f9d2cb6ab75d91cc0cd Mon Sep 17 00:00:00 2001 From: uyjulian Date: Mon, 12 Jan 2015 00:28:26 -0600 Subject: [PATCH] Fix losedos bug --- Makefile | 4 ++-- emu.c | 2 +- it.c | 6 +++--- readme.md | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 61b5807..6131224 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,8 @@ OBJS = $(addprefix $(OBJDIR), emu.o it.o main.o sound.o spc700.o) COMMONFLAGS = CFLAGS = $(COMMONFLAGS) -Wall -g LDFLAGS = $(OBJS) -o $(EXENAME) $(COMMONFLAGS) -lm -g -LD = clang $(LDFLAGS) -CC = clang $(CFLAGS) +LD = gcc $(LDFLAGS) +CC = gcc $(CFLAGS) .PHONY: clean all diff --git a/emu.c b/emu.c index ed85a26..7e73671 100644 --- a/emu.c +++ b/emu.c @@ -33,7 +33,7 @@ static s32 LoadZState(char *fn) { SPCFile *sFile = malloc(sizeof(SPCFile)); memset(sFile, 0, sizeof(SPCFile)); - FILE *f = fopen(fn, "r"); + FILE *f = fopen(fn, "rb"); if (f == NULL) { printf("Error: can't open file\n"); diff --git a/it.c b/it.c index f9133e9..ebe7e00 100644 --- a/it.c +++ b/it.c @@ -142,7 +142,7 @@ s32 ITStart() // Opens up temporary file and inits writing { SPCAddWriteDSPCallback(&ITWriteDSPCallback); s32 i; - ittmp = fopen(IT_PATTERN_TEMP_FILE_NAME, "w+"); + ittmp = fopen(IT_PATTERN_TEMP_FILE_NAME, "wb+"); if (ittmp == NULL) return 1; for (i = 0; i < NUM_PATT_BUFS; i++) @@ -224,7 +224,7 @@ s32 ITWrite(char *fn) // Write the final IT file ITpattlen[ITcurbuf++] = ITbufpos; ITUpdate(); // Save the changes we just made // END IT CLEANUP - f = fopen(fn, "w"); + f = fopen(fn, "wb"); if (f == NULL) { printf("Error: could not open IT file\n"); @@ -275,7 +275,7 @@ s32 ITWrite(char *fn) // Write the final IT file free(fHeader); // orders for (i = 0; i < curpatt; i++) - fputc(i, f); // Write from 0 to the number of patterns (max: 0xFE) + fputc(i, f); // Write from 0 to the number of patterns (max: 0xFD) fputc(255, f); // terminating order // Sample offsets ofs = sizeof(ITFileHeader) + (curpatt + 1) + ((numsamps * sizeof(s32)) + (curpatt * sizeof(s32))); diff --git a/readme.md b/readme.md index ae58606..4f99a94 100755 --- a/readme.md +++ b/readme.md @@ -19,7 +19,6 @@ Bugs • The first note isn't being played. • Pitch slides sound wrong in IT file. • IT speed is inconsistant. -• Windows isn't creating IT files properly. More information ================