diff --git a/Makefile.common b/Makefile.common index 39a9d4c5c9..d8b64a67ef 100644 --- a/Makefile.common +++ b/Makefile.common @@ -349,6 +349,7 @@ ifeq ($(HAVE_OPENGL), 1) OBJ += gfx/gl.o \ gfx/gl_common.o \ gfx/gfx_context.o \ + gfx/context/gfx_null_ctx.o \ gfx/fonts/gl_font.o \ gfx/fonts/gl_raster_font.o \ gfx/math/matrix.o \ diff --git a/driver.c b/driver.c index b88076d97c..b7a8aad9d4 100644 --- a/driver.c +++ b/driver.c @@ -28,6 +28,10 @@ #include "audio/audio_thread_wrapper.h" #include "gfx/gfx_common.h" +#ifdef HAVE_X11 +#include "gfx/context/x11_common.h" +#endif + #ifdef HAVE_MENU #include "frontend/menu/menu_common.h" #endif diff --git a/gfx/context/gfx_null_ctx.c b/gfx/context/gfx_null_ctx.c new file mode 100644 index 0000000000..a07d01fe47 --- /dev/null +++ b/gfx/context/gfx_null_ctx.c @@ -0,0 +1,145 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2014 - 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 . + */ + +// Null context. + +#include "../../driver.h" +#include "../gfx_context.h" +#include "../gfx_common.h" + +static void gfx_ctx_null_swap_interval(void *data, unsigned interval) +{ + (void)data; + (void)interval; +} + +static void gfx_ctx_null_check_window(void *data, bool *quit, + bool *resize, unsigned *width, unsigned *height, unsigned frame_count) +{ + (void)frame_count; + (void)data; + (void)quit; + (void)width; + (void)height; + (void)resize; +} + +static void gfx_ctx_null_swap_buffers(void *data) +{ + (void)data; +} + +static void gfx_ctx_null_set_resize(void *data, unsigned width, unsigned height) +{ + (void)data; + (void)width; + (void)height; +} + +static void gfx_ctx_null_update_window_title(void *data) +{ + (void)data; +} + +static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *height) +{ + (void)data; + *width = 320; + *height = 240; +} + +static bool gfx_ctx_null_set_video_mode(void *data, + unsigned width, unsigned height, + bool fullscreen) +{ + (void)data; + (void)width; + (void)height; + (void)fullscreen; + + return true; +} + +static void gfx_ctx_null_destroy(void *data) +{ + (void)data; +} + +static void gfx_ctx_null_input_driver(void *data, const input_driver_t **input, void **input_data) +{ + (void)data; + (void)input; + (void)input_data; +} + +static bool gfx_ctx_null_has_focus(void *data) +{ + (void)data; + + return true; +} + +static bool gfx_ctx_null_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor) +{ + (void)data; + (void)api; + (void)major; + (void)minor; + + return true; +} + +static void gfx_ctx_null_show_mouse(void *data, bool state) +{ + (void)data; + (void)state; +} + +static void gfx_ctx_null_bind_hw_render(void *data, bool enable) +{ + (void)data; + (void)enable; +} + +static bool gfx_ctx_null_init(void *data) +{ + (void)data; + + return true; +} + +const gfx_ctx_driver_t gfx_ctx_null = { + gfx_ctx_null_init, + gfx_ctx_null_destroy, + gfx_ctx_null_bind_api, + gfx_ctx_null_swap_interval, + gfx_ctx_null_set_video_mode, + gfx_ctx_null_get_video_size, + NULL, + gfx_ctx_null_update_window_title, + gfx_ctx_null_check_window, + gfx_ctx_null_set_resize, + gfx_ctx_null_has_focus, + gfx_ctx_null_swap_buffers, + gfx_ctx_null_input_driver, + NULL, + NULL, + NULL, + gfx_ctx_null_show_mouse, + "null", + gfx_ctx_null_bind_hw_render, +}; + diff --git a/gfx/gfx_context.c b/gfx/gfx_context.c index e2cc2d920f..494e75ccda 100644 --- a/gfx/gfx_context.c +++ b/gfx/gfx_context.c @@ -69,6 +69,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { #ifdef EMSCRIPTEN &gfx_ctx_emscripten, #endif + &gfx_ctx_null, NULL }; diff --git a/griffin/griffin.c b/griffin/griffin.c index 2d6863a042..cb3facf396 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -101,6 +101,7 @@ VIDEO CONTEXT ============================================================ */ #include "../gfx/gfx_context.c" +#include "../gfx/context/gfx_null_ctx.c" #if defined(__CELLOS_LV2__) #include "../gfx/context/ps3_ctx.c"