mirror of
https://github.com/libretro/RetroArch
synced 2025-02-23 06:41:04 +00:00
(Vita) Update vita2d driver
(Vita/PSP) Name some stuff to vita
This commit is contained in:
parent
de8dfb627c
commit
96146e5313
@ -302,7 +302,11 @@ audio_driver_t audio_psp = {
|
||||
psp_audio_set_nonblock_state,
|
||||
psp_audio_free,
|
||||
psp_audio_use_float,
|
||||
#ifdef VITA
|
||||
"vita",
|
||||
#else
|
||||
"psp",
|
||||
#endif
|
||||
psp_write_avail,
|
||||
psp_buffer_size,
|
||||
};
|
||||
|
@ -115,7 +115,11 @@ const char *config_get_default_audio(void)
|
||||
case AUDIO_WII:
|
||||
return "gx";
|
||||
case AUDIO_PSP:
|
||||
#ifdef VITA
|
||||
return "vita";
|
||||
#else
|
||||
return "psp";
|
||||
#endif
|
||||
case AUDIO_CTR:
|
||||
return "ctr";
|
||||
case AUDIO_RWEBAUDIO:
|
||||
@ -231,7 +235,11 @@ const char *config_get_default_input(void)
|
||||
case INPUT_PS3:
|
||||
return "ps3";
|
||||
case INPUT_PSP:
|
||||
#ifdef VITA
|
||||
return "vita";
|
||||
#else
|
||||
return "psp";
|
||||
#endif
|
||||
case INPUT_CTR:
|
||||
return "ctr";
|
||||
case INPUT_SDL:
|
||||
@ -287,7 +295,11 @@ const char *config_get_default_joypad(void)
|
||||
case JOYPAD_XDK:
|
||||
return "xdk";
|
||||
case JOYPAD_PSP:
|
||||
#ifdef VITA
|
||||
return "vita";
|
||||
#else
|
||||
return "psp";
|
||||
#endif
|
||||
case JOYPAD_CTR:
|
||||
return "ctr";
|
||||
case JOYPAD_DINPUT:
|
||||
|
@ -198,7 +198,6 @@ static int frontend_vita_get_rating(void)
|
||||
static enum frontend_powerstate frontend_vita_get_powerstate(int *seconds, int *percent)
|
||||
{
|
||||
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
|
||||
int battery = 1;
|
||||
int plugged = scePowerIsPowerOnline();
|
||||
int charging = scePowerIsBatteryCharging();
|
||||
|
||||
|
@ -36,6 +36,9 @@ typedef struct vita_menu_frame
|
||||
typedef struct vita_video
|
||||
{
|
||||
vita2d_texture *texture;
|
||||
SceGxmTextureFormat format;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
bool vsync;
|
||||
bool rgb32;
|
||||
@ -63,20 +66,18 @@ static void *vita2d_gfx_init(const video_info_t *video,
|
||||
if (!vita)
|
||||
return NULL;
|
||||
|
||||
RARCH_LOG("vita2d_gfx_init: w: %i h: %i\n", video->width, video->height);
|
||||
|
||||
vita2d_init();
|
||||
vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF));
|
||||
vita2d_set_vblank_wait(video->vsync);
|
||||
|
||||
if (vita->rgb32)
|
||||
{
|
||||
vita->texture = vita2d_create_empty_texture(video->width, video->height);
|
||||
RARCH_LOG("Creating RGBA8 texture: w: %i h: %i\n", video->width, video->height);
|
||||
}
|
||||
vita->format = SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB;
|
||||
else
|
||||
{
|
||||
vita->texture = vita2d_create_empty_texture_format(video->width, video->height, SCE_GXM_TEXTURE_FORMAT_R5G6B5);
|
||||
RARCH_LOG("Creating R5G6B5 texture: w: %i h: %i\n", video->width, video->height);
|
||||
}
|
||||
vita->format = SCE_GXM_TEXTURE_FORMAT_R5G6B5;
|
||||
|
||||
vita->texture = NULL;
|
||||
|
||||
vita->menu.frame = NULL;
|
||||
vita->menu.active = 0;
|
||||
@ -100,6 +101,8 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
int i, j;
|
||||
void *tex_p;
|
||||
vita_video_t *vita = (vita_video_t *)data;
|
||||
(void)frame;
|
||||
(void)width;
|
||||
@ -107,9 +110,37 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
(void)pitch;
|
||||
(void)msg;
|
||||
|
||||
void *tex_p = vita2d_texture_get_datap(vita->texture);
|
||||
unsigned int tex_stride = vita2d_texture_get_stride(vita->texture);
|
||||
const unsigned int *frame_p = frame;
|
||||
if (frame)
|
||||
{
|
||||
if (width != vita->width && height != vita->height && vita->texture)
|
||||
{
|
||||
vita2d_free_texture(vita->texture);
|
||||
vita->texture = NULL;
|
||||
}
|
||||
|
||||
if (!vita->texture)
|
||||
{
|
||||
vita->width = width;
|
||||
vita->height = height;
|
||||
vita->texture = vita2d_create_empty_texture_format(width, height, vita->format);
|
||||
}
|
||||
|
||||
tex_p = vita2d_texture_get_datap(vita->texture);
|
||||
|
||||
if (vita->format == SCE_GXM_TEXTURE_FORMAT_A8B8G8R8)
|
||||
{
|
||||
for (i = 0; i < height; i++)
|
||||
for (j = 0; j < width; j++)
|
||||
*(unsigned int *)(tex_p + (j + i*height) * 4) = *(unsigned int *)(frame + (j + i*height) * 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*for (i = 0; i < height; i++)
|
||||
for (j = 0; j < width; j++)
|
||||
*(unsigned short *)(tex_p + (j + i*height) * 2) = *(unsigned short *)(frame + (j + i*height) * 2);*/
|
||||
memcpy(tex_p, frame, width*height*2);
|
||||
}
|
||||
}
|
||||
|
||||
// RARCH_LOG("w: %i h: %i pitch: %i\n", width, height, pitch);
|
||||
// RARCH_LOG("msg: %s\n", msg);
|
||||
@ -117,22 +148,17 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
vita2d_start_drawing();
|
||||
vita2d_clear_screen();
|
||||
|
||||
/* int i, j;
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
*(unsigned int *)(tex_p + i*4 + j * tex_stride) = frame_p[i + j * width];
|
||||
}
|
||||
} */
|
||||
// memcpy(tex_p, frame, height*pitch);
|
||||
|
||||
// vita2d_draw_texture(vita->texture, 0, 0);
|
||||
if (frame && vita->texture)
|
||||
vita2d_draw_texture_scale(vita->texture,
|
||||
SCREEN_W/2 - (vita->width/2)*2,
|
||||
SCREEN_H/2 - (vita->height/2)*2,
|
||||
2.0f, 2.0f);
|
||||
|
||||
if (vita->menu.active && vita->menu.frame)
|
||||
vita2d_draw_texture(vita->menu.frame,
|
||||
SCREEN_W/2 - vita->menu.width/2,
|
||||
SCREEN_H/2 - vita->menu.height/2);
|
||||
vita2d_draw_texture_scale(vita->menu.frame,
|
||||
SCREEN_W/2 - (vita->menu.width/2)*2,
|
||||
SCREEN_H/2 - (vita->menu.height/2)*2,
|
||||
2.0f, 2.0f);
|
||||
|
||||
vita2d_end_drawing();
|
||||
vita2d_swap_buffers();
|
||||
@ -222,12 +248,13 @@ static bool vita2d_gfx_read_viewport(void *data, uint8_t *buffer)
|
||||
|
||||
static void vita_set_filtering(void *data, unsigned index, bool smooth)
|
||||
{
|
||||
vita_video_t *psp = (vita_video_t*)data;
|
||||
(void)data;
|
||||
(void)index;
|
||||
(void)smooth;
|
||||
}
|
||||
|
||||
static void vita_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
||||
{
|
||||
vita_video_t *vid = (vita_video_t*)data;
|
||||
struct retro_system_av_info *av_info =
|
||||
video_viewport_get_system_av_info();
|
||||
|
||||
@ -264,7 +291,6 @@ static void vita_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
{
|
||||
int i, j;
|
||||
void *tex_p;
|
||||
unsigned int stride;
|
||||
vita_video_t *vita = (vita_video_t*)data;
|
||||
|
||||
(void)alpha;
|
||||
@ -275,7 +301,6 @@ static void vita_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
vita->menu.frame = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (!vita->menu.frame)
|
||||
{
|
||||
if (rgb32)
|
||||
@ -285,7 +310,7 @@ static void vita_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
}
|
||||
else
|
||||
{
|
||||
vita->menu.frame = vita2d_create_empty_texture_format(width, height, SCE_GXM_TEXTURE_FORMAT_R5G6B5);
|
||||
vita->menu.frame = vita2d_create_empty_texture_format(width, height, SCE_GXM_TEXTURE_FORMAT_U4U4U4U4_RGBA);
|
||||
RARCH_LOG("Creating Frame R5G6B5 texture: w: %i h: %i\n", width, height);
|
||||
}
|
||||
vita->menu.width = width;
|
||||
@ -293,7 +318,6 @@ static void vita_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
}
|
||||
|
||||
tex_p = vita2d_texture_get_datap(vita->menu.frame);
|
||||
stride = vita2d_texture_get_stride(vita->menu.frame);
|
||||
|
||||
if (rgb32)
|
||||
{
|
||||
@ -365,5 +389,5 @@ video_driver_t video_vita2d = {
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
vita2d_gfx_get_poke_interface,
|
||||
vita2d_gfx_get_poke_interface,
|
||||
};
|
||||
|
@ -42,7 +42,11 @@ DECL_AXIS(r_y_minus, +3)
|
||||
|
||||
const char* const input_builtin_autoconfs[] =
|
||||
{
|
||||
#ifdef VITA
|
||||
DECL_AUTOCONF_DEVICE("Vita Controller", "vita", PSPINPUT_DEFAULT_BINDS),
|
||||
#else
|
||||
DECL_AUTOCONF_DEVICE("PSP Controller", "psp", PSPINPUT_DEFAULT_BINDS),
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -171,7 +171,11 @@ input_driver_t input_psp = {
|
||||
NULL,
|
||||
NULL,
|
||||
psp_input_get_capabilities,
|
||||
#ifdef VITA
|
||||
"vita",
|
||||
#else
|
||||
"psp",
|
||||
#endif
|
||||
|
||||
psp_input_grab_mouse,
|
||||
NULL,
|
||||
|
@ -23,7 +23,11 @@ extern uint64_t lifecycle_state;
|
||||
|
||||
static const char *psp_joypad_name(unsigned pad)
|
||||
{
|
||||
#ifdef VITA
|
||||
return "Vita Controller";
|
||||
#else
|
||||
return "PSP Controller";
|
||||
#endif
|
||||
}
|
||||
|
||||
static void psp_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
@ -188,5 +192,9 @@ input_device_driver_t psp_joypad = {
|
||||
psp_joypad_poll,
|
||||
NULL,
|
||||
psp_joypad_name,
|
||||
#ifdef VITA
|
||||
"vita",
|
||||
#else
|
||||
"psp",
|
||||
#endif
|
||||
};
|
||||
|
@ -232,7 +232,7 @@ static bool input_autoconfigure_joypad_from_conf_dir(
|
||||
else
|
||||
{
|
||||
RARCH_LOG("Autodetect: no profiles found for %s (%d/%d)", params->name, params->vid, params->pid);
|
||||
snprintf(msg, sizeof(msg), "%s (%d/%d) not configured", params->name, params->vid, params->pid);
|
||||
snprintf(msg, sizeof(msg), "%s (%ld/%ld) not configured", params->name, params->vid, params->pid);
|
||||
rarch_main_msg_queue_push(msg, 0, 60, false);
|
||||
ret = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user