Hex Editor - Find option, allows you to enter a series of hex values and search ram for this combination
This commit is contained in:
parent
c0d5437ff4
commit
b2c9171b90
|
@ -47,6 +47,7 @@
|
|||
this.addToRamWatchToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.freezeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.unfreezeAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.findToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveWindowsSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -59,11 +60,11 @@
|
|||
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.incrementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.decrementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.gotoAddressToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MemoryViewerBox = new System.Windows.Forms.GroupBox();
|
||||
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
|
||||
this.AddressesLabel = new System.Windows.Forms.Label();
|
||||
this.gotoAddressToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.ViewerContextMenuStrip.SuspendLayout();
|
||||
this.MemoryViewerBox.SuspendLayout();
|
||||
|
@ -120,6 +121,7 @@
|
|||
this.enToolStripMenuItem,
|
||||
this.toolStripSeparator2,
|
||||
this.goToAddressToolStripMenuItem,
|
||||
this.findToolStripMenuItem,
|
||||
this.addToRamWatchToolStripMenuItem1,
|
||||
this.freezeAddressToolStripMenuItem,
|
||||
this.unfreezeAllToolStripMenuItem});
|
||||
|
@ -213,6 +215,14 @@
|
|||
this.unfreezeAllToolStripMenuItem.Text = "Unfreeze All";
|
||||
this.unfreezeAllToolStripMenuItem.Click += new System.EventHandler(this.unfreezeAllToolStripMenuItem_Click);
|
||||
//
|
||||
// findToolStripMenuItem
|
||||
//
|
||||
this.findToolStripMenuItem.Name = "findToolStripMenuItem";
|
||||
this.findToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
|
||||
this.findToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
|
||||
this.findToolStripMenuItem.Text = "&Find...";
|
||||
this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click);
|
||||
//
|
||||
// settingsToolStripMenuItem
|
||||
//
|
||||
this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -263,7 +273,7 @@
|
|||
this.toolStripSeparator5,
|
||||
this.gotoAddressToolStripMenuItem1});
|
||||
this.ViewerContextMenuStrip.Name = "ViewerContextMenuStrip";
|
||||
this.ViewerContextMenuStrip.Size = new System.Drawing.Size(220, 170);
|
||||
this.ViewerContextMenuStrip.Size = new System.Drawing.Size(220, 148);
|
||||
this.ViewerContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.ViewerContextMenuStrip_Opening);
|
||||
//
|
||||
// freezeToolStripMenuItem
|
||||
|
@ -314,6 +324,19 @@
|
|||
this.decrementToolStripMenuItem.Text = "&Decrement";
|
||||
this.decrementToolStripMenuItem.Click += new System.EventHandler(this.decrementToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator5
|
||||
//
|
||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
this.toolStripSeparator5.Size = new System.Drawing.Size(216, 6);
|
||||
//
|
||||
// gotoAddressToolStripMenuItem1
|
||||
//
|
||||
this.gotoAddressToolStripMenuItem1.Name = "gotoAddressToolStripMenuItem1";
|
||||
this.gotoAddressToolStripMenuItem1.ShortcutKeyDisplayString = "Ctrl+G";
|
||||
this.gotoAddressToolStripMenuItem1.Size = new System.Drawing.Size(219, 22);
|
||||
this.gotoAddressToolStripMenuItem1.Text = "&Go to Addres...";
|
||||
this.gotoAddressToolStripMenuItem1.Click += new System.EventHandler(this.gotoAddressToolStripMenuItem1_Click);
|
||||
//
|
||||
// MemoryViewerBox
|
||||
//
|
||||
this.MemoryViewerBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
|
@ -357,19 +380,6 @@
|
|||
this.AddressesLabel.MouseLeave += new System.EventHandler(this.AddressesLabel_MouseLeave);
|
||||
this.AddressesLabel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseMove);
|
||||
//
|
||||
// gotoAddressToolStripMenuItem1
|
||||
//
|
||||
this.gotoAddressToolStripMenuItem1.Name = "gotoAddressToolStripMenuItem1";
|
||||
this.gotoAddressToolStripMenuItem1.ShortcutKeyDisplayString = "Ctrl+G";
|
||||
this.gotoAddressToolStripMenuItem1.Size = new System.Drawing.Size(219, 22);
|
||||
this.gotoAddressToolStripMenuItem1.Text = "&Go to Addres...";
|
||||
this.gotoAddressToolStripMenuItem1.Click += new System.EventHandler(this.gotoAddressToolStripMenuItem1_Click);
|
||||
//
|
||||
// toolStripSeparator5
|
||||
//
|
||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
this.toolStripSeparator5.Size = new System.Drawing.Size(216, 6);
|
||||
//
|
||||
// HexEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -434,5 +444,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem decrementToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem gotoAddressToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||
private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem;
|
||||
}
|
||||
}
|
|
@ -1264,5 +1264,46 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
GoToSpecifiedAddress();
|
||||
}
|
||||
|
||||
private void findToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
InputPrompt prompt = new InputPrompt();
|
||||
prompt.SetMessage("Enter a set of hex values to search for");
|
||||
prompt.SetCasing(CharacterCasing.Upper);
|
||||
prompt.HexOnly = true;
|
||||
prompt.ShowDialog();
|
||||
if (prompt.UserOK)
|
||||
{
|
||||
int found = 0;
|
||||
|
||||
string search = prompt.UserText.Replace(" ", "").ToUpper();
|
||||
|
||||
int numByte = search.Length / 2;
|
||||
for (int i = 0; i < (Domain.Size - numByte); i++)
|
||||
{
|
||||
StringBuilder ramblock = new StringBuilder();
|
||||
for (int j = 0; j < numByte; j++)
|
||||
{
|
||||
ramblock.Append(String.Format("{0:X2}", (int)Domain.PeekByte(i + j)));
|
||||
}
|
||||
string block = ramblock.ToString().ToUpper();
|
||||
if (search == block)
|
||||
{
|
||||
found = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found > 0)
|
||||
{
|
||||
GoToAddress(found);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Could not find the values: " + search);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
this.PromptBox.Name = "PromptBox";
|
||||
this.PromptBox.Size = new System.Drawing.Size(164, 20);
|
||||
this.PromptBox.TabIndex = 1;
|
||||
this.PromptBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.PromptBox_KeyPress);
|
||||
//
|
||||
// OK
|
||||
//
|
||||
|
@ -77,7 +78,7 @@
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(233, 106);
|
||||
this.ClientSize = new System.Drawing.Size(235, 106);
|
||||
this.Controls.Add(this.Cancel);
|
||||
this.Controls.Add(this.OK);
|
||||
this.Controls.Add(this.PromptBox);
|
||||
|
|
|
@ -9,39 +9,59 @@ using System.Windows.Forms;
|
|||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple form that prompts the user for a single line of input
|
||||
/// </summary>
|
||||
public partial class InputPrompt : Form
|
||||
{
|
||||
public bool UserOK = false; //Will be true if the user selects Ok
|
||||
public string UserText = ""; //What the user selected
|
||||
|
||||
public InputPrompt()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// A simple form that prompts the user for a single line of input
|
||||
/// </summary>
|
||||
public partial class InputPrompt : Form
|
||||
{
|
||||
public bool UserOK = false; //Will be true if the user selects Ok
|
||||
public string UserText = ""; //What the user selected
|
||||
public bool HexOnly = false;
|
||||
public InputPrompt()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetMessage(string message)
|
||||
{
|
||||
PromptLabel.Text = message;
|
||||
}
|
||||
public void SetMessage(string message)
|
||||
{
|
||||
PromptLabel.Text = message;
|
||||
}
|
||||
|
||||
private void InputPrompt_Load(object sender, EventArgs e)
|
||||
{
|
||||
public void SetCasing(CharacterCasing casing)
|
||||
{
|
||||
PromptBox.CharacterCasing = casing;
|
||||
}
|
||||
|
||||
}
|
||||
private void InputPrompt_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
private void OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
UserOK = true;
|
||||
UserText = PromptBox.Text;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
private void OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
UserOK = true;
|
||||
UserText = PromptBox.Text;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void PromptBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (HexOnly)
|
||||
{
|
||||
if (e.KeyChar == '\b')
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (!InputValidate.IsValidHexNumber(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue