diff --git a/Core/RetroAchievements.cpp b/Core/RetroAchievements.cpp index c02c6cd444..4c3ea97710 100644 --- a/Core/RetroAchievements.cpp +++ b/Core/RetroAchievements.cpp @@ -89,7 +89,7 @@ rc_client_t *GetClient() { } bool IsLoggedIn() { - return rc_client_get_user_info(g_rcClient) != nullptr; + return rc_client_get_user_info(g_rcClient) != nullptr && !g_isLoggingIn; } bool EncoreModeActive() { @@ -129,7 +129,11 @@ bool WarnUserIfChallengeModeActive(const char *message) { } bool IsBlockingExecution() { - return g_isIdentifying || g_isLoggingIn; + if (g_isLoggingIn || g_isIdentifying) { + // Useful for debugging race conditions. + // INFO_LOG(ACHIEVEMENTS, "isLoggingIn: %d isIdentifying: %d", (int)g_isLoggingIn, (int)g_isIdentifying); + } + return g_isLoggingIn || g_isIdentifying; } static u32 GetGameID() { @@ -313,6 +317,7 @@ static void event_handler_callback(const rc_client_event_t *event, rc_client_t * static void login_token_callback(int result, const char *error_message, rc_client_t *client, void *userdata) { switch (result) { case RC_OK: + INFO_LOG(ACHIEVEMENTS, "Successful login by token."); OnAchievementsLoginStateChange(); break; case RC_NO_RESPONSE: @@ -328,7 +333,7 @@ static void login_token_callback(int result, const char *error_message, rc_clien default: { auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS); - ERROR_LOG(ACHIEVEMENTS, "Failure logging in via token: %d, %s", result, error_message); + ERROR_LOG(ACHIEVEMENTS, "Callback: Failure logging in via token: %d, %s", result, error_message); g_OSD.Show(OSDType::MESSAGE_WARNING, ac->T("Failed logging in to RetroAchievements")); OnAchievementsLoginStateChange(); break; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index d32335c663..90aa75199b 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -243,14 +243,14 @@ void EmuScreen::bootGame(const Path &filename) { } if (PSP_IsIniting()) { - std::string error_string; + std::string error_string = "(unknown error)"; bootPending_ = !PSP_InitUpdate(&error_string); if (!bootPending_) { invalid_ = !PSP_IsInited(); if (invalid_) { errorMessage_ = error_string; - ERROR_LOG(BOOT, "%s", errorMessage_.c_str()); + ERROR_LOG(BOOT, "isIniting bootGame error: %s", errorMessage_.c_str()); return; } bootComplete(); @@ -331,7 +331,7 @@ void EmuScreen::bootGame(const Path &filename) { bootPending_ = false; invalid_ = true; errorMessage_ = error_string; - ERROR_LOG(BOOT, "%s", errorMessage_.c_str()); + ERROR_LOG(BOOT, "InitStart bootGame error: %s", errorMessage_.c_str()); } if (PSP_CoreParameter().compat.flags().RequireBufferedRendering && g_Config.bSkipBufferEffects) { @@ -360,8 +360,9 @@ void EmuScreen::bootComplete() { System_Notify(SystemNotification::BOOT_DONE); System_Notify(SystemNotification::DISASSEMBLY); - NOTICE_LOG(BOOT, "Loading %s...", PSP_CoreParameter().fileToStart.c_str()); + NOTICE_LOG(BOOT, "Booted %s...", PSP_CoreParameter().fileToStart.c_str()); if (!Achievements::ChallengeModeActive()) { + // Don't auto-load savestates in challenge mode. autoLoad(); } @@ -1075,6 +1076,8 @@ void EmuScreen::update() { } if (bootPending_) { + // Keep trying the boot until bootPending_ is lifted. + // It may be delayed due to RetroAchievements or any other cause. bootGame(gamePath_); }