Clear the framebuffer for the pause menu link texture (#4213)

* clear pause menu link framebuffer

* cache bust

* Add enums for pause menu link width/height and rename the framebuffer

* revert cache bust
This commit is contained in:
Archez 2024-06-15 23:13:13 -04:00 committed by GitHub
parent 4441304dfd
commit cd7c5ab316
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 45 additions and 23 deletions

@ -1 +1 @@
Subproject commit c7974d6a25853d65b44905df728a0e0249636947
Subproject commit 9907ebfd66ff5bf903ecb7327cca69014993772b

View File

@ -841,6 +841,9 @@ typedef enum {
#define PAUSE_CURSOR_PAGE_LEFT 10
#define PAUSE_CURSOR_PAGE_RIGHT 11
#define PAUSE_EQUIP_PLAYER_WIDTH 64
#define PAUSE_EQUIP_PLAYER_HEIGHT 112
typedef enum {
/* 0x00 */ PAUSE_ITEM,
/* 0x01 */ PAUSE_MAP,

View File

@ -239,16 +239,15 @@ void GameState_ReqPadData(GameState* gameState) {
PadMgr_RequestPadData(&gPadMgr, &gameState->input[0], 1);
}
// OTRTODO
int fbTest = -1;
// Framebuffer for the Link preview on the pause menu equipment sub-screen
int gPauseLinkFrameBuffer = -1;
void GameState_Update(GameState* gameState) {
GraphicsContext* gfxCtx = gameState->gfxCtx;
if (fbTest == -1)
{
fbTest = gfx_create_framebuffer(64, 112, SCREEN_WIDTH, SCREEN_HEIGHT, true);
//fbTest = gfx_create_framebuffer(256, 512);
if (gPauseLinkFrameBuffer == -1) {
gPauseLinkFrameBuffer = gfx_create_framebuffer(PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT,
PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT, true);
}
GameState_SetFrameBuffer(gfxCtx);

View File

@ -2075,10 +2075,12 @@ void Pause_DrawTriforceSpot(PlayState* play, s32 showLightColumn) {
rotation += 0x03E8;
}
void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot,
f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height, Vec3f* eye, Vec3f* at,
f32 fovy, void* img1, void* img2) {
static Vp viewport = { 128, 224, 511, 0, 128, 224, 511, 0 };
void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject, SkelAnime* skelAnime, Vec3f* pos,
Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height,
Vec3f* eye, Vec3f* at, f32 fovy, void* colorFrameBuffer, void* depthFrameBuffer) {
// Note: the viewport x and y values are overwritten below, before usage
static Vp viewport = { (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0,
(PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0 };
static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, 172);
static Vec3f lightDir = { 89.8f, 0.0f, 89.8f };
u8 playerSwordAndShield[2];
@ -2106,6 +2108,24 @@ void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime*
gDPSetScissor(POLY_OPA_DISP++, G_SC_NON_INTERLACE, 0, 0, width, height);
gSPClipRatio(POLY_OPA_DISP++, FRUSTRATIO_1);
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, depthFrameBuffer);
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_ZDZ(G_MAXFBZ, 0) << 16) | GPACK_ZDZ(G_MAXFBZ, 0));
gDPFillRectangle(POLY_OPA_DISP++, 0, 0, width - 1, height - 1);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, colorFrameBuffer);
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
gDPFillRectangle(POLY_OPA_DISP++, 0, 0, width - 1, height - 1);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetDepthImage(POLY_OPA_DISP++, depthFrameBuffer);
viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * 2;
viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * 2;
gSPViewport(POLY_OPA_DISP++, &viewport);
@ -2126,8 +2146,8 @@ void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime*
pos->y - (CVarGetInteger(CVAR_GENERAL("PauseTriforce"), 0) ? 16 : 0), pos->z, rot);
Matrix_Scale(scale * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1), scale, scale, MTXMODE_APPLY);
gSPSegment(POLY_OPA_DISP++, 0x04, seg04);
gSPSegment(POLY_OPA_DISP++, 0x06, seg06);
gSPSegment(POLY_OPA_DISP++, 0x04, gameplayKeep);
gSPSegment(POLY_OPA_DISP++, 0x06, linkObject);
gSPSetLights1(POLY_OPA_DISP++, lights1);
@ -2401,8 +2421,8 @@ void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f*
}
}
Player_DrawPauseImpl(play, segment + 0x3800, segment + 0x8800, skelAnime, pos, rot, scale, sword, tunic, shield,
boots, 64, 112, &eye, &at, 60.0f, play->state.gfxCtx->curFrameBuffer,
play->state.gfxCtx->curFrameBuffer + 0x1C00);
boots, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f,
play->state.gfxCtx->curFrameBuffer,
play->state.gfxCtx->curFrameBuffer + (PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT));
}

