Ram Search - Freeze address button & menu item, change background color on frozen addresses

This commit is contained in:
andres.delikat 2011-03-18 17:52:31 +00:00
parent 2fdf734bc5
commit e7a3ee14f2
2 changed files with 67 additions and 17 deletions

View File

@ -38,8 +38,8 @@
this.TruncateFromFiletoolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.TruncateFromFiletoolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.ExcludeRamWatchtoolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.ExcludeRamWatchtoolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.WatchtoolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.PoketoolStripButton1 = new System.Windows.Forms.ToolStripButton(); this.PoketoolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.FreezeAddressToolStrip = new System.Windows.Forms.ToolStripButton();
this.TotalSearchLabel = new System.Windows.Forms.Label(); this.TotalSearchLabel = new System.Windows.Forms.Label();
this.SearchListView = new BizHawk.VirtualListView(); this.SearchListView = new BizHawk.VirtualListView();
this.Address = new System.Windows.Forms.ColumnHeader(); this.Address = new System.Windows.Forms.ColumnHeader();
@ -77,6 +77,7 @@
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.addSelectedToRamWatchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addSelectedToRamWatchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pokeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pokeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.freezeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.definePreviousValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.definePreviousValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sinceLastSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.sinceLastSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -95,6 +96,7 @@
this.SetCurrToPrevtoolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.SetCurrToPrevtoolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.ClearChangeCountstoolStripButton = new System.Windows.Forms.ToolStripButton(); this.ClearChangeCountstoolStripButton = new System.Windows.Forms.ToolStripButton();
this.UndotoolStripButton = new System.Windows.Forms.ToolStripButton(); this.UndotoolStripButton = new System.Windows.Forms.ToolStripButton();
this.WatchtoolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStrip2 = new System.Windows.Forms.ToolStrip(); this.toolStrip2 = new System.Windows.Forms.ToolStrip();
this.DataSizetoolStripSplitButton1 = new System.Windows.Forms.ToolStripSplitButton(); this.DataSizetoolStripSplitButton1 = new System.Windows.Forms.ToolStripSplitButton();
this.byteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.byteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -152,8 +154,8 @@
this.TruncateFromFiletoolStripButton2, this.TruncateFromFiletoolStripButton2,
this.ExcludeRamWatchtoolStripButton2, this.ExcludeRamWatchtoolStripButton2,
this.toolStripSeparator8, this.toolStripSeparator8,
this.WatchtoolStripButton1, this.PoketoolStripButton1,
this.PoketoolStripButton1}); this.FreezeAddressToolStrip});
this.SearchtoolStrip1.Location = new System.Drawing.Point(3, 25); this.SearchtoolStrip1.Location = new System.Drawing.Point(3, 25);
this.SearchtoolStrip1.Name = "SearchtoolStrip1"; this.SearchtoolStrip1.Name = "SearchtoolStrip1";
this.SearchtoolStrip1.Size = new System.Drawing.Size(183, 25); this.SearchtoolStrip1.Size = new System.Drawing.Size(183, 25);
@ -223,16 +225,6 @@
this.toolStripSeparator8.Name = "toolStripSeparator8"; this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(6, 25); this.toolStripSeparator8.Size = new System.Drawing.Size(6, 25);
// //
// WatchtoolStripButton1
//
this.WatchtoolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.WatchtoolStripButton1.Image = global::BizHawk.MultiClient.Properties.Resources.FindHS;
this.WatchtoolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.WatchtoolStripButton1.Name = "WatchtoolStripButton1";
this.WatchtoolStripButton1.Size = new System.Drawing.Size(23, 22);
this.WatchtoolStripButton1.Text = "Watch";
this.WatchtoolStripButton1.Click += new System.EventHandler(this.WatchtoolStripButton1_Click);
//
// PoketoolStripButton1 // PoketoolStripButton1
// //
this.PoketoolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.PoketoolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
@ -243,6 +235,16 @@
this.PoketoolStripButton1.Text = "Poke"; this.PoketoolStripButton1.Text = "Poke";
this.PoketoolStripButton1.Click += new System.EventHandler(this.PoketoolStripButton1_Click); this.PoketoolStripButton1.Click += new System.EventHandler(this.PoketoolStripButton1_Click);
// //
// FreezeAddressToolStrip
//
this.FreezeAddressToolStrip.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.FreezeAddressToolStrip.Image = global::BizHawk.MultiClient.Properties.Resources.cheat;
this.FreezeAddressToolStrip.ImageTransparentColor = System.Drawing.Color.Magenta;
this.FreezeAddressToolStrip.Name = "FreezeAddressToolStrip";
this.FreezeAddressToolStrip.Size = new System.Drawing.Size(23, 22);
this.FreezeAddressToolStrip.Text = "Freeze";
this.FreezeAddressToolStrip.Click += new System.EventHandler(this.FreezeAddressToolStrip_Click);
//
// TotalSearchLabel // TotalSearchLabel
// //
this.TotalSearchLabel.AutoSize = true; this.TotalSearchLabel.AutoSize = true;
@ -469,7 +471,8 @@
this.exludeRamWatchListToolStripMenuItem, this.exludeRamWatchListToolStripMenuItem,
this.toolStripSeparator5, this.toolStripSeparator5,
this.addSelectedToRamWatchToolStripMenuItem, this.addSelectedToRamWatchToolStripMenuItem,
this.pokeAddressToolStripMenuItem}); this.pokeAddressToolStripMenuItem,
this.freezeAddressToolStripMenuItem});
this.searchToolStripMenuItem.Name = "searchToolStripMenuItem"; this.searchToolStripMenuItem.Name = "searchToolStripMenuItem";
this.searchToolStripMenuItem.Size = new System.Drawing.Size(52, 20); this.searchToolStripMenuItem.Size = new System.Drawing.Size(52, 20);
this.searchToolStripMenuItem.Text = "&Search"; this.searchToolStripMenuItem.Text = "&Search";
@ -542,6 +545,13 @@
this.pokeAddressToolStripMenuItem.Text = "&Poke Address"; this.pokeAddressToolStripMenuItem.Text = "&Poke Address";
this.pokeAddressToolStripMenuItem.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem_Click); this.pokeAddressToolStripMenuItem.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem_Click);
// //
// freezeAddressToolStripMenuItem
//
this.freezeAddressToolStripMenuItem.Name = "freezeAddressToolStripMenuItem";
this.freezeAddressToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.freezeAddressToolStripMenuItem.Text = "Freeze Address";
this.freezeAddressToolStripMenuItem.Click += new System.EventHandler(this.freezeAddressToolStripMenuItem_Click);
//
// optionsToolStripMenuItem // optionsToolStripMenuItem
// //
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -645,10 +655,11 @@
this.toolStripSeparator7, this.toolStripSeparator7,
this.SetCurrToPrevtoolStripButton2, this.SetCurrToPrevtoolStripButton2,
this.ClearChangeCountstoolStripButton, this.ClearChangeCountstoolStripButton,
this.UndotoolStripButton}); this.UndotoolStripButton,
this.WatchtoolStripButton1});
this.toolStrip1.Location = new System.Drawing.Point(3, 0); this.toolStrip1.Location = new System.Drawing.Point(3, 0);
this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(137, 25); this.toolStrip1.Size = new System.Drawing.Size(191, 25);
this.toolStrip1.TabIndex = 1; this.toolStrip1.TabIndex = 1;
// //
// NewSearchtoolStripButton // NewSearchtoolStripButton
@ -713,6 +724,16 @@
this.UndotoolStripButton.Text = "Undo Search"; this.UndotoolStripButton.Text = "Undo Search";
this.UndotoolStripButton.Click += new System.EventHandler(this.UndotoolStripButton_Click_1); this.UndotoolStripButton.Click += new System.EventHandler(this.UndotoolStripButton_Click_1);
// //
// WatchtoolStripButton1
//
this.WatchtoolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.WatchtoolStripButton1.Image = global::BizHawk.MultiClient.Properties.Resources.FindHS;
this.WatchtoolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.WatchtoolStripButton1.Name = "WatchtoolStripButton1";
this.WatchtoolStripButton1.Size = new System.Drawing.Size(23, 22);
this.WatchtoolStripButton1.Text = "Watch";
this.WatchtoolStripButton1.Click += new System.EventHandler(this.WatchtoolStripButton1_Click);
//
// toolStrip2 // toolStrip2
// //
this.toolStrip2.Dock = System.Windows.Forms.DockStyle.None; this.toolStrip2.Dock = System.Windows.Forms.DockStyle.None;
@ -1137,7 +1158,6 @@
private System.Windows.Forms.ToolStripButton saveToolStripButton; private System.Windows.Forms.ToolStripButton saveToolStripButton;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator; private System.Windows.Forms.ToolStripSeparator toolStripSeparator;
private System.Windows.Forms.ToolStripButton cutToolStripButton; private System.Windows.Forms.ToolStripButton cutToolStripButton;
private System.Windows.Forms.ToolStripButton WatchtoolStripButton1;
private System.Windows.Forms.ToolStripButton PoketoolStripButton1; private System.Windows.Forms.ToolStripButton PoketoolStripButton1;
private System.Windows.Forms.Label TotalSearchLabel; private System.Windows.Forms.Label TotalSearchLabel;
VirtualListView SearchListView; VirtualListView SearchListView;
@ -1232,5 +1252,8 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9; private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem2; private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem memoryDomainsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem memoryDomainsToolStripMenuItem;
private System.Windows.Forms.ToolStripButton FreezeAddressToolStrip;
private System.Windows.Forms.ToolStripButton WatchtoolStripButton1;
private System.Windows.Forms.ToolStripMenuItem freezeAddressToolStripMenuItem;
} }
} }

