From: Francisco Javier Trujillo Mata Date: Mon, 1 Jan 2024 11:24:10 +0000 (+0100) Subject: Adding background objects X-Git-Tag: v2.00~119^2~11 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=862e969bab60a74cc94e45bef46aa419e21940b2;p=picodrive.git Adding background objects --- diff --git a/platform/ps2/emu.c b/platform/ps2/emu.c index a2562f45..c25fc2bd 100644 --- a/platform/ps2/emu.c +++ b/platform/ps2/emu.c @@ -55,11 +55,8 @@ enum renderer_types { RT_16BIT, RT_8BIT_ACC, RT_8BIT_FAST, RT_COUNT }; typedef struct ps2_video { GSGLOBAL *gsGlobal; - GSTEXTURE *scrbitmap; - GSTEXTURE *tex_spr0; - GSTEXTURE *tex_spr1; - GSTEXTURE *tex_spr2; - GSTEXTURE *tex_fix; + GSTEXTURE *g_menuscreen; + uint8_t *g_menubg_ptr; uint32_t offset; uint8_t vsync; /* 0 (Disabled), 1 (Enabled), 2 (Dynamic) */ uint8_t pixel_format; @@ -70,6 +67,29 @@ ps2_video_t *ps2_video = NULL; #define is_16bit_mode() \ (currentConfig.renderer == RT_16BIT || (PicoIn.AHW & PAHW_32X)) +static void set_g_menuscreen_values(ps2_video_t *ps2_video) +{ + GSTEXTURE *g_menuscreen = (GSTEXTURE *)calloc(1, sizeof(GSTEXTURE)); + size_t g_menuscreenSize = gsKit_texture_size_ee(ps2_video->gsGlobal->Width, ps2_video->gsGlobal->Height, GS_PSM_CT16); + g_menuscreen->Width = ps2_video->gsGlobal->Width; + g_menuscreen->Height = ps2_video->gsGlobal->Height; + g_menuscreen->PSM = GS_PSM_CT16; + g_menuscreen->Mem = (uint32_t *)malloc(g_menuscreenSize); + + ps2_video->g_menuscreen = g_menuscreen; + ps2_video->g_menubg_ptr = (uint8_t *)malloc(g_menuscreenSize);; + + g_menuscreen_w = g_menuscreen->Width; + g_menuscreen_h = g_menuscreen->Height; + g_menuscreen_pp = g_menuscreen->Width; + g_menuscreen_ptr = g_menuscreen->Mem; + + g_menubg_src_w = g_menuscreen->Width; + g_menubg_src_h = g_menuscreen->Height; + g_menubg_src_pp = g_menuscreen->Width; + g_menubg_ptr = ps2_video->g_menubg_ptr; +} + static void video_init(void) { ps2_video = (ps2_video_t*)calloc(1, sizeof(ps2_video_t)); @@ -104,12 +124,19 @@ static void video_init(void) gsKit_mode_switch(gsGlobal, GS_ONESHOT); gsKit_clear(gsGlobal, GS_BLACK); ps2_video->gsGlobal = gsGlobal; + + set_g_menuscreen_values(ps2_video); } static void video_deinit(void) { if (!ps2_video) return; + free(ps2_video->g_menuscreen->Mem); + free(ps2_video->g_menuscreen); + + free(ps2_video->g_menubg_ptr); + gsKit_clear(ps2_video->gsGlobal, GS_BLACK); gsKit_vram_clear(ps2_video->gsGlobal); gsKit_deinit_global(ps2_video->gsGlobal);