diff --git a/gfx/video_crt_switch.c b/gfx/video_crt_switch.c index 90a6f6b481..d848ae5ae0 100644 --- a/gfx/video_crt_switch.c +++ b/gfx/video_crt_switch.c @@ -48,6 +48,24 @@ static void crt_check_first_run(void) first_run = false; } +static void switch_crt_hz(void) +{ + if (ra_core_hz == ra_tmp_core_hz) + return; + /* set hz float to an int for windows switching */ + if (ra_core_hz < 53) + ra_set_core_hz = 50; + if (ra_core_hz >= 53 && ra_core_hz < 57) + ra_set_core_hz = 55; + if (ra_core_hz >= 57) + ra_set_core_hz = 60; + + video_monitor_set_refresh_rate(ra_set_core_hz); + + ra_tmp_core_hz = ra_core_hz; +} + + static void crt_aspect_ratio_switch(unsigned width, unsigned height) { /* send aspect float to videeo_driver */ @@ -60,7 +78,7 @@ static void switch_res_crt(unsigned width, unsigned height) if (height > 100) { video_display_server_switch_resolution(width, height, - 0, ra_core_hz); + ra_set_core_hz, ra_core_hz); video_driver_apply_state_changes(); } } @@ -68,7 +86,8 @@ static void switch_res_crt(unsigned width, unsigned height) /* Create correct aspect to fit video if resolution does not exist */ static void crt_screen_setup_aspect(unsigned width, unsigned height) { - + + switch_crt_hz(); /* get original resolution of core */ if (height == 4) { diff --git a/gfx/video_display_server.c b/gfx/video_display_server.c index 72fe658796..9e24223e8f 100644 --- a/gfx/video_display_server.c +++ b/gfx/video_display_server.c @@ -84,9 +84,9 @@ bool video_display_server_set_window_decorations(bool on) bool video_display_server_switch_resolution(unsigned width, unsigned height, - int f_restore, float hz) + int win_hz, float hz) { if (current_display_server && current_display_server->switch_resolution) - return current_display_server->switch_resolution(current_display_server_data, width, height, f_restore, hz); + return current_display_server->switch_resolution(current_display_server_data, width, height, win_hz, hz); return false; } diff --git a/gfx/video_display_server.h b/gfx/video_display_server.h index 719edc8d7b..5f86523d47 100644 --- a/gfx/video_display_server.h +++ b/gfx/video_display_server.h @@ -31,7 +31,7 @@ typedef struct video_display_server bool (*set_window_progress)(void *data, int progress, bool finished); bool (*set_window_decorations)(void *data, bool on); bool (*switch_resolution)(void *data, unsigned width, - unsigned height, int f_restore, float hz); + unsigned height, int win_hz, float hz); const char *ident; } video_display_server_t; @@ -47,7 +47,7 @@ bool video_display_server_set_window_decorations(bool on); bool video_display_server_switch_resolution( unsigned width, unsigned height, - int f_restore, float hz); + int win_hz, float hz); extern const video_display_server_t dispserv_win32; extern const video_display_server_t dispserv_x11;