Do wraparound of settings

This commit is contained in:
twinaphex 2015-07-04 19:58:43 +02:00
parent 665cbbd39e
commit e438dd3263
4 changed files with 46 additions and 7 deletions

View File

@ -570,6 +570,7 @@ static void config_set_defaults(void)
settings->menu.dpi.override_enable = menu_dpi_override_enable;
settings->menu.dpi.override_value = menu_dpi_override_value;
settings->menu.navigation.wraparound.setting_enable = true;
settings->menu.navigation.wraparound.horizontal_enable = true;
settings->menu.navigation.wraparound.vertical_enable = true;
settings->menu.navigation.browser.filter.supported_extensions_enable = true;

View File

@ -132,6 +132,7 @@ typedef struct settings
{
bool horizontal_enable;
bool vertical_enable;
bool setting_enable;
} wraparound;
struct
{

View File

@ -106,7 +106,7 @@ bool core_info_list_get_display_name(core_info_list_t *list,
bool core_info_get_display_name_from_file(const char *path, char *buf, size_t size);
void core_info_get_name(const char *path, char *s, size_t len);
bool core_info_get_display_name(const char *path, char *s, size_t len);
#ifdef __cplusplus
}

View File

@ -508,7 +508,14 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
if (setting->enforce_minrange && *setting->value.integer < setting->min)
*setting->value.integer = setting->min;
if (setting->enforce_maxrange && *setting->value.integer > setting->max)
*setting->value.integer = setting->max;
{
settings_t *settings = config_get_ptr();
if (settings && settings->menu.navigation.wraparound.setting_enable)
*setting->value.integer = setting->min;
else
*setting->value.integer = setting->max;
}
}
break;
case ST_UINT:
@ -518,7 +525,14 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
if (setting->enforce_minrange && *setting->value.unsigned_integer < setting->min)
*setting->value.unsigned_integer = setting->min;
if (setting->enforce_maxrange && *setting->value.unsigned_integer > setting->max)
*setting->value.unsigned_integer = setting->max;
{
settings_t *settings = config_get_ptr();
if (settings && settings->menu.navigation.wraparound.setting_enable)
*setting->value.unsigned_integer = setting->min;
else
*setting->value.unsigned_integer = setting->max;
}
}
break;
case ST_FLOAT:
@ -528,7 +542,14 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
if (setting->enforce_minrange && *setting->value.fraction < setting->min)
*setting->value.fraction = setting->min;
if (setting->enforce_maxrange && *setting->value.fraction > setting->max)
*setting->value.fraction = setting->max;
{
settings_t *settings = config_get_ptr();
if (settings && settings->menu.navigation.wraparound.setting_enable)
*setting->value.fraction = setting->min;
else
*setting->value.fraction = setting->max;
}
}
break;
case ST_PATH:
@ -975,7 +996,14 @@ static int setting_uint_action_right_default(void *data, bool wraparound)
if (setting->enforce_maxrange)
{
if (*setting->value.unsigned_integer > setting->max)
*setting->value.unsigned_integer = setting->max;
{
settings_t *settings = config_get_ptr();
if (settings && settings->menu.navigation.wraparound.setting_enable)
*setting->value.unsigned_integer = setting->min;
else
*setting->value.unsigned_integer = setting->max;
}
}
return 0;
@ -1015,7 +1043,14 @@ static int setting_fraction_action_right_default(
if (setting->enforce_maxrange)
{
if (*setting->value.fraction > setting->max)
*setting->value.fraction = setting->max;
{
settings_t *settings = config_get_ptr();
if (settings && settings->menu.navigation.wraparound.setting_enable)
*setting->value.fraction = setting->min;
else
*setting->value.fraction = setting->max;
}
}
return 0;
@ -1050,7 +1085,9 @@ static int setting_string_action_right_driver(void *data,
if (!find_next_driver(setting->name, setting->value.string, setting->size))
{
if (wraparound)
settings_t *settings = config_get_ptr();
if (settings && settings->menu.navigation.wraparound.setting_enable)
find_first_driver(setting->name, setting->value.string, setting->size);
}