From 21eed3e51248ccb735d72022a6569026be52b722 Mon Sep 17 00:00:00 2001 From: Natt Akuma Date: Mon, 18 Mar 2024 11:09:56 +0700 Subject: [PATCH] GB: Remove GBA-only system configs --- src/engine/platform/gb.cpp | 34 +++++++++++++++------------------- src/engine/platform/gb.h | 2 -- src/gui/presets.cpp | 12 ++---------- src/gui/sysConf.cpp | 25 ------------------------- 4 files changed, 17 insertions(+), 56 deletions(-) diff --git a/src/engine/platform/gb.cpp b/src/engine/platform/gb.cpp index 2ca894633..e942951ff 100644 --- a/src/engine/platform/gb.cpp +++ b/src/engine/platform/gb.cpp @@ -64,15 +64,13 @@ const char** DivPlatformGB::getRegisterSheet() { void DivPlatformGB::acquire(short** buf, size_t len) { for (size_t i=0; iapu_output.final_sample.left; buf[1][i]=gb->apu_output.final_sample.right; @@ -106,7 +104,7 @@ void DivPlatformGB::updateWave() { } antiClickWavePos&=63; } else { - rWrite(0x1a,extendWave?0x40:0); + rWrite(0x1a,model==GB_MODEL_AGB_NATIVE?0x40:0); for (int i=0; i<16; i++) { int nibble1=ws.output[((i<<1)+antiClickWavePos)&31]; int nibble2=ws.output[((1+(i<<1))+antiClickWavePos)&31]; @@ -189,7 +187,7 @@ void DivPlatformGB::tick(bool sysTick) { if (chan[i].outVol<0) chan[i].outVol=0; if (i==2) { - rWrite(16+i*5+2,(extendWave?gbVolMapEx:gbVolMap)[chan[i].outVol]); + rWrite(16+i*5+2,(model==GB_MODEL_AGB_NATIVE?gbVolMapEx:gbVolMap)[chan[i].outVol]); chan[i].soundLen=64; } else { chan[i].envLen=0; @@ -221,7 +219,7 @@ void DivPlatformGB::tick(bool sysTick) { rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(chan[i].soundLen&63))); } else if (!chan[i].softEnv) { if (parent->song.waveDutyIsVol) { - rWrite(16+i*5+2,(extendWave?gbVolMapEx:gbVolMap)[(chan[i].std.duty.val&3)<<2]); + rWrite(16+i*5+2,(model==GB_MODEL_AGB_NATIVE?gbVolMapEx:gbVolMap)[(chan[i].std.duty.val&3)<<2]); } } } @@ -335,7 +333,7 @@ void DivPlatformGB::tick(bool sysTick) { if (i==2) { // wave rWrite(16+i*5,0x00); rWrite(16+i*5,doubleWave?0xa0:0x80); - rWrite(16+i*5+2,(extendWave?gbVolMapEx:gbVolMap)[chan[i].outVol]); + rWrite(16+i*5+2,(model==GB_MODEL_AGB_NATIVE?gbVolMapEx:gbVolMap)[chan[i].outVol]); } else { rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(chan[i].soundLen&63))); rWrite(16+i*5+2,((chan[i].envVol<<4))|(chan[i].envLen&7)|((chan[i].envDir&1)<<3)); @@ -412,7 +410,7 @@ int DivPlatformGB::dispatch(DivCommand c) { chan[c.chan].softEnv=ins->gb.softEnv; chan[c.chan].macroInit(ins); if (c.chan==2) { - doubleWave=extendWave&&ins->gb.doubleWave; + doubleWave=(model==GB_MODEL_AGB_NATIVE) && ins->gb.doubleWave; if (chan[c.chan].wave<0) { chan[c.chan].wave=0; ws.changeWave1(chan[c.chan].wave); @@ -485,7 +483,7 @@ int DivPlatformGB::dispatch(DivCommand c) { chan[c.chan].vol=c.value; chan[c.chan].outVol=c.value; if (c.chan==2) { - rWrite(16+c.chan*5+2,(extendWave?gbVolMapEx:gbVolMap)[chan[c.chan].outVol]); + rWrite(16+c.chan*5+2,(model==GB_MODEL_AGB_NATIVE?gbVolMapEx:gbVolMap)[chan[c.chan].outVol]); } if (!chan[c.chan].softEnv) { chan[c.chan].envVol=chan[c.chan].vol; @@ -670,7 +668,7 @@ int DivPlatformGB::getOutputCount() { } bool DivPlatformGB::getDCOffRequired() { - return (model==GB_MODEL_AGB); + return (model==GB_MODEL_AGB_NATIVE); } void DivPlatformGB::notifyInsChange(int ins) { @@ -705,8 +703,6 @@ void DivPlatformGB::poke(std::vector& wlist) { void DivPlatformGB::setFlags(const DivConfig& flags) { antiClickEnabled=!flags.getBool("noAntiClick",false); - extendWave=flags.getBool("extendWave",false); - outDepth=flags.getInt("dacDepth",9); switch (flags.getInt("chipType",0)) { case 0: model=GB_MODEL_DMG_B; @@ -718,7 +714,7 @@ void DivPlatformGB::setFlags(const DivConfig& flags) { model=GB_MODEL_CGB_E; break; case 3: - model=extendWave?GB_MODEL_AGB_NATIVE:GB_MODEL_AGB; + model=GB_MODEL_AGB_NATIVE; break; } invertWave=flags.getBool("invertWave",true); @@ -726,7 +722,7 @@ void DivPlatformGB::setFlags(const DivConfig& flags) { chipClock=4194304; CHECK_CUSTOM_CLOCK; - rate=chipClock>>(outDepth-2); + rate=chipClock/16; for (int i=0; i<4; i++) { oscBuf[i]->rate=rate; } diff --git a/src/engine/platform/gb.h b/src/engine/platform/gb.h index 5bd445b7f..fa0484dff 100644 --- a/src/engine/platform/gb.h +++ b/src/engine/platform/gb.h @@ -59,10 +59,8 @@ class DivPlatformGB: public DivDispatch { bool antiClickEnabled; bool invertWave; bool enoughAlready; - bool extendWave; bool doubleWave; bool lastDoubleWave; - int outDepth; unsigned char lastPan; DivWaveSynth ws; struct QueuedWrite { diff --git a/src/gui/presets.cpp b/src/gui/presets.cpp index 9cbf192e4..4c96204d1 100644 --- a/src/gui/presets.cpp +++ b/src/gui/presets.cpp @@ -132,21 +132,13 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Game Boy Advance (no software mixing)", { - CH(DIV_SYSTEM_GB, 1.0f, 0, - "chipType=3\n" - "extendWave=true\n" - "dacDepth=9\n" - ), + CH(DIV_SYSTEM_GB, 1.0f, 0, "chipType=3"), CH(DIV_SYSTEM_GBA_DMA, 0.5f, 0, ""), } ); ENTRY( "Game Boy Advance (with MinMod)", { - CH(DIV_SYSTEM_GB, 1.0f, 0, - "chipType=3\n" - "extendWave=true\n" - "dacDepth=9\n" - ), + CH(DIV_SYSTEM_GB, 1.0f, 0, "chipType=3"), CH(DIV_SYSTEM_GBA_MINMOD, 0.5f, 0, ""), } ); diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index d6a2b043b..b62fe7f2a 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -330,8 +330,6 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl bool noAntiClick=flags.getBool("noAntiClick",false); bool invertWave=flags.getBool("invertWave",true); bool enoughAlready=flags.getBool("enoughAlready",false); - bool extendWave=flags.getBool("extendWave",false); - int dacDepth=flags.getInt("dacDepth",6); if (ImGui::Checkbox("Disable anti-click",&noAntiClick)) { altered=true; @@ -355,23 +353,6 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl altered=true; } ImGui::Unindent(); - ImGui::Text("Game Boy Advance:"); - ImGui::Indent(); - ImGui::BeginDisabled(chipType!=3); - if (ImGui::Checkbox("Wave channel extension",&extendWave)) { - altered=true; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("note: not supported by the VGM format!\nallows wave channel to have double length and 75%% volume"); - } - ImGui::Text("DAC bit depth (reduces output rate):"); - if (CWSliderInt("##DACDepth",&dacDepth,6,9)) { - if (dacDepth<6) dacDepth=6; - if (dacDepth>9) dacDepth=9; - altered=true; - } - ImGui::EndDisabled(); - ImGui::Unindent(); ImGui::Text("Wave channel orientation:"); if (chipType==3) { ImGui::Indent(); @@ -401,17 +382,11 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl } if (altered) { - if (chipType!=3) { - extendWave=false; - dacDepth=6; - } e->lockSave([&]() { flags.set("chipType",chipType); flags.set("noAntiClick",noAntiClick); flags.set("invertWave",invertWave); flags.set("enoughAlready",enoughAlready); - flags.set("extendWave",extendWave); - flags.set("dacDepth",dacDepth); }); } break;