UI: Fixed pause screen issues (was sometimes being shown when it should not have)
This commit is contained in:
parent
0c97f4ab3d
commit
028b2ff089
7 changed files with 13 additions and 10 deletions
|
@ -402,8 +402,6 @@ void Console::Run()
|
|||
_runLock.Acquire();
|
||||
}
|
||||
|
||||
shared_ptr<Debugger> debugger = _debugger;
|
||||
|
||||
bool paused = EmulationSettings::IsPaused();
|
||||
if(paused && !_stop) {
|
||||
MessageManager::SendNotification(ConsoleNotificationType::GamePaused);
|
||||
|
@ -414,13 +412,13 @@ void Console::Run()
|
|||
_runLock.Release();
|
||||
|
||||
PlatformUtilities::EnableScreensaver();
|
||||
while(paused && !_stop && (!debugger || !debugger->CheckFlag(DebuggerFlags::DebuggerWindowEnabled))) {
|
||||
while(paused && !_stop) {
|
||||
//Sleep until emulation is resumed
|
||||
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>(30));
|
||||
paused = EmulationSettings::IsPaused();
|
||||
}
|
||||
|
||||
if(debugger && debugger->CheckFlag(DebuggerFlags::DebuggerWindowEnabled)) {
|
||||
if(EmulationSettings::CheckFlag(EmulationFlags::DebuggerWindowEnabled)) {
|
||||
//Prevent pausing when debugger is active
|
||||
EmulationSettings::ClearFlags(EmulationFlags::Paused);
|
||||
}
|
||||
|
@ -430,6 +428,7 @@ void Console::Run()
|
|||
MessageManager::SendNotification(ConsoleNotificationType::GameResumed);
|
||||
}
|
||||
|
||||
shared_ptr<Debugger> debugger = _debugger;
|
||||
if(debugger) {
|
||||
debugger->ProcessEvent(EventType::StartFrame);
|
||||
}
|
||||
|
|
|
@ -976,7 +976,7 @@ void Debugger::StopCodeRunner()
|
|||
//Break debugger when code has finished executing
|
||||
SetNextStatement(_returnToAddress);
|
||||
|
||||
if(CheckFlag(DebuggerFlags::DebuggerWindowEnabled)) {
|
||||
if(EmulationSettings::CheckFlag(EmulationFlags::DebuggerWindowEnabled)) {
|
||||
Step(1);
|
||||
} else {
|
||||
Run();
|
||||
|
|
|
@ -12,7 +12,6 @@ enum class DebuggerFlags
|
|||
DisassembleEverythingButData = 0x20,
|
||||
BreakOnBrk = 0x40,
|
||||
BreakOnUnofficialOpCode = 0x80,
|
||||
DebuggerWindowEnabled = 0x100,
|
||||
};
|
||||
|
||||
enum class AddressType
|
||||
|
|
|
@ -73,6 +73,8 @@ enum EmulationFlags : uint64_t
|
|||
|
||||
IntegerFpsMode = 0x2000000000000,
|
||||
|
||||
DebuggerWindowEnabled = 0x4000000000000,
|
||||
|
||||
ForceMaxSpeed = 0x4000000000000000,
|
||||
ConsoleMode = 0x8000000000000000,
|
||||
};
|
||||
|
@ -602,7 +604,7 @@ public:
|
|||
|
||||
static bool IsPaused()
|
||||
{
|
||||
return CheckFlag(EmulationFlags::Paused) || (CheckFlag(EmulationFlags::InBackground) && CheckFlag(EmulationFlags::PauseWhenInBackground) && !GameClient::Connected());
|
||||
return (CheckFlag(EmulationFlags::Paused) || (CheckFlag(EmulationFlags::InBackground) && CheckFlag(EmulationFlags::PauseWhenInBackground) && !GameClient::Connected())) && !CheckFlag(EmulationFlags::DebuggerWindowEnabled);
|
||||
}
|
||||
|
||||
static void SetNesModel(NesModel model)
|
||||
|
|
|
@ -243,7 +243,8 @@ namespace Mesen.GUI.Debugger
|
|||
if(mnuBreakOnBrk.Checked) {
|
||||
flags |= DebuggerFlags.BreakOnBrk;
|
||||
}
|
||||
InteropEmu.DebugSetFlags(flags | DebuggerFlags.DebuggerWindowEnabled);
|
||||
InteropEmu.DebugSetFlags(flags);
|
||||
InteropEmu.SetFlag(EmulationFlags.DebuggerWindowEnabled, true);
|
||||
}
|
||||
|
||||
private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
|
||||
|
@ -563,6 +564,7 @@ namespace Mesen.GUI.Debugger
|
|||
}
|
||||
|
||||
InteropEmu.DebugSetFlags(0);
|
||||
InteropEmu.SetFlag(EmulationFlags.DebuggerWindowEnabled, false);
|
||||
InteropEmu.DebugSetBreakpoints(new InteropBreakpoint[0], 0);
|
||||
InteropEmu.DebugRun();
|
||||
|
||||
|
|
|
@ -1316,6 +1316,8 @@ namespace Mesen.GUI
|
|||
|
||||
IntegerFpsMode = 0x2000000000000,
|
||||
|
||||
DebuggerWindowEnabled = 0x4000000000000,
|
||||
|
||||
ForceMaxSpeed = 0x4000000000000000,
|
||||
ConsoleMode = 0x8000000000000000,
|
||||
}
|
||||
|
@ -1332,7 +1334,6 @@ namespace Mesen.GUI
|
|||
DisassembleEverythingButData = 0x20,
|
||||
BreakOnBrk = 0x40,
|
||||
BreakOnUnofficialOpCode = 0x80,
|
||||
DebuggerWindowEnabled = 0x100,
|
||||
}
|
||||
|
||||
public struct InteropRomInfo
|
||||
|
|
|
@ -457,7 +457,7 @@ namespace NES
|
|||
|
||||
void Renderer::Render()
|
||||
{
|
||||
bool paused = EmulationSettings::IsPaused();
|
||||
bool paused = EmulationSettings::IsPaused() && Console::IsRunning();
|
||||
if(_noUpdateCount > 10 || _frameChanged || paused || IsMessageShown()) {
|
||||
_noUpdateCount = 0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue