From dd41cb6365271423d3b46fb0dbc7b6bd2008c773 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 1 Sep 2012 18:15:04 +0000 Subject: [PATCH] NES Cheats - fix so that only the system bus uses the built in cheat/game genie system --- BizHawk.MultiClient/tools/Cheat.cs | 19 ++++++++++++++----- BizHawk.MultiClient/tools/Cheats.cs | 3 +-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/BizHawk.MultiClient/tools/Cheat.cs b/BizHawk.MultiClient/tools/Cheat.cs index 6030b867fc..11e479cd4e 100644 --- a/BizHawk.MultiClient/tools/Cheat.cs +++ b/BizHawk.MultiClient/tools/Cheat.cs @@ -31,8 +31,13 @@ namespace BizHawk.MultiClient domain = c.domain; compare = c.compare; if (enabled) - MemoryPulse.Add(domain, address, value); - + { + Enable(); + } + else + { + Disable(); + } } public Cheat(string cname, int addr, byte val, bool e, MemoryDomain d, byte? comp = null) @@ -45,14 +50,18 @@ namespace BizHawk.MultiClient compare = comp; if (enabled) { - MemoryPulse.Add(domain, address, value, compare); + Enable(); + } + else + { + Disable(); } } public void Enable() { enabled = true; - if (Global.Emulator is NES) + if (Global.Emulator is NES && domain == Global.Emulator.MemoryDomains[1]) { (Global.Emulator as NES).ApplyGameGenie(address, value, compare); } @@ -70,7 +79,7 @@ namespace BizHawk.MultiClient public void DisposeOfCheat() { - if (Global.Emulator is NES) + if (Global.Emulator is NES && domain == Global.Emulator.MemoryDomains[1]) { (Global.Emulator as NES).RemoveGameGenie(address); } diff --git a/BizHawk.MultiClient/tools/Cheats.cs b/BizHawk.MultiClient/tools/Cheats.cs index a2ab2b5b65..cf3815fa43 100644 --- a/BizHawk.MultiClient/tools/Cheats.cs +++ b/BizHawk.MultiClient/tools/Cheats.cs @@ -621,14 +621,13 @@ namespace BizHawk.MultiClient { c.compare = (byte)(int.Parse(CompareBox.Text, NumberStyles.HexNumber)); } + c.domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex]; c.Enable(); } catch { return null; } - - c.domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex]; return c; }