(Vita) Start vita2d_gfx video driver

This commit is contained in:
Sergi Granell 2015-08-30 20:04:52 +02:00
parent 8f4b4c55b2
commit 3b54e81d00
5 changed files with 173 additions and 21 deletions

View File

@ -80,6 +80,11 @@ static void frontend_vita_get_environment_settings(int *argc, char *argv[],
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.remap,
"remaps", sizeof(g_defaults.dir.remap));
struct rarch_main_wrap *params = NULL;
params = (struct rarch_main_wrap*)params_data;
params->verbose = true;
#ifndef IS_SALAMANDER
if (argv[1] && (argv[1][0] != '\0'))
{

145
gfx/drivers/vita2d_gfx.c Normal file
View File

@ -0,0 +1,145 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015 - Sergi Granell (xerpi)
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "../../general.h"
#include "../../driver.h"
#include "../video_viewport.h"
static void *vita2d_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
*input = NULL;
*input_data = NULL;
(void)video;
vita2d_init();
vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF));
return (void*)-1;
}
static bool vita2d_gfx_frame(void *data, const void *frame,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg)
{
(void)data;
(void)frame;
(void)width;
(void)height;
(void)pitch;
(void)msg;
return true;
}
static void vita2d_gfx_set_nonblock_state(void *data, bool toggle)
{
(void)data;
(void)toggle;
}
static bool vita2d_gfx_alive(void *data)
{
(void)data;
return true;
}
static bool vita2d_gfx_focus(void *data)
{
(void)data;
return true;
}
static bool vita2d_gfx_suppress_screensaver(void *data, bool enable)
{
(void)data;
(void)enable;
return false;
}
static bool vita2d_gfx_has_windowed(void *data)
{
(void)data;
return true;
}
static void vita2d_gfx_free(void *data)
{
(void)data;
vita2d_fini();
}
static bool vita2d_gfx_set_shader(void *data,
enum rarch_shader_type type, const char *path)
{
(void)data;
(void)type;
(void)path;
return false;
}
static void vita2d_gfx_set_rotation(void *data,
unsigned rotation)
{
(void)data;
(void)rotation;
}
static void vita2d_gfx_viewport_info(void *data,
struct video_viewport *vp)
{
(void)data;
(void)vp;
}
static bool vita2d_gfx_read_viewport(void *data, uint8_t *buffer)
{
(void)data;
(void)buffer;
return true;
}
static void vita2d_gfx_get_poke_interface(void *data,
const video_poke_interface_t **iface)
{
(void)data;
(void)iface;
}
video_driver_t video_vita2d = {
vita2d_gfx_init,
vita2d_gfx_frame,
vita2d_gfx_set_nonblock_state,
vita2d_gfx_alive,
vita2d_gfx_focus,
vita2d_gfx_suppress_screensaver,
vita2d_gfx_has_windowed,
vita2d_gfx_set_shader,
vita2d_gfx_free,
"vita2d",
NULL, /* set_viewport */
vita2d_gfx_set_rotation,
vita2d_gfx_viewport_info,
vita2d_gfx_read_viewport,
NULL, /* read_frame_raw */
#ifdef HAVE_OVERLAY
NULL, /* overlay_interface */
#endif
vita2d_gfx_get_poke_interface,
};

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - 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.
@ -70,8 +70,8 @@ static const video_driver_t *video_drivers[] = {
#if defined(HAVE_D3D)
&video_d3d,
#endif
#ifdef SN_TARGET_PSP2
&video_vita,
#ifdef HAVE_VITA2D
&video_vita2d,
#endif
#ifdef PSP
&video_psp1,
@ -233,7 +233,7 @@ void find_video_driver(void)
* video_driver_get_ptr:
* @drv : real video driver will be set to this.
*
* Use this if you need the real video driver
* Use this if you need the real video driver
* and driver data pointers.
*
* Returns: video driver's userdata.
@ -323,7 +323,7 @@ static void init_video_filter(enum retro_pixel_format colfmt)
unsigned width, height, pow2_x, pow2_y, maxsize;
struct retro_game_geometry *geom = NULL;
settings_t *settings = config_get_ptr();
struct retro_system_av_info *av_info =
struct retro_system_av_info *av_info =
video_viewport_get_system_av_info();
deinit_video_filter();
@ -360,7 +360,7 @@ static void init_video_filter(enum retro_pixel_format colfmt)
pow2_x = next_pow2(width);
pow2_y = next_pow2(height);
maxsize = max(pow2_x, pow2_y);
maxsize = max(pow2_x, pow2_y);
video_state.filter.scale = maxsize / RARCH_SCALE_BASE;
video_state.filter.out_rgb32 = rarch_softfilter_get_output_format(
video_state.filter.filter) == RETRO_PIXEL_FORMAT_XRGB8888;
@ -398,8 +398,8 @@ static void init_video_input(const input_driver_t *tmp)
if (!driver->input)
{
/* This should never really happen as tmp (driver.input) is always
* found before this in find_driver_input(), or we have aborted
/* This should never really happen as tmp (driver.input) is always
* found before this in find_driver_input(), or we have aborted
* in a similar fashion anyways. */
rarch_fail(1, "init_video_input()");
}
@ -452,7 +452,7 @@ void init_video(void)
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
struct retro_system_av_info *av_info =
struct retro_system_av_info *av_info =
video_viewport_get_system_av_info();
init_video_filter(video_state.pix_fmt);
@ -478,7 +478,7 @@ void init_video(void)
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
float default_aspect = aspectratio_lut[ASPECT_RATIO_CORE].value;
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
(custom_vp->width && custom_vp->height) ?
(float)custom_vp->width / custom_vp->height : default_aspect;
}
@ -496,7 +496,7 @@ void init_video(void)
if (settings->video.force_aspect)
{
/* Do rounding here to simplify integer scale correctness. */
unsigned base_width =
unsigned base_width =
roundf(geom->base_height * video_driver_get_aspect_ratio());
width = roundf(base_width * settings->video.scale);
}
@ -531,8 +531,8 @@ void init_video(void)
#endif
video.smooth = settings->video.smooth;
video.input_scale = scale;
video.rgb32 = video_state.filter.filter ?
video_state.filter.out_rgb32 :
video.rgb32 = video_state.filter.filter ?
video_state.filter.out_rgb32 :
(video_state.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888);
tmp = (const input_driver_t*)driver->input;
@ -911,7 +911,7 @@ void video_monitor_adjust_system_rates(void)
{
float timing_skew;
const struct retro_system_timing *info = NULL;
struct retro_system_av_info *av_info =
struct retro_system_av_info *av_info =
video_viewport_get_system_av_info();
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
@ -1016,7 +1016,7 @@ bool video_monitor_fps_statistics(double *refresh_rate,
retro_time_t accum = 0, avg, accum_var = 0;
unsigned samples = 0;
settings_t *settings = config_get_ptr();
samples = min(MEASURE_FRAME_TIME_SAMPLES_COUNT,
video_state.frame_time_samples_count);

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - 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.
@ -129,11 +129,11 @@ typedef struct video_poke_interface
typedef struct video_driver
{
/* Should the video driver act as an input driver as well?
* The video initialization might preinitialize an input driver
* to override the settings in case the video driver relies on
* The video initialization might preinitialize an input driver
* to override the settings in case the video driver relies on
* input driver for event handling. */
void *(*init)(const video_info_t *video, const input_driver_t **input,
void **input_data);
void **input_data);
/* msg is for showing a message on the screen along with the video frame. */
bool (*frame)(void *data, const void *frame, unsigned width,
@ -190,7 +190,7 @@ typedef struct video_driver
extern video_driver_t video_gl;
extern video_driver_t video_psp1;
extern video_driver_t video_vita;
extern video_driver_t video_vita2d;
extern video_driver_t video_ctr;
extern video_driver_t video_d3d;
extern video_driver_t video_gx;
@ -250,7 +250,7 @@ void find_video_driver(void);
* video_driver_get_ptr:
* @drv : real video driver will be set to this.
*
* Use this if you need the real video driver
* Use this if you need the real video driver
* and driver data pointers.
*
* Returns: video driver's userdata.

View File

@ -236,6 +236,8 @@ VIDEO DRIVER
#include "../gfx/drivers/gx_gfx.c"
#elif defined(PSP)
#include "../gfx/drivers/psp1_gfx.c"
#elif defined(HAVE_VITA2D)
#include "../gfx/drivers/vita2d_gfx.c"
#elif defined(_3DS)
#include "../gfx/drivers/ctr_gfx.c"
#elif defined(XENON)