(PS3) Implement video output get prev/next

This commit is contained in:
twinaphex 2015-11-21 07:54:42 +01:00
parent 60aad558d8
commit 1c3ba76e67
6 changed files with 60 additions and 41 deletions

View File

@ -355,6 +355,39 @@ static bool gfx_ctx_ps3_bind_api(void *data,
return api == GFX_CTX_OPENGL_API || GFX_CTX_OPENGL_ES_API;
}
static void gfx_ctx_ps3_get_video_output_prev(void *data)
{
global_t *global = global_get_ptr();
if (!global)
return;
if (global->console.screen.resolutions.current.idx)
{
global->console.screen.resolutions.current.idx--;
global->console.screen.resolutions.current.id =
global->console.screen.resolutions.list
[global->console.screen.resolutions.current.idx];
}
}
static void gfx_ctx_ps3_get_video_output_next(void *data)
{
global_t *global = global_get_ptr();
if (!global)
return;
if (global->console.screen.resolutions.current.idx + 1 <
global->console.screen.resolutions.count)
{
global->console.screen.resolutions.current.idx++;
global->console.screen.resolutions.current.id =
global->console.screen.resolutions.list
[global->console.screen.resolutions.current.idx];
}
}
const gfx_ctx_driver_t gfx_ctx_ps3 = {
gfx_ctx_ps3_init,
gfx_ctx_ps3_destroy,
@ -363,8 +396,8 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
gfx_ctx_ps3_set_video_mode,
gfx_ctx_ps3_get_video_size,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
gfx_ctx_ps3_get_video_output_prev,
gfx_ctx_ps3_get_video_output_next,
NULL, /* get_metrics */
NULL,
gfx_ctx_ps3_update_window_title,

View File

@ -119,20 +119,30 @@ void gfx_ctx_get_video_output_size(void *data,
ctx->get_video_output_size(data, width, height);
}
void gfx_ctx_get_video_output_prev(void *data)
bool gfx_ctx_get_video_output_prev(void *data)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (ctx->get_video_output_prev)
{
ctx->get_video_output_prev(data);
return true;
}
return false;
}
void gfx_ctx_get_video_output_next(void *data)
bool gfx_ctx_get_video_output_next(void *data)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (ctx->get_video_output_next)
{
ctx->get_video_output_next(data);
return true;
}
return false;
}
void gfx_ctx_swap_buffers(void *data)

View File

@ -241,9 +241,9 @@ void gfx_ctx_bind_hw_render(void *data, bool enable);
void gfx_ctx_get_video_output_size(void *data,
unsigned *width, unsigned *height);
void gfx_ctx_get_video_output_prev(void *data);
bool gfx_ctx_get_video_output_prev(void *data);
void gfx_ctx_get_video_output_next(void *data);
bool gfx_ctx_get_video_output_next(void *data);
const char *gfx_ctx_get_ident(void);

View File

@ -18,6 +18,7 @@
#include "video_thread_wrapper.h"
#include "video_pixel_converter.h"
#include "video_context_driver.h"
#include "video_monitor.h"
#include "../general.h"
#include "../performance.h"
@ -1124,15 +1125,19 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
switch (state)
{
case RARCH_DISPLAY_CTL_GET_NEXT_VIDEO_OUT:
if (!poke || !poke->get_video_output_next)
return false;
if (poke && poke->get_video_output_next)
{
poke->get_video_output_next(driver->video_data);
return true;
return true;
}
return gfx_ctx_get_video_output_next(driver->video_data);
case RARCH_DISPLAY_CTL_GET_PREV_VIDEO_OUT:
if (!poke || !poke->get_video_output_prev)
return false;
if (poke && poke->get_video_output_prev)
{
poke->get_video_output_prev(driver->video_data);
return true;
return true;
}
return gfx_ctx_get_video_output_next(driver->video_data);
case RARCH_DISPLAY_CTL_INIT:
return init_video();
case RARCH_DISPLAY_CTL_DEINIT:

View File

@ -280,21 +280,7 @@ static int action_left_shader_num_passes(unsigned type, const char *label,
static int action_left_video_resolution(unsigned type, const char *label,
bool wraparound)
{
global_t *global = global_get_ptr();
(void)global;
#if defined(__CELLOS_LV2__)
if (global->console.screen.resolutions.current.idx)
{
global->console.screen.resolutions.current.idx--;
global->console.screen.resolutions.current.id =
global->console.screen.resolutions.list
[global->console.screen.resolutions.current.idx];
}
#else
video_driver_ctl(RARCH_DISPLAY_CTL_GET_PREV_VIDEO_OUT, NULL);
#endif
return 0;
}

View File

@ -304,22 +304,7 @@ static int action_right_shader_num_passes(unsigned type, const char *label,
static int action_right_video_resolution(unsigned type, const char *label,
bool wraparound)
{
global_t *global = global_get_ptr();
(void)global;
#if defined(__CELLOS_LV2__)
if (global->console.screen.resolutions.current.idx + 1 <
global->console.screen.resolutions.count)
{
global->console.screen.resolutions.current.idx++;
global->console.screen.resolutions.current.id =
global->console.screen.resolutions.list
[global->console.screen.resolutions.current.idx];
}
#else
video_driver_ctl(RARCH_DISPLAY_CTL_GET_NEXT_VIDEO_OUT, NULL);
#endif
return 0;
}