Linux / windows hz bug fix

when merging Linux CRT refresh rate hz was dealt with in floats for Linux but ints for windows.
This commit is contained in:
alphanu1 2018-04-30 16:40:27 +01:00 committed by GitHub
parent e6dd809c8a
commit af3eb9e851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 6 deletions

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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;