diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index c2fec82550..a56906e7df 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1781,6 +1781,25 @@ ScreenRenderFlags EmuScreen::RunEmulation(bool skipBufferEffects) { // We process savestates before running the frame. SaveState::Process(); + // A savestate that failed to load halfway leaves a reset as the only option. Do it before the frame + // draws anything: the GPU can't shut down while its pipelines are bound in the open backbuffer pass. + if (SaveState::PollRestartNeeded() && !bootPending_) { + Achievements::UnloadGame(); + PSP_Shutdown(true); + + // Restart the boot process + bootPending_ = true; + bootIsReset_ = true; + RecreateViews(); + _dbg_assert_(coreState == CORE_POWERDOWN); + if (!PSP_InitStart(PSP_CoreParameter())) { + bootPending_ = false; + WARN_LOG(Log::Loader, "Error resetting"); + screenManager()->switchScreen(new MainScreen()); + } + return flags; + } + if (gpu) { gpu->BeginHostFrame(displayLayoutConfig); } @@ -1858,22 +1877,6 @@ ScreenRenderFlags EmuScreen::RunEmulation(bool skipBufferEffects) { draw->BindFramebufferAsRenderTarget(nullptr, {RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR}, "BackBuffer"); } } - - if (SaveState::PollRestartNeeded() && !bootPending_) { - Achievements::UnloadGame(); - PSP_Shutdown(true); - - // Restart the boot process - bootPending_ = true; - bootIsReset_ = true; - RecreateViews(); - _dbg_assert_(coreState == CORE_POWERDOWN); - if (!PSP_InitStart(PSP_CoreParameter())) { - bootPending_ = false; - WARN_LOG(Log::Loader, "Error resetting"); - screenManager()->switchScreen(new MainScreen()); - } - } } if (frameStep_) {