summaryrefslogtreecommitdiff
path: root/soh/src/code/graph.c
diff options
context:
space:
mode:
authorbriaguya <70942617+briaguya-ai@users.noreply.github.com>2025-02-01 23:33:04 -0800
committerGitHub <noreply@github.com>2025-02-02 02:33:04 -0500
commitac9b8c2e87db604e826eb22609ea41989c10fc73 (patch)
tree57da93468a1612d1622cc1e955de20330891e1db /soh/src/code/graph.c
parentf4604673e02f223fbc5af5677d17a36eb44d9efd (diff)
better soft reset (#4984)
Diffstat (limited to 'soh/src/code/graph.c')
-rw-r--r--soh/src/code/graph.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c
index f691c2619..c55417d93 100644
--- a/soh/src/code/graph.c
+++ b/soh/src/code/graph.c
@@ -18,7 +18,6 @@
// SOH [Port] Game State management for our render loop
static struct RunFrameContext {
GraphicsContext gfxCtx;
- GameState* gameState;
GameStateOverlay* nextOvl;
GameStateOverlay* ovl;
int state;
@@ -487,28 +486,28 @@ static void RunFrame()
size = runFrameContext.ovl->instanceSize;
osSyncPrintf("クラスサイズ=%dバイト\n", size); // "Class size = %d bytes"
- runFrameContext.gameState = SYSTEM_ARENA_MALLOC_DEBUG(size);
+ gGameState = SYSTEM_ARENA_MALLOC_DEBUG(size);
- if (!runFrameContext.gameState)
+ if (!gGameState)
{
osSyncPrintf("確保失敗\n"); // "Failure to secure"
snprintf(faultMsg, sizeof(faultMsg), "CLASS SIZE= %d bytes", size);
Fault_AddHungupAndCrashImpl("GAME CLASS MALLOC FAILED", faultMsg);
}
- GameState_Init(runFrameContext.gameState, runFrameContext.ovl->init, &runFrameContext.gfxCtx);
+ GameState_Init(gGameState, 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) {
- PlayState* play = (PlayState*)runFrameContext.gameState;
+ PlayState* play = (PlayState*)gGameState;
Skybox_Setup(play, &play->skyboxCtx, SKYBOX_NORMAL_SKY);
hasSetupSkybox = true;
}
uint64_t freq = GetFrequency();
- while (GameState_IsRunning(runFrameContext.gameState))
+ while (GameState_IsRunning(gGameState))
{
//uint64_t ticksA, ticksB;
//ticksA = GetPerfCounter();
@@ -517,7 +516,7 @@ static void RunFrame()
PadMgr_ThreadEntry(&gPadMgr);
- Graph_Update(&runFrameContext.gfxCtx, runFrameContext.gameState);
+ Graph_Update(&runFrameContext.gfxCtx, gGameState);
//ticksB = GetPerfCounter();
if (GfxDebuggerIsDebuggingRequested()) {
@@ -535,9 +534,9 @@ static void RunFrame()
nextFrame:;
}
- runFrameContext.nextOvl = Graph_GetNextGameState(runFrameContext.gameState);
- GameState_Destroy(runFrameContext.gameState);
- SYSTEM_ARENA_FREE_DEBUG(runFrameContext.gameState);
+ runFrameContext.nextOvl = Graph_GetNextGameState(gGameState);
+ GameState_Destroy(gGameState);
+ SYSTEM_ARENA_FREE_DEBUG(gGameState);
Overlay_FreeGameState(runFrameContext.ovl);
}
Graph_Destroy(&runFrameContext.gfxCtx);