From ddf99f789c2d39563343ef2eec74bb7ae13766cd Mon Sep 17 00:00:00 2001 From: goyuken Date: Sat, 29 Sep 2012 23:21:55 +0000 Subject: [PATCH] when attempting to load SGB, unset SGB config mode if we fail to load the bios file. this avoids a catch-22 where you can't load an SGB because you don't have a rom, and you can't reset to GB mode because you can't get the menu item. --- BizHawk.MultiClient/MainForm.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 4013b4a06e..486aee6677 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1469,7 +1469,17 @@ namespace BizHawk.MultiClient else { // todo: get these bioses into a gamedb?? - byte[] sgbrom = File.ReadAllBytes(PathManager.MakeAbsolutePath(Global.Config.PathSGBRom, "SGB")); + byte[] sgbrom; + try + { + sgbrom = File.ReadAllBytes(PathManager.MakeAbsolutePath(Global.Config.PathSGBRom, "SGB")); + } + catch (Exception) + { + // failed to load SGB bios. to avoid catch-22, disable SGB mode + Global.Config.GB_AsSGB = false; + throw; + } game.AddOption("SGB"); game.System = "SGB"; var snes = new LibsnesCore();