Fix more race conditions if you exit during game bootup

This commit is contained in:
Henrik Rydgård
2026-02-23 20:46:14 +01:00
parent 25392ef6fd
commit 5dc169ecbe
3 changed files with 16 additions and 6 deletions
+3
View File
@@ -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 -
+1 -1
View File
@@ -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();
+12 -5
View File
@@ -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();