mirror of
https://github.com/libretro/RetroArch
synced 2025-02-02 14:54:10 +00:00
Backport Opendingux/GCW Zero patches courtesy of gama.coder
This commit is contained in:
parent
d2645e9087
commit
1b0a9d0b1d
@ -525,6 +525,12 @@ ifeq ($(HAVE_XINPUT), 1)
|
|||||||
input/autoconf/builtin_win.o
|
input/autoconf/builtin_win.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAVE_OPENDINGUX_FBDEV), 1)
|
||||||
|
OBJ += gfx/drivers_context/opendingux_fbdev_ctx.o
|
||||||
|
DEFINES += $(EGL_CFLAGS)
|
||||||
|
LIBS += $(EGL_LIBS)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_X11), 1)
|
ifeq ($(HAVE_X11), 1)
|
||||||
OBJ += input/common/input_x11_common.o \
|
OBJ += input/common/input_x11_common.o \
|
||||||
input/drivers/x11_input.o \
|
input/drivers/x11_input.o \
|
||||||
|
288
gfx/drivers_context/opendingux_fbdev_ctx.c
Normal file
288
gfx/drivers_context/opendingux_fbdev_ctx.c
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
/* RetroArch - A frontend for libretro.
|
||||||
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||||
|
* Copyright (C) 2014 2015 - Jean-Andre Santoni
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include "../../driver.h"
|
||||||
|
#include "../../general.h"
|
||||||
|
#include "../../runloop.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
#include "../common/egl_common.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_OPENGLES)
|
||||||
|
#include "../common/gl_common.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
egl_ctx_data_t egl;
|
||||||
|
#endif
|
||||||
|
bool resize;
|
||||||
|
unsigned width, height;
|
||||||
|
} opendingux_ctx_data_t;
|
||||||
|
|
||||||
|
static void gfx_ctx_opendingux_destroy(void *data)
|
||||||
|
{
|
||||||
|
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||||
|
|
||||||
|
if (!viv)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
egl_destroy(&viv->egl);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
viv->resize = false;
|
||||||
|
free(viv);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *gfx_ctx_opendingux_init(void *video_driver)
|
||||||
|
{
|
||||||
|
EGLint n;
|
||||||
|
EGLint major, minor;
|
||||||
|
EGLint format;
|
||||||
|
static const EGLint attribs[] = {
|
||||||
|
#if 0
|
||||||
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||||
|
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||||
|
#endif
|
||||||
|
EGL_BLUE_SIZE, 5,
|
||||||
|
EGL_GREEN_SIZE, 6,
|
||||||
|
EGL_RED_SIZE, 5,
|
||||||
|
EGL_ALPHA_SIZE, 0,
|
||||||
|
EGL_SAMPLES, 0,
|
||||||
|
EGL_NONE
|
||||||
|
};
|
||||||
|
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)
|
||||||
|
calloc(1, sizeof(*viv));
|
||||||
|
|
||||||
|
if (!viv)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
(void)video_driver;
|
||||||
|
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
egl_install_sighandlers();
|
||||||
|
|
||||||
|
if (!egl_init_context(&viv->egl, EGL_DEFAULT_DISPLAY,
|
||||||
|
&major, &minor,
|
||||||
|
&n, attribs))
|
||||||
|
{
|
||||||
|
egl_report_error();
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return viv;
|
||||||
|
|
||||||
|
error:
|
||||||
|
RARCH_ERR("[opendingux fbdev]: EGL error: %d.\n", eglGetError());
|
||||||
|
gfx_ctx_opendingux_destroy(viv);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_opendingux_get_video_size(void *data,
|
||||||
|
unsigned *width, unsigned *height)
|
||||||
|
{
|
||||||
|
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||||
|
|
||||||
|
*width = viv->width;
|
||||||
|
*height = viv->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_opendingux_check_window(void *data, bool *quit,
|
||||||
|
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
||||||
|
{
|
||||||
|
unsigned new_width, new_height;
|
||||||
|
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||||
|
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
egl_get_video_size(&viv->egl, &new_width, &new_height);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (new_width != *width || new_height != *height)
|
||||||
|
{
|
||||||
|
*width = new_width;
|
||||||
|
*height = new_height;
|
||||||
|
*resize = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
*quit = g_egl_quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool gfx_ctx_opendingux_set_resize(void *data,
|
||||||
|
unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
(void)width;
|
||||||
|
(void)height;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_opendingux_update_window_title(void *data)
|
||||||
|
{
|
||||||
|
char buf[128] = {0};
|
||||||
|
char buf_fps[128] = {0};
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
|
(void)data;
|
||||||
|
|
||||||
|
video_monitor_get_fps(buf, sizeof(buf),
|
||||||
|
buf_fps, sizeof(buf_fps));
|
||||||
|
if (settings->fps_show)
|
||||||
|
runloop_msg_queue_push(buf_fps, 1, 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool gfx_ctx_opendingux_set_video_mode(void *data,
|
||||||
|
unsigned width, unsigned height,
|
||||||
|
bool fullscreen)
|
||||||
|
{
|
||||||
|
EGLNativeWindowType window;
|
||||||
|
static const EGLint attribs[] = {
|
||||||
|
EGL_CONTEXT_CLIENT_VERSION, 2, /* Use version 2, even for GLES3. */
|
||||||
|
EGL_NONE
|
||||||
|
};
|
||||||
|
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||||
|
|
||||||
|
/* Pick some arbitrary default. */
|
||||||
|
if (!width || !fullscreen)
|
||||||
|
width = 1280;
|
||||||
|
if (!height || !fullscreen)
|
||||||
|
height = 1024;
|
||||||
|
|
||||||
|
viv->width = width;
|
||||||
|
viv->height = height;
|
||||||
|
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
if (!egl_create_context(&viv->egl, attribs))
|
||||||
|
{
|
||||||
|
egl_report_error();
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
window = 0;
|
||||||
|
if (!egl_create_surface(&viv->egl, window))
|
||||||
|
goto error;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
error:
|
||||||
|
RARCH_ERR("[opendingux fbdev]: EGL error: %d.\n", eglGetError());
|
||||||
|
gfx_ctx_opendingux_destroy(data);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_opendingux_input_driver(void *data,
|
||||||
|
const input_driver_t **input, void **input_data)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
*input = NULL;
|
||||||
|
*input_data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool gfx_ctx_opendingux_bind_api(void *data,
|
||||||
|
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
return api == GFX_CTX_OPENGL_ES_API;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool gfx_ctx_opendingux_has_focus(void *data)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool gfx_ctx_opendingux_suppress_screensaver(void *data, bool enable)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
(void)enable;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool gfx_ctx_opendingux_has_windowed(void *data)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_opendingux_swap_buffers(void *data)
|
||||||
|
{
|
||||||
|
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||||
|
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
egl_swap_buffers(&viv->egl);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_opendingux_set_swap_interval(
|
||||||
|
void *data, unsigned swap_interval)
|
||||||
|
{
|
||||||
|
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||||
|
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
egl_set_swap_interval(&viv->egl, swap_interval);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gfx_ctx_proc_t gfx_ctx_opendingux_get_proc_address(const char *symbol)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
return egl_get_proc_address(symbol);
|
||||||
|
#else
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gfx_ctx_opendingux_bind_hw_render(void *data, bool enable)
|
||||||
|
{
|
||||||
|
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||||
|
|
||||||
|
#ifdef HAVE_EGL
|
||||||
|
egl_bind_hw_render(&viv->egl, enable);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev = {
|
||||||
|
gfx_ctx_opendingux_init,
|
||||||
|
gfx_ctx_opendingux_destroy,
|
||||||
|
gfx_ctx_opendingux_bind_api,
|
||||||
|
gfx_ctx_opendingux_set_swap_interval,
|
||||||
|
gfx_ctx_opendingux_set_video_mode,
|
||||||
|
gfx_ctx_opendingux_get_video_size,
|
||||||
|
NULL, /* get_video_output_size */
|
||||||
|
NULL, /* get_video_output_prev */
|
||||||
|
NULL, /* get_video_output_next */
|
||||||
|
NULL, /* get_metrics */
|
||||||
|
NULL,
|
||||||
|
gfx_ctx_opendingux_update_window_title,
|
||||||
|
gfx_ctx_opendingux_check_window,
|
||||||
|
gfx_ctx_opendingux_set_resize,
|
||||||
|
gfx_ctx_opendingux_has_focus,
|
||||||
|
gfx_ctx_opendingux_suppress_screensaver,
|
||||||
|
gfx_ctx_opendingux_has_windowed,
|
||||||
|
gfx_ctx_opendingux_swap_buffers,
|
||||||
|
gfx_ctx_opendingux_input_driver,
|
||||||
|
gfx_ctx_opendingux_get_proc_address,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
"opendingux-fbdev",
|
||||||
|
gfx_ctx_opendingux_bind_hw_render
|
||||||
|
};
|
@ -43,6 +43,9 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
|
|||||||
#if defined(HAVE_VIVANTE_FBDEV)
|
#if defined(HAVE_VIVANTE_FBDEV)
|
||||||
&gfx_ctx_vivante_fbdev,
|
&gfx_ctx_vivante_fbdev,
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_OPENDINGUX_FBDEV)
|
||||||
|
&gfx_ctx_opendingux_fbdev,
|
||||||
|
#endif
|
||||||
#if defined(_WIN32) && defined(HAVE_OPENGL)
|
#if defined(_WIN32) && defined(HAVE_OPENGL)
|
||||||
&gfx_ctx_wgl,
|
&gfx_ctx_wgl,
|
||||||
#endif
|
#endif
|
||||||
|
@ -263,6 +263,7 @@ extern const gfx_ctx_driver_t gfx_ctx_bbqnx;
|
|||||||
extern const gfx_ctx_driver_t gfx_ctx_cgl;
|
extern const gfx_ctx_driver_t gfx_ctx_cgl;
|
||||||
extern const gfx_ctx_driver_t gfx_ctx_cocoagl;
|
extern const gfx_ctx_driver_t gfx_ctx_cocoagl;
|
||||||
extern const gfx_ctx_driver_t gfx_ctx_emscripten;
|
extern const gfx_ctx_driver_t gfx_ctx_emscripten;
|
||||||
|
extern const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev;
|
||||||
extern const gfx_ctx_driver_t gfx_ctx_null;
|
extern const gfx_ctx_driver_t gfx_ctx_null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
#define M_PI 3.14159265358979323846264338327
|
#define M_PI 3.14159265358979323846264338327
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
#ifndef max
|
#ifndef max
|
||||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
@ -75,6 +76,7 @@
|
|||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||||
#define RARCH_SCALE_BASE 256
|
#define RARCH_SCALE_BASE 256
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
HAVE_LIBRETRODB=yes # Disable libretrodb
|
HAVE_LIBRETRODB=yes # Enable libretrodb
|
||||||
HAVE_RGUI=yes # Disable RGUI menu
|
HAVE_RGUI=yes # Enable RGUI menu
|
||||||
HAVE_MATERIALUI=auto # Enable MaterialUI menu
|
HAVE_MATERIALUI=auto # Enable MaterialUI menu
|
||||||
HAVE_CHEEVOS=no # Enable Cheevos (achievements)
|
HAVE_CHEEVOS=no # Enable Cheevos (achievements)
|
||||||
HAVE_XMB=auto # Enable XMB menu
|
HAVE_XMB=auto # Enable XMB menu
|
||||||
HAVE_ZAHNRAD=no # Enable Zahnrad menu
|
HAVE_ZAHNRAD=no # Enable Zahnrad menu
|
||||||
HAVE_DYNAMIC=yes # Disable dynamic loading of libretro library
|
HAVE_DYNAMIC=yes # Enable dynamic loading of libretro library
|
||||||
HAVE_SDL=auto # SDL support
|
HAVE_SDL=auto # SDL support
|
||||||
HAVE_SDL2=auto # SDL2 support (disables SDL 1.x)
|
HAVE_SDL2=auto # SDL2 support (disables SDL 1.x)
|
||||||
C89_SDL2=no
|
C89_SDL2=no
|
||||||
@ -21,11 +21,12 @@ C89_FFMPEG=no
|
|||||||
HAVE_DYLIB=auto # Enable dynamic loading support
|
HAVE_DYLIB=auto # Enable dynamic loading support
|
||||||
HAVE_NETWORKING=auto # Enable networking features (recommended)
|
HAVE_NETWORKING=auto # Enable networking features (recommended)
|
||||||
HAVE_NETPLAY=auto # Enable netplay support (requires networking)
|
HAVE_NETPLAY=auto # Enable netplay support (requires networking)
|
||||||
HAVE_D3D9=yes # Disable Direct3D 9 support
|
HAVE_D3D9=yes # Enable Direct3D 9 support
|
||||||
HAVE_OPENGL=auto # Enable OpenGL support
|
HAVE_OPENGL=auto # Enable OpenGL support
|
||||||
HAVE_GLES=no # Use GLESv2 instead of desktop GL
|
HAVE_GLES=no # Use GLESv2 instead of desktop GL
|
||||||
HAVE_MALI_FBDEV=no # Enable Mali fbdev context support
|
HAVE_MALI_FBDEV=no # Enable Mali fbdev context support
|
||||||
HAVE_VIVANTE_FBDEV=no # Enable Vivante fbdev context support
|
HAVE_VIVANTE_FBDEV=no # Enable Vivante fbdev context support
|
||||||
|
HAVE_OPENDINGUX_FBDEV=no # Enable Opendingux fbdev context support
|
||||||
HAVE_GLES3=no # Enable OpenGLES3 support
|
HAVE_GLES3=no # Enable OpenGLES3 support
|
||||||
HAVE_X11=auto # Enable everything X11.
|
HAVE_X11=auto # Enable everything X11.
|
||||||
HAVE_OMAP=no # Enable OMAP video support
|
HAVE_OMAP=no # Enable OMAP video support
|
||||||
@ -53,7 +54,7 @@ HAVE_COREAUDIO=auto # Enable CoreAudio support
|
|||||||
HAVE_PULSE=auto # Enable PulseAudio support
|
HAVE_PULSE=auto # Enable PulseAudio support
|
||||||
C89_PULSE=no
|
C89_PULSE=no
|
||||||
HAVE_FREETYPE=auto # Enable FreeType support
|
HAVE_FREETYPE=auto # Enable FreeType support
|
||||||
HAVE_STB_FONT=yes # Disable stb_truetype font support
|
HAVE_STB_FONT=yes # Enable stb_truetype font support
|
||||||
HAVE_XVIDEO=auto # Enable XVideo support
|
HAVE_XVIDEO=auto # Enable XVideo support
|
||||||
HAVE_PYTHON=auto # Enable Python 3 support for shaders
|
HAVE_PYTHON=auto # Enable Python 3 support for shaders
|
||||||
C89_PYTHON=no
|
C89_PYTHON=no
|
||||||
@ -63,13 +64,13 @@ HAVE_SSE=no # Forcefully enable x86 SSE optimizations (SSE, SSE2)
|
|||||||
HAVE_FLOATHARD=no # Force hard float ABI (for ARM)
|
HAVE_FLOATHARD=no # Force hard float ABI (for ARM)
|
||||||
HAVE_FLOATSOFTFP=no # Force soft float ABI (for ARM)
|
HAVE_FLOATSOFTFP=no # Force soft float ABI (for ARM)
|
||||||
HAVE_7ZIP=yes # Compile in 7z support
|
HAVE_7ZIP=yes # Compile in 7z support
|
||||||
HAVE_PRESERVE_DYLIB=no # Disable dlclose() for Valgrind support
|
HAVE_PRESERVE_DYLIB=no # Enable dlclose() for Valgrind support
|
||||||
HAVE_PARPORT=auto # Parallel port joypad support
|
HAVE_PARPORT=auto # Parallel port joypad support
|
||||||
HAVE_IMAGEVIEWER=yes # Built-in image viewer support.
|
HAVE_IMAGEVIEWER=yes # Built-in image viewer support.
|
||||||
C89_IMAGEVIEWER=no # stb_image hates C89
|
C89_IMAGEVIEWER=no # stb_image hates C89
|
||||||
HAVE_MMAP=auto # MMAP support
|
HAVE_MMAP=auto # MMAP support
|
||||||
HAVE_QT=no # QT companion support
|
HAVE_QT=no # QT companion support
|
||||||
HAVE_XSHM=no # XShm video driver support (disabled because it's just a dummied out stub)
|
HAVE_XSHM=no # XShm video driver support (disabled because it's just a dummied out stub)
|
||||||
HAVE_CHEEVOS=yes # Disable Retro Achievements
|
HAVE_CHEEVOS=yes # Enable Retro Achievements
|
||||||
HAVE_VULKAN=auto # Enable Vulkan support
|
HAVE_VULKAN=auto # Enable Vulkan support
|
||||||
C89_VULKAN=no
|
C89_VULKAN=no
|
||||||
|
Loading…
x
Reference in New Issue
Block a user