diff --git a/BizHawk.Client.Common/tools/Cheat.cs b/BizHawk.Client.Common/tools/Cheat.cs index f982fc187d..b3c57f219b 100644 --- a/BizHawk.Client.Common/tools/Cheat.cs +++ b/BizHawk.Client.Common/tools/Cheat.cs @@ -87,7 +87,7 @@ namespace BizHawk.Client.Common public int? Value { - get { return _watch.Value; } + get { return IsSeparator ? (int?)null : _val; } } public bool? BigEndian diff --git a/BizHawk.Client.Common/tools/CheatList.cs b/BizHawk.Client.Common/tools/CheatList.cs index 083380af75..2eaf79746e 100644 --- a/BizHawk.Client.Common/tools/CheatList.cs +++ b/BizHawk.Client.Common/tools/CheatList.cs @@ -48,6 +48,14 @@ namespace BizHawk.Client.Common get { return _cheatList[index]; } } + public Cheat this[MemoryDomain domain, int address] + { + get + { + return _cheatList.FirstOrDefault(cheat => cheat.Domain == domain && cheat.Address == address); + } + } + public void Pulse() { _cheatList.ForEach(cheat => cheat.Pulse()); @@ -94,11 +102,6 @@ namespace BizHawk.Client.Common Changes = false; } - public void Update() - { - _cheatList.ForEach(x => x.Pulse()); - } - public void Add(Cheat cheat) { if (cheat.IsSeparator) diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index b9b8f391c7..c327fb53bd 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -2538,6 +2538,7 @@ namespace BizHawk.Client.EmuHawk // client input-related duties GlobalWin.OSD.ClearGUIText(); + Global.CheatList.Pulse(); if (!isTurboing) { GlobalWin.Tools.UpdateToolsBefore(); @@ -2588,7 +2589,6 @@ namespace BizHawk.Client.EmuHawk coreskipaudio = Global.ClientControls["Turbo"] && _currAviWriter == null; - Global.CheatList.Pulse(); Global.Emulator.FrameAdvance(!_throttle.skipnextframe || _currAviWriter != null, !coreskipaudio); GlobalWin.DisplayManager.NeedsToPaint = true; Global.CheatList.Pulse(); diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index a2fb967458..82f2908298 100644 --- a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -527,7 +527,7 @@ namespace BizHawk.Client.EmuHawk { if (_addr + k < _domain.Size) { - rowStr.Append(Remap(_domain.PeekByte(_addr + k))); + rowStr.Append(Remap(MakeByte(_addr + k))); } } @@ -537,8 +537,20 @@ namespace BizHawk.Client.EmuHawk return rowStr.ToString(); } + private byte MakeByte(int address) + { + return Global.CheatList.IsActive(_domain, address) + ? (byte) Global.CheatList[_domain, address].Value.Value + : _domain.PeekByte(address); + } + private int MakeValue(int address) { + if (Global.CheatList.IsActive(_domain, address)) + { + return Global.CheatList[_domain, address].Value.Value; + } + switch (_dataSize) { default: