From 71bfd98012983e5bdc09088bde368a0673a8ec93 Mon Sep 17 00:00:00 2001 From: radius Date: Thu, 11 Apr 2019 18:18:37 -0500 Subject: [PATCH] [subsystem] allow loading from history --- menu/cbs/menu_cbs_ok.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 730aeaa375..7ae36ebea9 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1715,9 +1715,17 @@ static int action_ok_playlist_entry_collection(const char *path, playlist_t *tmp_playlist = NULL; menu_handle_t *menu = NULL; + const char *subsystem_ident = NULL; + const struct string_list + *subsystem_rom_list = NULL; + unsigned i = 0; + + if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return menu_cbs_exit(); + + new_core_path[0] = '\0'; tmp_playlist = playlist_get_cached(); @@ -1735,7 +1743,32 @@ static int action_ok_playlist_entry_collection(const char *path, selection_ptr = entry_idx; playlist_get_index(playlist, selection_ptr, - &entry_path, &entry_label, &core_path, &core_name, NULL, NULL, NULL, NULL); + &entry_path, &entry_label, &core_path, &core_name, NULL, NULL, &subsystem_ident, &subsystem_rom_list); + + + /* Subsystem codepath */ + if (!string_is_empty(subsystem_ident) && subsystem_rom_list) + { + content_ctx_info_t content_info = {0}; + task_push_load_new_core(core_path, NULL, + &content_info, CORE_TYPE_PLAIN, NULL, NULL); + content_clear_subsystem(); + if (!content_set_subsystem_by_name(subsystem_ident)) + { + RARCH_LOG("[playlist] subsystem not found in implementation\n"); + /* TODO: Add OSD message telling users that content can't be loaded */ + return 0; + } + + for (i = 0; i < subsystem_rom_list->size; i++) + content_add_subsystem(subsystem_rom_list->elems[i].data); + task_push_load_subsystem_with_core_from_menu( + NULL, &content_info, + CORE_TYPE_PLAIN, NULL, NULL); + /* TODO: update playlist entry? move to first position I guess? */ + return 1; + } + /* Is the core path / name of the playlist entry not yet filled in? */ if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))