View File

@ -18,6 +18,7 @@ namespace BizHawk.MultiClient
{ {
//TODO: //TODO:
//Context Menu - if highlighted items - show Highlight dependent functions //Context Menu - if highlighted items - show Highlight dependent functions
//Freeze address - ability to freeze multi-byte addresses
string systemID = "NULL"; string systemID = "NULL";
List<Watch> searchList = new List<Watch>(); List<Watch> searchList = new List<Watch>();
@ -481,7 +482,11 @@ namespace BizHawk.MultiClient
if (!weededList.Contains(searchList[index])) if (!weededList.Contains(searchList[index]))
{ {
color = Color.Pink; color = Color.Pink;
if (Global.MainForm.Cheats1.IsActiveCheat(Domain, searchList[index].address))
color = Color.Purple;
} }
else if (Global.MainForm.Cheats1.IsActiveCheat(Domain, searchList[index].address))
color = Color.LightCyan;
else else
color = Color.White; color = Color.White;
} }
@ -1730,5 +1735,27 @@ namespace BizHawk.MultiClient
if (i < 0x10000000) return 7; if (i < 0x10000000) return 7;
else return 8; else return 8;
} }
private void FreezeAddressToolStrip_Click(object sender, EventArgs e)
{
FreezeAddress();
}
private void FreezeAddress()
{
ListView.SelectedIndexCollection indexes = SearchListView.SelectedIndices;
//TODO: if 2 byte or 4 byte, freeze correct addresses
if (indexes.Count > 0)
{
Cheat c = new Cheat("", searchList[indexes[0]].address, (byte)searchList[indexes[0]].value,
true, Domain);
Global.MainForm.Cheats1.AddCheat(c);
}
}
private void freezeAddressToolStripMenuItem_Click(object sender, EventArgs e)
{
FreezeAddress();
}
} }
} }