diff --git a/src/engine/platform/gb.cpp b/src/engine/platform/gb.cpp index fe9637362..9a5d6d7d4 100644 --- a/src/engine/platform/gb.cpp +++ b/src/engine/platform/gb.cpp @@ -82,8 +82,12 @@ void DivPlatformGB::acquire(short** buf, size_t len) { void DivPlatformGB::updateWave() { rWrite(0x1a,0); for (int i=0; i<16; i++) { - int nibble1=15-ws.output[((i<<1)+antiClickWavePos)&31]; - int nibble2=15-ws.output[((1+(i<<1))+antiClickWavePos)&31]; + int nibble1=ws.output[((i<<1)+antiClickWavePos)&31]; + int nibble2=ws.output[((1+(i<<1))+antiClickWavePos)&31]; + if (invertWave) { + nibble1^=15; + nibble2^=15; + } rWrite(0x30+i,(nibble1<<4)|nibble2); } antiClickWavePos&=31; @@ -658,6 +662,7 @@ void DivPlatformGB::setFlags(const DivConfig& flags) { model=GB_MODEL_AGB; break; } + invertWave=flags.getBool("invertWave",true); enoughAlready=flags.getBool("enoughAlready",false); } diff --git a/src/engine/platform/gb.h b/src/engine/platform/gb.h index f75cc62c2..8ba70a913 100644 --- a/src/engine/platform/gb.h +++ b/src/engine/platform/gb.h @@ -57,6 +57,7 @@ class DivPlatformGB: public DivDispatch { DivDispatchOscBuffer* oscBuf[4]; bool isMuted[4]; bool antiClickEnabled; + bool invertWave; bool enoughAlready; unsigned char lastPan; DivWaveSynth ws; diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 3e36ad857..5da9ed32c 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -310,6 +310,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 invertWave=flags.getBool("invertWave",true); bool enoughAlready=flags.getBool("enoughAlready",false); if (ImGui::Checkbox("Disable anti-click",&noAntiClick)) { @@ -332,6 +333,26 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo chipType=3; altered=true; } + ImGui::Text("Wave channel orientation:"); + if (chipType==3) { + if (ImGui::RadioButton("Normal",!invertWave)) { + invertWave=false; + altered=true; + } + if (ImGui::RadioButton("Inverted",invertWave)) { + invertWave=true; + altered=true; + } + } else { + if (ImGui::RadioButton("Exact data (inverted)",!invertWave)) { + invertWave=false; + altered=true; + } + if (ImGui::RadioButton("Exact output (normal)",invertWave)) { + invertWave=true; + altered=true; + } + } if (ImGui::Checkbox("Pretty please one more compat flag when I use arpeggio and my sound length",&enoughAlready)) { altered=true; } @@ -340,6 +361,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo e->lockSave([&]() { flags.set("chipType",chipType); flags.set("noAntiClick",noAntiClick); + flags.set("invertWave",invertWave); flags.set("enoughAlready",enoughAlready); }); }