From 5364ff24a93516f97596c22f37cfe324b044fbb2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 12 May 2015 16:24:10 +0200 Subject: [PATCH] Create DISPLAYLIST_CORE_OPTIONS --- menu/menu_displaylist.c | 28 +++++++++++++++++++++++ menu/menu_displaylist.h | 1 + menu/menu_entries_cbs_deferred_push.c | 32 ++++++--------------------- 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 8259c0952a..9bea69a7ea 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -585,6 +585,27 @@ int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_info_t *i return 0; } +static int menu_displaylist_parse_core_options(menu_displaylist_info_t *info) +{ + unsigned i; + global_t *global = global_get_ptr(); + + if (global->system.core_options) + { + size_t opts = core_option_size(global->system.core_options); + + for (i = 0; i < opts; i++) + menu_list_push(info->list, + core_option_get_desc(global->system.core_options, i), "", + MENU_SETTINGS_CORE_OPTION_START + i, 0); + } + else + menu_list_push(info->list, "No options available.", "", + MENU_SETTINGS_CORE_OPTION_NONE, 0); + + return 0; +} + int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) { int ret = 0; @@ -639,6 +660,13 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) if (ret == 0) need_push = true; break; + case DISPLAYLIST_CORE_OPTIONS: + menu_list_clear(info->list); + + ret = menu_displaylist_parse_core_options(info); + + need_push = true; + break; case DISPLAYLIST_CORES_ALL: menu_list_clear(info->list); diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 305656165b..ff070f5382 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -39,6 +39,7 @@ enum DISPLAYLIST_CORES_ALL, DISPLAYLIST_CORES_UPDATER, DISPLAYLIST_CORES_DETECTED, + DISPLAYLIST_CORE_OPTIONS, DISPLAYLIST_PERFCOUNTER_SELECTION, DISPLAYLIST_PERFCOUNTERS_CORE, DISPLAYLIST_PERFCOUNTERS_FRONTEND, diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 2604de479b..f877dbdb5b 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -1658,33 +1658,15 @@ static int deferred_push_core_input_remapping_options(void *data, void *userdata static int deferred_push_core_options(void *data, void *userdata, const char *path, const char *label, unsigned type) { - unsigned i; - file_list_t *list = (file_list_t*)data; - global_t *global = global_get_ptr(); + menu_displaylist_info_t info = {0}; - (void)userdata; + info.list = (file_list_t*)data; + info.menu_list = (file_list_t*)userdata; + info.type = type; + strlcpy(info.path, path, sizeof(info.path)); + strlcpy(info.label, label, sizeof(info.label)); - if (!list) - return -1; - - menu_list_clear(list); - - if (global->system.core_options) - { - size_t opts = core_option_size(global->system.core_options); - - for (i = 0; i < opts; i++) - menu_list_push(list, - core_option_get_desc(global->system.core_options, i), "", - MENU_SETTINGS_CORE_OPTION_START + i, 0); - } - else - menu_list_push(list, "No options available.", "", - MENU_SETTINGS_CORE_OPTION_NONE, 0); - - menu_driver_populate_entries(path, label, type); - - return 0; + return menu_displaylist_push_list(&info, DISPLAYLIST_CORE_OPTIONS); } static int deferred_push_disk_options(void *data, void *userdata,