Ram Search - fix updating of change counts and previous value

This commit is contained in:
adelikat 2013-09-29 19:17:41 +00:00
parent 173855cc03
commit 016c7cae47
1 changed files with 31 additions and 32 deletions

View File

@ -237,7 +237,7 @@ namespace BizHawk.MultiClient
{ {
foreach (IMiniWatchDetails watch in _watchList) foreach (IMiniWatchDetails watch in _watchList)
{ {
watch.Update(_settings.PreviousType, _settings.Domain); watch.Update(_settings.PreviousType, _settings.Domain, _settings.BigEndian);
} }
} }
else else
@ -716,7 +716,7 @@ namespace BizHawk.MultiClient
int ChangeCount { get; } int ChangeCount { get; }
void ClearChangeCount(); void ClearChangeCount();
void Update(Watch.PreviousType type, MemoryDomain domain); void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian);
} }
private class MiniByteWatch : IMiniWatch private class MiniByteWatch : IMiniWatch
@ -812,38 +812,24 @@ namespace BizHawk.MultiClient
get { return _changecount; } get { return _changecount; }
} }
public void Update(Watch.PreviousType type, MemoryDomain domain) public void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian)
{ {
byte value = domain.PeekByte(Address); byte value = domain.PeekByte(Address);
if (value != Previous)
{
_changecount++;
}
switch (type) switch (type)
{ {
case Watch.PreviousType.Original: case Watch.PreviousType.Original:
if (value != Previous)
{
_changecount++;
}
break;
case Watch.PreviousType.LastSearch: case Watch.PreviousType.LastSearch:
if (value != _previous)
{
_changecount++;
}
break; break;
case Watch.PreviousType.LastFrame: case Watch.PreviousType.LastFrame:
value = domain.PeekByte(Address);
if (value != Previous)
{
_changecount++;
}
_previous = value; _previous = value;
break; break;
case Watch.PreviousType.LastChange: case Watch.PreviousType.LastChange:
//TODO: this feature requires yet another variable, ugh //TODO: this feature requires yet another variable, ugh
if (value != Previous)
{
_changecount++;
}
break; break;
} }
} }
@ -881,20 +867,23 @@ namespace BizHawk.MultiClient
get { return _changecount; } get { return _changecount; }
} }
public void Update(Watch.PreviousType type, MemoryDomain domain) public void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian)
{ {
ushort value; ushort value = domain.PeekWord(Address, bigendian ? Endian.Big : Endian.Little);
if (value != Previous)
{
_changecount++;
}
switch (type) switch (type)
{ {
case Watch.PreviousType.LastChange: case Watch.PreviousType.Original:
case Watch.PreviousType.LastSearch:
break; break;
case Watch.PreviousType.LastFrame: case Watch.PreviousType.LastFrame:
value = domain.PeekByte(Address); //TODO: need big endian passed in _previous = value;
if (value != Previous) break;
{ case Watch.PreviousType.LastChange:
_changecount++; //TODO: this feature requires yet another variable, ugh
_previous = value;
}
break; break;
} }
} }
@ -932,13 +921,23 @@ namespace BizHawk.MultiClient
get { return _changecount; } get { return _changecount; }
} }
public void Update(Watch.PreviousType type, MemoryDomain domain) public void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian)
{ {
uint value = domain.PeekDWord(Address, bigendian ? Endian.Big : Endian.Little);
if (value != Previous)
{
_changecount++;
}
switch (type) switch (type)
{ {
case Watch.PreviousType.LastChange: case Watch.PreviousType.Original:
case Watch.PreviousType.LastSearch:
break; break;
case Watch.PreviousType.LastFrame: case Watch.PreviousType.LastFrame:
_previous = value;
break;
case Watch.PreviousType.LastChange:
//TODO: this feature requires yet another variable, ugh
break; break;
} }
} }