From 19a2af4ee388b6645ce1e8e0d593d8ea5ef505d9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 23 Sep 2018 14:39:21 +0200 Subject: [PATCH] Cleanup --- menu/menu_displaylist.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 9f5a151b1b..538a99cec8 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4230,7 +4230,7 @@ void menu_displaylist_info_init(menu_displaylist_info_t *info) info->setting = NULL; } -static void menu_displaylist_enumerate_range(menu_displaylist_info_t *info, +static bool menu_displaylist_enumerate_range(menu_displaylist_info_t *info, rarch_setting_t *setting, unsigned setting_type) { if (setting->enforce_minrange && setting->enforce_maxrange) @@ -4242,7 +4242,6 @@ static void menu_displaylist_enumerate_range(menu_displaylist_info_t *info, if (setting->get_string_representation) { - unsigned orig_value = *setting->value.target.unsigned_integer; for (i = min; i <= max; i += step) { char val_s[256], val_d[256]; @@ -4264,7 +4263,7 @@ static void menu_displaylist_enumerate_range(menu_displaylist_info_t *info, setting_type, val, 0); } - *setting->value.target.unsigned_integer = orig_value; + return true; } else { @@ -4284,6 +4283,8 @@ static void menu_displaylist_enumerate_range(menu_displaylist_info_t *info, } } } + + return false; } bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) @@ -7753,17 +7754,23 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - unsigned setting_type = 0; - switch (setting->type) { case ST_INT: - setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM; - menu_displaylist_enumerate_range(info, setting, setting_type); + { + int32_t orig_value = *setting->value.target.integer; + unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM; + if (menu_displaylist_enumerate_range(info, setting, setting_type)) + *setting->value.target.integer = orig_value; + } break; case ST_UINT: - setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM; - menu_displaylist_enumerate_range(info, setting, setting_type); + { + unsigned orig_value = *setting->value.target.unsigned_integer; + unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM; + if (menu_displaylist_enumerate_range(info, setting, setting_type)) + *setting->value.target.unsigned_integer = orig_value; + } break; default: break;