Merge pull request #12840 from sonninnos/video-rate-59hz

Fix refresh rate 59Hz rounding
This commit is contained in:
Autechre 2021-08-21 18:54:43 +02:00 committed by GitHub
commit ac539f6316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6207,7 +6207,16 @@ int action_cb_push_dropdown_item_resolution(const char *path,
{
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_y = height;