summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArchez <Archez@users.noreply.github.com>2024-12-06 10:36:38 -0500
committerGitHub <noreply@github.com>2024-12-06 10:36:38 -0500
commitbccd96966fa9339f3d85dad39c7fbc00a34a2246 (patch)
treec77a0415215f329e9731317488fdc636c5e3f421
parent09f297392f8744e5ea939eb65e49c109a67a32ca (diff)
Fix crash when toggling alt assets while paused (#4621)
-rw-r--r--soh/src/code/z_play.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c
index 219b3a448..df1314e71 100644
--- a/soh/src/code/z_play.c
+++ b/soh/src/code/z_play.c
@@ -12,6 +12,7 @@
#include "soh/Enhancements/enhancementTypes.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/OTRGlobals.h"
+#include "soh/ResourceManagerHelpers.h"
#include "soh/SaveManager.h"
#include "soh/framebuffer_effects.h"
@@ -1327,15 +1328,16 @@ void Play_Draw(PlayState* play) {
// Track render size when paused and that a copy was performed
static u32 lastPauseWidth;
static u32 lastPauseHeight;
- static u8 hasCapturedPauseBuffer;
- u8 recapturePauseBuffer = false;
+ static bool lastAltAssets;
+ static bool hasCapturedPauseBuffer;
+ bool 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_MENU_MODE == 2 || R_PAUSE_MENU_MODE == 3) &&
(lastPauseWidth != OTRGetGameRenderWidth() || lastPauseHeight != OTRGetGameRenderHeight() ||
- !hasCapturedPauseBuffer)) {
+ lastAltAssets != ResourceMgr_IsAltAssetsEnabled() || !hasCapturedPauseBuffer)) {
R_PAUSE_MENU_MODE = 1;
recapturePauseBuffer = true;
}
@@ -1594,6 +1596,7 @@ void Play_Draw(PlayState* play) {
// #region SOH [Port] Custom handling for pause prerender background capture
lastPauseWidth = OTRGetGameRenderWidth();
lastPauseHeight = OTRGetGameRenderHeight();
+ lastAltAssets = ResourceMgr_IsAltAssetsEnabled();
hasCapturedPauseBuffer = false;
FB_CopyToFramebuffer(&gfxP, 0, gPauseFrameBuffer, false, &hasCapturedPauseBuffer);