mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
move achievement activation to background thread
This commit is contained in:
parent
4faf2f82f1
commit
2adf52a493
@ -1313,27 +1313,8 @@ static void rcheevos_fetch_badges(void)
|
||||
rcheevos_client_fetch_badges(rcheevos_fetch_badges_callback, NULL);
|
||||
}
|
||||
|
||||
static void rcheevos_start_session(void)
|
||||
static void rcheevos_start_session_async(retro_task_t* task)
|
||||
{
|
||||
if (rcheevos_load_aborted())
|
||||
{
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Load aborted before starting session\n");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
rcheevos_begin_load_state(RCHEEVOS_LOAD_STATE_STARTING_SESSION);
|
||||
|
||||
/* activate the achievements and leaderboards
|
||||
@ -1378,10 +1359,41 @@ static void rcheevos_start_session(void)
|
||||
|
||||
rcheevos_show_game_placard();
|
||||
|
||||
task_set_finished(task, true);
|
||||
|
||||
if (rcheevos_end_load_state() == 0)
|
||||
rcheevos_fetch_badges();
|
||||
}
|
||||
|
||||
static void rcheevos_start_session(void)
|
||||
{
|
||||
retro_task_t* task;
|
||||
|
||||
if (rcheevos_load_aborted())
|
||||
{
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "Load aborted before starting session\n");
|
||||
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_queue_push(task);
|
||||
}
|
||||
|
||||
static void rcheevos_initialize_runtime_callback(void* userdata)
|
||||
{
|
||||
rcheevos_start_session();
|
||||
|
@ -442,9 +442,7 @@ static void rcheevos_async_http_task_callback(
|
||||
* response is properly formatted or will encounter a parse failure
|
||||
* before reading past the end of the data */
|
||||
if (request->handler)
|
||||
{
|
||||
request->handler(request, data, buffer, sizeof(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
if (!buffer[0])
|
||||
|
@ -297,7 +297,8 @@ static void gfx_widget_achievement_popup_next(void* userdata)
|
||||
|
||||
if (state->queue_read_index >= 0)
|
||||
{
|
||||
gfx_widget_achievement_popup_free_current(state);
|
||||
if (state->queue[state->queue_read_index].title)
|
||||
gfx_widget_achievement_popup_free_current(state);
|
||||
|
||||
/* start the next popup (if present) */
|
||||
if (state->queue[state->queue_read_index].title)
|
||||
|
Loading…
x
Reference in New Issue
Block a user