From eb8849ce631ccb99a4bc35d8cc378f6520e04ada Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 23 Sep 2022 19:18:32 -0500 Subject: [PATCH] add disableSampleMacro flag for compatibility --- src/engine/fileOps.cpp | 8 ++++---- src/engine/platform/ay.cpp | 4 ++-- src/engine/platform/msm6295.cpp | 1 + src/engine/platform/pce.cpp | 10 +++++----- src/engine/song.h | 4 ++-- src/gui/compatFlags.cpp | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index 4f4c6539e..47a837899 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -178,7 +178,7 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { ds.e1e2StopOnSameNote=true; ds.brokenPortaArp=false; ds.snNoLowPeriods=true; - ds.ignorePCEDACVolume=true; + ds.disableSampleMacro=true; ds.delayBehavior=0; ds.jumpTreatment=2; @@ -1102,7 +1102,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { ds.autoSystem=false; } if (ds.version<117) { - ds.ignorePCEDACVolume=true; + ds.disableSampleMacro=true; } ds.isDMF=false; @@ -1537,7 +1537,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { reader.readC(); } if (ds.version>=117) { - ds.ignorePCEDACVolume=reader.readC(); + ds.disableSampleMacro=reader.readC(); } else { reader.readC(); } @@ -3786,7 +3786,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) { w->writeC(song.delayBehavior); w->writeC(song.jumpTreatment); w->writeC(song.autoSystem); - w->writeC(song.ignorePCEDACVolume); + w->writeC(song.disableSampleMacro); for (int i=0; i<2; i++) { w->writeC(0); } diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index 5ce075ce0..ad2bbc650 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -348,14 +348,14 @@ int DivPlatformAY8910::dispatch(DivCommand c) { switch (c.cmd) { case DIV_CMD_NOTE_ON: { DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AY); - if (ins->type==DIV_INS_AMIGA || ins->amiga.useSample) { + if (!parent->song.disableSampleMacro && (ins->type==DIV_INS_AMIGA || ins->amiga.useSample)) { chan[c.chan].psgMode.dac=true; } else if (chan[c.chan].dac.furnaceDAC) { chan[c.chan].psgMode.dac=false; } if (chan[c.chan].psgMode.dac) { if (skipRegisterWrites) break; - if (ins->type==DIV_INS_AMIGA || ins->amiga.useSample) { + if (!parent->song.disableSampleMacro && (ins->type==DIV_INS_AMIGA || ins->amiga.useSample)) { chan[c.chan].dac.sample=ins->amiga.getSample(c.value); if (chan[c.chan].dac.sample<0 || chan[c.chan].dac.sample>=parent->song.sampleLen) { chan[c.chan].dac.sample=-1; diff --git a/src/engine/platform/msm6295.cpp b/src/engine/platform/msm6295.cpp index 5cfec125a..b85bc1a58 100644 --- a/src/engine/platform/msm6295.cpp +++ b/src/engine/platform/msm6295.cpp @@ -88,6 +88,7 @@ void DivPlatformMSM6295::acquire(short* bufL, short* bufR, size_t start, size_t } void DivPlatformMSM6295::tick(bool sysTick) { + if (parent->song.disableSampleMacro) return; for (int i=0; i<4; i++) { chan[i].std.next(); if (chan[i].std.vol.had) { diff --git a/src/engine/platform/pce.cpp b/src/engine/platform/pce.cpp index 74667c870..19b71a1be 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -69,7 +69,7 @@ void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len) signed char dacData=((signed char)((unsigned char)s->data8[chan[i].dacPos]^0x80))>>3; chan[i].dacOut=CLAMP(dacData,-16,15); if (!isMuted[i]) { - chWrite(i,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[i].outVol)); + chWrite(i,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[i].outVol)); chWrite(i,0x06,chan[i].dacOut&0x1f); } else { chWrite(i,0x04,0xc0); @@ -208,7 +208,7 @@ void DivPlatformPCE::tick(bool sysTick) { if (chan[i].active && chan[i].dacSample>=0 && chan[i].dacSamplesong.sampleLen) { chan[i].dacPos=0; chan[i].dacPeriod=0; - chWrite(i,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[i].vol)); + chWrite(i,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[i].vol)); addWrite(0xffff0000+(i<<8),chan[i].dacSample); chan[i].keyOn=true; } @@ -275,7 +275,7 @@ int DivPlatformPCE::dispatch(DivCommand c) { break; } else { if (dumpWrites) { - chWrite(c.chan,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[c.chan].vol)); + chWrite(c.chan,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[c.chan].vol)); addWrite(0xffff0000+(c.chan<<8),chan[c.chan].dacSample); } } @@ -310,7 +310,7 @@ int DivPlatformPCE::dispatch(DivCommand c) { chan[c.chan].dacPeriod=0; chan[c.chan].dacRate=parent->getSample(chan[c.chan].dacSample)->rate; if (dumpWrites) { - chWrite(c.chan,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[c.chan].vol)); + chWrite(c.chan,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[c.chan].vol)); addWrite(0xffff0001+(c.chan<<8),chan[c.chan].dacRate); } } @@ -466,7 +466,7 @@ void DivPlatformPCE::muteChannel(int ch, bool mute) { isMuted[ch]=mute; chWrite(ch,0x05,isMuted[ch]?0:chan[ch].pan); if (!isMuted[ch] && (chan[ch].pcm && chan[ch].dacSample!=-1)) { - chWrite(ch,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[ch].outVol)); + chWrite(ch,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[ch].outVol)); chWrite(ch,0x06,chan[ch].dacOut&0x1f); } } diff --git a/src/engine/song.h b/src/engine/song.h index 28a31c759..a9a16263a 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -511,7 +511,7 @@ struct DivSong { bool e1e2StopOnSameNote; bool brokenPortaArp; bool snNoLowPeriods; - bool ignorePCEDACVolume; + bool disableSampleMacro; bool autoSystem; std::vector ins; @@ -617,7 +617,7 @@ struct DivSong { e1e2StopOnSameNote(false), brokenPortaArp(false), snNoLowPeriods(false), - ignorePCEDACVolume(true), + disableSampleMacro(true), autoSystem(true) { for (int i=0; i<32; i++) { system[i]=DIV_SYSTEM_NULL; diff --git a/src/gui/compatFlags.cpp b/src/gui/compatFlags.cpp index ac7209d63..fcea0fa06 100644 --- a/src/gui/compatFlags.cpp +++ b/src/gui/compatFlags.cpp @@ -281,7 +281,7 @@ void FurnaceGUI::drawCompatFlags() { if (ImGui::IsItemHovered()) { ImGui::SetTooltip("behavior changed in 0.6pre1.5"); } - ImGui::Checkbox("Ignore PC Engine DAC volume",&e->song.ignorePCEDACVolume); + ImGui::Checkbox("Disable new sample features",&e->song.disableSampleMacro); if (ImGui::IsItemHovered()) { ImGui::SetTooltip("behavior changed in 0.6pre2"); }