From c0799cb75d07f627246ab2b00d869bcb1f6da71d Mon Sep 17 00:00:00 2001 From: sparky4 Date: Fri, 7 Apr 2017 15:52:27 -0500 Subject: [PATCH] p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I should remember what needs to be done soon][OpenVGMFile needs to be ported to 16_snd.c]going to port rest of code to borland c some time so we can use the core components of id engine here [going to add 16_us.c eventually but the debug system and CA_ PM_ and MM_ usage is priority now]older zcroll renamed to xcroll][zcroll is now the pre menu game loop system with PROPER data usage with CAMMPM] MM_ShowMemory is quite buggy on real machines. i need to debug it and fix added a struct printer[gvar.mm is FUCKING HUGE 14402 bytes FAT\!]imfplay works better than vgmtest --- src/imfplay.c | 14 +------------- src/lib/16_sd.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/imfplay.c b/src/imfplay.c index 3aefa2d2..415bcfb8 100755 --- a/src/imfplay.c +++ b/src/imfplay.c @@ -207,14 +207,7 @@ void main(int argc,char **argv) { return; } - if (!init_adlib()) { - printf("Cannot init library\n"); - return; - } - if (!probe_8254()) { /* we need the timer to keep time with the music */ - printf("8254 timer not found\n"); - return; - } + SD_Initimf(&gvar); if (!SD_imf_load_music(argv[1], &gvar)) { printf("Failed to load IMF Music\n"); @@ -222,14 +215,9 @@ void main(int argc,char **argv) { } write_8254_system_timer(T8254_REF_CLOCK_HZ / tickrate); - gvar.ca.sd.irq0_cnt = 0; - gvar.ca.sd.irq0_add = 182; - gvar.ca.sd.irq0_max = 1000; /* about 18.2Hz */ old_irq0 = _dos_getvect(8);/*IRQ0*/ _dos_setvect(8,irq0); - SD_adlib_shut_up(); - shutdown_adlib_opl3(); // NTS: Apparently the music won't play otherwise _cli(); gvar.ca.sd.irq0_ticks = ptick = 0; _sti(); diff --git a/src/lib/16_sd.c b/src/lib/16_sd.c index f48ae2c0..3e4cfc00 100755 --- a/src/lib/16_sd.c +++ b/src/lib/16_sd.c @@ -199,14 +199,29 @@ void FMSetVoice(int voiceNum, FMInstrument *ins){ void SD_Initimf(global_game_variables_t *gvar) { + if (!init_adlib()) { + printf("Cannot init library\n"); + return; + } + if (!probe_8254()) { /* we need the timer to keep time with the music */ + printf("8254 timer not found\n"); + return; + } + gvar->ca.sd.irq0_ticks= - gvar->ca.sd.irq0_cnt= - gvar->ca.sd.irq0_add= + //gvar->ca.sd.irq0_cnt= + //gvar->ca.sd.irq0_add= gvar->ca.sd.imf_delay_countdown= gvar->ca.sd.irq0_max=0; gvar->ca.sd.imf_music= gvar->ca.sd.imf_play_ptr= gvar->ca.sd.imf_music_end=NULL; + gvar->ca.sd.irq0_cnt = 0; + gvar->ca.sd.irq0_add = 182; + gvar->ca.sd.irq0_max = 1000; /* about 18.2Hz */ + + SD_adlib_shut_up(); + shutdown_adlib_opl3(); // NTS: Apparently the music won't play otherwise } void SD_imf_free_music(global_game_variables_t *gvar) -- 2.39.2