Use current value from detailed watches in RamSearch
This commit is contained in:
parent
e09bfa8ca9
commit
92724aee0b
|
@ -286,7 +286,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
||||||
_watchList = _watchList.OrderBy(w => w.Address, reverse).ToArray();
|
_watchList = _watchList.OrderBy(w => w.Address, reverse).ToArray();
|
||||||
break;
|
break;
|
||||||
case WatchList.Value:
|
case WatchList.Value:
|
||||||
_watchList = _watchList.OrderBy(w => GetValue(w.Address), reverse).ToArray();
|
_watchList = _watchList.OrderBy(w => GetValue(w), reverse).ToArray();
|
||||||
break;
|
break;
|
||||||
case WatchList.Prev:
|
case WatchList.Prev:
|
||||||
_watchList = _watchList.OrderBy(w => w.Previous, reverse).ToArray();
|
_watchList = _watchList.OrderBy(w => w.Previous, reverse).ToArray();
|
||||||
|
@ -300,7 +300,7 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
||||||
.ToArray();
|
.ToArray();
|
||||||
break;
|
break;
|
||||||
case WatchList.Diff:
|
case WatchList.Diff:
|
||||||
_watchList = _watchList.OrderBy(w => GetValue(w.Address) - w.Previous, reverse).ToArray();
|
_watchList = _watchList.OrderBy(w => GetValue(w) - w.Previous, reverse).ToArray();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,52 +349,52 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case ComparisonOperator.Equal:
|
case ComparisonOperator.Equal:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) == SignExtendAsNeeded(w.Previous));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) == SignExtendAsNeeded(w.Previous));
|
||||||
case ComparisonOperator.NotEqual:
|
case ComparisonOperator.NotEqual:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) != SignExtendAsNeeded(w.Previous));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) != SignExtendAsNeeded(w.Previous));
|
||||||
case ComparisonOperator.GreaterThan:
|
case ComparisonOperator.GreaterThan:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) > SignExtendAsNeeded(w.Previous));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) > SignExtendAsNeeded(w.Previous));
|
||||||
case ComparisonOperator.GreaterThanEqual:
|
case ComparisonOperator.GreaterThanEqual:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) >= SignExtendAsNeeded(w.Previous));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) >= SignExtendAsNeeded(w.Previous));
|
||||||
case ComparisonOperator.LessThan:
|
case ComparisonOperator.LessThan:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) < SignExtendAsNeeded(w.Previous));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) < SignExtendAsNeeded(w.Previous));
|
||||||
case ComparisonOperator.LessThanEqual:
|
case ComparisonOperator.LessThanEqual:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) <= SignExtendAsNeeded(w.Previous));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) <= SignExtendAsNeeded(w.Previous));
|
||||||
case ComparisonOperator.DifferentBy:
|
case ComparisonOperator.DifferentBy:
|
||||||
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
||||||
return watchList.Where(w =>
|
return watchList.Where(w =>
|
||||||
differentBy == Math.Abs(SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous)));
|
differentBy == Math.Abs(SignExtendAsNeeded(GetValue(w)) - SignExtendAsNeeded(w.Previous)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (Operator)
|
switch (Operator)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case ComparisonOperator.Equal:
|
case ComparisonOperator.Equal:
|
||||||
return watchList.Where(w => ReinterpretAsF32(GetValue(w.Address)).HawkFloatEquality(ReinterpretAsF32(w.Previous)));
|
return watchList.Where(w => ReinterpretAsF32(GetValue(w)).HawkFloatEquality(ReinterpretAsF32(w.Previous)));
|
||||||
case ComparisonOperator.NotEqual:
|
case ComparisonOperator.NotEqual:
|
||||||
return watchList.Where(w => !ReinterpretAsF32(GetValue(w.Address)).HawkFloatEquality(ReinterpretAsF32(w.Previous)));
|
return watchList.Where(w => !ReinterpretAsF32(GetValue(w)).HawkFloatEquality(ReinterpretAsF32(w.Previous)));
|
||||||
case ComparisonOperator.GreaterThan:
|
case ComparisonOperator.GreaterThan:
|
||||||
return watchList.Where(w => ReinterpretAsF32(GetValue(w.Address)) > ReinterpretAsF32(w.Previous));
|
return watchList.Where(w => ReinterpretAsF32(GetValue(w)) > ReinterpretAsF32(w.Previous));
|
||||||
case ComparisonOperator.GreaterThanEqual:
|
case ComparisonOperator.GreaterThanEqual:
|
||||||
return watchList.Where(w =>
|
return watchList.Where(w =>
|
||||||
{
|
{
|
||||||
var val = ReinterpretAsF32(GetValue(w.Address));
|
var val = ReinterpretAsF32(GetValue(w));
|
||||||
var prev = ReinterpretAsF32(w.Previous);
|
var prev = ReinterpretAsF32(w.Previous);
|
||||||
return val > prev || val.HawkFloatEquality(prev);
|
return val > prev || val.HawkFloatEquality(prev);
|
||||||
});
|
});
|
||||||
case ComparisonOperator.LessThan:
|
case ComparisonOperator.LessThan:
|
||||||
return watchList.Where(w => ReinterpretAsF32(GetValue(w.Address)) < ReinterpretAsF32(w.Previous));
|
return watchList.Where(w => ReinterpretAsF32(GetValue(w)) < ReinterpretAsF32(w.Previous));
|
||||||
case ComparisonOperator.LessThanEqual:
|
case ComparisonOperator.LessThanEqual:
|
||||||
return watchList.Where(w =>
|
return watchList.Where(w =>
|
||||||
{
|
{
|
||||||
var val = ReinterpretAsF32(GetValue(w.Address));
|
var val = ReinterpretAsF32(GetValue(w));
|
||||||
var prev = ReinterpretAsF32(w.Previous);
|
var prev = ReinterpretAsF32(w.Previous);
|
||||||
return val < prev || val.HawkFloatEquality(prev);
|
return val < prev || val.HawkFloatEquality(prev);
|
||||||
});
|
});
|
||||||
case ComparisonOperator.DifferentBy:
|
case ComparisonOperator.DifferentBy:
|
||||||
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
||||||
var differentByF = ReinterpretAsF32(differentBy);
|
var differentByF = ReinterpretAsF32(differentBy);
|
||||||
return watchList.Where(w => Math.Abs(ReinterpretAsF32(GetValue(w.Address)) - ReinterpretAsF32(w.Previous))
|
return watchList.Where(w => Math.Abs(ReinterpretAsF32(GetValue(w)) - ReinterpretAsF32(w.Previous))
|
||||||
.HawkFloatEquality(differentByF));
|
.HawkFloatEquality(differentByF));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,21 +408,21 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case ComparisonOperator.Equal:
|
case ComparisonOperator.Equal:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) == SignExtendAsNeeded(compareValue));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) == SignExtendAsNeeded(compareValue));
|
||||||
case ComparisonOperator.NotEqual:
|
case ComparisonOperator.NotEqual:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) != SignExtendAsNeeded(compareValue));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) != SignExtendAsNeeded(compareValue));
|
||||||
case ComparisonOperator.GreaterThan:
|
case ComparisonOperator.GreaterThan:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) > SignExtendAsNeeded(compareValue));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) > SignExtendAsNeeded(compareValue));
|
||||||
case ComparisonOperator.GreaterThanEqual:
|
case ComparisonOperator.GreaterThanEqual:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) >= SignExtendAsNeeded(compareValue));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) >= SignExtendAsNeeded(compareValue));
|
||||||
case ComparisonOperator.LessThan:
|
case ComparisonOperator.LessThan:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) < SignExtendAsNeeded(compareValue));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) < SignExtendAsNeeded(compareValue));
|
||||||
case ComparisonOperator.LessThanEqual:
|
case ComparisonOperator.LessThanEqual:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) <= SignExtendAsNeeded(compareValue));
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) <= SignExtendAsNeeded(compareValue));
|
||||||
case ComparisonOperator.DifferentBy:
|
case ComparisonOperator.DifferentBy:
|
||||||
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
||||||
return watchList.Where(w =>
|
return watchList.Where(w =>
|
||||||
differentBy == Math.Abs(SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(compareValue)));
|
differentBy == Math.Abs(SignExtendAsNeeded(GetValue(w)) - SignExtendAsNeeded(compareValue)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var compareValueF = ReinterpretAsF32(compareValue);
|
var compareValueF = ReinterpretAsF32(compareValue);
|
||||||
|
@ -430,29 +430,29 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case ComparisonOperator.Equal:
|
case ComparisonOperator.Equal:
|
||||||
return watchList.Where(w => ReinterpretAsF32(GetValue(w.Address)).HawkFloatEquality(compareValueF));
|
return watchList.Where(w => ReinterpretAsF32(GetValue(w)).HawkFloatEquality(compareValueF));
|
||||||
case ComparisonOperator.NotEqual:
|
case ComparisonOperator.NotEqual:
|
||||||
return watchList.Where(w => !ReinterpretAsF32(GetValue(w.Address)).HawkFloatEquality(compareValueF));
|
return watchList.Where(w => !ReinterpretAsF32(GetValue(w)).HawkFloatEquality(compareValueF));
|
||||||
case ComparisonOperator.GreaterThan:
|
case ComparisonOperator.GreaterThan:
|
||||||
return watchList.Where(w => ReinterpretAsF32(GetValue(w.Address)) > compareValueF);
|
return watchList.Where(w => ReinterpretAsF32(GetValue(w)) > compareValueF);
|
||||||
case ComparisonOperator.GreaterThanEqual:
|
case ComparisonOperator.GreaterThanEqual:
|
||||||
return watchList.Where(w =>
|
return watchList.Where(w =>
|
||||||
{
|
{
|
||||||
var val = ReinterpretAsF32(GetValue(w.Address));
|
var val = ReinterpretAsF32(GetValue(w));
|
||||||
return val > compareValueF || val.HawkFloatEquality(compareValueF);
|
return val > compareValueF || val.HawkFloatEquality(compareValueF);
|
||||||
});
|
});
|
||||||
case ComparisonOperator.LessThan:
|
case ComparisonOperator.LessThan:
|
||||||
return watchList.Where(w => ReinterpretAsF32(GetValue(w.Address)) < compareValueF);
|
return watchList.Where(w => ReinterpretAsF32(GetValue(w)) < compareValueF);
|
||||||
case ComparisonOperator.LessThanEqual:
|
case ComparisonOperator.LessThanEqual:
|
||||||
return watchList.Where(w =>
|
return watchList.Where(w =>
|
||||||
{
|
{
|
||||||
var val = ReinterpretAsF32(GetValue(w.Address));
|
var val = ReinterpretAsF32(GetValue(w));
|
||||||
return val < compareValueF || val.HawkFloatEquality(compareValueF);
|
return val < compareValueF || val.HawkFloatEquality(compareValueF);
|
||||||
});
|
});
|
||||||
case ComparisonOperator.DifferentBy:
|
case ComparisonOperator.DifferentBy:
|
||||||
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
||||||
var differentByF = ReinterpretAsF32(differentBy);
|
var differentByF = ReinterpretAsF32(differentBy);
|
||||||
return watchList.Where(w => Math.Abs(ReinterpretAsF32(GetValue(w.Address)) - compareValueF)
|
return watchList.Where(w => Math.Abs(ReinterpretAsF32(GetValue(w)) - compareValueF)
|
||||||
.HawkFloatEquality(differentByF));
|
.HawkFloatEquality(differentByF));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,21 +529,21 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case ComparisonOperator.Equal:
|
case ComparisonOperator.Equal:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) == compareValue);
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) - SignExtendAsNeeded(w.Previous) == compareValue);
|
||||||
case ComparisonOperator.NotEqual:
|
case ComparisonOperator.NotEqual:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) != compareValue);
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) - SignExtendAsNeeded(w.Previous) != compareValue);
|
||||||
case ComparisonOperator.GreaterThan:
|
case ComparisonOperator.GreaterThan:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) > compareValue);
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) - SignExtendAsNeeded(w.Previous) > compareValue);
|
||||||
case ComparisonOperator.GreaterThanEqual:
|
case ComparisonOperator.GreaterThanEqual:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) >= compareValue);
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) - SignExtendAsNeeded(w.Previous) >= compareValue);
|
||||||
case ComparisonOperator.LessThan:
|
case ComparisonOperator.LessThan:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) < compareValue);
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) - SignExtendAsNeeded(w.Previous) < compareValue);
|
||||||
case ComparisonOperator.LessThanEqual:
|
case ComparisonOperator.LessThanEqual:
|
||||||
return watchList.Where(w => SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) <= compareValue);
|
return watchList.Where(w => SignExtendAsNeeded(GetValue(w)) - SignExtendAsNeeded(w.Previous) <= compareValue);
|
||||||
case ComparisonOperator.DifferentBy:
|
case ComparisonOperator.DifferentBy:
|
||||||
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
||||||
return watchList.Where(w =>
|
return watchList.Where(w =>
|
||||||
differentBy == Math.Abs(SignExtendAsNeeded(GetValue(w.Address)) - SignExtendAsNeeded(w.Previous) - compareValue));
|
differentBy == Math.Abs(SignExtendAsNeeded(GetValue(w)) - SignExtendAsNeeded(w.Previous) - compareValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var compareValueF = ReinterpretAsF32(compareValue);
|
var compareValueF = ReinterpretAsF32(compareValue);
|
||||||
|
@ -551,29 +551,29 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case ComparisonOperator.Equal:
|
case ComparisonOperator.Equal:
|
||||||
return watchList.Where(w => (ReinterpretAsF32(GetValue(w.Address)) - ReinterpretAsF32(w.Previous)).HawkFloatEquality(compareValueF));
|
return watchList.Where(w => (ReinterpretAsF32(GetValue(w)) - ReinterpretAsF32(w.Previous)).HawkFloatEquality(compareValueF));
|
||||||
case ComparisonOperator.NotEqual:
|
case ComparisonOperator.NotEqual:
|
||||||
return watchList.Where(w => !(ReinterpretAsF32(GetValue(w.Address)) - ReinterpretAsF32(w.Previous)).HawkFloatEquality(compareValueF));
|
return watchList.Where(w => !(ReinterpretAsF32(GetValue(w)) - ReinterpretAsF32(w.Previous)).HawkFloatEquality(compareValueF));
|
||||||
case ComparisonOperator.GreaterThan:
|
case ComparisonOperator.GreaterThan:
|
||||||
return watchList.Where(w => ReinterpretAsF32(GetValue(w.Address)) - ReinterpretAsF32(w.Previous) > compareValueF);
|
return watchList.Where(w => ReinterpretAsF32(GetValue(w)) - ReinterpretAsF32(w.Previous) > compareValueF);
|
||||||
case ComparisonOperator.GreaterThanEqual:
|
case ComparisonOperator.GreaterThanEqual:
|
||||||
return watchList.Where(w =>
|
return watchList.Where(w =>
|
||||||
{
|
{
|
||||||
var diff = ReinterpretAsF32(GetValue(w.Address)) - ReinterpretAsF32(w.Previous);
|
var diff = ReinterpretAsF32(GetValue(w)) - ReinterpretAsF32(w.Previous);
|
||||||
return diff > compareValueF || diff.HawkFloatEquality(compareValueF);
|
return diff > compareValueF || diff.HawkFloatEquality(compareValueF);
|
||||||
});
|
});
|
||||||
case ComparisonOperator.LessThan:
|
case ComparisonOperator.LessThan:
|
||||||
return watchList.Where(w => ReinterpretAsF32(GetValue(w.Address)) - ReinterpretAsF32(w.Previous) < compareValueF);
|
return watchList.Where(w => ReinterpretAsF32(GetValue(w)) - ReinterpretAsF32(w.Previous) < compareValueF);
|
||||||
case ComparisonOperator.LessThanEqual:
|
case ComparisonOperator.LessThanEqual:
|
||||||
return watchList.Where(w =>
|
return watchList.Where(w =>
|
||||||
{
|
{
|
||||||
var diff = ReinterpretAsF32(GetValue(w.Address)) - ReinterpretAsF32(w.Previous);
|
var diff = ReinterpretAsF32(GetValue(w)) - ReinterpretAsF32(w.Previous);
|
||||||
return diff < compareValueF || diff.HawkFloatEquality(compareValueF);
|
return diff < compareValueF || diff.HawkFloatEquality(compareValueF);
|
||||||
});
|
});
|
||||||
case ComparisonOperator.DifferentBy:
|
case ComparisonOperator.DifferentBy:
|
||||||
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
if (DifferentBy is not uint differentBy) throw new InvalidOperationException();
|
||||||
var differentByF = ReinterpretAsF32(differentBy);
|
var differentByF = ReinterpretAsF32(differentBy);
|
||||||
return watchList.Where(w => Math.Abs(ReinterpretAsF32(GetValue(w.Address)) - ReinterpretAsF32(w.Previous) - compareValueF)
|
return watchList.Where(w => Math.Abs(ReinterpretAsF32(GetValue(w)) - ReinterpretAsF32(w.Previous) - compareValueF)
|
||||||
.HawkFloatEquality(differentByF));
|
.HawkFloatEquality(differentByF));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -594,14 +594,19 @@ namespace BizHawk.Client.Common.RamSearchEngine
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private uint GetValue(long addr)
|
private uint GetValue(IMiniWatch watch)
|
||||||
{
|
{
|
||||||
|
if (watch is IMiniWatchDetails detailedWatch)
|
||||||
|
{
|
||||||
|
return detailedWatch.Current;
|
||||||
|
}
|
||||||
|
|
||||||
return _settings.Size switch
|
return _settings.Size switch
|
||||||
{
|
{
|
||||||
WatchSize.Byte => MiniByteWatch.GetByte(addr, Domain),
|
WatchSize.Byte => MiniByteWatch.GetByte(watch.Address, Domain),
|
||||||
WatchSize.Word => MiniWordWatch.GetUshort(addr, Domain, _settings.BigEndian),
|
WatchSize.Word => MiniWordWatch.GetUshort(watch.Address, Domain, _settings.BigEndian),
|
||||||
WatchSize.DWord => MiniDWordWatch.GetUint(addr, Domain, _settings.BigEndian),
|
WatchSize.DWord => MiniDWordWatch.GetUint(watch.Address, Domain, _settings.BigEndian),
|
||||||
_ => MiniByteWatch.GetByte(addr, Domain)
|
_ => MiniByteWatch.GetByte(watch.Address, Domain)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue