Debugger: Rework label/breakpoint updates when resetting/loading a rom

This commit is contained in:
Sour 2020-05-06 18:43:27 -04:00
parent 63d0017d68
commit e963310112
10 changed files with 17 additions and 26 deletions

View file

@ -45,6 +45,12 @@ namespace Mesen.GUI.Debugger
case DebugWindow.Profiler: frm = new frmProfiler(); frm.Icon = Properties.Resources.Speed; break;
case DebugWindow.WatchWindow: frm = new frmWatchWindow(); frm.Icon = Properties.Resources.Find; break;
}
if(_openedWindows.Count == 0) {
DebugWorkspaceManager.GetWorkspace();
DebugWorkspaceManager.AutoLoadDbgFiles(true);
}
_openedWindows.Add(frm);
frm.FormClosed += Debugger_FormClosed;
frm.Show();

View file

@ -87,22 +87,18 @@ namespace Mesen.GUI.Debugger
//Load watch entries
WatchManager.WatchEntries = _workspace.WatchValues;
//Load breakpoints
BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
//Setup labels
if(_workspace.Labels.Count == 0) {
LabelManager.ResetLabels();
if(!ConfigManager.Config.DebugInfo.DisableDefaultLabels) {
LabelManager.SetDefaultLabels(InteropEmu.GetRomInfo().MapperId);
}
} else {
LabelManager.ResetLabels();
LabelManager.SetLabels(_workspace.Labels, true);
if(_workspace.Labels.Count == 0 && !ConfigManager.Config.DebugInfo.DisableDefaultLabels) {
LabelManager.SetDefaultLabels(InteropEmu.GetRomInfo().MapperId);
}
}
}
}
//Send breakpoints & labels to emulation core (even if the same game is running)
BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
LabelManager.RefreshLabels();
return _workspace;
}

View file

@ -71,7 +71,6 @@ namespace Mesen.GUI.Debugger
this.UpdateWorkspace();
this.AutoLoadCdlFiles();
DebugWorkspaceManager.AutoLoadDbgFiles(true);
if(!Program.IsMono) {
this.mnuSplitView.Checked = ConfigManager.Config.DebugInfo.SplitView;

View file

@ -89,8 +89,6 @@ namespace Mesen.GUI.Debugger
_binder.AddBinding(nameof(DebugInfo.EventViewerShowPreviousFrameEvents), chkShowPreviousFrameEvents);
_binder.AddBinding(nameof(DebugInfo.EventViewerShowNtscBorders), chkShowNtscBorders);
DebugWorkspaceManager.GetWorkspace();
RestoreLocation(_config.EventViewerLocation, _config.EventViewerSize);
mnuAutoRefresh.Checked = _config.EventViewerAutoRefresh;

View file

@ -35,8 +35,6 @@ namespace Mesen.GUI.Debugger
{
base.OnLoad(e);
DebugWorkspaceManager.AutoLoadDbgFiles(true);
this._selectedTab = this.tabMain.SelectedTab;
DebugInfo config = ConfigManager.Config.DebugInfo;

View file

@ -19,8 +19,6 @@ namespace Mesen.GUI.Debugger
InitializeComponent();
if(!DesignMode) {
DebugWorkspaceManager.AutoLoadDbgFiles(true);
ctrlProfiler.RefreshData();
ctrlProfiler.RefreshList();
tmrRefresh.Start();

View file

@ -50,9 +50,6 @@ namespace Mesen.GUI.Debugger
mnuBuiltInScripts
);
//Make sure labels are loaded
DebugWorkspaceManager.GetWorkspace();
DebugInfo config = ConfigManager.Config.DebugInfo;
_popupMenu = new AutocompleteMenu(txtScriptContent, this);

View file

@ -262,9 +262,6 @@ namespace Mesen.GUI.Debugger
return;
}
//Make sure labels are up to date
DebugWorkspaceManager.GetWorkspace();
_refreshRunning = true;
SetOptions();
Task.Run(() => {

View file

@ -31,8 +31,6 @@ namespace Mesen.GUI.Debugger
base.OnLoad(e);
if(!DesignMode) {
DebugWorkspaceManager.GetWorkspace();
DebugWorkspaceManager.AutoLoadDbgFiles(true);
_notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
_notifListener.OnNotification += _notifListener_OnNotification;
ctrlWatch.UpdateWatch(true);

View file

@ -691,6 +691,10 @@ namespace Mesen.GUI.Forms
this.StartEmuThread();
this.BeginInvoke((MethodInvoker)(() => {
if(DebugWindowManager.HasOpenedWindow) {
DebugWorkspaceManager.GetWorkspace();
DebugWorkspaceManager.AutoLoadDbgFiles(true);
}
ctrlRecentGames.Visible = false;
UpdateViewerSize();
ProcessPostLoadCommandSwitches();