Now RGUI shows fullscreen proper colors

This commit is contained in:
Francisco Javier Trujillo Mata 2018-10-16 01:35:09 +02:00
parent f4680b03eb
commit 21587ba2a4
2 changed files with 12 additions and 18 deletions

View File

@ -35,9 +35,6 @@ typedef struct ps2_video
{ {
GSGLOBAL *gsGlobal; GSGLOBAL *gsGlobal;
GSTEXTURE *backgroundTexture; GSTEXTURE *backgroundTexture;
int counter;
} ps2_video_t; } ps2_video_t;
// PRIVATE METHODS // PRIVATE METHODS
@ -88,7 +85,6 @@ static void deinitTexturePTR(void *texture_ptr) {
static void deinitTexture(GSTEXTURE *texture) { static void deinitTexture(GSTEXTURE *texture) {
deinitTexturePTR(texture->Mem); deinitTexturePTR(texture->Mem);
deinitTexturePTR(texture->Clut); deinitTexturePTR(texture->Clut);
// deinitTexturePTR(texture->Vram);
} }
@ -100,7 +96,6 @@ static void *ps2_gfx_init(const video_info_t *video,
(void)video; (void)video;
ps2_video_t *ps2 = (ps2_video_t*)calloc(1, sizeof(ps2_video_t)); ps2_video_t *ps2 = (ps2_video_t*)calloc(1, sizeof(ps2_video_t));
ps2->counter = 0;
initGSGlobal(ps2); initGSGlobal(ps2);
initBackgroundTexture(ps2); initBackgroundTexture(ps2);
@ -165,6 +160,7 @@ static void ps2_gfx_free(void *data)
ps2_video_t *ps2 = (ps2_video_t*)data; ps2_video_t *ps2 = (ps2_video_t*)data;
deinitTexture(ps2->backgroundTexture); deinitTexture(ps2->backgroundTexture);
gsKit_vram_clear(ps2->gsGlobal);
gsKit_deinit_global(ps2->gsGlobal); gsKit_deinit_global(ps2->gsGlobal);
free(data); free(data);
@ -222,9 +218,6 @@ static void ps2_set_texture_frame(void *data, const void *frame, bool rgb32,
{ {
ps2_video_t *ps2 = (ps2_video_t*)data; ps2_video_t *ps2 = (ps2_video_t*)data;
(void) rgb32;
(void) alpha;
#ifdef DEBUG #ifdef DEBUG
/* ps2->backgroundTexture.Mem buffer size is (640 * 448)*2 Bytes */ /* ps2->backgroundTexture.Mem buffer size is (640 * 448)*2 Bytes */
retro_assert((width*height) < (480 * 448)); retro_assert((width*height) < (480 * 448));
@ -242,12 +235,8 @@ static void ps2_set_texture_frame(void *data, const void *frame, bool rgb32,
ps2->backgroundTexture->Mem = memalign(128, gskitTextureSize(ps2->backgroundTexture)); ps2->backgroundTexture->Mem = memalign(128, gskitTextureSize(ps2->backgroundTexture));
} }
memcpy(ps2->backgroundTexture->Mem, frame, width * height * (rgb32 ? 4 : 2)); memcpy(ps2->backgroundTexture->Mem, frame, width * height * (rgb32 ? 4 : 2));
printf("Counter %i\n", ps2->counter);
ps2->counter++;
gsKit_vram_clear(ps2->gsGlobal); gsKit_vram_clear(ps2->gsGlobal);
ps2->backgroundTexture->Vram=gsKit_vram_alloc(ps2->gsGlobal, textureSize(ps2->backgroundTexture) , GSKIT_ALLOC_USERBUFFER); ps2->backgroundTexture->Vram=gsKit_vram_alloc(ps2->gsGlobal, textureSize(ps2->backgroundTexture) , GSKIT_ALLOC_USERBUFFER);
if(ps2->backgroundTexture->Vram == GSKIT_ALLOC_ERROR) if(ps2->backgroundTexture->Vram == GSKIT_ALLOC_ERROR)
@ -257,9 +246,6 @@ static void ps2_set_texture_frame(void *data, const void *frame, bool rgb32,
// Upload texture // Upload texture
gsKit_texture_upload(ps2->gsGlobal, ps2->backgroundTexture); gsKit_texture_upload(ps2->gsGlobal, ps2->backgroundTexture);
printf("Texure 2 VRAM Range = 0x%X - 0x%X\n",ps2->backgroundTexture->Vram, ps2->backgroundTexture->Vram +gsKit_texture_size(ps2->backgroundTexture->Width, ps2->backgroundTexture->Height, ps2->backgroundTexture->PSM) - 1);
gsKit_prim_sprite_texture( ps2->gsGlobal, ps2->backgroundTexture, gsKit_prim_sprite_texture( ps2->gsGlobal, ps2->backgroundTexture,
0.0f, 0.0f,
0.0f, // Y1 0.0f, // Y1

View File

@ -73,6 +73,10 @@ static uint16_t *rgui_framebuf_data = NULL;
#define HOVER_COLOR(settings) ((3 << 0) | (10 << 4) | (3 << 8) | (7 << 12)) #define HOVER_COLOR(settings) ((3 << 0) | (10 << 4) | (3 << 8) | (7 << 12))
#define NORMAL_COLOR(settings) 0x7FFF #define NORMAL_COLOR(settings) 0x7FFF
#define TITLE_COLOR(settings) HOVER_COLOR(settings) #define TITLE_COLOR(settings) HOVER_COLOR(settings)
#elif defined(PS2)
#define HOVER_COLOR(settings) 0x03E0
#define NORMAL_COLOR(settings) 0x7FFF
#define TITLE_COLOR(settings) HOVER_COLOR(settings)
#else #else
#define HOVER_COLOR(settings) (argb32_to_rgba4444(settings->uints.menu_entry_hover_color)) #define HOVER_COLOR(settings) (argb32_to_rgba4444(settings->uints.menu_entry_hover_color))
#define NORMAL_COLOR(settings) (argb32_to_rgba4444(settings->uints.menu_entry_normal_color)) #define NORMAL_COLOR(settings) (argb32_to_rgba4444(settings->uints.menu_entry_normal_color))
@ -93,8 +97,10 @@ static uint16_t rgui_gray_filler(rgui_t *rgui, unsigned x, unsigned y)
{ {
unsigned shft = (rgui->bg_thickness ? 1 : 0); unsigned shft = (rgui->bg_thickness ? 1 : 0);
unsigned col = (((x >> shft) + (y >> shft)) & 1) + 1; unsigned col = (((x >> shft) + (y >> shft)) & 1) + 1;
#if defined(GEKKO) || defined(PSP) || defined(PS2) #if defined(GEKKO) || defined(PSP)
return (6 << 12) | (col << 8) | (col << 4) | (col << 0); return (6 << 12) | (col << 8) | (col << 4) | (col << 0);
#elif defined(PS2)
return (0 << 15) | (col << 12) | (col << 7) | (col << 2);
#elif defined(HAVE_LIBNX) && !defined(HAVE_OPENGL) #elif defined(HAVE_LIBNX) && !defined(HAVE_OPENGL)
return (((31 * (54)) / 255) << 11) | return (((31 * (54)) / 255) << 11) |
(((63 * (54)) / 255) << 5) | (((63 * (54)) / 255) << 5) |
@ -108,8 +114,10 @@ static uint16_t rgui_green_filler(rgui_t *rgui, unsigned x, unsigned y)
{ {
unsigned shft = (rgui->border_thickness ? 1 : 0); unsigned shft = (rgui->border_thickness ? 1 : 0);
unsigned col = (((x >> shft) + (y >> shft)) & 1) + 1; unsigned col = (((x >> shft) + (y >> shft)) & 1) + 1;
#if defined(GEKKO) || defined(PSP) || defined(PS2) #if defined(GEKKO) || defined(PSP)
return (6 << 12) | (col << 8) | (col << 5) | (col << 0); return (6 << 12) | (col << 8) | (col << 5) | (col << 0);
#elif defined(PS2)
return (0 << 15) | (col << 12) | (col << 8) | (col << 2);
#elif defined(HAVE_LIBNX) && !defined(HAVE_OPENGL) #elif defined(HAVE_LIBNX) && !defined(HAVE_OPENGL)
return (((31 * (54)) / 255) << 11) | return (((31 * (54)) / 255) << 11) |
(((63 * (109)) / 255) << 5) | (((63 * (109)) / 255) << 5) |