(menu_setting) enforce_minrange and enforce_maxrange become flags,

and make remainder of minrange/maxrange local variables of type
float
This commit is contained in:
LibretroAdmin 2022-10-03 02:27:35 +02:00
parent cb280dcf5e
commit 0a8ff5d15d
4 changed files with 68 additions and 96 deletions

View File

@ -14227,8 +14227,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
int32_t orig_value = *setting->value.target.integer; int32_t orig_value = *setting->value.target.integer;
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM; unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM;
float step = setting->step; float step = setting->step;
float min = setting->enforce_minrange ? setting->min : 0.00f; float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f;
float max = setting->enforce_maxrange ? setting->max : 99999.00f; float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : 99999.00f;
bool checked_found = false; bool checked_found = false;
unsigned checked = 0; unsigned checked = 0;
unsigned entry_index = 0; unsigned entry_index = 0;
@ -14304,9 +14304,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM; unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM;
float step = setting->step; float step = setting->step;
float half_step = step * 0.5f; float half_step = step * 0.5f;
float min = setting->enforce_minrange ? float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ?
setting->min : 0.00f; setting->min : 0.00f;
float max = setting->enforce_maxrange ? float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ?
setting->max : 9999.00f; setting->max : 9999.00f;
bool checked_found = false; bool checked_found = false;
unsigned checked = 0; unsigned checked = 0;
@ -14380,10 +14380,10 @@ setting->max : 9999.00f;
unsigned orig_value = *setting->value.target.unsigned_integer; unsigned orig_value = *setting->value.target.unsigned_integer;
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM; unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM;
float step = setting->step; float step = setting->step;
float min = setting->enforce_minrange ? float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ?
setting->min : 0.00f; setting->min : 0.00f;
float max = setting->enforce_maxrange ? float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ?
setting->max : 9999.00f; setting->max : 9999.00f;
bool checked_found = false; bool checked_found = false;
unsigned checked = 0; unsigned checked = 0;
unsigned entry_index = 0; unsigned entry_index = 0;
@ -14564,10 +14564,8 @@ setting->max : 9999.00f;
int32_t orig_value = *setting->value.target.integer; int32_t orig_value = *setting->value.target.integer;
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM_SPECIAL; unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM_SPECIAL;
float step = setting->step; float step = setting->step;
float min = setting->enforce_minrange ? float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f;
setting->min : 0.00f; float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : 9999.00f;
float max = setting->enforce_maxrange ?
setting->max : 9999.00f;
bool checked_found = false; bool checked_found = false;
unsigned checked = 0; unsigned checked = 0;
unsigned entry_index = 0; unsigned entry_index = 0;
@ -14642,10 +14640,8 @@ setting->max : 9999.00f;
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM_SPECIAL; unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM_SPECIAL;
float step = setting->step; float step = setting->step;
float half_step = step * 0.5f; float half_step = step * 0.5f;
float min = setting->enforce_minrange ? float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f;
setting->min : 0.00f; float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : 9999.00f;
float max = setting->enforce_maxrange ?
setting->max : 9999.00f;
bool checked_found = false; bool checked_found = false;
unsigned checked = 0; unsigned checked = 0;
unsigned entry_index = 0; unsigned entry_index = 0;
@ -14717,10 +14713,8 @@ setting->max : 9999.00f;
unsigned orig_value = *setting->value.target.unsigned_integer; unsigned orig_value = *setting->value.target.unsigned_integer;
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL; unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL;
float step = setting->step; float step = setting->step;
float min = setting->enforce_minrange ? float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f;
setting->min : 0.00f; float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : 9999.00f;
float max = setting->enforce_maxrange ?
setting->max : 9999.00f;
bool checked_found = false; bool checked_found = false;
unsigned checked = 0; unsigned checked = 0;
unsigned entry_index = 0; unsigned entry_index = 0;

View File

