From 12de6551e61b0eb72a9dcdd3ad7836b0869a060a Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Sat, 29 Jun 2024 16:39:35 -0400 Subject: [PATCH] Update N64Recomp to fix issue with pause screen cursor, fix some issues caused by patches and overlay function-local statics --- .github/workflows/validate.yml | 2 +- Zelda64RecompSyms | 2 +- patches/fixes.c | 27 ++++++++++++++------------- patches/particle_transform_tagging.c | 1 - patches/terrain_transform_tagging.c | 14 ++++++++------ patches/ui_transform_tagging.c | 16 +++++++++------- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 5d2f08c..f43b595 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -9,7 +9,7 @@ on: N64RECOMP_COMMIT: type: string required: false - default: 'd30d85bdfb711d05443c5d3e9a52cdd766ba1e49' + default: '388c16c13f7ab5f18ea41da9c58f5b6478498f57' DXC_CHECKSUM: type: string required: false diff --git a/Zelda64RecompSyms b/Zelda64RecompSyms index 8e93e55..50d63de 160000 --- a/Zelda64RecompSyms +++ b/Zelda64RecompSyms @@ -1 +1 @@ -Subproject commit 8e93e558b04cc6866b635838099823f51a3941a0 +Subproject commit 50d63debd58ce9f01957142ea91b67b6c7018c96 diff --git a/patches/fixes.c b/patches/fixes.c index 9643b4d..7a62450 100644 --- a/patches/fixes.c +++ b/patches/fixes.c @@ -8,7 +8,7 @@ #define PAGE_BG_WIDTH (PAGE_BG_COLS * PAGE_BG_QUAD_WIDTH) #define PAGE_BG_HEIGHT (PAGE_BG_ROWS * PAGE_BG_QUAD_HEIGHT) -#define RECOMP_PAGE_ROW_HEIGHT 14 +#define RECOMP_PAGE_ROW_HEIGHT 15 #define RECOMP_PAGE_ROW_COUNT ((PAGE_BG_HEIGHT + RECOMP_PAGE_ROW_HEIGHT - 1) / RECOMP_PAGE_ROW_HEIGHT) extern s16* sVtxPageQuadsX[VTX_PAGE_MAX]; @@ -55,16 +55,16 @@ s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 num vtx[4 * row + 0].v.flag = vtx[4 * row + 1].v.flag = vtx[4 * row + 2].v.flag = vtx[4 * row + 3].v.flag = 0; - #define PIXEL_OFFSET ((1 << 4)) + #define PIXEL_OFFSET 0 vtx[4 * row + 0].v.tc[0] = PIXEL_OFFSET; - vtx[4 * row + 0].v.tc[1] = (1 << 5) + PIXEL_OFFSET; - vtx[4 * row + 1].v.tc[0] = PAGE_BG_WIDTH * (1 << 5) + PIXEL_OFFSET; - vtx[4 * row + 1].v.tc[1] = (1 << 5) + PIXEL_OFFSET; + vtx[4 * row + 0].v.tc[1] = PIXEL_OFFSET; + vtx[4 * row + 1].v.tc[0] = (PAGE_BG_WIDTH + 2 - 1) * (1 << 5) + PIXEL_OFFSET; + vtx[4 * row + 1].v.tc[1] = PIXEL_OFFSET; vtx[4 * row + 2].v.tc[0] = PIXEL_OFFSET; - vtx[4 * row + 2].v.tc[1] = (cur_y - next_y + 1) * (1 << 5) + PIXEL_OFFSET; - vtx[4 * row + 3].v.tc[0] = PAGE_BG_WIDTH * (1 << 5) + PIXEL_OFFSET; - vtx[4 * row + 3].v.tc[1] = (cur_y - next_y + 1) * (1 << 5) + PIXEL_OFFSET; + vtx[4 * row + 2].v.tc[1] = (cur_y - next_y + 1 - 1) * (1 << 5) + PIXEL_OFFSET; + vtx[4 * row + 3].v.tc[0] = (PAGE_BG_WIDTH + 2 - 1) * (1 << 5) + PIXEL_OFFSET; + vtx[4 * row + 3].v.tc[1] = (cur_y - next_y + 1 - 1) * (1 << 5) + PIXEL_OFFSET; vtx[4 * row + 0].v.cn[0] = vtx[4 * row + 1].v.cn[0] = vtx[4 * row + 2].v.cn[0] = vtx[4 * row + 3].v.cn[0] = 0; vtx[4 * row + 0].v.cn[1] = vtx[4 * row + 1].v.cn[1] = vtx[4 * row + 2].v.cn[1] = vtx[4 * row + 3].v.cn[1] = 0; @@ -234,20 +234,21 @@ Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, TexturePtr* textures // Draw the rows. for (u32 bg_row = 0; bg_row < RECOMP_PAGE_ROW_COUNT; bg_row++) { + u32 cur_row_height = MIN(RECOMP_PAGE_ROW_HEIGHT, PAGE_BG_HEIGHT - bg_row * RECOMP_PAGE_ROW_HEIGHT); gDPLoadTextureTile(gfx++, *cur_image, G_IM_FMT_IA, G_IM_SIZ_8b, // fmt, siz PAGE_BG_WIDTH + 2, PAGE_BG_HEIGHT + 2, // width, height - 0, (bg_row + 0) * RECOMP_PAGE_ROW_HEIGHT, // uls, ult - PAGE_BG_WIDTH + 2, (bg_row + 1) * RECOMP_PAGE_ROW_HEIGHT + 2, // lrs, lrt + 0, bg_row * RECOMP_PAGE_ROW_HEIGHT, // uls, ult + PAGE_BG_WIDTH + 2 - 1, bg_row * RECOMP_PAGE_ROW_HEIGHT + cur_row_height + 1 - 1, // lrs, lrt 0, // pal - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gDPSetTileSize(gfx++, G_TX_RENDERTILE, 0 << G_TEXTURE_IMAGE_FRAC, 0 << G_TEXTURE_IMAGE_FRAC, - (PAGE_BG_WIDTH + 2) <unk_01)[1] diff --git a/patches/terrain_transform_tagging.c b/patches/terrain_transform_tagging.c index 6ad6acc..3a521b6 100644 --- a/patches/terrain_transform_tagging.c +++ b/patches/terrain_transform_tagging.c @@ -122,14 +122,16 @@ extern s16 D_80AAAE20; extern s16 D_80AAAE22; extern s16 D_80AAAE24; +extern f32 D_80AAAAB8; +extern f32 D_80AAAABC; +extern s16 D_80AAAAC0; +extern s16 D_80AAAAC4; +extern s16 D_80AAAAC8; +extern s16 D_80AAAACC; + // @recomp Patched to enable vertex interpolation for the dynamic water as Woodfall temple rises from below the water. void DmChar01_Draw(Actor* thisx, PlayState* play) { - static f32 D_80AAAAB8 = 0.0f; - static f32 D_80AAAABC = 0.0f; - static s16 D_80AAAAC0 = 0; - static s16 D_80AAAAC4 = 0; - static s16 D_80AAAAC8 = 0; - static s16 D_80AAAACC = 0; + // @recomp Move function statics to externs so they still get reset on overlay load like normal. DmChar01* this = (DmChar01*)thisx; f32 temp_f12; f32 spBC; diff --git a/patches/ui_transform_tagging.c b/patches/ui_transform_tagging.c index 0419223..b071bab 100644 --- a/patches/ui_transform_tagging.c +++ b/patches/ui_transform_tagging.c @@ -199,6 +199,13 @@ void KaleidoScope_DrawCursor(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } +extern s16 sPauseZRCursorColorTimer; // 8082B9C8 32899 -17976 +extern s16 sPauseZRCursorColorIndex; // 8082B9CC 32899 -17972 +extern s16 sPauseZRCursorRed; // 8082DA50 32899 -9648 +extern s16 sPauseZRCursorGreen; // 8082DA52 32899 -9646 +extern s16 sPauseZRCursorBlue; // 8082DA54 32899 -9644 +extern s16 sPauseZRCursorAlpha; // 8082DA56 32899 -9642 + /** * infoPanelVtx * @@ -213,16 +220,11 @@ void KaleidoScope_DrawCursor(PlayState* play) { // @recomp Patched to tag the matrix for interpolating the vertices of the Z button, R button, and name panel. void KaleidoScope_DrawInfoPanel(PlayState* play) { - static s16 sPauseZRCursorColorTargets[][4] = { + static const s16 sPauseZRCursorColorTargets[][4] = { { 180, 210, 255, 220 }, { 100, 100, 150, 220 }, }; - static s16 sPauseZRCursorColorTimer = 20; - static s16 sPauseZRCursorColorIndex = 0; - static s16 sPauseZRCursorRed; - static s16 sPauseZRCursorGreen; - static s16 sPauseZRCursorBlue; - static s16 sPauseZRCursorAlpha; + // @recomp Moved non-const function-local statics to externs so they still get reset on overlay load. PauseContext* pauseCtx = &play->pauseCtx; s16 stepR; s16 stepG;