This commit is contained in:
LillyJadeKatrin 2025-08-10 16:11:35 -04:00 committed by GitHub
commit 2b62c1fe91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View file

@ -902,6 +902,7 @@ void AchievementManager::LoginCallback(int result, const char* error_message, rc
{
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to login {} to RetroAchievements server.",
Config::Get(Config::RA_USERNAME));
Config::SetBaseOrCurrent(Config::RA_API_TOKEN, "");
AchievementManager::GetInstance().m_update_callback({.failed_login_code = result});
return;
}
@ -996,6 +997,18 @@ void AchievementManager::LoadGameCallback(int result, const char* error_message,
OSD::Color::RED);
return;
}
if (result == RC_LOGIN_REQUIRED || result == RC_INVALID_CREDENTIALS || result == RC_EXPIRED_TOKEN)
{
WARN_LOG_FMT(ACHIEVEMENTS, "Invalid/expired RetroAchievements API token.");
OSD::AddMessage(
"You have been logged out from RetroAchievements due to invalid/expired credentials.",
OSD::Duration::VERY_LONG, OSD::Color::RED);
OSD::AddMessage("Please close the game to log back in before continuing.",
OSD::Duration::VERY_LONG, OSD::Color::RED);
Config::SetBaseOrCurrent(Config::RA_API_TOKEN, "");
instance.m_update_callback({.failed_login_code = result});
return;
}
auto* game = rc_client_get_game_info(client);
if (result == RC_OK)
@ -1239,7 +1252,7 @@ void AchievementManager::HandleGameCompletedEvent(const rc_client_event_t* clien
return;
}
bool hardcore = rc_client_get_hardcore_enabled(client);
OSD::AddMessage(fmt::format("Congratulations! {} has {} {}", user_info->display_name,
OSD::AddMessage(fmt::format("Congratulations {}! You have {} {}", user_info->display_name,
hardcore ? "mastered" : "completed", game_info->title),
OSD::Duration::VERY_LONG, hardcore ? OSD::Color::YELLOW : OSD::Color::CYAN,
&AchievementManager::GetInstance().GetGameBadge());

View file

@ -42,6 +42,10 @@ void AchievementSettingsWidget::UpdateData(int login_failed_code)
{
switch (login_failed_code)
{
case RC_LOGIN_REQUIRED:
case RC_EXPIRED_TOKEN:
m_common_login_failed->setText(tr("Logged Out - Credentials Expired"));
break;
case RC_INVALID_CREDENTIALS:
m_common_login_failed->setText(tr("Login Failed - Invalid Username/Password"));
break;