Debugger: Fixed workspace issues (caused by earlier commit)
-Don't go into "debug mode" if no debug window is opened -Don't lose recent changes when doing power cycle
This commit is contained in:
parent
71cb982058
commit
8f4f67baee
2 changed files with 15 additions and 13 deletions
|
@ -50,10 +50,15 @@ namespace Mesen.GUI.Debugger
|
|||
}
|
||||
}
|
||||
|
||||
public static void SetupWorkspace()
|
||||
public static void SetupWorkspace(bool saveCurrentWorkspace = true)
|
||||
{
|
||||
string romName = InteropEmu.GetRomInfo().GetRomName();
|
||||
lock(_lock) {
|
||||
if(_workspace != null) {
|
||||
if(_workspace != null && _romName == romName) {
|
||||
if(saveCurrentWorkspace) {
|
||||
SaveWorkspace();
|
||||
}
|
||||
|
||||
//Setup labels
|
||||
if(_workspace.Labels.Count == 0) {
|
||||
LabelManager.ResetLabels();
|
||||
|
@ -70,22 +75,24 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
//Load breakpoints
|
||||
BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
|
||||
} else {
|
||||
Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static DebugWorkspace GetWorkspace(bool forceReload = false)
|
||||
public static DebugWorkspace GetWorkspace()
|
||||
{
|
||||
string romName = InteropEmu.GetRomInfo().GetRomName();
|
||||
if(_workspace == null || _romName != romName || forceReload) {
|
||||
if(_workspace == null || _romName != romName) {
|
||||
lock(_lock) {
|
||||
if(_workspace == null || _romName != romName || forceReload) {
|
||||
if(_workspace == null || _romName != romName) {
|
||||
if(_workspace != null) {
|
||||
SaveWorkspace();
|
||||
}
|
||||
_romName = InteropEmu.GetRomInfo().GetRomName();
|
||||
_workspace = DebugWorkspace.GetWorkspace();
|
||||
SetupWorkspace();
|
||||
SetupWorkspace(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -514,13 +514,8 @@ namespace Mesen.GUI.Forms
|
|||
}));
|
||||
|
||||
Task.Run(() => {
|
||||
if(ConfigManager.Config.PreferenceInfo.DeveloperMode) {
|
||||
//Preload workspace in the background to be able to open debugging tools faster
|
||||
DebugWorkspaceManager.GetWorkspace(true);
|
||||
} else {
|
||||
//If a workspace is already loaded, make sure we setup the labels, watch, etc properly
|
||||
DebugWorkspaceManager.SetupWorkspace();
|
||||
}
|
||||
//If a workspace is already loaded for this game, make sure we setup the labels, watch, etc properly
|
||||
DebugWorkspaceManager.SetupWorkspace();
|
||||
});
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue