summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorSirius902 <10891979+Sirius902@users.noreply.github.com>2022-07-08 14:39:50 -0700
committerGitHub <noreply@github.com>2022-07-08 17:39:50 -0400
commit4371b582232ab034e2dd8b0f03ee21e3832b14ad (patch)
treec923a039f6822865955b120e79ad8dcfd7d721fd /soh/src/code
parentef3dd96eb45eb09498f58cecbf6b588b77ebe30d (diff)
Fix 0xabababab crash (#617)
* Unconditionally setup the normal skybox * Only call Skybox_Setup once ever
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/graph.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c
index f4a824cb4..f4dcf56e8 100644
--- a/soh/src/code/graph.c
+++ b/soh/src/code/graph.c
@@ -433,6 +433,7 @@ static void RunFrame()
{
u32 size;
char faultMsg[0x50];
+ static bool hasSetupSkybox = false;
switch (runFrameContext.state) {
case 0:
@@ -465,6 +466,14 @@ static void RunFrame()
}
GameState_Init(runFrameContext.gameState, runFrameContext.ovl->init, &runFrameContext.gfxCtx);
+ // Setup the normal skybox once before entering any game states to avoid the 0xabababab crash.
+ // The crash is due to certain skyboxes not loading all the data they need from Skybox_Setup.
+ if (!hasSetupSkybox) {
+ GlobalContext* globalCtx = (GlobalContext*)runFrameContext.gameState;
+ Skybox_Setup(globalCtx, &globalCtx->skyboxCtx, SKYBOX_NORMAL_SKY);
+ hasSetupSkybox = true;
+ }
+
uint64_t freq = GetFrequency();
while (GameState_IsRunning(runFrameContext.gameState))