mirror of
https://github.com/libretro/Mesen.git
synced 2024-12-16 05:48:05 +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 string FindOccurrencesLastSearch = string.Empty;
|
||||
|
||||
public bool AutoLoadDbgFiles = false;
|
||||
|
||||
public DebugInfo()
|
||||
{
|
||||
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);
|
||||
|
||||
@ -257,22 +257,24 @@ namespace Mesen.GUI.Debugger
|
||||
LabelManager.SetLabels(_romLabels.Values);
|
||||
LabelManager.SetLabels(_ramLabels.Values);
|
||||
|
||||
int labelCount = _romLabels.Count + _ramLabels.Count;
|
||||
if(_errorCount > 0) {
|
||||
_errorCount -= _filesNotFound.Count;
|
||||
string message = $"Import completed with {labelCount} labels imported";
|
||||
if(!silent) {
|
||||
int labelCount = _romLabels.Count + _ramLabels.Count;
|
||||
if(_errorCount > 0) {
|
||||
message += $"and {_errorCount} errors - please file a bug report and attach the DBG file you tried to import.";
|
||||
}
|
||||
if(_filesNotFound.Count > 0) {
|
||||
message += Environment.NewLine + Environment.NewLine + "The following files could not be found:";
|
||||
foreach(string file in _filesNotFound) {
|
||||
message += Environment.NewLine + file;
|
||||
_errorCount -= _filesNotFound.Count;
|
||||
string message = $"Import completed with {labelCount} labels imported";
|
||||
if(_errorCount > 0) {
|
||||
message += $"and {_errorCount} errors - please file a bug report and attach the DBG file you tried to import.";
|
||||
}
|
||||
if(_filesNotFound.Count > 0) {
|
||||
message += Environment.NewLine + Environment.NewLine + "The following files could not be found:";
|
||||
foreach(string file in _filesNotFound) {
|
||||
message += Environment.NewLine + file;
|
||||
}
|
||||
}
|
||||
MessageBox.Show(message, "Mesen", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
} else {
|
||||
MessageBox.Show($"Import completed with {labelCount} labels imported.", "Mesen", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
MessageBox.Show(message, "Mesen", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
} else {
|
||||
MessageBox.Show($"Import completed with {labelCount} labels imported.", "Mesen", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
|
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.mnuWorkspace = 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.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuClose = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -125,6 +124,8 @@
|
||||
this.lblChrAnalysisResult = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.ctrlPpuMemoryMapping = 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();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
@ -423,8 +424,9 @@
|
||||
//
|
||||
this.mnuWorkspace.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mnuImportLabels,
|
||||
this.mnuSaveWorkspace,
|
||||
this.mnuResetWorkspace});
|
||||
this.mnuResetWorkspace,
|
||||
this.toolStripMenuItem10,
|
||||
this.mnuAutoLoadDbgFiles});
|
||||
this.mnuWorkspace.Name = "mnuWorkspace";
|
||||
this.mnuWorkspace.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuWorkspace.Text = "Workspace";
|
||||
@ -433,24 +435,15 @@
|
||||
//
|
||||
this.mnuImportLabels.Image = global::Mesen.GUI.Properties.Resources.Import;
|
||||
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.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
|
||||
//
|
||||
this.mnuResetWorkspace.Image = global::Mesen.GUI.Properties.Resources.Reset;
|
||||
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.Click += new System.EventHandler(this.mnuResetWorkspace_Click);
|
||||
//
|
||||
@ -982,6 +975,19 @@
|
||||
this.ctrlCpuMemoryMapping.Text = "ctrlMemoryMapping1";
|
||||
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
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -1106,7 +1112,6 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuShowOnlyDisassembledCode;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuShowFunctionLabelLists;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuWorkspace;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuSaveWorkspace;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuResetWorkspace;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuImportLabels;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuHighlightUnexecutedCode;
|
||||
@ -1115,5 +1120,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuBreakIn;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem9;
|
||||
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;
|
||||
|
||||
this.UpdateWorkspace();
|
||||
this.AutoLoadDbgFile(true);
|
||||
|
||||
this.mnuSplitView.Checked = ConfigManager.Config.DebugInfo.SplitView;
|
||||
this.mnuPpuPartialDraw.Checked = ConfigManager.Config.DebugInfo.PpuPartialDraw;
|
||||
@ -47,6 +48,7 @@ namespace Mesen.GUI.Debugger
|
||||
this.mnuShowOnlyDisassembledCode.Checked = ConfigManager.Config.DebugInfo.ShowOnlyDisassembledCode;
|
||||
this.mnuShowFunctionLabelLists.Checked = ConfigManager.Config.DebugInfo.ShowFunctionLabelLists;
|
||||
this.mnuHighlightUnexecutedCode.Checked = ConfigManager.Config.DebugInfo.HighlightUnexecutedCode;
|
||||
this.mnuAutoLoadDbgFiles.Checked = ConfigManager.Config.DebugInfo.AutoLoadDbgFiles;
|
||||
|
||||
this.Width = ConfigManager.Config.DebugInfo.WindowWidth;
|
||||
this.Height = ConfigManager.Config.DebugInfo.WindowHeight;
|
||||
@ -91,6 +93,17 @@ namespace Mesen.GUI.Debugger
|
||||
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()
|
||||
{
|
||||
if(_workspace != null) {
|
||||
@ -164,6 +177,7 @@ namespace Mesen.GUI.Debugger
|
||||
case InteropEmu.ConsoleNotificationType.GameLoaded:
|
||||
this.BeginInvoke((MethodInvoker)(() => {
|
||||
this.UpdateWorkspace();
|
||||
this.AutoLoadDbgFile(true);
|
||||
UpdateDebugger();
|
||||
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)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
@ -640,5 +649,15 @@ namespace Mesen.GUI.Debugger
|
||||
_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