Debugger: Added option to ignore writes that do not alter the value (in hex editor highlights & access counters)
This commit is contained in:
parent
95c2c30076
commit
cdf5e62a81
8 changed files with 113 additions and 35 deletions
|
@ -477,7 +477,13 @@ bool Debugger::PrivateProcessRamOperation(MemoryOperationType type, uint16_t &ad
|
|||
int32_t absoluteRamAddr = addressInfo.Type == AddressType::WorkRam ? addressInfo.Address : -1;
|
||||
|
||||
if(addressInfo.Address >= 0 && type != MemoryOperationType::DummyRead) {
|
||||
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, type, _cpu->GetCycleCount());
|
||||
if(type == MemoryOperationType::Write && CheckFlag(DebuggerFlags::IgnoreRedundantWrites)) {
|
||||
if(_memoryManager->DebugRead(addr) != value) {
|
||||
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, type, _cpu->GetCycleCount());
|
||||
}
|
||||
} else {
|
||||
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, type, _cpu->GetCycleCount());
|
||||
}
|
||||
}
|
||||
|
||||
if(absoluteAddr >= 0) {
|
||||
|
|
|
@ -15,6 +15,8 @@ enum class DebuggerFlags
|
|||
DisassembleUnidentifiedData = 0x40,
|
||||
ShowVerifiedData = 0x80,
|
||||
ShowUnidentifiedData = 0x100,
|
||||
|
||||
IgnoreRedundantWrites = 0x200,
|
||||
};
|
||||
|
||||
enum class AddressType
|
||||
|
|
|
@ -138,6 +138,7 @@ namespace Mesen.GUI.Config
|
|||
|
||||
public bool RamAutoRefresh = true;
|
||||
public RefreshSpeed RamAutoRefreshSpeed = RefreshSpeed.Normal;
|
||||
public bool RamIgnoreRedundantWrites = false;
|
||||
public int RamColumnCount = 2;
|
||||
public float RamFontSize = BaseControl.DefaultFontSize;
|
||||
public bool RamShowCharacters = true;
|
||||
|
|
|
@ -98,5 +98,22 @@ namespace Mesen.GUI.Debugger
|
|||
}
|
||||
return _workspace;
|
||||
}
|
||||
|
||||
private static DebuggerFlags _flags = DebuggerFlags.None;
|
||||
public static void SetFlags(DebuggerFlags flags)
|
||||
{
|
||||
_flags |= flags;
|
||||
InteropEmu.DebugSetFlags(_flags);
|
||||
}
|
||||
|
||||
public static void ClearFlags(DebuggerFlags flags = DebuggerFlags.None)
|
||||
{
|
||||
if(flags == DebuggerFlags.None) {
|
||||
_flags = DebuggerFlags.None;
|
||||
} else {
|
||||
_flags &= ~flags;
|
||||
}
|
||||
InteropEmu.DebugSetFlags(_flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,7 +256,8 @@ namespace Mesen.GUI.Debugger
|
|||
if(mnuBreakOnBrk.Checked) {
|
||||
flags |= DebuggerFlags.BreakOnBrk;
|
||||
}
|
||||
InteropEmu.DebugSetFlags(flags);
|
||||
|
||||
DebugWorkspaceManager.SetFlags(flags);
|
||||
InteropEmu.SetFlag(EmulationFlags.DebuggerWindowEnabled, true);
|
||||
}
|
||||
|
||||
|
|
46
GUI.NET/Debugger/frmMemoryViewer.Designer.cs
generated
46
GUI.NET/Debugger/frmMemoryViewer.Designer.cs
generated
|
@ -102,6 +102,8 @@
|
|||
this.ctrlMemoryAccessCounters = new Mesen.GUI.Debugger.Controls.ctrlMemoryAccessCounters();
|
||||
this.tpgProfiler = new System.Windows.Forms.TabPage();
|
||||
this.ctrlProfiler = new Mesen.GUI.Debugger.Controls.ctrlProfiler();
|
||||
this.mnuIgnoreRedundantWrites = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
|
@ -261,7 +263,9 @@
|
|||
this.toolStripMenuItem9,
|
||||
this.mnuAutoRefresh,
|
||||
this.mnuShowCharacters,
|
||||
this.mnuShowLabelInfoOnMouseOver});
|
||||
this.mnuShowLabelInfoOnMouseOver,
|
||||
this.toolStripMenuItem10,
|
||||
this.mnuIgnoreRedundantWrites});
|
||||
this.mnuView.Name = "mnuView";
|
||||
this.mnuView.Size = new System.Drawing.Size(44, 20);
|
||||
this.mnuView.Text = "View";
|
||||
|
@ -275,7 +279,7 @@
|
|||
this.toolStripMenuItem6,
|
||||
this.fadeSpeedToolStripMenuItem});
|
||||
this.highlightToolStripMenuItem.Name = "highlightToolStripMenuItem";
|
||||
this.highlightToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
|
||||
this.highlightToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
|
||||
this.highlightToolStripMenuItem.Text = "Memory Access Highlighting";
|
||||
//
|
||||
// mnuHighlightExecution
|
||||
|
@ -374,7 +378,7 @@
|
|||
this.mnuHighlightChrDrawnBytes,
|
||||
this.mnuHighlightChrReadBytes});
|
||||
this.dataTypeHighlightingToolStripMenuItem.Name = "dataTypeHighlightingToolStripMenuItem";
|
||||
this.dataTypeHighlightingToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
|
||||
this.dataTypeHighlightingToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
|
||||
this.dataTypeHighlightingToolStripMenuItem.Text = "Data Type Highlighting";
|
||||
//
|
||||
// mnuHighlightLabelledBytes
|
||||
|
@ -437,7 +441,7 @@
|
|||
this.mnuHideWrittenBytes,
|
||||
this.mnuHideExecutedBytes});
|
||||
this.fadeToolStripMenuItem.Name = "fadeToolStripMenuItem";
|
||||
this.fadeToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
|
||||
this.fadeToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
|
||||
this.fadeToolStripMenuItem.Text = "De-emphasize";
|
||||
//
|
||||
// mnuHideUnusedBytes
|
||||
|
@ -475,13 +479,13 @@
|
|||
// toolStripMenuItem5
|
||||
//
|
||||
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(245, 6);
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(253, 6);
|
||||
//
|
||||
// mnuConfigureColors
|
||||
//
|
||||
this.mnuConfigureColors.Image = global::Mesen.GUI.Properties.Resources.PipetteSmall;
|
||||
this.mnuConfigureColors.Name = "mnuConfigureColors";
|
||||
this.mnuConfigureColors.Size = new System.Drawing.Size(248, 22);
|
||||
this.mnuConfigureColors.Size = new System.Drawing.Size(256, 22);
|
||||
this.mnuConfigureColors.Text = "Configure Colors";
|
||||
this.mnuConfigureColors.Click += new System.EventHandler(this.mnuConfigureColors_Click);
|
||||
//
|
||||
|
@ -493,7 +497,7 @@
|
|||
this.mnuResetFontSize});
|
||||
this.fontSizeToolStripMenuItem.Image = global::Mesen.GUI.Properties.Resources.Font;
|
||||
this.fontSizeToolStripMenuItem.Name = "fontSizeToolStripMenuItem";
|
||||
this.fontSizeToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
|
||||
this.fontSizeToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
|
||||
this.fontSizeToolStripMenuItem.Text = "Text Size";
|
||||
//
|
||||
// mnuIncreaseFontSize
|
||||
|
@ -531,7 +535,7 @@
|
|||
this.mnuAutoRefreshHigh});
|
||||
this.autorefreshSpeedToolStripMenuItem.Image = global::Mesen.GUI.Properties.Resources.Speed;
|
||||
this.autorefreshSpeedToolStripMenuItem.Name = "autorefreshSpeedToolStripMenuItem";
|
||||
this.autorefreshSpeedToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
|
||||
this.autorefreshSpeedToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
|
||||
this.autorefreshSpeedToolStripMenuItem.Text = "Auto-refresh Speed";
|
||||
//
|
||||
// mnuAutoRefreshLow
|
||||
|
@ -558,21 +562,21 @@
|
|||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(245, 6);
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(253, 6);
|
||||
//
|
||||
// mnuRefresh
|
||||
//
|
||||
this.mnuRefresh.Image = global::Mesen.GUI.Properties.Resources.Reset;
|
||||
this.mnuRefresh.Name = "mnuRefresh";
|
||||
this.mnuRefresh.ShortcutKeys = System.Windows.Forms.Keys.F5;
|
||||
this.mnuRefresh.Size = new System.Drawing.Size(248, 22);
|
||||
this.mnuRefresh.Size = new System.Drawing.Size(256, 22);
|
||||
this.mnuRefresh.Text = "Refresh";
|
||||
this.mnuRefresh.Click += new System.EventHandler(this.mnuRefresh_Click);
|
||||
//
|
||||
// toolStripMenuItem9
|
||||
//
|
||||
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
|
||||
this.toolStripMenuItem9.Size = new System.Drawing.Size(245, 6);
|
||||
this.toolStripMenuItem9.Size = new System.Drawing.Size(253, 6);
|
||||
//
|
||||
// mnuAutoRefresh
|
||||
//
|
||||
|
@ -580,7 +584,7 @@
|
|||
this.mnuAutoRefresh.CheckOnClick = true;
|
||||
this.mnuAutoRefresh.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.mnuAutoRefresh.Name = "mnuAutoRefresh";
|
||||
this.mnuAutoRefresh.Size = new System.Drawing.Size(248, 22);
|
||||
this.mnuAutoRefresh.Size = new System.Drawing.Size(256, 22);
|
||||
this.mnuAutoRefresh.Text = "Auto-refresh";
|
||||
this.mnuAutoRefresh.Click += new System.EventHandler(this.mnuAutoRefresh_Click);
|
||||
//
|
||||
|
@ -590,14 +594,14 @@
|
|||
this.mnuShowCharacters.CheckOnClick = true;
|
||||
this.mnuShowCharacters.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.mnuShowCharacters.Name = "mnuShowCharacters";
|
||||
this.mnuShowCharacters.Size = new System.Drawing.Size(248, 22);
|
||||
this.mnuShowCharacters.Size = new System.Drawing.Size(256, 22);
|
||||
this.mnuShowCharacters.Text = "Show characters";
|
||||
//
|
||||
// mnuShowLabelInfoOnMouseOver
|
||||
//
|
||||
this.mnuShowLabelInfoOnMouseOver.CheckOnClick = true;
|
||||
this.mnuShowLabelInfoOnMouseOver.Name = "mnuShowLabelInfoOnMouseOver";
|
||||
this.mnuShowLabelInfoOnMouseOver.Size = new System.Drawing.Size(248, 22);
|
||||
this.mnuShowLabelInfoOnMouseOver.Size = new System.Drawing.Size(256, 22);
|
||||
this.mnuShowLabelInfoOnMouseOver.Text = "Show label tooltip on mouseover";
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
|
@ -754,6 +758,18 @@
|
|||
this.ctrlProfiler.Size = new System.Drawing.Size(606, 343);
|
||||
this.ctrlProfiler.TabIndex = 0;
|
||||
//
|
||||
// mnuIgnoreRedundantWrites
|
||||
//
|
||||
this.mnuIgnoreRedundantWrites.CheckOnClick = true;
|
||||
this.mnuIgnoreRedundantWrites.Name = "mnuIgnoreRedundantWrites";
|
||||
this.mnuIgnoreRedundantWrites.Size = new System.Drawing.Size(256, 22);
|
||||
this.mnuIgnoreRedundantWrites.Text = "Ignore writes that do not alter data";
|
||||
//
|
||||
// toolStripMenuItem10
|
||||
//
|
||||
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
|
||||
this.toolStripMenuItem10.Size = new System.Drawing.Size(253, 6);
|
||||
//
|
||||
// frmMemoryViewer
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -856,5 +872,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem mnuAutoRefreshNormal;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuAutoRefreshHigh;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem9;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem10;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuIgnoreRedundantWrites;
|
||||
}
|
||||
}
|
|
@ -37,6 +37,9 @@ namespace Mesen.GUI.Debugger
|
|||
this.mnuAutoRefresh.Checked = ConfigManager.Config.DebugInfo.RamAutoRefresh;
|
||||
UpdateRefreshSpeedMenu();
|
||||
|
||||
this.mnuIgnoreRedundantWrites.Checked = ConfigManager.Config.DebugInfo.RamIgnoreRedundantWrites;
|
||||
this.UpdateFlags();
|
||||
|
||||
this.mnuShowCharacters.Checked = ConfigManager.Config.DebugInfo.RamShowCharacters;
|
||||
this.mnuShowLabelInfoOnMouseOver.Checked = ConfigManager.Config.DebugInfo.RamShowLabelInfo;
|
||||
|
||||
|
@ -70,7 +73,8 @@ namespace Mesen.GUI.Debugger
|
|||
_notifListener = new InteropEmu.NotificationListener();
|
||||
_notifListener.OnNotification += _notifListener_OnNotification;
|
||||
|
||||
this.mnuShowCharacters.CheckedChanged += new EventHandler(this.mnuShowCharacters_CheckedChanged);
|
||||
this.mnuShowCharacters.CheckedChanged += this.mnuShowCharacters_CheckedChanged;
|
||||
this.mnuIgnoreRedundantWrites.CheckedChanged += mnuIgnoreRedundantWrites_CheckedChanged;
|
||||
|
||||
if(!ConfigManager.Config.DebugInfo.MemoryViewerSize.IsEmpty) {
|
||||
this.Size = ConfigManager.Config.DebugInfo.MemoryViewerSize;
|
||||
|
@ -86,6 +90,15 @@ namespace Mesen.GUI.Debugger
|
|||
DebugWorkspaceManager.SaveWorkspace();
|
||||
}
|
||||
|
||||
private void UpdateFlags()
|
||||
{
|
||||
if(mnuIgnoreRedundantWrites.Checked) {
|
||||
DebugWorkspaceManager.SetFlags(DebuggerFlags.IgnoreRedundantWrites);
|
||||
} else {
|
||||
DebugWorkspaceManager.ClearFlags(DebuggerFlags.IgnoreRedundantWrites);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowAddress(int address)
|
||||
{
|
||||
tabMain.SelectedTab = tpgMemoryViewer;
|
||||
|
@ -108,25 +121,34 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
|
||||
{
|
||||
if(e.NotificationType == InteropEmu.ConsoleNotificationType.CodeBreak) {
|
||||
this.BeginInvoke((MethodInvoker)(() => this.RefreshData()));
|
||||
} else if(e.NotificationType == InteropEmu.ConsoleNotificationType.PpuViewerDisplayFrame) {
|
||||
int refreshDelay = 90;
|
||||
switch(ConfigManager.Config.DebugInfo.RamAutoRefreshSpeed) {
|
||||
case RefreshSpeed.Low: refreshDelay= 90; break;
|
||||
case RefreshSpeed.Normal: refreshDelay = 32; break;
|
||||
case RefreshSpeed.High: refreshDelay = 16; break;
|
||||
}
|
||||
switch(e.NotificationType) {
|
||||
case InteropEmu.ConsoleNotificationType.CodeBreak:
|
||||
this.BeginInvoke((MethodInvoker)(() => this.RefreshData()));
|
||||
break;
|
||||
|
||||
case InteropEmu.ConsoleNotificationType.GameReset:
|
||||
case InteropEmu.ConsoleNotificationType.GameLoaded:
|
||||
this.UpdateFlags();
|
||||
break;
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
if(!_updating && ConfigManager.Config.DebugInfo.RamAutoRefresh && (now - _lastUpdate).Milliseconds >= refreshDelay) {
|
||||
_lastUpdate = now;
|
||||
_updating = true;
|
||||
this.BeginInvoke((Action)(() => {
|
||||
this.RefreshData();
|
||||
_updating = false;
|
||||
}));
|
||||
}
|
||||
case InteropEmu.ConsoleNotificationType.PpuViewerDisplayFrame:
|
||||
int refreshDelay = 90;
|
||||
switch(ConfigManager.Config.DebugInfo.RamAutoRefreshSpeed) {
|
||||
case RefreshSpeed.Low: refreshDelay= 90; break;
|
||||
case RefreshSpeed.Normal: refreshDelay = 32; break;
|
||||
case RefreshSpeed.High: refreshDelay = 16; break;
|
||||
}
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
if(!_updating && ConfigManager.Config.DebugInfo.RamAutoRefresh && (now - _lastUpdate).Milliseconds >= refreshDelay) {
|
||||
_lastUpdate = now;
|
||||
_updating = true;
|
||||
this.BeginInvoke((Action)(() => {
|
||||
this.RefreshData();
|
||||
_updating = false;
|
||||
}));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,6 +266,9 @@ namespace Mesen.GUI.Debugger
|
|||
private void UpdateConfig()
|
||||
{
|
||||
ConfigManager.Config.DebugInfo.RamAutoRefresh = this.mnuAutoRefresh.Checked;
|
||||
|
||||
ConfigManager.Config.DebugInfo.RamIgnoreRedundantWrites = this.mnuIgnoreRedundantWrites.Checked;
|
||||
|
||||
ConfigManager.Config.DebugInfo.RamShowCharacters = this.mnuShowCharacters.Checked;
|
||||
ConfigManager.Config.DebugInfo.RamShowLabelInfo = this.mnuShowLabelInfoOnMouseOver.Checked;
|
||||
ConfigManager.Config.DebugInfo.RamFontSize = this.ctrlHexViewer.HexFont.Size;
|
||||
|
@ -359,6 +384,12 @@ namespace Mesen.GUI.Debugger
|
|||
this.UpdateConfig();
|
||||
}
|
||||
|
||||
private void mnuIgnoreRedundantWrites_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.UpdateFlags();
|
||||
this.UpdateConfig();
|
||||
}
|
||||
|
||||
private void UpdateFadeOptions()
|
||||
{
|
||||
int fadeSpeed = ConfigManager.Config.DebugInfo.RamFadeSpeed;
|
||||
|
|
|
@ -1453,6 +1453,8 @@ namespace Mesen.GUI
|
|||
DisassembleUnidentifiedData = 0x40,
|
||||
ShowVerifiedData = 0x80,
|
||||
ShowUnidentifiedData = 0x100,
|
||||
|
||||
IgnoreRedundantWrites= 0x200,
|
||||
}
|
||||
|
||||
public struct InteropRomInfo
|
||||
|
|
Loading…
Add table
Reference in a new issue