From f13ff67ec84a6416a148a85d4a4227a24925a904 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 22 Jun 2015 08:46:42 +0200 Subject: [PATCH] Create 'Load Content' Group --- menu/cbs/menu_cbs_deferred_push.c | 8 ++++ menu/cbs/menu_cbs_ok.c | 1 + menu/menu_displaylist.c | 42 +++++++++++++++++++ menu/menu_displaylist.h | 1 + menu/menu_hash.c | 12 ++++-- menu/menu_hash.h | 3 ++ menu/menu_setting.c | 70 +------------------------------ 7 files changed, 65 insertions(+), 72 deletions(-) diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index ab07e17ea6..083331bc17 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -191,6 +191,11 @@ static int deferred_push_options(menu_displaylist_info_t *info) return menu_displaylist_push_list(info, DISPLAYLIST_OPTIONS); } +static int deferred_push_load_content_list(menu_displaylist_info_t *info) +{ + return menu_displaylist_push_list(info, DISPLAYLIST_LOAD_CONTENT_LIST); +} + static int deferred_push_management_options(menu_displaylist_info_t *info) { return menu_displaylist_push_list(info, DISPLAYLIST_OPTIONS_MANAGEMENT); @@ -495,6 +500,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(menu_file_list_cbs_t * case MENU_LABEL_OPTIONS: cbs->action_deferred_push = deferred_push_options; break; + case MENU_LABEL_LOAD_CONTENT_LIST: + cbs->action_deferred_push = deferred_push_load_content_list; + break; case MENU_LABEL_MANAGEMENT: cbs->action_deferred_push = deferred_push_management_options; break; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 3787a1c3a7..003c498c64 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1553,6 +1553,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_CORE_COUNTERS: case MENU_LABEL_MANAGEMENT: case MENU_LABEL_OPTIONS: + case MENU_LABEL_LOAD_CONTENT_LIST: cbs->action_ok = action_ok_push_default; break; case MENU_LABEL_LOAD_CONTENT: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index d152924592..63cd81e457 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1429,6 +1429,42 @@ static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info) return 0; } +static int menu_displaylist_parse_load_core_list(menu_displaylist_info_t *info) +{ + global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); + +#ifdef HAVE_LIBRETRODB + menu_list_push(info->list, + menu_hash_to_str(MENU_LABEL_VALUE_CONTENT_COLLECTION_LIST), + menu_hash_to_str(MENU_LABEL_CONTENT_COLLECTION_LIST), + MENU_SETTING_ACTION, 0, 0); +#endif + + if (settings->history_list_enable) + { + menu_list_push(info->list, + menu_hash_to_str(MENU_LABEL_VALUE_LOAD_CONTENT_HISTORY), + menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_HISTORY), + MENU_SETTING_ACTION, 0, 0); + } + + if (global->core_info && core_info_list_num_info_files(global->core_info)) + { + menu_list_push(info->list, + menu_hash_to_str(MENU_LABEL_VALUE_DETECT_CORE_LIST), + menu_hash_to_str(MENU_LABEL_DETECT_CORE_LIST), + MENU_SETTING_ACTION, 0, 0); + } + + menu_list_push(info->list, + menu_hash_to_str(MENU_LABEL_VALUE_LOAD_CONTENT), + menu_hash_to_str(MENU_LABEL_LOAD_CONTENT), + MENU_SETTING_ACTION, 0, 0); + + return 0; +} + static int menu_displaylist_parse_options(menu_displaylist_info_t *info) { global_t *global = global_get_ptr(); @@ -1866,6 +1902,12 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) need_sort = true; need_refresh = true; + need_push = true; + break; + case DISPLAYLIST_LOAD_CONTENT_LIST: + menu_list_clear(info->list); + ret = menu_displaylist_parse_load_core_list(info); + need_push = true; break; case DISPLAYLIST_OPTIONS: diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 0e4d4543d2..499f31722d 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -72,6 +72,7 @@ enum DISPLAYLIST_SHADER_PARAMETERS, DISPLAYLIST_SHADER_PARAMETERS_PRESET, DISPLAYLIST_SYSTEM_INFO, + DISPLAYLIST_LOAD_CONTENT_LIST, DISPLAYLIST_OPTIONS, DISPLAYLIST_OPTIONS_CHEATS, DISPLAYLIST_OPTIONS_REMAPPINGS, diff --git a/menu/menu_hash.c b/menu/menu_hash.c index 20b4e77a5d..52ba702848 100644 --- a/menu/menu_hash.c +++ b/menu/menu_hash.c @@ -1572,6 +1572,10 @@ static const char *menu_hash_to_str_english(uint32_t hash) { switch (hash) { + case MENU_LABEL_LOAD_CONTENT_LIST: + return "load_content_list"; + case MENU_LABEL_VALUE_LOAD_CONTENT_LIST: + return "Load Content"; case MENU_VALUE_LOAD_ARCHIVE: return "Load Archive"; case MENU_VALUE_OPEN_ARCHIVE: @@ -2225,15 +2229,15 @@ static const char *menu_hash_to_str_english(uint32_t hash) case MENU_LABEL_CONTENT_COLLECTION_LIST: return "content_collection_list"; case MENU_LABEL_VALUE_CONTENT_COLLECTION_LIST: - return "Load Content From Collection"; + return "Select From Collection"; case MENU_LABEL_DETECT_CORE_LIST: return "detect_core_list"; case MENU_LABEL_VALUE_DETECT_CORE_LIST: - return "Load Content (Detect Core)"; + return "Select From Browser + Detect Core"; case MENU_LABEL_LOAD_CONTENT_HISTORY: return "history_list"; case MENU_LABEL_VALUE_LOAD_CONTENT_HISTORY: - return "Load Content From History"; + return "Select From History"; case MENU_LABEL_AUDIO_ENABLE: return "audio_enable"; case MENU_LABEL_VALUE_AUDIO_ENABLE: @@ -2497,7 +2501,7 @@ static const char *menu_hash_to_str_english(uint32_t hash) case MENU_LABEL_LOAD_CONTENT: return "load_content"; case MENU_LABEL_VALUE_LOAD_CONTENT: - return "Load Content"; + return "Select From Browser"; case MENU_LABEL_UNLOAD_CORE: return "unload_core"; case MENU_LABEL_VALUE_UNLOAD_CORE: diff --git a/menu/menu_hash.h b/menu/menu_hash.h index fa9f84e21f..9cc477ce25 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -35,6 +35,9 @@ extern "C" { #define MENU_VALUE_OPEN_ARCHIVE 0x96da22b9U #define MENU_VALUE_ASK_ARCHIVE 0x0b87d6a4U +#define MENU_LABEL_LOAD_CONTENT_LIST 0xd2e4a83aU +#define MENU_LABEL_VALUE_LOAD_CONTENT_LIST 0x55ff08eaU + #define MENU_LABEL_NO_SETTINGS_FOUND 0xabf77040U #define MENU_LABEL_VALUE_NO_SETTINGS_FOUND 0xffcc5b5dU #define MENU_LABEL_VALUE_NO_PERFORMANCE_COUNTERS 0xb4b52b95U diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 779ada4766..134c7473a0 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -1115,34 +1115,6 @@ static int core_list_action_toggle(void *data, bool wraparound) } #endif -/** - * load_content_action_toggle: - * @data : pointer to setting - * @action : toggle action value. Can be either one of : - * MENU_ACTION_RIGHT | MENU_ACTION_LEFT - * - * Function callback for 'Load Content' action's 'Action Toggle' - * function pointer. - * - * Returns: 0 on success, -1 on error. - **/ -static int load_content_action_toggle(void *data, bool wraparound) -{ - rarch_setting_t *setting = (rarch_setting_t *)data; - settings_t *settings = config_get_ptr(); - global_t *global = global_get_ptr(); - - if (setting_set_with_string_representation(setting, settings->menu_content_directory) != 0) - return -1; - - if (global->menu.info.valid_extensions) - setting->values = global->menu.info.valid_extensions; - else - setting->values = global->system.valid_extensions; - - return 0; -} - /** ******* ACTION OK CALLBACK FUNCTIONS ******* **/ @@ -3548,50 +3520,12 @@ static bool setting_append_list_main_menu_options( } #endif - -#ifdef HAVE_LIBRETRODB CONFIG_ACTION( - menu_hash_to_str(MENU_LABEL_CONTENT_COLLECTION_LIST), - menu_hash_to_str(MENU_LABEL_VALUE_CONTENT_COLLECTION_LIST), + menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_LIST), + menu_hash_to_str(MENU_LABEL_VALUE_LOAD_CONTENT_LIST), group_info.name, subgroup_info.name, parent_group); -#endif - - if (settings->history_list_enable) - { - CONFIG_ACTION( - menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_HISTORY), - menu_hash_to_str(MENU_LABEL_VALUE_LOAD_CONTENT_HISTORY), - group_info.name, - subgroup_info.name, - parent_group); - } - - if (global->core_info && core_info_list_num_info_files(global->core_info)) - { - CONFIG_ACTION( - menu_hash_to_str(MENU_LABEL_DETECT_CORE_LIST), - menu_hash_to_str(MENU_LABEL_VALUE_DETECT_CORE_LIST), - group_info.name, - subgroup_info.name, - parent_group); - settings_data_list_current_add_flags(list, list_info, SD_FLAG_BROWSER_ACTION); - } - - CONFIG_ACTION( - menu_hash_to_str(MENU_LABEL_LOAD_CONTENT), - menu_hash_to_str(MENU_LABEL_VALUE_LOAD_CONTENT), - group_info.name, - subgroup_info.name, - parent_group); - (*list)[list_info->index - 1].size = sizeof(global->fullpath); - (*list)[list_info->index - 1].value.string = global->fullpath; - (*list)[list_info->index - 1].action_left = load_content_action_toggle; - (*list)[list_info->index - 1].action_right = load_content_action_toggle; - (*list)[list_info->index - 1].action_select = load_content_action_toggle; - menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_LOAD_CONTENT); - settings_data_list_current_add_flags(list, list_info, SD_FLAG_BROWSER_ACTION); CONFIG_ACTION( menu_hash_to_str(MENU_LABEL_MANAGEMENT),