mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 09:39:56 +00:00
Implement set_video_mode in video poke interface
This commit is contained in:
parent
88137521c4
commit
f80e3740aa
@ -1917,6 +1917,7 @@ static void d3d_set_menu_texture_enable(void *data,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const video_poke_interface_t d3d_poke_interface = {
|
static const video_poke_interface_t d3d_poke_interface = {
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL, /* get_video_output_size */
|
NULL, /* get_video_output_size */
|
||||||
NULL, /* get_video_output_prev */
|
NULL, /* get_video_output_prev */
|
||||||
|
@ -1613,6 +1613,7 @@ static void exynos_show_mouse(void *data, bool state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const video_poke_interface_t exynos_poke_interface = {
|
static const video_poke_interface_t exynos_poke_interface = {
|
||||||
|
NULL, /* set_video_mode */
|
||||||
NULL, /* set_filtering */
|
NULL, /* set_filtering */
|
||||||
NULL, /* get_video_output_size */
|
NULL, /* get_video_output_size */
|
||||||
NULL, /* get_video_output_prev */
|
NULL, /* get_video_output_prev */
|
||||||
|
@ -861,6 +861,15 @@ static void gl_set_rotation(void *data, unsigned rotation)
|
|||||||
gl_set_projection(gl, &ortho, true);
|
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
|
#ifdef HAVE_FBO
|
||||||
static inline void gl_start_frame_fbo(gl_t *gl)
|
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 = {
|
static const video_poke_interface_t gl_poke_interface = {
|
||||||
|
gl_set_video_mode,
|
||||||
NULL,
|
NULL,
|
||||||
gl_get_video_output_size,
|
gl_get_video_output_size,
|
||||||
gl_get_video_output_prev,
|
gl_get_video_output_prev,
|
||||||
|
@ -138,6 +138,8 @@ enum
|
|||||||
GX_RESOLUTIONS_LAST,
|
GX_RESOLUTIONS_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static unsigned menu_current_gx_resolution = GX_RESOLUTIONS_640_480;
|
||||||
|
|
||||||
unsigned menu_gx_resolutions[GX_RESOLUTIONS_LAST][2] = {
|
unsigned menu_gx_resolutions[GX_RESOLUTIONS_LAST][2] = {
|
||||||
{ 512, 192 },
|
{ 512, 192 },
|
||||||
{ 598, 200 },
|
{ 598, 200 },
|
||||||
@ -200,7 +202,8 @@ static void gx_free_overlay(gx_video_t *gx)
|
|||||||
}
|
}
|
||||||
#endif
|
#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,
|
unsigned modetype, level, viHeightMultiplier, viWidth, tvmode,
|
||||||
max_width, max_height, i;
|
max_width, max_height, i;
|
||||||
@ -433,7 +436,7 @@ static void setup_video_mode(void *data)
|
|||||||
OSInitThreadQueue(&g_video_cond);
|
OSInitThreadQueue(&g_video_cond);
|
||||||
|
|
||||||
VIDEO_GetPreferredMode(&gx_mode);
|
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)
|
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];
|
*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)
|
if (menu_current_gx_resolution > 0)
|
||||||
menu_current_gx_resolution--;
|
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)
|
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 = {
|
static const video_poke_interface_t gx_poke_interface = {
|
||||||
|
gx_set_video_mode,
|
||||||
NULL,
|
NULL,
|
||||||
gx_get_video_output_size,
|
gx_get_video_output_size,
|
||||||
gx_get_video_output_prev,
|
gx_get_video_output_prev,
|
||||||
|
@ -46,8 +46,5 @@ typedef struct gx_video
|
|||||||
#endif
|
#endif
|
||||||
} gx_video_t;
|
} gx_video_t;
|
||||||
|
|
||||||
void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines);
|
|
||||||
const char *gx_get_video_mode(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -840,6 +840,7 @@ static void psp_viewport_info(void *data, struct video_viewport *vp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const video_poke_interface_t psp_poke_interface = {
|
static const video_poke_interface_t psp_poke_interface = {
|
||||||
|
NULL,
|
||||||
psp_set_filtering,
|
psp_set_filtering,
|
||||||
NULL, /* get_video_output_size */
|
NULL, /* get_video_output_size */
|
||||||
NULL, /* get_video_output_prev */
|
NULL, /* get_video_output_prev */
|
||||||
|
@ -717,6 +717,7 @@ void sdl2_grab_mouse_toggle(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static video_poke_interface_t sdl2_video_poke_interface = {
|
static video_poke_interface_t sdl2_video_poke_interface = {
|
||||||
|
NULL,
|
||||||
sdl2_poke_set_filtering,
|
sdl2_poke_set_filtering,
|
||||||
NULL, /* get_video_output_size */
|
NULL, /* get_video_output_size */
|
||||||
NULL, /* get_video_output_prev */
|
NULL, /* get_video_output_prev */
|
||||||
|
@ -506,6 +506,7 @@ static void sdl_grab_mouse_toggle(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const video_poke_interface_t sdl_poke_interface = {
|
static const video_poke_interface_t sdl_poke_interface = {
|
||||||
|
NULL,
|
||||||
sdl_set_filtering,
|
sdl_set_filtering,
|
||||||
NULL, /* get_video_output_size */
|
NULL, /* get_video_output_size */
|
||||||
NULL, /* get_video_output_prev */
|
NULL, /* get_video_output_prev */
|
||||||
|
@ -315,6 +315,21 @@ static bool gfx_ctx_ps3_set_video_mode(void *data,
|
|||||||
bool fullscreen)
|
bool fullscreen)
|
||||||
{
|
{
|
||||||
(void)data;
|
(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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ enum texture_filter_type
|
|||||||
|
|
||||||
typedef struct video_poke_interface
|
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 (*set_filtering)(void *data, unsigned index, bool smooth);
|
||||||
void (*get_video_output_size)(void *data, unsigned *width, unsigned *height);
|
void (*get_video_output_size)(void *data, unsigned *width, unsigned *height);
|
||||||
void (*get_video_output_prev)(void *data);
|
void (*get_video_output_prev)(void *data);
|
||||||
|
@ -249,6 +249,14 @@ static void thread_loop(void *data)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#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:
|
case CMD_POKE_SET_FILTERING:
|
||||||
if (thr->poke && thr->poke->set_filtering)
|
if (thr->poke && thr->poke->set_filtering)
|
||||||
thr->poke->set_filtering(thr->driver_data,
|
thr->poke->set_filtering(thr->driver_data,
|
||||||
@ -767,6 +775,20 @@ static void thread_get_overlay_interface(void *data,
|
|||||||
}
|
}
|
||||||
#endif
|
#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)
|
static void thread_set_filtering(void *data, unsigned idx, bool smooth)
|
||||||
{
|
{
|
||||||
thread_video_t *thr = (thread_video_t*)data;
|
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 = {
|
static const video_poke_interface_t thread_poke = {
|
||||||
|
thread_set_video_mode,
|
||||||
thread_set_filtering,
|
thread_set_filtering,
|
||||||
thread_get_video_output_size,
|
thread_get_video_output_size,
|
||||||
thread_get_video_output_prev,
|
thread_get_video_output_prev,
|
||||||
|
@ -41,6 +41,7 @@ enum thread_cmd
|
|||||||
CMD_OVERLAY_FULL_SCREEN,
|
CMD_OVERLAY_FULL_SCREEN,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CMD_POKE_SET_VIDEO_MODE,
|
||||||
CMD_POKE_SET_FILTERING,
|
CMD_POKE_SET_FILTERING,
|
||||||
CMD_POKE_GET_VIDEO_OUTPUT_SIZE,
|
CMD_POKE_GET_VIDEO_OUTPUT_SIZE,
|
||||||
CMD_POKE_GET_VIDEO_OUTPUT_PREV,
|
CMD_POKE_GET_VIDEO_OUTPUT_PREV,
|
||||||
@ -143,6 +144,13 @@ typedef struct thread_video
|
|||||||
unsigned height;
|
unsigned height;
|
||||||
} output;
|
} output;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
bool fullscreen;
|
||||||
|
} new_mode;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned index;
|
unsigned index;
|
||||||
|
@ -45,10 +45,6 @@
|
|||||||
|
|
||||||
#include "../gfx/video_viewport.h"
|
#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 unsigned rdb_entry_start_game_selection_ptr;
|
||||||
|
|
||||||
static int archive_open(void)
|
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,
|
static int action_ok_video_resolution(const char *path,
|
||||||
const char *label, unsigned type, size_t idx)
|
const char *label, unsigned type, size_t idx)
|
||||||
{
|
{
|
||||||
#ifdef GEKKO
|
|
||||||
if (driver.video_data && driver.video_poke &&
|
if (driver.video_data && driver.video_poke &&
|
||||||
driver.video_poke->get_video_output_size)
|
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,
|
driver.video_poke->get_video_output_size(driver.video_data,
|
||||||
&width, &height);
|
&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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user