From 9a256fa8b7ef6819a1a2ba0d47f49c3cad4876d9 Mon Sep 17 00:00:00 2001 From: Sour Date: Tue, 29 Jan 2019 17:21:23 -0500 Subject: [PATCH] Debugger: Added standalone "Watch Window" --- GUI.NET/Config/DebugInfo.cs | 3 + GUI.NET/Config/DebuggerShortcutsConfig.cs | 2 + .../Debugger/Controls/ctrlWatch.Designer.cs | 12 +- GUI.NET/Debugger/Controls/ctrlWatch.cs | 4 +- GUI.NET/Debugger/DebugWindowManager.cs | 4 + GUI.NET/Debugger/WatchManager.cs | 8 +- GUI.NET/Debugger/frmDbgPreferences.cs | 1 + GUI.NET/Debugger/frmDebugger.Designer.cs | 29 +++-- GUI.NET/Debugger/frmDebugger.cs | 6 + GUI.NET/Debugger/frmWatchWindow.Designer.cs | 58 +++++++++ GUI.NET/Debugger/frmWatchWindow.cs | 83 ++++++++++++ GUI.NET/Debugger/frmWatchWindow.resx | 123 ++++++++++++++++++ GUI.NET/Forms/frmMain.Designer.cs | 29 +++-- GUI.NET/Forms/frmMain.Tools.cs | 5 + GUI.NET/Forms/frmMain.cs | 2 + GUI.NET/GUI.NET.csproj | 9 ++ 16 files changed, 344 insertions(+), 34 deletions(-) create mode 100644 GUI.NET/Debugger/frmWatchWindow.Designer.cs create mode 100644 GUI.NET/Debugger/frmWatchWindow.cs create mode 100644 GUI.NET/Debugger/frmWatchWindow.resx diff --git a/GUI.NET/Config/DebugInfo.cs b/GUI.NET/Config/DebugInfo.cs index 651b9c15..67f5e8b2 100644 --- a/GUI.NET/Config/DebugInfo.cs +++ b/GUI.NET/Config/DebugInfo.cs @@ -289,6 +289,9 @@ namespace Mesen.GUI.Config public Size ProfilerSize = new Size(0, 0); public Point ProfilerLocation; + public Size WatchWindowSize = new Size(0, 0); + public Point WatchWindowLocation; + public Point WindowLocation; public int WindowWidth = -1; public int WindowHeight = -1; diff --git a/GUI.NET/Config/DebuggerShortcutsConfig.cs b/GUI.NET/Config/DebuggerShortcutsConfig.cs index 50726ca8..2122836e 100644 --- a/GUI.NET/Config/DebuggerShortcutsConfig.cs +++ b/GUI.NET/Config/DebuggerShortcutsConfig.cs @@ -84,6 +84,8 @@ namespace Mesen.GUI.Config public XmlKeys OpenTraceLogger = Keys.Control | Keys.J; [ShortcutName("Open Text Hooker")] public XmlKeys OpenTextHooker = Keys.Control | Keys.H; + [ShortcutName("Open Watch Window")] + public XmlKeys OpenWatchWindow = Keys.Control | Keys.W; [ShortcutName("Open Nametabler Viewer (Compact)")] public XmlKeys OpenNametableViewer = Keys.Control | Keys.D1; diff --git a/GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs b/GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs index 4c9803d7..1cac53e2 100644 --- a/GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs +++ b/GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs @@ -43,7 +43,6 @@ this.mnuMoveDown = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); this.mnuHexDisplay = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); this.txtEdit = new System.Windows.Forms.TextBox(); this.contextMenuWatch.SuspendLayout(); this.SuspendLayout(); @@ -93,10 +92,9 @@ this.mnuMoveUp, this.mnuMoveDown, this.toolStripMenuItem2, - this.mnuHexDisplay, - this.toolStripMenuItem3}); + this.mnuHexDisplay}); this.contextMenuWatch.Name = "contextMenuWatch"; - this.contextMenuWatch.Size = new System.Drawing.Size(194, 160); + this.contextMenuWatch.Size = new System.Drawing.Size(194, 154); this.contextMenuWatch.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuWatch_Opening); // // mnuRemoveWatch @@ -164,11 +162,6 @@ this.mnuHexDisplay.Text = "Hexadecimal Display"; this.mnuHexDisplay.Click += new System.EventHandler(this.mnuHexDisplay_Click); // - // toolStripMenuItem3 - // - this.toolStripMenuItem3.Name = "toolStripMenuItem3"; - this.toolStripMenuItem3.Size = new System.Drawing.Size(190, 6); - // // txtEdit // this.txtEdit.AcceptsReturn = true; @@ -209,6 +202,5 @@ private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4; private System.Windows.Forms.ToolStripMenuItem mnuMoveUp; private System.Windows.Forms.ToolStripMenuItem mnuMoveDown; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3; } } diff --git a/GUI.NET/Debugger/Controls/ctrlWatch.cs b/GUI.NET/Debugger/Controls/ctrlWatch.cs index 99c8d95a..5767aa45 100644 --- a/GUI.NET/Debugger/Controls/ctrlWatch.cs +++ b/GUI.NET/Debugger/Controls/ctrlWatch.cs @@ -21,6 +21,7 @@ namespace Mesen.GUI.Debugger private int _previousMaxLength = -1; private int _selectedAddress = -1; private CodeLabel _selectedLabel = null; + private List _previousValues = new List(); private bool _isEditing = false; ListViewItem _keyDownItem = null; @@ -90,7 +91,8 @@ namespace Mesen.GUI.Debugger public void UpdateWatch(bool autoResizeColumns = true) { - List watchContent = WatchManager.GetWatchContent(mnuHexDisplay.Checked); + List watchContent = WatchManager.GetWatchContent(mnuHexDisplay.Checked, _previousValues); + _previousValues = watchContent; int currentSelection = lstWatch.FocusedItem?.Index ?? -1; diff --git a/GUI.NET/Debugger/DebugWindowManager.cs b/GUI.NET/Debugger/DebugWindowManager.cs index b08720d8..559cd960 100644 --- a/GUI.NET/Debugger/DebugWindowManager.cs +++ b/GUI.NET/Debugger/DebugWindowManager.cs @@ -43,6 +43,7 @@ namespace Mesen.GUI.Debugger case DebugWindow.EventViewer: frm = new frmEventViewer(); frm.Icon = Properties.Resources.NesEventViewer; break; case DebugWindow.TextHooker: frm = new frmTextHooker(); frm.Icon = Properties.Resources.Font; break; case DebugWindow.Profiler: frm = new frmProfiler(); frm.Icon = Properties.Resources.Speed; break; + case DebugWindow.WatchWindow: frm = new frmWatchWindow(); frm.Icon = Properties.Resources.Find; break; } _openedWindows.Add(frm); frm.FormClosed += Debugger_FormClosed; @@ -147,6 +148,7 @@ namespace Mesen.GUI.Debugger case DebugWindow.ApuViewer: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmApuViewer)); case DebugWindow.TextHooker: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmTextHooker)); case DebugWindow.Profiler: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmProfiler)); + case DebugWindow.WatchWindow: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmWatchWindow)); } return null; @@ -156,6 +158,7 @@ namespace Mesen.GUI.Debugger { if(_openedWindows.Count == 0) { //All windows have been closed, disable debugger + DebugWorkspaceManager.SaveWorkspace(); DebugWorkspaceManager.Clear(); InteropEmu.DebugRelease(); } @@ -180,5 +183,6 @@ namespace Mesen.GUI.Debugger EventViewer, TextHooker, Profiler, + WatchWindow, } } diff --git a/GUI.NET/Debugger/WatchManager.cs b/GUI.NET/Debugger/WatchManager.cs index 8d7b3f94..9527b59a 100644 --- a/GUI.NET/Debugger/WatchManager.cs +++ b/GUI.NET/Debugger/WatchManager.cs @@ -11,7 +11,6 @@ namespace Mesen.GUI.Debugger { public static event EventHandler WatchChanged; private static List _watchEntries = new List(); - private static List _previousValues = new List(); private static Regex _arrayWatchRegex = new Regex(@"\[((\$[0-9A-Fa-f]+)|(\d+)|([@_a-zA-Z0-9]+))\s*,\s*(\d+)\]", RegexOptions.Compiled); public static List WatchEntries @@ -24,7 +23,7 @@ namespace Mesen.GUI.Debugger } } - public static List GetWatchContent(bool useHex) + public static List GetWatchContent(bool useHex, List previousValues) { var list = new List(); for(int i = 0; i < _watchEntries.Count; i++) { @@ -53,10 +52,9 @@ namespace Mesen.GUI.Debugger } } - list.Add(new WatchValueInfo() { Expression = expression, Value = newValue, HasChanged = forceHasChanged || (i < _previousValues.Count ? (_previousValues[i].Value != newValue) : false) }); + list.Add(new WatchValueInfo() { Expression = expression, Value = newValue, HasChanged = forceHasChanged || (i < previousValues.Count ? (previousValues[i].Value != newValue) : false) }); } - _previousValues = list; return list; } @@ -119,7 +117,7 @@ namespace Mesen.GUI.Debugger { HashSet set = new HashSet(indexes); _watchEntries = _watchEntries.Where((el, index) => !set.Contains(index)).ToList(); - _previousValues = _previousValues.Where((el, index) => !set.Contains(index)).ToList(); + //_previousValues = _previousValues.Where((el, index) => !set.Contains(index)).ToList(); WatchChanged?.Invoke(null, EventArgs.Empty); } } diff --git a/GUI.NET/Debugger/frmDbgPreferences.cs b/GUI.NET/Debugger/frmDbgPreferences.cs index 39c6555e..5ca9e2a2 100644 --- a/GUI.NET/Debugger/frmDbgPreferences.cs +++ b/GUI.NET/Debugger/frmDbgPreferences.cs @@ -52,6 +52,7 @@ namespace Mesen.GUI.Debugger GetMember(nameof(DebuggerShortcutsConfig.OpenScriptWindow)), GetMember(nameof(DebuggerShortcutsConfig.OpenTextHooker)), GetMember(nameof(DebuggerShortcutsConfig.OpenTraceLogger)), + GetMember(nameof(DebuggerShortcutsConfig.OpenWatchWindow)), GetMember(nameof(DebuggerShortcutsConfig.OpenNametableViewer)), GetMember(nameof(DebuggerShortcutsConfig.OpenChrViewer)), diff --git a/GUI.NET/Debugger/frmDebugger.Designer.cs b/GUI.NET/Debugger/frmDebugger.Designer.cs index 1bc7afc5..f3a01f2d 100644 --- a/GUI.NET/Debugger/frmDebugger.Designer.cs +++ b/GUI.NET/Debugger/frmDebugger.Designer.cs @@ -180,6 +180,7 @@ namespace Mesen.GUI.Debugger this.toolStripMenuItem19 = new System.Windows.Forms.ToolStripSeparator(); this.mnuShowBreakNotifications = new System.Windows.Forms.ToolStripMenuItem(); this.mnuShowInstructionProgression = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuShowSelectionLength = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem27 = new System.Windows.Forms.ToolStripSeparator(); this.mnuAlwaysScrollToCenter = new System.Windows.Forms.ToolStripMenuItem(); this.mnuRefreshWhileRunning = new System.Windows.Forms.ToolStripMenuItem(); @@ -196,6 +197,7 @@ namespace Mesen.GUI.Debugger this.mnuScriptWindow = new System.Windows.Forms.ToolStripMenuItem(); this.mnuTextHooker = new System.Windows.Forms.ToolStripMenuItem(); this.mnuTraceLogger = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuWatchWindow = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem13 = new System.Windows.Forms.ToolStripSeparator(); this.pPUViewerCompactToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mnuOpenNametableViewer = new System.Windows.Forms.ToolStripMenuItem(); @@ -226,7 +228,6 @@ namespace Mesen.GUI.Debugger this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); this.tsToolbar = new Mesen.GUI.Controls.ctrlMesenToolStrip(); - this.mnuShowSelectionLength = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -1634,6 +1635,14 @@ namespace Mesen.GUI.Debugger this.mnuShowInstructionProgression.Text = "Show instruction progression"; this.mnuShowInstructionProgression.Click += new System.EventHandler(this.mnuShowInstructionProgression_Click); // + // mnuShowSelectionLength + // + this.mnuShowSelectionLength.CheckOnClick = true; + this.mnuShowSelectionLength.Name = "mnuShowSelectionLength"; + this.mnuShowSelectionLength.Size = new System.Drawing.Size(266, 22); + this.mnuShowSelectionLength.Text = "Show selection length"; + this.mnuShowSelectionLength.Click += new System.EventHandler(this.mnuShowSelectionLength_Click); + // // toolStripMenuItem27 // this.toolStripMenuItem27.Name = "toolStripMenuItem27"; @@ -1688,6 +1697,7 @@ namespace Mesen.GUI.Debugger this.mnuScriptWindow, this.mnuTextHooker, this.mnuTraceLogger, + this.mnuWatchWindow, this.toolStripMenuItem13, this.pPUViewerCompactToolStripMenuItem, this.toolStripMenuItem17, @@ -1770,6 +1780,14 @@ namespace Mesen.GUI.Debugger this.mnuTraceLogger.Text = "Trace Logger"; this.mnuTraceLogger.Click += new System.EventHandler(this.mnuTraceLogger_Click); // + // mnuWatchWindow + // + this.mnuWatchWindow.Image = global::Mesen.GUI.Properties.Resources.Find; + this.mnuWatchWindow.Name = "mnuWatchWindow"; + this.mnuWatchWindow.Size = new System.Drawing.Size(194, 22); + this.mnuWatchWindow.Text = "Watch Window"; + this.mnuWatchWindow.Click += new System.EventHandler(this.mnuWatchWindow_Click); + // // toolStripMenuItem13 // this.toolStripMenuItem13.Name = "toolStripMenuItem13"; @@ -2005,14 +2023,6 @@ namespace Mesen.GUI.Debugger this.tsToolbar.Text = "toolStrip1"; this.tsToolbar.Visible = false; // - // mnuShowSelectionLength - // - this.mnuShowSelectionLength.CheckOnClick = true; - this.mnuShowSelectionLength.Name = "mnuShowSelectionLength"; - this.mnuShowSelectionLength.Size = new System.Drawing.Size(266, 22); - this.mnuShowSelectionLength.Text = "Show selection length"; - this.mnuShowSelectionLength.Click += new System.EventHandler(this.mnuShowSelectionLength_Click); - // // frmDebugger // this.AllowDrop = true; @@ -2260,5 +2270,6 @@ namespace Mesen.GUI.Debugger private System.Windows.Forms.ToolStripMenuItem mnuProfiler; private System.Windows.Forms.ToolStripMenuItem mnuRunCpuCycle; private System.Windows.Forms.ToolStripMenuItem mnuShowSelectionLength; + private System.Windows.Forms.ToolStripMenuItem mnuWatchWindow; } } \ No newline at end of file diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs index 22fe2adc..e66d1c1a 100644 --- a/GUI.NET/Debugger/frmDebugger.cs +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -287,6 +287,7 @@ namespace Mesen.GUI.Debugger mnuTraceLogger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTraceLogger)); mnuTextHooker.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTextHooker)); mnuProfiler.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenProfiler)); + mnuWatchWindow.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenWatchWindow)); mnuOpenNametableViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenNametableViewer)); mnuOpenChrViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenChrViewer)); @@ -1890,5 +1891,10 @@ namespace Mesen.GUI.Debugger { DebugWindowManager.OpenPpuViewer(PpuViewerMode.PaletteViewer); } + + private void mnuWatchWindow_Click(object sender, EventArgs e) + { + DebugWindowManager.OpenDebugWindow(DebugWindow.WatchWindow); + } } } diff --git a/GUI.NET/Debugger/frmWatchWindow.Designer.cs b/GUI.NET/Debugger/frmWatchWindow.Designer.cs new file mode 100644 index 00000000..78159151 --- /dev/null +++ b/GUI.NET/Debugger/frmWatchWindow.Designer.cs @@ -0,0 +1,58 @@ +namespace Mesen.GUI.Debugger +{ + partial class frmWatchWindow + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.ctrlWatch = new Mesen.GUI.Debugger.ctrlWatch(); + this.SuspendLayout(); + // + // ctrlWatch + // + this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill; + this.ctrlWatch.Location = new System.Drawing.Point(0, 0); + this.ctrlWatch.Name = "ctrlWatch"; + this.ctrlWatch.Size = new System.Drawing.Size(317, 322); + this.ctrlWatch.TabIndex = 0; + // + // frmWatchWindow + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(317, 322); + this.Controls.Add(this.ctrlWatch); + this.MinimumSize = new System.Drawing.Size(248, 137); + this.Name = "frmWatchWindow"; + this.Text = "Watch Window"; + this.ResumeLayout(false); + + } + + #endregion + + private ctrlWatch ctrlWatch; + } +} \ No newline at end of file diff --git a/GUI.NET/Debugger/frmWatchWindow.cs b/GUI.NET/Debugger/frmWatchWindow.cs new file mode 100644 index 00000000..7d7c62a4 --- /dev/null +++ b/GUI.NET/Debugger/frmWatchWindow.cs @@ -0,0 +1,83 @@ +using Mesen.GUI.Config; +using Mesen.GUI.Forms; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesen.GUI.Debugger +{ + public partial class frmWatchWindow : BaseForm + { + private InteropEmu.NotificationListener _notifListener; + + public frmWatchWindow() + { + InitializeComponent(); + + if(!DesignMode) { + if(!ConfigManager.Config.DebugInfo.WatchWindowSize.IsEmpty) { + this.StartPosition = FormStartPosition.Manual; + this.Size = ConfigManager.Config.DebugInfo.WatchWindowSize; + this.Location = ConfigManager.Config.DebugInfo.WatchWindowLocation; + } + } + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + if(!DesignMode) { + DebugWorkspaceManager.GetWorkspace(); + DebugWorkspaceManager.AutoLoadDbgFiles(true); + _notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId); + _notifListener.OnNotification += _notifListener_OnNotification; + ctrlWatch.UpdateWatch(true); + } + } + + protected override void OnFormClosing(FormClosingEventArgs e) + { + base.OnFormClosing(e); + + ConfigManager.Config.DebugInfo.WatchWindowSize = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size; + ConfigManager.Config.DebugInfo.WatchWindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location; + ConfigManager.ApplyChanges(); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + if(_notifListener != null) { + _notifListener.Dispose(); + _notifListener = null; + } + } + + private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e) + { + switch(e.NotificationType) { + case InteropEmu.ConsoleNotificationType.PpuFrameDone: + if(ConfigManager.Config.DebugInfo.RefreshWhileRunning) { + this.BeginInvoke((MethodInvoker)(() => { + ctrlWatch.UpdateWatch(false); + })); + } + break; + + case InteropEmu.ConsoleNotificationType.CodeBreak: + this.BeginInvoke((MethodInvoker)(() => { + ctrlWatch.UpdateWatch(false); + })); + break; + } + } + } +} diff --git a/GUI.NET/Debugger/frmWatchWindow.resx b/GUI.NET/Debugger/frmWatchWindow.resx new file mode 100644 index 00000000..8766f298 --- /dev/null +++ b/GUI.NET/Debugger/frmWatchWindow.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/GUI.NET/Forms/frmMain.Designer.cs b/GUI.NET/Forms/frmMain.Designer.cs index bdd48a9d..5c1acb38 100644 --- a/GUI.NET/Forms/frmMain.Designer.cs +++ b/GUI.NET/Forms/frmMain.Designer.cs @@ -198,6 +198,7 @@ namespace Mesen.GUI.Forms this.mnuDebugDebugger = new System.Windows.Forms.ToolStripMenuItem(); this.mnuEventViewer = new System.Windows.Forms.ToolStripMenuItem(); this.mnuMemoryViewer = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuProfiler = new System.Windows.Forms.ToolStripMenuItem(); this.mnuPpuViewer = new System.Windows.Forms.ToolStripMenuItem(); this.mnuScriptWindow = new System.Windows.Forms.ToolStripMenuItem(); this.mnuTextHooker = new System.Windows.Forms.ToolStripMenuItem(); @@ -221,7 +222,7 @@ namespace Mesen.GUI.Forms this.mnuReportBug = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator(); this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuProfiler = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuWatchWindow = new System.Windows.Forms.ToolStripMenuItem(); this.panelRenderer.SuspendLayout(); this.panelInfo.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); @@ -315,10 +316,10 @@ namespace Mesen.GUI.Forms this.lblVersion.AutoSize = true; this.lblVersion.BackColor = System.Drawing.Color.Transparent; this.lblVersion.ForeColor = System.Drawing.Color.White; - this.lblVersion.Location = new System.Drawing.Point(55, 5); + this.lblVersion.Location = new System.Drawing.Point(55, 7); this.lblVersion.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0); this.lblVersion.Name = "lblVersion"; - this.lblVersion.Size = new System.Drawing.Size(0, 16); + this.lblVersion.Size = new System.Drawing.Size(0, 13); this.lblVersion.TabIndex = 6; this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -1567,6 +1568,7 @@ namespace Mesen.GUI.Forms this.mnuScriptWindow, this.mnuTextHooker, this.mnuTraceLogger, + this.mnuWatchWindow, this.sepDebugDualSystemSecondaryCpu, this.mnuDebugDualSystemSecondaryCpu, this.toolStripMenuItem25, @@ -1620,6 +1622,14 @@ namespace Mesen.GUI.Forms this.mnuMemoryViewer.Text = "Memory Tools"; this.mnuMemoryViewer.Click += new System.EventHandler(this.mnuMemoryViewer_Click); // + // mnuProfiler + // + this.mnuProfiler.Image = global::Mesen.GUI.Properties.Resources.Speed; + this.mnuProfiler.Name = "mnuProfiler"; + this.mnuProfiler.Size = new System.Drawing.Size(258, 22); + this.mnuProfiler.Text = "Performance Profiler"; + this.mnuProfiler.Click += new System.EventHandler(this.mnuProfiler_Click); + // // mnuPpuViewer // this.mnuPpuViewer.Image = global::Mesen.GUI.Properties.Resources.Video; @@ -1794,13 +1804,13 @@ namespace Mesen.GUI.Forms this.mnuAbout.Text = "About"; this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click); // - // mnuProfiler + // mnuWatchWindow // - this.mnuProfiler.Image = global::Mesen.GUI.Properties.Resources.Speed; - this.mnuProfiler.Name = "mnuProfiler"; - this.mnuProfiler.Size = new System.Drawing.Size(258, 22); - this.mnuProfiler.Text = "Performance Profiler"; - this.mnuProfiler.Click += new System.EventHandler(this.mnuProfiler_Click); + this.mnuWatchWindow.Image = global::Mesen.GUI.Properties.Resources.Find; + this.mnuWatchWindow.Name = "mnuWatchWindow"; + this.mnuWatchWindow.Size = new System.Drawing.Size(258, 22); + this.mnuWatchWindow.Text = "Watch Window"; + this.mnuWatchWindow.Click += new System.EventHandler(this.mnuWatchWindow_Click); // // frmMain // @@ -2023,6 +2033,7 @@ namespace Mesen.GUI.Forms private System.Windows.Forms.ToolStripSeparator toolStripMenuItem28; private System.Windows.Forms.ToolStripMenuItem mnuProfiler; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.ToolStripMenuItem mnuWatchWindow; } } diff --git a/GUI.NET/Forms/frmMain.Tools.cs b/GUI.NET/Forms/frmMain.Tools.cs index b21c7cb6..93160685 100644 --- a/GUI.NET/Forms/frmMain.Tools.cs +++ b/GUI.NET/Forms/frmMain.Tools.cs @@ -398,6 +398,11 @@ namespace Mesen.GUI.Forms DebugWindowManager.OpenDebugWindow(DebugWindow.TraceLogger); } + private void mnuWatchWindow_Click(object sender, EventArgs e) + { + DebugWindowManager.OpenDebugWindow(DebugWindow.WatchWindow); + } + private void mnuTextHooker_Click(object sender, EventArgs e) { DebugWindowManager.OpenDebugWindow(DebugWindow.TextHooker); diff --git a/GUI.NET/Forms/frmMain.cs b/GUI.NET/Forms/frmMain.cs index c38aee17..59f20ef4 100644 --- a/GUI.NET/Forms/frmMain.cs +++ b/GUI.NET/Forms/frmMain.cs @@ -841,6 +841,7 @@ namespace Mesen.GUI.Forms mnuTraceLogger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTraceLogger)); mnuTextHooker.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTextHooker)); mnuProfiler.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenProfiler)); + mnuWatchWindow.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenWatchWindow)); mnuOpenNametableViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenNametableViewer)); mnuOpenChrViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenChrViewer)); @@ -1183,6 +1184,7 @@ namespace Mesen.GUI.Forms mnuTextHooker.Enabled = running; mnuTraceLogger.Enabled = running; mnuProfiler.Enabled = running; + mnuWatchWindow.Enabled = running; mnuPpuViewerCompact.Enabled = running; mnuOpenNametableViewer.Enabled = running; diff --git a/GUI.NET/GUI.NET.csproj b/GUI.NET/GUI.NET.csproj index 8b8387cf..32f5c832 100644 --- a/GUI.NET/GUI.NET.csproj +++ b/GUI.NET/GUI.NET.csproj @@ -844,6 +844,12 @@ frmTraceLogger.cs + + Form + + + frmWatchWindow.cs + Component @@ -1401,6 +1407,9 @@ frmTextHooker.cs + + frmWatchWindow.cs + Always