From 0c32b48f299941c5e1a1845fd9897ece1c1ebfe9 Mon Sep 17 00:00:00 2001 From: feos Date: Sun, 21 Feb 2016 15:19:56 +0300 Subject: [PATCH] debugger: - don't post pc and raw bytes to genesis disasm string - make some fonts monospace - pad reg values properly - give enough space for big reg names --- .../Debugger/GenericDebugger.Designer.cs | 52 ++++++++++--------- .../Debugger/GenericDebugger.Disassembler.cs | 1 + .../tools/Debugger/RegisterBoxControl.cs | 8 +-- .../CPUs/68000/Diassembler.cs | 4 +- 4 files changed, 35 insertions(+), 30 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Designer.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Designer.cs index 8ab99a6486..fa34d68a4c 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Designer.cs @@ -49,6 +49,8 @@ this.DisassemblerView = new BizHawk.Client.EmuHawk.VirtualListView(); this.Address = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Instruction = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.DisassemblerContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.AddBreakpointContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.StepOutBtn = new System.Windows.Forms.Button(); this.StepIntoBtn = new System.Windows.Forms.Button(); this.StepOverBtn = new System.Windows.Forms.Button(); @@ -56,8 +58,6 @@ this.SeekToBtn = new System.Windows.Forms.Button(); this.SeekToBox = new BizHawk.Client.EmuHawk.HexTextBox(); this.CancelSeekBtn = new System.Windows.Forms.Button(); - this.DisassemblerContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this.AddBreakpointContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.RegistersGroupBox.SuspendLayout(); this.BreakpointsGroupBox.SuspendLayout(); @@ -82,14 +82,14 @@ this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.ExitMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); this.fileToolStripMenuItem.Text = "&File"; // // ExitMenuItem // this.ExitMenuItem.Name = "ExitMenuItem"; this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4"; - this.ExitMenuItem.Size = new System.Drawing.Size(145, 22); + this.ExitMenuItem.Size = new System.Drawing.Size(151, 22); this.ExitMenuItem.Text = "&Close"; this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); // @@ -102,7 +102,7 @@ this.toolStripSeparator1, this.RefreshMenuItem}); this.DebugSubMenu.Name = "DebugSubMenu"; - this.DebugSubMenu.Size = new System.Drawing.Size(54, 20); + this.DebugSubMenu.Size = new System.Drawing.Size(50, 20); this.DebugSubMenu.Text = "&Debug"; this.DebugSubMenu.DropDownOpened += new System.EventHandler(this.DebugSubMenu_DropDownOpened); // @@ -111,7 +111,7 @@ this.StepIntoMenuItem.Enabled = false; this.StepIntoMenuItem.Name = "StepIntoMenuItem"; this.StepIntoMenuItem.ShortcutKeyDisplayString = "F11"; - this.StepIntoMenuItem.Size = new System.Drawing.Size(177, 22); + this.StepIntoMenuItem.Size = new System.Drawing.Size(183, 22); this.StepIntoMenuItem.Text = "Step &Into"; this.StepIntoMenuItem.Click += new System.EventHandler(this.StepIntoMenuItem_Click); // @@ -120,7 +120,7 @@ this.StepOverMenuItem.Enabled = false; this.StepOverMenuItem.Name = "StepOverMenuItem"; this.StepOverMenuItem.ShortcutKeyDisplayString = "F10"; - this.StepOverMenuItem.Size = new System.Drawing.Size(177, 22); + this.StepOverMenuItem.Size = new System.Drawing.Size(183, 22); this.StepOverMenuItem.Text = "Step O&ver"; this.StepOverMenuItem.Click += new System.EventHandler(this.StepOverMenuItem_Click); // @@ -129,20 +129,20 @@ this.StepOutMenuItem.Enabled = false; this.StepOutMenuItem.Name = "StepOutMenuItem"; this.StepOutMenuItem.ShortcutKeyDisplayString = "Shift+F11"; - this.StepOutMenuItem.Size = new System.Drawing.Size(177, 22); + this.StepOutMenuItem.Size = new System.Drawing.Size(183, 22); this.StepOutMenuItem.Text = "Step Ou&t"; this.StepOutMenuItem.Click += new System.EventHandler(this.StepOutMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(174, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(180, 6); // // RefreshMenuItem // this.RefreshMenuItem.Name = "RefreshMenuItem"; this.RefreshMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5; - this.RefreshMenuItem.Size = new System.Drawing.Size(177, 22); + this.RefreshMenuItem.Size = new System.Drawing.Size(183, 22); this.RefreshMenuItem.Text = "Refresh"; this.RefreshMenuItem.Click += new System.EventHandler(this.RefreshMenuItem_Click); // @@ -165,6 +165,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.RegisterPanel.AutoScroll = true; this.RegisterPanel.Core = null; + this.RegisterPanel.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.RegisterPanel.Location = new System.Drawing.Point(8, 19); this.RegisterPanel.Name = "RegisterPanel"; this.RegisterPanel.ParentDebugger = null; @@ -242,6 +243,7 @@ this.Address, this.Instruction}); this.DisassemblerView.ContextMenuStrip = this.DisassemblerContextMenu; + this.DisassemblerView.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.DisassemblerView.FullRowSelect = true; this.DisassemblerView.GridLines = true; this.DisassemblerView.ItemCount = 0; @@ -268,6 +270,21 @@ this.Instruction.Text = "Instruction"; this.Instruction.Width = 291; // + // DisassemblerContextMenu + // + this.DisassemblerContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.AddBreakpointContextMenuItem}); + this.DisassemblerContextMenu.Name = "DisassemblerContextMenu"; + this.DisassemblerContextMenu.Size = new System.Drawing.Size(157, 26); + this.DisassemblerContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.DisassemblerContextMenu_Opening); + // + // AddBreakpointContextMenuItem + // + this.AddBreakpointContextMenuItem.Name = "AddBreakpointContextMenuItem"; + this.AddBreakpointContextMenuItem.Size = new System.Drawing.Size(156, 22); + this.AddBreakpointContextMenuItem.Text = "Add Breakpoint"; + this.AddBreakpointContextMenuItem.Click += new System.EventHandler(this.AddBreakpointContextMenuItem_Click); + // // StepOutBtn // this.StepOutBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -336,21 +353,6 @@ this.CancelSeekBtn.UseVisualStyleBackColor = true; this.CancelSeekBtn.Click += new System.EventHandler(this.CancelSeekBtn_Click); // - // DisassemblerContextMenu - // - this.DisassemblerContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.AddBreakpointContextMenuItem}); - this.DisassemblerContextMenu.Name = "DisassemblerContextMenu"; - this.DisassemblerContextMenu.Size = new System.Drawing.Size(157, 26); - this.DisassemblerContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.DisassemblerContextMenu_Opening); - // - // AddBreakpointContextMenuItem - // - this.AddBreakpointContextMenuItem.Name = "AddBreakpointContextMenuItem"; - this.AddBreakpointContextMenuItem.Size = new System.Drawing.Size(156, 22); - this.AddBreakpointContextMenuItem.Text = "Add Breakpoint"; - this.AddBreakpointContextMenuItem.Click += new System.EventHandler(this.AddBreakpointContextMenuItem_Click); - // // GenericDebugger // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs index 6784c36431..bbf7efba0e 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs @@ -75,6 +75,7 @@ namespace BizHawk.Client.EmuHawk { if (column == 0) { + // feos: address size must be platform dependant text = string.Format("{0:X4}", DisassemblyLines[index].Address); } else if (column == 1) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs index 31738033c7..73853d6edb 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs @@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk { if (textbox.Name == register.Key) { - textbox.Text = register.Value.Value.ToHexString(register.Value.BitSize / 16); + textbox.Text = register.Value.Value.ToHexString(register.Value.BitSize / 4); } }); } @@ -82,7 +82,7 @@ namespace BizHawk.Client.EmuHawk { if (label.Name == register.Key) { - label.Text = register.Value.Value.ToHexString(register.Value.BitSize / 16); + label.Text = register.Value.Value.ToHexString(register.Value.BitSize / 4); } }); } @@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk int y = UIHelper.ScaleY(0); var maxCharSize = registers.Where(r => r.Value.BitSize != 1).Max(r => r.Key.Length); - var width = maxCharSize * 5; + var width = maxCharSize * (int)this.Font.Size; if (width < 20) { width = 20; @@ -207,7 +207,7 @@ namespace BizHawk.Client.EmuHawk }); } - y += UIHelper.ScaleY(25); + y += UIHelper.ScaleY(this.Font.Height + 8); } var flags = registers.Where(r => r.Value.BitSize == 1); diff --git a/BizHawk.Emulation.Cores/CPUs/68000/Diassembler.cs b/BizHawk.Emulation.Cores/CPUs/68000/Diassembler.cs index e3ea8d8146..f4a68d31d9 100644 --- a/BizHawk.Emulation.Cores/CPUs/68000/Diassembler.cs +++ b/BizHawk.Emulation.Cores/CPUs/68000/Diassembler.cs @@ -12,7 +12,9 @@ namespace BizHawk.Emulation.Cores.Components.M68000 public override string ToString() { - return string.Format("{0:X6}: {3,-20} {1,-8} {2}", PC, Mnemonic, Args, RawBytes); + // feos: pc is known already, raw bytes must be optional, other cores don't return them + //return string.Format("{0:X6}: {3,-20} {1,-8} {2}", PC, Mnemonic, Args, RawBytes); + return string.Format("{0,-8} {1}", Mnemonic, Args); } }