diff options
| author | Archez <Archez@users.noreply.github.com> | 2024-11-12 10:06:35 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-12 10:06:35 -0500 |
| commit | a2e93687f6b094f2800f4b4d5fa77c09465bd9c1 (patch) | |
| tree | 4ee963449473bfd61be175b499cbf1d3027f2571 | |
| parent | fab43404618c41b244f9a2b4a5336442748ac130 (diff) | |
Fix crash when toggling alt assets while paused (#839)
| -rw-r--r-- | mm/src/code/z_play.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/src/code/z_play.c b/mm/src/code/z_play.c index deab776c1..23eede557 100644 --- a/mm/src/code/z_play.c +++ b/mm/src/code/z_play.c @@ -1184,16 +1184,17 @@ void Play_DrawMain(PlayState* this) { // Track render size when paused and that a copy was performed static u32 lastPauseWidth; static u32 lastPauseHeight; - static u8 hasCapturedPauseBuffer; + static bool lastAltAssets; + static bool hasCapturedPauseBuffer; u8 recapturePauseBuffer = false; - // If the size has changed or dropped frames leading to the buffer not being copied, + // If the size has changed, alt assets toggled or dropped frames leading to the buffer not being copied, // set the prerender state back to setup to copy a new frame. - // This requires not rendering kaleido during this copy to avoid kaleido being copied + // This requires not rendering kaleido during this copy to avoid kaleido itself being copied too. if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_PROCESS || R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) && (lastPauseWidth != OTRGetGameRenderWidth() || lastPauseHeight != OTRGetGameRenderHeight() || - !hasCapturedPauseBuffer || sJustClosedBomberNotebook)) { + lastAltAssets != ResourceMgr_IsAltAssetsEnabled() || !hasCapturedPauseBuffer || sJustClosedBomberNotebook)) { R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; recapturePauseBuffer = true; } @@ -1487,6 +1488,7 @@ void Play_DrawMain(PlayState* this) { // #region 2S2H [Port] Custom handling for pause prerender background capture lastPauseWidth = OTRGetGameRenderWidth(); lastPauseHeight = OTRGetGameRenderHeight(); + lastAltAssets = ResourceMgr_IsAltAssetsEnabled(); hasCapturedPauseBuffer = false; FB_CopyToFramebuffer(&sp74, 0, gPauseFrameBuffer, false, &hasCapturedPauseBuffer); |
