The beginnings of a Hex Editor tool

This commit is contained in:
andres.delikat 2011-03-06 15:03:17 +00:00
parent 52e6727841
commit 06e7e30d6d
6 changed files with 358 additions and 3 deletions

View File

@ -188,6 +188,12 @@
<Compile Include="config\HotkeyWindow.Designer.cs">
<DependentUpon>HotkeyWindow.cs</DependentUpon>
</Compile>
<Compile Include="tools\HexEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="tools\HexEditor.Designer.cs">
<DependentUpon>HexEditor.cs</DependentUpon>
</Compile>
<Compile Include="tools\LuaWindow.cs">
<SubType>Form</SubType>
</Compile>
@ -278,6 +284,10 @@
<DependentUpon>HotkeyWindow.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="tools\HexEditor.resx">
<DependentUpon>HexEditor.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="tools\LuaWindow.resx">
<DependentUpon>LuaWindow.cs</DependentUpon>
<SubType>Designer</SubType>

View File

@ -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);
//

View File

@ -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
}
}
}

View File

@ -0,0 +1,172 @@
namespace BizHawk.MultiClient
{
partial class HexEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -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);
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>