ram search - pr fixes. also remove out of range searches in ramsearch
- adds a static IsValid method to IMiniWatch implementations - reverts .csproj changes - 'remove out of range' button on ram search didn't seem to actually do anything. this was fixed
This commit is contained in:
parent
c8ca09724c
commit
286b56de5a
|
@ -27,19 +27,24 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
|||
|
||||
public long Previous => _previous;
|
||||
|
||||
public bool IsValid(MemoryDomain domain)
|
||||
{
|
||||
return IsValid(Address, domain);
|
||||
}
|
||||
|
||||
public void SetPreviousToCurrent(MemoryDomain domain, bool bigEndian)
|
||||
{
|
||||
_previous = GetByte(Address, domain);
|
||||
}
|
||||
|
||||
public bool IsValid(MemoryDomain domain)
|
||||
public static bool IsValid(long address, MemoryDomain domain)
|
||||
{
|
||||
return Address < domain.Size;
|
||||
return address < domain.Size;
|
||||
}
|
||||
|
||||
public static byte GetByte(long address, MemoryDomain domain)
|
||||
{
|
||||
if (address >= domain.Size)
|
||||
if (!IsValid(address, domain))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -68,12 +73,17 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
|||
|
||||
public bool IsValid(MemoryDomain domain)
|
||||
{
|
||||
return Address < (domain.Size - 1);
|
||||
return IsValid(Address, domain);
|
||||
}
|
||||
|
||||
public static bool IsValid(long address, MemoryDomain domain)
|
||||
{
|
||||
return address < (domain.Size - 1);
|
||||
}
|
||||
|
||||
public static ushort GetUshort(long address, MemoryDomain domain, bool bigEndian)
|
||||
{
|
||||
if (address >= (domain.Size - 1))
|
||||
if (!IsValid(address, domain))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -102,12 +112,17 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
|||
|
||||
public bool IsValid(MemoryDomain domain)
|
||||
{
|
||||
return Address < (domain.Size - 3);
|
||||
return IsValid(Address, domain);
|
||||
}
|
||||
|
||||
public static bool IsValid(long address, MemoryDomain domain)
|
||||
{
|
||||
return address < (domain.Size - 3);
|
||||
}
|
||||
|
||||
public static uint GetUint(long address, MemoryDomain domain, bool bigEndian)
|
||||
{
|
||||
if (address >= (domain.Size - 3))
|
||||
if (!IsValid(address, domain))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -68,10 +68,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
|||
|
||||
public void ClearChangeCount() => ChangeCount = 0;
|
||||
|
||||
public bool IsValid(MemoryDomain domain)
|
||||
{
|
||||
return Address < domain.Size;
|
||||
}
|
||||
public bool IsValid(MemoryDomain domain) => MiniByteWatch.IsValid(Address, domain);
|
||||
}
|
||||
|
||||
internal sealed class MiniWordWatchDetailed : IMiniWatchDetails
|
||||
|
@ -126,10 +123,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
|||
|
||||
public void ClearChangeCount() => ChangeCount = 0;
|
||||
|
||||
public bool IsValid(MemoryDomain domain)
|
||||
{
|
||||
return Address < (domain.Size - 1);
|
||||
}
|
||||
public bool IsValid(MemoryDomain domain) => MiniWordWatch.IsValid(Address, domain);
|
||||
}
|
||||
|
||||
internal sealed class MiniDWordWatchDetailed : IMiniWatchDetails
|
||||
|
@ -184,9 +178,6 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
|||
|
||||
public void ClearChangeCount() => ChangeCount = 0;
|
||||
|
||||
public bool IsValid(MemoryDomain domain)
|
||||
{
|
||||
return Address < (domain.Size - 3);
|
||||
}
|
||||
public bool IsValid(MemoryDomain domain) => MiniDWordWatch.IsValid(Address, domain);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
|||
}
|
||||
|
||||
var addresses = watches.Select(w => w.Address);
|
||||
_watchList.RemoveAll(w => addresses.Contains(w.Address));
|
||||
RemoveAddressRange(addresses);
|
||||
}
|
||||
|
||||
public void RemoveRange(IEnumerable<int> indices)
|
||||
|
@ -262,6 +262,11 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
|||
_watchList = _watchList.Except(removeList).ToList();
|
||||
}
|
||||
|
||||
public void RemoveAddressRange(IEnumerable<long> addresses)
|
||||
{
|
||||
_watchList.RemoveAll(w => addresses.Contains(w.Address));
|
||||
}
|
||||
|
||||
public void AddRange(IEnumerable<long> addresses, bool append)
|
||||
{
|
||||
if (!append)
|
||||
|
@ -313,7 +318,6 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
|||
|
||||
public bool UndoEnabled { get; set; }
|
||||
|
||||
|
||||
public bool CanUndo => UndoEnabled && _history.CanUndo;
|
||||
|
||||
public bool CanRedo => UndoEnabled && _history.CanRedo;
|
||||
|
|
|
@ -70,13 +70,13 @@
|
|||
<Content Include="discohawk.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="About.cs" />
|
||||
<Compile Update="About.cs" SubType="Form" />
|
||||
<Compile Update="About.Designer.cs" DependentUpon="About.cs" />
|
||||
<EmbeddedResource Update="About.resx" DependentUpon="About.cs" />
|
||||
<Compile Update="ComparisonResults.cs" />
|
||||
<Compile Update="ComparisonResults.cs" SubType="Form" />
|
||||
<Compile Update="ComparisonResults.Designer.cs" DependentUpon="ComparisonResults.cs" />
|
||||
<EmbeddedResource Update="ComparisonResults.resx" DependentUpon="ComparisonResults.cs" />
|
||||
<Compile Update="MainDiscoForm.cs" />
|
||||
<Compile Update="MainDiscoForm.cs" SubType="Form" />
|
||||
<Compile Update="MainDiscoForm.Designer.cs" DependentUpon="MainDiscoForm.cs" />
|
||||
|
||||
<EmbeddedResource Remove="MainDiscoForm.resx" />
|
||||
|
|
|
@ -1490,7 +1490,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void ErrorIconButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var outOfRangeAddresses = _searches.OutOfRangeAddress.ToList();
|
||||
|
||||
_searches.RemoveAddressRange(outOfRangeAddresses);
|
||||
SetRemovedMessage(outOfRangeAddresses.Count);
|
||||
|
||||
UpdateList();
|
||||
|
|
Loading…
Reference in New Issue