diff --git a/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs b/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs index 9fe35b7c31..3c65cb4a53 100644 --- a/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs +++ b/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs @@ -198,10 +198,18 @@ namespace BizHawk.Client.Common.RamSearchEngine { if (_settings.IsDetailed()) { - foreach (IMiniWatchDetails watch in _watchList) - { - watch.Update(_settings.PreviousType, _settings.Domain, _settings.BigEndian); + try + { + _settings.Domain.Monitor?.Enter(); + foreach (IMiniWatchDetails watch in _watchList) + { + watch.Update(_settings.PreviousType, _settings.Domain, _settings.BigEndian); + } } + finally + { + _settings.Domain.Monitor?.Exit(); + } } } diff --git a/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs b/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs index 6b83f3c7f3..c488ebf1a1 100644 --- a/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs +++ b/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs @@ -27,6 +27,12 @@ namespace BizHawk.Emulation.Common public bool Writable { get; protected set; } + /// + /// only use this if you are expecting to do a lot of peeks/pokes + /// MAY BE NULL + /// + public IMonitor Monitor { get; protected set; } + public abstract byte PeekByte(long addr); public abstract void PokeByte(long addr, byte val); diff --git a/src/BizHawk.Emulation.Cores/Waterbox/WaterboxMemoryDomain.cs b/src/BizHawk.Emulation.Cores/Waterbox/WaterboxMemoryDomain.cs index 5e0d8a31fb..306aa21161 100644 --- a/src/BizHawk.Emulation.Cores/Waterbox/WaterboxMemoryDomain.cs +++ b/src/BizHawk.Emulation.Cores/Waterbox/WaterboxMemoryDomain.cs @@ -51,6 +51,7 @@ namespace BizHawk.Emulation.Cores.Waterbox _addressMangler = 0; } Definition = m; + Monitor = _monitor; } }