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) {
|
lock(_lock) {
|
||||||
if(_workspace != null) {
|
if(_workspace != null && _romName == romName) {
|
||||||
|
if(saveCurrentWorkspace) {
|
||||||
|
SaveWorkspace();
|
||||||
|
}
|
||||||
|
|
||||||
//Setup labels
|
//Setup labels
|
||||||
if(_workspace.Labels.Count == 0) {
|
if(_workspace.Labels.Count == 0) {
|
||||||
LabelManager.ResetLabels();
|
LabelManager.ResetLabels();
|
||||||
|
@ -70,22 +75,24 @@ namespace Mesen.GUI.Debugger
|
||||||
|
|
||||||
//Load breakpoints
|
//Load breakpoints
|
||||||
BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
|
BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
|
||||||
|
} else {
|
||||||
|
Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DebugWorkspace GetWorkspace(bool forceReload = false)
|
public static DebugWorkspace GetWorkspace()
|
||||||
{
|
{
|
||||||
string romName = InteropEmu.GetRomInfo().GetRomName();
|
string romName = InteropEmu.GetRomInfo().GetRomName();
|
||||||
if(_workspace == null || _romName != romName || forceReload) {
|
if(_workspace == null || _romName != romName) {
|
||||||
lock(_lock) {
|
lock(_lock) {
|
||||||
if(_workspace == null || _romName != romName || forceReload) {
|
if(_workspace == null || _romName != romName) {
|
||||||
if(_workspace != null) {
|
if(_workspace != null) {
|
||||||
SaveWorkspace();
|
SaveWorkspace();
|
||||||
}
|
}
|
||||||
_romName = InteropEmu.GetRomInfo().GetRomName();
|
_romName = InteropEmu.GetRomInfo().GetRomName();
|
||||||
_workspace = DebugWorkspace.GetWorkspace();
|
_workspace = DebugWorkspace.GetWorkspace();
|
||||||
SetupWorkspace();
|
SetupWorkspace(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -514,13 +514,8 @@ namespace Mesen.GUI.Forms
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Task.Run(() => {
|
Task.Run(() => {
|
||||||
if(ConfigManager.Config.PreferenceInfo.DeveloperMode) {
|
//If a workspace is already loaded for this game, make sure we setup the labels, watch, etc properly
|
||||||
//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();
|
DebugWorkspaceManager.SetupWorkspace();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue