From fdf28e5259876941205ba84eca4bd113131b9927 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 19 Jul 2019 13:14:29 +0200 Subject: [PATCH] Turn more default values into macros --- config.def.h | 10 ++++------ configuration.c | 6 +++--- menu/menu_setting.c | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/config.def.h b/config.def.h index 1699865088..7297fbe501 100644 --- a/config.def.h +++ b/config.def.h @@ -562,15 +562,13 @@ static const float message_bgcolor_opacity = 1.0f; * If your monitor does not run at 60Hz, or something close to it, * disable VSync, and leave this at its default. */ #ifdef _3DS -static const float refresh_rate = (32730.0 * 8192.0) / 4481134.0 ; -static const float crt_refresh_rate = (32730.0 * 8192.0) / 4481134.0 ; +#define DEFAULT_REFRESH_RATE ((32730.0 * 8192.0) / 4481134.0) #elif defined(RARCH_CONSOLE) -static const float refresh_rate = 60/1.001; -static const float crt_refresh_rate = 60/1.001; +#define DEFAULT_REFRESH_RATE (60/1.001) #else -static const float refresh_rate = 60; -static const float crt_refresh_rate = 60; +#define DEFAULT_REFRESH_RATE (60) #endif +#define DEFAULT_CRT_REFRESH_RATE (DEFAULT_REFRESH_RATE) /* Allow games to set rotation. If false, rotation requests are * honored, but ignored. diff --git a/configuration.c b/configuration.c index 67b4e5d65e..15b8f494ca 100644 --- a/configuration.c +++ b/configuration.c @@ -1638,8 +1638,8 @@ static struct config_float_setting *populate_settings_float(settings_t *settings SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, DEFAULT_ASPECT_RATIO, false); SETTING_FLOAT("video_scale", &settings->floats.video_scale, false, 0.0f, false); - SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, crt_refresh_rate, false); - SETTING_FLOAT("video_refresh_rate", &settings->floats.video_refresh_rate, true, refresh_rate, false); + SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, DEFAULT_CRT_REFRESH_RATE, false); + SETTING_FLOAT("video_refresh_rate", &settings->floats.video_refresh_rate, true, DEFAULT_REFRESH_RATE, false); SETTING_FLOAT("audio_rate_control_delta", audio_get_float_ptr(AUDIO_ACTION_RATE_CONTROL_DELTA), true, DEFAULT_RATE_CONTROL_DELTA, false); SETTING_FLOAT("audio_max_timing_skew", &settings->floats.audio_max_timing_skew, true, DEFAULT_MAX_TIMING_SKEW, false); SETTING_FLOAT("audio_volume", &settings->floats.audio_volume, true, DEFAULT_AUDIO_VOLUME, false); @@ -2048,7 +2048,7 @@ void config_set_defaults(void) settings->floats.video_msg_color_b = ((message_color >> 0) & 0xff) / 255.0f; if (g_defaults.settings.video_refresh_rate > 0.0 && - g_defaults.settings.video_refresh_rate != refresh_rate) + g_defaults.settings.video_refresh_rate != DEFAULT_REFRESH_RATE) settings->floats.video_refresh_rate = g_defaults.settings.video_refresh_rate; if (DEFAULT_AUDIO_DEVICE) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index b4aada538c..842dc36002 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -8547,7 +8547,7 @@ static bool setting_append_list( &settings->floats.video_refresh_rate, MENU_ENUM_LABEL_VIDEO_REFRESH_RATE, MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, - refresh_rate, + DEFAULT_REFRESH_RATE, "%.3f Hz", &group_info, &subgroup_info, @@ -8562,7 +8562,7 @@ static bool setting_append_list( &settings->floats.video_refresh_rate, MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO, MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, - refresh_rate, + DEFAULT_REFRESH_RATE, "%.3f Hz", &group_info, &subgroup_info,