Ram Search & Ram Watch - Freeze function freezes all selected list items

This commit is contained in:
andres.delikat 2011-08-07 00:32:22 +00:00
parent c9ea7c85c5
commit 9814cc26c9
3 changed files with 145 additions and 117 deletions

View File

@ -1826,20 +1826,22 @@ namespace BizHawk.MultiClient
ListView.SelectedIndexCollection indexes = SearchListView.SelectedIndices; ListView.SelectedIndexCollection indexes = SearchListView.SelectedIndices;
if (indexes.Count > 0) if (indexes.Count > 0)
{ {
switch (searchList[indexes[0]].type) for (int i = 0; i < indexes.Count; i++)
{
switch (searchList[indexes[i]].type)
{ {
case atype.BYTE: case atype.BYTE:
Cheat c = new Cheat("", searchList[indexes[0]].address, (byte)searchList[indexes[0]].value, Cheat c = new Cheat("", searchList[indexes[i]].address, (byte)searchList[indexes[i]].value,
true, Domain); true, Domain);
Global.MainForm.Cheats1.AddCheat(c); Global.MainForm.Cheats1.AddCheat(c);
break; break;
case atype.WORD: case atype.WORD:
{ {
byte low = (byte)(searchList[indexes[0]].value / 256); byte low = (byte)(searchList[indexes[i]].value / 256);
byte high = (byte)(searchList[indexes[0]].value); byte high = (byte)(searchList[indexes[i]].value);
int a1 = searchList[indexes[0]].address; int a1 = searchList[indexes[i]].address;
int a2 = searchList[indexes[0]].address + 1; int a2 = searchList[indexes[i]].address + 1;
if (searchList[indexes[0]].bigendian) if (searchList[indexes[i]].bigendian)
{ {
Cheat c1 = new Cheat("", a1, low, true, Domain); Cheat c1 = new Cheat("", a1, low, true, Domain);
Cheat c2 = new Cheat("", a2, high, true, Domain); Cheat c2 = new Cheat("", a2, high, true, Domain);
@ -1857,15 +1859,15 @@ namespace BizHawk.MultiClient
break; break;
case atype.DWORD: case atype.DWORD:
{ {
byte HIWORDhigh = (byte)(searchList[indexes[0]].value / 0x1000000); byte HIWORDhigh = (byte)(searchList[indexes[i]].value / 0x1000000);
byte HIWORDlow = (byte)(searchList[indexes[0]].value / 0x10000); byte HIWORDlow = (byte)(searchList[indexes[i]].value / 0x10000);
byte LOWORDhigh = (byte)(searchList[indexes[0]].value / 0x100); byte LOWORDhigh = (byte)(searchList[indexes[i]].value / 0x100);
byte LOWORDlow = (byte)(searchList[indexes[0]].value); byte LOWORDlow = (byte)(searchList[indexes[i]].value);
int a1 = searchList[indexes[0]].address; int a1 = searchList[indexes[i]].address;
int a2 = searchList[indexes[0]].address + 1; int a2 = searchList[indexes[i]].address + 1;
int a3 = searchList[indexes[0]].address + 2; int a3 = searchList[indexes[i]].address + 2;
int a4 = searchList[indexes[0]].address + 3; int a4 = searchList[indexes[i]].address + 3;
if (searchList[indexes[0]].bigendian) if (searchList[indexes[i]].bigendian)
{ {
Cheat c1 = new Cheat("", a1, HIWORDhigh, true, Domain); Cheat c1 = new Cheat("", a1, HIWORDhigh, true, Domain);
Cheat c2 = new Cheat("", a2, HIWORDlow, true, Domain); Cheat c2 = new Cheat("", a2, HIWORDlow, true, Domain);
@ -1892,6 +1894,7 @@ namespace BizHawk.MultiClient
} }
} }
} }
}
private void freezeAddressToolStripMenuItem_Click(object sender, EventArgs e) private void freezeAddressToolStripMenuItem_Click(object sender, EventArgs e)
{ {

View File

@ -526,7 +526,7 @@
// //
// freezeToolStripMenuItem // freezeToolStripMenuItem
// //
this.freezeToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.cheat; this.freezeToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Freeze;
this.freezeToolStripMenuItem.Name = "freezeToolStripMenuItem"; this.freezeToolStripMenuItem.Name = "freezeToolStripMenuItem";
this.freezeToolStripMenuItem.Size = new System.Drawing.Size(227, 22); this.freezeToolStripMenuItem.Size = new System.Drawing.Size(227, 22);
this.freezeToolStripMenuItem.Text = "&Freeze"; this.freezeToolStripMenuItem.Text = "&Freeze";

View File

@ -1030,6 +1030,24 @@ namespace BizHawk.MultiClient
{ {
for (int x = 0; x < contextMenuStrip1.Items.Count; x++) for (int x = 0; x < contextMenuStrip1.Items.Count; x++)
contextMenuStrip1.Items[x].Visible = true; contextMenuStrip1.Items[x].Visible = true;
if (indexes.Count == 1)
{
/*
if (Global.CheatList.IsActiveCheat(Domain, watchList[indexes[0]].address))
{
contextMenuStrip1.Items[4].Text = "Unfreeze address";
contextMenuStrip1.Items[4].Image =
BizHawk.MultiClient.Properties.Resources.Unfreeze;
}
else
{
contextMenuStrip1.Items[4].Text = "&Freeze address";
contextMenuStrip1.Items[4].Image =
BizHawk.MultiClient.Properties.Resources.Freeze;
}
*/ //TODO: When Unfreeze is implemented
}
} }
if (Global.Config.RamWatchShowChangeColumn) if (Global.Config.RamWatchShowChangeColumn)
@ -1159,6 +1177,10 @@ namespace BizHawk.MultiClient
private void freezeToolStripMenuItem_Click(object sender, EventArgs e) private void freezeToolStripMenuItem_Click(object sender, EventArgs e)
{ {
/*
if (sender.ToString().Contains("Unfreeze"))
FreezeAddress();
*/
FreezeAddress(); FreezeAddress();
} }
@ -1177,20 +1199,22 @@ namespace BizHawk.MultiClient
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
if (indexes.Count > 0) if (indexes.Count > 0)
{ {
switch (watchList[indexes[0]].type) for (int i = 0; i < indexes.Count; i++)
{
switch (watchList[indexes[i]].type)
{ {
case atype.BYTE: case atype.BYTE:
Cheat c = new Cheat("", watchList[indexes[0]].address, (byte)watchList[indexes[0]].value, Cheat c = new Cheat("", watchList[indexes[i]].address, (byte)watchList[indexes[i]].value,
true, Domain); true, Domain);
Global.MainForm.Cheats1.AddCheat(c); Global.MainForm.Cheats1.AddCheat(c);
break; break;
case atype.WORD: case atype.WORD:
{ {
byte low = (byte)(watchList[indexes[0]].value / 256); byte low = (byte)(watchList[indexes[i]].value / 256);
byte high = (byte)(watchList[indexes[0]].value); byte high = (byte)(watchList[indexes[i]].value);
int a1 = watchList[indexes[0]].address; int a1 = watchList[indexes[i]].address;
int a2 = watchList[indexes[0]].address + 1; int a2 = watchList[indexes[i]].address + 1;
if (watchList[indexes[0]].bigendian) if (watchList[indexes[i]].bigendian)
{ {
Cheat c1 = new Cheat("", a1, low, true, Domain); Cheat c1 = new Cheat("", a1, low, true, Domain);
Cheat c2 = new Cheat("", a2, high, true, Domain); Cheat c2 = new Cheat("", a2, high, true, Domain);
@ -1208,15 +1232,15 @@ namespace BizHawk.MultiClient
break; break;
case atype.DWORD: case atype.DWORD:
{ {
byte HIWORDhigh = (byte)(watchList[indexes[0]].value / 0x1000000); byte HIWORDhigh = (byte)(watchList[indexes[i]].value / 0x1000000);
byte HIWORDlow = (byte)(watchList[indexes[0]].value / 0x10000); byte HIWORDlow = (byte)(watchList[indexes[i]].value / 0x10000);
byte LOWORDhigh = (byte)(watchList[indexes[0]].value / 0x100); byte LOWORDhigh = (byte)(watchList[indexes[i]].value / 0x100);
byte LOWORDlow = (byte)(watchList[indexes[0]].value); byte LOWORDlow = (byte)(watchList[indexes[i]].value);
int a1 = watchList[indexes[0]].address; int a1 = watchList[indexes[i]].address;
int a2 = watchList[indexes[0]].address + 1; int a2 = watchList[indexes[i]].address + 1;
int a3 = watchList[indexes[0]].address + 2; int a3 = watchList[indexes[i]].address + 2;
int a4 = watchList[indexes[0]].address + 3; int a4 = watchList[indexes[i]].address + 3;
if (watchList[indexes[0]].bigendian) if (watchList[indexes[i]].bigendian)
{ {
Cheat c1 = new Cheat("", a1, HIWORDhigh, true, Domain); Cheat c1 = new Cheat("", a1, HIWORDhigh, true, Domain);
Cheat c2 = new Cheat("", a2, HIWORDlow, true, Domain); Cheat c2 = new Cheat("", a2, HIWORDlow, true, Domain);
@ -1243,6 +1267,7 @@ namespace BizHawk.MultiClient
} }
} }
} }
}
private void freezeAddressToolStripMenuItem_Click(object sender, EventArgs e) private void freezeAddressToolStripMenuItem_Click(object sender, EventArgs e)
{ {