Ram Watch - ability to freeze 2 byte watch

This commit is contained in:
andres.delikat 2011-03-19 02:24:29 +00:00
parent fc845c1778
commit 211ef7e1b9
1 changed files with 41 additions and 5 deletions

View File

@ -17,7 +17,7 @@ namespace BizHawk.MultiClient
public partial class RamWatch : Form public partial class RamWatch : Form
{ {
//TODO: //TODO:
//Ability to freeze 2 & 4 byte //Ability to freeze 4 byte
//.wch format includes platform and domain type //.wch format includes platform and domain type
//address num digits based on domain size //address num digits based on domain size
//Restore window size should restore column order as well //Restore window size should restore column order as well
@ -1097,15 +1097,51 @@ namespace BizHawk.MultiClient
FreezeAddress(); FreezeAddress();
} }
private int WORDGetLowerByte(int value)
{
return value / 256;
}
private int WORDGetUpperByte(int value)
{
return value >> 2;
}
private void FreezeAddress() private void FreezeAddress()
{ {
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
//TODO: if 2 byte or 4 byte, freeze correct addresses
if (indexes.Count > 0) if (indexes.Count > 0)
{ {
Cheat c = new Cheat("", watchList[indexes[0]].address, (byte)watchList[indexes[0]].value, switch (watchList[indexes[0]].type)
true, Domain); {
Global.MainForm.Cheats1.AddCheat(c); case atype.BYTE:
Cheat c = new Cheat("", watchList[indexes[0]].address, (byte)watchList[indexes[0]].value,
true, Domain);
Global.MainForm.Cheats1.AddCheat(c);
break;
case atype.WORD:
byte low = (byte)(watchList[indexes[0]].value / 256);
byte high = (byte)(watchList[indexes[0]].value % 256);
int a1 = watchList[indexes[0]].address;
int a2 = watchList[indexes[0]].address + 1;
if (watchList[indexes[0]].bigendian)
{
Cheat c1 = new Cheat("", a1, low, true, Domain);
Cheat c2 = new Cheat("", a2, high, true, Domain);
Global.MainForm.Cheats1.AddCheat(c1);
Global.MainForm.Cheats1.AddCheat(c2);
}
else
{
Cheat c1 = new Cheat("", a1, high, true, Domain);
Cheat c2 = new Cheat("", a2, low, true, Domain);
Global.MainForm.Cheats1.AddCheat(c1);
Global.MainForm.Cheats1.AddCheat(c2);
}
break;
case atype.DWORD:
break;
}
} }
} }