diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 3f305729c6..fad69c8ad5 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -1917,6 +1917,7 @@ static void d3d_set_menu_texture_enable(void *data, #endif static const video_poke_interface_t d3d_poke_interface = { + NULL, NULL, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index f81b33e642..3882aab5d6 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -1613,6 +1613,7 @@ static void exynos_show_mouse(void *data, bool state) } static const video_poke_interface_t exynos_poke_interface = { + NULL, /* set_video_mode */ NULL, /* set_filtering */ NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 413fe24a1a..60f1f55bab 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -861,6 +861,15 @@ static void gl_set_rotation(void *data, unsigned rotation) gl_set_projection(gl, &ortho, true); } +static void gl_set_video_mode(void *data, unsigned width, unsigned height, + bool fullscreen) +{ + gl_t *gl = (gl_t*)data; + + if (gl && gl->ctx_driver && gl->ctx_driver->set_video_mode) + gl->ctx_driver->set_video_mode(gl, width, height, fullscreen); +} + #ifdef HAVE_FBO static inline void gl_start_frame_fbo(gl_t *gl) { @@ -3114,6 +3123,7 @@ static void gl_get_video_output_next(void *data) static const video_poke_interface_t gl_poke_interface = { + gl_set_video_mode, NULL, gl_get_video_output_size, gl_get_video_output_prev, diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index 6164d61876..649f5ae21a 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -138,6 +138,8 @@ enum GX_RESOLUTIONS_LAST, }; +static unsigned menu_current_gx_resolution = GX_RESOLUTIONS_640_480; + unsigned menu_gx_resolutions[GX_RESOLUTIONS_LAST][2] = { { 512, 192 }, { 598, 200 }, @@ -200,7 +202,8 @@ static void gx_free_overlay(gx_video_t *gx) } #endif -void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines) +static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, + bool fullscreen) { unsigned modetype, level, viHeightMultiplier, viWidth, tvmode, max_width, max_height, i; @@ -433,7 +436,7 @@ static void setup_video_mode(void *data) OSInitThreadQueue(&g_video_cond); VIDEO_GetPreferredMode(&gx_mode); - gx_set_video_mode(data, 0, 0); + gx_set_video_mode(data, 0, 0, true); } static void init_texture(void *data, unsigned width, unsigned height) @@ -1241,13 +1244,13 @@ static void gx_get_video_output_size(void *data, unsigned *width, unsigned *heig *height = menu_gx_resolutions[menu_current_gx_resolution][1]; } -static void gx_video_output_get_prev(void *data) +static void gx_get_video_output_prev(void *data) { if (menu_current_gx_resolution > 0) menu_current_gx_resolution--; } -static void gx_video_output_get_next(void *data) +static void gx_get_video_output_next(void *data) { if (menu_current_gx_resolution < GX_RESOLUTIONS_LAST - 1) { @@ -1262,6 +1265,7 @@ static void gx_video_output_get_next(void *data) } static const video_poke_interface_t gx_poke_interface = { + gx_set_video_mode, NULL, gx_get_video_output_size, gx_get_video_output_prev, diff --git a/gfx/drivers/gx_gfx.h b/gfx/drivers/gx_gfx.h index 3a75bee8ce..d3f7f6541e 100644 --- a/gfx/drivers/gx_gfx.h +++ b/gfx/drivers/gx_gfx.h @@ -46,8 +46,5 @@ typedef struct gx_video #endif } gx_video_t; -void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines); -const char *gx_get_video_mode(void); - #endif diff --git a/gfx/drivers/psp1_gfx.c b/gfx/drivers/psp1_gfx.c index 165336da51..ca5ed53ef5 100644 --- a/gfx/drivers/psp1_gfx.c +++ b/gfx/drivers/psp1_gfx.c @@ -840,6 +840,7 @@ static void psp_viewport_info(void *data, struct video_viewport *vp) } static const video_poke_interface_t psp_poke_interface = { + NULL, psp_set_filtering, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index 7ccfe89ac8..dc87bd2771 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -717,6 +717,7 @@ void sdl2_grab_mouse_toggle(void *data) } static video_poke_interface_t sdl2_video_poke_interface = { + NULL, sdl2_poke_set_filtering, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/sdl_gfx.c b/gfx/drivers/sdl_gfx.c index 172c46ee56..6707b1a08e 100644 --- a/gfx/drivers/sdl_gfx.c +++ b/gfx/drivers/sdl_gfx.c @@ -506,6 +506,7 @@ static void sdl_grab_mouse_toggle(void *data) } static const video_poke_interface_t sdl_poke_interface = { + NULL, sdl_set_filtering, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers_context/ps3_ctx.c b/gfx/drivers_context/ps3_ctx.c index e6df0d1afa..6ad154dd3c 100644 --- a/gfx/drivers_context/ps3_ctx.c +++ b/gfx/drivers_context/ps3_ctx.c @@ -315,6 +315,21 @@ static bool gfx_ctx_ps3_set_video_mode(void *data, bool fullscreen) { (void)data; + + if (g_extern.console.screen.resolutions.list[ + g_extern.console.screen.resolutions.current.idx] == + CELL_VIDEO_OUT_RESOLUTION_576) + { + if (g_extern.console.screen.pal_enable) + g_extern.console.screen.pal60_enable = true; + } + else + { + g_extern.console.screen.pal_enable = false; + g_extern.console.screen.pal60_enable = false; + } + + rarch_main_command(RARCH_CMD_REINIT); return true; } diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 9855bc988f..054fbc1ee3 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -92,6 +92,7 @@ enum texture_filter_type typedef struct video_poke_interface { + void (*set_video_mode)(void *data, unsigned width, unsigned height, bool fullscreen); void (*set_filtering)(void *data, unsigned index, bool smooth); void (*get_video_output_size)(void *data, unsigned *width, unsigned *height); void (*get_video_output_prev)(void *data); diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index e3991bb05f..65890d4625 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -249,6 +249,14 @@ static void thread_loop(void *data) break; #endif + case CMD_POKE_SET_VIDEO_MODE: + if (thr->poke && thr->poke->set_video_mode) + thr->poke->set_video_mode(thr->driver_data, + thr->cmd_data.new_mode.width, + thr->cmd_data.new_mode.height, + thr->cmd_data.new_mode.fullscreen); + thread_reply(thr, CMD_POKE_SET_VIDEO_MODE); + break; case CMD_POKE_SET_FILTERING: if (thr->poke && thr->poke->set_filtering) thr->poke->set_filtering(thr->driver_data, @@ -767,6 +775,20 @@ static void thread_get_overlay_interface(void *data, } #endif +static void thread_set_video_mode(void *data, unsigned width, unsigned height, + bool fullscreen) +{ + thread_video_t *thr = (thread_video_t*)data; + + if (!thr) + return; + thr->cmd_data.new_mode.width = width; + thr->cmd_data.new_mode.height = height; + thr->cmd_data.new_mode.fullscreen = fullscreen; + thread_send_cmd(thr, CMD_POKE_SET_VIDEO_MODE); + thread_wait_reply(thr, CMD_POKE_SET_VIDEO_MODE); +} + static void thread_set_filtering(void *data, unsigned idx, bool smooth) { thread_video_t *thr = (thread_video_t*)data; @@ -904,6 +926,7 @@ static struct video_shader *thread_get_current_shader(void *data) } static const video_poke_interface_t thread_poke = { + thread_set_video_mode, thread_set_filtering, thread_get_video_output_size, thread_get_video_output_prev, diff --git a/gfx/video_thread_wrapper.h b/gfx/video_thread_wrapper.h index d9e021348e..cf3d2fdbb3 100644 --- a/gfx/video_thread_wrapper.h +++ b/gfx/video_thread_wrapper.h @@ -41,6 +41,7 @@ enum thread_cmd CMD_OVERLAY_FULL_SCREEN, #endif + CMD_POKE_SET_VIDEO_MODE, CMD_POKE_SET_FILTERING, CMD_POKE_GET_VIDEO_OUTPUT_SIZE, CMD_POKE_GET_VIDEO_OUTPUT_PREV, @@ -143,6 +144,13 @@ typedef struct thread_video unsigned height; } output; + struct + { + unsigned width; + unsigned height; + bool fullscreen; + } new_mode; + struct { unsigned index; diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c index ed478986d6..4e63c51717 100644 --- a/menu/menu_entries_cbs.c +++ b/menu/menu_entries_cbs.c @@ -45,10 +45,6 @@ #include "../gfx/video_viewport.h" -#ifdef GEKKO -unsigned menu_current_gx_resolution = GX_RESOLUTIONS_640_480; -#endif - static unsigned rdb_entry_start_game_selection_ptr; static int archive_open(void) @@ -2376,7 +2372,6 @@ static int action_toggle_shader_num_passes(unsigned type, const char *label, static int action_ok_video_resolution(const char *path, const char *label, unsigned type, size_t idx) { -#ifdef GEKKO if (driver.video_data && driver.video_poke && driver.video_poke->get_video_output_size) { @@ -2384,24 +2379,11 @@ static int action_ok_video_resolution(const char *path, driver.video_poke->get_video_output_size(driver.video_data, &width, &height); - gx_set_video_mode(driver.video_data, width, height); + if (driver.video_data && driver.video_poke && + driver.video_poke->set_video_mode) + driver.video_poke->set_video_mode(driver.video_data, + width, height, true); } -#elif defined(__CELLOS_LV2__) - if (g_extern.console.screen.resolutions.list[ - g_extern.console.screen.resolutions.current.idx] == - CELL_VIDEO_OUT_RESOLUTION_576) - { - if (g_extern.console.screen.pal_enable) - g_extern.console.screen.pal60_enable = true; - } - else - { - g_extern.console.screen.pal_enable = false; - g_extern.console.screen.pal60_enable = false; - } - - rarch_main_command(RARCH_CMD_REINIT); -#endif return 0; }