@@ -1340,13 +1340,28 @@ static void rcheevos_client_login_callback(int result,
13401340
13411341 if (result != RC_OK )
13421342 {
1343+ settings_t * settings = config_get_ptr ();
13431344 char msg [256 ];
13441345 size_t _len = strlcpy (msg , "RetroAchievements login failed: " ,
13451346 sizeof (msg ));
13461347 _len += strlcpy (msg + _len , error_message , sizeof (msg ) - _len );
13471348 CHEEVOS_LOG (RCHEEVOS_TAG "%s\n" , msg );
1349+
1350+ if (result == RC_EXPIRED_TOKEN || /* token expired */
1351+ (result == RC_INVALID_CREDENTIALS && settings -> arrays .cheevos_token [0 ])) /* token invalid */
1352+ {
1353+ /* expired token, clear it out */
1354+ settings -> arrays .cheevos_token [0 ] = '\0' ;
1355+
1356+ /* the server message says to log in again. RetroArch doesn't really
1357+ have a login form, so use a custom message (that's translated) to
1358+ tell them to re-enter their password and restart the game. */
1359+ _len = strlcpy (msg , msg_hash_to_str (MSG_CHEEVOS_LOGIN_TOKEN_EXPIRED ),
1360+ sizeof (msg ));
1361+ }
1362+
13481363 runloop_msg_queue_push (msg , _len , 0 , 2 * 60 , false, NULL ,
1349- MESSAGE_QUEUE_ICON_DEFAULT , MESSAGE_QUEUE_CATEGORY_INFO );
1364+ MESSAGE_QUEUE_ICON_DEFAULT , MESSAGE_QUEUE_CATEGORY_ERROR );
13501365 return ;
13511366 }
13521367
@@ -1444,18 +1459,29 @@ static void rcheevos_client_load_game_callback(int result,
14441459 return ;
14451460
14461461 _len = strlcpy (msg , msg_hash_to_str (MSG_CHEEVOS_GAME_NOT_IDENTIFIED ), sizeof (msg ));
1462+
1463+ runloop_msg_queue_push (msg , _len , 0 , 2 * 60 , false, NULL ,
1464+ MESSAGE_QUEUE_ICON_DEFAULT , MESSAGE_QUEUE_CATEGORY_INFO );
14471465 }
14481466 else
14491467 {
14501468 if (!error_message )
14511469 error_message = "Unknown error" ;
14521470
1453- _len = snprintf (msg , sizeof (msg ), msg_hash_to_str (MSG_CHEEVOS_GAME_LOAD_FAILED ), error_message );
14541471 CHEEVOS_LOG (RCHEEVOS_TAG "Game load failed: %s\n" , error_message );
1472+
1473+ if (result == RC_LOGIN_REQUIRED )
1474+ {
1475+ /* assume error already reported by rcheevos_client_login_callback */
1476+ }
1477+ else
1478+ {
1479+ _len = snprintf (msg , sizeof (msg ), msg_hash_to_str (MSG_CHEEVOS_GAME_LOAD_FAILED ), error_message );
1480+ runloop_msg_queue_push (msg , _len , 0 , 2 * 60 , false, NULL ,
1481+ MESSAGE_QUEUE_ICON_DEFAULT , MESSAGE_QUEUE_CATEGORY_ERROR );
1482+ }
14551483 }
14561484
1457- runloop_msg_queue_push (msg , _len , 0 , 2 * 60 , false, NULL ,
1458- MESSAGE_QUEUE_ICON_DEFAULT , MESSAGE_QUEUE_CATEGORY_INFO );
14591485 return ;
14601486 }
14611487
0 commit comments