Port Watch Window from Mesen
This commit is contained in:
parent
e25c69e54b
commit
242dd77365
12 changed files with 495 additions and 168 deletions
|
@ -32,6 +32,7 @@ namespace Mesen.GUI.Config
|
|||
public bool NeedInputReinit2 = true;
|
||||
public DefaultKeyMappingType DefaultKeyMappings = DefaultKeyMappingType.Xbox | DefaultKeyMappingType.ArrowKeys;
|
||||
public HistoryViewerConfig HistoryViewer;
|
||||
public WatchWindowConfig WatchWindow;
|
||||
|
||||
public Configuration()
|
||||
{
|
||||
|
@ -48,6 +49,7 @@ namespace Mesen.GUI.Config
|
|||
Cheats = new CheatWindowConfig();
|
||||
Netplay = new NetplayConfig();
|
||||
HistoryViewer = new HistoryViewerConfig();
|
||||
WatchWindow = new WatchWindowConfig();
|
||||
}
|
||||
|
||||
~Configuration()
|
||||
|
|
15
UI/Config/WatchWindowConfig.cs
Normal file
15
UI/Config/WatchWindowConfig.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mesen.GUI.Config
|
||||
{
|
||||
public class WatchWindowConfig
|
||||
{
|
||||
public Size WindowSize;
|
||||
public Point WindowLocation;
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ namespace Mesen.GUI.Config
|
|||
public ProfilerConfig Profiler = new ProfilerConfig();
|
||||
public AssemblerConfig Assembler = new AssemblerConfig();
|
||||
public DebugLogConfig DebugLog = new DebugLogConfig();
|
||||
public WatchWindowConfig WatchWindow = new WatchWindowConfig();
|
||||
|
||||
public DebugInfo()
|
||||
{
|
||||
|
|
|
@ -97,6 +97,8 @@ namespace Mesen.GUI.Config
|
|||
public XmlKeys OpenRegisterViewer = Keys.Control | Keys.K;
|
||||
[ShortcutName("Open Debug Log")]
|
||||
public XmlKeys OpenDebugLog = Keys.Control | Keys.B;
|
||||
[ShortcutName("Open Watch Window")]
|
||||
public XmlKeys OpenWatchWindow = Keys.Control | Keys.W;
|
||||
|
||||
[ShortcutName("Open Tilemap Viewer")]
|
||||
public XmlKeys OpenTilemapViewer = Keys.Control | Keys.D1;
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace Mesen.GUI.Debugger
|
|||
case DebugWindow.GbPaletteViewer: frm = new frmPaletteViewer(CpuType.Gameboy); frm.Icon = Properties.Resources.VideoFilter; break;
|
||||
case DebugWindow.GbSpriteViewer: frm = new frmSpriteViewer(CpuType.Gameboy); frm.Icon = Properties.Resources.PerfTracker; break;
|
||||
case DebugWindow.GbEventViewer: frm = new frmEventViewer(CpuType.Gameboy); frm.Icon = Properties.Resources.NesEventViewer; break;
|
||||
case DebugWindow.WatchWindow: frm = new frmWatchWindow(); frm.Icon = Properties.Resources.Find; break;
|
||||
}
|
||||
|
||||
if(_openedWindows.Count == 0) {
|
||||
|
@ -203,6 +204,7 @@ namespace Mesen.GUI.Debugger
|
|||
case DebugWindow.GbEventViewer: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmEventViewer) && ((frmEventViewer)form).CpuType == CpuType.Gameboy);
|
||||
case DebugWindow.Profiler: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmProfiler));
|
||||
case DebugWindow.DebugLog: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmDebugLog));
|
||||
case DebugWindow.WatchWindow: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmWatchWindow));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -261,6 +263,7 @@ namespace Mesen.GUI.Debugger
|
|||
Profiler,
|
||||
Assembler,
|
||||
DebugLog,
|
||||
WatchWindow,
|
||||
|
||||
GbTileViewer,
|
||||
GbTilemapViewer,
|
||||
|
|
74
UI/Debugger/frmWatchWindow.Designer.cs
generated
Normal file
74
UI/Debugger/frmWatchWindow.Designer.cs
generated
Normal file
|
@ -0,0 +1,74 @@
|
|||
namespace Mesen.GUI.Debugger
|
||||
{
|
||||
partial class frmWatchWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.ctrlWatch = new Mesen.GUI.Debugger.ctrlWatch();
|
||||
this.picWatchHelp = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picWatchHelp)).BeginInit();
|
||||
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;
|
||||
//
|
||||
// picWatchHelp
|
||||
//
|
||||
this.picWatchHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.picWatchHelp.Image = global::Mesen.GUI.Properties.Resources.Help;
|
||||
this.picWatchHelp.Location = new System.Drawing.Point(297, 4);
|
||||
this.picWatchHelp.Name = "picWatchHelp";
|
||||
this.picWatchHelp.Size = new System.Drawing.Size(16, 16);
|
||||
this.picWatchHelp.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
|
||||
this.picWatchHelp.TabIndex = 2;
|
||||
this.picWatchHelp.TabStop = false;
|
||||
//
|
||||
// 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.picWatchHelp);
|
||||
this.Controls.Add(this.ctrlWatch);
|
||||
this.MinimumSize = new System.Drawing.Size(248, 137);
|
||||
this.Name = "frmWatchWindow";
|
||||
this.Text = "Watch Window";
|
||||
((System.ComponentModel.ISupportInitialize)(this.picWatchHelp)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ctrlWatch ctrlWatch;
|
||||
private System.Windows.Forms.PictureBox picWatchHelp;
|
||||
}
|
||||
}
|
78
UI/Debugger/frmWatchWindow.cs
Normal file
78
UI/Debugger/frmWatchWindow.cs
Normal file
|
@ -0,0 +1,78 @@
|
|||
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 NotificationListener _notifListener;
|
||||
|
||||
public frmWatchWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if(!DesignMode) {
|
||||
this.toolTip.SetToolTip(picWatchHelp, ctrlWatch.GetTooltipText());
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
// Allow more CPU types later
|
||||
ctrlWatch.CpuType = EmuApi.GetRomInfo().CoprocessorType == CoprocessorType.Gameboy ? CpuType.Gameboy : CpuType.Cpu;
|
||||
|
||||
if(!DesignMode) {
|
||||
RestoreLocation(ConfigManager.Config.WatchWindow.WindowLocation, ConfigManager.Config.WatchWindow.WindowSize);
|
||||
_notifListener = new NotificationListener();
|
||||
_notifListener.OnNotification += _notifListener_OnNotification;
|
||||
ctrlWatch.UpdateWatch(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
base.OnFormClosing(e);
|
||||
|
||||
ConfigManager.Config.WatchWindow.WindowSize = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
|
||||
ConfigManager.Config.WatchWindow.WindowLocation = 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(NotificationEventArgs e)
|
||||
{
|
||||
switch(e.NotificationType) {
|
||||
case ConsoleNotificationType.PpuFrameDone:
|
||||
this.BeginInvoke((MethodInvoker)(() => {
|
||||
ctrlWatch.UpdateWatch(false);
|
||||
}));
|
||||
break;
|
||||
|
||||
case ConsoleNotificationType.CodeBreak:
|
||||
this.BeginInvoke((MethodInvoker)(() => {
|
||||
ctrlWatch.UpdateWatch(false);
|
||||
}));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
UI/Debugger/frmWatchWindow.resx
Normal file
123
UI/Debugger/frmWatchWindow.resx
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
349
UI/Forms/frmMain.Designer.cs
generated
349
UI/Forms/frmMain.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
@ -302,6 +302,7 @@ namespace Mesen.GUI.Forms
|
|||
mnuProfiler.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenProfiler));
|
||||
mnuAssembler.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenAssembler));
|
||||
mnuDebugLog.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenDebugLog));
|
||||
mnuWatchWindow.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenWatchWindow));
|
||||
|
||||
mnuNoneFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.None); };
|
||||
mnuNtscFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.NTSC); };
|
||||
|
@ -369,6 +370,7 @@ namespace Mesen.GUI.Forms
|
|||
mnuProfiler.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Profiler); };
|
||||
mnuAssembler.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Assembler); };
|
||||
mnuDebugLog.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.DebugLog); };
|
||||
mnuWatchWindow.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.WatchWindow); };
|
||||
|
||||
mnuGbTilemapViewer.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.GbTilemapViewer); };
|
||||
mnuGbTileViewer.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.GbTileViewer); };
|
||||
|
@ -486,6 +488,7 @@ namespace Mesen.GUI.Forms
|
|||
mnuProfiler.Enabled = running;
|
||||
mnuAssembler.Enabled = running;
|
||||
mnuDebugLog.Enabled = running;
|
||||
mnuWatchWindow.Enabled = running;
|
||||
|
||||
bool isGameboyMode = coprocessor == CoprocessorType.Gameboy;
|
||||
bool isSuperGameboy = coprocessor == CoprocessorType.SGB;
|
||||
|
@ -827,5 +830,6 @@ namespace Mesen.GUI.Forms
|
|||
_historyViewerWindow.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,6 +121,6 @@
|
|||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="mnuMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>107, 17</value>
|
||||
<value>122, 17</value>
|
||||
</metadata>
|
||||
</root>
|
10
UI/UI.csproj
10
UI/UI.csproj
|
@ -229,6 +229,7 @@
|
|||
<Compile Include="Config\EmulationConfig.cs" />
|
||||
<Compile Include="Config\NetplayConfig.cs" />
|
||||
<Compile Include="Config\VideoConfig.cs" />
|
||||
<Compile Include="Config\WatchWindowConfig.cs" />
|
||||
<Compile Include="Controls\ctrlLinkLabel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
@ -318,6 +319,12 @@
|
|||
<Compile Include="Debugger\frmDebugLog.Designer.cs">
|
||||
<DependentUpon>frmDebugLog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Debugger\frmWatchWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Debugger\frmWatchWindow.Designer.cs">
|
||||
<DependentUpon>frmWatchWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Debugger\Integration\RgbdsSymbolFile.cs" />
|
||||
<Compile Include="Debugger\Integration\BassLabelFile.cs" />
|
||||
<Compile Include="Debugger\MemoryTools\ctrlMemoryAccessCounters.cs">
|
||||
|
@ -1110,6 +1117,9 @@
|
|||
<EmbeddedResource Include="Debugger\frmDebugLog.resx">
|
||||
<DependentUpon>frmDebugLog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Debugger\frmWatchWindow.resx">
|
||||
<DependentUpon>frmWatchWindow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Debugger\MemoryTools\ctrlMemoryAccessCounters.resx">
|
||||
<DependentUpon>ctrlMemoryAccessCounters.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
Loading…
Add table
Reference in a new issue