From 92d552569276bb730d6c5b244d4b1a6a7a6d10aa Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 2 Oct 2022 00:06:06 -0500 Subject: [PATCH] Game Boy: fix Synchronize --- src/engine/fileOps.cpp | 3 +++ src/engine/platform/gb.cpp | 4 ++++ src/engine/platform/gb.h | 1 + src/gui/sysConf.cpp | 5 +++++ 4 files changed, 13 insertions(+) diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index 5033e3ec..c2888e34 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -206,6 +206,9 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { ds.tuning=433.2; }*/ + // Game Boy arp+soundLen screwery + ds.systemFlags[0].set("enoughAlready",true); + logI("reading module data..."); if (ds.version>0x0c) { ds.subsong[0]->hilightA=reader.readC(); diff --git a/src/engine/platform/gb.cpp b/src/engine/platform/gb.cpp index 0c9ab7b3..8a4cabc4 100644 --- a/src/engine/platform/gb.cpp +++ b/src/engine/platform/gb.cpp @@ -313,6 +313,9 @@ void DivPlatformGB::tick(bool sysTick) { rWrite(16+i*5+3,(2048-chan[i].freq)&0xff); rWrite(16+i*5+4,(((2048-chan[i].freq)>>8)&7)|((chan[i].keyOn||chan[i].keyOff)?0x80:0x00)|((chan[i].soundLen<63)<<6)); } + if (enoughAlready) { // more compat garbage + rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(chan[i].soundLen&63))); + } if (chan[i].keyOn) chan[i].keyOn=false; if (chan[i].keyOff) chan[i].keyOff=false; chan[i].freqChanged=false; @@ -645,6 +648,7 @@ void DivPlatformGB::setFlags(const DivConfig& flags) { model=GB_MODEL_AGB; break; } + enoughAlready=flags.getBool("enoughAlready",false); } int DivPlatformGB::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/gb.h b/src/engine/platform/gb.h index d0a2c1f3..17a17da1 100644 --- a/src/engine/platform/gb.h +++ b/src/engine/platform/gb.h @@ -76,6 +76,7 @@ class DivPlatformGB: public DivDispatch { DivDispatchOscBuffer* oscBuf[4]; bool isMuted[4]; bool antiClickEnabled; + bool enoughAlready; unsigned char lastPan; DivWaveSynth ws; struct QueuedWrite { diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index ad9d4fec..a1dc3181 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -270,6 +270,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo case DIV_SYSTEM_GB: { int chipType=flags.getInt("chipType",0); bool noAntiClick=flags.getBool("noAntiClick",false); + bool enoughAlready=flags.getBool("enoughAlready",false); if (ImGui::Checkbox("Disable anti-click",&noAntiClick)) { altered=true; @@ -291,11 +292,15 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo chipType=3; altered=true; } + if (ImGui::Checkbox("Pretty please one more compat flag when I use arpeggio and my sound length",&enoughAlready)) { + altered=true; + } if (altered) { e->lockSave([&]() { flags.set("chipType",chipType); flags.set("noAntiClick",noAntiClick); + flags.set("enoughAlready",enoughAlready); }); } break;