diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index fe940cacfc..c0c4df3150 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -751,6 +751,7 @@ + diff --git a/BizHawk.MultiClient/Properties/Resources.Designer.cs b/BizHawk.MultiClient/Properties/Resources.Designer.cs index 58fac28b3c..0ccfe50454 100644 --- a/BizHawk.MultiClient/Properties/Resources.Designer.cs +++ b/BizHawk.MultiClient/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.1 +// Runtime Version:4.0.30319.269 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -444,6 +444,13 @@ namespace BizHawk.MultiClient.Properties { } } + internal static System.Drawing.Bitmap Paste { + get { + object obj = ResourceManager.GetObject("Paste", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap Pause { get { object obj = ResourceManager.GetObject("Pause", resourceCulture); diff --git a/BizHawk.MultiClient/Properties/Resources.resx b/BizHawk.MultiClient/Properties/Resources.resx index a175c61606..c0474edc94 100644 --- a/BizHawk.MultiClient/Properties/Resources.resx +++ b/BizHawk.MultiClient/Properties/Resources.resx @@ -819,4 +819,7 @@ ..\images\TurboFastForward.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\images\Paste.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/BizHawk.MultiClient/images/Paste.png b/BizHawk.MultiClient/images/Paste.png new file mode 100644 index 0000000000..95d9df6220 Binary files /dev/null and b/BizHawk.MultiClient/images/Paste.png differ diff --git a/BizHawk.MultiClient/tools/HexEditor.Designer.cs b/BizHawk.MultiClient/tools/HexEditor.Designer.cs index 08f6aeaab3..6f9e7995c0 100644 --- a/BizHawk.MultiClient/tools/HexEditor.Designer.cs +++ b/BizHawk.MultiClient/tools/HexEditor.Designer.cs @@ -33,11 +33,13 @@ this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dumpToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveAsBinaryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); this.findToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.memoryDomainsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -68,7 +70,6 @@ this.MemoryViewerBox = new System.Windows.Forms.GroupBox(); this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); this.AddressesLabel = new System.Windows.Forms.Label(); - this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); this.menuStrip1.SuspendLayout(); this.ViewerContextMenuStrip.SuspendLayout(); this.MemoryViewerBox.SuspendLayout(); @@ -91,6 +92,7 @@ // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.dumpToFileToolStripMenuItem, + this.saveAsBinaryToolStripMenuItem, this.toolStripSeparator1, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; @@ -99,22 +101,28 @@ // // dumpToFileToolStripMenuItem // - this.dumpToFileToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.SaveAs; this.dumpToFileToolStripMenuItem.Name = "dumpToFileToolStripMenuItem"; - this.dumpToFileToolStripMenuItem.Size = new System.Drawing.Size(149, 22); - this.dumpToFileToolStripMenuItem.Text = "&Dump to file..."; + this.dumpToFileToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.dumpToFileToolStripMenuItem.Text = "Save as text..."; this.dumpToFileToolStripMenuItem.Click += new System.EventHandler(this.dumpToFileToolStripMenuItem_Click); // + // saveAsBinaryToolStripMenuItem + // + this.saveAsBinaryToolStripMenuItem.Name = "saveAsBinaryToolStripMenuItem"; + this.saveAsBinaryToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.saveAsBinaryToolStripMenuItem.Text = "Save as binary..."; + this.saveAsBinaryToolStripMenuItem.Click += new System.EventHandler(this.saveAsBinaryToolStripMenuItem_Click); + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(146, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(154, 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(149, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(157, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -131,6 +139,7 @@ // // copyToolStripMenuItem // + this.copyToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Duplicate; this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); this.copyToolStripMenuItem.Size = new System.Drawing.Size(152, 22); @@ -139,12 +148,18 @@ // // pasteToolStripMenuItem // + this.pasteToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Paste; this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V))); this.pasteToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.pasteToolStripMenuItem.Text = "&Paste"; this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click); // + // toolStripSeparator6 + // + this.toolStripSeparator6.Name = "toolStripSeparator6"; + this.toolStripSeparator6.Size = new System.Drawing.Size(149, 6); + // // findToolStripMenuItem1 // this.findToolStripMenuItem1.Name = "findToolStripMenuItem1"; @@ -411,11 +426,6 @@ this.AddressesLabel.MouseLeave += new System.EventHandler(this.AddressesLabel_MouseLeave); this.AddressesLabel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseMove); // - // toolStripSeparator6 - // - this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(149, 6); - // // HexEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -485,5 +495,6 @@ private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; + private System.Windows.Forms.ToolStripMenuItem saveAsBinaryToolStripMenuItem; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor.cs index 28f873773d..b556a5e28e 100644 --- a/BizHawk.MultiClient/tools/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor.cs @@ -750,10 +750,10 @@ namespace BizHawk.MultiClient private void dumpToFileToolStripMenuItem_Click(object sender, EventArgs e) { - SaveAs(); + SaveAsText(); } - private void SaveAs() + private void SaveAsText() { var file = GetSaveFileFromUser(); if (file != null) @@ -776,6 +776,23 @@ namespace BizHawk.MultiClient } } + private void SaveAsBinary() + { + var file = GetBinarySaveFileFromUser(); + if (file != null) + { + using(BinaryWriter binWriter = new BinaryWriter(File.Open(file.FullName, FileMode.Create))) + { + byte[] dump = new byte[Domain.Size]; + + for (int x = 0; x < Domain.Size; x++) + { + binWriter.Write(Domain.PeekByte(x)); + } + } + } + } + private FileInfo GetSaveFileFromUser() { var sfd = new SaveFileDialog(); @@ -799,6 +816,29 @@ namespace BizHawk.MultiClient return file; } + private FileInfo GetBinarySaveFileFromUser() + { + var sfd = new SaveFileDialog(); + + if (!(Global.Emulator is NullEmulator)) + sfd.FileName = PathManager.FilesystemSafeName(Global.Game); + else + sfd.FileName = "MemoryDump"; + + + sfd.InitialDirectory = PathManager.GetPlatformBase(Global.Emulator.SystemId); + + sfd.Filter = "Binary (*.bin)|*.bin|All Files|*.*"; + sfd.RestoreDirectory = true; + Global.Sound.StopSound(); + var result = sfd.ShowDialog(); + Global.Sound.StartSound(); + if (result != DialogResult.OK) + return null; + var file = new FileInfo(sfd.FileName); + return file; + } + public void ResetScrollBar() { vScrollBar1.Value = 0; @@ -1400,6 +1440,9 @@ namespace BizHawk.MultiClient Find(); } - + private void saveAsBinaryToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveAsBinary(); + } } }