ensure placard is initialized on main thread when game has no achievements (#13275)

This commit is contained in:
Jamiras 2021-11-22 08:42:43 -07:00 committed by GitHub
parent c2c36177b8
commit 228c5b83e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1315,6 +1315,27 @@ static void rcheevos_fetch_badges(void)
static void rcheevos_start_session_async(retro_task_t* task)
{
if (rcheevos_load_aborted())
return;
/* We don't have to wait for this to complete
* to proceed to the next loading state */
rcheevos_client_start_session(rcheevos_locals.game.id);
/* if there's nothing for the runtime to process,
* disable hardcore and bail. */
if (rcheevos_locals.game.achievement_count == 0
&& rcheevos_locals.game.leaderboard_count == 0)
{
if (!rcheevos_locals.runtime.richpresence)
{
rcheevos_pause_hardcore();
task_set_finished(task, true);
rcheevos_end_load();
return;
}
}
rcheevos_begin_load_state(RCHEEVOS_LOAD_STATE_STARTING_SESSION);
/* activate the achievements and leaderboards
@ -1325,10 +1346,6 @@ static void rcheevos_start_session_async(retro_task_t* task)
&& rcheevos_locals.hardcore_active)
rcheevos_activate_leaderboards();
/* We don't have to wait for this to complete
* to proceed to the next loading state */
rcheevos_client_start_session(rcheevos_locals.game.id);
rcheevos_validate_memrefs(&rcheevos_locals);
/* Let the runtime start processing the achievements */
@ -1384,20 +1401,6 @@ static void rcheevos_start_session(void)
return;
}
if (rcheevos_locals.game.achievement_count == 0
&& rcheevos_locals.game.leaderboard_count == 0)
{
if (!rcheevos_locals.runtime.richpresence)
{
/* nothing for the runtime to process,
* disable hardcore and bail */
rcheevos_show_game_placard();
rcheevos_pause_hardcore();
return;
}
}
/* this is called on the primary thread. use a task to do the initialization on a background thread */
task = task_init();
task->handler = rcheevos_start_session_async;
task->callback = rcheevos_start_session_finish;