From ce2d4af1035b0a516a3efd785e3806323ee7f4eb Mon Sep 17 00:00:00 2001 From: alphanu1 <37101891+alphanu1@users.noreply.github.com> Date: Mon, 26 Mar 2018 21:01:13 +0100 Subject: [PATCH] Add files via upload Added Linux place holder --- gfx/video_crt_linux.c | 36 +++++++++++++ gfx/video_crt_linux.h | 21 ++++++++ gfx/video_crt_switch.c | 117 +---------------------------------------- gfx/video_crt_switch.h | 3 ++ 4 files changed, 61 insertions(+), 116 deletions(-) create mode 100644 gfx/video_crt_linux.c create mode 100644 gfx/video_crt_linux.h diff --git a/gfx/video_crt_linux.c b/gfx/video_crt_linux.c new file mode 100644 index 0000000000..f663a330e8 --- /dev/null +++ b/gfx/video_crt_linux.c @@ -0,0 +1,36 @@ +/* CRT SwitchRes Core + * Copyright (C) 2018 Ben Templeman. + * + * RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis + * + * 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- + * 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; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * 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. + * If not, see . +*/ +#include +#include +#include + +#include "video_crt_switch.h" + + +void switch_res(int width, int height, int f_restore) +{ /* Place holder for Linux function to swith resolutions */ + + + +} + +void video_restore() +{ + +} diff --git a/gfx/video_crt_linux.h b/gfx/video_crt_linux.h new file mode 100644 index 0000000000..83a27d47d2 --- /dev/null +++ b/gfx/video_crt_linux.h @@ -0,0 +1,21 @@ +/* CRT SwitchRes Core + * Copyright (C) 2018 Ben Templeman. + * + * RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis + * + * 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- + * 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; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * 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. + * If not, see . +*/ + +void switch_res(int width, int height, int f_restore); +void video_restore(); \ No newline at end of file diff --git a/gfx/video_crt_switch.c b/gfx/video_crt_switch.c index 11a731d413..f7c8b22eb9 100644 --- a/gfx/video_crt_switch.c +++ b/gfx/video_crt_switch.c @@ -24,15 +24,13 @@ #include #include "video_crt_switch.h" +#include "video_crt_win.h" -static int ra_set_core_hz; static float ra_tmp_core_hz; static int ra_core_width; static int ra_core_height; static int ra_tmp_width; static int ra_tmp_height; -static int orig_width; -static int orig_height; static int first_run; static float fly_aspect; @@ -54,7 +52,6 @@ void switch_res_core(int width, int height, float hz) video_driver_set_aspect_ratio_value((float)fly_aspect); crt_poke_video(); } - } void check_first_run() @@ -168,116 +165,4 @@ void switch_crt_hz() } -void switch_res(int width, int height, int f_restore) -{ /* windows function to swith resolutions */ - - DEVMODE curDevmode; - DEVMODE devmode; - DWORD flags = 0; - int iModeNum; - int depth = 0; - int freq; - if (f_restore == 0) - { - freq = ra_set_core_hz; - } - else - { - freq = 0; - } - - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &curDevmode); - - if (width == curDevmode.dmPelsWidth) - { - width = 0; /* used to stop superresolution bug */ - } - if (width == 0) - { - width = curDevmode.dmPelsWidth; - } - if (height == 0) - { - height = curDevmode.dmPelsHeight; - } - if (depth == 0) - { - depth = curDevmode.dmBitsPerPel; - } - if (freq == 0) - { - freq = curDevmode.dmDisplayFrequency; - } - - for (iModeNum = 0; ; iModeNum++) - { - if (EnumDisplaySettings(NULL, iModeNum, &devmode)) - { - - if (devmode.dmPelsWidth != width) - { - continue; - } - - if (devmode.dmPelsHeight != height) - { - continue; - } - - - if (devmode.dmBitsPerPel != depth) - { - continue; - } - - - if (devmode.dmDisplayFrequency != freq) - { - continue; - } - - - devmode.dmFields |= DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY; - LONG res = ChangeDisplaySettings(&devmode, CDS_TEST); - - switch (res) - { - case DISP_CHANGE_SUCCESSFUL: - res = ChangeDisplaySettings(&devmode, flags); - switch (res) - { - case DISP_CHANGE_SUCCESSFUL: - return; - - case DISP_CHANGE_NOTUPDATED: - - return; - - default: - - break; - } - break; - - case DISP_CHANGE_RESTART: - - break; - - default: - - break; - } - } - else - { - break; - } - } - -} - -void video_restore() -{ - switch_res(orig_width, orig_height,1); -} diff --git a/gfx/video_crt_switch.h b/gfx/video_crt_switch.h index 8a1e283cdd..1ee133c713 100644 --- a/gfx/video_crt_switch.h +++ b/gfx/video_crt_switch.h @@ -19,6 +19,9 @@ static float ra_core_hz; /* Shared with video_driver.c */ +static int ra_set_core_hz; +static int orig_width; +static int orig_height; void switch_res_core(int width, int height, float hz); void check_first_run();