diff --git a/BizHawk.MultiClient/tools/HexEditor.Designer.cs b/BizHawk.MultiClient/tools/HexEditor.Designer.cs index 4c25850018..e2b6aa999e 100644 --- a/BizHawk.MultiClient/tools/HexEditor.Designer.cs +++ b/BizHawk.MultiClient/tools/HexEditor.Designer.cs @@ -78,6 +78,7 @@ this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); this.AddressesLabel = new System.Windows.Forms.Label(); this.Header = new System.Windows.Forms.Label(); + this.AddressLabel = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); this.ViewerContextMenuStrip.SuspendLayout(); this.MemoryViewerBox.SuspendLayout(); @@ -446,6 +447,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.MemoryViewerBox.ContextMenuStrip = this.ViewerContextMenuStrip; + this.MemoryViewerBox.Controls.Add(this.AddressLabel); this.MemoryViewerBox.Controls.Add(this.vScrollBar1); this.MemoryViewerBox.Controls.Add(this.AddressesLabel); this.MemoryViewerBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -473,7 +475,7 @@ // this.AddressesLabel.AutoSize = true; this.AddressesLabel.ContextMenuStrip = this.ViewerContextMenuStrip; - this.AddressesLabel.Location = new System.Drawing.Point(6, 30); + this.AddressesLabel.Location = new System.Drawing.Point(48, 30); this.AddressesLabel.Name = "AddressesLabel"; this.AddressesLabel.Size = new System.Drawing.Size(31, 13); this.AddressesLabel.TabIndex = 0; @@ -492,6 +494,16 @@ this.Header.TabIndex = 2; this.Header.Text = "label1"; // + // AddressLabel + // + this.AddressLabel.AutoSize = true; + this.AddressLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.AddressLabel.Location = new System.Drawing.Point(3, 30); + this.AddressLabel.Name = "AddressLabel"; + this.AddressLabel.Size = new System.Drawing.Size(25, 13); + this.AddressLabel.TabIndex = 2; + this.AddressLabel.Text = " "; + // // HexEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -571,5 +583,6 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; private System.Windows.Forms.ToolStripMenuItem resetToDefaultToolStripMenuItem1; public System.Windows.Forms.Label Header; + private System.Windows.Forms.Label AddressLabel; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor.cs index 6aa7ad1b79..93d62ef78a 100644 --- a/BizHawk.MultiClient/tools/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor.cs @@ -14,8 +14,9 @@ namespace BizHawk.MultiClient public partial class HexEditor : Form { //TODO: - //Find text box - autohighlights matches, and shows total matches - //Users can customize background, & text colors + //Find Prev, Find Next + //Multi-select + //Open Up ROM in memory domains, set up logic for saving the rom //Tool strip //Increment/Decrement wrapping logic for 2 and 4 byte values int defaultWidth; @@ -63,6 +64,7 @@ namespace BizHawk.MultiClient Closing += (o, e) => SaveConfigSettings(); Header.Font = new Font("Courier New", 8); AddressesLabel.Font = new Font("Courier New", 8); + AddressLabel.Font = new Font("Courier New", 8); } private void LoadConfigSettings() @@ -115,6 +117,7 @@ namespace BizHawk.MultiClient SetDataSize(DataSize); UpdateValues(); loaded = true; + AddressLabel.Text = GenerateAddressString(); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) @@ -129,18 +132,35 @@ namespace BizHawk.MultiClient AddressesLabel.Text = GenerateMemoryViewString(); } - public string GenerateMemoryViewString() + public string GenerateAddressString() { - StringBuilder rowStr = new StringBuilder(""); - addrOffset = (NumDigits % 4) * 9; + StringBuilder addrStr = new StringBuilder(); for (int i = 0; i < RowsVisible; i++) { row = i + vScrollBar1.Value; - addr = (row * 16); + addr = (row << 4); if (addr >= Domain.Size) break; - rowStr.AppendFormat(NumDigitsStr, addr); + addrStr.AppendFormat(NumDigitsStr, addr); + addrStr.Append('\n'); + } + + return addrStr.ToString(); + } + + public string GenerateMemoryViewString() + { + StringBuilder rowStr = new StringBuilder(); + addrOffset = (NumDigits % 4) * 9; //TODO: I dont think this has any purpose here anymore, if this needs to be calculated, it could be done outside the frame loop + + for (int i = 0; i < RowsVisible; i++) + { + row = i + vScrollBar1.Value; + addr = (row << 4); + if (addr >= Domain.Size) + break; + //rowStr.AppendFormat(NumDigitsStr, addr); for (int j = 0; j < 16; j += DataSize) { @@ -362,6 +382,7 @@ namespace BizHawk.MultiClient GoToAddress(int.Parse(i.UserText, NumberStyles.HexNumber)); } } + AddressLabel.Text = GenerateAddressString(); } private void ClearNibbles() @@ -382,6 +403,7 @@ namespace BizHawk.MultiClient ClearNibbles(); UpdateValues(); MemoryViewerBox.Refresh(); + AddressLabel.Text = GenerateAddressString(); } public void SetHighlighted(int addr) @@ -867,6 +889,7 @@ namespace BizHawk.MultiClient else vScrollBar1.Visible = false; + AddressLabel.Text = GenerateAddressString(); } private void vScrollBar1_Scroll(object sender, ScrollEventArgs e) @@ -895,7 +918,7 @@ namespace BizHawk.MultiClient colWidth = 9; break; } - int column = (x - 43) / (fontWidth * colWidth); + int column = (x /*- 43*/) / (fontWidth * colWidth); if (row >= 0 && row <= maxRow && column >= 0 && column < (16 / DataSize)) { @@ -907,6 +930,7 @@ namespace BizHawk.MultiClient addressOver = -1; info = ""; } + AddressLabel.Text = GenerateAddressString(); } private void HexEditor_ResizeEnd(object sender, EventArgs e)