diff --git a/src/BizHawk.Client.Common/tools/RamSearchEngine/IMiniWatch.cs b/src/BizHawk.Client.Common/tools/RamSearchEngine/IMiniWatch.cs index 1bd7b86966..5dad7ecf4e 100644 --- a/src/BizHawk.Client.Common/tools/RamSearchEngine/IMiniWatch.cs +++ b/src/BizHawk.Client.Common/tools/RamSearchEngine/IMiniWatch.cs @@ -9,7 +9,7 @@ namespace BizHawk.Client.Common.RamSearchEngine internal interface IMiniWatch { long Address { get; } - long Previous { get; } // do not store sign extended variables in here. + uint Previous { get; } void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian); bool IsValid(MemoryDomain domain); } @@ -25,7 +25,7 @@ namespace BizHawk.Client.Common.RamSearchEngine _previous = GetByte(Address, domain); } - public long Previous => _previous; + public uint Previous => _previous; public bool IsValid(MemoryDomain domain) { @@ -64,7 +64,7 @@ namespace BizHawk.Client.Common.RamSearchEngine _previous = GetUshort(Address, domain, bigEndian); } - public long Previous => _previous; + public uint Previous => _previous; public void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian) { @@ -103,7 +103,7 @@ namespace BizHawk.Client.Common.RamSearchEngine _previous = GetUint(Address, domain, bigEndian); } - public long Previous => _previous; + public uint Previous => _previous; public void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian) { diff --git a/src/BizHawk.Client.Common/tools/RamSearchEngine/IMiniWatchDetails.cs b/src/BizHawk.Client.Common/tools/RamSearchEngine/IMiniWatchDetails.cs index 024eae8d78..284ee172ee 100644 --- a/src/BizHawk.Client.Common/tools/RamSearchEngine/IMiniWatchDetails.cs +++ b/src/BizHawk.Client.Common/tools/RamSearchEngine/IMiniWatchDetails.cs @@ -33,7 +33,7 @@ namespace BizHawk.Client.Common.RamSearchEngine _previous = _prevFrame = MiniByteWatch.GetByte(Address, domain); } - public long Previous => _previous; + public uint Previous => _previous; public int ChangeCount { get; private set; } @@ -89,7 +89,7 @@ namespace BizHawk.Client.Common.RamSearchEngine _previous = _prevFrame = MiniWordWatch.GetUshort(Address, domain, bigEndian); } - public long Previous => _previous; + public uint Previous => _previous; public int ChangeCount { get; private set; } @@ -144,7 +144,7 @@ namespace BizHawk.Client.Common.RamSearchEngine _previous = _prevFrame = MiniDWordWatch.GetUint(Address, domain, bigEndian); } - public long Previous => (int)_previous; + public uint Previous => _previous; public int ChangeCount { get; private set; } diff --git a/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs b/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs index c52099fcdb..535f996561 100644 --- a/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs +++ b/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs @@ -38,7 +38,7 @@ namespace BizHawk.Client.Common.RamSearchEngine }; } - public RamSearchEngine(SearchEngineSettings settings, IMemoryDomains memoryDomains, Compare compareTo, long? compareValue, int? differentBy) + public RamSearchEngine(SearchEngineSettings settings, IMemoryDomains memoryDomains, Compare compareTo, uint? compareValue, int? differentBy) : this(settings, memoryDomains) { _compareTo = compareTo; @@ -191,7 +191,7 @@ namespace BizHawk.Client.Common.RamSearchEngine } } - public long? CompareValue { get; set; } + public uint? CompareValue { get; set; } public ComparisonOperator Operator { get; set; } @@ -407,7 +407,7 @@ namespace BizHawk.Client.Common.RamSearchEngine private IEnumerable CompareSpecificValue(IEnumerable watchList) { - if (CompareValue is not long compareValue) throw new InvalidOperationException(); + if (CompareValue is not uint compareValue) throw new InvalidOperationException(); if (_settings.Type is not WatchDisplayType.Float) { switch (Operator) @@ -465,7 +465,7 @@ namespace BizHawk.Client.Common.RamSearchEngine private IEnumerable CompareSpecificAddress(IEnumerable watchList) { - if (CompareValue is not long compareValue) throw new InvalidOperationException(); + if (CompareValue is not uint compareValue) throw new InvalidOperationException(); switch (Operator) { default: @@ -490,7 +490,7 @@ namespace BizHawk.Client.Common.RamSearchEngine private IEnumerable CompareChanges(IEnumerable watchList) { if (!_settings.IsDetailed()) throw new InvalidCastException(); //TODO matches previous behaviour; was this intended to skip processing? --yoshi - if (CompareValue is not long compareValue) throw new InvalidCastException(); //TODO typo for IOE? + if (CompareValue is not uint compareValue) throw new InvalidCastException(); //TODO typo for IOE? switch (Operator) { default: @@ -528,7 +528,7 @@ namespace BizHawk.Client.Common.RamSearchEngine private IEnumerable CompareDifference(IEnumerable watchList) { - if (CompareValue is not long compareValue) throw new InvalidCastException(); //TODO typo for IOE? + if (CompareValue is not uint compareValue) throw new InvalidCastException(); //TODO typo for IOE? if (_settings.Type is not WatchDisplayType.Float) { switch (Operator) @@ -584,7 +584,7 @@ namespace BizHawk.Client.Common.RamSearchEngine } } - private long SignExtendAsNeeded(long val) + private long SignExtendAsNeeded(uint val) { if (_settings.Type != WatchDisplayType.Signed) { @@ -600,9 +600,8 @@ namespace BizHawk.Client.Common.RamSearchEngine }; } - private long GetValue(long addr) + private uint GetValue(long addr) { - // do not return sign extended variables from here. return _settings.Size switch { WatchSize.Byte => MiniByteWatch.GetByte(addr, Domain), diff --git a/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs b/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs index cafc967053..4e46d77e93 100644 --- a/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs @@ -161,7 +161,7 @@ namespace BizHawk.Client.Common /// /// Get the previous value /// - public override int Previous => _previous; + public override uint Previous => _previous; /// /// Get a string representation of the previous value diff --git a/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs b/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs index 558a47e691..dfffdb3cac 100644 --- a/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/DWordWatch.cs @@ -186,7 +186,7 @@ namespace BizHawk.Client.Common /// /// Get the previous value /// - public override int Previous => (int)_previous; + public override uint Previous => _previous; /// /// Get a string representation of the previous value diff --git a/src/BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs b/src/BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs index b78e31694a..12a9a5c73d 100644 --- a/src/BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs @@ -44,7 +44,7 @@ namespace BizHawk.Client.Common /// /// Ignore that stuff /// - public override int Previous => 0; + public override uint Previous => 0; /// /// Ignore that stuff diff --git a/src/BizHawk.Client.Common/tools/Watch/Watch.cs b/src/BizHawk.Client.Common/tools/Watch/Watch.cs index fbf45fb264..97e9606096 100644 --- a/src/BizHawk.Client.Common/tools/Watch/Watch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/Watch.cs @@ -458,7 +458,7 @@ namespace BizHawk.Client.Common /// /// Gets the previous value /// - public abstract int Previous { get; } + public abstract uint Previous { get; } /// /// Gets a string representation of the previous value diff --git a/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs b/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs index 7dfaa07146..15d6630813 100644 --- a/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs +++ b/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs @@ -166,7 +166,7 @@ namespace BizHawk.Client.Common /// /// Get the previous value /// - public override int Previous => _previous; + public override uint Previous => _previous; /// /// Get a string representation of the previous value diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs index 1f540009d7..20f10b36b7 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs @@ -420,7 +420,7 @@ namespace BizHawk.Client.EmuHawk WatchListView.AnyRowsSelected && _searches.Domain.Writable; } - private long? CompareToValue + private uint? CompareToValue { get { @@ -431,22 +431,22 @@ namespace BizHawk.Client.EmuHawk if (SpecificValueRadio.Checked) { - return (long)SpecificValueBox.ToRawInt() & 0x00000000FFFFFFFF; + return (uint)SpecificValueBox.ToRawInt()!.Value; } if (SpecificAddressRadio.Checked) { - return SpecificAddressBox.ToRawInt(); + return (uint)SpecificAddressBox.ToRawInt()!.Value; } if (NumberOfChangesRadio.Checked) { - return NumberOfChangesBox.ToRawInt(); + return (uint)NumberOfChangesBox.ToRawInt()!.Value; } if (DifferenceRadio.Checked) { - return DifferenceBox.ToRawInt(); + return (uint)DifferenceBox.ToRawInt()!.Value; } return null; @@ -737,7 +737,7 @@ namespace BizHawk.Client.EmuHawk WatchListView.Refresh(); } - private void SetCompareValue(int? value) + private void SetCompareValue(uint? value) { _searches.CompareValue = value; WatchListView.Refresh(); @@ -1460,7 +1460,7 @@ namespace BizHawk.Client.EmuHawk SpecificAddressBox.ResetText(); } - _searches.CompareValue = SpecificValueBox.ToRawInt(); + _searches.CompareValue = (uint?)SpecificValueBox.ToRawInt(); if (Focused) { @@ -1482,7 +1482,7 @@ namespace BizHawk.Client.EmuHawk SpecificAddressBox.ResetText(); } - _searches.CompareValue = SpecificAddressBox.ToRawInt(); + _searches.CompareValue = (uint?)SpecificAddressBox.ToRawInt(); if (Focused) { @@ -1504,7 +1504,7 @@ namespace BizHawk.Client.EmuHawk NumberOfChangesBox.ResetText(); } - _searches.CompareValue = NumberOfChangesBox.ToRawInt(); + _searches.CompareValue = (uint?)NumberOfChangesBox.ToRawInt(); if (Focused) { @@ -1526,7 +1526,7 @@ namespace BizHawk.Client.EmuHawk DifferenceBox.ResetText(); } - _searches.CompareValue = DifferenceBox.ToRawInt(); + _searches.CompareValue = (uint?)DifferenceBox.ToRawInt(); if (Focused) { @@ -1538,7 +1538,7 @@ namespace BizHawk.Client.EmuHawk private void CompareToValue_TextChanged(object sender, EventArgs e) { - SetCompareValue(((INumberBox)sender).ToRawInt()); + SetCompareValue((uint?)((INumberBox)sender).ToRawInt()); } private void EqualToRadio_Click(object sender, EventArgs e)