diff --git a/apple/common/apple_gfx_context.c.inl b/apple/common/apple_gfx_context.c.inl index 6d50008892..1e7fe385f8 100644 --- a/apple/common/apple_gfx_context.c.inl +++ b/apple/common/apple_gfx_context.c.inl @@ -252,6 +252,17 @@ static bool apple_gfx_ctx_has_focus(void *data) #endif } +static bool apple_gfx_ctx_has_windowed(void *data) +{ + (void)data; + +#ifdef IOS + return false; +#else + return true; +#endif +} + static void apple_gfx_ctx_swap_buffers(void *data) { if (!(--g_fast_forward_skips < 0)) @@ -327,6 +338,7 @@ const gfx_ctx_driver_t gfx_ctx_apple = { apple_gfx_ctx_check_window, apple_gfx_ctx_set_resize, apple_gfx_ctx_has_focus, + apple_gfx_ctx_has_windowed, apple_gfx_ctx_swap_buffers, apple_gfx_ctx_input_driver, apple_gfx_ctx_get_proc_address, diff --git a/driver.h b/driver.h index 79d21b6fcd..ac12dcea5d 100644 --- a/driver.h +++ b/driver.h @@ -405,6 +405,9 @@ typedef struct video_driver /* Does the window have focus? */ bool (*focus)(void *data); + /* Does the graphics conext support windowed mode? */ + bool (*has_windowed)(void *data); + /* Sets shader. Might not be implemented. Will be moved to * poke_interface later. */ bool (*set_shader)(void *data, enum rarch_shader_type type, diff --git a/gfx/context/androidegl_ctx.c b/gfx/context/androidegl_ctx.c index 09acaa8baa..0b3c85abad 100644 --- a/gfx/context/androidegl_ctx.c +++ b/gfx/context/androidegl_ctx.c @@ -261,12 +261,19 @@ static bool gfx_ctx_has_focus(void *data) return true; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + return false; +} + static void android_gfx_ctx_bind_hw_render(void *data, bool enable) { (void)data; g_use_hw_ctx = enable; if (g_egl_dpy && g_egl_surf) - eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, enable ? g_egl_hw_ctx : g_egl_ctx); + eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, + enable ? g_egl_hw_ctx : g_egl_ctx); } const gfx_ctx_driver_t gfx_ctx_android = { @@ -281,6 +288,7 @@ const gfx_ctx_driver_t gfx_ctx_android = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, gfx_ctx_get_proc_address, diff --git a/gfx/context/bbqnx_ctx.c b/gfx/context/bbqnx_ctx.c index a180853d6f..182e5f1ab4 100644 --- a/gfx/context/bbqnx_ctx.c +++ b/gfx/context/bbqnx_ctx.c @@ -400,6 +400,12 @@ static bool gfx_ctx_qnx_has_focus(void *data) return true; } +static bool gfx_ctx_qnx_has_windowed(void *data) +{ + (void)data; + return false; +} + static void gfx_qnx_ctx_bind_hw_render(void *data, bool enable) { (void)data; @@ -420,6 +426,7 @@ const gfx_ctx_driver_t gfx_ctx_bbqnx = { gfx_ctx_qnx_check_window, gfx_ctx_qnx_set_resize, gfx_ctx_qnx_has_focus, + gfx_ctx_qnx_has_windowed, gfx_ctx_qnx_swap_buffers, gfx_ctx_qnx_input_driver, gfx_ctx_qnx_get_proc_address, diff --git a/gfx/context/d3d_ctx.cpp b/gfx/context/d3d_ctx.cpp index afcb06172b..b21bd6e2b9 100644 --- a/gfx/context/d3d_ctx.cpp +++ b/gfx/context/d3d_ctx.cpp @@ -293,6 +293,16 @@ static bool gfx_ctx_d3d_has_focus(void *data) return GetFocus() == d3d->hWnd; } +static bool gfx_ctx_d3d_has_windowed(void *data) +{ + (void)data; +#ifdef _XBOX + return false; +#else + return true; +#endif +} + static bool gfx_ctx_d3d_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor) { (void)data; @@ -451,6 +461,7 @@ const gfx_ctx_driver_t gfx_ctx_d3d = { gfx_ctx_d3d_check_window, d3d_resize, gfx_ctx_d3d_has_focus, + gfx_ctx_d3d_has_windowed, gfx_ctx_d3d_swap_buffers, gfx_ctx_d3d_input_driver, NULL, diff --git a/gfx/context/drm_egl_ctx.c b/gfx/context/drm_egl_ctx.c index 2aaa0a9992..8e8c6eeb29 100644 --- a/gfx/context/drm_egl_ctx.c +++ b/gfx/context/drm_egl_ctx.c @@ -765,6 +765,12 @@ static bool gfx_ctx_has_focus(void *data) return g_inited; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + return false; +} + static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) { return eglGetProcAddress(symbol); @@ -817,6 +823,7 @@ const gfx_ctx_driver_t gfx_ctx_drm_egl = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, gfx_ctx_get_proc_address, diff --git a/gfx/context/gfx_null_ctx.c b/gfx/context/gfx_null_ctx.c index ce588d8fcc..15ac8f955f 100644 --- a/gfx/context/gfx_null_ctx.c +++ b/gfx/context/gfx_null_ctx.c @@ -88,7 +88,12 @@ static void gfx_ctx_null_input_driver(void *data, const input_driver_t **input, static bool gfx_ctx_null_has_focus(void *data) { (void)data; + return true; +} +static bool gfx_ctx_null_has_windowed(void *data) +{ + (void)data; return true; } @@ -133,6 +138,7 @@ const gfx_ctx_driver_t gfx_ctx_null = { gfx_ctx_null_check_window, gfx_ctx_null_set_resize, gfx_ctx_null_has_focus, + gfx_ctx_null_has_windowed, gfx_ctx_null_swap_buffers, gfx_ctx_null_input_driver, NULL, diff --git a/gfx/context/glx_ctx.c b/gfx/context/glx_ctx.c index f1fb9a0802..b9897fb5ce 100644 --- a/gfx/context/glx_ctx.c +++ b/gfx/context/glx_ctx.c @@ -602,6 +602,12 @@ static bool gfx_ctx_has_focus(void *data) return (win == g_win && g_has_focus) || g_true_full; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + return true; +} + static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) { return glXGetProcAddress((const GLubyte*)symbol); @@ -645,6 +651,7 @@ const gfx_ctx_driver_t gfx_ctx_glx = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, gfx_ctx_get_proc_address, diff --git a/gfx/context/mali_fbdev_ctx.c b/gfx/context/mali_fbdev_ctx.c index 841948fa82..a015316d26 100644 --- a/gfx/context/mali_fbdev_ctx.c +++ b/gfx/context/mali_fbdev_ctx.c @@ -256,6 +256,12 @@ static bool gfx_ctx_has_focus(void *data) return true; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + return false; +} + const gfx_ctx_driver_t gfx_ctx_mali_fbdev = { gfx_ctx_init, gfx_ctx_destroy, @@ -268,6 +274,7 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, gfx_ctx_get_proc_address, diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index e4c19da36a..99bc12cf4f 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -172,6 +172,12 @@ static bool gfx_ctx_has_focus(void *data) return true; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + return false; +} + static void gfx_ctx_swap_buffers(void *data) { (void)data; @@ -314,6 +320,7 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, NULL, diff --git a/gfx/context/sdl_gl_ctx.c b/gfx/context/sdl_gl_ctx.c index dc1280b9fe..bc6dfba1c8 100644 --- a/gfx/context/sdl_gl_ctx.c +++ b/gfx/context/sdl_gl_ctx.c @@ -333,6 +333,12 @@ static bool sdl_ctx_has_focus(void *data) #endif } +static bool sdl_ctx_has_windowed(void *data) +{ + (void)data; + return true; +} + static void sdl_ctx_swap_buffers(void *data) { (void)data; @@ -374,6 +380,7 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl = sdl_ctx_check_window, sdl_ctx_set_resize, sdl_ctx_has_focus, + sdl_ctx_has_windowed, sdl_ctx_swap_buffers, sdl_ctx_input_driver, sdl_ctx_get_proc_address, @@ -384,4 +391,4 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl = sdl_ctx_show_mouse, "sdl_gl", NULL /* bind_hw_render */ -}; \ No newline at end of file +}; diff --git a/gfx/context/vc_egl_ctx.c b/gfx/context/vc_egl_ctx.c index f2e97ee756..8bb80d888c 100644 --- a/gfx/context/vc_egl_ctx.c +++ b/gfx/context/vc_egl_ctx.c @@ -372,6 +372,12 @@ static bool gfx_ctx_has_focus(void *data) return g_inited; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + return false; +} + static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) { return eglGetProcAddress(symbol); @@ -511,6 +517,7 @@ const gfx_ctx_driver_t gfx_ctx_videocore = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, gfx_ctx_get_proc_address, diff --git a/gfx/context/vivante_fbdev_ctx.c b/gfx/context/vivante_fbdev_ctx.c index 9c0e2f666f..419a31483b 100644 --- a/gfx/context/vivante_fbdev_ctx.c +++ b/gfx/context/vivante_fbdev_ctx.c @@ -261,6 +261,12 @@ static bool gfx_ctx_has_focus(void *data) return true; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + return false; +} + const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = { gfx_ctx_init, gfx_ctx_destroy, @@ -273,6 +279,7 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, gfx_ctx_get_proc_address, diff --git a/gfx/context/wayland_ctx.c b/gfx/context/wayland_ctx.c index c5872d0da9..8d7bb2bf46 100644 --- a/gfx/context/wayland_ctx.c +++ b/gfx/context/wayland_ctx.c @@ -567,6 +567,12 @@ static bool gfx_ctx_has_focus(void *data) return true; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + return true; +} + static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) { return eglGetProcAddress(symbol); @@ -759,6 +765,7 @@ const gfx_ctx_driver_t gfx_ctx_wayland = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, gfx_ctx_get_proc_address, diff --git a/gfx/context/wgl_ctx.c b/gfx/context/wgl_ctx.c index f5788a46bd..3ca719ba7c 100644 --- a/gfx/context/wgl_ctx.c +++ b/gfx/context/wgl_ctx.c @@ -576,6 +576,13 @@ static bool gfx_ctx_has_focus(void *data) return GetFocus() == g_hwnd; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + + return true; +} + static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) { return (gfx_ctx_proc_t)wglGetProcAddress(symbol); @@ -614,6 +621,7 @@ const gfx_ctx_driver_t gfx_ctx_wgl = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, gfx_ctx_get_proc_address, diff --git a/gfx/context/xegl_ctx.c b/gfx/context/xegl_ctx.c index 01f792a13b..48be82f346 100644 --- a/gfx/context/xegl_ctx.c +++ b/gfx/context/xegl_ctx.c @@ -671,6 +671,14 @@ static bool gfx_ctx_has_focus(void *data) return (win == g_win && g_has_focus) || g_true_full; } +static bool gfx_ctx_has_windowed(void *data) +{ + (void)data; + + /* TODO - verify if this has windowed mode or not. */ + return true; +} + static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) { return eglGetProcAddress(symbol); @@ -729,6 +737,7 @@ const gfx_ctx_driver_t gfx_ctx_x_egl = { gfx_ctx_check_window, gfx_ctx_set_resize, gfx_ctx_has_focus, + gfx_ctx_has_windowed, gfx_ctx_swap_buffers, gfx_ctx_input_driver, gfx_ctx_get_proc_address, diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index e92d168ee9..87bb2e9b62 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -413,6 +413,14 @@ static bool d3d_focus(void *data) return false; } +static bool d3d_has_windowed(void *data) +{ + d3d_video_t *d3d = (d3d_video_t*)data; + if (d3d && d3d->ctx_driver && d3d->ctx_driver->has_windowed) + return d3d->ctx_driver->has_windowed(d3d); + return true; +} + static void d3d_set_aspect_ratio(void *data, unsigned aspect_ratio_idx) { d3d_video_t *d3d = (d3d_video_t*)data; @@ -1874,6 +1882,7 @@ video_driver_t video_d3d = { d3d_set_nonblock_state, d3d_alive, d3d_focus, + d3d_has_windowed, d3d_set_shader, d3d_free, "d3d", diff --git a/gfx/exynos_gfx.c b/gfx/exynos_gfx.c index 79ee34b7a8..c7dca33640 100644 --- a/gfx/exynos_gfx.c +++ b/gfx/exynos_gfx.c @@ -1325,31 +1325,45 @@ fail: return false; } -static void exynos_gfx_set_nonblock_state(void *data, bool state) { - struct exynos_video *vid = data; - - vid->data->sync = !state; +static void exynos_gfx_set_nonblock_state(void *data, bool state) +{ + struct exynos_video *vid = data; + if (vid && vid->data) + vid->data->sync = !state; } -static bool exynos_gfx_alive(void *data) { - (void)data; - return true; /* always alive */ +static bool exynos_gfx_alive(void *data) +{ + (void)data; + return true; /* always alive */ } -static bool exynos_gfx_focus(void *data) { - (void)data; - return true; /* drm device always has focus */ +static bool exynos_gfx_focus(void *data) +{ + (void)data; + return true; /* drm device always has focus */ +} + +static bool exynos_gfx_has_windowed(void *data) +{ + (void)data; + + return false; } static void exynos_gfx_set_rotation(void *data, unsigned rotation) { - struct exynos_video *vid = data; - vid->menu_rotation = rotation; + struct exynos_video *vid = (struct exynos_video*)data; + if (vid) + vid->menu_rotation = rotation; } static void exynos_gfx_viewport_info(void *data, struct rarch_viewport *vp) { - struct exynos_video *vid = data; + struct exynos_video *vid = (struct exynos_video*)data; + + if (!vid) + return; vp->x = vp->y = 0; @@ -1357,81 +1371,91 @@ static void exynos_gfx_viewport_info(void *data, struct rarch_viewport *vp) vp->height = vp->full_height = vid->height; } -static void exynos_set_aspect_ratio(void *data, unsigned aspect_ratio_idx) { - struct exynos_video *vid = data; +static void exynos_set_aspect_ratio(void *data, unsigned aspect_ratio_idx) +{ + struct exynos_video *vid = data; - switch (aspect_ratio_idx) { - case ASPECT_RATIO_SQUARE: - gfx_set_square_pixel_viewport(g_extern.system.av_info.geometry.base_width, g_extern.system.av_info.geometry.base_height); - break; + switch (aspect_ratio_idx) + { + case ASPECT_RATIO_SQUARE: + gfx_set_square_pixel_viewport( + g_extern.system.av_info.geometry.base_width, + g_extern.system.av_info.geometry.base_height); + break; - case ASPECT_RATIO_CORE: - gfx_set_core_viewport(); - break; + case ASPECT_RATIO_CORE: + gfx_set_core_viewport(); + break; - case ASPECT_RATIO_CONFIG: - gfx_set_config_viewport(); - break; + case ASPECT_RATIO_CONFIG: + gfx_set_config_viewport(); + break; - default: - break; - } + default: + break; + } - g_extern.system.aspect_ratio = aspectratio_lut[aspect_ratio_idx].value; - vid->aspect_changed = true; + g_extern.system.aspect_ratio = aspectratio_lut[aspect_ratio_idx].value; + vid->aspect_changed = true; } -static void exynos_apply_state_changes(void *data) { - (void)data; +static void exynos_apply_state_changes(void *data) +{ + (void)data; } static void exynos_set_texture_frame(void *data, const void *frame, bool rgb32, - unsigned width, unsigned height, float alpha) { - const enum exynos_buffer_type buf_type = defaults[exynos_image_menu].buf_type; + unsigned width, unsigned height, float alpha) +{ + const enum exynos_buffer_type buf_type = defaults[exynos_image_menu].buf_type; - struct exynos_video *vid = data; - struct exynos_data *pdata = vid->data; - struct g2d_image *src = pdata->src[exynos_image_menu]; + struct exynos_video *vid = data; + struct exynos_data *pdata = vid->data; + struct g2d_image *src = pdata->src[exynos_image_menu]; - const unsigned size = width * height * (rgb32 ? 4 : 2); + const unsigned size = width * height * (rgb32 ? 4 : 2); - if (realloc_buffer(pdata, buf_type, size) != 0) - return; + if (realloc_buffer(pdata, buf_type, size) != 0) + return; - src->width = width; - src->height = height; - src->stride = width * (rgb32 ? 4 : 2); - src->color_mode = rgb32 ? G2D_COLOR_FMT_ARGB8888 | G2D_ORDER_RGBAX : - G2D_COLOR_FMT_ARGB4444 | G2D_ORDER_RGBAX; + src->width = width; + src->height = height; + src->stride = width * (rgb32 ? 4 : 2); + src->color_mode = rgb32 ? G2D_COLOR_FMT_ARGB8888 | G2D_ORDER_RGBAX : + G2D_COLOR_FMT_ARGB4444 | G2D_ORDER_RGBAX; - src->component_alpha = (unsigned char)(255.0f * alpha); + src->component_alpha = (unsigned char)(255.0f * alpha); #if (EXYNOS_GFX_DEBUG_PERF == 1) - perf_memcpy(&pdata->perf, true); + perf_memcpy(&pdata->perf, true); #endif - memcpy_neon(pdata->buf[buf_type]->vaddr, frame, size); + memcpy_neon(pdata->buf[buf_type]->vaddr, frame, size); #if (EXYNOS_GFX_DEBUG_PERF == 1) - perf_memcpy(&pdata->perf, false); + perf_memcpy(&pdata->perf, false); #endif } -static void exynos_set_texture_enable(void *data, bool state, bool full_screen) { +static void exynos_set_texture_enable(void *data, bool state, bool full_screen) +{ struct exynos_video *vid = data; - vid->menu_active = state; + if (vid) + vid->menu_active = state; } -static void exynos_set_osd_msg(void *data, const char *msg, const struct font_params *params) { - struct exynos_video *vid = data; - - /* TODO: what does this do? */ - (void)msg; - (void)params; +static void exynos_set_osd_msg(void *data, const char *msg, + const struct font_params *params) +{ + (void)data; + (void)msg; + (void)params; } -static void exynos_show_mouse(void *data, bool state) { - (void)data; +static void exynos_show_mouse(void *data, bool state) +{ + (void)data; + (void)state; } static const video_poke_interface_t exynos_poke_interface = { @@ -1481,6 +1505,7 @@ video_driver_t video_exynos = { exynos_gfx_set_nonblock_state, exynos_gfx_alive, exynos_gfx_focus, + exynos_gfx_has_windowed, exynos_gfx_set_shader, exynos_gfx_free, "exynos", diff --git a/gfx/gfx_context.h b/gfx/gfx_context.h index f7ec92da37..e37e51a3d0 100644 --- a/gfx/gfx_context.h +++ b/gfx/gfx_context.h @@ -89,6 +89,9 @@ typedef struct gfx_ctx_driver /* Checks if window has input focus. */ bool (*has_focus)(void*); + /* Checks if context driver has windowed support. */ + bool (*has_windowed)(void*); + /* Swaps buffers. VBlank sync depends on * earlier calls to swap_interval. */ void (*swap_buffers)(void*); diff --git a/gfx/gl.c b/gfx/gl.c index e42ee04980..5ecfc651a6 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -2461,6 +2461,15 @@ static bool gl_focus(void *data) return false; } +static bool gl_has_windowed(void *data) +{ + gl_t *gl = (gl_t*)data; + + if (gl && gl->ctx_driver) + gl->ctx_driver->has_windowed(gl); + return true; +} + static void gl_update_tex_filter_frame(gl_t *gl) { unsigned i; @@ -3099,6 +3108,7 @@ video_driver_t video_gl = { gl_set_nonblock_state, gl_alive, gl_focus, + gl_has_windowed, gl_set_shader, diff --git a/gfx/gx/gx_gfx.c b/gfx/gx/gx_gfx.c index e4cd742aa8..6738b0600a 100644 --- a/gfx/gx/gx_gfx.c +++ b/gfx/gx/gx_gfx.c @@ -1056,6 +1056,12 @@ static bool gx_focus(void *data) return true; } +static bool gx_has_windowed(void *data) +{ + (void)data; + return false; +} + static void gx_free(void *data) { gx_video_t *gx = (gx_video_t*)driver.video_data; @@ -1333,6 +1339,7 @@ video_driver_t video_gx = { gx_set_nonblock_state, gx_alive, gx_focus, + gx_has_windowed, gx_set_shader, gx_free, "gx", diff --git a/gfx/nullgfx.c b/gfx/nullgfx.c index de101f5d54..396922385f 100644 --- a/gfx/nullgfx.c +++ b/gfx/nullgfx.c @@ -57,6 +57,12 @@ static bool null_gfx_focus(void *data) return true; } +static bool null_gfx_has_windowed(void *data) +{ + (void)data; + return true; +} + static void null_gfx_free(void *data) { (void)data; @@ -107,6 +113,7 @@ video_driver_t video_null = { null_gfx_set_nonblock_state, null_gfx_alive, null_gfx_focus, + null_gfx_has_windowed, null_gfx_set_shader, null_gfx_free, "null", diff --git a/gfx/omap_gfx.c b/gfx/omap_gfx.c index 45894fd543..01c9e0554a 100644 --- a/gfx/omap_gfx.c +++ b/gfx/omap_gfx.c @@ -879,6 +879,14 @@ static void omap_gfx_viewport_info(void *data, struct rarch_viewport *vp) { vp->height = vp->full_height = vid->height; } +static bool omap_gfx_has_windowed(void *data) +{ + (void)data; + + /* TODO - implement. */ + return true; +} + static bool omap_gfx_set_shader(void *data, enum rarch_shader_type type, const char *path) { @@ -916,6 +924,7 @@ video_driver_t video_omap = { omap_gfx_set_nonblock_state, omap_gfx_alive, omap_gfx_focus, + omap_gfx_has_windowed, omap_gfx_set_shader, omap_gfx_free, "omap", diff --git a/gfx/psp/psp1_gfx.c b/gfx/psp/psp1_gfx.c index bb18c302db..c335f34638 100644 --- a/gfx/psp/psp1_gfx.c +++ b/gfx/psp/psp1_gfx.c @@ -591,6 +591,12 @@ static bool psp_focus(void *data) return true; } +static bool psp_has_windowed(void *data) +{ + (void)data; + return false; +} + static void psp_free(void *data) { psp1_video_t *psp = (psp1_video_t*)data; @@ -851,6 +857,7 @@ video_driver_t video_psp1 = { psp_set_nonblock_state, psp_alive, psp_focus, + psp_has_windowed, psp_set_shader, psp_free, "psp1", diff --git a/gfx/sdl2_gfx.c b/gfx/sdl2_gfx.c index bd45bce3ed..63d111b498 100644 --- a/gfx/sdl2_gfx.c +++ b/gfx/sdl2_gfx.c @@ -534,6 +534,15 @@ static bool sdl2_gfx_focus(void *data) return (SDL_GetWindowFlags(vid->window) & flags) == flags; } +static bool sdl2_gfx_has_windowed(void *data) +{ + (void)data; + + /* TODO - implement */ + + return true; +} + static void sdl2_gfx_free(void *data) { sdl2_video_t *vid = (sdl2_video_t*)data; @@ -721,6 +730,7 @@ video_driver_t video_sdl2 = { sdl2_gfx_set_nonblock_state, sdl2_gfx_alive, sdl2_gfx_focus, + sdl2_gfx_has_windowed, sdl2_gfx_set_shader, sdl2_gfx_free, "sdl2", diff --git a/gfx/sdl_gfx.c b/gfx/sdl_gfx.c index 5affe6158c..a4e6a2160d 100644 --- a/gfx/sdl_gfx.c +++ b/gfx/sdl_gfx.c @@ -387,6 +387,14 @@ static bool sdl_gfx_focus(void *data) return (SDL_GetAppState() & (SDL_APPINPUTFOCUS | SDL_APPACTIVE)) == (SDL_APPINPUTFOCUS | SDL_APPACTIVE); } +static bool sdl_gfx_has_windowed(void *data) +{ + (void)data; + + /* TODO - implement. */ + return true; +} + static void sdl_gfx_viewport_info(void *data, struct rarch_viewport *vp) { sdl_video_t *vid = (sdl_video_t*)data; @@ -522,6 +530,7 @@ video_driver_t video_sdl = { sdl_gfx_set_nonblock_state, sdl_gfx_alive, sdl_gfx_focus, + sdl_gfx_has_windowed, sdl_gfx_set_shader, sdl_gfx_free, "sdl", diff --git a/gfx/vg.c b/gfx/vg.c index 039e1c549f..b6f75c601a 100644 --- a/gfx/vg.c +++ b/gfx/vg.c @@ -413,7 +413,17 @@ static bool vg_alive(void *data) static bool vg_focus(void *data) { vg_t *vg = (vg_t*)data; - return vg->driver->has_focus(vg); + if (vg && vg->driver) + return vg->driver->has_focus(vg); + return false; +} + +static bool vg_has_windowed(void *data) +{ + vg_t *vg = (vg_t*)data; + if (vg && vg->driver) + return vg->driver->has_windowed(vg); + return true; } static bool vg_set_shader(void *data, @@ -460,6 +470,7 @@ video_driver_t video_vg = { vg_set_nonblock_state, vg_alive, vg_focus, + vg_has_windowed, vg_set_shader, vg_free, "vg", diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index 8e2126aba3..080935c77f 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -291,6 +291,7 @@ static void thread_loop(void *data) bool ret = false; bool alive = false; bool focus = false; + bool has_windowed = true; struct rarch_viewport vp = {0}; if (thr->driver && thr->driver->frame) @@ -306,12 +307,16 @@ static void thread_loop(void *data) if (thr->driver && thr->driver->focus) focus = ret && thr->driver->focus(thr->driver_data); + if (thr->driver && thr->driver->has_windowed) + has_windowed = ret && thr->driver->has_windowed(thr->driver_data); + if (thr->driver && thr->driver->viewport_info) thr->driver->viewport_info(thr->driver_data, &vp); slock_lock(thr->lock); thr->alive = alive; thr->focus = focus; + thr->has_windowed = has_windowed; thr->frame.updated = false; thr->vp = vp; scond_signal(thr->cond_cmd); @@ -364,6 +369,15 @@ static bool thread_focus(void *data) return ret; } +static bool thread_has_windowed(void *data) +{ + thread_video_t *thr = (thread_video_t*)data; + slock_lock(thr->lock); + bool ret = thr->has_windowed; + slock_unlock(thr->lock); + return ret; +} + static bool thread_frame(void *data, const void *frame_, unsigned width, unsigned height, unsigned pitch, const char *msg) { @@ -474,6 +488,7 @@ static bool thread_init(thread_video_t *thr, const video_info_t *info, thr->info = *info; thr->alive = true; thr->focus = true; + thr->has_windowed = true; size_t max_size = info->input_scale * RARCH_SCALE_BASE; max_size *= max_size; @@ -788,6 +803,7 @@ static const video_driver_t video_thread = { thread_set_nonblock_state, thread_alive, thread_focus, + thread_has_windowed, thread_set_shader, thread_free, "Thread wrapper", diff --git a/gfx/video_thread_wrapper.h b/gfx/video_thread_wrapper.h index 347354736a..8447881123 100644 --- a/gfx/video_thread_wrapper.h +++ b/gfx/video_thread_wrapper.h @@ -97,6 +97,7 @@ typedef struct thread_video bool alive; bool focus; + bool has_windowed; bool nonblock; retro_time_t last_time; diff --git a/gfx/xenon360_gfx.c b/gfx/xenon360_gfx.c index 0316d40451..a44e747246 100644 --- a/gfx/xenon360_gfx.c +++ b/gfx/xenon360_gfx.c @@ -257,6 +257,12 @@ static bool xenon360_gfx_focus(void *data) return true; } +static bool xenon360_gfx_has_windowed(void *data) +{ + (void)data; + return false; +} + static void xenon360_gfx_set_rotation(void *data, unsigned rotation) { (void)data; @@ -306,6 +312,7 @@ video_driver_t video_xenon360 = { xenon360_gfx_set_nonblock_state, xenon360_gfx_alive, xenon360_gfx_focus, + xenon360_gfx_has_windowed, xenon360_gfx_set_shader, xenon360_gfx_free, "xenon360", diff --git a/gfx/xvideo.c b/gfx/xvideo.c index 0f203b7ccd..2ec0ed6328 100644 --- a/gfx/xvideo.c +++ b/gfx/xvideo.c @@ -777,6 +777,14 @@ static bool xv_focus(void *data) return xv->focus; } +static bool xv_has_windowed(void *data) +{ + (void)data; + + /* TODO - verify. */ + return true; +} + static void xv_free(void *data) { xv_t *xv = (xv_t*)data; @@ -850,6 +858,7 @@ video_driver_t video_xvideo = { xv_set_nonblock_state, xv_alive, xv_focus, + xv_has_windowed, xv_set_shader, xv_free, "xvideo", diff --git a/retroarch.c b/retroarch.c index 244dc5d76c..358bba048a 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1704,6 +1704,7 @@ static void check_disk_next( { unsigned num_disks = control->get_num_images(); unsigned current = control->get_image_index(); + if (num_disks && num_disks != UINT_MAX) { unsigned new_index = current;