diff --git a/BizHawk.Client.Common/tools/Cheat.cs b/BizHawk.Client.Common/tools/Cheat.cs index 08ffc3ea38..5f42673c7f 100644 --- a/BizHawk.Client.Common/tools/Cheat.cs +++ b/BizHawk.Client.Common/tools/Cheat.cs @@ -292,6 +292,14 @@ namespace BizHawk.Client.Common } } + public void PokeValue(int val) + { + if (!IsSeparator) + { + _val = val; + } + } + public void Increment() { if (!IsSeparator) diff --git a/BizHawk.Client.Common/tools/Watch.cs b/BizHawk.Client.Common/tools/Watch.cs index 13c16c2684..2fdc45d000 100644 --- a/BizHawk.Client.Common/tools/Watch.cs +++ b/BizHawk.Client.Common/tools/Watch.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using BizHawk.Common; using BizHawk.Common.NumberExtensions; @@ -581,6 +582,16 @@ namespace BizHawk.Client.Common break; } + if (Global.CheatList.Contains(Domain, _address)) + { + var cheat = Global.CheatList.FirstOrDefault(c => c.Address == _address && c.Domain == Domain); + if (cheat != (Cheat)null) + { + cheat.PokeValue(val); + return true; + } + } + PokeByte(val); return true; } @@ -802,6 +813,16 @@ namespace BizHawk.Client.Common break; } + if (Global.CheatList.Contains(Domain, _address)) + { + var cheat = Global.CheatList.FirstOrDefault(c => c.Address == _address && c.Domain == Domain); + if (cheat != (Cheat)null) + { + cheat.PokeValue(val); + return true; + } + } + PokeWord(val); return true; } @@ -1016,6 +1037,16 @@ namespace BizHawk.Client.Common break; } + if (Global.CheatList.Contains(Domain, _address)) + { + var cheat = Global.CheatList.FirstOrDefault(c => c.Address == _address && c.Domain == Domain); + if (cheat != (Cheat)null) + { + cheat.PokeValue((int)val); + return true; + } + } + PokeDWord(val); return true; }