Debugger: Ability to de-emphasize read/written/executed bytes in hex editor

This commit is contained in:
Souryo 2017-03-04 23:15:50 -05:00
parent 910e27f0af
commit acbd7f183d
10 changed files with 213 additions and 30 deletions

View file

@ -20,7 +20,7 @@ MemoryAccessCounter::MemoryAccessCounter(Debugger* debugger)
} }
} }
vector<int>& MemoryAccessCounter::GetArray(MemoryOperationType operationType, AddressType addressType, bool stampArray) vector<int32_t>& MemoryAccessCounter::GetArray(MemoryOperationType operationType, AddressType addressType, bool stampArray)
{ {
switch(operationType) { switch(operationType) {
case MemoryOperationType::Read: return stampArray ? _readStamps[(int)addressType] : _readCounts[(int)addressType]; case MemoryOperationType::Read: return stampArray ? _readStamps[(int)addressType] : _readCounts[(int)addressType];
@ -99,4 +99,33 @@ void MemoryAccessCounter::GetAccessStamps(uint32_t offset, uint32_t length, Debu
} }
break; break;
} }
}
void MemoryAccessCounter::GetAccessCountsEx(uint32_t offset, uint32_t length, DebugMemoryType memoryType, MemoryOperationType operationType, int32_t counts[])
{
switch(memoryType) {
case DebugMemoryType::InternalRam:
memcpy(counts, GetArray(operationType, AddressType::InternalRam, false).data() + offset, length * sizeof(uint32_t));
break;
case DebugMemoryType::WorkRam:
memcpy(counts, GetArray(operationType, AddressType::WorkRam, false).data() + offset, length * sizeof(uint32_t));
break;
case DebugMemoryType::SaveRam:
memcpy(counts, GetArray(operationType, AddressType::SaveRam, false).data() + offset, length * sizeof(uint32_t));
break;
case DebugMemoryType::PrgRom:
memcpy(counts, GetArray(operationType, AddressType::PrgRom, false).data() + offset, length * sizeof(uint32_t));
break;
case DebugMemoryType::CpuMemory:
for(uint32_t i = 0; i < length; i++) {
AddressTypeInfo info;
_debugger->GetAbsoluteAddressAndType(offset + i, &info);
counts[i] = GetArray(operationType, info.Type, false).data()[info.Address];
}
break;
}
} }

View file

@ -29,5 +29,6 @@ public:
void ResetCounts(); void ResetCounts();
void GetAccessCounts(AddressType memoryType, MemoryOperationType operationType, uint32_t counts[], bool forUninitReads); void GetAccessCounts(AddressType memoryType, MemoryOperationType operationType, uint32_t counts[], bool forUninitReads);
void GetAccessCountsEx(uint32_t offset, uint32_t length, DebugMemoryType memoryType, MemoryOperationType operationType, int32_t counts[]);
void GetAccessStamps(uint32_t offset, uint32_t length, DebugMemoryType memoryType, MemoryOperationType operationType, uint32_t stamps[]); void GetAccessStamps(uint32_t offset, uint32_t length, DebugMemoryType memoryType, MemoryOperationType operationType, uint32_t stamps[]);
}; };

View file

@ -125,6 +125,10 @@ namespace Mesen.GUI.Config
public bool RamHighlightWrites = true; public bool RamHighlightWrites = true;
public bool RamHighlightReads = true; public bool RamHighlightReads = true;
public int RamFadeSpeed = 300; public int RamFadeSpeed = 300;
public bool RamHideUnusedBytes;
public bool RamHideReadBytes;
public bool RamHideWrittenBytes;
public bool RamHideExecutedBytes;
public int WindowWidth = -1; public int WindowWidth = -1;
public int WindowHeight = -1; public int WindowHeight = -1;

View file

