From 6c3169e333e44df5cac3e613c8100d8572fe395f Mon Sep 17 00:00:00 2001 From: sparky4 Date: Mon, 28 Aug 2017 13:15:42 -0500 Subject: [PATCH] added stuff like repo call of dro2imf and imfplay actually uses the memory manager properly! Due to this I am thinking of using imf for music wwww --- .gitignore | 1 + .gitmodules | 4 ++++ 16/shitman | 1 - makefile | 11 ++++++++++- src/lib/16_sd.c | 13 +++++++++++-- src/lib/16_sd.h | 3 ++- src/lib/vgmsnd/vgmSnd.c | 14 ++++++++++---- src/lib/vgmsnd/vgmSnd.h | 2 ++ src/util/git/git_modu.les | 4 ++++ 9 files changed, 44 insertions(+), 9 deletions(-) delete mode 160000 16/shitman diff --git a/.gitignore b/.gitignore index 70f8e216..bce92ec3 100755 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ pcxsscut vrl2vrs vrsdump vrldbg +dro2imf ps.exe *.upx # except foo.html which is maintained by hand. diff --git a/.gitmodules b/.gitmodules index 1805ff91..ab23923c 100755 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,7 @@ [submodule "shitman"] path = 16/shitman url = https://github.com/joncampbell123/shitman.git + +[submodule "dro2imf"] + path = "16/dro2imf" + url = https://github.com/Malvineous/dro2imf.git diff --git a/16/shitman b/16/shitman deleted file mode 160000 index 30235e5e..00000000 --- a/16/shitman +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 30235e5eabc57190c68d5b042a687295029026cc diff --git a/makefile b/makefile index a655ce6c..8a8bd909 100755 --- a/makefile +++ b/makefile @@ -236,7 +236,8 @@ SPRIUTILEXEC = & pcxsscut & vrl2vrs & vrsdump & - vrldbg + vrldbg & + dro2imf #UTILEXEC += $(SPRIUTILEXEC) !endif @@ -473,6 +474,7 @@ clean: .symbolic @if exist *.OBJ $(REMOVECOMMAND) *.OBJ #@for %f in ($(SPRIUTILEXEC)) do @if exist %f $(REMOVECOMMAND) %f @if not exist vrl2vrs wmake -s -h pcx2vrl + @if not exist dro2imf wmake -s -h drotoimf !else @if exist *.o $(REMOVECOMMAND) *.o !endif @@ -618,6 +620,7 @@ reinitlibs: .symbolic @$(REMOVECOMMAND) -rf 16/keen @$(REMOVECOMMAND) -rf 16/Catacomb3D @$(REMOVECOMMAND) -rf 16/shitman + @$(REMOVECOMMAND) -rf 16/dro2imf @wmake -s -h initlibs initlibs: .symbolic @@ -628,6 +631,7 @@ initlibs: .symbolic @git clone https://github.com/id-Software/wolf3d.git @git clone https://github.com/keendreams/keen.git @git clone https://github.com/FlatRockSoft/Catacomb3D.git + @git clone https://github.com/Malvineous/dro2imf.git @cd $(BUILD_ROOT) @$(COPYCOMMAND) $(DOSLIBDIR)/make-lowercase . @@ -666,6 +670,11 @@ mx_: .symbolic @cd $(BUILD_ROOT) !ifdef __LINUX__ +drotoimf: .symbolic + @cd 16/dro2imf + @make + @$(MOVECOMMAND) dro2imf ../.. + @cd $(BUILD_ROOT) vrs: .symbolic vrl: .symbolic $(SPRIUTILEXEC): diff --git a/src/lib/16_sd.c b/src/lib/16_sd.c index 4445bc47..b3349bc2 100755 --- a/src/lib/16_sd.c +++ b/src/lib/16_sd.c @@ -223,6 +223,12 @@ void SD_Initimf(global_game_variables_t *gvar) shutdown_adlib_opl3(); // NTS: Apparently the music won't play otherwise } +void SD_imf_reset_music(global_game_variables_t *gvar) +{ + gvar->ca.sd.imf_music = gvar->ca.sd.imf_play_ptr = gvar->ca.sd.imf_music_end = NULL; + gvar->ca.sd.imf_delay_countdown = 0; +} + void SD_imf_free_music(global_game_variables_t *gvar) { #ifndef SD_USESCAMMPM @@ -230,8 +236,7 @@ void SD_imf_free_music(global_game_variables_t *gvar) #else MM_FreePtr(MEMPTRCONV gvar->ca.audiosegs[0], gvar); //TODO make behave like id engine #endif - gvar->ca.sd.imf_music = gvar->ca.sd.imf_play_ptr = gvar->ca.sd.imf_music_end = NULL; - gvar->ca.sd.imf_delay_countdown = 0; + SD_imf_reset_music(gvar); } int SD_imf_load_music(const char *path, global_game_variables_t *gvar) @@ -240,7 +245,11 @@ int SD_imf_load_music(const char *path, global_game_variables_t *gvar) unsigned char buf[8]; int fd; +#ifndef SD_USESCAMMPM SD_imf_free_music(gvar); +#else + SD_imf_reset_music(gvar); +#endif fd = open(path,O_RDONLY|O_BINARY); if (fd < 0) return 0; diff --git a/src/lib/16_sd.h b/src/lib/16_sd.h index 54a2e73e..117ab0c4 100755 --- a/src/lib/16_sd.h +++ b/src/lib/16_sd.h @@ -31,7 +31,7 @@ #include #include -//#define SD_USESCAMMPM +#define SD_USESCAMMPM #define MIN_REGISTER 0x01 #define MAX_REGISTER 0xF5 @@ -66,6 +66,7 @@ void FMKeyOn(int voice, int freq, int octave); void FMSetVoice(int voiceNum, FMInstrument *ins); void SD_Initimf(global_game_variables_t *gvar); +void SD_imf_reset_music(global_game_variables_t *gvar); void SD_imf_free_music(global_game_variables_t *gvar); int SD_imf_load_music(const char *path, global_game_variables_t *gvar); void interrupt SD_irq0(void); diff --git a/src/lib/vgmsnd/vgmSnd.c b/src/lib/vgmsnd/vgmSnd.c index 2cfd8690..c46b0b76 100755 --- a/src/lib/vgmsnd/vgmSnd.c +++ b/src/lib/vgmsnd/vgmSnd.c @@ -171,9 +171,12 @@ UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile, global_game_variables } vgmFile->dataLen = vgmBaseHdr.lngEOFOffset + 0x04; - //vgmFile->data = (UINT8*)malloc(vgmFile->dataLen); +#ifndef VGM_USESCAMMPM + vgmFile->data = (UINT8*)malloc(vgmFile->dataLen); +#else MM_GetPtr(MEMPTRCONV gvar->ca.audiosegs[0], vgmFile->dataLen, gvar); vgmFile->data = (UINT8*)gvar->ca.audiosegs[0]; +#endif if (vgmFile->data == NULL) { fclose(hFile); @@ -216,12 +219,15 @@ UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile, global_game_variables void FreeVGMFile(VGM_FILE* vgmFile, global_game_variables_t *gvar) { - //if(vgmFile->data){ free(vgmFile->data); vgmFile->data = NULL; } +#ifndef VGM_USESCAMMPM + if(vgmFile->data){ free(vgmFile->data); vgmFile->data = NULL; } +#else MM_FreePtr(MEMPTRCONV gvar->ca.audiosegs[0], gvar); - if(vgmFile->data) free(vgmFile->data); +#endif +// if(vgmFile->data) free(vgmFile->data); vgmFile->dataLen = 0; -// return; + return; } diff --git a/src/lib/vgmsnd/vgmSnd.h b/src/lib/vgmsnd/vgmSnd.h index 5cadbe18..da9fcec9 100755 --- a/src/lib/vgmsnd/vgmSnd.h +++ b/src/lib/vgmsnd/vgmSnd.h @@ -1,6 +1,8 @@ #ifndef __VGMSNDDRV_H__ #define __VGMSNDDRV_H__ +//#define VGM_USESCAMMPM + #ifdef __cplusplus extern "C" { diff --git a/src/util/git/git_modu.les b/src/util/git/git_modu.les index 1805ff91..ab23923c 100755 --- a/src/util/git/git_modu.les +++ b/src/util/git/git_modu.les @@ -25,3 +25,7 @@ [submodule "shitman"] path = 16/shitman url = https://github.com/joncampbell123/shitman.git + +[submodule "dro2imf"] + path = "16/dro2imf" + url = https://github.com/Malvineous/dro2imf.git -- 2.39.5