diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs index 3cb8414cb4..fb41292935 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs @@ -85,16 +85,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy [DefaultValue(false)] public bool EnableBIOS { get; set; } - [DisplayName("Console Mode")] - [Description("Pick which console to run, 'Default' chooses from ROM extension, 'GB' and 'GBC' chooses the respective system")] - [DefaultValue("Default")] - public string ConsoleMode + public enum ConsoleModeType { - get { return _ConsoleMode; } - set { _ConsoleMode = value;} + Auto, + GB, + GBC } - [JsonIgnore] - private string _ConsoleMode; + + [DisplayName("Console Mode")] + [Description("Pick which console to run, 'Auto' chooses from ROM header, 'GB' and 'GBC' chooses the respective system")] + [DefaultValue(ConsoleModeType.Auto)] + public ConsoleModeType ConsoleMode { get; set; } [DisplayName("CGB in GBA")] [Description("Emulate GBA hardware running a CGB game, instead of CGB hardware. Relevant only for titles that detect the presense of a GBA, such as Shantae.")] diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs index 7b2d03c371..dd2b855fba 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -58,12 +58,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy if (game.System == "GB") { - BiosRom = new byte[256]; BiosRom = comm.CoreFileProvider.GetFirmware("GB", "World", false); } else { - BiosRom = new byte[2304]; BiosRom = comm.CoreFileProvider.GetFirmware("GBC", "World", false); } @@ -80,32 +78,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy LibGambatte.LoadFlags flags = 0; - if (_syncSettings.ConsoleMode=="GB") + switch (_syncSettings.ConsoleMode) { - flags |= LibGambatte.LoadFlags.FORCE_DMG; - - // we need to change the BIOS to GB bios - if (game.System == "GBC") - { - BiosRom = null; - BiosRom = new byte[256]; - BiosRom = comm.CoreFileProvider.GetFirmware("GB", "World", false); - bios_length = BiosRom.Length; - } - - } - else if (_syncSettings.ConsoleMode == "GBC") - { - BiosRom = null; - BiosRom = new byte[2304]; - BiosRom = comm.CoreFileProvider.GetFirmware("GBC", "World", false); - bios_length = BiosRom.Length; - - } - else - { - if(game.System == "GB") + case GambatteSyncSettings.ConsoleModeType.GB: flags |= LibGambatte.LoadFlags.FORCE_DMG; + // we need to change the BIOS to GB bios + if (game.System == "GBC") + { + BiosRom = comm.CoreFileProvider.GetFirmware("GB", "World", false); + bios_length = BiosRom.Length; + } + break; + case GambatteSyncSettings.ConsoleModeType.GBC: + BiosRom = comm.CoreFileProvider.GetFirmware("GBC", "World", false); + bios_length = BiosRom.Length; + break; + default: + if (game.System == "GB") + flags |= LibGambatte.LoadFlags.FORCE_DMG; + break; } if (_syncSettings.EnableBIOS && BiosRom == null) @@ -351,7 +342,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy LibGambatte.gambatte_settracecallback(GambatteState, _tracecb); - LibGambatte.gambatte_setlayers(GambatteState, (_settings.DisplayBG ? 1 : 0) | (_settings.DisplayOBJ ? 2 : 0) | (_settings.DisplayWindow ? 4 : 0 ) ); + LibGambatte.gambatte_setlayers(GambatteState, (_settings.DisplayBG ? 1 : 0) | (_settings.DisplayOBJ ? 2 : 0) | (_settings.DisplayWindow ? 4 : 0)); } internal void FrameAdvancePost()