@ -10,20 +10,31 @@ namespace Mesen.GUI.Debugger
Int32[] _readStamps; Int32[] _readStamps;
Int32[] _writeStamps; Int32[] _writeStamps;
Int32[] _execStamps; Int32[] _execStamps;
Int32[] _readCounts;
Int32[] _writeCounts;
Int32[] _execCounts;
bool[] _freezeState; bool[] _freezeState;
DebugState _state = new DebugState(); DebugState _state = new DebugState();
bool _showExec; bool _showExec;
bool _showWrite; bool _showWrite;
bool _showRead; bool _showRead;
int _framesToFade; int _framesToFade;
bool _hideUnusedBytes;
bool _hideReadBytes;
bool _hideWrittenBytes;
bool _hideExecutedBytes;
public ByteColorProvider(DebugMemoryType memoryType, bool showExec, bool showWrite, bool showRead, int framesToFade) public ByteColorProvider(DebugMemoryType memoryType, bool showExec, bool showWrite, bool showRead, int framesToFade, bool hideUnusedBytes, bool hideReadBytes, bool hideWrittenBytes, bool hideExecutedBytes)
{ {
_memoryType = memoryType; _memoryType = memoryType;
_showExec = showExec; _showExec = showExec;
_showWrite = showWrite; _showWrite = showWrite;
_showRead = showRead; _showRead = showRead;
_framesToFade = framesToFade; _framesToFade = framesToFade;
_hideUnusedBytes = hideUnusedBytes;
_hideReadBytes = hideReadBytes;
_hideWrittenBytes = hideWrittenBytes;
_hideExecutedBytes = hideExecutedBytes;
} }
public void Prepare(long firstByteIndex, long lastByteIndex) public void Prepare(long firstByteIndex, long lastByteIndex)
@ -34,11 +45,19 @@ namespace Mesen.GUI.Debugger
if(_memoryType == DebugMemoryType.CpuMemory) { if(_memoryType == DebugMemoryType.CpuMemory) {
_freezeState = InteropEmu.DebugGetFreezeState((UInt16)firstByteIndex, (UInt16)(lastByteIndex - firstByteIndex + 1)); _freezeState = InteropEmu.DebugGetFreezeState((UInt16)firstByteIndex, (UInt16)(lastByteIndex - firstByteIndex + 1));
} }
_readCounts = InteropEmu.DebugGetMemoryAccessCountsEx((UInt32)firstByteIndex, (UInt32)(lastByteIndex - firstByteIndex + 1), _memoryType, MemoryOperationType.Read);
_writeCounts = InteropEmu.DebugGetMemoryAccessCountsEx((UInt32)firstByteIndex, (UInt32)(lastByteIndex - firstByteIndex + 1), _memoryType, MemoryOperationType.Write);
_execCounts = InteropEmu.DebugGetMemoryAccessCountsEx((UInt32)firstByteIndex, (UInt32)(lastByteIndex - firstByteIndex + 1), _memoryType, MemoryOperationType.Exec);
InteropEmu.DebugGetState(ref _state); InteropEmu.DebugGetState(ref _state);
} }
public Color DarkerColor(Color input, double brightnessPercentage) public Color DarkerColor(Color input, double brightnessPercentage)
{ {
if(double.IsInfinity(brightnessPercentage)) {
brightnessPercentage = 1.0;
}
if(brightnessPercentage < 0.20) { if(brightnessPercentage < 0.20) {
brightnessPercentage *= 5; brightnessPercentage *= 5;
} else { } else {
@ -55,17 +74,30 @@ namespace Mesen.GUI.Debugger
double framesSinceWrite = (double)(_state.CPU.CycleCount - _writeStamps[index]) / CyclesPerFrame; double framesSinceWrite = (double)(_state.CPU.CycleCount - _writeStamps[index]) / CyclesPerFrame;
double framesSinceRead = (double)(_state.CPU.CycleCount - _readStamps[index]) / CyclesPerFrame; double framesSinceRead = (double)(_state.CPU.CycleCount - _readStamps[index]) / CyclesPerFrame;
if(_freezeState != null && _freezeState[index]) { bool isRead = _readCounts[index] > 0;
return Color.Magenta; bool isWritten = _writeCounts[index] > 0;
} else if(_showExec && _execStamps[index] != 0 && framesSinceExec < _framesToFade) { bool isExecuted = _execCounts[index] > 0;
return DarkerColor(Color.Green, (_framesToFade - framesSinceExec) / _framesToFade); bool isUnused = !isRead && !isWritten && !isExecuted;
} else if(_showWrite && _writeStamps[index] != 0 && framesSinceWrite < _framesToFade) {
return DarkerColor(Color.Red, (_framesToFade - framesSinceWrite) / _framesToFade); int alpha = 0;
} else if(_showRead && _readStamps[index] != 0 && framesSinceRead < _framesToFade) { if(isRead && _hideReadBytes || isWritten && _hideWrittenBytes || isExecuted && _hideExecutedBytes || isUnused && _hideUnusedBytes) {
return DarkerColor(Color.Blue, (_framesToFade - framesSinceRead) / _framesToFade); alpha = 128;
}
if(isRead && !_hideReadBytes || isWritten && !_hideWrittenBytes || isExecuted && !_hideExecutedBytes || isUnused && !_hideUnusedBytes) {
alpha = 255;
} }
return Color.Black; if(_freezeState != null && _freezeState[index]) {
return Color.Magenta;
} else if(_showExec && _execStamps[index] != 0 && (framesSinceExec < _framesToFade || _framesToFade == 0)) {
return Color.FromArgb(alpha, DarkerColor(Color.Green, (_framesToFade - framesSinceExec) / _framesToFade));
} else if(_showWrite && _writeStamps[index] != 0 && (framesSinceWrite < _framesToFade || _framesToFade == 0)) {
return Color.FromArgb(alpha, DarkerColor(Color.Red, (_framesToFade - framesSinceWrite) / _framesToFade));
} else if(_showRead && _readStamps[index] != 0 && (framesSinceRead < _framesToFade || _framesToFade == 0)) {
return Color.FromArgb(alpha, DarkerColor(Color.Blue, (_framesToFade - framesSinceRead) / _framesToFade));
}
return Color.FromArgb(alpha, Color.Black);
} }
} }
} }

