diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index f600725212..8923d0c560 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -319,6 +319,7 @@ Cheats.cs + Component diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 163a331d46..a5ed0a9a31 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -12,6 +12,7 @@ using BizHawk.Emulation.Consoles.TurboGrafx; using BizHawk.Emulation.Consoles.Calculator; using BizHawk.Emulation.Consoles.Gameboy; using BizHawk.Emulation.Consoles.Nintendo; +using BizHawk.MultiClient.tools; namespace BizHawk.MultiClient { @@ -1486,7 +1487,9 @@ namespace BizHawk.MultiClient //} //======================================= + MemoryPulse.Pulse(); Global.Emulator.FrameAdvance(!throttle.skipnextframe); + MemoryPulse.Pulse(); //======================================= if (CurrAviWriter != null) @@ -1938,9 +1941,10 @@ namespace BizHawk.MultiClient private void CloseROM() { - CloseGame(); + CloseGame(); Global.Emulator = new NullEmulator(); Global.Game = new NullGame(); + MemoryPulse.Clear(); RamSearch1.Restart(); RamWatch1.Restart(); HexEditor1.Restart(); diff --git a/BizHawk.MultiClient/tools/Cheat.cs b/BizHawk.MultiClient/tools/Cheat.cs index ddb2f453fe..308136b5c7 100644 --- a/BizHawk.MultiClient/tools/Cheat.cs +++ b/BizHawk.MultiClient/tools/Cheat.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using BizHawk.MultiClient.tools; namespace BizHawk.MultiClient { @@ -44,13 +41,13 @@ namespace BizHawk.MultiClient public void Enable() { enabled = true; - //domain.SetFreeze(address, new MemoryDomain.FreezeData(MemoryDomain.FreezeData.Flag.Frozen, value)); + MemoryPulse.Add(domain, address, value); } public void Disable() { enabled = false; - //domain.ClearFreeze(address); + MemoryPulse.Remove(domain, address); } public bool IsEnabled() diff --git a/BizHawk.MultiClient/tools/Cheats.cs b/BizHawk.MultiClient/tools/Cheats.cs index 2cb2202f49..d35a6a0d2a 100644 --- a/BizHawk.MultiClient/tools/Cheats.cs +++ b/BizHawk.MultiClient/tools/Cheats.cs @@ -157,10 +157,6 @@ namespace BizHawk.MultiClient default: break; case "GB": - case "SMS": - case "SG": - case "GG": - case "PCE": AddCheatGroup.Enabled = false; CheatListView.Enabled = false; MessageLabel.Text = Global.Emulator.SystemId + " not supported."; diff --git a/BizHawk.MultiClient/tools/MemoryPulse.cs b/BizHawk.MultiClient/tools/MemoryPulse.cs new file mode 100644 index 0000000000..e5c882f6ac --- /dev/null +++ b/BizHawk.MultiClient/tools/MemoryPulse.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; + +namespace BizHawk.MultiClient.tools +{ + public static class MemoryPulse + { + public class MemoryPulseEntry + { + public int address; + public byte value; + public MemoryDomain domain; + } + + private static List entries = new List(); + + public static void Pulse() + { + foreach (var entry in entries) + { + entry.domain.PokeByte(entry.address, entry.value); + } + } + + public static void Add(MemoryDomain domain, int address, byte value) + { + entries.RemoveAll(o => o.domain == domain && o.address == address); + + var entry = new MemoryPulseEntry {address = address, value = value, domain = domain}; + entries.Add(entry); + } + + public static MemoryPulseEntry Query(MemoryDomain domain, int address) + { + return entries.Find(o => o.domain == domain && o.address == address); + } + + public static void Remove(MemoryDomain domain, int address) + { + entries.RemoveAll(o => o.domain == domain && o.address == address); + } + + public static IList GetEntries() + { + return entries.AsReadOnly(); + } + + public static void Clear() + { + entries.Clear(); + } + } +}