Debugger: Add show byte code option

This commit is contained in:
Sour 2019-03-31 09:22:01 -04:00
parent 65fff98f1c
commit 2cd02c3dcc
5 changed files with 45 additions and 16 deletions

View file

@ -15,6 +15,8 @@ namespace Mesen.GUI.Config
public Size WindowSize = new Size(0, 0);
public Point WindowLocation;
public bool ShowByteCode = false;
public int BreakOnValue = 0;
public int BreakInCount = 1;
public BreakInMetric BreakInMetric = BreakInMetric.CpuInstructions;

View file

@ -30,7 +30,7 @@ namespace Mesen.GUI.Debugger.Controls
_styleProvider = new CpuLineStyleProvider();
ctrlCode.StyleProvider = _styleProvider;
ctrlCode.ShowContentNotes = true;
ctrlCode.ShowContentNotes = false;
ctrlCode.ShowMemoryValues = true;
InitShortcuts();

View file

@ -107,10 +107,7 @@ namespace Mesen.GUI.Debugger
config.MemoryType = cboMemoryType.GetEnumValue<SnesMemoryType>();
_entityBinder.UpdateObject();
ConfigManager.ApplyChanges();
//TODO?
//DebugWorkspaceManager.SaveWorkspace();
if(this._notifListener != null) {
this._notifListener.Dispose();
this._notifListener = null;

View file

@ -71,6 +71,8 @@
this.mnuGoToBrkHandler = new System.Windows.Forms.ToolStripMenuItem();
this.mnuGoToCopHandler = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuShowByteCode = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
this.fontSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuIncreaseFontSize = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDecreaseFontSize = new System.Windows.Forms.ToolStripMenuItem();
@ -399,6 +401,8 @@
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuShowByteCode,
this.toolStripMenuItem5,
this.fontSizeToolStripMenuItem,
this.toolStripMenuItem4,
this.mnuPreferences});
@ -406,6 +410,18 @@
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.Text = "Options";
//
// mnuShowByteCode
//
this.mnuShowByteCode.CheckOnClick = true;
this.mnuShowByteCode.Name = "mnuShowByteCode";
this.mnuShowByteCode.Size = new System.Drawing.Size(209, 22);
this.mnuShowByteCode.Text = "Show byte code";
//
// toolStripMenuItem5
//
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
this.toolStripMenuItem5.Size = new System.Drawing.Size(206, 6);
//
// fontSizeToolStripMenuItem
//
this.fontSizeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -676,5 +692,7 @@
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem21;
private System.Windows.Forms.ToolStripMenuItem mnuSelectFont;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
private System.Windows.Forms.ToolStripMenuItem mnuShowByteCode;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5;
}
}

View file

@ -34,17 +34,7 @@ namespace Mesen.GUI.Debugger
InitShortcuts();
InitToolbar();
DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger;
Font font = new Font(cfg.FontFamily, cfg.FontSize, cfg.FontStyle);
ctrlDisassemblyView.CodeViewer.BaseFont = font;
ctrlDisassemblyView.CodeViewer.TextZoom = cfg.TextZoom;
if(!cfg.WindowSize.IsEmpty) {
this.StartPosition = FormStartPosition.Manual;
this.Size = cfg.WindowSize;
this.Location = cfg.WindowLocation;
}
LoadConfig();
toolTip.SetToolTip(picWatchHelp, ctrlWatch.GetTooltipText());
@ -59,6 +49,7 @@ namespace Mesen.GUI.Debugger
DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger;
cfg.WindowSize = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
cfg.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
_entityBinder.UpdateObject();
ConfigManager.ApplyChanges();
BreakpointManager.BreakpointsEnabled = false;
@ -167,6 +158,27 @@ namespace Mesen.GUI.Debugger
);
}
private void LoadConfig()
{
DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger;
_entityBinder.Entity = cfg;
_entityBinder.AddBinding(nameof(cfg.ShowByteCode), mnuShowByteCode);
mnuShowByteCode.CheckedChanged += (s, e) => { ctrlDisassemblyView.CodeViewer.ShowContentNotes = mnuShowByteCode.Checked; };
_entityBinder.UpdateUI();
Font font = new Font(cfg.FontFamily, cfg.FontSize, cfg.FontStyle);
ctrlDisassemblyView.CodeViewer.BaseFont = font;
ctrlDisassemblyView.CodeViewer.TextZoom = cfg.TextZoom;
if(!cfg.WindowSize.IsEmpty) {
this.StartPosition = FormStartPosition.Manual;
this.Size = cfg.WindowSize;
this.Location = cfg.WindowLocation;
}
}
private void UpdateContinueAction()
{
bool paused = EmuApi.IsPaused();