From f8b3c089a4386c8f40f7f80670956cf72edb919c Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 14 Aug 2022 23:07:19 -0500 Subject: [PATCH] Game Boy: fix volume column --- src/engine/platform/gb.cpp | 11 ++++++++++- src/engine/platform/gb.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/engine/platform/gb.cpp b/src/engine/platform/gb.cpp index a7b310935..9680d0ff9 100644 --- a/src/engine/platform/gb.cpp +++ b/src/engine/platform/gb.cpp @@ -373,6 +373,8 @@ void DivPlatformGB::tick(bool sysTick) { chan[i].killIt=false; } } + + chan[i].soManyHacksToMakeItDefleCompatible=false; } } @@ -409,10 +411,16 @@ int DivPlatformGB::dispatch(DivCommand c) { ws.init(ins,32,15,chan[c.chan].insChanged); } if ((chan[c.chan].insChanged || ins->gb.alwaysInit) && !chan[c.chan].softEnv) { - chan[c.chan].envVol=ins->gb.envVol; + if (!chan[c.chan].soManyHacksToMakeItDefleCompatible) { + chan[c.chan].envVol=ins->gb.envVol; + } chan[c.chan].envLen=ins->gb.envLen; chan[c.chan].envDir=ins->gb.envDir; chan[c.chan].soundLen=ins->gb.soundLen; + if (!chan[c.chan].soManyHacksToMakeItDefleCompatible) { + chan[c.chan].vol=chan[c.chan].envVol; + chan[c.chan].outVol=chan[c.chan].envVol; + } } if (c.chan==2 && chan[c.chan].softEnv) { chan[c.chan].soundLen=64; @@ -460,6 +468,7 @@ int DivPlatformGB::dispatch(DivCommand c) { } if (!chan[c.chan].softEnv) { chan[c.chan].envVol=chan[c.chan].vol; + chan[c.chan].soManyHacksToMakeItDefleCompatible=true; } else if (c.chan!=2) { chan[c.chan].envVol=chan[c.chan].vol; if (!chan[c.chan].keyOn) chan[c.chan].killIt=true; diff --git a/src/engine/platform/gb.h b/src/engine/platform/gb.h index 9498317bd..00dcca036 100644 --- a/src/engine/platform/gb.h +++ b/src/engine/platform/gb.h @@ -31,6 +31,7 @@ class DivPlatformGB: public DivDispatch { int freq, baseFreq, pitch, pitch2, note, ins; unsigned char duty, sweep; bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta, released, softEnv, killIt; + bool soManyHacksToMakeItDefleCompatible; signed char vol, outVol, wave, lastKill; unsigned char envVol, envDir, envLen, soundLen; unsigned short hwSeqPos; @@ -59,6 +60,7 @@ class DivPlatformGB: public DivDispatch { released(false), softEnv(false), killIt(false), + soManyHacksToMakeItDefleCompatible(false), vol(15), outVol(15), wave(-1),