GB: Remove GBA-only system configs

This commit is contained in:
Natt Akuma 2024-03-18 11:09:56 +07:00
parent 1bdbd640ec
commit 21eed3e512
4 changed files with 17 additions and 56 deletions

View file

@ -64,7 +64,6 @@ const char** DivPlatformGB::getRegisterSheet() {
void DivPlatformGB::acquire(short** buf, size_t len) { void DivPlatformGB::acquire(short** buf, size_t len) {
for (size_t i=0; i<len; i++) { for (size_t i=0; i<len; i++) {
for (int j=0; j<(1<<(outDepth-6)); j++) {
if (!writes.empty()) { if (!writes.empty()) {
QueuedWrite& w=writes.front(); QueuedWrite& w=writes.front();
GB_apu_write(gb,w.addr,w.val); GB_apu_write(gb,w.addr,w.val);
@ -72,7 +71,6 @@ void DivPlatformGB::acquire(short** buf, size_t len) {
} }
GB_advance_cycles(gb,16); GB_advance_cycles(gb,16);
}
buf[0][i]=gb->apu_output.final_sample.left; buf[0][i]=gb->apu_output.final_sample.left;
buf[1][i]=gb->apu_output.final_sample.right; buf[1][i]=gb->apu_output.final_sample.right;
@ -106,7 +104,7 @@ void DivPlatformGB::updateWave() {
} }
antiClickWavePos&=63; antiClickWavePos&=63;
} else { } else {
rWrite(0x1a,extendWave?0x40:0); rWrite(0x1a,model==GB_MODEL_AGB_NATIVE?0x40:0);
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
int nibble1=ws.output[((i<<1)+antiClickWavePos)&31]; int nibble1=ws.output[((i<<1)+antiClickWavePos)&31];
int nibble2=ws.output[((1+(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 (chan[i].outVol<0) chan[i].outVol=0;
if (i==2) { 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; chan[i].soundLen=64;
} else { } else {
chan[i].envLen=0; 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))); rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(chan[i].soundLen&63)));
} else if (!chan[i].softEnv) { } else if (!chan[i].softEnv) {
if (parent->song.waveDutyIsVol) { 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 if (i==2) { // wave
rWrite(16+i*5,0x00); rWrite(16+i*5,0x00);
rWrite(16+i*5,doubleWave?0xa0:0x80); 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 { } else {
rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(chan[i].soundLen&63))); 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)); 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].softEnv=ins->gb.softEnv;
chan[c.chan].macroInit(ins); chan[c.chan].macroInit(ins);
if (c.chan==2) { if (c.chan==2) {
doubleWave=extendWave&&ins->gb.doubleWave; doubleWave=(model==GB_MODEL_AGB_NATIVE) && ins->gb.doubleWave;
if (chan[c.chan].wave<0) { if (chan[c.chan].wave<0) {
chan[c.chan].wave=0; chan[c.chan].wave=0;
ws.changeWave1(chan[c.chan].wave); ws.changeWave1(chan[c.chan].wave);
@ -485,7 +483,7 @@ int DivPlatformGB::dispatch(DivCommand c) {
chan[c.chan].vol=c.value; chan[c.chan].vol=c.value;
chan[c.chan].outVol=c.value; chan[c.chan].outVol=c.value;
if (c.chan==2) { 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) { if (!chan[c.chan].softEnv) {
chan[c.chan].envVol=chan[c.chan].vol; chan[c.chan].envVol=chan[c.chan].vol;
@ -670,7 +668,7 @@ int DivPlatformGB::getOutputCount() {
} }
bool DivPlatformGB::getDCOffRequired() { bool DivPlatformGB::getDCOffRequired() {
return (model==GB_MODEL_AGB); return (model==GB_MODEL_AGB_NATIVE);
} }
void DivPlatformGB::notifyInsChange(int ins) { void DivPlatformGB::notifyInsChange(int ins) {
@ -705,8 +703,6 @@ void DivPlatformGB::poke(std::vector<DivRegWrite>& wlist) {
void DivPlatformGB::setFlags(const DivConfig& flags) { void DivPlatformGB::setFlags(const DivConfig& flags) {
antiClickEnabled=!flags.getBool("noAntiClick",false); antiClickEnabled=!flags.getBool("noAntiClick",false);
extendWave=flags.getBool("extendWave",false);
outDepth=flags.getInt("dacDepth",9);
switch (flags.getInt("chipType",0)) { switch (flags.getInt("chipType",0)) {
case 0: case 0:
model=GB_MODEL_DMG_B; model=GB_MODEL_DMG_B;
@ -718,7 +714,7 @@ void DivPlatformGB::setFlags(const DivConfig& flags) {
model=GB_MODEL_CGB_E; model=GB_MODEL_CGB_E;
break; break;
case 3: case 3:
model=extendWave?GB_MODEL_AGB_NATIVE:GB_MODEL_AGB; model=GB_MODEL_AGB_NATIVE;
break; break;
} }
invertWave=flags.getBool("invertWave",true); invertWave=flags.getBool("invertWave",true);
@ -726,7 +722,7 @@ void DivPlatformGB::setFlags(const DivConfig& flags) {
chipClock=4194304; chipClock=4194304;
CHECK_CUSTOM_CLOCK; CHECK_CUSTOM_CLOCK;
rate=chipClock>>(outDepth-2); rate=chipClock/16;
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;
} }

View file

@ -59,10 +59,8 @@ class DivPlatformGB: public DivDispatch {
bool antiClickEnabled; bool antiClickEnabled;
bool invertWave; bool invertWave;
bool enoughAlready; bool enoughAlready;
bool extendWave;
bool doubleWave; bool doubleWave;
bool lastDoubleWave; bool lastDoubleWave;
int outDepth;
unsigned char lastPan; unsigned char lastPan;
DivWaveSynth ws; DivWaveSynth ws;
struct QueuedWrite { struct QueuedWrite {

View file

@ -132,21 +132,13 @@ void FurnaceGUI::initSystemPresets() {
); );
ENTRY( ENTRY(
"Game Boy Advance (no software mixing)", { "Game Boy Advance (no software mixing)", {
CH(DIV_SYSTEM_GB, 1.0f, 0, CH(DIV_SYSTEM_GB, 1.0f, 0, "chipType=3"),
"chipType=3\n"
"extendWave=true\n"
"dacDepth=9\n"
),
CH(DIV_SYSTEM_GBA_DMA, 0.5f, 0, ""), CH(DIV_SYSTEM_GBA_DMA, 0.5f, 0, ""),
} }
); );
ENTRY( ENTRY(
"Game Boy Advance (with MinMod)", { "Game Boy Advance (with MinMod)", {
CH(DIV_SYSTEM_GB, 1.0f, 0, CH(DIV_SYSTEM_GB, 1.0f, 0, "chipType=3"),
"chipType=3\n"
"extendWave=true\n"
"dacDepth=9\n"
),
CH(DIV_SYSTEM_GBA_MINMOD, 0.5f, 0, ""), CH(DIV_SYSTEM_GBA_MINMOD, 0.5f, 0, ""),
} }
); );

View file

@ -330,8 +330,6 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
bool noAntiClick=flags.getBool("noAntiClick",false); bool noAntiClick=flags.getBool("noAntiClick",false);
bool invertWave=flags.getBool("invertWave",true); bool invertWave=flags.getBool("invertWave",true);
bool enoughAlready=flags.getBool("enoughAlready",false); 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)) { if (ImGui::Checkbox("Disable anti-click",&noAntiClick)) {
altered=true; altered=true;
@ -355,23 +353,6 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
altered=true; altered=true;
} }
ImGui::Unindent(); 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:"); ImGui::Text("Wave channel orientation:");
if (chipType==3) { if (chipType==3) {
ImGui::Indent(); ImGui::Indent();
@ -401,17 +382,11 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
} }
if (altered) { if (altered) {
if (chipType!=3) {
extendWave=false;
dacDepth=6;
}
e->lockSave([&]() { e->lockSave([&]() {
flags.set("chipType",chipType); flags.set("chipType",chipType);
flags.set("noAntiClick",noAntiClick); flags.set("noAntiClick",noAntiClick);
flags.set("invertWave",invertWave); flags.set("invertWave",invertWave);
flags.set("enoughAlready",enoughAlready); flags.set("enoughAlready",enoughAlready);
flags.set("extendWave",extendWave);
flags.set("dacDepth",dacDepth);
}); });
} }
break; break;