From 4345320c851274beacc634bbab7a0c8c3b337465 Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 23 Sep 2015 20:48:08 -0500 Subject: [PATCH] add a debug information panel, disabled by default --- configuration.c | 1 + configuration.h | 1 + menu/cbs/menu_cbs_deferred_push.c | 7 ++++ menu/cbs/menu_cbs_get_value.c | 4 +++ menu/cbs/menu_cbs_ok.c | 1 + menu/cbs/menu_cbs_title.c | 1 + menu/intl/menu_hash_us.c | 4 +++ menu/menu_displaylist.c | 53 +++++++++++++++++++++++++++++++ menu/menu_displaylist.h | 1 + menu/menu_hash.h | 2 ++ 10 files changed, 75 insertions(+) diff --git a/configuration.c b/configuration.c index 917d3b166c..8a32a1dacf 100644 --- a/configuration.c +++ b/configuration.c @@ -1631,6 +1631,7 @@ static bool config_load_file(const char *path, bool set_defaults) CONFIG_GET_BOOL_BASE(conf, settings, network_cmd_enable, "network_cmd_enable"); CONFIG_GET_INT_BASE(conf, settings, network_cmd_port, "network_cmd_port"); CONFIG_GET_BOOL_BASE(conf, settings, stdin_cmd_enable, "stdin_cmd_enable"); + CONFIG_GET_BOOL_BASE(conf, settings, debug_panel_enable, "debug_panel_enable"); CONFIG_GET_PATH_BASE(conf, settings, content_history_directory, "content_history_dir"); diff --git a/configuration.h b/configuration.h index 895d9a7f3b..57e3eec6cd 100644 --- a/configuration.h +++ b/configuration.h @@ -326,6 +326,7 @@ typedef struct settings bool network_cmd_enable; unsigned network_cmd_port; bool stdin_cmd_enable; + bool debug_panel_enable; char core_assets_directory[PATH_MAX_LENGTH]; char assets_directory[PATH_MAX_LENGTH]; diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 338ca42c27..2b3ced135c 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -40,6 +40,11 @@ static int deferred_push_system_information(menu_displaylist_info_t *info) return menu_displaylist_push_list(info, DISPLAYLIST_SYSTEM_INFO); } +static int deferred_push_debug_information(menu_displaylist_info_t *info) +{ + return menu_displaylist_push_list(info, DISPLAYLIST_DEBUG_INFO); +} + static int deferred_push_rdb_collection(menu_displaylist_info_t *info) { return menu_displaylist_push_list(info, DISPLAYLIST_PLAYLIST_COLLECTION); @@ -628,6 +633,8 @@ static int menu_cbs_init_bind_deferred_push_compare_label(menu_file_list_cbs_t * break; case MENU_LABEL_SYSTEM_INFORMATION: cbs->action_deferred_push = deferred_push_system_information; + case MENU_LABEL_DEBUG_INFORMATION: + cbs->action_deferred_push = deferred_push_debug_information; break; case MENU_LABEL_CORE_COUNTERS: cbs->action_deferred_push = deferred_push_core_counters; diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 11aace10d2..02394a4721 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -912,6 +912,9 @@ static void menu_action_setting_disp_set_label(file_list_t* list, case MENU_LABEL_SYSTEM_INFORMATION: *w = 2; break; + case MENU_LABEL_DEBUG_INFORMATION: + *w = 2; + break; } if (type >= MENU_SETTINGS_CORE_OPTION_START) @@ -1009,6 +1012,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( case MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS: case MENU_LABEL_CORE_INFORMATION: case MENU_LABEL_SYSTEM_INFORMATION: + case MENU_LABEL_DEBUG_INFORMATION: cbs->action_get_value = menu_action_setting_disp_set_label_menu_more; break; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 5dee6c3108..8e7df48dee 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1807,6 +1807,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS: case MENU_LABEL_CORE_INFORMATION: case MENU_LABEL_SYSTEM_INFORMATION: + case MENU_LABEL_DEBUG_INFORMATION: case MENU_LABEL_DISK_OPTIONS: case MENU_LABEL_SETTINGS: case MENU_LABEL_FRONTEND_COUNTERS: diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index 785eb7202c..76d9bc5439 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -617,6 +617,7 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_LOAD_CONTENT_HISTORY: case MENU_LABEL_INFO_SCREEN: case MENU_LABEL_SYSTEM_INFORMATION: + case MENU_LABEL_DEBUG_INFORMATION: case MENU_LABEL_CORE_INFORMATION: case MENU_LABEL_VIDEO_SHADER_PARAMETERS: case MENU_LABEL_VIDEO_SHADER_PRESET_PARAMETERS: diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index aa37d0bfac..c0f4e1b086 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -540,6 +540,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash) return "menu_navigation_browser_filter_supported_extensions_enable"; case MENU_LABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE: return "core_updater_auto_extract_archive"; + case MENU_LABEL_DEBUG_INFORMATION: + return "debug_information"; case MENU_LABEL_SYSTEM_INFORMATION: return "system_information"; case MENU_LABEL_ONLINE_UPDATER: @@ -1170,6 +1172,8 @@ const char *menu_hash_to_str_us(uint32_t hash) return "Automatically extract downloaded archive"; case MENU_LABEL_VALUE_SYSTEM_INFORMATION: return "System Information"; + case MENU_LABEL_VALUE_DEBUG_INFORMATION: + return "Debug Information"; case MENU_LABEL_VALUE_ONLINE_UPDATER: return "Online Updater"; case MENU_LABEL_VALUE_CORE_INFORMATION: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 51754f9c03..e5bbf2a9ff 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -401,6 +401,46 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info) return 0; } +static int menu_displaylist_parse_debug_info(menu_displaylist_info_t *info) +{ + char tmp[PATH_MAX_LENGTH] = {0}; + char tmp2[PATH_MAX_LENGTH] = {0}; + + settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); + + snprintf(tmp, sizeof(tmp), "%s", menu_hash_to_str(MENU_LABEL_VALUE_SAVEFILE_DIRECTORY)); + menu_list_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + snprintf(tmp, sizeof(tmp), "%s", global->dir.savefile); + menu_list_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + snprintf(tmp, sizeof(tmp), "%s", global->name.savefile); + menu_list_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + + snprintf(tmp, sizeof(tmp), "%s", menu_hash_to_str(MENU_LABEL_VALUE_SAVESTATE_DIRECTORY)); + menu_list_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + snprintf(tmp, sizeof(tmp), "%s", global->dir.savestate); + menu_list_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + snprintf(tmp, sizeof(tmp), "%s", global->name.savestate); + menu_list_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + + snprintf(tmp, sizeof(tmp), "%s", menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_DIRECTORY)); + menu_list_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + snprintf(tmp, sizeof(tmp), "%s", settings->system_directory); + menu_list_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + snprintf(tmp, sizeof(tmp), "%s", global->dir.systemdir); + menu_list_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + return 0; +} + static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) { int controller; @@ -1833,6 +1873,7 @@ static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_in static int menu_displaylist_parse_information_list(menu_displaylist_info_t *info) { global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); menu_list_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_CORE_INFORMATION), @@ -1844,6 +1885,12 @@ static int menu_displaylist_parse_information_list(menu_displaylist_info_t *info menu_hash_to_str(MENU_LABEL_SYSTEM_INFORMATION), MENU_SETTING_ACTION, 0, 0); + if(settings->debug_panel_enable) + menu_list_push(info->list, + menu_hash_to_str(MENU_LABEL_VALUE_DEBUG_INFORMATION), + menu_hash_to_str(MENU_LABEL_DEBUG_INFORMATION), + MENU_SETTING_ACTION, 0, 0); + #ifdef HAVE_LIBRETRODB menu_list_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_DATABASE_MANAGER), menu_hash_to_str(MENU_LABEL_DATABASE_MANAGER_LIST), @@ -2359,6 +2406,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) case DISPLAYLIST_HISTORY: case DISPLAYLIST_OPTIONS_DISK: case DISPLAYLIST_SYSTEM_INFO: + case DISPLAYLIST_DEBUG_INFO: case DISPLAYLIST_CORES: case DISPLAYLIST_CORES_DETECTED: case DISPLAYLIST_CORES_UPDATER: @@ -2703,6 +2751,11 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) need_push = true; need_refresh = true; break; + case DISPLAYLIST_DEBUG_INFO: + menu_displaylist_parse_debug_info(info); + need_push = true; + need_refresh = true; + break; case DISPLAYLIST_CORES_SUPPORTED: case DISPLAYLIST_CORES_COLLECTION_SUPPORTED: need_sort = true; diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 6c1815e2bf..e8b93df78d 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -77,6 +77,7 @@ enum DISPLAYLIST_SHADER_PARAMETERS, DISPLAYLIST_SHADER_PARAMETERS_PRESET, DISPLAYLIST_SYSTEM_INFO, + DISPLAYLIST_DEBUG_INFO, DISPLAYLIST_LOAD_CONTENT_LIST, DISPLAYLIST_INFORMATION_LIST, DISPLAYLIST_CONTENT_SETTINGS, diff --git a/menu/menu_hash.h b/menu/menu_hash.h index 512ca15032..76c98f3695 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -658,7 +658,9 @@ extern "C" { #define MENU_LABEL_LOAD_CONTENT_HISTORY 0xfe1d79e5U #define MENU_LABEL_VALUE_LOAD_CONTENT_HISTORY 0x5b362286U #define MENU_LABEL_SYSTEM_INFORMATION 0x206ebf0fU +#define MENU_LABEL_DEBUG_INFORMATION 0xeb0d82b1U #define MENU_LABEL_VALUE_SYSTEM_INFORMATION 0xa62fd7f0U +#define MENU_LABEL_VALUE_DEBUG_INFORMATION 0xd8569f92U #define MENU_LABEL_CORE_INFORMATION 0xb638e0d3U #define MENU_LABEL_VALUE_CORE_INFORMATION 0x781981b4U #define MENU_LABEL_VALUE_VIDEO_SHADER_PARAMETERS 0x5ace99b3U