From d5956f768b7bce7cea11c1446a510179a7ab2383 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 3 Sep 2014 23:47:24 +0200 Subject: [PATCH] (Menu) Dehardcode MENU_SETTINGS_CORE_INFO --- frontend/menu/menu_common.c | 2 +- frontend/menu/menu_common.h | 1 - frontend/menu/menu_entries.c | 177 +++++++++++++++++------------------ 3 files changed, 89 insertions(+), 91 deletions(-) diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 800b62bda8..cfe17c06d2 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -646,7 +646,7 @@ unsigned menu_common_type_is(const char *label, unsigned type) type == MENU_SETTINGS || type == MENU_SETTINGS_GENERAL_OPTIONS || type == MENU_SETTINGS_CORE_OPTIONS || - type == MENU_SETTINGS_CORE_INFO || + !strcmp(label, "core_information") || type == MENU_SETTINGS_VIDEO_OPTIONS || type == MENU_SETTINGS_FONT_OPTIONS || type == MENU_SETTINGS_SHADER_OPTIONS || diff --git a/frontend/menu/menu_common.h b/frontend/menu/menu_common.h index a2d7fb2f15..84673b7226 100644 --- a/frontend/menu/menu_common.h +++ b/frontend/menu/menu_common.h @@ -106,7 +106,6 @@ typedef enum // settings options are done here too MENU_SETTINGS_CORE, - MENU_SETTINGS_CORE_INFO, MENU_SETTINGS_DEFERRED_CORE, MENU_SETTINGS_CONFIG, MENU_SETTINGS_CORE_OPTIONS, diff --git a/frontend/menu/menu_entries.c b/frontend/menu/menu_entries.c index 951981b04e..ce7eed208b 100644 --- a/frontend/menu/menu_entries.c +++ b/frontend/menu/menu_entries.c @@ -107,7 +107,7 @@ int menu_entries_push_list(menu_handle_t *menu, add_setting_entry(menu,list,"detect_core_list", 0, setting_data); add_setting_entry(menu,list,"load_content", 0, setting_data); add_setting_entry(menu,list,"core_options", MENU_SETTINGS_CORE_OPTIONS, setting_data); - add_setting_entry(menu,list,"core_information", MENU_SETTINGS_CORE_INFO, setting_data); + add_setting_entry(menu,list,"core_information", 0, setting_data); add_setting_entry(menu,list,"settings", MENU_SETTINGS_OPTIONS, setting_data); add_setting_entry(menu,list,"performance_counters", MENU_FILE_SWITCH, setting_data); add_setting_entry(menu,list,"savestate", 0, setting_data); @@ -183,6 +183,93 @@ int menu_entries_push_list(menu_handle_t *menu, file_list_push(list, "Core Counters", "", MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO, 0); } + else if (!strcmp(label, "core_information")) + { + core_info_t *info = (core_info_t*)g_extern.core_info_current; + file_list_clear(list); + + if (info->data) + { + snprintf(tmp, sizeof(tmp), "Core name: %s", + info->display_name ? info->display_name : ""); + file_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + if (info->authors_list) + { + strlcpy(tmp, "Authors: ", sizeof(tmp)); + string_list_join_concat(tmp, sizeof(tmp), + info->authors_list, ", "); + file_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + + if (info->permissions_list) + { + strlcpy(tmp, "Permissions: ", sizeof(tmp)); + string_list_join_concat(tmp, sizeof(tmp), + info->permissions_list, ", "); + file_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + + if (info->supported_extensions_list) + { + strlcpy(tmp, "Supported extensions: ", sizeof(tmp)); + string_list_join_concat(tmp, sizeof(tmp), + info->supported_extensions_list, ", "); + file_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + + if (info->firmware_count > 0) + { + core_info_list_update_missing_firmware( + g_extern.core_info, info->path, + g_settings.system_directory); + + file_list_push(list, "Firmware: ", "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + for (i = 0; i < info->firmware_count; i++) + { + if (info->firmware[i].desc) + { + snprintf(tmp, sizeof(tmp), " name: %s", + info->firmware[i].desc ? info->firmware[i].desc : ""); + file_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(tmp, sizeof(tmp), " status: %s, %s", + info->firmware[i].missing ? + "missing" : "present", + info->firmware[i].optional ? + "optional" : "required"); + file_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + } + } + + if (info->notes) + { + snprintf(tmp, sizeof(tmp), "Core notes: "); + file_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + for (i = 0; i < info->note_list->size; i++) + { + snprintf(tmp, sizeof(tmp), " %s", + info->note_list->elems[i].data); + file_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + } + } + else + file_list_push(list, + "No information available.", "", + MENU_SETTINGS_CORE_OPTION_NONE, 0); + } else { switch (menu_type) @@ -319,94 +406,6 @@ int menu_entries_push_list(menu_handle_t *menu, file_list_push(list, "No options available.", "", MENU_SETTINGS_CORE_OPTION_NONE, 0); break; - case MENU_SETTINGS_CORE_INFO: - { - core_info_t *info = (core_info_t*)g_extern.core_info_current; - file_list_clear(list); - - if (info->data) - { - snprintf(tmp, sizeof(tmp), "Core name: %s", - info->display_name ? info->display_name : ""); - file_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); - - if (info->authors_list) - { - strlcpy(tmp, "Authors: ", sizeof(tmp)); - string_list_join_concat(tmp, sizeof(tmp), - info->authors_list, ", "); - file_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); - } - - if (info->permissions_list) - { - strlcpy(tmp, "Permissions: ", sizeof(tmp)); - string_list_join_concat(tmp, sizeof(tmp), - info->permissions_list, ", "); - file_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); - } - - if (info->supported_extensions_list) - { - strlcpy(tmp, "Supported extensions: ", sizeof(tmp)); - string_list_join_concat(tmp, sizeof(tmp), - info->supported_extensions_list, ", "); - file_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); - } - - if (info->firmware_count > 0) - { - core_info_list_update_missing_firmware( - g_extern.core_info, info->path, - g_settings.system_directory); - - file_list_push(list, "Firmware: ", "", - MENU_SETTINGS_CORE_INFO_NONE, 0); - for (i = 0; i < info->firmware_count; i++) - { - if (info->firmware[i].desc) - { - snprintf(tmp, sizeof(tmp), " name: %s", - info->firmware[i].desc ? info->firmware[i].desc : ""); - file_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); - - snprintf(tmp, sizeof(tmp), " status: %s, %s", - info->firmware[i].missing ? - "missing" : "present", - info->firmware[i].optional ? - "optional" : "required"); - file_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); - } - } - } - - if (info->notes) - { - snprintf(tmp, sizeof(tmp), "Core notes: "); - file_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); - - for (i = 0; i < info->note_list->size; i++) - { - snprintf(tmp, sizeof(tmp), " %s", - info->note_list->elems[i].data); - file_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); - } - } - } - else - file_list_push(list, - "No information available.", "", - MENU_SETTINGS_CORE_OPTION_NONE, 0); - } - break; case MENU_SETTINGS_OPTIONS: file_list_clear(list); add_setting_entry(menu,list,"Driver Options", MENU_SETTINGS_DRIVERS, setting_data);