From 06e7e30d6dcae6b5fc14fa52e40d05829c93707c Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sun, 6 Mar 2011 15:03:17 +0000 Subject: [PATCH] The beginnings of a Hex Editor tool --- .../BizHawk.MultiClient.csproj | 10 + BizHawk.MultiClient/MainForm.Designer.cs | 6 +- BizHawk.MultiClient/MainForm.cs | 6 + .../tools/HexEditor.Designer.cs | 172 ++++++++++++++++++ BizHawk.MultiClient/tools/HexEditor.cs | 44 +++++ BizHawk.MultiClient/tools/HexEditor.resx | 123 +++++++++++++ 6 files changed, 358 insertions(+), 3 deletions(-) create mode 100644 BizHawk.MultiClient/tools/HexEditor.Designer.cs create mode 100644 BizHawk.MultiClient/tools/HexEditor.cs create mode 100644 BizHawk.MultiClient/tools/HexEditor.resx diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index c6f799cecf..c6e0120a5e 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -188,6 +188,12 @@ HotkeyWindow.cs + + Form + + + HexEditor.cs + Form @@ -278,6 +284,10 @@ HotkeyWindow.cs Designer + + HexEditor.cs + Designer + LuaWindow.cs Designer diff --git a/BizHawk.MultiClient/MainForm.Designer.cs b/BizHawk.MultiClient/MainForm.Designer.cs index 9598b5e38e..9c53544457 100644 --- a/BizHawk.MultiClient/MainForm.Designer.cs +++ b/BizHawk.MultiClient/MainForm.Designer.cs @@ -1164,10 +1164,10 @@ // // hexEditorToolStripMenuItem // - this.hexEditorToolStripMenuItem.Enabled = false; this.hexEditorToolStripMenuItem.Name = "hexEditorToolStripMenuItem"; this.hexEditorToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.hexEditorToolStripMenuItem.Text = "&Hex Editor"; + this.hexEditorToolStripMenuItem.Click += new System.EventHandler(this.hexEditorToolStripMenuItem_Click); // // luaConsoleToolStripMenuItem // @@ -1220,14 +1220,14 @@ // this.helpToolStripMenuItem1.Enabled = false; this.helpToolStripMenuItem1.Name = "helpToolStripMenuItem1"; - this.helpToolStripMenuItem1.Size = new System.Drawing.Size(114, 22); + this.helpToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); this.helpToolStripMenuItem1.Text = "&Help"; this.helpToolStripMenuItem1.Click += new System.EventHandler(this.helpToolStripMenuItem1_Click); // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.aboutToolStripMenuItem.Text = "&About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 7dec5490d9..c377deb368 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1134,5 +1134,11 @@ namespace BizHawk.MultiClient { Global.Config.RewindEnabled ^= true; } + + private void hexEditorToolStripMenuItem_Click(object sender, EventArgs e) + { + HexEditor h = new HexEditor(); + h.Show(); //TODO: make global + autoload capabilities + } } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/HexEditor.Designer.cs b/BizHawk.MultiClient/tools/HexEditor.Designer.cs new file mode 100644 index 0000000000..8309bb70fa --- /dev/null +++ b/BizHawk.MultiClient/tools/HexEditor.Designer.cs @@ -0,0 +1,172 @@ +namespace BizHawk.MultiClient +{ + partial class HexEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.MemoryViewer = new System.Windows.Forms.GroupBox(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.dumpToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.memoryDomainsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.dataSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.byteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.byteToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.byteToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // MemoryViewer + // + this.MemoryViewer.Location = new System.Drawing.Point(12, 37); + this.MemoryViewer.Name = "MemoryViewer"; + this.MemoryViewer.Size = new System.Drawing.Size(484, 328); + this.MemoryViewer.TabIndex = 0; + this.MemoryViewer.TabStop = false; + this.MemoryViewer.Text = "RAM"; + this.MemoryViewer.Paint += new System.Windows.Forms.PaintEventHandler(this.MemoryViewer_Paint); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.optionsToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(508, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.dumpToFileToolStripMenuItem, + this.toolStripSeparator1, + this.exitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // dumpToFileToolStripMenuItem + // + this.dumpToFileToolStripMenuItem.Name = "dumpToFileToolStripMenuItem"; + this.dumpToFileToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.dumpToFileToolStripMenuItem.Text = "&Dump to file..."; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(151, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.exitToolStripMenuItem.Text = "E&xit"; + this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); + // + // optionsToolStripMenuItem + // + this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.memoryDomainsToolStripMenuItem, + this.dataSizeToolStripMenuItem}); + this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20); + this.optionsToolStripMenuItem.Text = "&Options"; + // + // memoryDomainsToolStripMenuItem + // + this.memoryDomainsToolStripMenuItem.Name = "memoryDomainsToolStripMenuItem"; + this.memoryDomainsToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.memoryDomainsToolStripMenuItem.Text = "&Memory Domains"; + // + // dataSizeToolStripMenuItem + // + this.dataSizeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.byteToolStripMenuItem, + this.byteToolStripMenuItem1, + this.byteToolStripMenuItem2}); + this.dataSizeToolStripMenuItem.Name = "dataSizeToolStripMenuItem"; + this.dataSizeToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.dataSizeToolStripMenuItem.Text = "Data Size"; + // + // byteToolStripMenuItem + // + this.byteToolStripMenuItem.Name = "byteToolStripMenuItem"; + this.byteToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.byteToolStripMenuItem.Text = "1 Byte"; + // + // byteToolStripMenuItem1 + // + this.byteToolStripMenuItem1.Name = "byteToolStripMenuItem1"; + this.byteToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); + this.byteToolStripMenuItem1.Text = "2 Byte"; + // + // byteToolStripMenuItem2 + // + this.byteToolStripMenuItem2.Name = "byteToolStripMenuItem2"; + this.byteToolStripMenuItem2.Size = new System.Drawing.Size(152, 22); + this.byteToolStripMenuItem2.Text = "4 Byte"; + // + // HexEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(508, 377); + this.Controls.Add(this.MemoryViewer); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "HexEditor"; + this.Text = "HexEditor"; + this.Load += new System.EventHandler(this.HexEditor_Load); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox MemoryViewer; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem dumpToFileToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem memoryDomainsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem dataSizeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem byteToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem byteToolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem byteToolStripMenuItem2; + } +} \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor.cs new file mode 100644 index 0000000000..aa9565785b --- /dev/null +++ b/BizHawk.MultiClient/tools/HexEditor.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace BizHawk.MultiClient +{ + public partial class HexEditor : Form + { + public HexEditor() + { + InitializeComponent(); + } + + private void HexEditor_Load(object sender, EventArgs e) + { + + } + + private void exitToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void MemoryViewer_Paint(object sender, PaintEventArgs e) + { + // Create a local version of the graphics object for the PictureBox. + Graphics g = e.Graphics; + + // Draw a string on the PictureBox. + g.DrawString("This is a diagonal line drawn on the control", + new Font("Arial",10), System.Drawing.Brushes.Blue, new Point(30,30)); + + // Draw a line in the PictureBox. + g.DrawLine(System.Drawing.Pens.Red, this.Left, this.Top, + this.Right, this.Bottom); + + } + } +} diff --git a/BizHawk.MultiClient/tools/HexEditor.resx b/BizHawk.MultiClient/tools/HexEditor.resx new file mode 100644 index 0000000000..69c56499b0 --- /dev/null +++ b/BizHawk.MultiClient/tools/HexEditor.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file