From c5acef29576d7e851abbb4e30873082da9b135d8 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Tue, 20 Sep 2022 02:12:31 -0400 Subject: [PATCH] Fixes laggy text boxes in Switch (#1527) * Refactors message texture invalidation to remove lag on Switch. * Removes unneeded commented out function calls. --- soh/src/code/z_message_PAL.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index efb88d32e..693187fb7 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -1281,7 +1281,9 @@ void Message_Decode(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; Font* font = &globalCtx->msgCtx.font; - gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, NULL); + for (u32 i = 0; i < FONT_CHAR_TEX_SIZE * 120; i += FONT_CHAR_TEX_SIZE) { + gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, &font->charTexBuf[i]); + } globalCtx->msgCtx.textDelayTimer = 0; globalCtx->msgCtx.textUnskippable = globalCtx->msgCtx.textDelay = globalCtx->msgCtx.textDelayTimer = 0; @@ -1678,7 +1680,6 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) { } sMessageHasSetSfx = D_8014B2F4 = sTextboxSkipped = sTextIsCredits = 0; - gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, NULL); if (textId >= 0x0500 && textId < 0x0600) { // text ids 0500 to 0600 are reserved for credits sTextIsCredits = true;