diff --git a/BizHawk.MultiClient/tools/HexEditor.Designer.cs b/BizHawk.MultiClient/tools/HexEditor.Designer.cs index 9936fcdbe8..f07d82a7d1 100644 --- a/BizHawk.MultiClient/tools/HexEditor.Designer.cs +++ b/BizHawk.MultiClient/tools/HexEditor.Designer.cs @@ -56,6 +56,7 @@ this.addToRamWatchToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.freezeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.unfreezeAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pokeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.customColorsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -74,6 +75,7 @@ this.freezeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addToRamWatchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.unfreezeAllToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.pokeAddressToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.incrementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.decrementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -84,8 +86,6 @@ this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); this.AddressesLabel = new System.Windows.Forms.Label(); this.Header = new System.Windows.Forms.Label(); - this.pokeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.pokeAddressToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.ViewerContextMenuStrip.SuspendLayout(); this.MemoryViewerBox.SuspendLayout(); @@ -174,7 +174,7 @@ this.copyToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Duplicate; this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); - this.copyToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.copyToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.copyToolStripMenuItem.Text = "&Copy"; this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click); // @@ -183,20 +183,20 @@ this.pasteToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Paste; this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V))); - this.pasteToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.pasteToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.pasteToolStripMenuItem.Text = "&Paste"; this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click); // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(143, 6); // // findToolStripMenuItem1 // this.findToolStripMenuItem1.Name = "findToolStripMenuItem1"; this.findToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); - this.findToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); + this.findToolStripMenuItem1.Size = new System.Drawing.Size(146, 22); this.findToolStripMenuItem1.Text = "&Find..."; this.findToolStripMenuItem1.Click += new System.EventHandler(this.findToolStripMenuItem1_Click); // @@ -204,7 +204,7 @@ // this.findNextToolStripMenuItem.Name = "findNextToolStripMenuItem"; this.findNextToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F3; - this.findNextToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.findNextToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.findNextToolStripMenuItem.Text = "Find Next"; this.findNextToolStripMenuItem.Click += new System.EventHandler(this.findNextToolStripMenuItem_Click); // @@ -212,7 +212,7 @@ // this.findPrevToolStripMenuItem.Name = "findPrevToolStripMenuItem"; this.findPrevToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F2; - this.findPrevToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.findPrevToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.findPrevToolStripMenuItem.Text = "Find Prev"; this.findPrevToolStripMenuItem.Click += new System.EventHandler(this.findPrevToolStripMenuItem_Click); // @@ -318,6 +318,15 @@ this.unfreezeAllToolStripMenuItem.Text = "Unfreeze All"; this.unfreezeAllToolStripMenuItem.Click += new System.EventHandler(this.unfreezeAllToolStripMenuItem_Click); // + // pokeAddressToolStripMenuItem + // + this.pokeAddressToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke; + this.pokeAddressToolStripMenuItem.Name = "pokeAddressToolStripMenuItem"; + this.pokeAddressToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); + this.pokeAddressToolStripMenuItem.Size = new System.Drawing.Size(219, 22); + this.pokeAddressToolStripMenuItem.Text = "&Poke Address"; + this.pokeAddressToolStripMenuItem.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem_Click); + // // settingsToolStripMenuItem // this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -467,6 +476,15 @@ this.unfreezeAllToolStripMenuItem1.Text = "&Unfreeze All"; this.unfreezeAllToolStripMenuItem1.Click += new System.EventHandler(this.unfreezeAllToolStripMenuItem1_Click); // + // pokeAddressToolStripMenuItem1 + // + this.pokeAddressToolStripMenuItem1.Image = global::BizHawk.MultiClient.Properties.Resources.poke; + this.pokeAddressToolStripMenuItem1.Name = "pokeAddressToolStripMenuItem1"; + this.pokeAddressToolStripMenuItem1.ShortcutKeyDisplayString = "Ctrl+P"; + this.pokeAddressToolStripMenuItem1.Size = new System.Drawing.Size(219, 22); + this.pokeAddressToolStripMenuItem1.Text = "&Poke Address"; + this.pokeAddressToolStripMenuItem1.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem1_Click); + // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; @@ -551,8 +569,10 @@ this.AddressesLabel.TabIndex = 0; this.AddressesLabel.Text = "RAM"; this.AddressesLabel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseClick); + this.AddressesLabel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseDown); this.AddressesLabel.MouseLeave += new System.EventHandler(this.AddressesLabel_MouseLeave); this.AddressesLabel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseMove); + this.AddressesLabel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseUp); // // Header // @@ -564,24 +584,6 @@ this.Header.TabIndex = 2; this.Header.Text = "label1"; // - // pokeAddressToolStripMenuItem - // - this.pokeAddressToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke; - this.pokeAddressToolStripMenuItem.Name = "pokeAddressToolStripMenuItem"; - this.pokeAddressToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); - this.pokeAddressToolStripMenuItem.Size = new System.Drawing.Size(219, 22); - this.pokeAddressToolStripMenuItem.Text = "&Poke Address"; - this.pokeAddressToolStripMenuItem.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem_Click); - // - // pokeAddressToolStripMenuItem1 - // - this.pokeAddressToolStripMenuItem1.Image = global::BizHawk.MultiClient.Properties.Resources.poke; - this.pokeAddressToolStripMenuItem1.Name = "pokeAddressToolStripMenuItem1"; - this.pokeAddressToolStripMenuItem1.ShortcutKeyDisplayString = "Ctrl+P"; - this.pokeAddressToolStripMenuItem1.Size = new System.Drawing.Size(219, 22); - this.pokeAddressToolStripMenuItem1.Text = "&Poke Address"; - this.pokeAddressToolStripMenuItem1.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem1_Click); - // // HexEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor.cs index f17a652896..211c96e88c 100644 --- a/BizHawk.MultiClient/tools/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor.cs @@ -42,7 +42,9 @@ namespace BizHawk.MultiClient const int fontWidth = 7; //Width of 1 digits string FindStr = ""; bool loaded = false; - + + bool MouseIsDown = false; + byte[] ROM; MemoryDomain ROMDomain; @@ -1140,61 +1142,38 @@ namespace BizHawk.MultiClient addressOver = GetPointedAddress(e.X, e.Y); Pointedx = e.X; Pointedy = e.Y; + + if (MouseIsDown) + { + DoShiftClick(); + MemoryViewerBox.Refresh(); + } } private void AddressesLabel_MouseClick(object sender, MouseEventArgs e) { - int addressOver = GetPointedAddress(e.X, e.Y); + + } + + private void DoShiftClick() + { if (addressOver >= 0) { - if ((Control.ModifierKeys & Keys.Control) == Keys.Control) + SecondaryHighlightedAddresses.Clear(); + if (addressOver < addressHighlighted) { - if (addressOver == addressHighlighted) + for (int x = addressOver; x < addressHighlighted; x++) { - ClearHighlighted(); - } - else if (SecondaryHighlightedAddresses.Contains(addressOver)) - { - SecondaryHighlightedAddresses.Remove(addressOver); - } - else - { - SecondaryHighlightedAddresses.Add(addressOver); + SecondaryHighlightedAddresses.Add(x); } } - else if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) + else if (addressOver > addressHighlighted) { - if (addressOver >= 0) + for (int x = addressHighlighted + DataSize; x <= addressOver; x++) { - SecondaryHighlightedAddresses.Clear(); - if (addressOver < addressHighlighted) - { - for (int x = addressOver; x < addressHighlighted; x++) - { - SecondaryHighlightedAddresses.Add(x); - } - } - else if (addressOver > addressHighlighted) - { - for (int x = addressHighlighted + DataSize; x <= addressOver; x++) - { - SecondaryHighlightedAddresses.Add(x); - } - } + SecondaryHighlightedAddresses.Add(x); } } - else if (addressOver == addressHighlighted) - { - ClearHighlighted(); - } - else - { - SetHighlighted(addressOver); - SecondaryHighlightedAddresses.Clear(); - FindStr = ""; - } - - MemoryViewerBox.Refresh(); } } @@ -1506,6 +1485,10 @@ namespace BizHawk.MultiClient if (e.Modifiers == Keys.Control) AddToRamWatch(); break; + case Keys.Escape: + SecondaryHighlightedAddresses.Clear(); + ClearHighlighted(); + break; } } @@ -2175,7 +2158,7 @@ namespace BizHawk.MultiClient string value = ValueString(GetHighlightedAddress()); foreach (int x in SecondaryHighlightedAddresses) { - value += ValueString(x); + value += ValueString(x); } if (!String.IsNullOrWhiteSpace(value)) { @@ -2341,6 +2324,50 @@ namespace BizHawk.MultiClient UpdateValues(); } + private void AddressesLabel_MouseDown(object sender, MouseEventArgs e) + { + int addressOver = GetPointedAddress(e.X, e.Y); + if (addressOver >= 0) + { + if ((Control.ModifierKeys & Keys.Control) == Keys.Control) + { + if (addressOver == addressHighlighted) + { + ClearHighlighted(); + } + else if (SecondaryHighlightedAddresses.Contains(addressOver)) + { + SecondaryHighlightedAddresses.Remove(addressOver); + } + else + { + SecondaryHighlightedAddresses.Add(addressOver); + } + } + else if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) + { + DoShiftClick(); + } + //else if (addressOver == addressHighlighted) + //{ + // ClearHighlighted(); + //} + else + { + SetHighlighted(addressOver); + SecondaryHighlightedAddresses.Clear(); + FindStr = ""; + } + MemoryViewerBox.Refresh(); + } + + MouseIsDown = true; + } + + private void AddressesLabel_MouseUp(object sender, MouseEventArgs e) + { + MouseIsDown = false; + } } }