From 79e71c3d02d4c11161aea66a558c4bed6bd2aaf7 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 11 Mar 2025 11:23:25 -0500 Subject: [PATCH] possibly fix VGM, ZSM and SAP-R export issue #2408 --- src/engine/export/sapr.cpp | 9 +-------- src/engine/export/zsm.cpp | 9 +-------- src/engine/vgmOps.cpp | 4 +--- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/engine/export/sapr.cpp b/src/engine/export/sapr.cpp index a074cbb3e..c99c1254e 100644 --- a/src/engine/export/sapr.cpp +++ b/src/engine/export/sapr.cpp @@ -27,9 +27,6 @@ #include #include -constexpr int MASTER_CLOCK_PREC=(sizeof(void*)==8)?8:0; -constexpr int MASTER_CLOCK_MASK=(sizeof(void*)==8)?0xff:0; - static String ticksToTime(double rate, int ticks) { double timing = ticks / rate; @@ -112,7 +109,6 @@ void DivExportSAPR::run() { // Prepare to write song data. e->playSub(false); bool done=false; - int fracWait=0; // accumulates fractional ticks e->disCont[POKEY].dispatch->toggleRegisterDump(true); std::array currRegs; @@ -136,10 +132,7 @@ void DivExportSAPR::run() { // write wait tickCount++; - int totalWait=e->cycles>>MASTER_CLOCK_PREC; - fracWait+=e->cycles&MASTER_CLOCK_MASK; - totalWait+=fracWait>>MASTER_CLOCK_PREC; - fracWait&=MASTER_CLOCK_MASK; + int totalWait=e->cycles; if (totalWait>0 && !done) { while (totalWait) { regs.push_back(currRegs); diff --git a/src/engine/export/zsm.cpp b/src/engine/export/zsm.cpp index 869daabc9..109e0e754 100644 --- a/src/engine/export/zsm.cpp +++ b/src/engine/export/zsm.cpp @@ -518,9 +518,6 @@ void DivZSM::flushTicks() { /// ZSM export -constexpr int MASTER_CLOCK_PREC=(sizeof(void*)==8)?8:0; -constexpr int MASTER_CLOCK_MASK=(sizeof(void*)==8)?0xff:0; - void DivExportZSM::run() { // settings unsigned int zsmrate=conf.getInt("zsmrate",60); @@ -598,7 +595,6 @@ void DivExportZSM::run() { bool done=false; bool loopNow=false; int loopPos=-1; - int fracWait=0; // accumulates fractional ticks if (VERA>=0) e->disCont[VERA].dispatch->toggleRegisterDump(true); if (YM>=0) { e->disCont[YM].dispatch->toggleRegisterDump(true); @@ -687,10 +683,7 @@ void DivExportZSM::run() { } // write wait - int totalWait=e->cycles>>MASTER_CLOCK_PREC; - fracWait+=e->cycles&MASTER_CLOCK_MASK; - totalWait+=fracWait>>MASTER_CLOCK_PREC; - fracWait&=MASTER_CLOCK_MASK; + int totalWait=e->cycles; if (totalWait>0 && !done) { zsm.tick(totalWait); //tickCount+=totalWait; diff --git a/src/engine/vgmOps.cpp b/src/engine/vgmOps.cpp index 13fbd9b2c..fb3a82b62 100644 --- a/src/engine/vgmOps.cpp +++ b/src/engine/vgmOps.cpp @@ -22,8 +22,6 @@ #include "../utfutils.h" #include "song.h" -constexpr int MASTER_CLOCK_PREC=(sizeof(void*)==8)?8:0; - // this function is so long // may as well make it something else void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write, int streamOff, double* loopTimer, double* loopFreq, int* loopSample, bool* sampleDir, bool isSecond, int* pendingFreq, int* playingSample, int* setPos, unsigned int* sampleOff8, unsigned int* sampleLen8, size_t bankOffset, bool directStream, bool* sampleStoppable) { @@ -2741,7 +2739,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p }; // calculate number of samples in this tick - int totalWait=cycles>>MASTER_CLOCK_PREC; + int totalWait=cycles; // get register dumps and put them into delayed writes int writeNum=0;