mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
Added functions for new CRT SwitchRes options
This commit is contained in:
parent
0da456e48c
commit
c362a6d7f4
@ -31,6 +31,7 @@ static unsigned ra_tmp_height = 0;
|
||||
static unsigned ra_set_core_hz = 0;
|
||||
static unsigned orig_width = 0;
|
||||
static unsigned orig_height = 0;
|
||||
static int crt_center_adjust = 0;
|
||||
|
||||
static bool first_run = true;
|
||||
|
||||
@ -53,12 +54,25 @@ 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;
|
||||
if (ra_core_hz < 100)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if (ra_core_hz > 100)
|
||||
{
|
||||
if (ra_core_hz < 106)
|
||||
ra_set_core_hz = 120;
|
||||
if (ra_core_hz >= 106 && ra_core_hz < 114)
|
||||
ra_set_core_hz = 110;
|
||||
if (ra_core_hz >= 114)
|
||||
ra_set_core_hz = 120;
|
||||
}
|
||||
|
||||
video_monitor_set_refresh_rate(ra_set_core_hz);
|
||||
|
||||
@ -78,7 +92,7 @@ static void switch_res_crt(unsigned width, unsigned height)
|
||||
if (height > 100)
|
||||
{
|
||||
video_display_server_switch_resolution(width, height,
|
||||
ra_set_core_hz, ra_core_hz);
|
||||
ra_set_core_hz, ra_core_hz, crt_center_adjust);
|
||||
video_driver_apply_state_changes();
|
||||
}
|
||||
}
|
||||
@ -149,13 +163,23 @@ static void crt_screen_setup_aspect(unsigned width, unsigned height)
|
||||
}
|
||||
|
||||
|
||||
void crt_switch_res_core(unsigned width, unsigned height, float hz)
|
||||
void crt_switch_res_core(unsigned width, unsigned height, float hz, unsigned crt_mode, int crt_switch_center_adjust)
|
||||
{
|
||||
/* ra_core_hz float passed from within
|
||||
* void video_driver_monitor_adjust_system_rates(void) */
|
||||
ra_core_width = width;
|
||||
ra_core_height = height;
|
||||
ra_core_hz = hz;
|
||||
crt_center_adjust = crt_switch_center_adjust;
|
||||
|
||||
if (crt_mode == 2)
|
||||
{
|
||||
if (hz > 53)
|
||||
ra_core_hz = hz*2;
|
||||
|
||||
if (hz <= 53)
|
||||
ra_core_hz = 120.0f;
|
||||
}
|
||||
|
||||
crt_check_first_run();
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
void crt_switch_res_core(unsigned width, unsigned height, float hz);
|
||||
void crt_switch_res_core(unsigned width, unsigned height, float hz, unsigned crt_mode, int crt_switch_center_adjust);
|
||||
|
||||
void crt_aspect_ratio_switch(unsigned width, unsigned height);
|
||||
|
||||
|
@ -84,10 +84,10 @@ bool video_display_server_set_window_decorations(bool on)
|
||||
|
||||
|
||||
bool video_display_server_switch_resolution(unsigned width, unsigned height,
|
||||
int int_hz, float hz)
|
||||
int int_hz, float hz, int center)
|
||||
{
|
||||
if (current_display_server && current_display_server->switch_resolution)
|
||||
return current_display_server->switch_resolution(current_display_server_data, width, height, int_hz, hz);
|
||||
return current_display_server->switch_resolution(current_display_server_data, width, height, int_hz, hz, center);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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 int_hz, float hz);
|
||||
unsigned height, int int_hz, float hz, int center);
|
||||
const char *(*get_output_options)(void *data);
|
||||
const char *ident;
|
||||
} video_display_server_t;
|
||||
@ -48,7 +48,7 @@ bool video_display_server_set_window_decorations(bool on);
|
||||
|
||||
bool video_display_server_switch_resolution(
|
||||
unsigned width, unsigned height,
|
||||
int int_hz, float hz);
|
||||
int int_hz, float hz, int center);
|
||||
|
||||
const char *video_display_server_get_output_options(void);
|
||||
|
||||
|
@ -2643,7 +2643,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
width = 3840;
|
||||
if (video_info.crt_switch_resolution_super == 1920)
|
||||
width = 1920;
|
||||
crt_switch_res_core(width, height, video_driver_core_hz);
|
||||
crt_switch_res_core(width, height, video_driver_core_hz, video_info.crt_switch_resolution, video_info.crt_switch_center_adjust);
|
||||
}
|
||||
else if (!video_info.crt_switch_resolution)
|
||||
video_driver_crt_switching_active = false;
|
||||
@ -2743,6 +2743,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||
video_info->refresh_rate = settings->floats.video_refresh_rate;
|
||||
video_info->crt_switch_resolution = settings->uints.crt_switch_resolution;
|
||||
video_info->crt_switch_resolution_super = settings->uints.crt_switch_resolution_super;
|
||||
video_info->crt_switch_center_adjust = settings->ints.crt_switch_center_adjust;
|
||||
video_info->black_frame_insertion = settings->bools.video_black_frame_insertion;
|
||||
video_info->hard_sync = settings->bools.video_hard_sync;
|
||||
video_info->hard_sync_frames = settings->uints.video_hard_sync_frames;
|
||||
|
@ -429,6 +429,7 @@ typedef struct video_frame_info
|
||||
|
||||
int custom_vp_x;
|
||||
int custom_vp_y;
|
||||
int crt_switch_center_adjust;
|
||||
|
||||
unsigned hard_sync_frames;
|
||||
unsigned aspect_ratio_idx;
|
||||
|
Loading…
Reference in New Issue
Block a user