summaryrefslogtreecommitdiff
path: root/mm/src/code
diff options
context:
space:
mode:
authorArchez <Archez@users.noreply.github.com>2024-07-08 17:57:17 -0400
committerGitHub <noreply@github.com>2024-07-08 17:57:17 -0400
commit2bb149b367c04da89ed5b825926d48bda4e00586 (patch)
treed0f2b0f7e87cdc09fb4d7fe897dafd6b647ae313 /mm/src/code
parent7458760c7553ac20489dc21259da7e99fab7632e (diff)
Tweak: Improve Save Editor time options (#729)
* improve save editor time options * set gPlayState after early returns to avoid dangling ptr * avoid crash with day 0 on daytelop
Diffstat (limited to 'mm/src/code')
-rw-r--r--mm/src/code/z_play.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mm/src/code/z_play.c b/mm/src/code/z_play.c
index a939ed217..c9b3a1796 100644
--- a/mm/src/code/z_play.c
+++ b/mm/src/code/z_play.c
@@ -2184,9 +2184,6 @@ void Play_FillScreen(GameState* thisx, s16 fillScreenOn, u8 red, u8 green, u8 bl
void Play_Init(GameState* thisx) {
PlayState* this = (PlayState*)thisx;
- // #region 2S2H [General] Making gPlayState available
- gPlayState = this;
- // #endregion
GraphicsContext* gfxCtx = this->state.gfxCtx;
s32 pad;
uintptr_t zAlloc;
@@ -2220,6 +2217,11 @@ void Play_Init(GameState* thisx) {
return;
}
+ // #region 2S2H [General] Making gPlayState available
+ // Setting after the early returns, so that Play_Destroy is registered to unset the ptr later
+ gPlayState = this;
+ // #endregion
+
if ((gSaveContext.nextCutsceneIndex == 0xFFEF) || (gSaveContext.nextCutsceneIndex == 0xFFF0)) {
scene = ((void)0, gSaveContext.save.entrance) >> 9;
spawn = (((void)0, gSaveContext.save.entrance) >> 4) & 0x1F;