diff --git a/BizHawk.MultiClient/tools/HexEditor.Designer.cs b/BizHawk.MultiClient/tools/HexEditor.Designer.cs index cef272ea71..781fcacdf1 100644 --- a/BizHawk.MultiClient/tools/HexEditor.Designer.cs +++ b/BizHawk.MultiClient/tools/HexEditor.Designer.cs @@ -28,7 +28,6 @@ /// private void InitializeComponent() { - this.MemoryViewer = new MemoryViewer(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dumpToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -40,26 +39,15 @@ this.byteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.byteToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.byteToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); + this.goToAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.goToAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); + this.MemoryViewer = new BizHawk.MultiClient.MemoryViewer(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // - // MemoryViewer - // - this.MemoryViewer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - 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[] { @@ -68,7 +56,7 @@ this.settingsToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(508, 24); + this.menuStrip1.Size = new System.Drawing.Size(534, 24); this.menuStrip1.TabIndex = 1; this.menuStrip1.Text = "menuStrip1"; // @@ -115,7 +103,7 @@ // memoryDomainsToolStripMenuItem // this.memoryDomainsToolStripMenuItem.Name = "memoryDomainsToolStripMenuItem"; - this.memoryDomainsToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.memoryDomainsToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.memoryDomainsToolStripMenuItem.Text = "&Memory Domains"; // // dataSizeToolStripMenuItem @@ -125,27 +113,35 @@ this.byteToolStripMenuItem1, this.byteToolStripMenuItem2}); this.dataSizeToolStripMenuItem.Name = "dataSizeToolStripMenuItem"; - this.dataSizeToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.dataSizeToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.dataSizeToolStripMenuItem.Text = "Data Size"; // // byteToolStripMenuItem // this.byteToolStripMenuItem.Name = "byteToolStripMenuItem"; - this.byteToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.byteToolStripMenuItem.Size = new System.Drawing.Size(116, 22); this.byteToolStripMenuItem.Text = "1 Byte"; // // byteToolStripMenuItem1 // this.byteToolStripMenuItem1.Name = "byteToolStripMenuItem1"; - this.byteToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); + this.byteToolStripMenuItem1.Size = new System.Drawing.Size(116, 22); this.byteToolStripMenuItem1.Text = "2 Byte"; // // byteToolStripMenuItem2 // this.byteToolStripMenuItem2.Name = "byteToolStripMenuItem2"; - this.byteToolStripMenuItem2.Size = new System.Drawing.Size(152, 22); + this.byteToolStripMenuItem2.Size = new System.Drawing.Size(116, 22); this.byteToolStripMenuItem2.Text = "4 Byte"; // + // goToAddressToolStripMenuItem + // + this.goToAddressToolStripMenuItem.Name = "goToAddressToolStripMenuItem"; + this.goToAddressToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); + this.goToAddressToolStripMenuItem.Size = new System.Drawing.Size(192, 22); + this.goToAddressToolStripMenuItem.Text = "Go to Address"; + this.goToAddressToolStripMenuItem.Click += new System.EventHandler(this.goToAddressToolStripMenuItem_Click); + // // settingsToolStripMenuItem // this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -160,6 +156,7 @@ this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem"; this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(186, 22); this.restoreWindowSizeToolStripMenuItem.Text = "&Restore Window Size"; + this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click); // // autoloadToolStripMenuItem // @@ -167,19 +164,35 @@ this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(186, 22); this.autoloadToolStripMenuItem.Text = "Auto-load"; // - // goToAddressToolStripMenuItem + // vScrollBar1 // - this.goToAddressToolStripMenuItem.Name = "goToAddressToolStripMenuItem"; - this.goToAddressToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); - this.goToAddressToolStripMenuItem.Size = new System.Drawing.Size(192, 22); - this.goToAddressToolStripMenuItem.Text = "Go to Address"; - this.goToAddressToolStripMenuItem.Click += new System.EventHandler(this.goToAddressToolStripMenuItem_Click); + this.vScrollBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.vScrollBar1.LargeChange = 16; + this.vScrollBar1.Location = new System.Drawing.Point(515, 42); + this.vScrollBar1.Name = "vScrollBar1"; + this.vScrollBar1.Size = new System.Drawing.Size(16, 323); + this.vScrollBar1.TabIndex = 0; + // + // MemoryViewer + // + this.MemoryViewer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.MemoryViewer.Location = new System.Drawing.Point(12, 37); + this.MemoryViewer.Name = "MemoryViewer"; + this.MemoryViewer.Size = new System.Drawing.Size(502, 328); + this.MemoryViewer.TabIndex = 0; + this.MemoryViewer.TabStop = false; + this.MemoryViewer.Text = "RAM"; + this.MemoryViewer.Paint += new System.Windows.Forms.PaintEventHandler(this.MemoryViewer_Paint); // // 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.ClientSize = new System.Drawing.Size(534, 377); + this.Controls.Add(this.vScrollBar1); this.Controls.Add(this.MemoryViewer); this.Controls.Add(this.menuStrip1); this.MainMenuStrip = this.menuStrip1; @@ -211,5 +224,6 @@ private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem restoreWindowSizeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem; + private System.Windows.Forms.VScrollBar vScrollBar1; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor.cs index 2386347ed0..1133140724 100644 --- a/BizHawk.MultiClient/tools/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor.cs @@ -12,9 +12,9 @@ namespace BizHawk.MultiClient public partial class HexEditor : Form { //TODO: + //Length of values doesn't match //Find text box - autohighlights matches, and shows total matches //Implement Goto address - //Scroll bar //Users can customize background, & text colors //Context menu - Poke, Freeze/Unfreeze, Watch //Tool strip @@ -73,21 +73,23 @@ namespace BizHawk.MultiClient { unchecked { - e.Graphics.DrawLine(new Pen(regBrush), MemoryViewer.Left + 46, MemoryViewer.Top, MemoryViewer.Left + 46, MemoryViewer.Bottom-40); - e.Graphics.DrawString(HEADER, font, regBrush, new Point(16, 16)); - e.Graphics.DrawLine(new Pen(regBrush), MemoryViewer.Left, 34, MemoryViewer.Right-16, 34); - - int rowX = 16; + int row = 0; + int rowX = 8; int rowY = 16; int rowYoffset = 20; string rowStr; + e.Graphics.DrawString(HEADER, font, regBrush, new Point(rowX, rowY)); + e.Graphics.DrawLine(new Pen(regBrush), MemoryViewer.Left + 38, MemoryViewer.Top, MemoryViewer.Left + 38, MemoryViewer.Bottom - 40); + e.Graphics.DrawLine(new Pen(regBrush), MemoryViewer.Left, 34, MemoryViewer.Right - 16, 34); + for (int i = 0; i < Domain.Size / 16; i++) { - rowStr = String.Format("{0:X4}", i*16) + " "; //TODO: num digits based on size of domain + row = i + vScrollBar1.Value; + rowStr = String.Format("{0:X4}", row*16) + " "; //TODO: num digits based on size of domain for (int j = 0; j < 16; j++) { - rowStr += String.Format("{0:X2}", Domain.PeekByte((i*16)+j)) + " "; //TODO: format based on data size + rowStr += String.Format("{0:X2}", Domain.PeekByte((row*16)+j)) + " "; //TODO: format based on data size } e.Graphics.DrawString(rowStr, font, regBrush, new Point(rowX, (rowY*(i+1))+rowYoffset)); @@ -162,6 +164,10 @@ namespace BizHawk.MultiClient } else memoryDomainsToolStripMenuItem.Enabled = false; + + //Set up scrollbar + vScrollBar1.Maximum = Domain.Size / 16; + vScrollBar1.Value = 0; } private void goToAddressToolStripMenuItem_Click(object sender, EventArgs e)