NES Cheats - fix so that only the system bus uses the built in cheat/game genie system

This commit is contained in:
adelikat 2012-09-01 18:15:04 +00:00
parent c1d2272aec
commit dd41cb6365
2 changed files with 15 additions and 7 deletions

View File

@ -31,8 +31,13 @@ namespace BizHawk.MultiClient
domain = c.domain; domain = c.domain;
compare = c.compare; compare = c.compare;
if (enabled) 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) public Cheat(string cname, int addr, byte val, bool e, MemoryDomain d, byte? comp = null)
@ -45,14 +50,18 @@ namespace BizHawk.MultiClient
compare = comp; compare = comp;
if (enabled) if (enabled)
{ {
MemoryPulse.Add(domain, address, value, compare); Enable();
}
else
{
Disable();
} }
} }
public void Enable() public void Enable()
{ {
enabled = true; 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); (Global.Emulator as NES).ApplyGameGenie(address, value, compare);
} }
@ -70,7 +79,7 @@ namespace BizHawk.MultiClient
public void DisposeOfCheat() public void DisposeOfCheat()
{ {
if (Global.Emulator is NES) if (Global.Emulator is NES && domain == Global.Emulator.MemoryDomains[1])
{ {
(Global.Emulator as NES).RemoveGameGenie(address); (Global.Emulator as NES).RemoveGameGenie(address);
} }

View File

@ -621,14 +621,13 @@ namespace BizHawk.MultiClient
{ {
c.compare = (byte)(int.Parse(CompareBox.Text, NumberStyles.HexNumber)); c.compare = (byte)(int.Parse(CompareBox.Text, NumberStyles.HexNumber));
} }
c.domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex];
c.Enable(); c.Enable();
} }
catch catch
{ {
return null; return null;
} }
c.domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex];
return c; return c;
} }