Skip to content

Commit

Permalink
RetroAchievements: Only apply Hardcore restrictions if the game is re…
Browse files Browse the repository at this point in the history
…cognized
  • Loading branch information
hrydgard committed Dec 3, 2023
1 parent 0f262d5 commit cd24f4e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Core/RetroAchievements.cpp
Expand Up @@ -104,6 +104,19 @@ bool IsLoggedIn() {
return rc_client_get_user_info(g_rcClient) != nullptr && !g_isLoggingIn;
}

// This is the RetroAchievements game ID, rather than the PSP game ID.
static u32 GetGameID() {
if (!g_rcClient) {
return 0;
}

const rc_client_game_t *info = rc_client_get_game_info(g_rcClient);
if (!info) {
return 0;
}
return info->id; // 0 if not identified
}

bool EncoreModeActive() {
if (!g_rcClient) {
return false;
Expand All @@ -122,7 +135,7 @@ bool ChallengeModeActive() {
if (!g_rcClient) {
return false;
}
return IsLoggedIn() && rc_client_get_hardcore_enabled(g_rcClient);
return IsLoggedIn() && rc_client_get_hardcore_enabled(g_rcClient) && GetGameID();
}

bool WarnUserIfChallengeModeActive(bool isSaveStateAction, const char *message) {
Expand All @@ -148,19 +161,6 @@ bool IsBlockingExecution() {
return g_isLoggingIn || g_isIdentifying;
}

// This is the RetroAchievements game ID, rather than the PSP game ID.
static u32 GetGameID() {
if (!g_rcClient) {
return 0;
}

const rc_client_game_t *info = rc_client_get_game_info(g_rcClient);
if (!info) {
return 0;
}
return info->id; // 0 if not identified
}

bool IsActive() {
return GetGameID() != 0;
}
Expand Down

0 comments on commit cd24f4e

Please sign in to comment.