Merge pull request #17772 from hrydgard/fix-achievements-from-frontend

Fix issue where achievements wouldn't always activate when starting from frontends
This commit is contained in:
Henrik Rydgård 2023-07-24 00:12:40 +02:00 committed by GitHub
commit add3a6b01d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -647,12 +647,14 @@ struct FileContext {
static BlockDevice *g_blockDevice;
bool IsReadyToStart() {
return !g_isLoggingIn;
}
void SetGame(const Path &path, FileLoader *fileLoader) {
// If we are currently logging in, give it a couple of seconds. This is not ideal, but works.
if (g_isLoggingIn) {
for (int i = 0; i < 3000 / 50; i++) {
sleep_ms(50);
}
// IsReadyToStart should have been checked, so we shouldn't be here.
ERROR_LOG(ACHIEVEMENTS, "Still logging in during SetGame - shouldn't happen");
}
if (!g_rcClient || !IsLoggedIn()) {

View File

@ -106,6 +106,7 @@ bool HasAchievementsOrLeaderboards();
bool LoginAsync(const char *username, const char *password);
void Logout();
bool IsReadyToStart();
void SetGame(const Path &path, FileLoader *fileLoader);
void ChangeUMD(const Path &path); // for in-game UMD change
void UnloadGame(); // Call when leaving a game.

View File

@ -418,6 +418,10 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) {
return false;
}
if (!Achievements::IsReadyToStart()) {
return false;
}
#if defined(_WIN32) && PPSSPP_ARCH(AMD64)
NOTICE_LOG(BOOT, "PPSSPP %s Windows 64 bit", PPSSPP_GIT_VERSION);
#elif defined(_WIN32) && !PPSSPP_ARCH(AMD64)