mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
new method
This commit is contained in:
parent
22e0560395
commit
fa8c9d7049
@ -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,
|
static bool win32_display_server_set_resolution(void *data,
|
||||||
unsigned width, unsigned height, int int_hz, float hz, int center)
|
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index)
|
||||||
{
|
{
|
||||||
DEVMODE curDevmode;
|
DEVMODE curDevmode;
|
||||||
int iModeNum;
|
int iModeNum;
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
static unsigned orig_width = 0;
|
static unsigned orig_width = 0;
|
||||||
static unsigned orig_height = 0;
|
static unsigned orig_height = 0;
|
||||||
static char old_mode[250] = {0};
|
static char old_mode[250] = {0};
|
||||||
|
static char orig_output[250] = NULL;
|
||||||
static char new_mode[250] = {0};
|
static char new_mode[250] = {0};
|
||||||
static char xrandr[250] = {0};
|
static char xrandr[250] = {0};
|
||||||
static char fbset[150] = {0};
|
static char fbset[150] = {0};
|
||||||
@ -64,26 +65,23 @@ static void x11_display_server_destroy(void *data)
|
|||||||
|
|
||||||
if (crt_en)
|
if (crt_en)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
snprintf(output, sizeof(output),
|
snprintf(output, sizeof(output),
|
||||||
"xrandr -s %dx%d", orig_width, orig_height);
|
"xrandr --newmode \"700x480_59.941002\" 13.849698 700 742 801 867 480 490 496 533 interlace -hsync -vsync")
|
||||||
|
system(output);
|
||||||
|
snprintf(output, sizeof(output),
|
||||||
|
"xrandr --addmode %s 700x480_59.941002", orig_output);
|
||||||
|
system(output);
|
||||||
|
snprintf(output, sizeof(output),
|
||||||
|
"xrandr --output %s --mode 700x480_59.941002", orig_output);
|
||||||
system(output);
|
system(output);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
snprintf(output, sizeof(output),
|
||||||
{
|
"xrandr --delmode %s %s",orig_mode, old_output);
|
||||||
snprintf(output, sizeof(output),
|
system(output);
|
||||||
"xrandr --delmode %s%d %s", "VGA", i, old_mode);
|
|
||||||
system(output);
|
|
||||||
snprintf(output, sizeof(output),
|
|
||||||
"xrandr --delmode %s-%d %s", "VGA", i, old_mode);
|
|
||||||
system(output);
|
|
||||||
|
|
||||||
snprintf(output, sizeof(output),
|
|
||||||
"xrandr --delmode %s%d %s", "DVI", i, old_mode);
|
|
||||||
system(output);
|
|
||||||
snprintf(output, sizeof(output),
|
|
||||||
"xrandr --delmode %s-%d %s", "DVI", i, old_mode);
|
|
||||||
system(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(output, sizeof(output), "xrandr --rmmode %s", old_mode);
|
snprintf(output, sizeof(output), "xrandr --rmmode %s", old_mode);
|
||||||
system(output);
|
system(output);
|
||||||
@ -126,7 +124,7 @@ static bool x11_display_server_set_window_decorations(void *data, bool on)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool x11_display_server_set_resolution(void *data,
|
static bool x11_display_server_set_resolution(void *data,
|
||||||
unsigned width, unsigned height, int int_hz, float hz, int center)
|
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int hfp = 0;
|
int hfp = 0;
|
||||||
@ -235,59 +233,66 @@ static bool x11_display_server_set_resolution(void *data,
|
|||||||
|
|
||||||
/* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to
|
/* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to
|
||||||
* add and delete modes */
|
* add and delete modes */
|
||||||
for (i = 0; i < 3; i++)
|
crt_rrmode.id = crtid;
|
||||||
|
crt_rrmode.width = width;
|
||||||
|
crt_rrmode.height = height;
|
||||||
|
crt_rrmode.dotClock = pixel_clock;
|
||||||
|
crt_rrmode.hSyncStart = hfp;
|
||||||
|
crt_rrmode.hSyncEnd = hsp;
|
||||||
|
crt_rrmode.hTotal = hmax;
|
||||||
|
crt_rrmode.hSkew = 0;
|
||||||
|
crt_rrmode.vSyncStart = vfp;
|
||||||
|
crt_rrmode.vSyncEnd = vsp;
|
||||||
|
crt_rrmode.vTotal = vmax;
|
||||||
|
crt_rrmode.name = new_mode;
|
||||||
|
crt_rrmode.nameLength = sizeof(new_mode);
|
||||||
|
crt_rrmode.modeFlags = 0;
|
||||||
|
|
||||||
|
res = XRRGetScreenResources (dsp, window);
|
||||||
|
|
||||||
|
if (monitor_index == 0)
|
||||||
{
|
{
|
||||||
snprintf(output, sizeof(output), "xrandr --addmode %s%d %s", "DVI", i,
|
for (int i = 0; i < res->noutput; i++)
|
||||||
new_mode);
|
{
|
||||||
system(output);
|
|
||||||
snprintf(output, sizeof(output), "xrandr --delmode %s%d %s", "DVI", i,
|
|
||||||
old_mode);
|
XRROutputInfo *outputs = XRRGetOutputInfo (dsp, res, res->outputs[i]);
|
||||||
system(output);
|
|
||||||
}
|
if (outputs->connection == RR_Connected)
|
||||||
|
{
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
{
|
snprintf(output4, sizeof(output4),"xrandr --addmode %s %s",outputs->name ,new_mode);
|
||||||
snprintf(output, sizeof(output), "xrandr --addmode %s-%d %s", "DVI", i,
|
system(output4);
|
||||||
new_mode);
|
snprintf(output4, sizeof(output4),"xrandr --output %s --mode %s", outputs->name, new_mode);
|
||||||
system(output);
|
system(output4);
|
||||||
snprintf(output, sizeof(output), "xrandr --delmode %s-%d %s", "DVI", i,
|
|
||||||
old_mode);
|
snprintf(output4, sizeof(output4),"xrandr --delmode %s %s", outputs->name,old_mode);
|
||||||
system(output);
|
system(output4);
|
||||||
}
|
snprintf(output4, sizeof(output4),"xrandr --rmmode %s", old_mode);
|
||||||
|
system(output4);
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
snprintf(output, sizeof(output), "xrandr --addmode %s%d %s", "VGA", i, new_mode);
|
|
||||||
system(output);
|
|
||||||
snprintf(output, sizeof(output), "xrandr --delmode %s%d %s", "VGA", i, old_mode);
|
|
||||||
system(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
snprintf(output, sizeof(output), "xrandr --addmode %s-%d %s", "VGA", i, new_mode);
|
|
||||||
system(output);
|
|
||||||
snprintf(output, sizeof(output), "xrandr --delmode %s-%d %s", "VGA", i, old_mode);
|
|
||||||
system(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(output, sizeof(output), "xrandr -s %s", new_mode);
|
|
||||||
system(output);
|
|
||||||
|
|
||||||
/* remove old mode */
|
|
||||||
snprintf(output, sizeof(output), "xrandr --rmmode %s", old_mode);
|
|
||||||
system(output);
|
|
||||||
|
|
||||||
/* needs xdotool installed. needed to recapture window. */
|
|
||||||
system("xdotool windowactivate $(xdotool search --class RetroArch)");
|
|
||||||
|
|
||||||
/* variable for old mode */
|
|
||||||
snprintf(old_mode, sizeof(old_mode), "%s", new_mode);
|
|
||||||
|
|
||||||
/* needs xdotool installed. needed to recapture window. */
|
|
||||||
system("xdotool windowactivate $(xdotool search --class RetroArch)");
|
|
||||||
/* Second run needed as some times it runs to fast to capture first time */
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (monitor_index > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
XRROutputInfo *outputs = XRRGetOutputInfo (dsp, res, res->outputs[monitor_index]);
|
||||||
|
if (outputs->connection == RR_Connected)
|
||||||
|
{
|
||||||
|
snprintf(orig_output, sizeof(orig_output),"%s", outputs->name);
|
||||||
|
|
||||||
|
snprintf(output4, sizeof(output4),"xrandr --addmode %s %s",outputs->name ,new_mode);
|
||||||
|
system(output4);
|
||||||
|
snprintf(output4, sizeof(output4),"xrandr --output %s --mode %s", outputs->name, new_mode);
|
||||||
|
system(output4);
|
||||||
|
|
||||||
|
snprintf(output4, sizeof(output4),"xrandr --delmode %s %s", outputs->name, old_mode);
|
||||||
|
system(output4);
|
||||||
|
snprintf(output4, sizeof(output4),"xrandr --rmmode %s", old_mode);
|
||||||
|
system(output4);
|
||||||
|
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user