Add PeekAddress() to the watch object. Ram Search & Ram Watch refactored to use the object method instead. DWord view implemented as a result. A display bug in Ram Watch 2 byte fixed.
This commit is contained in:
parent
bc74d6c575
commit
f15d16c513
|
@ -19,7 +19,6 @@ namespace BizHawk.MultiClient
|
|||
//TODO:
|
||||
//Window position gets saved but doesn't load properly
|
||||
//Add to Ram watch fails to open ram watch if it has neve been opened
|
||||
//Implement DWORD start new search & updateValues
|
||||
//Doesnt' release handle after saving file, Ram Watch too?
|
||||
//Implement Preview search
|
||||
//Implement Check Misaligned (does 2 & 4 byte on each possible address instead of every other (or every 4)
|
||||
|
@ -47,35 +46,11 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void UpdateValues()
|
||||
{
|
||||
//TODO: update based on atype
|
||||
for (int x = 0; x < searchList.Count; x++)
|
||||
{
|
||||
searchList[x].prev = searchList[x].value;
|
||||
switch (searchList[x].type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
searchList[x].value = Global.Emulator.MainMemory.PeekByte(searchList[x].address);
|
||||
break;
|
||||
case atype.WORD:
|
||||
if (searchList[x].bigendian)
|
||||
{
|
||||
searchList[x].value = ((Global.Emulator.MainMemory.PeekByte(searchList[x].address) * 256) +
|
||||
Global.Emulator.MainMemory.PeekByte((searchList[x].address) + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
searchList[x].value = (Global.Emulator.MainMemory.PeekByte(searchList[x].address) +
|
||||
(Global.Emulator.MainMemory.PeekByte((searchList[x].address) + 1) * 256));
|
||||
}
|
||||
break;
|
||||
case atype.DWORD:
|
||||
//TODO
|
||||
break;
|
||||
default:
|
||||
searchList[x].value = Global.Emulator.MainMemory.PeekByte(searchList[x].address);
|
||||
break;
|
||||
}
|
||||
|
||||
searchList[x].PeekAddress(Global.Emulator.MainMemory);
|
||||
|
||||
if (searchList[x].prev != searchList[x].value)
|
||||
searchList[x].changecount++;
|
||||
|
||||
|
@ -301,7 +276,7 @@ namespace BizHawk.MultiClient
|
|||
int startaddress = 0;
|
||||
if (Global.Emulator.SystemId == "PCE")
|
||||
startaddress = 0x1F0000; //For now, until Emulator core functionality can better handle a prefix
|
||||
int count = 1;
|
||||
int count = 0;
|
||||
int divisor = 1;
|
||||
switch (GetDataSize())
|
||||
{
|
||||
|
@ -320,33 +295,21 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
searchList.Add(new Watch());
|
||||
searchList[x].address = count + startaddress;
|
||||
searchList[x].type = GetDataSize();
|
||||
searchList[x].bigendian = GetBigEndian();
|
||||
searchList[x].signed = GetDataType();
|
||||
searchList[x].PeekAddress(Global.Emulator.MainMemory);
|
||||
searchList[x].prev = searchList[x].value;
|
||||
switch (GetDataSize())
|
||||
{
|
||||
case atype.BYTE:
|
||||
searchList[x].prev = searchList[x].value = Global.Emulator.MainMemory.PeekByte(count);
|
||||
searchList[x].bigendian = GetBigEndian(); //Pointless in 1 byte, but might as well
|
||||
searchList[x].signed = GetDataType();
|
||||
searchList[x].type = atype.BYTE;
|
||||
case atype.BYTE: //TODO: misaligned option
|
||||
count++;
|
||||
break;
|
||||
case atype.WORD:
|
||||
if (GetBigEndian())
|
||||
{
|
||||
searchList[x].prev = searchList[x].value = ((Global.Emulator.MainMemory.PeekByte(searchList[x].address) * 256) +
|
||||
Global.Emulator.MainMemory.PeekByte((searchList[x].address) + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
searchList[x].prev = searchList[x].value = (Global.Emulator.MainMemory.PeekByte(searchList[x].address) +
|
||||
(Global.Emulator.MainMemory.PeekByte((searchList[x].address) + 1) * 256));
|
||||
}
|
||||
searchList[x].bigendian = GetBigEndian(); //Pointless in 1 byte, but might as well
|
||||
searchList[x].signed = GetDataType();
|
||||
searchList[x].type = atype.BYTE;
|
||||
count += 2;
|
||||
break;
|
||||
case atype.DWORD:
|
||||
//TODO
|
||||
count += 4;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
//TODO:
|
||||
//Call AskSave in main client X function
|
||||
//DWORD display
|
||||
//On Movie UP/Down set highlighted items to be what the user had selected (in their new position)
|
||||
//DisplayWatches needs to do value display properly like updatevalues, or just run update values
|
||||
//When Watch object has a changes member, display in watch list with a reset changes function
|
||||
|
@ -42,32 +41,8 @@ namespace BizHawk.MultiClient
|
|||
public void UpdateValues()
|
||||
{
|
||||
for (int x = 0; x < watchList.Count; x++)
|
||||
{
|
||||
if (watchList[x].type == atype.SEPARATOR) continue;
|
||||
switch (watchList[x].type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
watchList[x].value = Global.Emulator.MainMemory.PeekByte(watchList[x].address);
|
||||
break;
|
||||
case atype.WORD:
|
||||
{
|
||||
if (watchList[x].bigendian)
|
||||
{
|
||||
watchList[x].value = ((Global.Emulator.MainMemory.PeekByte(watchList[x].address)*256) +
|
||||
Global.Emulator.MainMemory.PeekByte((watchList[x+1].address)+1) );
|
||||
}
|
||||
else
|
||||
{
|
||||
watchList[x].value = (Global.Emulator.MainMemory.PeekByte(watchList[x].address) +
|
||||
(Global.Emulator.MainMemory.PeekByte((watchList[x].address)+1)*256) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case atype.DWORD:
|
||||
break;
|
||||
}
|
||||
WatchListView.Refresh();
|
||||
}
|
||||
watchList[x].PeekAddress(Global.Emulator.MainMemory);
|
||||
WatchListView.Refresh();
|
||||
}
|
||||
|
||||
public void AddWatch(Watch w)
|
||||
|
|
|
@ -115,5 +115,51 @@ namespace BizHawk.MultiClient
|
|||
return 's'; //Just in case
|
||||
}
|
||||
}
|
||||
|
||||
private void PeekByte(MemoryDomain domain)
|
||||
{
|
||||
value = domain.PeekByte(address);
|
||||
}
|
||||
|
||||
private int PeekWord(MemoryDomain domain, int addr)
|
||||
{
|
||||
int temp = 0;
|
||||
if (bigendian)
|
||||
{
|
||||
temp = ((domain.PeekByte(addr) * 256) +
|
||||
domain.PeekByte(addr + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = ((domain.PeekByte(addr) +
|
||||
domain.PeekByte(addr + 1) * 256));
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
private void PeekDWord(MemoryDomain domain)
|
||||
{
|
||||
value = ((PeekWord(domain, address) * 65536) +
|
||||
PeekWord(domain, address + 2));
|
||||
}
|
||||
|
||||
public void PeekAddress(MemoryDomain domain)
|
||||
{
|
||||
if (type == atype.SEPARATOR)
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
PeekByte(domain);
|
||||
break;
|
||||
case atype.WORD:
|
||||
value = PeekWord(domain, address);
|
||||
break;
|
||||
case atype.DWORD:
|
||||
PeekDWord(domain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue