From eb416ce4787980da391bd63412e09eb0944f20f3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Oct 2016 02:23:21 +0200 Subject: [PATCH] Prevent null representation entries --- menu/widgets/menu_entry.c | 3 ++- setting_list.c | 3 +++ setting_list.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index f7506e170f..e327a244d8 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -442,7 +442,8 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, if (path && !use_representation) strlcpy(entry->path, path, sizeof(entry->path)); - if (cbs && cbs->setting && cbs->setting->enum_value_idx != MSG_UNKNOWN) + if (cbs && cbs->setting && cbs->setting->enum_value_idx != MSG_UNKNOWN + && !cbs->setting->dont_use_enum_idx_representation) strlcpy(entry->path, msg_hash_to_str(cbs->setting->enum_value_idx), sizeof(entry->path)); if (entry_label) diff --git a/setting_list.c b/setting_list.c index d2ae929482..0e3ec15d48 100644 --- a/setting_list.c +++ b/setting_list.c @@ -1458,6 +1458,7 @@ bool CONFIG_BOOL_ALT( (*list)[list_info->index++] = value; if (flags != SD_FLAG_NONE) settings_data_list_current_add_flags(list, list_info, flags); + (*list)[list_info->index - 1].dont_use_enum_idx_representation = true; return true; } @@ -1545,6 +1546,7 @@ bool CONFIG_UINT_ALT( if (value.name) value.name_hash = msg_hash_calculate(value.name); (*list)[list_info->index++] = value; + (*list)[list_info->index - 1].dont_use_enum_idx_representation = true; return true; } @@ -1790,6 +1792,7 @@ bool CONFIG_ACTION_ALT( if (value.name) value.name_hash = msg_hash_calculate(value.name); (*list)[list_info->index++] = value; + (*list)[list_info->index - 1].dont_use_enum_idx_representation = true; return true; } diff --git a/setting_list.h b/setting_list.h index 571cf93250..ee01bced36 100644 --- a/setting_list.h +++ b/setting_list.h @@ -93,6 +93,8 @@ struct rarch_setting enum msg_hash_enums enum_value_idx; enum setting_type type; + bool dont_use_enum_idx_representation; + uint32_t size; const char *name;