mirror of
https://github.com/libretro/RetroArch
synced 2025-02-09 09:39:56 +00:00
RPi Additions new switching method
Partil new switching method
This commit is contained in:
parent
e533dda94a
commit
76bf63f905
@ -1,206 +1,351 @@
|
|||||||
/* CRT SwitchRes Core
|
/* CRT SwitchRes Core
|
||||||
* Copyright (C) 2018 Alphanu / Ben Templeman.
|
* Copyright (C) 2018 Alphanu / Ben Templeman.
|
||||||
*
|
*
|
||||||
* RetroArch - A frontend for libretro.
|
* RetroArch - A frontend for libretro.
|
||||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||||
*
|
*
|
||||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||||
* of the GNU General Public License as published by the Free Software Found-
|
* of the GNU General Public License as published by the Free Software Found-
|
||||||
* ation, either version 3 of the License, or (at your option) any later version.
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "video_driver.h"
|
#include "video_driver.h"
|
||||||
#include "video_crt_switch.h"
|
#include "video_crt_switch.h"
|
||||||
#include "video_display_server.h"
|
#include "video_display_server.h"
|
||||||
|
|
||||||
static unsigned ra_core_width = 0;
|
#if defined(__arm__)
|
||||||
static unsigned ra_core_height = 0;
|
#include "include/userland/interface/vmcs_host/vc_vchi_gencmd.h"
|
||||||
static unsigned ra_tmp_width = 0;
|
#endif
|
||||||
static unsigned ra_tmp_height = 0;
|
|
||||||
static unsigned ra_set_core_hz = 0;
|
static unsigned ra_core_width = 0;
|
||||||
static unsigned orig_width = 0;
|
static unsigned ra_core_height = 0;
|
||||||
static unsigned orig_height = 0;
|
static unsigned ra_tmp_width = 0;
|
||||||
static int crt_center_adjust = 0;
|
static unsigned ra_tmp_height = 0;
|
||||||
|
static unsigned ra_set_core_hz = 0;
|
||||||
static bool first_run = true;
|
static unsigned orig_width = 0;
|
||||||
|
static unsigned orig_height = 0;
|
||||||
static float ra_tmp_core_hz = 0.0f;
|
static int crt_center_adjust = 0;
|
||||||
static float fly_aspect = 0.0f;
|
|
||||||
static float ra_core_hz = 0.0f;
|
static bool first_run = true;
|
||||||
|
|
||||||
static void crt_check_first_run(void)
|
static float ra_tmp_core_hz = 0.0f;
|
||||||
{
|
static float fly_aspect = 0.0f;
|
||||||
if (!first_run)
|
static float ra_core_hz = 0.0f;
|
||||||
return;
|
static unsigned crt_index = 0;
|
||||||
|
|
||||||
first_run = false;
|
static void crt_check_first_run(void)
|
||||||
}
|
{
|
||||||
|
if (!first_run)
|
||||||
static void switch_crt_hz(void)
|
return;
|
||||||
{
|
|
||||||
if (ra_core_hz == ra_tmp_core_hz)
|
first_run = false;
|
||||||
return;
|
}
|
||||||
/* set hz float to an int for windows switching */
|
|
||||||
if (ra_core_hz < 100)
|
static void switch_crt_hz(void)
|
||||||
{
|
{
|
||||||
if (ra_core_hz < 53)
|
if (ra_core_hz == ra_tmp_core_hz)
|
||||||
ra_set_core_hz = 50;
|
return;
|
||||||
if (ra_core_hz >= 53 && ra_core_hz < 57)
|
/* set hz float to an int for windows switching */
|
||||||
ra_set_core_hz = 55;
|
if (ra_core_hz < 100)
|
||||||
if (ra_core_hz >= 57)
|
{
|
||||||
ra_set_core_hz = 60;
|
if (ra_core_hz < 53)
|
||||||
}
|
ra_set_core_hz = 50;
|
||||||
|
if (ra_core_hz >= 53 && ra_core_hz < 57)
|
||||||
if (ra_core_hz > 100)
|
ra_set_core_hz = 55;
|
||||||
{
|
if (ra_core_hz >= 57)
|
||||||
if (ra_core_hz < 106)
|
ra_set_core_hz = 60;
|
||||||
ra_set_core_hz = 120;
|
}
|
||||||
if (ra_core_hz >= 106 && ra_core_hz < 114)
|
|
||||||
ra_set_core_hz = 110;
|
if (ra_core_hz > 100)
|
||||||
if (ra_core_hz >= 114)
|
{
|
||||||
ra_set_core_hz = 120;
|
if (ra_core_hz < 106)
|
||||||
}
|
ra_set_core_hz = 120;
|
||||||
|
if (ra_core_hz >= 106 && ra_core_hz < 114)
|
||||||
video_monitor_set_refresh_rate(ra_set_core_hz);
|
ra_set_core_hz = 110;
|
||||||
|
if (ra_core_hz >= 114)
|
||||||
ra_tmp_core_hz = ra_core_hz;
|
ra_set_core_hz = 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
void crt_aspect_ratio_switch(unsigned width, unsigned height)
|
video_monitor_set_refresh_rate(ra_set_core_hz);
|
||||||
{
|
|
||||||
/* send aspect float to videeo_driver */
|
ra_tmp_core_hz = ra_core_hz;
|
||||||
fly_aspect = (float)width / height;
|
}
|
||||||
video_driver_set_aspect_ratio_value((float)fly_aspect);
|
|
||||||
}
|
void crt_aspect_ratio_switch(unsigned width, unsigned height)
|
||||||
|
{
|
||||||
static void switch_res_crt(unsigned width, unsigned height)
|
/* send aspect float to videeo_driver */
|
||||||
{
|
fly_aspect = (float)width / height;
|
||||||
if (height > 100)
|
video_driver_set_aspect_ratio_value((float)fly_aspect);
|
||||||
{
|
}
|
||||||
video_display_server_set_resolution(width, height,
|
|
||||||
ra_set_core_hz, ra_core_hz, crt_center_adjust);
|
static void switch_res_crt(unsigned width, unsigned height)
|
||||||
video_driver_apply_state_changes();
|
{
|
||||||
}
|
video_display_server_set_resolution(width, height,
|
||||||
}
|
ra_set_core_hz, ra_core_hz, crt_center_adjust, crt_index);
|
||||||
|
#if defined(__arm__)
|
||||||
/* Create correct aspect to fit video if resolution does not exist */
|
crt_rpi_switch(width, height, ra_core_hz);
|
||||||
static void crt_screen_setup_aspect(unsigned width, unsigned height)
|
video_monitor_set_refresh_rate(ra_core_hz);
|
||||||
{
|
crt_switch_driver_reinit();
|
||||||
|
#endif
|
||||||
switch_crt_hz();
|
video_driver_apply_state_changes();
|
||||||
/* get original resolution of core */
|
}
|
||||||
if (height == 4)
|
|
||||||
{
|
/* Create correct aspect to fit video if resolution does not exist */
|
||||||
/* detect menu only */
|
static void crt_screen_setup_aspect(unsigned width, unsigned height)
|
||||||
if (width < 1920)
|
{
|
||||||
width = 320;
|
#if defined(__arm__)
|
||||||
|
if (height > 300)
|
||||||
height = 240;
|
height = height/2;
|
||||||
|
#endif
|
||||||
crt_aspect_ratio_switch(width, height);
|
|
||||||
}
|
switch_crt_hz();
|
||||||
|
/* get original resolution of core */
|
||||||
if (height < 200 && height != 144)
|
if (height == 4)
|
||||||
{
|
{
|
||||||
crt_aspect_ratio_switch(width, height);
|
/* detect menu only */
|
||||||
height = 200;
|
if (width < 1920)
|
||||||
}
|
width = 320;
|
||||||
|
|
||||||
if (height > 200)
|
height = 240;
|
||||||
crt_aspect_ratio_switch(width, height);
|
|
||||||
|
crt_aspect_ratio_switch(width, height);
|
||||||
if (height == 144 && ra_set_core_hz == 50)
|
}
|
||||||
{
|
|
||||||
height = 288;
|
if (height < 200 && height != 144)
|
||||||
crt_aspect_ratio_switch(width, height);
|
{
|
||||||
}
|
crt_aspect_ratio_switch(width, height);
|
||||||
|
height = 200;
|
||||||
if (height > 200 && height < 224)
|
}
|
||||||
{
|
|
||||||
crt_aspect_ratio_switch(width, height);
|
if (height > 200)
|
||||||
height = 224;
|
crt_aspect_ratio_switch(width, height);
|
||||||
}
|
|
||||||
|
if (height == 144 && ra_set_core_hz == 50)
|
||||||
if (height > 224 && height < 240)
|
{
|
||||||
{
|
height = 288;
|
||||||
crt_aspect_ratio_switch(width, height);
|
crt_aspect_ratio_switch(width, height);
|
||||||
height = 240;
|
}
|
||||||
}
|
|
||||||
|
if (height > 200 && height < 224)
|
||||||
if (height > 240 && height < 255)
|
{
|
||||||
{
|
crt_aspect_ratio_switch(width, height);
|
||||||
crt_aspect_ratio_switch(width, height);
|
height = 224;
|
||||||
height = 254;
|
}
|
||||||
}
|
|
||||||
|
if (height > 224 && height < 240)
|
||||||
if (height == 528 && ra_set_core_hz == 60)
|
{
|
||||||
{
|
crt_aspect_ratio_switch(width, height);
|
||||||
crt_aspect_ratio_switch(width, height);
|
height = 240;
|
||||||
height = 480;
|
}
|
||||||
}
|
|
||||||
|
if (height > 240 && height < 255)
|
||||||
if (height >= 240 && height < 255 && ra_set_core_hz == 55)
|
{
|
||||||
{
|
crt_aspect_ratio_switch(width, height);
|
||||||
crt_aspect_ratio_switch(width, height);
|
height = 254;
|
||||||
height = 254;
|
}
|
||||||
}
|
|
||||||
|
if (height == 528 && ra_set_core_hz == 60)
|
||||||
switch_res_crt(width, height);
|
{
|
||||||
}
|
crt_aspect_ratio_switch(width, height);
|
||||||
|
height = 480;
|
||||||
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
|
if (height >= 240 && height < 255 && ra_set_core_hz == 55)
|
||||||
* void video_driver_monitor_adjust_system_rates(void) */
|
{
|
||||||
ra_core_width = width;
|
crt_aspect_ratio_switch(width, height);
|
||||||
ra_core_height = height;
|
height = 254;
|
||||||
ra_core_hz = hz;
|
}
|
||||||
crt_center_adjust = crt_switch_center_adjust;
|
|
||||||
|
switch_res_crt(width, height);
|
||||||
if (crt_mode == 2)
|
}
|
||||||
{
|
|
||||||
if (hz > 53)
|
void crt_switch_res_core(unsigned width, unsigned height, float hz, unsigned crt_mode, int crt_switch_center_adjust)
|
||||||
ra_core_hz = hz * 2;
|
{
|
||||||
|
/* ra_core_hz float passed from within
|
||||||
if (hz <= 53)
|
* void video_driver_monitor_adjust_system_rates(void) */
|
||||||
ra_core_hz = 120.0f;
|
ra_core_width = width;
|
||||||
}
|
ra_core_height = height;
|
||||||
|
ra_core_hz = hz;
|
||||||
crt_check_first_run();
|
crt_center_adjust = crt_switch_center_adjust;
|
||||||
|
crt_index = monitor_index;
|
||||||
/* Detect resolution change and switch */
|
|
||||||
if (
|
if (crt_mode == 2)
|
||||||
(ra_tmp_height != ra_core_height) ||
|
{
|
||||||
(ra_core_width != ra_tmp_width)
|
if (hz > 53)
|
||||||
)
|
ra_core_hz = hz * 2;
|
||||||
crt_screen_setup_aspect(width, height);
|
|
||||||
|
if (hz <= 53)
|
||||||
ra_tmp_height = ra_core_height;
|
ra_core_hz = 120.0f;
|
||||||
ra_tmp_width = ra_core_width;
|
}
|
||||||
|
|
||||||
/* Check if aspect is correct, if notchange */
|
crt_check_first_run();
|
||||||
if (video_driver_get_aspect_ratio() != fly_aspect)
|
|
||||||
{
|
/* Detect resolution change and switch */
|
||||||
video_driver_set_aspect_ratio_value((float)fly_aspect);
|
if (
|
||||||
video_driver_apply_state_changes();
|
(ra_tmp_height != ra_core_height) ||
|
||||||
}
|
(ra_core_width != ra_tmp_width)
|
||||||
}
|
)
|
||||||
|
crt_screen_setup_aspect(width, height);
|
||||||
void crt_video_restore(void)
|
|
||||||
{
|
ra_tmp_height = ra_core_height;
|
||||||
if (first_run)
|
ra_tmp_width = ra_core_width;
|
||||||
return;
|
|
||||||
|
/* Check if aspect is correct, if notchange */
|
||||||
first_run = true;
|
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)
|
||||||
|
{
|
||||||
|
if (first_run)
|
||||||
|
return;
|
||||||
|
|
||||||
|
first_run = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__arm__)
|
||||||
|
static void crt_rpi_switch(int width, int height, float hz)
|
||||||
|
{
|
||||||
|
static char output[250] = {0};
|
||||||
|
static char output1[250] = {0};
|
||||||
|
static char output2[250] = {0};
|
||||||
|
static char set_hdmi[250] ={0};
|
||||||
|
static char set_hdmi_timing[250] = {0};
|
||||||
|
int i = 0;
|
||||||
|
int hfp = 0;
|
||||||
|
int hsp = 0;
|
||||||
|
int hbp = 0;
|
||||||
|
int vfp = 0;
|
||||||
|
int vsp = 0;
|
||||||
|
int vbp = 0;
|
||||||
|
int hmax = 0;
|
||||||
|
int vmax = 0;
|
||||||
|
int pdefault = 8;
|
||||||
|
int pwidth = 0;
|
||||||
|
float roundw = 0.0f;
|
||||||
|
float roundh = 0.0f;
|
||||||
|
float pixel_clock = 0;
|
||||||
|
int ip_flag = 0;
|
||||||
|
|
||||||
|
/* set core refresh from hz */
|
||||||
|
video_monitor_set_refresh_rate(hz);
|
||||||
|
|
||||||
|
/* following code is the mode line generator */
|
||||||
|
|
||||||
|
pwidth = width;
|
||||||
|
|
||||||
|
if (height < 400 && width > 400)
|
||||||
|
pwidth = width / 2;
|
||||||
|
|
||||||
|
roundw = roundf((float)pwidth / (float)height * 100) / 100;
|
||||||
|
|
||||||
|
if (height > width)
|
||||||
|
roundw = roundf((float)height / (float)width * 100) / 100;
|
||||||
|
|
||||||
|
if (roundw > 1.35)
|
||||||
|
roundw = 1.25;
|
||||||
|
|
||||||
|
if (roundw < 1.20)
|
||||||
|
roundw = 1.34;
|
||||||
|
hfp = width * 0.065;
|
||||||
|
|
||||||
|
hsp = width * 0.1433-hfp;
|
||||||
|
|
||||||
|
hbp = width * 0.3-hsp-hfp;
|
||||||
|
|
||||||
|
|
||||||
|
if (height < 241)
|
||||||
|
vmax = 261;
|
||||||
|
if (height < 241 && hz > 56 && hz < 58)
|
||||||
|
vmax = 280;
|
||||||
|
if (height < 241 && hz < 55)
|
||||||
|
vmax = 313;
|
||||||
|
if (height > 250 && height < 260 && hz > 54)
|
||||||
|
vmax = 296;
|
||||||
|
if (height > 250 && height < 260 && hz > 52 && hz < 54)
|
||||||
|
vmax = 285;
|
||||||
|
if (height > 250 && height < 260 && hz < 52)
|
||||||
|
vmax = 313;
|
||||||
|
if (height > 260 && height < 300)
|
||||||
|
vmax = 318;
|
||||||
|
|
||||||
|
if (height > 400 && hz > 56)
|
||||||
|
vmax = 533;
|
||||||
|
if (height > 520 && hz < 57)
|
||||||
|
vmax = 580;
|
||||||
|
|
||||||
|
if (height > 300 && hz < 56)
|
||||||
|
vmax = 615;
|
||||||
|
if (height > 500 && hz < 56)
|
||||||
|
vmax = 624;
|
||||||
|
if (height > 300)
|
||||||
|
pdefault = pdefault * 2;
|
||||||
|
|
||||||
|
vfp = (height + ((vmax - height) / 2) - pdefault) - height;
|
||||||
|
|
||||||
|
if (height < 300)
|
||||||
|
vsp = vfp + 3; /* needs to be 3 for progressive */
|
||||||
|
if (height > 300)
|
||||||
|
vsp = vfp + 6; /* needs to be 6 for interlaced */
|
||||||
|
|
||||||
|
vsp = 3;
|
||||||
|
|
||||||
|
vbp = (vmax-height)-vsp-vfp;
|
||||||
|
|
||||||
|
hmax = width+hfp+hsp+hbp;
|
||||||
|
|
||||||
|
if (height < 300)
|
||||||
|
{
|
||||||
|
pixel_clock = (hmax * vmax * hz) ;
|
||||||
|
ip_flag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height > 300)
|
||||||
|
{
|
||||||
|
pixel_clock = (hmax * vmax * (hz/2)) /2 ;
|
||||||
|
ip_flag = 1;
|
||||||
|
}
|
||||||
|
/* above code is the modeline generator */
|
||||||
|
|
||||||
|
snprintf(set_hdmi_timing, sizeof(set_hdmi_timings), "hdmi_timings %d 1 %d %d %d %d 1 %d %d %d 0 0 0 %f %d %f 1 ", width, hfp, hsp, hbp, height, vfp,vsp, vbp, hz, ip_flag, pixel_clock);
|
||||||
|
|
||||||
|
VCHI_INSTANCE_T vchi_instance;
|
||||||
|
VCHI_CONNECTION_T *vchi_connection = NULL;
|
||||||
|
char buffer[1024];
|
||||||
|
|
||||||
|
vcos_init ();
|
||||||
|
|
||||||
|
vchi_initialise (&vchi_instance);
|
||||||
|
|
||||||
|
vchi_connect (NULL, 0, vchi_instance);
|
||||||
|
|
||||||
|
vc_vchi_gencmd_init (vchi_instance, &vchi_connection, 1);
|
||||||
|
|
||||||
|
|
||||||
|
vc_gencmd (buffer, sizeof (buffer), set_hdmi_timing);
|
||||||
|
|
||||||
|
vc_gencmd_stop ();
|
||||||
|
|
||||||
|
vchi_disconnect (vchi_instance);
|
||||||
|
|
||||||
|
snprintf(output1, sizeof(output1),"tvservice -e \"DMT 87\" > /dev/null");
|
||||||
|
system(output1);
|
||||||
|
snprintf(output2, sizeof(output1),"fbset -g %d %d %d %d 24 > /dev/null",width, height, width, height);
|
||||||
|
system(output2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
/* CRT SwitchRes Core
|
/* CRT SwitchRes Core
|
||||||
* Copyright (C) 2018 Alphanu / Ben Templeman.
|
* Copyright (C) 2018 Alphanu / Ben Templeman.
|
||||||
*
|
*
|
||||||
* RetroArch - A frontend for libretro.
|
* RetroArch - A frontend for libretro.
|
||||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||||
*
|
*
|
||||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||||
* of the GNU General Public License as published by the Free Software Found-
|
* of the GNU General Public License as published by the Free Software Found-
|
||||||
* ation, either version 3 of the License, or (at your option) any later version.
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __VIDEO_CRT_SWITCH_H__
|
#ifndef __VIDEO_CRT_SWITCH_H__
|
||||||
#define __VIDEO_CRT_SWITCH_H__
|
#define __VIDEO_CRT_SWITCH_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
#include <retro_common_api.h>
|
#include <retro_common_api.h>
|
||||||
|
|
||||||
RETRO_BEGIN_DECLS
|
RETRO_BEGIN_DECLS
|
||||||
|
|
||||||
void crt_switch_res_core(unsigned width, unsigned height, float hz, unsigned crt_mode, int crt_switch_center_adjust);
|
void crt_switch_res_core(unsigned width, unsigned height, float hz, unsigned crt_mode, int crt_switch_center_adjust, int monitor_index);
|
||||||
|
|
||||||
void crt_aspect_ratio_switch(unsigned width, unsigned height);
|
void crt_aspect_ratio_switch(unsigned width, unsigned height);
|
||||||
|
|
||||||
void crt_video_restore(void);
|
void crt_video_restore(void);
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,112 +1,112 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
/* RetroArch - A frontend for libretro.
|
||||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||||
* Copyright (C) 2016-2017 - Brad Parker
|
* Copyright (C) 2016-2017 - Brad Parker
|
||||||
*
|
*
|
||||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||||
* of the GNU General Public License as published by the Free Software Found-
|
* of the GNU General Public License as published by the Free Software Found-
|
||||||
* ation, either version 3 of the License, or (at your option) any later version.
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "video_display_server.h"
|
#include "video_display_server.h"
|
||||||
#include "video_driver.h"
|
#include "video_driver.h"
|
||||||
#include "../verbosity.h"
|
#include "../verbosity.h"
|
||||||
|
|
||||||
static const video_display_server_t *current_display_server = &dispserv_null;
|
static const video_display_server_t *current_display_server = &dispserv_null;
|
||||||
static void *current_display_server_data = NULL;
|
static void *current_display_server_data = NULL;
|
||||||
|
|
||||||
const char *video_display_server_get_ident(void)
|
const char *video_display_server_get_ident(void)
|
||||||
{
|
{
|
||||||
if (!current_display_server)
|
if (!current_display_server)
|
||||||
return "null";
|
return "null";
|
||||||
return current_display_server->ident;
|
return current_display_server->ident;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* video_display_server_init(void)
|
void* video_display_server_init(void)
|
||||||
{
|
{
|
||||||
enum rarch_display_type type = video_driver_display_type_get();
|
enum rarch_display_type type = video_driver_display_type_get();
|
||||||
|
|
||||||
video_display_server_destroy();
|
video_display_server_destroy();
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case RARCH_DISPLAY_WIN32:
|
case RARCH_DISPLAY_WIN32:
|
||||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||||
current_display_server = &dispserv_win32;
|
current_display_server = &dispserv_win32;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case RARCH_DISPLAY_X11:
|
case RARCH_DISPLAY_X11:
|
||||||
#if defined(HAVE_X11)
|
#if defined(HAVE_X11)
|
||||||
current_display_server = &dispserv_x11;
|
current_display_server = &dispserv_x11;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
current_display_server = &dispserv_null;
|
current_display_server = &dispserv_null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_display_server_data = current_display_server->init();
|
current_display_server_data = current_display_server->init();
|
||||||
|
|
||||||
RARCH_LOG("[Video]: Found display server: %s\n",
|
RARCH_LOG("[Video]: Found display server: %s\n",
|
||||||
current_display_server->ident);
|
current_display_server->ident);
|
||||||
|
|
||||||
return current_display_server_data;
|
return current_display_server_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_display_server_destroy(void)
|
void video_display_server_destroy(void)
|
||||||
{
|
{
|
||||||
if (current_display_server && current_display_server->destroy)
|
if (current_display_server && current_display_server->destroy)
|
||||||
if (current_display_server_data)
|
if (current_display_server_data)
|
||||||
current_display_server->destroy(current_display_server_data);
|
current_display_server->destroy(current_display_server_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool video_display_server_set_window_opacity(unsigned opacity)
|
bool video_display_server_set_window_opacity(unsigned opacity)
|
||||||
{
|
{
|
||||||
if (current_display_server && current_display_server->set_window_opacity)
|
if (current_display_server && current_display_server->set_window_opacity)
|
||||||
return current_display_server->set_window_opacity(current_display_server_data, opacity);
|
return current_display_server->set_window_opacity(current_display_server_data, opacity);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool video_display_server_set_window_progress(int progress, bool finished)
|
bool video_display_server_set_window_progress(int progress, bool finished)
|
||||||
{
|
{
|
||||||
if (current_display_server && current_display_server->set_window_progress)
|
if (current_display_server && current_display_server->set_window_progress)
|
||||||
return current_display_server->set_window_progress(current_display_server_data, progress, finished);
|
return current_display_server->set_window_progress(current_display_server_data, progress, finished);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool video_display_server_set_window_decorations(bool on)
|
bool video_display_server_set_window_decorations(bool on)
|
||||||
{
|
{
|
||||||
if (current_display_server && current_display_server->set_window_decorations)
|
if (current_display_server && current_display_server->set_window_decorations)
|
||||||
return current_display_server->set_window_decorations(current_display_server_data, on);
|
return current_display_server->set_window_decorations(current_display_server_data, on);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool video_display_server_set_resolution(unsigned width, unsigned height,
|
bool video_display_server_set_resolution(unsigned width, unsigned height,
|
||||||
int int_hz, float hz, int center)
|
int int_hz, float hz, int center, int monitor_index)
|
||||||
{
|
{
|
||||||
if (current_display_server && current_display_server->set_resolution)
|
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);
|
return current_display_server->set_resolution(current_display_server_data, width, height, int_hz, hz, center, monitor_index);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *video_display_server_get_resolution_list(unsigned *size)
|
void *video_display_server_get_resolution_list(unsigned *size)
|
||||||
{
|
{
|
||||||
if (current_display_server && current_display_server->get_resolution_list)
|
if (current_display_server && current_display_server->get_resolution_list)
|
||||||
return current_display_server->get_resolution_list(current_display_server_data, size);
|
return current_display_server->get_resolution_list(current_display_server_data, size);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *video_display_server_get_output_options(void)
|
const char *video_display_server_get_output_options(void)
|
||||||
{
|
{
|
||||||
if (current_display_server && current_display_server->get_output_options)
|
if (current_display_server && current_display_server->get_output_options)
|
||||||
return current_display_server->get_output_options(current_display_server_data);
|
return current_display_server->get_output_options(current_display_server_data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1,77 +1,77 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
/* RetroArch - A frontend for libretro.
|
||||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||||
* Copyright (C) 2016-2017 - Brad Parker
|
* Copyright (C) 2016-2017 - Brad Parker
|
||||||
*
|
*
|
||||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||||
* of the GNU General Public License as published by the Free Software Found-
|
* of the GNU General Public License as published by the Free Software Found-
|
||||||
* ation, either version 3 of the License, or (at your option) any later version.
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __VIDEO_DISPLAY_SERVER__H
|
#ifndef __VIDEO_DISPLAY_SERVER__H
|
||||||
#define __VIDEO_DISPLAY_SERVER__H
|
#define __VIDEO_DISPLAY_SERVER__H
|
||||||
|
|
||||||
#include <retro_common_api.h>
|
#include <retro_common_api.h>
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
|
|
||||||
RETRO_BEGIN_DECLS
|
RETRO_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct video_display_config
|
typedef struct video_display_config
|
||||||
{
|
{
|
||||||
unsigned width;
|
unsigned width;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
unsigned bpp;
|
unsigned bpp;
|
||||||
unsigned refreshrate;
|
unsigned refreshrate;
|
||||||
unsigned idx;
|
unsigned idx;
|
||||||
bool current;
|
bool current;
|
||||||
} video_display_config_t;
|
} video_display_config_t;
|
||||||
|
|
||||||
typedef struct video_display_server
|
typedef struct video_display_server
|
||||||
{
|
{
|
||||||
void *(*init)(void);
|
void *(*init)(void);
|
||||||
void (*destroy)(void *data);
|
void (*destroy)(void *data);
|
||||||
bool (*set_window_opacity)(void *data, unsigned opacity);
|
bool (*set_window_opacity)(void *data, unsigned opacity);
|
||||||
bool (*set_window_progress)(void *data, int progress, bool finished);
|
bool (*set_window_progress)(void *data, int progress, bool finished);
|
||||||
bool (*set_window_decorations)(void *data, bool on);
|
bool (*set_window_decorations)(void *data, bool on);
|
||||||
bool (*set_resolution)(void *data, unsigned width,
|
bool (*set_resolution)(void *data, unsigned width,
|
||||||
unsigned height, int int_hz, float hz, int center);
|
unsigned height, int int_hz, float hz, int center, int monitor_index);
|
||||||
void *(*get_resolution_list)(void *data,
|
void *(*get_resolution_list)(void *data,
|
||||||
unsigned *size);
|
unsigned *size);
|
||||||
const char *(*get_output_options)(void *data);
|
const char *(*get_output_options)(void *data);
|
||||||
const char *ident;
|
const char *ident;
|
||||||
} video_display_server_t;
|
} video_display_server_t;
|
||||||
|
|
||||||
void* video_display_server_init(void);
|
void* video_display_server_init(void);
|
||||||
|
|
||||||
void video_display_server_destroy(void);
|
void video_display_server_destroy(void);
|
||||||
|
|
||||||
bool video_display_server_set_window_opacity(unsigned opacity);
|
bool video_display_server_set_window_opacity(unsigned opacity);
|
||||||
|
|
||||||
bool video_display_server_set_window_progress(int progress, bool finished);
|
bool video_display_server_set_window_progress(int progress, bool finished);
|
||||||
|
|
||||||
bool video_display_server_set_window_decorations(bool on);
|
bool video_display_server_set_window_decorations(bool on);
|
||||||
|
|
||||||
bool video_display_server_set_resolution(
|
bool video_display_server_set_resolution(
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
int int_hz, float hz, int center);
|
int int_hz, float hz, int center, int monitor_index);
|
||||||
|
|
||||||
void *video_display_server_get_resolution_list(unsigned *size);
|
void *video_display_server_get_resolution_list(unsigned *size);
|
||||||
|
|
||||||
const char *video_display_server_get_output_options(void);
|
const char *video_display_server_get_output_options(void);
|
||||||
|
|
||||||
const char *video_display_server_get_ident(void);
|
const char *video_display_server_get_ident(void);
|
||||||
|
|
||||||
extern const video_display_server_t dispserv_win32;
|
extern const video_display_server_t dispserv_win32;
|
||||||
extern const video_display_server_t dispserv_x11;
|
extern const video_display_server_t dispserv_x11;
|
||||||
extern const video_display_server_t dispserv_null;
|
extern const video_display_server_t dispserv_null;
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
7561
gfx/video_driver.c
7561
gfx/video_driver.c
File diff suppressed because it is too large
Load Diff
2618
gfx/video_driver.h
2618
gfx/video_driver.h
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user