diff --git a/Core/System.cpp b/Core/System.cpp index a1895f53f0..9d16624c05 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -636,6 +636,9 @@ bool PSP_InitStart(const CoreParameter &coreParam) { } } + // Use this to test exit-during-boot and other exceptional cases. + // sleep_ms(6000, "test"); + g_CoreParameter.fileType = fileType; // TODO: The reason we pass in g_CoreParameter.errorString here is that it's persistent - diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 6e099732f1..b30b64178b 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -2874,7 +2874,7 @@ void FramebufferManagerCommon::NotifyRenderResized(const DisplayLayoutConfig &co PSP_CoreParameter().renderHeight = h; PSP_CoreParameter().renderScaleFactor = scaleFactor; - if (UpdateRenderSize(msaaLevel)) { + if (draw_ && UpdateRenderSize(msaaLevel)) { draw_->StopThreads(); DestroyAllFBOs(); draw_->StartThreads(); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 85136e6a5e..1836555efa 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -460,13 +460,20 @@ EmuScreen::~EmuScreen() { std::string gameID = g_paramSFO.GetValueString("DISC_ID"); g_Config.TimeTracker().Stop(gameID); - // Should not be able to quit during boot, as boot can't be cancelled. - _dbg_assert_(!bootPending_); - if (!bootPending_) { - Achievements::UnloadGame(); - PSP_Shutdown(true); + if (bootPending_) { + // We probably quit during boot, got blocked in lostdevice, and then didn't end up in update again to call PSP_InitUpdate. + // So we need to finish and join the boot thread before we can exit. + _dbg_assert_(PollBootState() != BootState::Booting); + // Make sure we join the boot thread, by calling PSP_InitUpdate. + std::string error_string = "(unknown error)"; + PSP_InitUpdate(&error_string); + ERROR_LOG(Log::G3D, "Quit during boot, not good. %s", error_string.c_str()); + bootPending_ = false; } + Achievements::UnloadGame(); + PSP_Shutdown(true); + // If achievements are disabled in the global config, let's shut it down here. if (!g_Config.bAchievementsEnable) { Achievements::Shutdown();