From 782f17ec23252a686933933f65e4059aa2bc3ca5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Jun 2016 16:02:16 +0200 Subject: [PATCH] Dehardcode some strings --- menu/intl/menu_hash_us.c | 16 ++++++++++++++++ menu/menu_hash.h | 12 ++++++++++++ menu/menu_setting.c | 26 +++++++++++++------------- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index 97bd358fd6..31e640fcc6 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -26,6 +26,14 @@ static const char *menu_hash_to_str_us_label_enum(enum menu_hash_enums msg) { switch (msg) { + case MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_X: + return "video_viewport_custom_x"; + case MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_Y: + return "video_viewport_custom_y"; + case MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH: + return "video_viewport_custom_width"; + case MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT: + return "video_viewport_custom_height"; case MENU_ENUM_LABEL_NO_CORES_AVAILABLE: return "no_cores_available"; case MENU_ENUM_LABEL_NO_CORE_OPTIONS_AVAILABLE: @@ -776,6 +784,14 @@ const char *menu_hash_to_str_us_enum(enum menu_hash_enums msg) switch (msg) { + case MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X: + return "Custom Viewport X"; + case MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y: + return "Custom Viewport Y"; + case MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH: + return "Custom Viewport Width"; + case MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT: + return "Custom Viewport Height"; case MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY: return "No entries to display."; case MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ACHIEVEMENTS: diff --git a/menu/menu_hash.h b/menu/menu_hash.h index 5dca200baf..c62449227f 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -26,6 +26,18 @@ enum menu_hash_enums MENU_ENUM_LABEL_START_NET_RETROPAD, MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD, + MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_X, + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X, + + MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_Y, + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y, + + MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH, + + MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT, + MENU_ENUM_LABEL_CB_THUMBNAILS_UPDATER_DOWNLOAD, MENU_ENUM_LABEL_INPUT_BACK_AS_MENU_TOGGLE, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index c588df70f4..655ed36dff 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4658,8 +4658,8 @@ static bool setting_append_list( CONFIG_INT( list, list_info, &settings->video_viewport_custom.x, - "video_viewport_custom_x", - "Custom Viewport X", + menu_hash_to_str_enum(MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_X), + menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X), 0, &group_info, &subgroup_info, @@ -4671,13 +4671,13 @@ static bool setting_append_list( list, list_info, CMD_EVENT_VIDEO_APPLY_STATE_CHANGES); - /* TODO - add enum idx */ + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_X); CONFIG_INT( list, list_info, &settings->video_viewport_custom.y, - "video_viewport_custom_y", - "Custom Viewport Y", + menu_hash_to_str_enum(MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_Y), + menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y), 0, &group_info, &subgroup_info, @@ -4689,13 +4689,13 @@ static bool setting_append_list( list, list_info, CMD_EVENT_VIDEO_APPLY_STATE_CHANGES); - /* TODO - add enum idx */ + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_Y); CONFIG_UINT( list, list_info, &settings->video_viewport_custom.width, - "video_viewport_custom_width", - "Custom Viewport Width", + menu_hash_to_str_enum(MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH), + menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH), 0, &group_info, &subgroup_info, @@ -4710,13 +4710,13 @@ static bool setting_append_list( list, list_info, CMD_EVENT_VIDEO_APPLY_STATE_CHANGES); - /* TODO - add enum idx */ + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH); CONFIG_UINT( list, list_info, &settings->video_viewport_custom.height, - "video_viewport_custom_height", - "Custom Viewport Height", + menu_hash_to_str_enum(MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT), + menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT), 0, &group_info, &subgroup_info, @@ -4731,7 +4731,7 @@ static bool setting_append_list( list, list_info, CMD_EVENT_VIDEO_APPLY_STATE_CHANGES); - /* TODO - add enum idx */ + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH); END_SUB_GROUP(list, list_info, parent_group); START_SUB_GROUP(list, list_info, "Scaling", &group_info, &subgroup_info, parent_group); @@ -5409,7 +5409,7 @@ static bool setting_append_list( general_write_handler, general_read_handler); menu_settings_list_current_add_range(list, list_info, 0, 2, 1, true, true); - /* TODO - add enum idx */ + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO); CONFIG_BOOL( list, list_info,