From 71f71c909d0805f277f87f65b041b413ce3a45df Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 3 Nov 2012 10:18:08 +0100 Subject: [PATCH] (Android) Implement macro override calls for Android - for bypassing several layers of function call indirection --- console/griffin/hook_context.h | 47 ++++++++++++++++++++++++++++++++++ gfx/gl_common.h | 4 +++ 2 files changed, 51 insertions(+) create mode 100644 console/griffin/hook_context.h diff --git a/console/griffin/hook_context.h b/console/griffin/hook_context.h new file mode 100644 index 0000000000..38d7ee43a1 --- /dev/null +++ b/console/griffin/hook_context.h @@ -0,0 +1,47 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * Copyright (C) 2011-2012 - 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 . + */ + +#if defined(ANDROID) +#define context_get_video_size_func(win, height) gfx_ctx_get_video_size(win, height) +#define context_update_window_title_func(var) gfx_ctx_update_window_title(var) +#define context_destroy_func() gfx_ctx_destroy() + +#ifdef HAVE_FBO +#define context_set_fbo_func(enable) gl->ctx_driver->set_fbo(enable) +#define context_apply_fbo_state_changes_func(var) gl->ctx_driver->apply_fbo_state_changes(var) +#endif + +#define context_get_available_resolutions_func() gl->ctx_driver->get_available_resolutions() +#define context_translate_aspect_func(width, height) (device_aspect) +#define context_set_resize_func(width, height) gl->ctx_driver->set_resize(width, height) +#define context_swap_buffers_func() eglSwapBuffers(g_egl_dpy, g_egl_surf) +#define context_swap_interval_func(var) eglSwapInterval(g_egl_dpy, var) +#define context_has_focus_func() (true) +#define context_check_window_func(quit, resize, width, height, frame_count) gfx_ctx_check_window(quit, resize, width, height, frame_count) +#define context_set_video_mode_func(width, height, force_16bit, fullscreen) gfx_ctx_set_video_mode(width, height, force_16bit, fullscreen) +#define context_input_driver_func(input, input_data) gl->ctx_driver->input_driver(input, input_data) +#endif + +#ifdef HAVE_RMENU +#define context_rmenu_init_func() gl->ctx_driver->rmenu_init() +#define context_rmenu_frame_func(ctx) gl->ctx_driver->rmenu_frame(ctx) +#endif + +#ifdef HAVE_EGL +#define context_init_egl_image_buffer_func(video) gl->ctx_driver->init_egl_image_buffer(video) + +#define context_write_egl_image_func(frame, width, height, pitch, base_size, tex_index, img) gl->ctx_driver->write_egl_image(frame, width, height, pitch, base_size, tex_index,img) +#endif diff --git a/gfx/gl_common.h b/gfx/gl_common.h index f1a7a95027..66c759c4d9 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -55,6 +55,9 @@ #include #endif +#if defined(ANDROID) && defined(HAVE_GRIFFIN) +#include "../console/griffin/hook_context.h" +#else #define context_get_video_size_func(win, height) gl->ctx_driver->get_video_size(win, height) #define context_update_window_title_func(var) gl->ctx_driver->update_window_title(var) #define context_destroy_func() gl->ctx_driver->destroy() @@ -81,6 +84,7 @@ #define context_write_egl_image_func(frame, width, height, pitch, base_size, tex_index, img) gl->ctx_driver->write_egl_image(frame, width, height, pitch, base_size, tex_index,img) #endif +#endif static inline bool gl_query_extension(const char *ext) {