mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
(Vita) Cleanups
This commit is contained in:
parent
e32e85c964
commit
1310263470
@ -21,7 +21,7 @@
|
||||
ERROR PROTOTYPES
|
||||
============================================================ */
|
||||
|
||||
#if defined(PSP)
|
||||
#ifndef SCE_OK
|
||||
#define SCE_OK 0
|
||||
#endif
|
||||
|
||||
|
@ -22,9 +22,6 @@
|
||||
|
||||
#include <vita2d.h>
|
||||
|
||||
#define SCREEN_W 960
|
||||
#define SCREEN_H 544
|
||||
|
||||
typedef struct vita_menu_frame
|
||||
{
|
||||
bool active;
|
||||
@ -71,7 +68,6 @@ static void *vita2d_gfx_init(const video_info_t *video,
|
||||
RARCH_LOG("RARCH_SCALE_BASE: %i input_scale: %i = %i\n",
|
||||
RARCH_SCALE_BASE, video->input_scale, RARCH_SCALE_BASE * video->input_scale);
|
||||
|
||||
|
||||
vita2d_init();
|
||||
vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF));
|
||||
vita2d_set_vblank_wait(video->vsync);
|
||||
@ -116,6 +112,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
void *tex_p;
|
||||
unsigned int stride;
|
||||
vita_video_t *vita = (vita_video_t *)data;
|
||||
|
||||
(void)frame;
|
||||
(void)width;
|
||||
(void)height;
|
||||
@ -145,8 +142,9 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
{
|
||||
stride /= 4;
|
||||
pitch /= 4;
|
||||
unsigned int *tex32 = tex_p;
|
||||
const unsigned int *frame32 = frame;
|
||||
uint32_t *tex32 = tex_p;
|
||||
const uint32_t *frame32 = frame;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
for (j = 0; j < width; j++)
|
||||
tex32[j + i*stride] = frame32[j + i*pitch];
|
||||
@ -155,8 +153,9 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
{
|
||||
stride /= 2;
|
||||
pitch /= 2;
|
||||
unsigned short *tex16 = tex_p;
|
||||
const unsigned short *frame16 = frame;
|
||||
uint16_t *tex16 = tex_p;
|
||||
const uint16_t *frame16 = frame;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
for (j = 0; j < width; j++)
|
||||
tex16[j + i*stride] = frame16[j + i*pitch];
|
||||
@ -171,52 +170,58 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
if (vita->fullscreen)
|
||||
vita2d_draw_texture_scale(vita->texture,
|
||||
0, 0,
|
||||
SCREEN_W/(float)vita->width,
|
||||
SCREEN_H/(float)vita->height);
|
||||
PSP_FB_WIDTH / (float)vita->width,
|
||||
PSP_FB_HEIGHT / (float)vita->height);
|
||||
else
|
||||
{
|
||||
if (vita->width > vita->height)
|
||||
{
|
||||
float scale = SCREEN_H/(float)vita->height;
|
||||
float scale = PSP_FB_HEIGHT / (float)vita->height;
|
||||
float w = vita->width * scale;
|
||||
|
||||
vita2d_draw_texture_scale(vita->texture,
|
||||
SCREEN_W/2.0f - w/2.0f, 0.0f,
|
||||
PSP_FB_WIDTH / 2.0f - w/2.0f, 0.0f,
|
||||
scale, scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
float scale = SCREEN_W/(float)vita->width;
|
||||
float scale = PSP_FB_WIDTH / (float)vita->width;
|
||||
float h = vita->height * scale;
|
||||
|
||||
vita2d_draw_texture_scale(vita->texture,
|
||||
0.0f, SCREEN_H/2.0f - h/2.0f,
|
||||
0.0f, PSP_FB_HEIGHT / 2.0f - h/2.0f,
|
||||
scale, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vita->menu.active && vita->menu.texture)
|
||||
{
|
||||
if (vita->fullscreen)
|
||||
vita2d_draw_texture_scale(vita->menu.texture,
|
||||
0, 0,
|
||||
SCREEN_W/(float)vita->menu.width,
|
||||
SCREEN_H/(float)vita->menu.height);
|
||||
PSP_FB_WIDTH / (float)vita->menu.width,
|
||||
PSP_FB_HEIGHT / (float)vita->menu.height);
|
||||
else
|
||||
{
|
||||
if (vita->menu.width > vita->menu.height)
|
||||
{
|
||||
float scale = SCREEN_H/(float)vita->menu.height;
|
||||
float scale = PSP_FB_HEIGHT / (float)vita->menu.height;
|
||||
float w = vita->menu.width * scale;
|
||||
vita2d_draw_texture_scale(vita->menu.texture,
|
||||
SCREEN_W/2.0f - w/2.0f, 0.0f,
|
||||
PSP_FB_WIDTH / 2.0f - w/2.0f, 0.0f,
|
||||
scale, scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
float scale = SCREEN_W/(float)vita->menu.width;
|
||||
float scale = PSP_FB_WIDTH / (float)vita->menu.width;
|
||||
float h = vita->menu.height * scale;
|
||||
vita2d_draw_texture_scale(vita->menu.texture,
|
||||
0.0f, SCREEN_H/2.0f - h/2.0f,
|
||||
0.0f, PSP_FB_HEIGHT / 2.0f - h/2.0f,
|
||||
scale, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vita2d_end_drawing();
|
||||
vita2d_swap_buffers();
|
||||
@ -324,8 +329,7 @@ static void vita_set_filtering(void *data, unsigned index, bool smooth)
|
||||
|
||||
static void vita_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
||||
{
|
||||
struct retro_system_av_info *av_info =
|
||||
video_viewport_get_system_av_info();
|
||||
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
|
||||
|
||||
switch (aspectratio_index)
|
||||
{
|
||||
@ -393,8 +397,9 @@ static void vita_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
if (rgb32)
|
||||
{
|
||||
stride /= 4;
|
||||
unsigned int *tex32 = tex_p;
|
||||
const unsigned int *frame32 = frame;
|
||||
uint32_t *tex32 = tex_p;
|
||||
const uint32_t *frame32 = frame;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
for (j = 0; j < width; j++)
|
||||
tex32[j + i*stride] = frame32[j + i*width];
|
||||
@ -402,8 +407,9 @@ static void vita_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
else
|
||||
{
|
||||
stride /= 2;
|
||||
unsigned short *tex16 = tex_p;
|
||||
const unsigned short *frame16 = frame;
|
||||
uint16_t *tex16 = tex_p;
|
||||
const uint16_t *frame16 = frame;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
for (j = 0; j < width; j++)
|
||||
tex16[j + i*stride] = frame16[j + i*width];
|
||||
|
Loading…
Reference in New Issue
Block a user