From c08183f0822cbbca823da9825252736dbad48855 Mon Sep 17 00:00:00 2001 From: goyuken Date: Fri, 17 Jan 2014 19:53:57 +0000 Subject: [PATCH] NES: internal debugging infrastructure. when compiled in debug mode, throw if two boards both respond to configure. (in release mode, we short circuit there for speedup). also fix zeromus's fat fingers from r2011 --- .../Consoles/Nintendo/NES/BoardSystem.cs | 10 +++++++++- .../Consoles/Nintendo/NES/Boards/Mapper078.cs | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/BoardSystem.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/BoardSystem.cs index b471de51e9..e0b21fa53b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/BoardSystem.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/BoardSystem.cs @@ -449,6 +449,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES { NES nes = new NES(); nes.cart = cart; + Type ret = null; lock(INESBoardImplementors) foreach (var type in INESBoardImplementors) { @@ -464,11 +465,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES board.InitialRegisterValues = properties; if (board.Configure(origin)) { +#if DEBUG + if (ret != null) + throw new Exception(string.Format("Boards {0} and {1} both responded to Configure!", ret, type)); + else + ret = type; +#else return type; +#endif } } } - return null; + return ret; } /// diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs index 7daea6386c..50dcea1798 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs @@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES switch (Cart.board_type) { - case "MAPPER079": + case "MAPPER078": break; case "IREM-HOLYDIVER": holydiver = true;