View file

@ -3305,8 +3305,13 @@ namespace Be.Windows.Forms
} }
IByteProvider _byteProvider; IByteProvider _byteProvider;
IByteColorProvider _byteColorProvider;
public IByteColorProvider ByteColorProvider { get; set; } public IByteColorProvider ByteColorProvider
{
get { return _byteColorProvider; }
set { _byteColorProvider = value; Invalidate(); }
}
/// <summary> /// <summary>
/// Gets or sets the visibility of the group separator. /// Gets or sets the visibility of the group separator.

View file

@ -86,11 +86,6 @@
99999, 99999,
0, 0,
0, 0,
0});
this.nudFrameCount.Minimum = new decimal(new int[] {
1,
0,
0,
0}); 0});
this.nudFrameCount.Name = "nudFrameCount"; this.nudFrameCount.Name = "nudFrameCount";
this.nudFrameCount.Size = new System.Drawing.Size(79, 20); this.nudFrameCount.Size = new System.Drawing.Size(79, 20);

View file

@ -55,8 +55,14 @@
this.mnuFadeSlow = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFadeSlow = new System.Windows.Forms.ToolStripMenuItem();
this.mnuFadeNormal = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFadeNormal = new System.Windows.Forms.ToolStripMenuItem();
this.mnuFadeFast = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFadeFast = new System.Windows.Forms.ToolStripMenuItem();
this.mnuFadeNever = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator();
this.mnuCustomFadeSpeed = new System.Windows.Forms.ToolStripMenuItem(); this.mnuCustomFadeSpeed = new System.Windows.Forms.ToolStripMenuItem();
this.fadeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHideUnusedBytes = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHideReadBytes = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHideWrittenBytes = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHideExecutedBytes = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
this.mnuRefresh = new System.Windows.Forms.ToolStripMenuItem(); this.mnuRefresh = new System.Windows.Forms.ToolStripMenuItem();
this.fontSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fontSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -219,6 +225,7 @@
// //
this.mnuView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.highlightToolStripMenuItem, this.highlightToolStripMenuItem,
this.fadeToolStripMenuItem,
this.toolStripMenuItem5, this.toolStripMenuItem5,
this.mnuRefresh, this.mnuRefresh,
this.fontSizeToolStripMenuItem, this.fontSizeToolStripMenuItem,
@ -245,27 +252,30 @@
// //
this.mnuHightlightReads.CheckOnClick = true; this.mnuHightlightReads.CheckOnClick = true;
this.mnuHightlightReads.Name = "mnuHightlightReads"; this.mnuHightlightReads.Name = "mnuHightlightReads";
this.mnuHightlightReads.Size = new System.Drawing.Size(133, 22); this.mnuHightlightReads.Size = new System.Drawing.Size(152, 22);
this.mnuHightlightReads.Text = "Reads"; this.mnuHightlightReads.Text = "Reads";
this.mnuHightlightReads.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
// //
// mnuHighlightWrites // mnuHighlightWrites
// //
this.mnuHighlightWrites.CheckOnClick = true; this.mnuHighlightWrites.CheckOnClick = true;
this.mnuHighlightWrites.Name = "mnuHighlightWrites"; this.mnuHighlightWrites.Name = "mnuHighlightWrites";
this.mnuHighlightWrites.Size = new System.Drawing.Size(133, 22); this.mnuHighlightWrites.Size = new System.Drawing.Size(152, 22);
this.mnuHighlightWrites.Text = "Writes"; this.mnuHighlightWrites.Text = "Writes";
this.mnuHighlightWrites.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
// //
// mnuHighlightExecution // mnuHighlightExecution
// //
this.mnuHighlightExecution.CheckOnClick = true; this.mnuHighlightExecution.CheckOnClick = true;
this.mnuHighlightExecution.Name = "mnuHighlightExecution"; this.mnuHighlightExecution.Name = "mnuHighlightExecution";
this.mnuHighlightExecution.Size = new System.Drawing.Size(133, 22); this.mnuHighlightExecution.Size = new System.Drawing.Size(152, 22);
this.mnuHighlightExecution.Text = "Execution"; this.mnuHighlightExecution.Text = "Execution";
this.mnuHighlightExecution.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
// //
// toolStripMenuItem6 // toolStripMenuItem6
// //
this.toolStripMenuItem6.Name = "toolStripMenuItem6"; this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(130, 6); this.toolStripMenuItem6.Size = new System.Drawing.Size(149, 6);
// //
// fadeSpeedToolStripMenuItem // fadeSpeedToolStripMenuItem
// //
@ -273,16 +283,17 @@
this.mnuFadeSlow, this.mnuFadeSlow,
this.mnuFadeNormal, this.mnuFadeNormal,
this.mnuFadeFast, this.mnuFadeFast,
this.mnuFadeNever,
this.toolStripMenuItem7, this.toolStripMenuItem7,
this.mnuCustomFadeSpeed}); this.mnuCustomFadeSpeed});
this.fadeSpeedToolStripMenuItem.Name = "fadeSpeedToolStripMenuItem"; this.fadeSpeedToolStripMenuItem.Name = "fadeSpeedToolStripMenuItem";
this.fadeSpeedToolStripMenuItem.Size = new System.Drawing.Size(133, 22); this.fadeSpeedToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.fadeSpeedToolStripMenuItem.Text = "Fade speed"; this.fadeSpeedToolStripMenuItem.Text = "Fade speed";
// //
// mnuFadeSlow // mnuFadeSlow
// //
this.mnuFadeSlow.Name = "mnuFadeSlow"; this.mnuFadeSlow.Name = "mnuFadeSlow";
this.mnuFadeSlow.Size = new System.Drawing.Size(125, 22); this.mnuFadeSlow.Size = new System.Drawing.Size(152, 22);
this.mnuFadeSlow.Text = "Slow"; this.mnuFadeSlow.Text = "Slow";
this.mnuFadeSlow.Click += new System.EventHandler(this.mnuFadeSpeed_Click); this.mnuFadeSlow.Click += new System.EventHandler(this.mnuFadeSpeed_Click);
// //
@ -291,29 +302,79 @@
this.mnuFadeNormal.Checked = true; this.mnuFadeNormal.Checked = true;
this.mnuFadeNormal.CheckState = System.Windows.Forms.CheckState.Checked; this.mnuFadeNormal.CheckState = System.Windows.Forms.CheckState.Checked;
this.mnuFadeNormal.Name = "mnuFadeNormal"; this.mnuFadeNormal.Name = "mnuFadeNormal";
this.mnuFadeNormal.Size = new System.Drawing.Size(125, 22); this.mnuFadeNormal.Size = new System.Drawing.Size(152, 22);
this.mnuFadeNormal.Text = "Normal"; this.mnuFadeNormal.Text = "Normal";
this.mnuFadeNormal.Click += new System.EventHandler(this.mnuFadeSpeed_Click); this.mnuFadeNormal.Click += new System.EventHandler(this.mnuFadeSpeed_Click);
// //
// mnuFadeFast // mnuFadeFast
// //
this.mnuFadeFast.Name = "mnuFadeFast"; this.mnuFadeFast.Name = "mnuFadeFast";
this.mnuFadeFast.Size = new System.Drawing.Size(125, 22); this.mnuFadeFast.Size = new System.Drawing.Size(152, 22);
this.mnuFadeFast.Text = "Fast"; this.mnuFadeFast.Text = "Fast";
this.mnuFadeFast.Click += new System.EventHandler(this.mnuFadeSpeed_Click); this.mnuFadeFast.Click += new System.EventHandler(this.mnuFadeSpeed_Click);
// //
// mnuFadeNever
//
this.mnuFadeNever.Name = "mnuFadeNever";
this.mnuFadeNever.Size = new System.Drawing.Size(152, 22);
this.mnuFadeNever.Text = "Do not fade";
this.mnuFadeNever.Click += new System.EventHandler(this.mnuFadeSpeed_Click);
//
// toolStripMenuItem7 // toolStripMenuItem7
// //
this.toolStripMenuItem7.Name = "toolStripMenuItem7"; this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(122, 6); this.toolStripMenuItem7.Size = new System.Drawing.Size(149, 6);
// //
// mnuCustomFadeSpeed // mnuCustomFadeSpeed
// //
this.mnuCustomFadeSpeed.Name = "mnuCustomFadeSpeed"; this.mnuCustomFadeSpeed.Name = "mnuCustomFadeSpeed";
this.mnuCustomFadeSpeed.Size = new System.Drawing.Size(125, 22); this.mnuCustomFadeSpeed.Size = new System.Drawing.Size(152, 22);
this.mnuCustomFadeSpeed.Text = "Custom..."; this.mnuCustomFadeSpeed.Text = "Custom...";
this.mnuCustomFadeSpeed.Click += new System.EventHandler(this.mnuCustomFadeSpeed_Click); this.mnuCustomFadeSpeed.Click += new System.EventHandler(this.mnuCustomFadeSpeed_Click);
// //
// fadeToolStripMenuItem
//
this.fadeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuHideUnusedBytes,
this.mnuHideReadBytes,
this.mnuHideWrittenBytes,
this.mnuHideExecutedBytes});
this.fadeToolStripMenuItem.Name = "fadeToolStripMenuItem";
this.fadeToolStripMenuItem.Size = new System.Drawing.Size(160, 22);
this.fadeToolStripMenuItem.Text = "De-emphasize";
//
// mnuHideUnusedBytes
//
this.mnuHideUnusedBytes.CheckOnClick = true;
this.mnuHideUnusedBytes.Name = "mnuHideUnusedBytes";
this.mnuHideUnusedBytes.Size = new System.Drawing.Size(152, 22);
this.mnuHideUnusedBytes.Text = "Unused bytes";
this.mnuHideUnusedBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// mnuHideReadBytes
//
this.mnuHideReadBytes.CheckOnClick = true;
this.mnuHideReadBytes.Name = "mnuHideReadBytes";
this.mnuHideReadBytes.Size = new System.Drawing.Size(152, 22);
this.mnuHideReadBytes.Text = "Read bytes";
this.mnuHideReadBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// mnuHideWrittenBytes
//
this.mnuHideWrittenBytes.CheckOnClick = true;
this.mnuHideWrittenBytes.Name = "mnuHideWrittenBytes";
this.mnuHideWrittenBytes.Size = new System.Drawing.Size(152, 22);
this.mnuHideWrittenBytes.Text = "Written bytes";
this.mnuHideWrittenBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// mnuHideExecutedBytes
//
this.mnuHideExecutedBytes.CheckOnClick = true;
this.mnuHideExecutedBytes.Name = "mnuHideExecutedBytes";
this.mnuHideExecutedBytes.Size = new System.Drawing.Size(152, 22);
this.mnuHideExecutedBytes.Text = "Executed bytes";
this.mnuHideExecutedBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// toolStripMenuItem5 // toolStripMenuItem5
// //
this.toolStripMenuItem5.Name = "toolStripMenuItem5"; this.toolStripMenuItem5.Name = "toolStripMenuItem5";
@ -606,5 +667,11 @@
private System.Windows.Forms.ToolStripMenuItem mnuFadeFast; private System.Windows.Forms.ToolStripMenuItem mnuFadeFast;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem7; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem7;
private System.Windows.Forms.ToolStripMenuItem mnuCustomFadeSpeed; private System.Windows.Forms.ToolStripMenuItem mnuCustomFadeSpeed;
private System.Windows.Forms.ToolStripMenuItem fadeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuHideUnusedBytes;
private System.Windows.Forms.ToolStripMenuItem mnuHideReadBytes;
private System.Windows.Forms.ToolStripMenuItem mnuHideWrittenBytes;
private System.Windows.Forms.ToolStripMenuItem mnuHideExecutedBytes;
private System.Windows.Forms.ToolStripMenuItem mnuFadeNever;
} }
} }

