Clean up dumb in GBHawk ctor

This commit is contained in:
YoshiRulz 2021-07-19 09:19:37 +10:00
parent 0892fb8733
commit 2077b19caa
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 8 additions and 34 deletions

View File

@ -127,41 +127,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
_ = PutSettings(settings ?? new GBSettings());
_syncSettings = (GBSyncSettings)syncSettings ?? new GBSyncSettings();
byte[] Bios = null;
is_GBC = _syncSettings.ConsoleMode switch
{
GBSyncSettings.ConsoleModeType.GB => false,
GBSyncSettings.ConsoleModeType.GBC => true,
_ => game.System is not "GB"
};
// Load up a BIOS and initialize the correct PPU
if (_syncSettings.ConsoleMode == GBSyncSettings.ConsoleModeType.Auto)
{
if (game.System == "GB")
{
Bios = comm.CoreFileProvider.GetFirmwareOrThrow(new("GB", "World"), "BIOS Not Found, Cannot Load");
ppu = new GB_PPU();
}
else
{
Bios = comm.CoreFileProvider.GetFirmwareOrThrow(new("GBC", "World"), "BIOS Not Found, Cannot Load");
ppu = new GBC_PPU();
is_GBC = true;
}
}
else if (_syncSettings.ConsoleMode == GBSyncSettings.ConsoleModeType.GB)
{
Bios = comm.CoreFileProvider.GetFirmwareOrThrow(new("GB", "World"), "BIOS Not Found, Cannot Load");
ppu = new GB_PPU();
}
else
{
Bios = comm.CoreFileProvider.GetFirmwareOrThrow(new("GBC", "World"), "BIOS Not Found, Cannot Load");
ppu = new GBC_PPU();
is_GBC = true;
}
if (Bios == null)
{
throw new MissingFirmwareException("Missing Gamboy Bios");
}
_bios = Bios;
_bios = comm.CoreFileProvider.GetFirmwareOrThrow(new(is_GBC ? "GBC" : "GB", "World"), "BIOS Not Found, Cannot Load");
ppu = is_GBC ? new GBC_PPU() : new GB_PPU();
// set up IR register to off state
if (is_GBC) { IR_mask = 0; IR_reg = 0x3E; IR_receive = 2; IR_self = 2; IR_signal = 2; }