From 498b2b4dd9f823eaf8882200b5d73043d823884e Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 1 Mar 2017 15:06:58 -0600 Subject: [PATCH] hex editor: add import binary tool (quick and dirty way to effect .sav importing in many cases) --- .../tools/HexEditor/HexEditor.Designer.cs | 108 ++++++++++-------- .../tools/HexEditor/HexEditor.cs | 30 +++++ 2 files changed, 89 insertions(+), 49 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.Designer.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.Designer.cs index 14a56104cc..dfe62e01f1 100644 --- a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.Designer.cs @@ -35,6 +35,7 @@ this.SaveMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SaveAsBinaryMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SaveAsTextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importAsBinaryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.LoadTableFileMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CloseTableFileMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -117,6 +118,7 @@ this.SaveMenuItem, this.SaveAsBinaryMenuItem, this.SaveAsTextMenuItem, + this.importAsBinaryToolStripMenuItem, this.toolStripSeparator4, this.LoadTableFileMenuItem, this.CloseTableFileMenuItem, @@ -133,7 +135,7 @@ this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs; this.SaveMenuItem.Name = "SaveMenuItem"; this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.SaveMenuItem.Size = new System.Drawing.Size(236, 22); + this.SaveMenuItem.Size = new System.Drawing.Size(225, 22); this.SaveMenuItem.Text = "Save"; this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click); // @@ -142,33 +144,41 @@ this.SaveAsBinaryMenuItem.Name = "SaveAsBinaryMenuItem"; this.SaveAsBinaryMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.S))); - this.SaveAsBinaryMenuItem.Size = new System.Drawing.Size(236, 22); + this.SaveAsBinaryMenuItem.Size = new System.Drawing.Size(225, 22); this.SaveAsBinaryMenuItem.Text = "Save as binary..."; this.SaveAsBinaryMenuItem.Click += new System.EventHandler(this.SaveAsBinaryMenuItem_Click); // // SaveAsTextMenuItem // this.SaveAsTextMenuItem.Name = "SaveAsTextMenuItem"; - this.SaveAsTextMenuItem.Size = new System.Drawing.Size(236, 22); + this.SaveAsTextMenuItem.Size = new System.Drawing.Size(225, 22); this.SaveAsTextMenuItem.Text = "Save as text..."; this.SaveAsTextMenuItem.Click += new System.EventHandler(this.SaveAsTextMenuItem_Click); // + // importAsBinaryToolStripMenuItem + // + this.importAsBinaryToolStripMenuItem.Name = "importAsBinaryToolStripMenuItem"; + this.importAsBinaryToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); + this.importAsBinaryToolStripMenuItem.Size = new System.Drawing.Size(225, 22); + this.importAsBinaryToolStripMenuItem.Text = "Import as binary..."; + this.importAsBinaryToolStripMenuItem.Click += new System.EventHandler(this.importAsBinaryToolStripMenuItem_Click); + // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(233, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(222, 6); // // LoadTableFileMenuItem // this.LoadTableFileMenuItem.Name = "LoadTableFileMenuItem"; - this.LoadTableFileMenuItem.Size = new System.Drawing.Size(236, 22); + this.LoadTableFileMenuItem.Size = new System.Drawing.Size(225, 22); this.LoadTableFileMenuItem.Text = "&Load .tbl file"; this.LoadTableFileMenuItem.Click += new System.EventHandler(this.LoadTableFileMenuItem_Click); // // CloseTableFileMenuItem // this.CloseTableFileMenuItem.Name = "CloseTableFileMenuItem"; - this.CloseTableFileMenuItem.Size = new System.Drawing.Size(236, 22); + this.CloseTableFileMenuItem.Size = new System.Drawing.Size(225, 22); this.CloseTableFileMenuItem.Text = "Close .tbl file"; this.CloseTableFileMenuItem.Click += new System.EventHandler(this.CloseTableFileMenuItem_Click); // @@ -177,26 +187,26 @@ this.RecentTablesSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.noneToolStripMenuItem}); this.RecentTablesSubMenu.Name = "RecentTablesSubMenu"; - this.RecentTablesSubMenu.Size = new System.Drawing.Size(236, 22); + this.RecentTablesSubMenu.Size = new System.Drawing.Size(225, 22); this.RecentTablesSubMenu.Text = "Recent"; this.RecentTablesSubMenu.DropDownOpened += new System.EventHandler(this.RecentTablesSubMenu_DropDownOpened); // // noneToolStripMenuItem // this.noneToolStripMenuItem.Name = "noneToolStripMenuItem"; - this.noneToolStripMenuItem.Size = new System.Drawing.Size(110, 22); + this.noneToolStripMenuItem.Size = new System.Drawing.Size(99, 22); this.noneToolStripMenuItem.Text = "None"; // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(233, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(222, 6); // // ExitMenuItem // this.ExitMenuItem.Name = "ExitMenuItem"; this.ExitMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); - this.ExitMenuItem.Size = new System.Drawing.Size(236, 22); + this.ExitMenuItem.Size = new System.Drawing.Size(225, 22); this.ExitMenuItem.Text = "E&xit"; this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); // @@ -220,7 +230,7 @@ this.CopyMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Duplicate; this.CopyMenuItem.Name = "CopyMenuItem"; this.CopyMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); - this.CopyMenuItem.Size = new System.Drawing.Size(155, 22); + this.CopyMenuItem.Size = new System.Drawing.Size(144, 22); this.CopyMenuItem.Text = "&Copy"; this.CopyMenuItem.Click += new System.EventHandler(this.CopyMenuItem_Click); // @@ -228,7 +238,7 @@ // this.ExportMenuItem.Name = "ExportMenuItem"; this.ExportMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E))); - this.ExportMenuItem.Size = new System.Drawing.Size(155, 22); + this.ExportMenuItem.Size = new System.Drawing.Size(144, 22); this.ExportMenuItem.Text = "&Export"; this.ExportMenuItem.Click += new System.EventHandler(this.ExportMenuItem_Click); // @@ -237,20 +247,20 @@ this.PasteMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Paste; this.PasteMenuItem.Name = "PasteMenuItem"; this.PasteMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V))); - this.PasteMenuItem.Size = new System.Drawing.Size(155, 22); + this.PasteMenuItem.Size = new System.Drawing.Size(144, 22); this.PasteMenuItem.Text = "&Paste"; this.PasteMenuItem.Click += new System.EventHandler(this.PasteMenuItem_Click); // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(152, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(141, 6); // // FindMenuItem // this.FindMenuItem.Name = "FindMenuItem"; this.FindMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); - this.FindMenuItem.Size = new System.Drawing.Size(155, 22); + this.FindMenuItem.Size = new System.Drawing.Size(144, 22); this.FindMenuItem.Text = "&Find..."; this.FindMenuItem.Click += new System.EventHandler(this.FindMenuItem_Click); // @@ -258,7 +268,7 @@ // this.FindNextMenuItem.Name = "FindNextMenuItem"; this.FindNextMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F3; - this.FindNextMenuItem.Size = new System.Drawing.Size(155, 22); + this.FindNextMenuItem.Size = new System.Drawing.Size(144, 22); this.FindNextMenuItem.Text = "Find Next"; this.FindNextMenuItem.Click += new System.EventHandler(this.FindNextMenuItem_Click); // @@ -266,7 +276,7 @@ // this.FindPrevMenuItem.Name = "FindPrevMenuItem"; this.FindPrevMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F2; - this.FindPrevMenuItem.Size = new System.Drawing.Size(155, 22); + this.FindPrevMenuItem.Size = new System.Drawing.Size(144, 22); this.FindPrevMenuItem.Text = "Find Prev"; this.FindPrevMenuItem.Click += new System.EventHandler(this.FindPrevMenuItem_Click); // @@ -292,7 +302,7 @@ this.MemoryDomainsMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator3}); this.MemoryDomainsMenuItem.Name = "MemoryDomainsMenuItem"; - this.MemoryDomainsMenuItem.Size = new System.Drawing.Size(217, 22); + this.MemoryDomainsMenuItem.Size = new System.Drawing.Size(207, 22); this.MemoryDomainsMenuItem.Text = "&Memory Domains"; this.MemoryDomainsMenuItem.DropDownOpened += new System.EventHandler(this.MemoryDomainsMenuItem_DropDownOpened); // @@ -308,47 +318,47 @@ this.DataSizeWordMenuItem, this.DataSizeDWordMenuItem}); this.DataSizeSubMenu.Name = "DataSizeSubMenu"; - this.DataSizeSubMenu.Size = new System.Drawing.Size(217, 22); + this.DataSizeSubMenu.Size = new System.Drawing.Size(207, 22); this.DataSizeSubMenu.Text = "Data Size"; // // DataSizeByteMenuItem // this.DataSizeByteMenuItem.Name = "DataSizeByteMenuItem"; - this.DataSizeByteMenuItem.Size = new System.Drawing.Size(116, 22); + this.DataSizeByteMenuItem.Size = new System.Drawing.Size(105, 22); this.DataSizeByteMenuItem.Text = "1 Byte"; this.DataSizeByteMenuItem.Click += new System.EventHandler(this.DataSizeByteMenuItem_Click); // // DataSizeWordMenuItem // this.DataSizeWordMenuItem.Name = "DataSizeWordMenuItem"; - this.DataSizeWordMenuItem.Size = new System.Drawing.Size(116, 22); + this.DataSizeWordMenuItem.Size = new System.Drawing.Size(105, 22); this.DataSizeWordMenuItem.Text = "2 Byte"; this.DataSizeWordMenuItem.Click += new System.EventHandler(this.DataSizeWordMenuItem_Click); // // DataSizeDWordMenuItem // this.DataSizeDWordMenuItem.Name = "DataSizeDWordMenuItem"; - this.DataSizeDWordMenuItem.Size = new System.Drawing.Size(116, 22); + this.DataSizeDWordMenuItem.Size = new System.Drawing.Size(105, 22); this.DataSizeDWordMenuItem.Text = "4 Byte"; this.DataSizeDWordMenuItem.Click += new System.EventHandler(this.DataSizeDWordMenuItem_Click); // // BigEndianMenuItem // this.BigEndianMenuItem.Name = "BigEndianMenuItem"; - this.BigEndianMenuItem.Size = new System.Drawing.Size(217, 22); + this.BigEndianMenuItem.Size = new System.Drawing.Size(207, 22); this.BigEndianMenuItem.Text = "Big Endian"; this.BigEndianMenuItem.Click += new System.EventHandler(this.BigEndianMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(214, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(204, 6); // // GoToAddressMenuItem // this.GoToAddressMenuItem.Name = "GoToAddressMenuItem"; this.GoToAddressMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); - this.GoToAddressMenuItem.Size = new System.Drawing.Size(217, 22); + this.GoToAddressMenuItem.Size = new System.Drawing.Size(207, 22); this.GoToAddressMenuItem.Text = "&Go to Address..."; this.GoToAddressMenuItem.Click += new System.EventHandler(this.GoToAddressMenuItem_Click); // @@ -357,7 +367,7 @@ this.AddToRamWatchMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.FindHS; this.AddToRamWatchMenuItem.Name = "AddToRamWatchMenuItem"; this.AddToRamWatchMenuItem.ShortcutKeyDisplayString = "Ctrl+W"; - this.AddToRamWatchMenuItem.Size = new System.Drawing.Size(217, 22); + this.AddToRamWatchMenuItem.Size = new System.Drawing.Size(207, 22); this.AddToRamWatchMenuItem.Text = "Add to RAM Watch"; this.AddToRamWatchMenuItem.Click += new System.EventHandler(this.AddToRamWatchMenuItem_Click); // @@ -366,7 +376,7 @@ this.FreezeAddressMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Freeze; this.FreezeAddressMenuItem.Name = "FreezeAddressMenuItem"; this.FreezeAddressMenuItem.ShortcutKeyDisplayString = "Space"; - this.FreezeAddressMenuItem.Size = new System.Drawing.Size(217, 22); + this.FreezeAddressMenuItem.Size = new System.Drawing.Size(207, 22); this.FreezeAddressMenuItem.Text = "&Freeze Address"; this.FreezeAddressMenuItem.Click += new System.EventHandler(this.FreezeAddressMenuItem_Click); // @@ -375,7 +385,7 @@ this.UnfreezeAllMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Unfreeze; this.UnfreezeAllMenuItem.Name = "UnfreezeAllMenuItem"; this.UnfreezeAllMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.Delete))); - this.UnfreezeAllMenuItem.Size = new System.Drawing.Size(217, 22); + this.UnfreezeAllMenuItem.Size = new System.Drawing.Size(207, 22); this.UnfreezeAllMenuItem.Text = "Unfreeze All"; this.UnfreezeAllMenuItem.Click += new System.EventHandler(this.UnfreezeAllMenuItem_Click); // @@ -384,7 +394,7 @@ this.PokeAddressMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.poke; this.PokeAddressMenuItem.Name = "PokeAddressMenuItem"; this.PokeAddressMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); - this.PokeAddressMenuItem.Size = new System.Drawing.Size(217, 22); + this.PokeAddressMenuItem.Size = new System.Drawing.Size(207, 22); this.PokeAddressMenuItem.Text = "&Poke Address"; this.PokeAddressMenuItem.Click += new System.EventHandler(this.PokeAddressMenuItem_Click); // @@ -403,25 +413,25 @@ this.toolStripSeparator8, this.ResetColorsToDefaultMenuItem}); this.CustomColorsSubMenu.Name = "CustomColorsSubMenu"; - this.CustomColorsSubMenu.Size = new System.Drawing.Size(154, 22); + this.CustomColorsSubMenu.Size = new System.Drawing.Size(143, 22); this.CustomColorsSubMenu.Text = "Custom Colors"; // // SetColorsMenuItem // this.SetColorsMenuItem.Name = "SetColorsMenuItem"; - this.SetColorsMenuItem.Size = new System.Drawing.Size(164, 22); + this.SetColorsMenuItem.Size = new System.Drawing.Size(153, 22); this.SetColorsMenuItem.Text = "Set Colors"; this.SetColorsMenuItem.Click += new System.EventHandler(this.SetColorsMenuItem_Click); // // toolStripSeparator8 // this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(161, 6); + this.toolStripSeparator8.Size = new System.Drawing.Size(150, 6); // // ResetColorsToDefaultMenuItem // this.ResetColorsToDefaultMenuItem.Name = "ResetColorsToDefaultMenuItem"; - this.ResetColorsToDefaultMenuItem.Size = new System.Drawing.Size(164, 22); + this.ResetColorsToDefaultMenuItem.Size = new System.Drawing.Size(153, 22); this.ResetColorsToDefaultMenuItem.Text = "Reset to Default"; this.ResetColorsToDefaultMenuItem.Click += new System.EventHandler(this.ResetColorsToDefaultMenuItem_Click); // @@ -454,7 +464,7 @@ this.toolStripMenuItem1, this.viewN64MatrixToolStripMenuItem}); this.ViewerContextMenuStrip.Name = "ViewerContextMenuStrip"; - this.ViewerContextMenuStrip.Size = new System.Drawing.Size(207, 264); + this.ViewerContextMenuStrip.Size = new System.Drawing.Size(208, 264); this.ViewerContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.ViewerContextMenuStrip_Opening); // // CopyContextItem @@ -462,7 +472,7 @@ this.CopyContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Duplicate; this.CopyContextItem.Name = "CopyContextItem"; this.CopyContextItem.ShortcutKeyDisplayString = "Ctrl+C"; - this.CopyContextItem.Size = new System.Drawing.Size(206, 22); + this.CopyContextItem.Size = new System.Drawing.Size(207, 22); this.CopyContextItem.Text = "&Copy"; this.CopyContextItem.Click += new System.EventHandler(this.CopyMenuItem_Click); // @@ -470,7 +480,7 @@ // this.ExportContextItem.Name = "ExportContextItem"; this.ExportContextItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E))); - this.ExportContextItem.Size = new System.Drawing.Size(206, 22); + this.ExportContextItem.Size = new System.Drawing.Size(207, 22); this.ExportContextItem.Text = "&Export"; // // PasteContextItem @@ -478,7 +488,7 @@ this.PasteContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Paste; this.PasteContextItem.Name = "PasteContextItem"; this.PasteContextItem.ShortcutKeyDisplayString = "Ctrl+V"; - this.PasteContextItem.Size = new System.Drawing.Size(206, 22); + this.PasteContextItem.Size = new System.Drawing.Size(207, 22); this.PasteContextItem.Text = "&Paste"; this.PasteContextItem.Click += new System.EventHandler(this.PasteMenuItem_Click); // @@ -487,7 +497,7 @@ this.FreezeContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Freeze; this.FreezeContextItem.Name = "FreezeContextItem"; this.FreezeContextItem.ShortcutKeyDisplayString = "Space"; - this.FreezeContextItem.Size = new System.Drawing.Size(206, 22); + this.FreezeContextItem.Size = new System.Drawing.Size(207, 22); this.FreezeContextItem.Text = "&Freeze"; this.FreezeContextItem.Click += new System.EventHandler(this.FreezeAddressMenuItem_Click); // @@ -496,7 +506,7 @@ this.AddToRamWatchContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.FindHS; this.AddToRamWatchContextItem.Name = "AddToRamWatchContextItem"; this.AddToRamWatchContextItem.ShortcutKeyDisplayString = "Ctrl+W"; - this.AddToRamWatchContextItem.Size = new System.Drawing.Size(206, 22); + this.AddToRamWatchContextItem.Size = new System.Drawing.Size(207, 22); this.AddToRamWatchContextItem.Text = "&Add to RAM Watch"; this.AddToRamWatchContextItem.Click += new System.EventHandler(this.AddToRamWatchMenuItem_Click); // @@ -505,7 +515,7 @@ this.UnfreezeAllContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Unfreeze; this.UnfreezeAllContextItem.Name = "UnfreezeAllContextItem"; this.UnfreezeAllContextItem.ShortcutKeyDisplayString = "Shift+Del"; - this.UnfreezeAllContextItem.Size = new System.Drawing.Size(206, 22); + this.UnfreezeAllContextItem.Size = new System.Drawing.Size(207, 22); this.UnfreezeAllContextItem.Text = "&Unfreeze All"; this.UnfreezeAllContextItem.Click += new System.EventHandler(this.UnfreezeAllMenuItem_Click); // @@ -514,20 +524,20 @@ this.PokeContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.poke; this.PokeContextItem.Name = "PokeContextItem"; this.PokeContextItem.ShortcutKeyDisplayString = "Ctrl+P"; - this.PokeContextItem.Size = new System.Drawing.Size(206, 22); + this.PokeContextItem.Size = new System.Drawing.Size(207, 22); this.PokeContextItem.Text = "&Poke Address"; this.PokeContextItem.Click += new System.EventHandler(this.PokeAddressMenuItem_Click); // // ContextSeparator1 // this.ContextSeparator1.Name = "ContextSeparator1"; - this.ContextSeparator1.Size = new System.Drawing.Size(203, 6); + this.ContextSeparator1.Size = new System.Drawing.Size(204, 6); // // IncrementContextItem // this.IncrementContextItem.Name = "IncrementContextItem"; this.IncrementContextItem.ShortcutKeyDisplayString = "+"; - this.IncrementContextItem.Size = new System.Drawing.Size(206, 22); + this.IncrementContextItem.Size = new System.Drawing.Size(207, 22); this.IncrementContextItem.Text = "&Increment"; this.IncrementContextItem.Click += new System.EventHandler(this.IncrementContextItem_Click); // @@ -535,32 +545,32 @@ // this.DecrementContextItem.Name = "DecrementContextItem"; this.DecrementContextItem.ShortcutKeyDisplayString = "-"; - this.DecrementContextItem.Size = new System.Drawing.Size(206, 22); + this.DecrementContextItem.Size = new System.Drawing.Size(207, 22); this.DecrementContextItem.Text = "&Decrement"; this.DecrementContextItem.Click += new System.EventHandler(this.DecrementContextItem_Click); // // ContextSeparator2 // this.ContextSeparator2.Name = "ContextSeparator2"; - this.ContextSeparator2.Size = new System.Drawing.Size(203, 6); + this.ContextSeparator2.Size = new System.Drawing.Size(204, 6); // // GoToContextItem // this.GoToContextItem.Name = "GoToContextItem"; this.GoToContextItem.ShortcutKeyDisplayString = "Ctrl+G"; - this.GoToContextItem.Size = new System.Drawing.Size(206, 22); + this.GoToContextItem.Size = new System.Drawing.Size(207, 22); this.GoToContextItem.Text = "&Go to Address..."; this.GoToContextItem.Click += new System.EventHandler(this.GoToAddressMenuItem_Click); // // toolStripMenuItem1 // this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(203, 6); + this.toolStripMenuItem1.Size = new System.Drawing.Size(204, 6); // // viewN64MatrixToolStripMenuItem // this.viewN64MatrixToolStripMenuItem.Name = "viewN64MatrixToolStripMenuItem"; - this.viewN64MatrixToolStripMenuItem.Size = new System.Drawing.Size(206, 22); + this.viewN64MatrixToolStripMenuItem.Size = new System.Drawing.Size(207, 22); this.viewN64MatrixToolStripMenuItem.Text = "View N64 Matrix"; this.viewN64MatrixToolStripMenuItem.Click += new System.EventHandler(this.viewN64MatrixToolStripMenuItem_Click); // @@ -573,7 +583,6 @@ this.MemoryViewerBox.Controls.Add(this.HexScrollBar); this.MemoryViewerBox.Controls.Add(this.AddressLabel); this.MemoryViewerBox.Controls.Add(this.AddressesLabel); - this.MemoryViewerBox.Controls.Add(this.Header); this.MemoryViewerBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.MemoryViewerBox.Location = new System.Drawing.Point(12, 27); this.MemoryViewerBox.MaximumSize = new System.Drawing.Size(600, 1024); @@ -722,5 +731,6 @@ private System.Windows.Forms.ToolStripMenuItem viewN64MatrixToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem ExportContextItem; private System.Windows.Forms.ToolStripMenuItem ExportMenuItem; + private System.Windows.Forms.ToolStripMenuItem importAsBinaryToolStripMenuItem; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index ddc2ac8a15..c2abbc5687 100644 --- a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -1274,6 +1274,35 @@ namespace BizHawk.Client.EmuHawk } } + private void importAsBinaryToolStripMenuItem_Click(object sender, EventArgs e) + { + if(!_domain.CanPoke()) + { + MessageBox.Show("This Memory Domain can't be Poked; so importing can't work"); + return; + } + + var sfd = new OpenFileDialog + { + Filter = "Binary (*.bin)|*.bin|Save Files (*.sav)|*.sav|All Files|*.*", + RestoreDirectory = true, + }; + + var result = sfd.ShowHawkDialog(); + if(result != System.Windows.Forms.DialogResult.OK) return; + + var path = sfd.FileName; + + using (var inf = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)) + { + long todo = Math.Min(inf.Length, _domain.Size); + for (long i = 0; i < todo; i++) + { + _domain.PokeByte(i, (byte)inf.ReadByte()); + } + } + } + private void SaveAsTextMenuItem_Click(object sender, EventArgs e) { var path = GetSaveFileFromUser(); @@ -2349,5 +2378,6 @@ namespace BizHawk.Client.EmuHawk } + } }