initial attempt at a firmware fallback for Gambatte's clean room patch

This commit is contained in:
TiKevin83 2020-09-26 19:12:58 -04:00
parent bb0e92a830
commit be25ad0bc8
1 changed files with 13 additions and 1 deletions

View File

@ -103,7 +103,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
if (_syncSettings.EnableBIOS)
{
bios = comm.CoreFileProvider.GetFirmware(biosSystemId, biosId, true, "BIOS Not Found, Cannot Load. Change SyncSettings to run without BIOS.");
try {
bios = comm.CoreFileProvider.GetFirmware(biosSystemId, biosId, true, "BIOS Not Found, Cannot Load. Change SyncSettings to run without BIOS.");
} catch (MissingFirmwareException) {
if (_syncSettings.GBACGB && IsCgb) {
bios = comm.CoreFileProvider.GetFirmware(biosSystemId, "World", true, "BIOS Not Found, Cannot Load. Change SyncSettings to run without BIOS.");
byte[] agbOverride = { 0xFF, 0x00, 0xCD, 0x03, 0x35, 0xAA, 0x31, 0x90, 0x94, 0x00, 0x00, 0x00, 0x00 };
for (int i = 0xF3; i < 0x100; i++) {
bios[i] = (byte)((agbOverride[i - 0xF3] + bios[i]) & 0xFF);
}
} else {
bios = comm.CoreFileProvider.GetFirmware(biosSystemId, biosId, true, "BIOS Not Found, Cannot Load. Change SyncSettings to run without BIOS.");
}
}
}
else
{