From 589ad612d10647069e06dd6644efa862c64bf051 Mon Sep 17 00:00:00 2001 From: Sour Date: Tue, 26 Dec 2017 15:59:58 -0500 Subject: [PATCH] Debugger: Added shortcut to open memory viewer from code window --- .../Controls/ctrlDebuggerCode.Designer.cs | 12 +++++ GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs | 25 ++++++++-- GUI.NET/Debugger/Controls/ctrlHexViewer.cs | 11 ++++- GUI.NET/Debugger/DebugWindowManager.cs | 44 +++++++++-------- GUI.NET/Debugger/HexBox/HexBox.cs | 2 + GUI.NET/Debugger/frmDebugger.Designer.cs | 48 ++++++++----------- GUI.NET/Debugger/frmMemoryViewer.cs | 11 ++++- GUI.NET/Forms/EntityBinder.cs | 2 +- 8 files changed, 98 insertions(+), 57 deletions(-) diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs index 30b38633..3df0c795 100644 --- a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs @@ -48,6 +48,7 @@ this.mnuHidePrgAddresses = new System.Windows.Forms.ToolStripMenuItem(); this.sepEditLabel = new System.Windows.Forms.ToolStripSeparator(); this.mnuEditLabel = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditInMemoryViewer = new System.Windows.Forms.ToolStripMenuItem(); this.mnuToggleBreakpoint = new System.Windows.Forms.ToolStripMenuItem(); this.sepAddToWatch = new System.Windows.Forms.ToolStripSeparator(); this.mnuAddToWatch = new System.Windows.Forms.ToolStripMenuItem(); @@ -95,6 +96,7 @@ this.mnuShowLineNotes, this.sepEditLabel, this.mnuEditLabel, + this.mnuEditInMemoryViewer, this.mnuToggleBreakpoint, this.sepAddToWatch, this.mnuAddToWatch, @@ -250,6 +252,15 @@ this.mnuEditLabel.Text = "Edit Label"; this.mnuEditLabel.Click += new System.EventHandler(this.mnuEditLabel_Click); // + // mnuEditInMemoryViewer + // + this.mnuEditInMemoryViewer.Image = global::Mesen.GUI.Properties.Resources.CheatCode; + this.mnuEditInMemoryViewer.Name = "mnuEditInMemoryViewer"; + this.mnuEditInMemoryViewer.ShortcutKeys = System.Windows.Forms.Keys.F1; + this.mnuEditInMemoryViewer.Size = new System.Drawing.Size(258, 22); + this.mnuEditInMemoryViewer.Text = "Edit in Memory Viewer"; + this.mnuEditInMemoryViewer.Click += new System.EventHandler(this.mnuEditInMemoryViewer_Click); + // // mnuToggleBreakpoint // this.mnuToggleBreakpoint.Image = global::Mesen.GUI.Properties.Resources.Breakpoint; @@ -536,5 +547,6 @@ private System.Windows.Forms.ToolStripMenuItem mnuEditSubroutine; private System.Windows.Forms.ToolStripMenuItem mnuEditSelectedCode; private System.Windows.Forms.ToolStripMenuItem copySelectionToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem mnuEditInMemoryViewer; } } diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs index dba15570..b1a1c5d0 100644 --- a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs @@ -480,6 +480,9 @@ namespace Mesen.GUI.Debugger mnuEditLabel.Enabled = true; mnuEditLabel.Text = $"Edit Label ({word})"; + mnuEditInMemoryViewer.Enabled = true; + mnuEditInMemoryViewer.Text = $"Edit in Memory Viewer ({word})"; + return true; } else { mnuGoToLocation.Enabled = false; @@ -490,9 +493,17 @@ namespace Mesen.GUI.Debugger mnuFindOccurrences.Text = "Find Occurrences"; mnuEditLabel.Enabled = false; mnuEditLabel.Text = "Edit Label"; + mnuEditInMemoryViewer.Enabled = false; + mnuEditInMemoryViewer.Text = $"Edit in Memory Viewer"; - _lastClickedAddress = ctrlCodeViewer.GetLineNumberAtPosition(mouseLocation.Y); - if(mouseLocation.X < this.ctrlCodeViewer.CodeMargin && _lastClickedAddress >= 0) { + + if(mouseLocation.X < this.ctrlCodeViewer.CodeMargin) { + _lastClickedAddress = ctrlCodeViewer.GetLineNumberAtPosition(mouseLocation.Y); + } else { + _lastClickedAddress = ctrlCodeViewer.LastSelectedLine; + } + + if(_lastClickedAddress >= 0) { //Cursor is in the margin, over an address label string address = $"${_lastClickedAddress.ToString("X4")}"; _newWatchValue = $"[{address}]"; @@ -504,7 +515,8 @@ namespace Mesen.GUI.Debugger mnuFindOccurrences.Text = $"Find Occurrences ({address})"; mnuEditLabel.Enabled = true; mnuEditLabel.Text = $"Edit Label ({address})"; - + mnuEditInMemoryViewer.Enabled = true; + mnuEditInMemoryViewer.Text = $"Edit in Memory Viewer ({address})"; return true; } @@ -867,6 +879,13 @@ namespace Mesen.GUI.Debugger { this.ctrlCodeViewer.CopySelection(); } + + private void mnuEditInMemoryViewer_Click(object sender, EventArgs e) + { + if(UpdateContextMenu(_previousLocation)) { + DebugWindowManager.OpenMemoryViewer(_lastClickedAddress); + } + } } public class WatchEventArgs : EventArgs diff --git a/GUI.NET/Debugger/Controls/ctrlHexViewer.cs b/GUI.NET/Debugger/Controls/ctrlHexViewer.cs index c655a50e..138efd0d 100644 --- a/GUI.NET/Debugger/Controls/ctrlHexViewer.cs +++ b/GUI.NET/Debugger/Controls/ctrlHexViewer.cs @@ -116,6 +116,14 @@ namespace Mesen.GUI.Debugger.Controls this.SetFontSize(BaseControl.DefaultFontSize); } + public void GoToAddress(int address) + { + this.ctrlHexBox.ScrollByteIntoView(GetData().Length - 1); + this.ctrlHexBox.ScrollByteIntoView(address); + this.ctrlHexBox.Select(address, 0); + this.ctrlHexBox.Focus(); + } + public void GoToAddress() { GoToAddress address = new GoToAddress(); @@ -128,8 +136,7 @@ namespace Mesen.GUI.Debugger.Controls Point topLeft = this.PointToScreen(new Point(0, 0)); frm.Location = new Point(topLeft.X + (this.Width - frm.Width) / 2, topLeft.Y + (this.Height - frm.Height) / 2); if(frm.ShowDialog() == DialogResult.OK) { - this.ctrlHexBox.ScrollByteIntoView((int)address.Address); - this.ctrlHexBox.Focus(); + GoToAddress((int)address.Address); } } diff --git a/GUI.NET/Debugger/DebugWindowManager.cs b/GUI.NET/Debugger/DebugWindowManager.cs index b05614d0..9620e941 100644 --- a/GUI.NET/Debugger/DebugWindowManager.cs +++ b/GUI.NET/Debugger/DebugWindowManager.cs @@ -9,7 +9,7 @@ namespace Mesen.GUI.Debugger { public class DebugWindowManager { - private static List
_openedWindows = new List(); + private static HashSet _openedWindows = new HashSet(); public static void OpenDebugWindow(DebugWindow window) { @@ -41,6 +41,18 @@ namespace Mesen.GUI.Debugger frm.Show(); } + public static void OpenMemoryViewer(int address) + { + frmMemoryViewer frm = GetMemoryViewer(); + if(frm == null) { + frm = new frmMemoryViewer(); + frm.FormClosed += Debugger_FormClosed; + _openedWindows.Add(frm); + } + frm.Show(); + frm.ShowAddress(address); + } + public static void OpenScriptWindow(bool forceBlank) { frmScript frm = new frmScript(forceBlank); @@ -51,11 +63,12 @@ namespace Mesen.GUI.Debugger public static frmDebugger GetDebugger() { - int index = _openedWindows.FindIndex((form) => form.GetType() == typeof(frmDebugger)); - if(index >= 0) { - return (frmDebugger)_openedWindows[index]; - } - return null; + return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmDebugger)) as frmDebugger; + } + + public static frmMemoryViewer GetMemoryViewer() + { + return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmMemoryViewer)) as frmMemoryViewer; } public static void CloseAll() @@ -69,24 +82,13 @@ namespace Mesen.GUI.Debugger private static Form GetExistingSingleInstanceWindow(DebugWindow window) { //Only one of each of these windows can be opened at once, check if one is already opened - int index = -1; switch(window) { - case DebugWindow.TraceLogger: - index = _openedWindows.FindIndex((form) => form.GetType() == typeof(frmTraceLogger)); - break; - case DebugWindow.Assembler: - index = _openedWindows.FindIndex((form) => form.GetType() == typeof(frmAssembler)); - break; - case DebugWindow.Debugger: - index = _openedWindows.FindIndex((form) => form.GetType() == typeof(frmDebugger)); - break; + case DebugWindow.TraceLogger: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmTraceLogger)); + case DebugWindow.Assembler: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmAssembler)); + case DebugWindow.Debugger: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmDebugger)); } - if(index >= 0) { - return _openedWindows[index]; - } else { - return null; - } + return null; } private static void Debugger_FormClosed(object sender, FormClosedEventArgs e) diff --git a/GUI.NET/Debugger/HexBox/HexBox.cs b/GUI.NET/Debugger/HexBox/HexBox.cs index 118d9745..6db97499 100644 --- a/GUI.NET/Debugger/HexBox/HexBox.cs +++ b/GUI.NET/Debugger/HexBox/HexBox.cs @@ -1716,6 +1716,8 @@ namespace Be.Windows.Forms InternalSelect(start, length); ScrollByteIntoView(); + + ActivateKeyInterpreter(); } void InternalSelect(long start, long length) diff --git a/GUI.NET/Debugger/frmDebugger.Designer.cs b/GUI.NET/Debugger/frmDebugger.Designer.cs index 7bcab912..ff4e9bf1 100644 --- a/GUI.NET/Debugger/frmDebugger.Designer.cs +++ b/GUI.NET/Debugger/frmDebugger.Designer.cs @@ -120,7 +120,6 @@ namespace Mesen.GUI.Debugger this.mnuIncreaseFontSize = new System.Windows.Forms.ToolStripMenuItem(); this.mnuDecreaseFontSize = new System.Windows.Forms.ToolStripMenuItem(); this.mnuResetFontSize = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripSeparator(); this.mnuShowCpuMemoryMapping = new System.Windows.Forms.ToolStripMenuItem(); this.mnuShowPpuMemoryMapping = new System.Windows.Forms.ToolStripMenuItem(); @@ -225,7 +224,7 @@ namespace Mesen.GUI.Debugger this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists); this.ctrlSplitContainerTop.Panel2MinSize = 150; this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1172, 400); - this.ctrlSplitContainerTop.SplitterDistance = 875; + this.ctrlSplitContainerTop.SplitterDistance = 872; this.ctrlSplitContainerTop.SplitterWidth = 7; this.ctrlSplitContainerTop.TabIndex = 3; this.ctrlSplitContainerTop.PanelCollapsed += new System.EventHandler(this.ctrlSplitContainerTop_PanelCollapsed); @@ -246,7 +245,7 @@ namespace Mesen.GUI.Debugger this.tlpTop.Name = "tlpTop"; this.tlpTop.RowCount = 1; this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tlpTop.Size = new System.Drawing.Size(875, 400); + this.tlpTop.Size = new System.Drawing.Size(872, 400); this.tlpTop.TabIndex = 2; // // ctrlDebuggerCode @@ -255,7 +254,7 @@ namespace Mesen.GUI.Debugger this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3); this.ctrlDebuggerCode.Name = "ctrlDebuggerCode"; - this.ctrlDebuggerCode.Size = new System.Drawing.Size(411, 394); + this.ctrlDebuggerCode.Size = new System.Drawing.Size(408, 394); this.ctrlDebuggerCode.TabIndex = 2; this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode); this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement); @@ -264,7 +263,7 @@ namespace Mesen.GUI.Debugger // ctrlConsoleStatus // this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Fill; - this.ctrlConsoleStatus.Location = new System.Drawing.Point(417, 0); + this.ctrlConsoleStatus.Location = new System.Drawing.Point(414, 0); this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0); this.ctrlConsoleStatus.Name = "ctrlConsoleStatus"; this.ctrlConsoleStatus.Size = new System.Drawing.Size(458, 400); @@ -275,7 +274,7 @@ namespace Mesen.GUI.Debugger // this.ctrlDebuggerCodeSplit.Code = null; this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill; - this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(420, 3); + this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(417, 3); this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit"; this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 394); this.ctrlDebuggerCodeSplit.TabIndex = 4; @@ -297,7 +296,7 @@ namespace Mesen.GUI.Debugger this.tlpFunctionLabelLists.RowCount = 2; this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tlpFunctionLabelLists.Size = new System.Drawing.Size(290, 400); + this.tlpFunctionLabelLists.Size = new System.Drawing.Size(293, 400); this.tlpFunctionLabelLists.TabIndex = 5; // // grpLabels @@ -306,7 +305,7 @@ namespace Mesen.GUI.Debugger this.grpLabels.Dock = System.Windows.Forms.DockStyle.Fill; this.grpLabels.Location = new System.Drawing.Point(3, 203); this.grpLabels.Name = "grpLabels"; - this.grpLabels.Size = new System.Drawing.Size(284, 194); + this.grpLabels.Size = new System.Drawing.Size(287, 194); this.grpLabels.TabIndex = 6; this.grpLabels.TabStop = false; this.grpLabels.Text = "Labels"; @@ -316,7 +315,7 @@ namespace Mesen.GUI.Debugger this.ctrlLabelList.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlLabelList.Location = new System.Drawing.Point(3, 16); this.ctrlLabelList.Name = "ctrlLabelList"; - this.ctrlLabelList.Size = new System.Drawing.Size(278, 175); + this.ctrlLabelList.Size = new System.Drawing.Size(281, 175); this.ctrlLabelList.TabIndex = 0; this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence); this.ctrlLabelList.OnLabelSelected += new System.EventHandler(this.ctrlLabelList_OnLabelSelected); @@ -327,7 +326,7 @@ namespace Mesen.GUI.Debugger this.grpFunctions.Dock = System.Windows.Forms.DockStyle.Fill; this.grpFunctions.Location = new System.Drawing.Point(3, 3); this.grpFunctions.Name = "grpFunctions"; - this.grpFunctions.Size = new System.Drawing.Size(284, 194); + this.grpFunctions.Size = new System.Drawing.Size(287, 194); this.grpFunctions.TabIndex = 5; this.grpFunctions.TabStop = false; this.grpFunctions.Text = "Functions"; @@ -337,7 +336,7 @@ namespace Mesen.GUI.Debugger this.ctrlFunctionList.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlFunctionList.Location = new System.Drawing.Point(3, 16); this.ctrlFunctionList.Name = "ctrlFunctionList"; - this.ctrlFunctionList.Size = new System.Drawing.Size(278, 175); + this.ctrlFunctionList.Size = new System.Drawing.Size(281, 175); this.ctrlFunctionList.TabIndex = 0; this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence); this.ctrlFunctionList.OnFunctionSelected += new System.EventHandler(this.ctrlFunctionList_OnFunctionSelected); @@ -837,7 +836,6 @@ namespace Mesen.GUI.Debugger this.toolStripMenuItem12, this.mnuSplitView, this.fontSizeToolStripMenuItem, - this.toolStripMenuItem5, this.toolStripMenuItem11, this.mnuShowCpuMemoryMapping, this.mnuShowPpuMemoryMapping, @@ -1041,11 +1039,6 @@ namespace Mesen.GUI.Debugger this.mnuResetFontSize.Text = "Reset to Default"; this.mnuResetFontSize.Click += new System.EventHandler(this.mnuResetFontSize_Click); // - // toolStripMenuItem5 - // - this.toolStripMenuItem5.Name = "toolStripMenuItem5"; - this.toolStripMenuItem5.Size = new System.Drawing.Size(256, 6); - // // toolStripMenuItem11 // this.toolStripMenuItem11.Name = "toolStripMenuItem11"; @@ -1117,7 +1110,7 @@ namespace Mesen.GUI.Debugger this.toolStripMenuItem17, this.mnuCodeDataLogger}); this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; - this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20); + this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 20); this.toolsToolStripMenuItem.Text = "Tools"; // // mnuAssembler @@ -1125,7 +1118,7 @@ namespace Mesen.GUI.Debugger this.mnuAssembler.Image = global::Mesen.GUI.Properties.Resources.Chip; this.mnuAssembler.Name = "mnuAssembler"; this.mnuAssembler.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.K))); - this.mnuAssembler.Size = new System.Drawing.Size(196, 22); + this.mnuAssembler.Size = new System.Drawing.Size(195, 22); this.mnuAssembler.Text = "Assembler"; this.mnuAssembler.Click += new System.EventHandler(this.mnuAssembler_Click); // @@ -1134,7 +1127,7 @@ namespace Mesen.GUI.Debugger this.mnuMemoryViewer.Image = global::Mesen.GUI.Properties.Resources.CheatCode; this.mnuMemoryViewer.Name = "mnuMemoryViewer"; this.mnuMemoryViewer.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.M))); - this.mnuMemoryViewer.Size = new System.Drawing.Size(196, 22); + this.mnuMemoryViewer.Size = new System.Drawing.Size(195, 22); this.mnuMemoryViewer.Text = "Memory Tools"; this.mnuMemoryViewer.Click += new System.EventHandler(this.mnuMemoryViewer_Click); // @@ -1143,7 +1136,7 @@ namespace Mesen.GUI.Debugger this.mnuPpuViewer.Image = global::Mesen.GUI.Properties.Resources.Video; this.mnuPpuViewer.Name = "mnuPpuViewer"; this.mnuPpuViewer.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); - this.mnuPpuViewer.Size = new System.Drawing.Size(196, 22); + this.mnuPpuViewer.Size = new System.Drawing.Size(195, 22); this.mnuPpuViewer.Text = "PPU Viewer"; this.mnuPpuViewer.Click += new System.EventHandler(this.mnuNametableViewer_Click); // @@ -1152,7 +1145,7 @@ namespace Mesen.GUI.Debugger this.mnuScriptWindow.Image = global::Mesen.GUI.Properties.Resources.Script; this.mnuScriptWindow.Name = "mnuScriptWindow"; this.mnuScriptWindow.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.J))); - this.mnuScriptWindow.Size = new System.Drawing.Size(196, 22); + this.mnuScriptWindow.Size = new System.Drawing.Size(195, 22); this.mnuScriptWindow.Text = "Script Window"; this.mnuScriptWindow.Click += new System.EventHandler(this.mnuScriptWindow_Click); // @@ -1161,27 +1154,27 @@ namespace Mesen.GUI.Debugger this.mnuTraceLogger.Image = global::Mesen.GUI.Properties.Resources.LogWindow; this.mnuTraceLogger.Name = "mnuTraceLogger"; this.mnuTraceLogger.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); - this.mnuTraceLogger.Size = new System.Drawing.Size(196, 22); + this.mnuTraceLogger.Size = new System.Drawing.Size(195, 22); this.mnuTraceLogger.Text = "Trace Logger"; this.mnuTraceLogger.Click += new System.EventHandler(this.mnuTraceLogger_Click); // // toolStripMenuItem13 // this.toolStripMenuItem13.Name = "toolStripMenuItem13"; - this.toolStripMenuItem13.Size = new System.Drawing.Size(193, 6); + this.toolStripMenuItem13.Size = new System.Drawing.Size(192, 6); // // mnuEditHeader // this.mnuEditHeader.Image = global::Mesen.GUI.Properties.Resources.Edit; this.mnuEditHeader.Name = "mnuEditHeader"; - this.mnuEditHeader.Size = new System.Drawing.Size(196, 22); + this.mnuEditHeader.Size = new System.Drawing.Size(195, 22); this.mnuEditHeader.Text = "Edit iNES Header"; this.mnuEditHeader.Click += new System.EventHandler(this.mnuEditHeader_Click); // // toolStripMenuItem17 // this.toolStripMenuItem17.Name = "toolStripMenuItem17"; - this.toolStripMenuItem17.Size = new System.Drawing.Size(193, 6); + this.toolStripMenuItem17.Size = new System.Drawing.Size(192, 6); // // mnuCodeDataLogger // @@ -1193,7 +1186,7 @@ namespace Mesen.GUI.Debugger this.mnuResetCdlLog, this.generateROMToolStripMenuItem}); this.mnuCodeDataLogger.Name = "mnuCodeDataLogger"; - this.mnuCodeDataLogger.Size = new System.Drawing.Size(196, 22); + this.mnuCodeDataLogger.Size = new System.Drawing.Size(195, 22); this.mnuCodeDataLogger.Text = "Code/Data Logger"; // // autoLoadsaveCDLFileToolStripMenuItem @@ -1438,7 +1431,6 @@ namespace Mesen.GUI.Debugger private System.Windows.Forms.ToolStripMenuItem mnuGoToResetHandler; private System.Windows.Forms.ToolStripMenuItem mnuTraceLogger; private System.Windows.Forms.ToolStripMenuItem mnuRunPpuCycle; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5; private System.Windows.Forms.ToolStripMenuItem mnuPpuPartialDraw; private System.Windows.Forms.ToolStripMenuItem mnuRunScanline; private System.Windows.Forms.PictureBox picWatchHelp; diff --git a/GUI.NET/Debugger/frmMemoryViewer.cs b/GUI.NET/Debugger/frmMemoryViewer.cs index a394628e..bc133e67 100644 --- a/GUI.NET/Debugger/frmMemoryViewer.cs +++ b/GUI.NET/Debugger/frmMemoryViewer.cs @@ -73,7 +73,14 @@ namespace Mesen.GUI.Debugger DebugWorkspaceManager.SaveWorkspace(); } - void InitTblMappings() + public void ShowAddress(int address) + { + tabMain.SelectedTab = tpgMemoryViewer; + cboMemoryType.SetEnumValue(DebugMemoryType.CpuMemory); + ctrlHexViewer.GoToAddress(address); + } + + private void InitTblMappings() { DebugWorkspace workspace = DebugWorkspaceManager.GetWorkspace(); if(workspace.TblMappings != null && workspace.TblMappings.Count > 0) { @@ -86,7 +93,7 @@ namespace Mesen.GUI.Debugger } } - void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e) + private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e) { if(e.NotificationType == InteropEmu.ConsoleNotificationType.CodeBreak) { this.BeginInvoke((MethodInvoker)(() => this.RefreshData())); diff --git a/GUI.NET/Forms/EntityBinder.cs b/GUI.NET/Forms/EntityBinder.cs index 005b20c9..9d76ccc6 100644 --- a/GUI.NET/Forms/EntityBinder.cs +++ b/GUI.NET/Forms/EntityBinder.cs @@ -68,7 +68,7 @@ namespace Mesen.GUI.Forms if(value is IFormattable) { kvp.Value.Text = ((IFormattable)value).ToString(format == eNumberFormat.Decimal ? "" : "X", System.Globalization.CultureInfo.InvariantCulture); } else { - kvp.Value.Text = ((string)value).Replace(Environment.NewLine, "\n").Replace("\n", Environment.NewLine); + kvp.Value.Text = value == null ? "" : ((string)value).Replace(Environment.NewLine, "\n").Replace("\n", Environment.NewLine); } } else if(kvp.Value is ctrlPathSelection) { kvp.Value.Text = (string)value;