Fix refresh rate 59Hz rounding

This commit is contained in:
sonninnos 2021-08-21 18:20:15 +03:00
parent 11d5d3170d
commit 1e4557c09a

View File

@ -6207,7 +6207,16 @@ int action_cb_push_dropdown_item_resolution(const char *path,
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
video_monitor_set_refresh_rate((float)refreshrate); unsigned refresh_mod = round(refreshrate / 60.0f);
float refresh_exact = refreshrate;
/* 59 Hz is an inaccurate representation of the real value (59.94).
* And since we at this point only have the integer to work with,
* the exact float needs to be calculated for 'video_refresh_rate' */
if (refreshrate == (60.0f * refresh_mod) - 1)
refresh_exact = 59.94f * refresh_mod;
video_monitor_set_refresh_rate(refresh_exact);
settings->uints.video_fullscreen_x = width; settings->uints.video_fullscreen_x = width;
settings->uints.video_fullscreen_y = height; settings->uints.video_fullscreen_y = height;