Fix menu bar becoming desynced when Pause at End of Movie is disabled

Previously, when Pause at End of Movie was disabled, the game would continue running as it should, but the menu bar would think the game was paused, showing the play button instead of the pause button.  To make things worse, clicking the play button would then restart the game, instead of pausing or doing nothing.  F10 paused/unpaused as normal, though.

The old behavior was essentially to enable stepping/pause mode (via `CPU::Break()`) and then if Pause at End of Movie was disabled, to un-pause on the host thread (via `CPU::EnableStepping(false)`).  For reasons which aren't entirely clear to me, the first one notified the menu bar (through the `Host::UpdateDisasmDialog` callback, not the `Settings::EmulationStateChanged` one), and the second did not.  In any case, this approach does not particularly make sense; I don't see any reason to pause and unpause if Pause at End of Movie is disabled; instead, we should only pause when Pause at End of Movie is enabled.

This behavior was probably introduced in c1944f623b, though I haven't tested it.
This commit is contained in:
Pokechu22 2022-02-16 11:07:12 -08:00
parent bb097c0576
commit a81b44f697

View File

@ -1324,7 +1324,7 @@ void EndPlayInput(bool cont)
{ {
// We can be called by EmuThread during boot (CPU::State::PowerDown) // We can be called by EmuThread during boot (CPU::State::PowerDown)
bool was_running = Core::IsRunningAndStarted() && !CPU::IsStepping(); bool was_running = Core::IsRunningAndStarted() && !CPU::IsStepping();
if (was_running) if (was_running && Config::Get(Config::MAIN_MOVIE_PAUSE_MOVIE))
CPU::Break(); CPU::Break();
s_rerecords = 0; s_rerecords = 0;
s_currentByte = 0; s_currentByte = 0;
@ -1337,11 +1337,7 @@ void EndPlayInput(bool cont)
// delete tmpInput; // delete tmpInput;
// tmpInput = nullptr; // tmpInput = nullptr;
Core::QueueHostJob([=] { Core::QueueHostJob([=] { Core::UpdateWantDeterminism(); });
Core::UpdateWantDeterminism();
if (was_running && !Config::Get(Config::MAIN_MOVIE_PAUSE_MOVIE))
CPU::EnableStepping(false);
});
} }
} }