View file

@ -36,10 +36,15 @@ namespace Mesen.GUI.Debugger
this.mnuAutoRefresh.Checked = ConfigManager.Config.DebugInfo.RamAutoRefresh; this.mnuAutoRefresh.Checked = ConfigManager.Config.DebugInfo.RamAutoRefresh;
this.mnuShowCharacters.Checked = ConfigManager.Config.DebugInfo.RamShowCharacters; this.mnuShowCharacters.Checked = ConfigManager.Config.DebugInfo.RamShowCharacters;
this.ctrlHexViewer.SetFontSize((int)ConfigManager.Config.DebugInfo.RamFontSize); this.ctrlHexViewer.SetFontSize((int)ConfigManager.Config.DebugInfo.RamFontSize);
this.mnuHighlightExecution.Checked = ConfigManager.Config.DebugInfo.RamHighlightExecution; this.mnuHighlightExecution.Checked = ConfigManager.Config.DebugInfo.RamHighlightExecution;
this.mnuHightlightReads.Checked = ConfigManager.Config.DebugInfo.RamHighlightReads; this.mnuHightlightReads.Checked = ConfigManager.Config.DebugInfo.RamHighlightReads;
this.mnuHighlightWrites.Checked = ConfigManager.Config.DebugInfo.RamHighlightWrites; this.mnuHighlightWrites.Checked = ConfigManager.Config.DebugInfo.RamHighlightWrites;
this.mnuHideUnusedBytes.Checked = ConfigManager.Config.DebugInfo.RamHideUnusedBytes;
this.mnuHideReadBytes.Checked = ConfigManager.Config.DebugInfo.RamHideReadBytes;
this.mnuHideWrittenBytes.Checked = ConfigManager.Config.DebugInfo.RamHideWrittenBytes;
this.mnuHideExecutedBytes.Checked = ConfigManager.Config.DebugInfo.RamHideExecutedBytes;
this.UpdateFadeOptions(); this.UpdateFadeOptions();
this.InitTblMappings(); this.InitTblMappings();
@ -90,7 +95,17 @@ namespace Mesen.GUI.Debugger
case DebugMemoryType.WorkRam: case DebugMemoryType.WorkRam:
case DebugMemoryType.SaveRam: case DebugMemoryType.SaveRam:
case DebugMemoryType.InternalRam: case DebugMemoryType.InternalRam:
this.ctrlHexViewer.ByteColorProvider = new ByteColorProvider((DebugMemoryType)this.cboMemoryType.SelectedIndex, mnuHighlightExecution.Checked, mnuHighlightWrites.Checked, mnuHightlightReads.Checked, ConfigManager.Config.DebugInfo.RamFadeSpeed); this.ctrlHexViewer.ByteColorProvider = new ByteColorProvider(
(DebugMemoryType)this.cboMemoryType.SelectedIndex,
mnuHighlightExecution.Checked,
mnuHighlightWrites.Checked,
mnuHightlightReads.Checked,
ConfigManager.Config.DebugInfo.RamFadeSpeed,
mnuHideUnusedBytes.Checked,
mnuHideReadBytes.Checked,
mnuHideWrittenBytes.Checked,
mnuHideExecutedBytes.Checked
);
break; break;
default: default:
@ -170,6 +185,16 @@ namespace Mesen.GUI.Debugger
ConfigManager.Config.DebugInfo.RamAutoRefresh = this.mnuAutoRefresh.Checked; ConfigManager.Config.DebugInfo.RamAutoRefresh = this.mnuAutoRefresh.Checked;
ConfigManager.Config.DebugInfo.RamShowCharacters = this.mnuShowCharacters.Checked; ConfigManager.Config.DebugInfo.RamShowCharacters = this.mnuShowCharacters.Checked;
ConfigManager.Config.DebugInfo.RamFontSize = this.ctrlHexViewer.HexFont.Size; ConfigManager.Config.DebugInfo.RamFontSize = this.ctrlHexViewer.HexFont.Size;
ConfigManager.Config.DebugInfo.RamHighlightExecution = this.mnuHighlightExecution.Checked;
ConfigManager.Config.DebugInfo.RamHighlightReads = this.mnuHightlightReads.Checked;
ConfigManager.Config.DebugInfo.RamHighlightWrites = this.mnuHighlightWrites.Checked;
ConfigManager.Config.DebugInfo.RamHideUnusedBytes = this.mnuHideUnusedBytes.Checked;
ConfigManager.Config.DebugInfo.RamHideReadBytes = this.mnuHideReadBytes.Checked;
ConfigManager.Config.DebugInfo.RamHideWrittenBytes = this.mnuHideWrittenBytes.Checked;
ConfigManager.Config.DebugInfo.RamHideExecutedBytes = this.mnuHideExecutedBytes.Checked;
ConfigManager.Config.DebugInfo.RamHideExecutedBytes = this.mnuHideExecutedBytes.Checked;
ConfigManager.ApplyChanges(); ConfigManager.ApplyChanges();
} }
@ -280,7 +305,8 @@ namespace Mesen.GUI.Debugger
mnuFadeSlow.Checked = fadeSpeed == 600; mnuFadeSlow.Checked = fadeSpeed == 600;
mnuFadeNormal.Checked = fadeSpeed == 300; mnuFadeNormal.Checked = fadeSpeed == 300;
mnuFadeFast.Checked = fadeSpeed == 120; mnuFadeFast.Checked = fadeSpeed == 120;
mnuCustomFadeSpeed.Checked = !mnuFadeSlow.Checked && !mnuFadeNormal.Checked && !mnuFadeFast.Checked; mnuFadeNever.Checked = fadeSpeed == 0;
mnuCustomFadeSpeed.Checked = !mnuFadeSlow.Checked && !mnuFadeNormal.Checked && !mnuFadeFast.Checked && !mnuFadeSlow.Checked;
} }
private void mnuFadeSpeed_Click(object sender, EventArgs e) private void mnuFadeSpeed_Click(object sender, EventArgs e)
@ -291,6 +317,8 @@ namespace Mesen.GUI.Debugger
ConfigManager.Config.DebugInfo.RamFadeSpeed = 300; ConfigManager.Config.DebugInfo.RamFadeSpeed = 300;
} else if(sender == mnuFadeFast) { } else if(sender == mnuFadeFast) {
ConfigManager.Config.DebugInfo.RamFadeSpeed = 120; ConfigManager.Config.DebugInfo.RamFadeSpeed = 120;
} else if(sender == mnuFadeNever) {
ConfigManager.Config.DebugInfo.RamFadeSpeed = 0;
} }
ConfigManager.ApplyChanges(); ConfigManager.ApplyChanges();
UpdateFadeOptions(); UpdateFadeOptions();
@ -420,5 +448,11 @@ namespace Mesen.GUI.Debugger
hexBox.ContextMenuStrip.Items.Insert(0, mnuEditBreakpoint); hexBox.ContextMenuStrip.Items.Insert(0, mnuEditBreakpoint);
hexBox.ContextMenuStrip.Items.Insert(0, mnuAddWatch); hexBox.ContextMenuStrip.Items.Insert(0, mnuAddWatch);
} }
private void mnuColorProviderOptions_Click(object sender, EventArgs e)
{
this.UpdateConfig();
this.UpdateByteColorProvider();
}
} }
} }

