mirror of
https://github.com/libretro/Mesen.git
synced 2025-01-07 09:20:57 +00:00
Debugger: Added option to automatically load DBG files when they are next to the rom file (same name, dbg extension)
This commit is contained in:
parent
a86eaa0911
commit
da3cfdeeec
@ -101,6 +101,8 @@ namespace Mesen.GUI.Config
|
|||||||
public bool FindOccurrencesMatchWholeWord = false;
|
public bool FindOccurrencesMatchWholeWord = false;
|
||||||
public string FindOccurrencesLastSearch = string.Empty;
|
public string FindOccurrencesLastSearch = string.Empty;
|
||||||
|
|
||||||
|
public bool AutoLoadDbgFiles = false;
|
||||||
|
|
||||||
public DebugInfo()
|
public DebugInfo()
|
||||||
{
|
{
|
||||||
LeftView = new DebugViewInfo();
|
LeftView = new DebugViewInfo();
|
||||||
|
@ -236,7 +236,7 @@ namespace Mesen.GUI.Debugger
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Import(string path)
|
public void Import(string path, bool silent = false)
|
||||||
{
|
{
|
||||||
string[] fileRows = File.ReadAllLines(path);
|
string[] fileRows = File.ReadAllLines(path);
|
||||||
|
|
||||||
@ -257,6 +257,7 @@ namespace Mesen.GUI.Debugger
|
|||||||
LabelManager.SetLabels(_romLabels.Values);
|
LabelManager.SetLabels(_romLabels.Values);
|
||||||
LabelManager.SetLabels(_ramLabels.Values);
|
LabelManager.SetLabels(_ramLabels.Values);
|
||||||
|
|
||||||
|
if(!silent) {
|
||||||
int labelCount = _romLabels.Count + _ramLabels.Count;
|
int labelCount = _romLabels.Count + _ramLabels.Count;
|
||||||
if(_errorCount > 0) {
|
if(_errorCount > 0) {
|
||||||
_errorCount -= _filesNotFound.Count;
|
_errorCount -= _filesNotFound.Count;
|
||||||
@ -275,6 +276,7 @@ namespace Mesen.GUI.Debugger
|
|||||||
MessageBox.Show($"Import completed with {labelCount} labels imported.", "Mesen", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show($"Import completed with {labelCount} labels imported.", "Mesen", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class SegmentInfo
|
private class SegmentInfo
|
||||||
{
|
{
|
||||||
|
37
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
37
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
@ -59,7 +59,6 @@
|
|||||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mnuWorkspace = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuWorkspace = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mnuImportLabels = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuImportLabels = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mnuSaveWorkspace = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.mnuResetWorkspace = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuResetWorkspace = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.mnuClose = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuClose = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@ -125,6 +124,8 @@
|
|||||||
this.lblChrAnalysisResult = new System.Windows.Forms.ToolStripStatusLabel();
|
this.lblChrAnalysisResult = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
|
this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
|
||||||
this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
|
this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
|
||||||
|
this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.mnuAutoLoadDbgFiles = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.contextMenuCode.SuspendLayout();
|
this.contextMenuCode.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||||
this.splitContainer.Panel1.SuspendLayout();
|
this.splitContainer.Panel1.SuspendLayout();
|
||||||
@ -423,8 +424,9 @@
|
|||||||
//
|
//
|
||||||
this.mnuWorkspace.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.mnuWorkspace.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.mnuImportLabels,
|
this.mnuImportLabels,
|
||||||
this.mnuSaveWorkspace,
|
this.mnuResetWorkspace,
|
||||||
this.mnuResetWorkspace});
|
this.toolStripMenuItem10,
|
||||||
|
this.mnuAutoLoadDbgFiles});
|
||||||
this.mnuWorkspace.Name = "mnuWorkspace";
|
this.mnuWorkspace.Name = "mnuWorkspace";
|
||||||
this.mnuWorkspace.Size = new System.Drawing.Size(152, 22);
|
this.mnuWorkspace.Size = new System.Drawing.Size(152, 22);
|
||||||
this.mnuWorkspace.Text = "Workspace";
|
this.mnuWorkspace.Text = "Workspace";
|
||||||
@ -433,24 +435,15 @@
|
|||||||
//
|
//
|
||||||
this.mnuImportLabels.Image = global::Mesen.GUI.Properties.Resources.Import;
|
this.mnuImportLabels.Image = global::Mesen.GUI.Properties.Resources.Import;
|
||||||
this.mnuImportLabels.Name = "mnuImportLabels";
|
this.mnuImportLabels.Name = "mnuImportLabels";
|
||||||
this.mnuImportLabels.Size = new System.Drawing.Size(152, 22);
|
this.mnuImportLabels.Size = new System.Drawing.Size(178, 22);
|
||||||
this.mnuImportLabels.Text = "Import Labels";
|
this.mnuImportLabels.Text = "Import Labels";
|
||||||
this.mnuImportLabels.Click += new System.EventHandler(this.mnuImportLabels_Click);
|
this.mnuImportLabels.Click += new System.EventHandler(this.mnuImportLabels_Click);
|
||||||
//
|
//
|
||||||
// mnuSaveWorkspace
|
|
||||||
//
|
|
||||||
this.mnuSaveWorkspace.Image = global::Mesen.GUI.Properties.Resources.Floppy;
|
|
||||||
this.mnuSaveWorkspace.Name = "mnuSaveWorkspace";
|
|
||||||
this.mnuSaveWorkspace.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
|
|
||||||
this.mnuSaveWorkspace.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.mnuSaveWorkspace.Text = "Save";
|
|
||||||
this.mnuSaveWorkspace.Click += new System.EventHandler(this.mnuSaveWorkspace_Click);
|
|
||||||
//
|
|
||||||
// mnuResetWorkspace
|
// mnuResetWorkspace
|
||||||
//
|
//
|
||||||
this.mnuResetWorkspace.Image = global::Mesen.GUI.Properties.Resources.Reset;
|
this.mnuResetWorkspace.Image = global::Mesen.GUI.Properties.Resources.Reset;
|
||||||
this.mnuResetWorkspace.Name = "mnuResetWorkspace";
|
this.mnuResetWorkspace.Name = "mnuResetWorkspace";
|
||||||
this.mnuResetWorkspace.Size = new System.Drawing.Size(152, 22);
|
this.mnuResetWorkspace.Size = new System.Drawing.Size(178, 22);
|
||||||
this.mnuResetWorkspace.Text = "Reset";
|
this.mnuResetWorkspace.Text = "Reset";
|
||||||
this.mnuResetWorkspace.Click += new System.EventHandler(this.mnuResetWorkspace_Click);
|
this.mnuResetWorkspace.Click += new System.EventHandler(this.mnuResetWorkspace_Click);
|
||||||
//
|
//
|
||||||
@ -982,6 +975,19 @@
|
|||||||
this.ctrlCpuMemoryMapping.Text = "ctrlMemoryMapping1";
|
this.ctrlCpuMemoryMapping.Text = "ctrlMemoryMapping1";
|
||||||
this.ctrlCpuMemoryMapping.Visible = false;
|
this.ctrlCpuMemoryMapping.Visible = false;
|
||||||
//
|
//
|
||||||
|
// toolStripMenuItem10
|
||||||
|
//
|
||||||
|
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
|
||||||
|
this.toolStripMenuItem10.Size = new System.Drawing.Size(175, 6);
|
||||||
|
//
|
||||||
|
// mnuAutoLoadDbgFiles
|
||||||
|
//
|
||||||
|
this.mnuAutoLoadDbgFiles.CheckOnClick = true;
|
||||||
|
this.mnuAutoLoadDbgFiles.Name = "mnuAutoLoadDbgFiles";
|
||||||
|
this.mnuAutoLoadDbgFiles.Size = new System.Drawing.Size(178, 22);
|
||||||
|
this.mnuAutoLoadDbgFiles.Text = "Auto-load DBG files";
|
||||||
|
this.mnuAutoLoadDbgFiles.CheckedChanged += new System.EventHandler(this.mnuAutoLoadDbgFiles_CheckedChanged);
|
||||||
|
//
|
||||||
// frmDebugger
|
// frmDebugger
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@ -1106,7 +1112,6 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem mnuShowOnlyDisassembledCode;
|
private System.Windows.Forms.ToolStripMenuItem mnuShowOnlyDisassembledCode;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuShowFunctionLabelLists;
|
private System.Windows.Forms.ToolStripMenuItem mnuShowFunctionLabelLists;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuWorkspace;
|
private System.Windows.Forms.ToolStripMenuItem mnuWorkspace;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuSaveWorkspace;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuResetWorkspace;
|
private System.Windows.Forms.ToolStripMenuItem mnuResetWorkspace;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuImportLabels;
|
private System.Windows.Forms.ToolStripMenuItem mnuImportLabels;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuHighlightUnexecutedCode;
|
private System.Windows.Forms.ToolStripMenuItem mnuHighlightUnexecutedCode;
|
||||||
@ -1115,5 +1120,7 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem mnuBreakIn;
|
private System.Windows.Forms.ToolStripMenuItem mnuBreakIn;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem9;
|
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem9;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuFindAllOccurrences;
|
private System.Windows.Forms.ToolStripMenuItem mnuFindAllOccurrences;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem10;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem mnuAutoLoadDbgFiles;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,6 +38,7 @@ namespace Mesen.GUI.Debugger
|
|||||||
BreakpointManager.BreakpointsChanged += BreakpointManager_BreakpointsChanged;
|
BreakpointManager.BreakpointsChanged += BreakpointManager_BreakpointsChanged;
|
||||||
|
|
||||||
this.UpdateWorkspace();
|
this.UpdateWorkspace();
|
||||||
|
this.AutoLoadDbgFile(true);
|
||||||
|
|
||||||
this.mnuSplitView.Checked = ConfigManager.Config.DebugInfo.SplitView;
|
this.mnuSplitView.Checked = ConfigManager.Config.DebugInfo.SplitView;
|
||||||
this.mnuPpuPartialDraw.Checked = ConfigManager.Config.DebugInfo.PpuPartialDraw;
|
this.mnuPpuPartialDraw.Checked = ConfigManager.Config.DebugInfo.PpuPartialDraw;
|
||||||
@ -47,6 +48,7 @@ namespace Mesen.GUI.Debugger
|
|||||||
this.mnuShowOnlyDisassembledCode.Checked = ConfigManager.Config.DebugInfo.ShowOnlyDisassembledCode;
|
this.mnuShowOnlyDisassembledCode.Checked = ConfigManager.Config.DebugInfo.ShowOnlyDisassembledCode;
|
||||||
this.mnuShowFunctionLabelLists.Checked = ConfigManager.Config.DebugInfo.ShowFunctionLabelLists;
|
this.mnuShowFunctionLabelLists.Checked = ConfigManager.Config.DebugInfo.ShowFunctionLabelLists;
|
||||||
this.mnuHighlightUnexecutedCode.Checked = ConfigManager.Config.DebugInfo.HighlightUnexecutedCode;
|
this.mnuHighlightUnexecutedCode.Checked = ConfigManager.Config.DebugInfo.HighlightUnexecutedCode;
|
||||||
|
this.mnuAutoLoadDbgFiles.Checked = ConfigManager.Config.DebugInfo.AutoLoadDbgFiles;
|
||||||
|
|
||||||
this.Width = ConfigManager.Config.DebugInfo.WindowWidth;
|
this.Width = ConfigManager.Config.DebugInfo.WindowWidth;
|
||||||
this.Height = ConfigManager.Config.DebugInfo.WindowHeight;
|
this.Height = ConfigManager.Config.DebugInfo.WindowHeight;
|
||||||
@ -91,6 +93,17 @@ namespace Mesen.GUI.Debugger
|
|||||||
tmrCdlRatios.Start();
|
tmrCdlRatios.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AutoLoadDbgFile(bool silent)
|
||||||
|
{
|
||||||
|
if(ConfigManager.Config.DebugInfo.AutoLoadDbgFiles) {
|
||||||
|
string dbgPath = Path.Combine(Path.GetDirectoryName(ConfigManager.Config.RecentFiles[0].Path), Path.GetFileNameWithoutExtension(ConfigManager.Config.RecentFiles[0].RomName) + ".dbg");
|
||||||
|
if(File.Exists(dbgPath)) {
|
||||||
|
Ld65DbgImporter dbgImporter = new Ld65DbgImporter();
|
||||||
|
dbgImporter.Import(dbgPath, silent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SaveWorkspace()
|
private void SaveWorkspace()
|
||||||
{
|
{
|
||||||
if(_workspace != null) {
|
if(_workspace != null) {
|
||||||
@ -164,6 +177,7 @@ namespace Mesen.GUI.Debugger
|
|||||||
case InteropEmu.ConsoleNotificationType.GameLoaded:
|
case InteropEmu.ConsoleNotificationType.GameLoaded:
|
||||||
this.BeginInvoke((MethodInvoker)(() => {
|
this.BeginInvoke((MethodInvoker)(() => {
|
||||||
this.UpdateWorkspace();
|
this.UpdateWorkspace();
|
||||||
|
this.AutoLoadDbgFile(true);
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
BreakpointManager.SetBreakpoints();
|
BreakpointManager.SetBreakpoints();
|
||||||
}));
|
}));
|
||||||
@ -600,11 +614,6 @@ namespace Mesen.GUI.Debugger
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mnuSaveWorkspace_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
SaveWorkspace();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void mnuImportLabels_Click(object sender, EventArgs e)
|
private void mnuImportLabels_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
OpenFileDialog ofd = new OpenFileDialog();
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
@ -640,5 +649,15 @@ namespace Mesen.GUI.Debugger
|
|||||||
_lastCodeWindow.FindAllOccurrences(frm.SearchString, frm.MatchWholeWord, frm.MatchCase);
|
_lastCodeWindow.FindAllOccurrences(frm.SearchString, frm.MatchWholeWord, frm.MatchCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mnuAutoLoadDbgFiles_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(_debuggerInitialized) {
|
||||||
|
ConfigManager.Config.DebugInfo.AutoLoadDbgFiles = mnuAutoLoadDbgFiles.Checked;
|
||||||
|
ConfigManager.ApplyChanges();
|
||||||
|
|
||||||
|
AutoLoadDbgFile(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user