@ -631,7 +631,7 @@ static int setting_int_action_right_default(
*setting->value.target.integer = *setting->value.target.integer =
*setting->value.target.integer + setting->step; *setting->value.target.integer + setting->step;
if (setting->enforce_maxrange) if (setting->flags & SD_FLAG_ENFORCE_MAXRANGE)
{ {
if (*setting->value.target.integer > max) if (*setting->value.target.integer > max)
{ {
@ -782,7 +782,7 @@ int setting_uint_action_left_default(
*setting->value.target.unsigned_integer = *setting->value.target.unsigned_integer =
*setting->value.target.unsigned_integer - step; *setting->value.target.unsigned_integer - step;
if (setting->enforce_minrange) if (setting->flags & SD_FLAG_ENFORCE_MINRANGE)
{ {
float min = setting->min; float min = setting->min;
if (overflowed || *setting->value.target.unsigned_integer < min) if (overflowed || *setting->value.target.unsigned_integer < min)
@ -817,7 +817,7 @@ int setting_uint_action_right_default(
*setting->value.target.unsigned_integer = *setting->value.target.unsigned_integer =
*setting->value.target.unsigned_integer + step; *setting->value.target.unsigned_integer + step;
if (setting->enforce_maxrange) if (setting->flags & SD_FLAG_ENFORCE_MAXRANGE)
{ {
float max = setting->max; float max = setting->max;
if (*setting->value.target.unsigned_integer > max) if (*setting->value.target.unsigned_integer > max)
@ -903,7 +903,7 @@ static int setting_size_action_left_default(
if (!(overflowed = step > *setting->value.target.sizet)) if (!(overflowed = step > *setting->value.target.sizet))
*setting->value.target.sizet = *setting->value.target.sizet - step; *setting->value.target.sizet = *setting->value.target.sizet - step;
if (setting->enforce_minrange) if (setting->flags & SD_FLAG_ENFORCE_MINRANGE)
{ {
float min = setting->min; float min = setting->min;
if (overflowed || *setting->value.target.sizet < min) if (overflowed || *setting->value.target.sizet < min)
@ -934,7 +934,7 @@ static int setting_size_action_right_default(
*setting->value.target.sizet = *setting->value.target.sizet =
*setting->value.target.sizet + step; *setting->value.target.sizet + step;
if (setting->enforce_maxrange) if (setting->flags & SD_FLAG_ENFORCE_MAXRANGE)
{ {
float max = setting->max; float max = setting->max;
if (*setting->value.target.sizet > max) if (*setting->value.target.sizet > max)
@ -1028,9 +1028,9 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
*setting->value.target.integer = (int)strtol(value, &ptr, 10); *setting->value.target.integer = (int)strtol(value, &ptr, 10);
if (flags & SD_FLAG_HAS_RANGE) if (flags & SD_FLAG_HAS_RANGE)
{ {
if (setting->enforce_minrange && *setting->value.target.integer < min) if (setting->flags & SD_FLAG_ENFORCE_MINRANGE && *setting->value.target.integer < min)
*setting->value.target.integer = min; *setting->value.target.integer = min;
if (setting->enforce_maxrange && *setting->value.target.integer > max) if (setting->flags & SD_FLAG_ENFORCE_MAXRANGE && *setting->value.target.integer > max)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (settings && settings->bools.menu_navigation_wraparound_enable) if (settings && settings->bools.menu_navigation_wraparound_enable)
@ -1044,9 +1044,9 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
*setting->value.target.unsigned_integer = (unsigned int)strtoul(value, &ptr, 10); *setting->value.target.unsigned_integer = (unsigned int)strtoul(value, &ptr, 10);
if (flags & SD_FLAG_HAS_RANGE) if (flags & SD_FLAG_HAS_RANGE)
{ {
if (setting->enforce_minrange && *setting->value.target.unsigned_integer < min) if (setting->flags & SD_FLAG_ENFORCE_MINRANGE && *setting->value.target.unsigned_integer < min)
*setting->value.target.unsigned_integer = min; *setting->value.target.unsigned_integer = min;
if (setting->enforce_maxrange && *setting->value.target.unsigned_integer > max) if (setting->flags & SD_FLAG_ENFORCE_MAXRANGE && *setting->value.target.unsigned_integer > max)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (settings && settings->bools.menu_navigation_wraparound_enable) if (settings && settings->bools.menu_navigation_wraparound_enable)
@ -1060,9 +1060,9 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
sscanf(value, "%" PRI_SIZET, setting->value.target.sizet); sscanf(value, "%" PRI_SIZET, setting->value.target.sizet);
if (flags & SD_FLAG_HAS_RANGE) if (flags & SD_FLAG_HAS_RANGE)
{ {
if (setting->enforce_minrange && *setting->value.target.sizet < min) if (setting->flags & SD_FLAG_ENFORCE_MINRANGE && *setting->value.target.sizet < min)
*setting->value.target.sizet = min; *setting->value.target.sizet = min;
if (setting->enforce_maxrange && *setting->value.target.sizet > max) if (setting->flags & SD_FLAG_ENFORCE_MAXRANGE && *setting->value.target.sizet > max)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (settings && settings->bools.menu_navigation_wraparound_enable) if (settings && settings->bools.menu_navigation_wraparound_enable)
@ -1077,9 +1077,9 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
*setting->value.target.fraction = (float)strtod(value, &ptr); *setting->value.target.fraction = (float)strtod(value, &ptr);
if (flags & SD_FLAG_HAS_RANGE) if (flags & SD_FLAG_HAS_RANGE)
{ {
if (setting->enforce_minrange && *setting->value.target.fraction < min) if (setting->flags & SD_FLAG_ENFORCE_MINRANGE && *setting->value.target.fraction < min)
*setting->value.target.fraction = min; *setting->value.target.fraction = min;
if (setting->enforce_maxrange && *setting->value.target.fraction > max) if (setting->flags & SD_FLAG_ENFORCE_MAXRANGE && *setting->value.target.fraction > max)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (settings && settings->bools.menu_navigation_wraparound_enable) if (settings && settings->bools.menu_navigation_wraparound_enable)
@ -1122,7 +1122,7 @@ static int setting_fraction_action_left_default(
*setting->value.target.fraction = *setting->value.target.fraction =
*setting->value.target.fraction - setting->step; *setting->value.target.fraction - setting->step;
if (setting->enforce_minrange) if (setting->flags & SD_FLAG_ENFORCE_MINRANGE)
{ {
float min = setting->min; float min = setting->min;
if (*setting->value.target.fraction < min) if (*setting->value.target.fraction < min)
@ -1149,7 +1149,7 @@ static int setting_fraction_action_right_default(
*setting->value.target.fraction = *setting->value.target.fraction =
*setting->value.target.fraction + setting->step; *setting->value.target.fraction + setting->step;
if (setting->enforce_maxrange) if (setting->flags & SD_FLAG_ENFORCE_MAXRANGE)
{ {
float max = setting->max; float max = setting->max;
if (*setting->value.target.fraction > max) if (*setting->value.target.fraction > max)
@ -1389,8 +1389,6 @@ static rarch_setting_t setting_action_setting(const char* name,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_idx = CMD_EVENT_NONE;
result.cmd_trigger_event_triggered = false; result.cmd_trigger_event_triggered = false;
@ -1453,8 +1451,6 @@ static rarch_setting_t setting_group_setting(
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_idx = CMD_EVENT_NONE;
result.cmd_trigger_event_triggered = false; result.cmd_trigger_event_triggered = false;
@ -1527,8 +1523,6 @@ static rarch_setting_t setting_float_setting(const char* name,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = rounding; result.rounding_fraction = rounding;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.fraction = target; result.value.target.fraction = target;
result.original_value.fraction = *target; result.original_value.fraction = *target;
@ -1604,8 +1598,6 @@ static rarch_setting_t setting_uint_setting(const char* name,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.unsigned_integer = target; result.value.target.unsigned_integer = target;
result.original_value.unsigned_integer = *target; result.original_value.unsigned_integer = *target;
@ -1683,8 +1675,6 @@ static rarch_setting_t setting_size_setting(const char* name,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.sizet = target; result.value.target.sizet = target;
result.original_value.sizet = *target; result.original_value.sizet = *target;
@ -1761,8 +1751,6 @@ static rarch_setting_t setting_hex_setting(const char* name,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.unsigned_integer = target; result.value.target.unsigned_integer = target;
result.original_value.unsigned_integer = *target; result.original_value.unsigned_integer = *target;
@ -1840,8 +1828,6 @@ static rarch_setting_t setting_bind_setting(const char* name,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.keybind = target; result.value.target.keybind = target;
result.default_value.keybind = default_value; result.default_value.keybind = default_value;
@ -1862,7 +1848,7 @@ static int setting_int_action_left_default(
*setting->value.target.integer = *setting->value.target.integer - setting->step; *setting->value.target.integer = *setting->value.target.integer - setting->step;
if (setting->enforce_minrange) if (setting->flags & SD_FLAG_ENFORCE_MINRANGE)
{ {
float min = setting->min; float min = setting->min;
if (*setting->value.target.integer < min) if (*setting->value.target.integer < min)
@ -1971,8 +1957,6 @@ static rarch_setting_t setting_string_setting(enum setting_type type,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.dir.empty_path = empty; result.dir.empty_path = empty;
result.value.target.string = target; result.value.target.string = target;
@ -2095,8 +2079,6 @@ static rarch_setting_t setting_subgroup_setting(enum setting_type type,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_idx = CMD_EVENT_NONE;
result.cmd_trigger_event_triggered = false; result.cmd_trigger_event_triggered = false;
@ -2170,8 +2152,6 @@ static rarch_setting_t setting_bool_setting(const char* name,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.boolean = target; result.value.target.boolean = target;
result.original_value.boolean = *target; result.original_value.boolean = *target;
@ -2249,8 +2229,6 @@ static rarch_setting_t setting_int_setting(const char* name,
result.browser_selection_type = ST_NONE; result.browser_selection_type = ST_NONE;
result.step = 0.0f; result.step = 0.0f;
result.rounding_fraction = NULL; result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.integer = target; result.value.target.integer = target;
result.original_value.integer = *target; result.original_value.integer = *target;
@ -7033,16 +7011,16 @@ static void menu_settings_list_current_add_range(
unsigned idx = list_info->index - 1; unsigned idx = list_info->index - 1;
if ((*list)[idx].type == ST_FLOAT) if ((*list)[idx].type == ST_FLOAT)
(*list)[list_info->index - 1].ui_type (*list)[idx].ui_type = ST_UI_TYPE_FLOAT_SLIDER_AND_SPINBOX;
= ST_UI_TYPE_FLOAT_SLIDER_AND_SPINBOX;
(*list)[idx].min = min; (*list)[idx].min = min;
(*list)[idx].step = step; (*list)[idx].step = step;
(*list)[idx].max = max; (*list)[idx].max = max;
(*list)[idx].enforce_minrange = enforce_minrange_enable; if (enforce_minrange_enable)
(*list)[idx].enforce_maxrange = enforce_maxrange_enable; (*list)[idx].flags |= SD_FLAG_ENFORCE_MINRANGE;
if (enforce_maxrange_enable)
(*list)[list_info->index - 1].flags |= SD_FLAG_HAS_RANGE; (*list)[idx].flags |= SD_FLAG_ENFORCE_MAXRANGE;
(*list)[idx].flags |= SD_FLAG_HAS_RANGE;
} }
int menu_setting_generic(rarch_setting_t *setting, size_t idx, bool wraparound) int menu_setting_generic(rarch_setting_t *setting, size_t idx, bool wraparound)
@ -21748,8 +21726,6 @@ void menu_setting_free(rarch_setting_t *setting)
(*&list)[pos].enum_value_idx = MSG_UNKNOWN; \ (*&list)[pos].enum_value_idx = MSG_UNKNOWN; \
(*&list)[pos].type = ST_NONE; \ (*&list)[pos].type = ST_NONE; \
(*&list)[pos].dont_use_enum_idx_representation = false; \ (*&list)[pos].dont_use_enum_idx_representation = false; \
(*&list)[pos].enforce_minrange = false; \
(*&list)[pos].enforce_maxrange = false; \
(*&list)[pos].index = 0; \ (*&list)[pos].index = 0; \
(*&list)[pos].index_offset = 0; \ (*&list)[pos].index_offset = 0; \
(*&list)[pos].offset_by = 0; \ (*&list)[pos].offset_by = 0; \

View File

@ -70,18 +70,20 @@ enum ui_setting_type
enum setting_flags enum setting_flags
{ {
SD_FLAG_NONE = 0, SD_FLAG_NONE = 0,
SD_FLAG_PATH_DIR = (1 << 0), SD_FLAG_PATH_DIR = (1 << 0),
SD_FLAG_PATH_FILE = (1 << 1), SD_FLAG_PATH_FILE = (1 << 1),
SD_FLAG_ALLOW_EMPTY = (1 << 2), SD_FLAG_ALLOW_EMPTY = (1 << 2),
SD_FLAG_HAS_RANGE = (1 << 3), SD_FLAG_HAS_RANGE = (1 << 3),
SD_FLAG_ALLOW_INPUT = (1 << 4), SD_FLAG_ALLOW_INPUT = (1 << 4),
SD_FLAG_IS_DRIVER = (1 << 5), SD_FLAG_IS_DRIVER = (1 << 5),
SD_FLAG_EXIT = (1 << 6), SD_FLAG_EXIT = (1 << 6),
SD_FLAG_CMD_APPLY_AUTO = (1 << 7), SD_FLAG_CMD_APPLY_AUTO = (1 << 7),
SD_FLAG_BROWSER_ACTION = (1 << 8), SD_FLAG_BROWSER_ACTION = (1 << 8),
SD_FLAG_ADVANCED = (1 << 9), SD_FLAG_ADVANCED = (1 << 9),
SD_FLAG_LAKKA_ADVANCED = (1 << 10) SD_FLAG_LAKKA_ADVANCED = (1 << 10),
SD_FLAG_ENFORCE_MINRANGE = (1 << 11),
SD_FLAG_ENFORCE_MAXRANGE = (1 << 12)
}; };
enum settings_free_flags enum settings_free_flags
@ -199,8 +201,6 @@ struct rarch_setting
bool cmd_trigger_event_triggered; bool cmd_trigger_event_triggered;
bool dont_use_enum_idx_representation; bool dont_use_enum_idx_representation;
bool enforce_minrange;
bool enforce_maxrange;
}; };
/** /**

View File

@ -494,8 +494,8 @@ UIntComboBox::UIntComboBox(rarch_setting_t *setting, QWidget *parent) :
,m_setting(setting) ,m_setting(setting)
,m_value(setting->value.target.unsigned_integer) ,m_value(setting->value.target.unsigned_integer)
{ {
double min = setting->enforce_minrange ? setting->min : 0.00; float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f;
double max = setting->enforce_maxrange ? setting->max : 999.00; float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : 999.00f;
populate(min, max); populate(min, max);
@ -586,8 +586,8 @@ UIntSpinBox::UIntSpinBox(rarch_setting_t *setting, QWidget *parent) :
,m_setting(setting) ,m_setting(setting)
,m_value(setting->value.target.unsigned_integer) ,m_value(setting->value.target.unsigned_integer)
{ {
setMinimum(setting->enforce_minrange ? setting->min : 0.00); setMinimum((setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f);
setMaximum(setting->enforce_maxrange ? setting->max : INT_MAX); setMaximum((setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : INT_MAX);
setSingleStep(setting->step); setSingleStep(setting->step);
@ -627,8 +627,8 @@ SizeSpinBox::SizeSpinBox(rarch_setting_t *setting, unsigned scale, QWidget *pare
,m_value(setting->value.target.sizet) ,m_value(setting->value.target.sizet)
,m_scale(scale) ,m_scale(scale)
{ {
setMinimum(setting->enforce_minrange ? setting->min / m_scale : 0.00); setMinimum((setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min / m_scale : 0.00f);
setMaximum(setting->enforce_maxrange ? setting->max / m_scale : INT_MAX); setMaximum((setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max / m_scale : INT_MAX);
setSingleStep(setting->step / m_scale); setSingleStep(setting->step / m_scale);
@ -723,9 +723,8 @@ UIntRadioButtons::UIntRadioButtons(rarch_setting_t *setting, QWidget *parent) :
float i; float i;
unsigned orig_value = *setting->value.target.unsigned_integer; unsigned orig_value = *setting->value.target.unsigned_integer;
float step = setting->step; float step = setting->step;
double min = setting->enforce_minrange ? setting->min : 0.00; float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f;
double max = setting->enforce_maxrange ? setting->max : UINT_MAX; float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : UINT_MAX;
bool checked_found = false; bool checked_found = false;
if (setting->get_string_representation) if (setting->get_string_representation)
@ -779,8 +778,8 @@ IntSpinBox::IntSpinBox(rarch_setting_t *setting, QWidget *parent) :
,m_setting(setting) ,m_setting(setting)
,m_value(setting->value.target.integer) ,m_value(setting->value.target.integer)
{ {
setMinimum(setting->enforce_minrange ? setting->min : INT_MIN); setMinimum((setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : INT_MIN);
setMaximum(setting->enforce_maxrange ? setting->max : INT_MAX); setMaximum((setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : INT_MAX);
setSingleStep(setting->step); setSingleStep(setting->step);
@ -829,8 +828,9 @@ FloatSpinBox::FloatSpinBox(rarch_setting_t *setting, QWidget *parent) :
if (match.hasMatch()) if (match.hasMatch())
setDecimals(match.captured(1).toInt()); setDecimals(match.captured(1).toInt());
setMinimum(setting->enforce_minrange ? setting->min : 0.00); setMinimum((setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f);
setMaximum(setting->enforce_maxrange ? setting->max : 999.00); setMaximum((setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max :
999.00f);
setValue(*m_value); setValue(*m_value);
setSingleStep(setting->step); setSingleStep(setting->step);
@ -968,8 +968,10 @@ FloatSlider::FloatSlider(rarch_setting_t *setting, QWidget *parent) :
else else
m_precision = 10 * 10 * 10; m_precision = 10 * 10 * 10;
setMinimum(setting->enforce_minrange ? setting->min * m_precision : 0.00 * m_precision); setMinimum((setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min *
setMaximum(setting->enforce_maxrange ? setting->max * m_precision : 999.00 * m_precision); m_precision : 0.00f * m_precision);
setMaximum((setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max *
m_precision : 999.00f * m_precision);
setSingleStep(setting->step * m_precision); setSingleStep(setting->step * m_precision);