From d470703a407dadf661a12b5aaa38fbf4dc0e11fc Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 23 Dec 2015 21:11:25 -0500 Subject: [PATCH] Add an Experimental Tools submenu that only shows in Developer Builds and move autohawk there. Add a NewHexEditor tool (in the experimental section), which is currently just a bare bones winform with all the necessary plumbing set up --- .../BizHawk.Client.EmuHawk.csproj | 9 ++ BizHawk.Client.EmuHawk/MainForm.Designer.cs | 103 +++++++++------ BizHawk.Client.EmuHawk/MainForm.Events.cs | 11 +- .../tools/HexEditor/NewHexEditor.Designer.cs | 87 +++++++++++++ .../tools/HexEditor/NewHexEditor.cs | 80 ++++++++++++ .../tools/HexEditor/NewHexEditor.resx | 123 ++++++++++++++++++ 6 files changed, 368 insertions(+), 45 deletions(-) create mode 100644 BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.Designer.cs create mode 100644 BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.cs create mode 100644 BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.resx diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 88b0b3faa6..7c313a5b1a 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -807,6 +807,12 @@ HexFind.cs + + Form + + + NewHexEditor.cs + @@ -1421,6 +1427,9 @@ HexFind.cs + + NewHexEditor.cs + LuaCanvas.cs diff --git a/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/BizHawk.Client.EmuHawk/MainForm.Designer.cs index 6f07dd6654..0cc1e43ef9 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -204,17 +204,19 @@ this.TAStudioMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MacroToolMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.VirtualPadMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.AutoHawkMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.BasicBotMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.LuaConsoleMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); this.CheatsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.LuaConsoleMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.externalToolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.dummyExternalTool = new System.Windows.Forms.ToolStripMenuItem(); + this.gameSharkConverterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator29 = new System.Windows.Forms.ToolStripSeparator(); this.MultiDiskBundlerFileMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.gameSharkConverterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.externalToolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.dummyExternalTool = new System.Windows.Forms.ToolStripMenuItem(); this.batchRunnerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ExperimentalToolsSubMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.AutoHawkMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.NewHexEditorMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.NESSubMenu = new System.Windows.Forms.ToolStripMenuItem(); this.coreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.quickNESToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -1852,7 +1854,6 @@ this.TAStudioMenuItem, this.MacroToolMenuItem, this.VirtualPadMenuItem, - this.AutoHawkMenuItem, this.BasicBotMenuItem, this.LuaConsoleMenuItem, this.toolStripSeparator11, @@ -1861,7 +1862,8 @@ this.toolStripSeparator29, this.MultiDiskBundlerFileMenuItem, this.externalToolToolStripMenuItem, - this.batchRunnerToolStripMenuItem}); + this.batchRunnerToolStripMenuItem, + this.ExperimentalToolsSubMenu}); this.ToolsSubMenu.Name = "ToolsSubMenu"; this.ToolsSubMenu.Size = new System.Drawing.Size(47, 19); this.ToolsSubMenu.Text = "&Tools"; @@ -1951,13 +1953,6 @@ this.VirtualPadMenuItem.Text = "Virtual Pad"; this.VirtualPadMenuItem.Click += new System.EventHandler(this.VirtualPadMenuItem_Click); // - // AutoHawkMenuItem - // - this.AutoHawkMenuItem.Name = "AutoHawkMenuItem"; - this.AutoHawkMenuItem.Size = new System.Drawing.Size(189, 22); - this.AutoHawkMenuItem.Text = "AutoHawk"; - this.AutoHawkMenuItem.Click += new System.EventHandler(this.AutoHawkMenuItem_Click); - // // BasicBotMenuItem // this.BasicBotMenuItem.Name = "BasicBotMenuItem"; @@ -1965,6 +1960,14 @@ this.BasicBotMenuItem.Text = "Basic Bot"; this.BasicBotMenuItem.Click += new System.EventHandler(this.BasicBotMenuItem_Click); // + // LuaConsoleMenuItem + // + this.LuaConsoleMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Lua; + this.LuaConsoleMenuItem.Name = "LuaConsoleMenuItem"; + this.LuaConsoleMenuItem.Size = new System.Drawing.Size(189, 22); + this.LuaConsoleMenuItem.Text = "Lua Console"; + this.LuaConsoleMenuItem.Click += new System.EventHandler(this.LuaConsoleMenuItem_Click); + // // toolStripSeparator11 // this.toolStripSeparator11.Name = "toolStripSeparator11"; @@ -1978,28 +1981,13 @@ this.CheatsMenuItem.Text = "Cheats"; this.CheatsMenuItem.Click += new System.EventHandler(this.CheatsMenuItem_Click); // - // LuaConsoleMenuItem + // gameSharkConverterToolStripMenuItem // - this.LuaConsoleMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Lua; - this.LuaConsoleMenuItem.Name = "LuaConsoleMenuItem"; - this.LuaConsoleMenuItem.Size = new System.Drawing.Size(189, 22); - this.LuaConsoleMenuItem.Text = "Lua Console"; - this.LuaConsoleMenuItem.Click += new System.EventHandler(this.LuaConsoleMenuItem_Click); - // - // externalToolToolStripMenuItem - // - this.externalToolToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.dummyExternalTool}); - this.externalToolToolStripMenuItem.Name = "externalToolToolStripMenuItem"; - this.externalToolToolStripMenuItem.Size = new System.Drawing.Size(189, 22); - this.externalToolToolStripMenuItem.Text = "External Tool"; - this.externalToolToolStripMenuItem.DropDownOpening += new System.EventHandler(this.ExternalToolToolStripMenuItem_DropDownOpening); - // - // dummyExternalTool - // - this.dummyExternalTool.Name = "dummyExternalTool"; - this.dummyExternalTool.Size = new System.Drawing.Size(152, 22); - this.dummyExternalTool.Text = "None"; + this.gameSharkConverterToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("gameSharkConverterToolStripMenuItem.Image"))); + this.gameSharkConverterToolStripMenuItem.Name = "gameSharkConverterToolStripMenuItem"; + this.gameSharkConverterToolStripMenuItem.Size = new System.Drawing.Size(189, 22); + this.gameSharkConverterToolStripMenuItem.Text = "GameShark Converter"; + this.gameSharkConverterToolStripMenuItem.Click += new System.EventHandler(this.gameSharkConverterToolStripMenuItem_Click); // // toolStripSeparator29 // @@ -2014,13 +2002,20 @@ this.MultiDiskBundlerFileMenuItem.Text = "Multi-disk Bundler"; this.MultiDiskBundlerFileMenuItem.Click += new System.EventHandler(this.CreateMultigameFileMenuItem_Click); // - // gameSharkConverterToolStripMenuItem + // externalToolToolStripMenuItem // - this.gameSharkConverterToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("gameSharkConverterToolStripMenuItem.Image"))); - this.gameSharkConverterToolStripMenuItem.Name = "gameSharkConverterToolStripMenuItem"; - this.gameSharkConverterToolStripMenuItem.Size = new System.Drawing.Size(189, 22); - this.gameSharkConverterToolStripMenuItem.Text = "GameShark Converter"; - this.gameSharkConverterToolStripMenuItem.Click += new System.EventHandler(this.gameSharkConverterToolStripMenuItem_Click); + this.externalToolToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.dummyExternalTool}); + this.externalToolToolStripMenuItem.Name = "externalToolToolStripMenuItem"; + this.externalToolToolStripMenuItem.Size = new System.Drawing.Size(189, 22); + this.externalToolToolStripMenuItem.Text = "External Tool"; + this.externalToolToolStripMenuItem.DropDownOpening += new System.EventHandler(this.ExternalToolToolStripMenuItem_DropDownOpening); + // + // dummyExternalTool + // + this.dummyExternalTool.Name = "dummyExternalTool"; + this.dummyExternalTool.Size = new System.Drawing.Size(103, 22); + this.dummyExternalTool.Text = "None"; // // batchRunnerToolStripMenuItem // @@ -2030,6 +2025,28 @@ this.batchRunnerToolStripMenuItem.Visible = false; this.batchRunnerToolStripMenuItem.Click += new System.EventHandler(this.batchRunnerToolStripMenuItem_Click); // + // ExperimentalToolsSubMenu + // + this.ExperimentalToolsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.AutoHawkMenuItem, + this.NewHexEditorMenuItem}); + this.ExperimentalToolsSubMenu.Name = "ExperimentalToolsSubMenu"; + this.ExperimentalToolsSubMenu.Size = new System.Drawing.Size(189, 22); + this.ExperimentalToolsSubMenu.Text = "Experimental Tools"; + this.ExperimentalToolsSubMenu.DropDownOpened += new System.EventHandler(this.ExperimentalToolsSubMenu_DropDownOpened); + // + // AutoHawkMenuItem + // + this.AutoHawkMenuItem.Name = "AutoHawkMenuItem"; + this.AutoHawkMenuItem.Size = new System.Drawing.Size(155, 22); + this.AutoHawkMenuItem.Text = "AutoHawk"; + // + // NewHexEditorMenuItem + // + this.NewHexEditorMenuItem.Name = "NewHexEditorMenuItem"; + this.NewHexEditorMenuItem.Size = new System.Drawing.Size(155, 22); + this.NewHexEditorMenuItem.Text = "New Hex Editor"; + // // NESSubMenu // this.NESSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -4033,7 +4050,6 @@ private System.Windows.Forms.ToolStripMenuItem GBAmGBAMenuItem; private System.Windows.Forms.ToolStripMenuItem GBAVBANextMenuItem; private System.Windows.Forms.ToolStripMenuItem gBAWithMGBAToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem AutoHawkMenuItem; private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem PSXHashDiscsToolStripMenuItem; private System.Windows.Forms.Timer timerMouseIdle; @@ -4060,5 +4076,8 @@ private System.Windows.Forms.ToolStripMenuItem gameSharkConverterToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem dummyExternalTool; private System.Windows.Forms.ToolStripMenuItem RecordAVMenuItem; + private System.Windows.Forms.ToolStripMenuItem ExperimentalToolsSubMenu; + private System.Windows.Forms.ToolStripMenuItem AutoHawkMenuItem; + private System.Windows.Forms.ToolStripMenuItem NewHexEditorMenuItem; } } diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index 9f154f379a..8412798904 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1260,12 +1260,11 @@ namespace BizHawk.Client.EmuHawk batchRunnerToolStripMenuItem.Visible = VersionInfo.DeveloperBuild; - AutoHawkMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); - AutoHawkMenuItem.Visible = VersionInfo.DeveloperBuild; - BasicBotMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); gameSharkConverterToolStripMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + + ExperimentalToolsSubMenu.Visible = VersionInfo.DeveloperBuild; } private void ExternalToolToolStripMenuItem_DropDownOpening(object sender, EventArgs e) @@ -1294,6 +1293,12 @@ namespace BizHawk.Client.EmuHawk } } + private void ExperimentalToolsSubMenu_DropDownOpened(object sender, EventArgs e) + { + AutoHawkMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + NewHexEditorMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + } + private void AutoHawkMenuItem_Click(object sender, EventArgs e) { GlobalWin.Tools.Load(); diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.Designer.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.Designer.cs new file mode 100644 index 0000000000..59e8d1d5b5 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.Designer.cs @@ -0,0 +1,87 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class NewHexEditor + { + /// + /// 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.HexMenu = new System.Windows.Forms.MenuStrip(); + this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.HexMenu.SuspendLayout(); + this.SuspendLayout(); + // + // HexMenu + // + this.HexMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.FileSubMenu}); + this.HexMenu.Location = new System.Drawing.Point(0, 0); + this.HexMenu.Name = "HexMenu"; + this.HexMenu.Size = new System.Drawing.Size(284, 24); + this.HexMenu.TabIndex = 0; + this.HexMenu.Text = "menuStrip1"; + // + // FileSubMenu + // + this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ExitMenuItem}); + this.FileSubMenu.Name = "FileSubMenu"; + this.FileSubMenu.Size = new System.Drawing.Size(37, 20); + this.FileSubMenu.Text = "&File"; + this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened); + // + // ExitMenuItem + // + this.ExitMenuItem.Name = "ExitMenuItem"; + this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4"; + this.ExitMenuItem.Size = new System.Drawing.Size(152, 22); + this.ExitMenuItem.Text = "E&xit"; + this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); + // + // NewHexEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 261); + this.Controls.Add(this.HexMenu); + this.MainMenuStrip = this.HexMenu; + this.Name = "NewHexEditor"; + this.Text = "NewHexEditor"; + this.Load += new System.EventHandler(this.NewHexEditor_Load); + this.HexMenu.ResumeLayout(false); + this.HexMenu.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip HexMenu; + private System.Windows.Forms.ToolStripMenuItem FileSubMenu; + private System.Windows.Forms.ToolStripMenuItem ExitMenuItem; + } +} \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.cs new file mode 100644 index 0000000000..1bc295183b --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; + +using BizHawk.Emulation.Common; + +namespace BizHawk.Client.EmuHawk +{ + public partial class NewHexEditor : Form, IToolFormAutoConfig + { + #region Initialize and Dependencies + + [RequiredService] + private IMemoryDomains MemoryDomains { get; set; } + + [RequiredService] + private IEmulator Emulator { get; set; } + + public NewHexEditor() + { + InitializeComponent(); + + Closing += (o, e) => SaveConfigSettings(); + } + + private void NewHexEditor_Load(object sender, EventArgs e) + { + + } + + private void SaveConfigSettings() + { + + } + + #endregion + + #region IToolForm implementation + + public void UpdateValues() + { + // TODO + } + + public void FastUpdate() + { + // TODO + } + + public void Restart() + { + // TODO + } + + public bool AskSaveChanges() + { + return true; // TODO + } + + public bool UpdateBefore { get { return false; } } + + #endregion + + #region Menu Items + + private void FileSubMenu_DropDownOpened(object sender, EventArgs e) + { + + } + + private void ExitMenuItem_Click(object sender, EventArgs e) + { + Close(); + } + + #endregion + } +} diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.resx b/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.resx new file mode 100644 index 0000000000..9a68370371 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/NewHexEditor.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file