GB Audio: Properly apply per-model audio differences

This commit is contained in:
Vicki Pfau 2022-04-22 02:59:15 -07:00
parent 979be972dc
commit dcdd6d2dd2
2 changed files with 18 additions and 17 deletions

View File

@ -19,6 +19,7 @@ Emulation fixes:
- ARM7: Fix unsigned multiply timing
- GB: Copy logo from ROM if not running the BIOS intro (fixes mgba.io/i/2378)
- GB Audio: Fix channel 1/2 reseting edge cases (fixes mgba.io/i/1925)
- GB Audio: Properly apply per-model audio differences
- GB Memory: Add cursory cartridge open bus emulation (fixes mgba.io/i/2032)
- GB Serialize: Fix loading MBC1 states that affect bank 0 (fixes mgba.io/i/2402)
- GB Video: Draw SGB border pieces that overlap GB graphics (fixes mgba.io/i/1339)

View File

@ -556,6 +556,23 @@ void GBReset(struct SM83Core* cpu) {
}
}
switch (gb->model) {
case GB_MODEL_DMG:
case GB_MODEL_SGB:
case GB_MODEL_AUTODETECT: //Silence warnings
gb->audio.style = GB_AUDIO_DMG;
break;
case GB_MODEL_MGB:
case GB_MODEL_SGB2:
gb->audio.style = GB_AUDIO_MGB;
break;
case GB_MODEL_AGB:
case GB_MODEL_CGB:
case GB_MODEL_SCGB:
gb->audio.style = GB_AUDIO_CGB;
break;
}
GBVideoReset(&gb->video);
GBTimerReset(&gb->timer);
GBIOReset(gb);
@ -779,23 +796,6 @@ void GBDetectModel(struct GB* gb) {
gb->model = GB_MODEL_DMG;
}
}
switch (gb->model) {
case GB_MODEL_DMG:
case GB_MODEL_SGB:
case GB_MODEL_AUTODETECT: //Silence warnings
gb->audio.style = GB_AUDIO_DMG;
break;
case GB_MODEL_MGB:
case GB_MODEL_SGB2:
gb->audio.style = GB_AUDIO_MGB;
break;
case GB_MODEL_AGB:
case GB_MODEL_CGB:
case GB_MODEL_SCGB:
gb->audio.style = GB_AUDIO_CGB;
break;
}
}
int GBValidModels(const uint8_t* bank0) {