From 9730fa5c51fa8b2d59993f76e027f33ea0b899f8 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 11 Feb 2018 00:14:40 -0500 Subject: [PATCH] subsystem part 2: load content! hacky --- content.h | 2 ++ menu/cbs/menu_cbs_ok.c | 3 +- tasks/task_content.c | 68 +++++++++++++++++++++++++++++++++++++++++- tasks/tasks_internal.h | 6 ++++ 4 files changed, 77 insertions(+), 2 deletions(-) diff --git a/content.h b/content.h index 8111a41cad..33d3d1c9ba 100644 --- a/content.h +++ b/content.h @@ -39,6 +39,8 @@ typedef struct content_ctx_info environment_get_t environ_get; /* Function passed for environment_get function */ } content_ctx_info_t; +bool pending_subsystem_init; + int pending_subsystem; int pending_subsystem_rom_id; int pending_subsystem_rom_num; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 1454bb8996..3dacfb8232 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -463,7 +463,8 @@ int generic_action_ok_displaylist_push(const char *path, char* roms[2] = { pending_subsystem_roms[0], pending_subsystem_roms[1] }; path_set_special(roms, pending_subsystem_rom_num); content_ctx_info_t content_info = {0}; - task_push_load_content_with_core_from_menu( + pending_subsystem_init = true; + task_push_load_subsystem_with_core_from_menu( NULL, &content_info, CORE_TYPE_PLAIN, NULL, NULL); diff --git a/tasks/task_content.c b/tasks/task_content.c index 20e4348f1c..a8688e1ac3 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -187,7 +187,6 @@ static void content_load_init_wrap( } #endif - if (args->sram_path) { argv[(*argc)++] = strdup("-s"); @@ -235,6 +234,7 @@ static void content_load_init_wrap( **/ static bool content_load(content_ctx_info_t *info) { + RARCH_LOG("content_load\n"); unsigned i; bool retval = true; int rarch_argc = 0; @@ -272,6 +272,11 @@ static bool content_load(content_ctx_info_t *info) retval = false; goto end; } + + { + + content_init(); + } #ifdef HAVE_MENU /* TODO/FIXME - can we get rid of this? */ @@ -861,6 +866,8 @@ static bool task_load_content(content_ctx_info_t *content_info, return false; } + + content_get_status(&contentless, &is_inited); /* Push entry to top of history playlist */ @@ -1472,6 +1479,7 @@ static bool task_load_content_callback(content_ctx_info_t *content_info, char *error_string = NULL; global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); + struct string_list *content = NULL; content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading; content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL); @@ -1492,6 +1500,26 @@ static bool task_load_content_callback(content_ctx_info_t *content_info, content_ctx.subsystem.data = NULL; content_ctx.subsystem.size = 0; + rarch_system_info_t *sys_info = runloop_get_system_info(); + if (sys_info) + { + content_ctx.history_list_enable = settings->bools.history_list_enable; + content_ctx.set_supports_no_game_enable = settings->bools.set_supports_no_game_enable; + + if (!string_is_empty(settings->paths.directory_system)) + content_ctx.directory_system = strdup(settings->paths.directory_system); + if (!string_is_empty(settings->paths.directory_cache)) + content_ctx.directory_cache = strdup(settings->paths.directory_cache); + if (!string_is_empty(sys_info->info.valid_extensions)) + content_ctx.valid_extensions = strdup(sys_info->info.valid_extensions); + + content_ctx.block_extract = sys_info->info.block_extract; + content_ctx.need_fullpath = sys_info->info.need_fullpath; + + content_ctx.subsystem.data = sys_info->subsystem.data; + content_ctx.subsystem.size = sys_info->subsystem.size; + } + content_ctx.history_list_enable = settings->bools.history_list_enable; if (global) @@ -1660,6 +1688,35 @@ bool task_push_load_content_with_core_from_menu( return true; } + + +bool task_push_load_subsystem_with_core_from_menu( + const char *fullpath, + content_ctx_info_t *content_info, + enum rarch_core_type type, + retro_task_callback_t cb, + void *user_data) +{ + /* Set content path */ + path_set(RARCH_PATH_SUBSYSTEM, pending_subsystem_ident); + /* hardcoded to 2 for testing */ + char* roms[2] = { pending_subsystem_roms[0], pending_subsystem_roms[1] }; + path_set_special(roms, pending_subsystem_rom_num); + + /* Load content */ + if (!task_load_content_callback(content_info, true, false)) + { + rarch_menu_running(); + return false; + } + + /* Push quick menu onto menu stack */ + if (type != CORE_TYPE_DUMMY) + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); + + return true; +} + #endif void content_get_status( @@ -1674,6 +1731,7 @@ void content_get_status( void content_clear_subsystem(void) { pending_subsystem_rom_id = 0; + pending_subsystem_init = false; for (int i = 0; i < RARCH_MAX_SUBSYSTEM_ROMS; i++) pending_subsystem_roms[i][0] = '\0'; } @@ -1749,6 +1807,14 @@ void content_deinit(void) * selected libretro core. */ bool content_init(void) { + if (pending_subsystem_init) + { + path_set(RARCH_PATH_SUBSYSTEM, pending_subsystem_ident); + /* hardcoded to 2 for testing */ + char* roms[2] = { pending_subsystem_roms[0], pending_subsystem_roms[1] }; + path_set_special(roms, pending_subsystem_rom_num); + RARCH_LOG("********%s %s \n", pending_subsystem_ident, path_get(RARCH_PATH_SUBSYSTEM)); + } content_information_ctx_t content_ctx; bool ret = true; diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h index e83455aa62..f127900160 100644 --- a/tasks/tasks_internal.h +++ b/tasks/tasks_internal.h @@ -209,6 +209,12 @@ bool task_push_load_content_with_core_from_menu( enum rarch_core_type type, retro_task_callback_t cb, void *user_data); +bool task_push_load_subsystem_with_core_from_menu( + const char *fullpath, + content_ctx_info_t *content_info, + enum rarch_core_type type, + retro_task_callback_t cb, + void *user_data); #endif void task_file_load_handler(retro_task_t *task);