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;
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);
}

View File

@ -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;
}