expose a possible IMonitor for memory domains, use it to speed up RAM Search for waterbox cores (25-30% speedup?)

see #3296
This commit is contained in:
CasualPokePlayer 2022-07-03 13:18:09 -07:00
parent f1162d4912
commit 596bd03ebe
3 changed files with 18 additions and 3 deletions

View File

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

View File

@ -27,6 +27,12 @@ namespace BizHawk.Emulation.Common
public bool Writable { get; protected set; }
/// <summary>
/// only use this if you are expecting to do a lot of peeks/pokes
/// MAY BE NULL
/// </summary>
public IMonitor Monitor { get; protected set; }
public abstract byte PeekByte(long addr);
public abstract void PokeByte(long addr, byte val);

View File

@ -51,6 +51,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
_addressMangler = 0;
}
Definition = m;
Monitor = _monitor;
}
}