mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-10 13:42:23 +00:00
Fix native naming after new additions
CRT dynamic width changes Change menu detection width Using alternative variables for CRT width and height see output Add files via upload Add files via upload Add files via upload Add files via upload Add files via upload Add files via upload Add files via upload Add files via upload Add files via upload Add files via upload Add files via upload Update video_crt_switch.c Update video_crt_switch.c Update video_display_server.h Update video_display_server.c Update dispserv_win32.c Update dispserv_x11.c Update menu_cbs_ok.c X centring on the fly X centring on the fly Update dispserv_x11.c X centring on the fly Update dispserv_win32.c Fix dispserv_win32.c Fix dispserv_win32.c
This commit is contained in:
parent
84a784e28b
commit
e11c910c39
@ -116,7 +116,7 @@ static void win32_display_server_destroy(void *data)
|
||||
|
||||
if (win32_orig_width > 0 && win32_orig_height > 0)
|
||||
video_display_server_set_resolution(win32_orig_width, win32_orig_height,
|
||||
win32_orig_refresh, (float)win32_orig_refresh, crt_center, 0);
|
||||
win32_orig_refresh, (float)win32_orig_refresh, crt_center, 0, 0);
|
||||
|
||||
#ifdef HAS_TASKBAR_EXT
|
||||
if (g_taskbarList)
|
||||
@ -210,7 +210,7 @@ static bool win32_display_server_set_window_decorations(void *data, bool on)
|
||||
}
|
||||
|
||||
static bool win32_display_server_set_resolution(void *data,
|
||||
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index)
|
||||
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index, int xoffset)
|
||||
{
|
||||
DEVMODE curDevmode;
|
||||
int iModeNum;
|
||||
|
@ -45,6 +45,8 @@ static char xrandr[250] = {0};
|
||||
static char fbset[150] = {0};
|
||||
static char output[500] = {0};
|
||||
static char output4[500] = {0};
|
||||
static char crt_name[10] = {0};
|
||||
static int crt_name_id = 0;
|
||||
static bool crt_en = false;
|
||||
static unsigned crtid = 20;
|
||||
static XRRModeInfo crt_rrmode;
|
||||
@ -127,7 +129,7 @@ static bool x11_display_server_set_window_decorations(void *data, bool on)
|
||||
}
|
||||
|
||||
static bool x11_display_server_set_resolution(void *data,
|
||||
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index)
|
||||
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index, int xoffset)
|
||||
{
|
||||
int screen;
|
||||
Window window;
|
||||
@ -150,6 +152,9 @@ static bool x11_display_server_set_resolution(void *data,
|
||||
float pixel_clock = 0;
|
||||
|
||||
crt_en = true;
|
||||
crt_name_id += 1;
|
||||
snprintf(crt_name, sizeof(crt_name), "CRT%d", crt_name_id);
|
||||
|
||||
|
||||
snprintf(old_mode, sizeof(old_mode), "%s", new_mode);
|
||||
|
||||
@ -161,7 +166,7 @@ static bool x11_display_server_set_resolution(void *data,
|
||||
video_monitor_set_refresh_rate(hz);
|
||||
|
||||
/* following code is the mode line generator */
|
||||
hsp = (width * 1.140) + x_offset;
|
||||
hsp = (width * 1.140) - (xoffset*4);
|
||||
hfp = width * 1.055;
|
||||
pwidth = width;
|
||||
|
||||
@ -228,20 +233,20 @@ static bool x11_display_server_set_resolution(void *data,
|
||||
/* create interlaced newmode from modline variables */
|
||||
if (height < 300)
|
||||
{
|
||||
snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"CRT_%dx%d_%0.2f\" %f %d %d %d %d %d %d %d %d -hsync -vsync", width, height, hz, pixel_clock,
|
||||
snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%s_%dx%d_%0.2f\" %f %d %d %d %d %d %d %d %d -hsync -vsync",crt_name, width, height, hz, pixel_clock,
|
||||
width, hfp, hsp, hbp, height, vfp, vsp, vbp);
|
||||
system(xrandr);
|
||||
}
|
||||
/* create interlaced newmode from modline variables */
|
||||
if (height > 300)
|
||||
{
|
||||
snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"CRT_%dx%d_%0.2f\" %f %d %d %d %d %d %d %d %d interlace -hsync -vsync", width, height, hz, pixel_clock,
|
||||
snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%s_%dx%d_%0.2f\" %f %d %d %d %d %d %d %d %d interlace -hsync -vsync",crt_name, width, height, hz, pixel_clock,
|
||||
width, hfp, hsp, hbp, height, vfp, vsp, vbp);
|
||||
system(xrandr);
|
||||
}
|
||||
|
||||
/* variable for new mode */
|
||||
snprintf(new_mode, sizeof(new_mode), "CRT_%dx%d_%0.2f", width, height, hz);
|
||||
snprintf(new_mode, sizeof(new_mode), "%s_%dx%d_%0.2f",crt_name, width, height, hz);
|
||||
|
||||
/* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to
|
||||
* add and delete modes */
|
||||
|
@ -41,6 +41,7 @@ static unsigned ra_set_core_hz = 0;
|
||||
static unsigned orig_width = 0;
|
||||
static unsigned orig_height = 0;
|
||||
static int crt_center_adjust = 0;
|
||||
static int crt_tmp_center_adjust = 0;
|
||||
|
||||
static bool first_run = true;
|
||||
|
||||
@ -97,7 +98,7 @@ void crt_aspect_ratio_switch(unsigned width, unsigned height)
|
||||
static void switch_res_crt(unsigned width, unsigned height)
|
||||
{
|
||||
video_display_server_set_resolution(width, height,
|
||||
ra_set_core_hz, ra_core_hz, crt_center_adjust, crt_index);
|
||||
ra_set_core_hz, ra_core_hz, crt_center_adjust, crt_index, crt_center_adjust);
|
||||
#if defined(HAVE_VIDEOCORE)
|
||||
crt_rpi_switch(width, height, ra_core_hz);
|
||||
video_monitor_set_refresh_rate(ra_core_hz);
|
||||
@ -119,7 +120,7 @@ static void crt_screen_setup_aspect(unsigned width, unsigned height)
|
||||
if (height == 4)
|
||||
{
|
||||
/* detect menu only */
|
||||
if (width < 1920)
|
||||
if (width < 700)
|
||||
width = 320;
|
||||
|
||||
height = 240;
|
||||
@ -181,13 +182,19 @@ void crt_switch_res_core(unsigned width, unsigned height,
|
||||
{
|
||||
/* ra_core_hz float passed from within
|
||||
* void video_driver_monitor_adjust_system_rates(void) */
|
||||
if (width == 4 )
|
||||
{
|
||||
width = 320;
|
||||
height = 240;
|
||||
}
|
||||
|
||||
ra_core_width = width;
|
||||
ra_core_height = height;
|
||||
ra_core_hz = hz;
|
||||
|
||||
if (dynamic == true)
|
||||
ra_core_width = crt_compute_dynamic_width(width);
|
||||
else
|
||||
ra_core_width = width;
|
||||
|
||||
crt_center_adjust = crt_switch_center_adjust;
|
||||
crt_index = monitor_index;
|
||||
@ -206,12 +213,13 @@ void crt_switch_res_core(unsigned width, unsigned height,
|
||||
/* Detect resolution change and switch */
|
||||
if (
|
||||
(ra_tmp_height != ra_core_height) ||
|
||||
(ra_core_width != ra_tmp_width)
|
||||
(ra_core_width != ra_tmp_width) || (crt_center_adjust != crt_tmp_center_adjust)
|
||||
)
|
||||
crt_screen_setup_aspect(width, height);
|
||||
crt_screen_setup_aspect(ra_core_width, ra_core_height);
|
||||
|
||||
ra_tmp_height = ra_core_height;
|
||||
ra_tmp_width = ra_core_width;
|
||||
crt_tmp_center_adjust = crt_center_adjust;
|
||||
|
||||
/* Check if aspect is correct, if not change */
|
||||
if (video_driver_get_aspect_ratio() != fly_aspect)
|
||||
@ -231,20 +239,22 @@ void crt_video_restore(void)
|
||||
|
||||
int crt_compute_dynamic_width(int width)
|
||||
{
|
||||
double p_clock = 18000000;
|
||||
double p_clock = 15000000;
|
||||
int min_height = 261;
|
||||
int dynamic_width = 0;
|
||||
#if defined(HAVE_VIDEOCORE)
|
||||
double p_clock = 32000000;
|
||||
#endif
|
||||
|
||||
for (int i =1; i < 10; i++)
|
||||
for (int i =0; i < 10; i++)
|
||||
{
|
||||
dynamic_width = (width*0.5)*i;
|
||||
dynamic_width = (width*1.5)*i;
|
||||
if ((dynamic_width * min_height * ra_core_hz) > p_clock)
|
||||
return dynamic_width;
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return width;
|
||||
return dynamic_width;
|
||||
}
|
||||
|
||||
#if defined(HAVE_VIDEOCORE)
|
||||
@ -296,7 +306,7 @@ static void crt_rpi_switch(int width, int height, float hz)
|
||||
roundw = 1.34;
|
||||
hfp = width * 0.065;
|
||||
|
||||
hsp = width * 0.1433-hfp;
|
||||
hsp = width * 0.1433-hfp+(crt_center_adjust*4);
|
||||
|
||||
hbp = width * 0.3-hsp-hfp;
|
||||
|
||||
|
@ -90,10 +90,10 @@ bool video_display_server_set_window_decorations(bool on)
|
||||
}
|
||||
|
||||
bool video_display_server_set_resolution(unsigned width, unsigned height,
|
||||
int int_hz, float hz, int center, int monitor_index)
|
||||
int int_hz, float hz, int center, int monitor_index, int xoffset)
|
||||
{
|
||||
if (current_display_server && current_display_server->set_resolution)
|
||||
return current_display_server->set_resolution(current_display_server_data, width, height, int_hz, hz, center, monitor_index);
|
||||
return current_display_server->set_resolution(current_display_server_data, width, height, int_hz, hz, center, monitor_index, xoffset);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,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 (*set_resolution)(void *data, unsigned width,
|
||||
unsigned height, int int_hz, float hz, int center, int monitor_index);
|
||||
unsigned height, int int_hz, float hz, int center, int monitor_index, int xoffset);
|
||||
void *(*get_resolution_list)(void *data,
|
||||
unsigned *size);
|
||||
const char *(*get_output_options)(void *data);
|
||||
@ -60,7 +60,7 @@ bool video_display_server_set_window_decorations(bool on);
|
||||
|
||||
bool video_display_server_set_resolution(
|
||||
unsigned width, unsigned height,
|
||||
int int_hz, float hz, int center, int monitor_index);
|
||||
int int_hz, float hz, int center, int monitor_index, int xoffset);
|
||||
|
||||
void *video_display_server_get_resolution_list(unsigned *size);
|
||||
|
||||
|
@ -2648,6 +2648,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
width = 3840;
|
||||
if (video_info.crt_switch_resolution_super == 1920)
|
||||
width = 1920;
|
||||
|
||||
if (video_info.crt_switch_resolution_super == 1)
|
||||
video_driver_crt_dynamic_super_width = true;
|
||||
else
|
||||
|
@ -4725,7 +4725,7 @@ static int action_ok_push_dropdown_item_resolution(const char *path,
|
||||
refreshrate = strtoul(pch, NULL, 0);
|
||||
|
||||
if (video_display_server_set_resolution(width, height,
|
||||
refreshrate, (float)refreshrate, 0, 0))
|
||||
refreshrate, (float)refreshrate, 0, 0, 0))
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
|
@ -1195,10 +1195,11 @@ static void setting_get_string_representation_crt_switch_resolution_super(
|
||||
return;
|
||||
|
||||
if (*setting->value.target.unsigned_integer == 0)
|
||||
strlcpy(s, msg_hash_to_str(MSG_NATIVE), len);
|
||||
strlcpy(s, "NATIVE", len);
|
||||
else
|
||||
snprintf(s, len, "%d", *setting->value.target.unsigned_integer);
|
||||
/* TO DO make 1 read as DYNAMIC */
|
||||
|
||||
if (*setting->value.target.unsigned_integer == 1)
|
||||
strlcpy(s, "DYNAMIC", len);
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user