fix: no longer leak memory, invalidate textures properly (#2223)

* Revert "Fix Ganondorf boss battle ending (MQ only) (#2072)"

This reverts commit 52b896271c.

* yolo this should work

* finish comment

* see if this doesn't lag switches!

* formatting

* formatting

Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
briaguya
2022-12-21 01:26:13 -05:00
committed by GitHub
parent e03ef85f3b
commit 73873a6dbc
5 changed files with 29 additions and 32 deletions

View File

@@ -1703,10 +1703,7 @@ void BossDodongo_DrawEffects(PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
unkMtx = &play->billboardMtxF;
// OTRTODO: This call causes the whole texture cache to be cleaned up, which causes an important slowdown on switch so we need to find a way to avoid it.
#if !defined(__SWITCH__) && !defined(__WIIU__)
gSPInvalidateTexCache(POLY_XLU_DISP++, 0);
#endif
gSPInvalidateTexCache(POLY_XLU_DISP++, gDodongosCavernBossLavaFloorTex);
for (i = 0; i < 80; i++, eff++) {
FrameInterpolation_RecordOpenChild(eff, eff->epoch);

View File

@@ -1197,8 +1197,10 @@ void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) {
void BossGanon_ShatterWindows(u8 windowShatterState) {
s16 i;
u8* tex1 = ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(ResourceMgr_GetName(ganon_boss_sceneTex_006C18)));
u8* tex2 = ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(ResourceMgr_GetName(ganon_boss_sceneTex_007418)));
// Temporary solution: using LoadTexOrDList to ensure we actually have the texture available
// based on mq/nonmq. This will be handled properly with LUS 1.0
u8* tex1 = ResourceMgr_LoadTexOrDListByName(SEGMENTED_TO_VIRTUAL(ganon_boss_sceneTex_006C18));
u8* tex2 = ResourceMgr_LoadTexOrDListByName(SEGMENTED_TO_VIRTUAL(ganon_boss_sceneTex_007418));
u8* templateTex = ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(gGanondorfWindowShatterTemplateTex));
for (i = 0; i < 2048; i++) {
@@ -3820,8 +3822,8 @@ void BossGanon_Draw(Actor* thisx, PlayState* play) {
// Invalidate textures if they have changed
if (this->windowShatterState != GDF_WINDOW_SHATTER_OFF) {
gSPInvalidateTexCache(POLY_OPA_DISP++, ResourceMgr_GetName(ganon_boss_sceneTex_006C18));
gSPInvalidateTexCache(POLY_OPA_DISP++, ResourceMgr_GetName(ganon_boss_sceneTex_007418));
gSPInvalidateTexCache(POLY_OPA_DISP++, ganon_boss_sceneTex_006C18);
gSPInvalidateTexCache(POLY_OPA_DISP++, ganon_boss_sceneTex_007418);
}
Gfx_SetupDL_25Opa(play->state.gfxCtx);