From 7a715b322b481b6fa87358c96a467ca818a9a352 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 21 Jun 2015 22:35:19 +0200 Subject: [PATCH] Show 'No settings found.' if screen has no settings --- menu/menu_displaylist.c | 11 +++++++++-- menu/menu_hash.c | 4 ++++ menu/menu_hash.h | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index a63e05d78f..7470942d54 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1258,6 +1258,7 @@ static void menu_displaylist_realloc_settings(menu_entries_t *entries, unsigned static int menu_displaylist_parse_settings(menu_handle_t *menu, menu_displaylist_info_t *info, unsigned setting_flags) { + size_t count = 0; rarch_setting_t *setting = NULL; settings_t *settings = config_get_ptr(); @@ -1287,8 +1288,15 @@ static int menu_displaylist_parse_settings(menu_handle_t *menu, menu_list_push(info->list, setting->short_description, setting->name, menu_setting_set_flags(setting), 0, 0); + count++; } + if (count == 0) + menu_list_push(info->list, + menu_hash_to_str(MENU_LABEL_VALUE_NO_SETTINGS_FOUND), + menu_hash_to_str(MENU_LABEL_NO_SETTINGS_FOUND), + 0, 0, 0); + return 0; } @@ -1327,8 +1335,6 @@ static int menu_displaylist_parse_settings_in_subgroup(menu_displaylist_info_t * while (1) { - if (!info->setting) - return -1; if (info->setting->type == ST_SUB_GROUP) { if ((strlen(info->setting->name) != 0) && !strcmp(info->setting->name, elem1)) @@ -1337,6 +1343,7 @@ static int menu_displaylist_parse_settings_in_subgroup(menu_displaylist_info_t * info->setting++; } + info->setting++; for (; info->setting->type != ST_END_SUB_GROUP; info->setting++) diff --git a/menu/menu_hash.c b/menu/menu_hash.c index e299a13a97..d3fd8128ea 100644 --- a/menu/menu_hash.c +++ b/menu/menu_hash.c @@ -1330,6 +1330,10 @@ static const char *menu_hash_to_str_english(uint32_t hash) { switch (hash) { + case MENU_LABEL_NO_SETTINGS_FOUND: + return "menu_label_no_settings_found"; + case MENU_LABEL_VALUE_NO_SETTINGS_FOUND: + return "No settings found."; case MENU_LABEL_VALUE_NO_PERFORMANCE_COUNTERS: return "No performance counters."; case MENU_LABEL_VALUE_DRIVER_SETTINGS: diff --git a/menu/menu_hash.h b/menu/menu_hash.h index 10b976d46e..4e13192161 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -29,6 +29,8 @@ extern "C" { #define MENU_VALUE_DIRECTORY_DEFAULT 0xdcc3a2e4U #define MENU_VALUE_NOT_AVAILABLE 0x0b880503U +#define MENU_LABEL_NO_SETTINGS_FOUND 0xabf77040U +#define MENU_LABEL_VALUE_NO_SETTINGS_FOUND 0xffcc5b5dU #define MENU_LABEL_VALUE_NO_PERFORMANCE_COUNTERS 0xb4b52b95U #define MENU_LABEL_VIDEO_FONT_ENABLE 0x697d9b58U