diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 28b27ab29f..8ee2070a7e 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -3556,11 +3556,13 @@ static int action_ok_rpl_entry(const char *path, static int action_ok_start_core(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_file_load(NULL, NULL, - CORE_TYPE_PLAIN, - CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU); -} + content_ctx_info_t content_info = {0}; + if (!task_push_content_load_nothing_with_current_core_from_menu(&content_info)) + return -1; + + return 0; +} static int action_ok_open_archive_detect_core(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) diff --git a/tasks/task_content.c b/tasks/task_content.c index e0bd5a510b..8fd69bce4e 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -1169,6 +1169,95 @@ error: return false; } +bool task_push_content_load_nothing_with_current_core_from_menu( + content_ctx_info_t *content_info) +{ + content_information_ctx_t content_ctx; + + char *error_string = NULL; + settings_t *settings = config_get_ptr(); + + if (!content_info) + return false; + content_ctx.patch_is_blocked = rarch_ctl(RARCH_CTL_IS_PATCH_BLOCKED, NULL); + content_ctx.bios_is_missing = runloop_ctl(RUNLOOP_CTL_IS_MISSING_BIOS, NULL); + content_ctx.history_list_enable = false; + content_ctx.directory_system = NULL; + content_ctx.directory_cache = NULL; + content_ctx.valid_extensions = NULL; + content_ctx.block_extract = false; + content_ctx.need_fullpath = false; + content_ctx.set_supports_no_game_enable = false; + + content_ctx.subsystem.data = NULL; + content_ctx.subsystem.size = 0; + + if (settings) + { + content_ctx.history_list_enable = settings->history_list_enable; + + if (!string_is_empty(settings->directory.system)) + content_ctx.directory_system = strdup(settings->directory.system); + } + +#ifdef HAVE_MENU + if (!content_info->environ_get) + content_info->environ_get = menu_content_environment_get; +#endif + + /* Clear content path */ + path_clear(RARCH_PATH_CONTENT); + + /* Preliminary stuff that has to be done before we + * load the actual content. Can differ per mode. */ + retroarch_set_current_core_type(CORE_TYPE_PLAIN, true); + + /* Load content */ + task_push_content_update_firmware_status(&content_ctx); + + if( + content_ctx.bios_is_missing && + settings->check_firmware_before_loading) + { + runloop_msg_queue_push(msg_hash_to_str(MSG_FIRMWARE), 100, 500, true); + RARCH_LOG("Load content blocked. Reason: %s\n", msg_hash_to_str(MSG_FIRMWARE)); + + return true; + } + + if (!task_load_content(content_info, &content_ctx, + true, CONTENT_MODE_LOAD_NONE, &error_string)) + goto error; + +#ifdef HAVE_MENU + /* Push quick menu onto menu stack */ + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); +#endif + + if (content_ctx.directory_system) + free(content_ctx.directory_system); + + return true; + +error: + + if (error_string) + { + runloop_msg_queue_push(error_string, 2, 90, true); + RARCH_ERR(error_string); + free(error_string); + } + +#ifdef HAVE_MENU + rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL); +#endif + + if (content_ctx.directory_system) + free(content_ctx.directory_system); + + return false; +} + bool task_push_content_load_default( const char *core_path, const char *fullpath, @@ -1217,7 +1306,6 @@ bool task_push_content_load_default( #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD) case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU: #endif - case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU: case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU: case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_COMPANION_UI: case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI: @@ -1234,7 +1322,6 @@ bool task_push_content_load_default( switch (mode) { - case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU: case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU: case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU: case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU: @@ -1255,7 +1342,6 @@ bool task_push_content_load_default( /* Clear content path */ switch (mode) { - case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU: case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU: case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU: path_clear(RARCH_PATH_CONTENT); @@ -1322,7 +1408,6 @@ bool task_push_content_load_default( * load the actual content. Can differ per mode. */ switch (mode) { - case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU: case CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU: retroarch_set_current_core_type(type, true); break; @@ -1350,7 +1435,6 @@ bool task_push_content_load_default( #ifdef HAVE_VIDEO_PROCESSOR case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU: #endif - case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU: case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU: case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_COMPANION_UI: case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI: @@ -1412,7 +1496,6 @@ error: #ifdef HAVE_MENU switch (mode) { - case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU: case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU: case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU: case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU: diff --git a/tasks/task_netplay_find_content.c b/tasks/task_netplay_find_content.c index 98fe2e6a53..2eebe83789 100644 --- a/tasks/task_netplay_find_content.c +++ b/tasks/task_netplay_find_content.c @@ -72,6 +72,8 @@ static void netplay_crc_scan_callback(void *task_data, else if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path) && string_is_equal(state->content_path, "N/A")) { + content_ctx_info_t content_info = {0}; + command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname); task_push_content_load_default( state->core_path, NULL, @@ -79,12 +81,8 @@ static void netplay_crc_scan_callback(void *task_data, CORE_TYPE_PLAIN, CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU, NULL, NULL); - task_push_content_load_default( - state->core_path, NULL, - &content_info, - CORE_TYPE_PLAIN, - CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU, - NULL, NULL); + + task_push_content_load_nothing_with_current_core_from_menu(&content_info); } else { diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h index 48b7d6f86c..d66b5c0470 100644 --- a/tasks/tasks_internal.h +++ b/tasks/tasks_internal.h @@ -40,7 +40,6 @@ enum content_mode_load { CONTENT_MODE_LOAD_NONE = 0, CONTENT_MODE_LOAD_FROM_CLI, - CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU, CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU, CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU, CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU, @@ -144,6 +143,8 @@ bool task_push_decompress( retro_task_callback_t cb, void *user_data); +bool task_push_content_load_nothing_with_current_core_from_menu(content_ctx_info_t *content_info); + bool task_push_content_load_nothing_with_dummy_core(content_ctx_info_t *content_info); bool task_push_content_load_content_from_playlist_from_menu(