diff --git a/config.def.h b/config.def.h index ce1325ba6f..1d307de80e 100644 --- a/config.def.h +++ b/config.def.h @@ -237,6 +237,7 @@ /* Enable automatic switching of the screen refresh rate when using the specified screen mode(s), * based on running core/content */ #define DEFAULT_AUTOSWITCH_REFRESH_RATE AUTOSWITCH_REFRESH_RATE_EXCLUSIVE_FULLSCREEN +#define DEFAULT_AUTOSWITCH_PAL_THRESHOLD 54.50f /* Which monitor to prefer. 0 is any monitor, 1 and up selects * specific monitors, 1 being the first monitor. */ diff --git a/configuration.c b/configuration.c index c6a6951ac4..d5b52ed9e4 100644 --- a/configuration.c +++ b/configuration.c @@ -2199,6 +2199,7 @@ static struct config_float_setting *populate_settings_float( SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, DEFAULT_ASPECT_RATIO, false); SETTING_FLOAT("video_refresh_rate", &settings->floats.video_refresh_rate, true, DEFAULT_REFRESH_RATE, false); + SETTING_FLOAT("video_autoswitch_pal_threshold", &settings->floats.video_autoswitch_pal_threshold, true, DEFAULT_AUTOSWITCH_PAL_THRESHOLD, false); SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, DEFAULT_CRT_REFRESH_RATE, false); SETTING_FLOAT("video_message_pos_x", &settings->floats.video_msg_pos_x, true, DEFAULT_MESSAGE_POS_OFFSET_X, false); SETTING_FLOAT("video_message_pos_y", &settings->floats.video_msg_pos_y, true, DEFAULT_MESSAGE_POS_OFFSET_Y, false); diff --git a/configuration.h b/configuration.h index e4bffb2af5..3835d27614 100644 --- a/configuration.h +++ b/configuration.h @@ -359,6 +359,7 @@ typedef struct settings float placeholder; float video_aspect_ratio; float video_refresh_rate; + float video_autoswitch_pal_threshold; float crt_video_refresh_rate; float video_font_size; float video_msg_pos_x; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index a844f22487..70cbeb3c46 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -1232,6 +1232,7 @@ void video_switch_refresh_rate_maybe( float refresh_rate = *refresh_rate_suggest; float video_refresh_rate = settings->floats.video_refresh_rate; + float pal_threshold = settings->floats.video_autoswitch_pal_threshold; unsigned crt_switch_resolution = settings->uints.crt_switch_resolution; unsigned autoswitch_refresh_rate = settings->uints.video_autoswitch_refresh_rate; unsigned video_swap_interval = runloop_get_video_swap_interval( @@ -1243,7 +1244,7 @@ void video_switch_refresh_rate_maybe( bool all_fullscreen = settings->bools.video_fullscreen || settings->bools.video_windowed_fullscreen; /* Roundings to PAL & NTSC standards */ - if (refresh_rate > 49.00 && refresh_rate < 54.50) + if (refresh_rate > 49.00 && refresh_rate <= pal_threshold) refresh_rate = 50.00f; else if (refresh_rate > 54.00 && refresh_rate < 60.00) refresh_rate = 59.94f; diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index d471fcb752..69f17a5ca2 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2135,11 +2135,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_AUTOSWITCH_REFRESH_RATE, - "Switch Refresh Rate Automatically" + "Automatic Refresh Rate Switch" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_AUTOSWITCH_REFRESH_RATE, - "Switch the refresh rate of the screen automatically when using the specified screen mode, based on the core and/or content being run." + "Switch screen refresh rate automatically based on current content." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_AUTOSWITCH_REFRESH_RATE_EXCLUSIVE_FULLSCREEN, @@ -2153,6 +2153,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_AUTOSWITCH_REFRESH_RATE_ALL_FULLSCREEN, "All Fullscreen Modes" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_AUTOSWITCH_PAL_THRESHOLD, + "Automatic Refresh Rate PAL Threshold" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_AUTOSWITCH_PAL_THRESHOLD, + "Maximum refresh rate to be considered PAL." + ) #if defined(DINGUX) && defined(DINGUX_BETA) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_DINGUX_REFRESH_RATE, diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 124c9a5508..790bbc73fc 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -680,6 +680,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_force_srgb_enable, MENU_ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_fullscreen, MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_windowed_fullscreen, MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_autoswitch_refresh_rate, MENU_ENUM_SUBLABEL_VIDEO_AUTOSWITCH_REFRESH_RATE) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_autoswitch_pal_threshold,MENU_ENUM_SUBLABEL_VIDEO_AUTOSWITCH_PAL_THRESHOLD) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_gpu_record, MENU_ENUM_SUBLABEL_VIDEO_GPU_RECORD) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_savestate_auto_index, MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_INDEX) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_block_sram_overwrite, MENU_ENUM_SUBLABEL_BLOCK_SRAM_OVERWRITE) @@ -4047,6 +4048,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_AUTOSWITCH_REFRESH_RATE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_autoswitch_refresh_rate); break; + case MENU_ENUM_LABEL_VIDEO_AUTOSWITCH_PAL_THRESHOLD: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_autoswitch_pal_threshold); + break; case MENU_ENUM_LABEL_VIDEO_FORCE_SRGB_DISABLE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_force_srgb_enable); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 615ccab028..c5f06d4177 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -9245,6 +9245,11 @@ unsigned menu_displaylist_build_list( MENU_ENUM_LABEL_VIDEO_AUTOSWITCH_REFRESH_RATE, PARSE_ONLY_UINT, false) == 0) count++; + + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_VIDEO_AUTOSWITCH_PAL_THRESHOLD, + PARSE_ONLY_FLOAT, false) == 0) + count++; } if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, MENU_ENUM_LABEL_VIDEO_FORCE_SRGB_DISABLE, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index f8042c02e3..7b7e58501b 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -11049,7 +11049,7 @@ static bool setting_append_list( (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_uint_replay_checkpoint_interval; - menu_settings_list_current_add_range(list, list_info, 0, 3600, 60, true, false); + menu_settings_list_current_add_range(list, list_info, 0, 3600, 60, true, true); #endif CONFIG_BOOL( @@ -12242,6 +12242,21 @@ static bool setting_append_list( menu_settings_list_current_add_range(list, list_info, 0, AUTOSWITCH_REFRESH_RATE_LAST - 1, 1, true, true); (*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX; + CONFIG_FLOAT( + list, list_info, + &settings->floats.video_autoswitch_pal_threshold, + MENU_ENUM_LABEL_VIDEO_AUTOSWITCH_PAL_THRESHOLD, + MENU_ENUM_LABEL_VALUE_VIDEO_AUTOSWITCH_PAL_THRESHOLD, + DEFAULT_AUTOSWITCH_PAL_THRESHOLD, + "%.3f Hz", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_range(list, list_info, 50, 56, 0.1, true, true); + SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT); + if (string_is_equal(settings->arrays.video_driver, "gl")) { CONFIG_BOOL( diff --git a/msg_hash.h b/msg_hash.h index d852b6638e..30192e2d05 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1305,6 +1305,7 @@ enum msg_hash_enums MENU_LBL_H(VIDEO_HARD_SYNC_FRAMES), MENU_LABEL(VIDEO_WINDOWED_FULLSCREEN), MENU_LABEL(VIDEO_AUTOSWITCH_REFRESH_RATE), + MENU_LABEL(VIDEO_AUTOSWITCH_PAL_THRESHOLD), MENU_ENUM_LABEL_VALUE_VIDEO_AUTOSWITCH_REFRESH_RATE_EXCLUSIVE_FULLSCREEN, MENU_ENUM_LABEL_VALUE_VIDEO_AUTOSWITCH_REFRESH_RATE_WINDOWED_FULLSCREEN,