From ff95066672ede2d69152ae82fd5713bb4f29f6c2 Mon Sep 17 00:00:00 2001 From: goyuken Date: Wed, 29 Oct 2014 18:58:43 +0000 Subject: [PATCH] quicknes: reject (with the appropriate unsupported exception) any bootgod positive euro rom --- BizHawk.Client.Common/RomLoader.cs | 2 +- .../EmulationExceptions.cs | 7 ++++-- .../Consoles/Nintendo/Gameboy/Gambatte.cs | 24 +++++++++---------- .../Consoles/Nintendo/QuickNES/LibQuickNES.cs | 2 +- .../Consoles/Nintendo/QuickNES/QuickNES.cs | 12 ++++++++++ 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/BizHawk.Client.Common/RomLoader.cs b/BizHawk.Client.Common/RomLoader.cs index f5b8a903a6..ba1472454e 100644 --- a/BizHawk.Client.Common/RomLoader.cs +++ b/BizHawk.Client.Common/RomLoader.cs @@ -433,7 +433,7 @@ namespace BizHawk.Client.Common ex = ex.InnerException; // Specific hack here, as we get more cores of the same system, this isn't scalable - if (ex is UnsupportedMapperException) + if (ex is UnsupportedGameException) { return LoadRom(path, nextComm, forceAccurateCore: true); } diff --git a/BizHawk.Emulation.Common/EmulationExceptions.cs b/BizHawk.Emulation.Common/EmulationExceptions.cs index 6847a077d8..81e895a24f 100644 --- a/BizHawk.Emulation.Common/EmulationExceptions.cs +++ b/BizHawk.Emulation.Common/EmulationExceptions.cs @@ -10,9 +10,12 @@ namespace BizHawk.Emulation.Common } } - public class UnsupportedMapperException : InvalidOperationException + /// + /// indicates that this core does not support the game, but it may be valid + /// + public class UnsupportedGameException : InvalidOperationException { - public UnsupportedMapperException(string message) + public UnsupportedGameException(string message) : base(message) { diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs index e2ea3de0e3..a082c54fee 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -414,9 +414,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy case 0x08: break; case 0x09: break; - case 0x0b: throw new UnsupportedMapperException("\"MM01\" Mapper not supported!"); - case 0x0c: throw new UnsupportedMapperException("\"MM01\" Mapper not supported!"); - case 0x0d: throw new UnsupportedMapperException("\"MM01\" Mapper not supported!"); + case 0x0b: throw new UnsupportedGameException("\"MM01\" Mapper not supported!"); + case 0x0c: throw new UnsupportedGameException("\"MM01\" Mapper not supported!"); + case 0x0d: throw new UnsupportedGameException("\"MM01\" Mapper not supported!"); case 0x0f: break; case 0x10: break; @@ -424,9 +424,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy case 0x12: break; case 0x13: break; - case 0x15: throw new UnsupportedMapperException("\"MBC4\" Mapper not supported!"); - case 0x16: throw new UnsupportedMapperException("\"MBC4\" Mapper not supported!"); - case 0x17: throw new UnsupportedMapperException("\"MBC4\" Mapper not supported!"); + case 0x15: throw new UnsupportedGameException("\"MBC4\" Mapper not supported!"); + case 0x16: throw new UnsupportedGameException("\"MBC4\" Mapper not supported!"); + case 0x17: throw new UnsupportedGameException("\"MBC4\" Mapper not supported!"); case 0x19: break; case 0x1a: break; @@ -435,14 +435,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy case 0x1d: break; // rumble case 0x1e: break; // rumble - case 0x20: throw new UnsupportedMapperException("\"MBC6\" Mapper not supported!"); - case 0x22: throw new UnsupportedMapperException("\"MBC7\" Mapper not supported!"); + case 0x20: throw new UnsupportedGameException("\"MBC6\" Mapper not supported!"); + case 0x22: throw new UnsupportedGameException("\"MBC7\" Mapper not supported!"); - case 0xfc: throw new UnsupportedMapperException("\"Pocket Camera\" Mapper not supported!"); - case 0xfd: throw new UnsupportedMapperException("\"Bandai TAMA5\" Mapper not supported!"); - case 0xfe: throw new UnsupportedMapperException("\"HuC3\" Mapper not supported!"); + case 0xfc: throw new UnsupportedGameException("\"Pocket Camera\" Mapper not supported!"); + case 0xfd: throw new UnsupportedGameException("\"Bandai TAMA5\" Mapper not supported!"); + case 0xfe: throw new UnsupportedGameException("\"HuC3\" Mapper not supported!"); case 0xff: break; - default: throw new UnsupportedMapperException(string.Format("Unknown mapper: {0:x2}", romdata[0x147])); + default: throw new UnsupportedGameException(string.Format("Unknown mapper: {0:x2}", romdata[0x147])); } return; } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/LibQuickNES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/LibQuickNES.cs index 952192cb00..75a54fab96 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/LibQuickNES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/LibQuickNES.cs @@ -226,7 +226,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES string s = Marshal.PtrToStringAnsi(p); if (s == "Unsupported mapper" || s == "Not an iNES file") // Not worth making a new exception for the iNES error, they ultimately are the same problem { - throw new Emulation.Common.UnsupportedMapperException("Quicknes unsupported mapper"); + throw new Emulation.Common.UnsupportedGameException("Quicknes unsupported mapper"); } else { diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs index f494982c5f..b2d43d0f09 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs @@ -10,6 +10,7 @@ using Newtonsoft.Json; using BizHawk.Common.BufferExtensions; using BizHawk.Emulation.Common; using BizHawk.Common; +using BizHawk.Common.CollectionExtensions; namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES { @@ -395,6 +396,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES if (carts.Count > 0) { Console.WriteLine("BootGod entry found: {0}", carts[0].name); + switch (carts[0].system) + { + case "NES-PAL": + case "NES-PAL-A": + case "NES-PAL-B": + case "Dendy": + Console.WriteLine("Bad region {0}! Failing over...", carts[0].system); + throw new UnsupportedGameException("Unsupported region!"); + default: + break; + } BootGodStatus = RomStatus.GoodDump; BootGodName = carts[0].name; }