diff --git a/runloop.c b/runloop.c index f5b5d312ea..bc3dff0c23 100644 --- a/runloop.c +++ b/runloop.c @@ -5450,23 +5450,32 @@ bool runloop_event_init_core( float fastforward_ratio = 0.0f; rarch_system_info_t *sys_info = &runloop_st->system; -#if defined(HAVE_NETWORKING) && defined(HAVE_UPDATE_CORES) - /* If netplay is enabled, update the core before initializing. */ +#ifdef HAVE_NETWORKING if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) { +#ifdef HAVE_UPDATE_CORES + /* If netplay is enabled, update the core before initializing. */ const char *path_core = path_get(RARCH_PATH_CORE); if (!string_is_empty(path_core) && !string_is_equal(path_core, "builtin")) { - task_push_update_single_core(path_core, - settings->bools.core_updater_auto_backup, - settings->uints.core_updater_auto_backup_history_size, - settings->paths.directory_libretro, - settings->paths.directory_core_assets); - /* We must wait for the update to finish before starting the core. */ - task_update_installed_cores_wait(); + if (task_push_update_single_core(path_core, + settings->bools.core_updater_auto_backup, + settings->uints.core_updater_auto_backup_history_size, + settings->paths.directory_libretro, + settings->paths.directory_core_assets)) + /* We must wait for the update to finish + before starting the core. */ + task_queue_wait(NULL, NULL); } +#endif + + /* We need this in order for core_info_current_supports_netplay + to work correctly at init_netplay, + called later at event_init_content. */ + command_event(CMD_EVENT_CORE_INFO_INIT, NULL); + command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL); } #endif diff --git a/tasks/task_core_updater.c b/tasks/task_core_updater.c index c25c543322..c81cb1436b 100644 --- a/tasks/task_core_updater.c +++ b/tasks/task_core_updater.c @@ -1582,21 +1582,6 @@ static bool task_update_installed_cores_finder(retro_task_t *task, void *user_da return false; } -static bool task_update_installed_cores_waiter(void *data) -{ - task_finder_data_t find_data; - - find_data.func = task_update_installed_cores_finder; - find_data.userdata = NULL; - - return task_queue_find(&find_data); -} - -void task_update_installed_cores_wait(void) -{ - task_queue_wait(task_update_installed_cores_waiter, NULL); -} - void task_push_update_installed_cores( bool auto_backup, size_t auto_backup_history_size, const char *path_dir_libretro, @@ -1677,7 +1662,7 @@ error: free_update_installed_cores_handle(update_installed_handle); } -void task_push_update_single_core( +bool task_push_update_single_core( const char *path_core, bool auto_backup, size_t auto_backup_history_size, const char *path_dir_libretro, const char *path_dir_core_assets) { @@ -1687,19 +1672,19 @@ void task_push_update_single_core( retro_task_t *task; if (string_is_empty(path_core) || string_is_empty(path_dir_libretro)) - return; + return false; #ifdef ANDROID /* Regular core updater is disabled in Play Store builds. */ if (play_feature_delivery_enabled()) - return; + return false; #endif /* Only one instance of this task may run at a time. */ find_data.func = task_update_installed_cores_finder; find_data.userdata = NULL; if (task_queue_find(&find_data)) - return; + return false; core_list = core_updater_list_init(); handle = (update_single_core_handle_t*)malloc(sizeof(*handle)); @@ -1710,7 +1695,7 @@ void task_push_update_single_core( free(handle); free(task); - return; + return false; } /* Configure handle */ @@ -1734,6 +1719,8 @@ void task_push_update_single_core( /* Push task */ task_queue_push(task); + + return true; } #if defined(ANDROID) diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h index 991f21024d..83f59d2e3e 100644 --- a/tasks/tasks_internal.h +++ b/tasks/tasks_internal.h @@ -112,10 +112,9 @@ void task_push_update_installed_cores( bool auto_backup, size_t auto_backup_history_size, const char *path_dir_libretro, const char *path_dir_core_assets); -void task_push_update_single_core( +bool task_push_update_single_core( const char *path_core, bool auto_backup, size_t auto_backup_history_size, const char *path_dir_libretro, const char *path_dir_core_assets); -void task_update_installed_cores_wait(void); #if defined(ANDROID) void *task_push_play_feature_delivery_core_install( core_updater_list_t* core_list,