View file

@ -371,6 +371,21 @@ namespace Mesen.GUI
return stamps; return stamps;
} }
[DllImport(DLLPath, EntryPoint= "DebugGetMemoryAccessCountsEx")] private static extern void DebugGetMemoryAccessCountsExWrapper(UInt32 offset, UInt32 length, DebugMemoryType type, MemoryOperationType operationType, IntPtr counts);
public static Int32[] DebugGetMemoryAccessCountsEx(UInt32 offset, UInt32 length, DebugMemoryType type, MemoryOperationType operationType)
{
Int32[] counts = new Int32[length];
GCHandle hResult = GCHandle.Alloc(counts, GCHandleType.Pinned);
try {
InteropEmu.DebugGetMemoryAccessCountsExWrapper(offset, length, type, operationType, hResult.AddrOfPinnedObject());
} finally {
hResult.Free();
}
return counts;
}
[DllImport(DLLPath, EntryPoint= "DebugGetFreezeState")] private static extern void DebugGetFreezeStateWrapper(UInt16 startAddress, UInt16 length, IntPtr freezeState); [DllImport(DLLPath, EntryPoint= "DebugGetFreezeState")] private static extern void DebugGetFreezeStateWrapper(UInt16 startAddress, UInt16 length, IntPtr freezeState);
public static bool[] DebugGetFreezeState(UInt16 startAddress, UInt16 length) public static bool[] DebugGetFreezeState(UInt16 startAddress, UInt16 length)
{ {

View file

@ -84,6 +84,7 @@ extern "C"
DllExport void __stdcall DebugGetMemoryAccessCounts(AddressType memoryType, MemoryOperationType operationType, uint32_t* counts, bool forUninitReads) { GetDebugger()->GetMemoryAccessCounter()->GetAccessCounts(memoryType, operationType, counts, forUninitReads); } DllExport void __stdcall DebugGetMemoryAccessCounts(AddressType memoryType, MemoryOperationType operationType, uint32_t* counts, bool forUninitReads) { GetDebugger()->GetMemoryAccessCounter()->GetAccessCounts(memoryType, operationType, counts, forUninitReads); }
DllExport void __stdcall DebugResetMemoryAccessCounts() { GetDebugger()->GetMemoryAccessCounter()->ResetCounts(); } DllExport void __stdcall DebugResetMemoryAccessCounts() { GetDebugger()->GetMemoryAccessCounter()->ResetCounts(); }
DllExport void __stdcall DebugGetMemoryAccessStamps(uint32_t offset, uint32_t length, DebugMemoryType memoryType, MemoryOperationType operationType, uint32_t* stamps) { GetDebugger()->GetMemoryAccessCounter()->GetAccessStamps(offset, length, memoryType, operationType, stamps); } DllExport void __stdcall DebugGetMemoryAccessStamps(uint32_t offset, uint32_t length, DebugMemoryType memoryType, MemoryOperationType operationType, uint32_t* stamps) { GetDebugger()->GetMemoryAccessCounter()->GetAccessStamps(offset, length, memoryType, operationType, stamps); }
DllExport void __stdcall DebugGetMemoryAccessCountsEx(uint32_t offset, uint32_t length, DebugMemoryType memoryType, MemoryOperationType operationType, int32_t* counts) { GetDebugger()->GetMemoryAccessCounter()->GetAccessCountsEx(offset, length, memoryType, operationType, counts); }
DllExport void __stdcall DebugGetProfilerData(int64_t* profilerData, ProfilerDataType dataType) { GetDebugger()->GetProfiler()->GetProfilerData(profilerData, dataType); } DllExport void __stdcall DebugGetProfilerData(int64_t* profilerData, ProfilerDataType dataType) { GetDebugger()->GetProfiler()->GetProfilerData(profilerData, dataType); }
DllExport void __stdcall DebugResetProfiler() { GetDebugger()->GetProfiler()->Reset(); } DllExport void __stdcall DebugResetProfiler() { GetDebugger()->GetProfiler()->Reset(); }