(video_crt_switch.c) Turn a whole bunch of functions static
This commit is contained in:
parent
1c6a6c80f4
commit
4d87772f4a
|
@ -41,36 +41,7 @@ static float ra_tmp_core_hz = 0.0f;
|
|||
static float fly_aspect = 0.0f;
|
||||
static float ra_core_hz = 0.0f;
|
||||
|
||||
void crt_switch_res_core(int width, int height, float hz)
|
||||
{
|
||||
/* 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_check_first_run();
|
||||
|
||||
/* Detect resolution change and switch */
|
||||
if (
|
||||
(ra_tmp_height != ra_core_height) ||
|
||||
(ra_core_width != ra_tmp_width)
|
||||
)
|
||||
crt_screen_setup_aspect(width,height);
|
||||
|
||||
ra_tmp_height = ra_core_height;
|
||||
ra_tmp_width = ra_core_width;
|
||||
|
||||
/* Check if aspect is correct, if notchange */
|
||||
if (video_driver_get_aspect_ratio() != fly_aspect)
|
||||
{
|
||||
video_driver_set_aspect_ratio_value((float)fly_aspect);
|
||||
video_driver_apply_state_changes();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void crt_check_first_run(void)
|
||||
static void crt_check_first_run(void)
|
||||
{
|
||||
if (first_run != 1)
|
||||
{
|
||||
|
@ -84,109 +55,8 @@ void crt_check_first_run(void)
|
|||
first_run = 1;
|
||||
}
|
||||
|
||||
/* Create correct aspect to fit video if resolution does not exist */
|
||||
|
||||
void crt_screen_setup_aspect(int width, int height)
|
||||
{
|
||||
switch_crt_hz();
|
||||
|
||||
/* get original resolution of core */
|
||||
if (height == 4)
|
||||
{
|
||||
/* detect menu only */
|
||||
if (width < 1920)
|
||||
width = 640;
|
||||
height = 480;
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
}
|
||||
|
||||
if (height < 191 && height != 144)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 200;
|
||||
}
|
||||
|
||||
if (height > 191)
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
|
||||
if (height == 144 && ra_set_core_hz == 50)
|
||||
{
|
||||
height = 288;
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
}
|
||||
|
||||
if (height > 200 && height < 224)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 224;
|
||||
}
|
||||
|
||||
if (height > 224 && height < 240)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 240;
|
||||
}
|
||||
|
||||
if (height > 240 && height < 255)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 254;
|
||||
}
|
||||
|
||||
if (height == 528 && ra_set_core_hz == 60)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 480;
|
||||
}
|
||||
|
||||
if (height >= 240 && height < 255 && ra_set_core_hz == 55)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 254;
|
||||
}
|
||||
|
||||
switch_res_crt(width, height);
|
||||
}
|
||||
|
||||
void switch_res_crt(int width, int height)
|
||||
{
|
||||
if (height > 100)
|
||||
{
|
||||
crt_switch_res(width, height,0,ra_set_core_hz);
|
||||
video_driver_apply_state_changes();
|
||||
}
|
||||
}
|
||||
|
||||
void crt_aspect_ratio_switch(int width, int height)
|
||||
{
|
||||
/* send aspect float to videeo_driver */
|
||||
fly_aspect = (float)width / height;
|
||||
video_driver_set_aspect_ratio_value((float)fly_aspect);
|
||||
}
|
||||
|
||||
void switch_crt_hz(void)
|
||||
{
|
||||
if (ra_core_hz == ra_tmp_core_hz)
|
||||
return;
|
||||
|
||||
/* set hz float 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;
|
||||
}
|
||||
|
||||
void crt_video_restore(void)
|
||||
{
|
||||
crt_switch_res(orig_width, orig_height,0,60);
|
||||
}
|
||||
|
||||
|
||||
void crt_switch_res(int width, int height, int f_restore,int ra_hz)
|
||||
static void crt_switch_res(int width, int height,
|
||||
int f_restore,int ra_hz)
|
||||
{
|
||||
/* Windows function to switch resolutions */
|
||||
|
||||
|
@ -196,14 +66,12 @@ void crt_switch_res(int width, int height, int f_restore,int ra_hz)
|
|||
DEVMODE devmode;
|
||||
|
||||
int iModeNum;
|
||||
int freq;
|
||||
int freq = 0;
|
||||
DWORD flags = 0;
|
||||
int depth = 0;
|
||||
|
||||
if (f_restore == 0)
|
||||
freq = ra_hz;
|
||||
else
|
||||
freq = 0;
|
||||
|
||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &curDevmode);
|
||||
|
||||
|
@ -265,3 +133,132 @@ void crt_switch_res(int width, int height, int f_restore,int ra_hz)
|
|||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void switch_crt_hz(void)
|
||||
{
|
||||
if (ra_core_hz == ra_tmp_core_hz)
|
||||
return;
|
||||
|
||||
/* set hz float 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(int width, int height)
|
||||
{
|
||||
/* send aspect float to videeo_driver */
|
||||
fly_aspect = (float)width / height;
|
||||
video_driver_set_aspect_ratio_value((float)fly_aspect);
|
||||
}
|
||||
|
||||
static void switch_res_crt(int width, int height)
|
||||
{
|
||||
if (height > 100)
|
||||
{
|
||||
crt_switch_res(width, height,0,ra_set_core_hz);
|
||||
video_driver_apply_state_changes();
|
||||
}
|
||||
}
|
||||
|
||||
/* Create correct aspect to fit video if resolution does not exist */
|
||||
static void crt_screen_setup_aspect(int width, int height)
|
||||
{
|
||||
switch_crt_hz();
|
||||
|
||||
/* get original resolution of core */
|
||||
if (height == 4)
|
||||
{
|
||||
/* detect menu only */
|
||||
if (width < 1920)
|
||||
width = 640;
|
||||
height = 480;
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
}
|
||||
|
||||
if (height < 191 && height != 144)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 200;
|
||||
}
|
||||
|
||||
if (height > 191)
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
|
||||
if (height == 144 && ra_set_core_hz == 50)
|
||||
{
|
||||
height = 288;
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
}
|
||||
|
||||
if (height > 200 && height < 224)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 224;
|
||||
}
|
||||
|
||||
if (height > 224 && height < 240)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 240;
|
||||
}
|
||||
|
||||
if (height > 240 && height < 255)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 254;
|
||||
}
|
||||
|
||||
if (height == 528 && ra_set_core_hz == 60)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 480;
|
||||
}
|
||||
|
||||
if (height >= 240 && height < 255 && ra_set_core_hz == 55)
|
||||
{
|
||||
crt_aspect_ratio_switch(width,height);
|
||||
height = 254;
|
||||
}
|
||||
|
||||
switch_res_crt(width, height);
|
||||
}
|
||||
|
||||
|
||||
void crt_switch_res_core(int width, int height, float hz)
|
||||
{
|
||||
/* 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_check_first_run();
|
||||
|
||||
/* Detect resolution change and switch */
|
||||
if (
|
||||
(ra_tmp_height != ra_core_height) ||
|
||||
(ra_core_width != ra_tmp_width)
|
||||
)
|
||||
crt_screen_setup_aspect(width,height);
|
||||
|
||||
ra_tmp_height = ra_core_height;
|
||||
ra_tmp_width = ra_core_width;
|
||||
|
||||
/* Check if aspect is correct, if notchange */
|
||||
if (video_driver_get_aspect_ratio() != fly_aspect)
|
||||
{
|
||||
video_driver_set_aspect_ratio_value((float)fly_aspect);
|
||||
video_driver_apply_state_changes();
|
||||
}
|
||||
}
|
||||
|
||||
void crt_video_restore(void)
|
||||
{
|
||||
crt_switch_res(orig_width, orig_height, 0, 60);
|
||||
}
|
||||
|
|
|
@ -27,22 +27,10 @@
|
|||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
void crt_check_first_run(void);
|
||||
|
||||
void crt_switch_res_core(int width, int height, float hz);
|
||||
|
||||
void crt_screen_setup_aspect(int width, int height);
|
||||
|
||||
void switch_res_crt(int width, int height);
|
||||
|
||||
void crt_aspect_ratio_switch(int width,int height);
|
||||
|
||||
void switch_crt_hz(void);
|
||||
|
||||
void crt_video_restore(void);
|
||||
|
||||
void crt_switch_res(int width, int height, int f_restore, int ra_hz);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue