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
{
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)
{

View File

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

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)
{
_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<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)
{
switch (Operator)
@ -465,7 +465,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
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)
{
default:
@ -490,7 +490,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
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 (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<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)
{
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),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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)