View File

@ -27,6 +27,8 @@ static Vtx sStrengthAButtonVtx[] = {
static s16 sEquipTimer = 0;
extern int gPauseLinkFrameBuffer;
void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u32 height) {
PauseContext* pauseCtx = &play->pauseCtx;
u8* curTexture;
@ -70,13 +72,12 @@ void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u
for (i = 0; i < textureCount; i++) {
gSPVertex(POLY_KAL_DISP++, &pauseCtx->equipVtx[vtxIndex], 4, 0);
extern int fbTest;
gDPSetTextureImage(POLY_KAL_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, curTexture);
gDPLoadSync(POLY_KAL_DISP++);
gDPLoadTile(POLY_KAL_DISP++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2);
gDPSetTextureImageFB(POLY_KAL_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, fbTest);
gDPSetTextureImageFB(POLY_KAL_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, gPauseLinkFrameBuffer);
gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0);
curTexture += textureSize;
@ -185,8 +186,7 @@ void KaleidoScope_DrawPlayerWork(PlayState* play) {
link_kaleido_rot.x = 0;
extern int fbTest;
gsSPSetFB(play->state.gfxCtx->polyOpa.p++, fbTest);
gsSPSetFB(play->state.gfxCtx->polyOpa.p++, gPauseLinkFrameBuffer);
Player_DrawPause(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &link_kaleido_rot, scale,
SWORD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD)),
TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)),
@ -852,7 +852,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
//gSPSegment(POLY_KAL_DISP++, 0x0C, pauseCtx->iconItemAltSegment);
Gfx_SetupDL_42Kal(play->state.gfxCtx);
KaleidoScope_DrawEquipmentImage(play, pauseCtx->playerSegment, 64, 112);
KaleidoScope_DrawEquipmentImage(play, pauseCtx->playerSegment, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT);
if (gUpgradeMasks[0]) {}

View File

@ -929,7 +929,6 @@ static void* sPromptChoiceTexs[][2] = {
static u8 sButtonStatusSave[ARRAY_COUNT(gSaveContext.buttonStatus)];
static PreRender sPlayerPreRender;
static void* sPreRenderCvg;
extern int fbTest;
void KaleidoScope_ProcessPlayerPreRender(void) {
PreRender_Calc(&sPlayerPreRender);
@ -3725,7 +3724,8 @@ void KaleidoScope_Update(PlayState* play)
sPreRenderCvg = (void*)(((uintptr_t)pauseCtx->nameSegment + 0x400 + 0xA00 + 0xF) & ~0xF);
PreRender_Init(&sPlayerPreRender);
PreRender_SetValuesSave(&sPlayerPreRender, 64, 112, pauseCtx->playerSegment, NULL, sPreRenderCvg);
PreRender_SetValuesSave(&sPlayerPreRender, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT,
pauseCtx->playerSegment, NULL, sPreRenderCvg);
KaleidoScope_DrawPlayerWork(play);
//KaleidoScope_SetupPlayerPreRender(play);