diff --git a/BizHawk.Client.Common/tools/RamSearchEngine.cs b/BizHawk.Client.Common/tools/RamSearchEngine.cs index a921d2ca92..215eded2cb 100644 --- a/BizHawk.Client.Common/tools/RamSearchEngine.cs +++ b/BizHawk.Client.Common/tools/RamSearchEngine.cs @@ -89,14 +89,14 @@ namespace BizHawk.Client.Common case Watch.WatchSize.Word: if (_settings.Mode == Settings.SearchMode.Detailed) { - for (int i = 0; i < domain.Size; i += _settings.CheckMisAligned ? 1 : 2) + for (int i = 0; i < domain.Size - 1; i += _settings.CheckMisAligned ? 1 : 2) { _watchList.Add(new MiniWordWatchDetailed(domain, i, _settings.BigEndian)); } } else { - for (int i = 0; i < domain.Size; i += _settings.CheckMisAligned ? 1 : 2) + for (int i = 0; i < domain.Size - 1; i += _settings.CheckMisAligned ? 1 : 2) { _watchList.Add(new MiniWordWatch(domain, i, _settings.BigEndian)); } @@ -106,14 +106,14 @@ namespace BizHawk.Client.Common case Watch.WatchSize.DWord: if (_settings.Mode == Settings.SearchMode.Detailed) { - for (int i = 0; i < domain.Size; i += _settings.CheckMisAligned ? 1 : 4) + for (int i = 0; i < domain.Size - 3; i += _settings.CheckMisAligned ? 1 : 4) { _watchList.Add(new MiniDWordWatchDetailed(domain, i, _settings.BigEndian)); } } else { - for (int i = 0; i < domain.Size; i += _settings.CheckMisAligned ? 1 : 4) + for (int i = 0; i < domain.Size - 3; i += _settings.CheckMisAligned ? 1 : 4) { _watchList.Add(new MiniDWordWatch(domain, i, _settings.BigEndian)); } @@ -751,7 +751,7 @@ namespace BizHawk.Client.Common } case Watch.WatchSize.Word: - var theWord = _settings.Domain.PeekWord(addr % Domain.Size, _settings.BigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + var theWord = _settings.Domain.PeekWord(addr % Domain.Size, _settings.BigEndian); if (_settings.Type == Watch.DisplayType.Signed) { return (short)theWord; @@ -762,7 +762,7 @@ namespace BizHawk.Client.Common } case Watch.WatchSize.DWord: - var theDWord = _settings.Domain.PeekDWord(addr % Domain.Size, _settings.BigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + var theDWord = _settings.Domain.PeekDWord(addr % Domain.Size, _settings.BigEndian); if (_settings.Type == Watch.DisplayType.Signed) { return (int)theDWord; @@ -835,7 +835,7 @@ namespace BizHawk.Client.Common public MiniWordWatch(MemoryDomain domain, int addr, bool bigEndian) { Address = addr; - _previous = domain.PeekWord(Address % domain.Size, bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + _previous = domain.PeekWord(Address % domain.Size, bigEndian); } public int Previous @@ -857,7 +857,7 @@ namespace BizHawk.Client.Common public MiniDWordWatch(MemoryDomain domain, int addr, bool bigEndian) { Address = addr; - _previous = domain.PeekDWord(Address % domain.Size, bigEndian); // TODO: % size stil lisn't correct since it could be the last bytes of the domain + _previous = domain.PeekDWord(Address % domain.Size, bigEndian); } public int Previous @@ -944,7 +944,7 @@ namespace BizHawk.Client.Common public void SetPreviousToCurrent(MemoryDomain domain, bool bigendian) { - _previous = _prevFrame = domain.PeekWord(Address % domain.Size, bigendian); // TODO: % size stil lisn't correct since it could be the last bytes of the domain + _previous = _prevFrame = domain.PeekWord(Address % domain.Size, bigendian); } public int Previous @@ -959,7 +959,7 @@ namespace BizHawk.Client.Common public void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian) { - var value = domain.PeekWord(Address % domain.Size, bigendian); // TODO: % size stil lisn't correct since it could be the last bytes of the domain + var value = domain.PeekWord(Address % domain.Size, bigendian); if (value != Previous) { _changecount++; @@ -1000,7 +1000,7 @@ namespace BizHawk.Client.Common public void SetPreviousToCurrent(MemoryDomain domain, bool bigendian) { - _previous = _prevFrame = domain.PeekDWord(Address % domain.Size, bigendian); // TODO: % size stil lisn't correct since it could be the last bytes of the domain + _previous = _prevFrame = domain.PeekDWord(Address % domain.Size, bigendian); } public int Previous @@ -1015,7 +1015,7 @@ namespace BizHawk.Client.Common public void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian) { - var value = domain.PeekDWord(Address % domain.Size, bigendian); // TODO: % size stil lisn't correct since it could be the last bytes of the domain + var value = domain.PeekDWord(Address % domain.Size, bigendian); if (value != Previous) { _changecount++;