change a bunch of stuff to uint

- closes #4001
This commit is contained in:
Morilli 2024-08-29 05:35:03 +02:00
parent 564b916499
commit 6d9c74b7ea
9 changed files with 31 additions and 32 deletions

View File

@ -9,7 +9,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
internal interface IMiniWatch internal interface IMiniWatch
{ {
long Address { get; } long Address { get; }
long Previous { get; } // do not store sign extended variables in here. uint Previous { get; }
void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian); void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian);
bool IsValid(MemoryDomain domain); bool IsValid(MemoryDomain domain);
} }
@ -25,7 +25,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
_previous = GetByte(Address, domain); _previous = GetByte(Address, domain);
} }
public long Previous => _previous; public uint Previous => _previous;
public bool IsValid(MemoryDomain domain) public bool IsValid(MemoryDomain domain)
{ {
@ -64,7 +64,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
_previous = GetUshort(Address, domain, bigEndian); _previous = GetUshort(Address, domain, bigEndian);
} }
public long Previous => _previous; public uint Previous => _previous;
public void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian) public void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian)
{ {
@ -103,7 +103,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
_previous = GetUint(Address, domain, bigEndian); _previous = GetUint(Address, domain, bigEndian);
} }
public long Previous => _previous; public uint Previous => _previous;
public void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian) public void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian)
{ {

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
_previous = _prevFrame = MiniByteWatch.GetByte(Address, domain); _previous = _prevFrame = MiniByteWatch.GetByte(Address, domain);
} }
public long Previous => _previous; public uint Previous => _previous;
public int ChangeCount { get; private set; } public int ChangeCount { get; private set; }
@ -89,7 +89,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
_previous = _prevFrame = MiniWordWatch.GetUshort(Address, domain, bigEndian); _previous = _prevFrame = MiniWordWatch.GetUshort(Address, domain, bigEndian);
} }
public long Previous => _previous; public uint Previous => _previous;
public int ChangeCount { get; private set; } public int ChangeCount { get; private set; }
@ -144,7 +144,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
_previous = _prevFrame = MiniDWordWatch.GetUint(Address, domain, bigEndian); _previous = _prevFrame = MiniDWordWatch.GetUint(Address, domain, bigEndian);
} }
public long Previous => (int)_previous; public uint Previous => _previous;
public int ChangeCount { get; private set; } public int ChangeCount { get; private set; }

View File

