Add 'Use Custom Refresh Rate' setting

This commit is contained in:
twinaphex 2018-09-17 01:56:18 +02:00
parent cb7d15bc2b
commit 04211662cf
26 changed files with 138 additions and 0 deletions

View File

@ -452,6 +452,7 @@ static const float refresh_rate = (32730.0 * 8192.0) / 4481134.0 ;
#else
static const float refresh_rate = 60/1.001;
#endif
static const float crt_refresh_rate = refresh_rate;
/* Allow games to set rotation. If false, rotation requests are
* honored, but ignored.

View File

@ -1234,6 +1234,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
struct config_bool_setting *tmp = (struct config_bool_setting*)malloc((*size + 1) * sizeof(struct config_bool_setting));
unsigned count = 0;
SETTING_BOOL("crt_switch_resolution_use_custom_refresh_rate", &settings->bools.crt_switch_custom_refresh_enable, true, false, false);
SETTING_BOOL("automatically_add_content_to_playlist", &settings->bools.automatically_add_content_to_playlist, true, automatically_add_content_to_playlist, false);
SETTING_BOOL("ui_companion_start_on_boot", &settings->bools.ui_companion_start_on_boot, true, ui_companion_start_on_boot, false);
SETTING_BOOL("ui_companion_enable", &settings->bools.ui_companion_enable, true, ui_companion_enable, false);
@ -1484,6 +1485,7 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, 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("audio_rate_control_delta", audio_get_float_ptr(AUDIO_ACTION_RATE_CONTROL_DELTA), true, rate_control_delta, false);
SETTING_FLOAT("audio_max_timing_skew", &settings->floats.audio_max_timing_skew, true, max_timing_skew, false);

View File

@ -190,6 +190,8 @@ typedef struct settings
bool quick_menu_show_information;
bool kiosk_mode_enable;
bool crt_switch_custom_refresh_enable;
/* Netplay */
bool netplay_public_announce;
bool netplay_start_as_spectator;
@ -296,6 +298,7 @@ typedef struct settings
float video_scale;
float video_aspect_ratio;
float video_refresh_rate;
float crt_video_refresh_rate;
float video_font_size;
float video_msg_pos_x;
float video_msg_pos_y;

View File

@ -3571,3 +3571,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3355,3 +3355,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3347,3 +3347,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3457,3 +3457,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3222,3 +3222,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -7469,3 +7469,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3381,3 +3381,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3441,3 +3441,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3842,3 +3842,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3342,3 +3342,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -1663,3 +1663,5 @@ MSG_HASH(MENU_ENUM_LABEL_CHEAT_COPY_MATCH,
"cheat_copy_match")
MSG_HASH(MENU_ENUM_LABEL_CHEAT_DELETE_MATCH,
"cheat_delete_match")
MSG_HASH(MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"crt_switch_resolution_use_custom_refresh_rate")

View File

@ -3224,3 +3224,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3652,3 +3652,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -7468,3 +7468,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3316,3 +3316,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3511,3 +3511,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -7469,3 +7469,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -3379,3 +3379,9 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING,
"X-Axis Centering"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use a custom refresh rate specified in the config file if needed.")
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
"Use Custom Refresh Rate")

View File

@ -70,6 +70,7 @@ default_sublabel_macro(action_bind_sublabel_quick_menu_override_options,
default_sublabel_macro(action_bind_sublabel_crt_switchres, MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION)
default_sublabel_macro(action_bind_sublabel_crt_switchres_super, MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER)
default_sublabel_macro(action_bind_sublabel_crt_switchres_x_axis_centering, MENU_ENUM_SUBLABEL_CRT_SWITCH_X_AXIS_CENTERING)
default_sublabel_macro(action_bind_sublabel_crt_switchres_use_custom_refresh_rate, MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE)
default_sublabel_macro(action_bind_sublabel_automatically_add_content_to_playlist, MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST)
default_sublabel_macro(action_bind_sublabel_driver_settings_list, MENU_ENUM_SUBLABEL_DRIVER_SETTINGS)
default_sublabel_macro(action_bind_sublabel_retro_achievements_settings_list, MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS)
@ -748,6 +749,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_CRT_SWITCH_X_AXIS_CENTERING:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_crt_switchres_x_axis_centering);
break;
case MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_crt_switchres_use_custom_refresh_rate);
break;
case MENU_ENUM_LABEL_AUDIO_RESAMPLER_QUALITY:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_resampler_quality);
break;

View File

@ -6299,6 +6299,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_CRT_SWITCH_X_AXIS_CENTERING,
PARSE_ONLY_INT, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
PARSE_ONLY_BOOL, false);
info->need_refresh = true;
info->need_push = true;

View File

@ -4603,6 +4603,22 @@ static bool setting_append_list(
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
menu_settings_list_current_add_range(list, list_info, -3, 4, 1.0, true, true);
CONFIG_BOOL(
list, list_info,
&settings->bools.crt_switch_custom_refresh_enable,
MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE,
audio_enable,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE
);
END_SUB_GROUP(list, list_info, parent_group);
END_GROUP(list, list_info, parent_group);
break;

View File

@ -696,6 +696,7 @@ enum msg_hash_enums
/* Video */
MENU_LABEL(CRT_SWITCH_RESOLUTION),
MENU_LABEL(CRT_SWITCH_RESOLUTION_SUPER),
MENU_LABEL(CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE),
MENU_LABEL(CRT_SWITCH_X_AXIS_CENTERING),
MENU_LABEL(VIDEO_FONT_ENABLE),
MENU_LABEL(VIDEO_FONT_PATH),

View File

@ -141,6 +141,10 @@
# video_fullscreen_x = 0
# video_fullscreen_y = 0
# Video refresh rate of your CRT monitor.
# Used to calculate a suitable audio input rate.
# crt_video_refresh_rate = 59.94
# Video refresh rate of your monitor.
# Used to calculate a suitable audio input rate.
# video_refresh_rate = 59.94