mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-18 00:07:23 +00:00
Move more g_settings manipulation to settings.c (settings_set)
This commit is contained in:
parent
66716dc94c
commit
81280896ed
@ -1140,16 +1140,16 @@ static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, r
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_LEFT:
|
||||
g_settings.input.overlay_opacity -= 0.01f;
|
||||
settings_set(1ULL << S_INPUT_OVERLAY_OPACITY_DECREMENT);
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_RIGHT:
|
||||
case RGUI_ACTION_OK:
|
||||
g_settings.input.overlay_opacity += 0.01f;
|
||||
settings_set(1ULL << S_INPUT_OVERLAY_OPACITY_INCREMENT);
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_START:
|
||||
g_settings.input.overlay_opacity = 1.0f;
|
||||
settings_set(1ULL << S_DEF_INPUT_OVERLAY_OPACITY);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1157,11 +1157,6 @@ static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, r
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_settings.input.overlay_opacity < 0.0f)
|
||||
g_settings.input.overlay_opacity = 0.0f;
|
||||
else if (g_settings.input.overlay_opacity > 1.0f)
|
||||
g_settings.input.overlay_opacity = 1.0f;
|
||||
|
||||
if (changed && driver.overlay)
|
||||
input_overlay_set_alpha_mod(driver.overlay,
|
||||
g_settings.input.overlay_opacity);
|
||||
@ -1174,16 +1169,16 @@ static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, r
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_LEFT:
|
||||
g_settings.input.overlay_scale -= 0.01f;
|
||||
settings_set(1ULL << S_INPUT_OVERLAY_SCALE_DECREMENT);
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_RIGHT:
|
||||
case RGUI_ACTION_OK:
|
||||
g_settings.input.overlay_scale += 0.01f;
|
||||
settings_set(1ULL << S_INPUT_OVERLAY_SCALE_INCREMENT);
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_START:
|
||||
g_settings.input.overlay_scale = 1.0f;
|
||||
settings_set(1ULL << S_DEF_INPUT_OVERLAY_SCALE);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1191,11 +1186,6 @@ static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, r
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_settings.input.overlay_scale < 0.01f) // Avoid potential divide by zero.
|
||||
g_settings.input.overlay_scale = 0.01f;
|
||||
else if (g_settings.input.overlay_scale > 2.0f)
|
||||
g_settings.input.overlay_scale = 2.0f;
|
||||
|
||||
if (changed && driver.overlay)
|
||||
input_overlay_set_scale_factor(driver.overlay,
|
||||
g_settings.input.overlay_scale);
|
||||
@ -1947,13 +1937,13 @@ static int video_option_toggle_setting(rgui_handle_t *rgui, unsigned setting, rg
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_START:
|
||||
g_settings.video.vsync = true;
|
||||
settings_set(1ULL << S_DEF_VIDEO_VSYNC);
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_LEFT:
|
||||
case RGUI_ACTION_RIGHT:
|
||||
case RGUI_ACTION_OK:
|
||||
g_settings.video.vsync = !g_settings.video.vsync;
|
||||
settings_set(1ULL << S_VIDEO_VSYNC_TOGGLE);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -652,7 +652,15 @@ enum
|
||||
S_REFRESH_RATE_INCREMENT,
|
||||
S_INFO_DEBUG_MSG_TOGGLE,
|
||||
S_INFO_MSG_TOGGLE,
|
||||
S_INPUT_OVERLAY_OPACITY_DECREMENT,
|
||||
S_INPUT_OVERLAY_OPACITY_INCREMENT,
|
||||
S_INPUT_OVERLAY_SCALE_DECREMENT,
|
||||
S_INPUT_OVERLAY_SCALE_INCREMENT,
|
||||
S_VIDEO_VSYNC_TOGGLE,
|
||||
S_DEF_ASPECT_RATIO,
|
||||
S_DEF_VIDEO_VSYNC,
|
||||
S_DEF_INPUT_OVERLAY_OPACITY,
|
||||
S_DEF_INPUT_OVERLAY_SCALE,
|
||||
S_DEF_SCALE_INTEGER,
|
||||
S_DEF_AUDIO_MUTE,
|
||||
S_DEF_AUDIO_CONTROL_RATE,
|
||||
|
46
settings.c
46
settings.c
@ -1132,6 +1132,52 @@ bool config_save_keybinds(const char *path)
|
||||
|
||||
void settings_set(uint64_t settings)
|
||||
{
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (settings & (1ULL << S_INPUT_OVERLAY_OPACITY_DECREMENT))
|
||||
{
|
||||
g_settings.input.overlay_opacity -= 0.01f;
|
||||
|
||||
if (g_settings.input.overlay_opacity < 0.0f)
|
||||
g_settings.input.overlay_opacity = 0.0f;
|
||||
}
|
||||
|
||||
if (settings & (1ULL << S_INPUT_OVERLAY_OPACITY_INCREMENT))
|
||||
{
|
||||
g_settings.input.overlay_opacity += 0.01f;
|
||||
|
||||
if (g_settings.input.overlay_opacity > 1.0f)
|
||||
g_settings.input.overlay_opacity = 1.0f;
|
||||
}
|
||||
|
||||
if (settings & (1ULL << S_DEF_INPUT_OVERLAY_OPACITY))
|
||||
g_settings.input.overlay_opacity = 1.0f;
|
||||
|
||||
if (settings & (1ULL << S_INPUT_OVERLAY_SCALE_DECREMENT))
|
||||
{
|
||||
g_settings.input.overlay_scale -= 0.01f;
|
||||
|
||||
if (g_settings.input.overlay_scale < 0.01f) // Avoid potential divide by zero.
|
||||
g_settings.input.overlay_scale = 0.01f;
|
||||
}
|
||||
|
||||
if (settings & (1ULL << S_INPUT_OVERLAY_SCALE_INCREMENT))
|
||||
{
|
||||
g_settings.input.overlay_scale += 0.01f;
|
||||
|
||||
if (g_settings.input.overlay_scale > 2.0f)
|
||||
g_settings.input.overlay_scale = 2.0f;
|
||||
}
|
||||
|
||||
if (settings & (1ULL << S_DEF_INPUT_OVERLAY_SCALE))
|
||||
g_settings.input.overlay_opacity = 1.0f;
|
||||
#endif
|
||||
|
||||
if (settings & (1ULL << S_VIDEO_VSYNC_TOGGLE))
|
||||
g_settings.video.vsync = !g_settings.video.vsync;
|
||||
|
||||
if (settings & (1ULL << S_DEF_VIDEO_VSYNC))
|
||||
g_settings.video.vsync = true;
|
||||
|
||||
if (settings & (1ULL << S_ASPECT_RATIO_DECREMENT))
|
||||
{
|
||||
if (g_settings.video.aspect_ratio_idx > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user