@ -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) : this(settings, memoryDomains)
{ {
_compareTo = compareTo; _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; } public ComparisonOperator Operator { get; set; }
@ -407,7 +407,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
private IEnumerable<IMiniWatch> CompareSpecificValue(IEnumerable<IMiniWatch> watchList) private IEnumerable<IMiniWatch> CompareSpecificValue(IEnumerable<IMiniWatch> 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) if (_settings.Type is not WatchDisplayType.Float)
{ {
switch (Operator) switch (Operator)
@ -465,7 +465,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
private IEnumerable<IMiniWatch> CompareSpecificAddress(IEnumerable<IMiniWatch> watchList) private IEnumerable<IMiniWatch> CompareSpecificAddress(IEnumerable<IMiniWatch> watchList)
{ {
if (CompareValue is not long compareValue) throw new InvalidOperationException(); if (CompareValue is not uint compareValue) throw new InvalidOperationException();
switch (Operator) switch (Operator)
{ {
default: default:
@ -490,7 +490,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
private IEnumerable<IMiniWatch> CompareChanges(IEnumerable<IMiniWatch> watchList) private IEnumerable<IMiniWatch> CompareChanges(IEnumerable<IMiniWatch> watchList)
{ {
if (!_settings.IsDetailed()) throw new InvalidCastException(); //TODO matches previous behaviour; was this intended to skip processing? --yoshi 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) switch (Operator)
{ {
default: default:
@ -528,7 +528,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
private IEnumerable<IMiniWatch> CompareDifference(IEnumerable<IMiniWatch> watchList) private IEnumerable<IMiniWatch> CompareDifference(IEnumerable<IMiniWatch> 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) if (_settings.Type is not WatchDisplayType.Float)
{ {
switch (Operator) 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) 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 return _settings.Size switch
{ {
WatchSize.Byte => MiniByteWatch.GetByte(addr, Domain), WatchSize.Byte => MiniByteWatch.GetByte(addr, Domain),

View File

@ -161,7 +161,7 @@ namespace BizHawk.Client.Common
/// <summary> /// <summary>
/// Get the previous value /// Get the previous value
/// </summary> /// </summary>
public override int Previous => _previous; public override uint Previous => _previous;
/// <summary> /// <summary>
/// Get a string representation of the previous value /// Get a string representation of the previous value

View File

@ -186,7 +186,7 @@ namespace BizHawk.Client.Common
/// <summary> /// <summary>
/// Get the previous value /// Get the previous value
/// </summary> /// </summary>
public override int Previous => (int)_previous; public override uint Previous => _previous;
/// <summary> /// <summary>
/// Get a string representation of the previous value /// Get a string representation of the previous value

View File

@ -44,7 +44,7 @@ namespace BizHawk.Client.Common
/// <summary> /// <summary>
/// Ignore that stuff /// Ignore that stuff
/// </summary> /// </summary>
public override int Previous => 0; public override uint Previous => 0;
/// <summary> /// <summary>
/// Ignore that stuff /// Ignore that stuff

View File

@ -458,7 +458,7 @@ namespace BizHawk.Client.Common
/// <summary> /// <summary>
/// Gets the previous value /// Gets the previous value
/// </summary> /// </summary>
public abstract int Previous { get; } public abstract uint Previous { get; }
/// <summary> /// <summary>
/// Gets a string representation of the previous value /// Gets a string representation of the previous value

View File

@ -166,7 +166,7 @@ namespace BizHawk.Client.Common
/// <summary> /// <summary>
/// Get the previous value /// Get the previous value
/// </summary> /// </summary>
public override int Previous => _previous; public override uint Previous => _previous;
/// <summary> /// <summary>
/// Get a string representation of the previous value /// Get a string representation of the previous value

View File

@ -420,7 +420,7 @@ namespace BizHawk.Client.EmuHawk
WatchListView.AnyRowsSelected && _searches.Domain.Writable; WatchListView.AnyRowsSelected && _searches.Domain.Writable;
} }
private long? CompareToValue private uint? CompareToValue
{ {
get get
{ {
@ -431,22 +431,22 @@ namespace BizHawk.Client.EmuHawk
if (SpecificValueRadio.Checked) if (SpecificValueRadio.Checked)
{ {
return (long)SpecificValueBox.ToRawInt() & 0x00000000FFFFFFFF; return (uint)SpecificValueBox.ToRawInt()!.Value;
} }
if (SpecificAddressRadio.Checked) if (SpecificAddressRadio.Checked)
{ {
return SpecificAddressBox.ToRawInt(); return (uint)SpecificAddressBox.ToRawInt()!.Value;
} }
if (NumberOfChangesRadio.Checked) if (NumberOfChangesRadio.Checked)
{ {
return NumberOfChangesBox.ToRawInt(); return (uint)NumberOfChangesBox.ToRawInt()!.Value;
} }
if (DifferenceRadio.Checked) if (DifferenceRadio.Checked)
{ {
return DifferenceBox.ToRawInt(); return (uint)DifferenceBox.ToRawInt()!.Value;
} }
return null; return null;
@ -737,7 +737,7 @@ namespace BizHawk.Client.EmuHawk
WatchListView.Refresh(); WatchListView.Refresh();
} }
private void SetCompareValue(int? value) private void SetCompareValue(uint? value)
{ {
_searches.CompareValue = value; _searches.CompareValue = value;
WatchListView.Refresh(); WatchListView.Refresh();
@ -1460,7 +1460,7 @@ namespace BizHawk.Client.EmuHawk
SpecificAddressBox.ResetText(); SpecificAddressBox.ResetText();
} }
_searches.CompareValue = SpecificValueBox.ToRawInt(); _searches.CompareValue = (uint?)SpecificValueBox.ToRawInt();
if (Focused) if (Focused)
{ {
@ -1482,7 +1482,7 @@ namespace BizHawk.Client.EmuHawk
SpecificAddressBox.ResetText(); SpecificAddressBox.ResetText();
} }
_searches.CompareValue = SpecificAddressBox.ToRawInt(); _searches.CompareValue = (uint?)SpecificAddressBox.ToRawInt();
if (Focused) if (Focused)
{ {
@ -1504,7 +1504,7 @@ namespace BizHawk.Client.EmuHawk
NumberOfChangesBox.ResetText(); NumberOfChangesBox.ResetText();
} }
_searches.CompareValue = NumberOfChangesBox.ToRawInt(); _searches.CompareValue = (uint?)NumberOfChangesBox.ToRawInt();
if (Focused) if (Focused)
{ {
@ -1526,7 +1526,7 @@ namespace BizHawk.Client.EmuHawk
DifferenceBox.ResetText(); DifferenceBox.ResetText();
} }
_searches.CompareValue = DifferenceBox.ToRawInt(); _searches.CompareValue = (uint?)DifferenceBox.ToRawInt();
if (Focused) if (Focused)
{ {
@ -1538,7 +1538,7 @@ namespace BizHawk.Client.EmuHawk
private void CompareToValue_TextChanged(object sender, EventArgs e) 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) private void EqualToRadio_Click(object sender, EventArgs e)