summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
Diffstat (limited to 'src/code')
-rw-r--r--src/code/code_80174A40.c7
-rw-r--r--src/code/code_80182CE0.c7
-rw-r--r--src/code/game.c25
-rw-r--r--src/code/graph.c385
-rw-r--r--src/code/graphalloc.c29
-rw-r--r--src/code/sched.c8
-rw-r--r--src/code/sys_cmpdma.c4
-rw-r--r--src/code/sys_matrix.c8
-rw-r--r--src/code/sys_ucode.c8
-rw-r--r--src/code/title_setup.c2
-rw-r--r--src/code/z_actor.c2
-rw-r--r--src/code/z_effect_soft_sprite_old_init.c2
-rw-r--r--src/code/z_prenmi.c4
-rw-r--r--src/code/z_rcp.c156
-rw-r--r--src/code/z_room.c4
-rw-r--r--src/code/z_scene.c4
-rw-r--r--src/code/z_skelanime.c8
17 files changed, 537 insertions, 126 deletions
diff --git a/src/code/code_80174A40.c b/src/code/code_80174A40.c
deleted file mode 100644
index a4daff018..000000000
--- a/src/code/code_80174A40.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "global.h"
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_80174A40/Graph_GfxPlusOne.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_80174A40/Graph_BranchDlist.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_80174A40/Graph_DlistAlloc.s")
diff --git a/src/code/code_80182CE0.c b/src/code/code_80182CE0.c
new file mode 100644
index 000000000..6ff8736e5
--- /dev/null
+++ b/src/code/code_80182CE0.c
@@ -0,0 +1,7 @@
+#include "global.h"
+
+#pragma GLOBAL_ASM("asm/non_matchings/code/code_80182CE0/func_80182CE0.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/code/code_80182CE0/func_80183020.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/code/code_80182CE0/func_80183058.s")
diff --git a/src/code/game.c b/src/code/game.c
index a90fc7ac2..e431fafda 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -5,9 +5,6 @@ f32 gFramerateDivisorF = 1.0f;
f32 gFramerateDivisorHalf = 1.0f / 2.0f;
f32 gFramerateDivisorThird = 1.0f / 3.0f;
-u32 D_801D1510 = 0x0000000A;
-u32 D_801D1514[3] = { 0 };
-
void Game_UpdateFramerateVariables(s32 divisor) {
gFramerateDivisor = divisor;
gFramerateDivisorF = (f32)divisor;
@@ -104,12 +101,12 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
void GameState_SetFrameBuffer(GraphicsContext* gfxCtx) {
OPEN_DISPS(gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0, NULL);
- gSPSegment(POLY_OPA_DISP++, 0xF, gfxCtx->framebuffer);
- gSPSegment(POLY_XLU_DISP++, 0, NULL);
- gSPSegment(POLY_XLU_DISP++, 0xF, gfxCtx->framebuffer);
- gSPSegment(OVERLAY_DISP++, 0, NULL);
- gSPSegment(OVERLAY_DISP++, 0xF, gfxCtx->framebuffer);
+ gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
+ gSPSegment(POLY_OPA_DISP++, 0x0F, gfxCtx->curFrameBuffer);
+ gSPSegment(POLY_XLU_DISP++, 0x00, NULL);
+ gSPSegment(POLY_XLU_DISP++, 0x0F, gfxCtx->curFrameBuffer);
+ gSPSegment(OVERLAY_DISP++, 0x00, NULL);
+ gSPSegment(OVERLAY_DISP++, 0x0F, gfxCtx->curFrameBuffer);
CLOSE_DISPS(gfxCtx);
}
@@ -199,8 +196,8 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
gameState->running = 1;
gfxCtx->viMode = D_801FBB88;
gfxCtx->viConfigFeatures = gViConfigFeatures;
- gfxCtx->viConfigXScale = gViConfigXScale;
- gfxCtx->viConfigYScale = gViConfigYScale;
+ gfxCtx->xScale = gViConfigXScale;
+ gfxCtx->yScale = gViConfigYScale;
gameState->nextGameStateInit = NULL;
gameState->nextGameStateSize = 0U;
@@ -220,14 +217,14 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
func_801773A0(&D_801F7FF0);
func_8013ED9C();
- osSendMesg(&gameState->gfxCtx->unk5C, NULL, 1);
+ osSendMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
}
}
void GameState_Destroy(GameState* gameState) {
func_80172BC0();
func_8019E014();
- osRecvMesg(&gameState->gfxCtx->unk5C, NULL, OS_MESG_BLOCK);
+ osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
if (gameState->destroy != NULL) {
gameState->destroy(gameState);
@@ -247,7 +244,7 @@ GameStateFunc GameState_GetNextStateInit(GameState* gameState) {
return gameState->nextGameStateInit;
}
-size_t Game_GetNextStateSize(GameState* gameState) {
+size_t GameState_GetNextStateSize(GameState* gameState) {
return gameState->nextGameStateSize;
}
diff --git a/src/code/graph.c b/src/code/graph.c
index 428bd8621..7ef1715fd 100644
--- a/src/code/graph.c
+++ b/src/code/graph.c
@@ -1,25 +1,388 @@
+#include "prevent_bss_reordering.h"
#include "global.h"
+#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
+#include "overlays/gamestates/ovl_file_choose/z_file_choose.h"
+#include "overlays/gamestates/ovl_opening/z_opening.h"
+#include "overlays/gamestates/ovl_select/z_select.h"
+#include "overlays/gamestates/ovl_title/z_title.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_FaultClient.s")
+FaultAddrConvClient sGraphFaultAddrConvClient;
+FaultClient sGraphFaultClient;
+GfxMasterList* gGfxMasterDL;
+CfbInfo sGraphCfbInfos[3];
+OSTime sGraphTaskStartTime;
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_DlAlloc.s")
+void* Graph_FaultClient(void) {
+ FaultDrawer_DrawText(30, 100, "ShowFrameBuffer PAGE 0/1");
+ osViSwapBuffer(SysCfb_GetFbPtr(0));
+ osViSetMode(D_801FBB88);
+ osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF);
+ Fault_WaitForInput();
+ osViSwapBuffer(SysCfb_GetFbPtr(1));
+ osViSetMode(D_801FBB88);
+ osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_InitTHGA.s")
+void Graph_InitTHGA(TwoHeadGfxArena* arena, Gfx* buffer, s32 size) {
+ THGA_Ct(arena, buffer, size);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_GetNextGameState.s")
+void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
+ GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx % 2];
+ gGfxMasterDL = &pool->master;
+ gSegments[0x0E] = gGfxMasterDL;
+
+ pool->headMagic = GFXPOOL_HEAD_MAGIC;
+ pool->tailMagic = GFXPOOL_TAIL_MAGIC;
+
+ Graph_InitTHGA(&gfxCtx->polyOpa, pool->polyOpaBuffer, sizeof(pool->polyOpaBuffer));
+ Graph_InitTHGA(&gfxCtx->polyXlu, pool->polyXluBuffer, sizeof(pool->polyXluBuffer));
+ Graph_InitTHGA(&gfxCtx->overlay, pool->overlayBuffer, sizeof(pool->overlayBuffer));
+ Graph_InitTHGA(&gfxCtx->work, pool->workBuffer, sizeof(pool->workBuffer));
+ Graph_InitTHGA(&gfxCtx->debug, pool->debugBuffer, sizeof(pool->debugBuffer));
+
+ gfxCtx->polyOpaBuffer = pool->polyOpaBuffer;
+ gfxCtx->polyXluBuffer = pool->polyXluBuffer;
+ gfxCtx->overlayBuffer = pool->overlayBuffer;
+ gfxCtx->workBuffer = pool->workBuffer;
+ gfxCtx->debugBuffer = pool->debugBuffer;
+
+ gfxCtx->curFrameBuffer = (u16*)SysCfb_GetFbPtr(gfxCtx->framebufferIdx % 2);
+ gSegments[0x0F] = gfxCtx->curFrameBuffer;
+
+ gfxCtx->zbuffer = SysCfb_GetZBuffer();
+
+ gSPBranchList(&gGfxMasterDL->disps[0], pool->polyOpaBuffer);
+ gSPBranchList(&gGfxMasterDL->disps[1], pool->polyXluBuffer);
+ gSPBranchList(&gGfxMasterDL->disps[2], pool->overlayBuffer);
+ gSPBranchList(&gGfxMasterDL->disps[3], pool->workBuffer);
+ gSPEndDisplayList(&gGfxMasterDL->disps[4]);
+ gSPBranchList(&gGfxMasterDL->debugDisp[0], pool->debugBuffer);
+}
+
+GameStateOverlay* Graph_GetNextGameState(GameState* gameState) {
+ GameStateFunc gameStateInit = GameState_GetNextStateInit(gameState);
+
+ if (gameStateInit == (GameStateFunc)TitleSetup_Init) {
+ return &gGameStateOverlayTable[0];
+ }
+ if (gameStateInit == (GameStateFunc)Select_Init) {
+ return &gGameStateOverlayTable[1];
+ }
+ if (gameStateInit == (GameStateFunc)Title_Init) {
+ return &gGameStateOverlayTable[2];
+ }
+ if (gameStateInit == (GameStateFunc)Play_Init) {
+ return &gGameStateOverlayTable[3];
+ }
+ if (gameStateInit == (GameStateFunc)Opening_Init) {
+ return &gGameStateOverlayTable[4];
+ }
+ if (gameStateInit == (GameStateFunc)FileChoose_Init) {
+ return &gGameStateOverlayTable[5];
+ }
+ if (gameStateInit == (GameStateFunc)Daytelop_Init) {
+ return &gGameStateOverlayTable[6];
+ }
+ return NULL;
+}
+
+#ifdef NON_MATCHING
+// Regalloc differences
+void* Graph_FaultAddrConvFunc(void* address, void* param) {
+ u32 addr = address;
+ GameStateOverlay* gamestateOvl;
+ u32 ramConv;
+ u32 ramStart;
+ u32 diff;
+ s32 i;
+
+ for (i = 0; i < graphNumGameStates; i++) {
+ gamestateOvl = &gGameStateOverlayTable[i];
+ ramStart = gamestateOvl->loadedRamAddr;
+ diff = (u32)gamestateOvl->vramEnd - (u32)gamestateOvl->vramStart;
+ ramConv = (u32)gamestateOvl->vramStart - ramStart;
+
+ if (gamestateOvl->loadedRamAddr != NULL) {
+ if (addr >= ramStart && addr < ramStart + diff) {
+ return addr + ramConv;
+ }
+ }
+ }
+ return NULL;
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_FaultAddrConvFunc.s")
+#endif
+
+void Graph_Init(GraphicsContext* gfxCtx) {
+ bzero(gfxCtx, sizeof(GraphicsContext));
+ gfxCtx->gfxPoolIdx = 0;
+ gfxCtx->framebufferIdx = 0;
+ gfxCtx->viMode = NULL;
+ gfxCtx->viConfigFeatures = gViConfigFeatures;
+ gfxCtx->xScale = gViConfigXScale;
+ gfxCtx->yScale = gViConfigYScale;
+ osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff));
+ Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL);
+ Fault_AddAddrConvClient(&sGraphFaultAddrConvClient, Graph_FaultAddrConvFunc, NULL);
+}
+
+void Graph_Destroy(GraphicsContext* gfxCtx) {
+ Fault_RemoveClient(&sGraphFaultClient);
+ Fault_RemoveAddrConvClient(&sGraphFaultAddrConvClient);
+}
+
+/**
+ * Constructs the graphics OSTask and forwards it to the scheduler.
+ * Waits for up to 3 additional seconds for any current graphics task to complete.
+ * If it does not signal completion in that time, retry or trigger a crash.
+ */
+void Graph_TaskSet00(GraphicsContext* gfxCtx, GameState* gameState) {
+ static s32 retryCount = 10;
+ static s32 cfbIdx = 0;
+ OSTask_t* task = &gfxCtx->task.list.t;
+ OSScTask* scTask = &gfxCtx->task;
+ OSTimer timer;
+ OSMesg msg;
+ CfbInfo* cfb;
+
+retry:
+ osSetTimer(&timer, OS_USEC_TO_CYCLES(3 * 1000 * 1000), 0, &gfxCtx->queue, (OSMesg)666);
+ osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_BLOCK);
+ osStopTimer(&timer);
+
+ if (msg == (OSMesg)666) {
+ osSyncPrintf("GRAPH SP TIMEOUT\n");
+ if (retryCount >= 0) {
+ retryCount--;
+ Sched_SendGfxCancelMsg(&gSchedContext);
+ goto retry;
+ } else {
+ // graph.c: No more! die!
+ osSyncPrintf("graph.c:もうダメ!死ぬ!\n");
+ Fault_AddHungupAndCrashImpl("RCP is HUNG UP!!", "Oh! MY GOD!!");
+ }
+ }
+
+ gfxCtx->masterList = gGfxMasterDL;
+ if (gfxCtx->callback != NULL) {
+ gfxCtx->callback(gfxCtx, gfxCtx->callbackParam);
+ }
+
+ task->type = M_GFXTASK;
+ task->flags = OS_SC_DRAM_DLIST;
+ task->ucodeBoot = SysUcode_GetUCodeBoot();
+ task->ucodeBootSize = SysUcode_GetUCodeBootSize();
+ task->ucode = SysUcode_GetUCode();
+ task->ucodeData = SysUcode_GetUCodeData();
+ task->ucodeSize = 0x1000;
+ task->ucodeDataSize = 0x800;
+ task->dramStack = (u64*)gGfxSPTaskStack;
+ task->dramStackSize = sizeof(gGfxSPTaskStack);
+ task->outputBuff = gGfxSPTaskOutputBufferPtr;
+ task->outputBuffSize = gGfxSPTaskOutputBufferSize;
+ task->dataPtr = (u64*)gGfxMasterDL;
+ task->dataSize = 0;
+ task->yieldDataPtr = (u64*)gGfxSPTaskYieldBuffer;
+ task->yieldDataSize = sizeof(gGfxSPTaskYieldBuffer);
+
+ scTask->next = NULL;
+ scTask->flags = OS_SC_RCP_MASK | OS_SC_SWAPBUFFER | OS_SC_LAST_TASK;
+
+ if (SREG(33) & 1) {
+ SREG(33) &= ~1;
+ scTask->flags &= ~OS_SC_SWAPBUFFER;
+ gfxCtx->framebufferIdx--;
+ }
+
+ scTask->msgQ = &gfxCtx->queue;
+ scTask->msg = NULL;
+
+ { s32 pad; }
+
+ cfb = &sGraphCfbInfos[cfbIdx];
+ cfbIdx = (cfbIdx + 1) % ARRAY_COUNT(sGraphCfbInfos);
+
+ cfb->fb1 = gfxCtx->curFrameBuffer;
+ cfb->swapBuffer = gfxCtx->curFrameBuffer;
+
+ if (gfxCtx->updateViMode) {
+ gfxCtx->updateViMode = false;
+ cfb->viMode = gfxCtx->viMode;
+ cfb->features = gfxCtx->viConfigFeatures;
+ cfb->xScale = gfxCtx->xScale;
+ cfb->yScale = gfxCtx->yScale;
+ } else {
+ cfb->viMode = NULL;
+ }
+ cfb->unk_10 = 0;
+ cfb->updateRate = gameState->framerateDivisor;
+
+ scTask->framebuffer = cfb;
+
+ while (gfxCtx->queue.validCount != 0) {
+ osRecvMesg(&gfxCtx->queue, NULL, OS_MESG_NOBLOCK);
+ }
+
+ gfxCtx->schedMsgQ = &gSchedContext.cmdQ;
+ osSendMesg(&gSchedContext.cmdQ, scTask, OS_MESG_BLOCK);
+ Sched_SendEntryMsg(&gSchedContext);
+}
+
+void Graph_UpdateGame(GameState* gameState) {
+ Game_UpdateInput(gameState);
+ Game_IncrementFrameCount(gameState);
+ if (SREG(20) < 3) {
+ func_8019E014();
+ }
+}
+
+/**
+ * Run the gamestate logic, then finalize the gfx buffer
+ * and run the graphics task for this frame.
+ */
+void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
+ u32 problem;
+
+ gameState->unk_A3 = 0;
+ Graph_SetNextGfxPool(gfxCtx);
+
+ Game_Update(gameState);
+
+ OPEN_DISPS(gfxCtx);
+
+ gSPEndDisplayList(WORK_DISP++);
+ gSPEndDisplayList(POLY_OPA_DISP++);
+ gSPEndDisplayList(POLY_XLU_DISP++);
+ gSPEndDisplayList(OVERLAY_DISP++);
+ gSPEndDisplayList(DEBUG_DISP++);
+
+ CLOSE_DISPS(gfxCtx);
+
+ {
+ Gfx* gfx = gGfxMasterDL->taskStart;
+
+ gSPSegment(gfx++, 0x0E, gGfxMasterDL);
+ gSPDisplayList(gfx++, &D_0E000000.disps[3]);
+ gSPDisplayList(gfx++, &D_0E000000.disps[0]);
+ gSPDisplayList(gfx++, &D_0E000000.disps[1]);
+ gSPDisplayList(gfx++, &D_0E000000.disps[2]);
+ gSPDisplayList(gfx++, &D_0E000000.debugDisp[0]);
+
+ gDPPipeSync(gfx++);
+ gDPFullSync(gfx++);
+ gSPEndDisplayList(gfx++);
+ }
+
+ problem = false;
+
+ {
+ GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx % 2];
+
+ if (pool->headMagic != GFXPOOL_HEAD_MAGIC) {
+ Fault_AddHungupAndCrash("../graph.c", 1054);
+ }
+ if (pool->tailMagic != GFXPOOL_TAIL_MAGIC) {
+ Fault_AddHungupAndCrash("../graph.c", 1066);
+ }
+ }
+
+ if (THGA_IsCrash(&gfxCtx->polyOpa)) {
+ problem = true;
+ }
+ if (THGA_IsCrash(&gfxCtx->polyXlu)) {
+ problem = true;
+ }
+ if (THGA_IsCrash(&gfxCtx->overlay)) {
+ problem = true;
+ }
+ if (THGA_IsCrash(&gfxCtx->work)) {
+ problem = true;
+ }
+ if (THGA_IsCrash(&gfxCtx->debug)) {
+ problem = true;
+ }
+
+ if (!problem) {
+ Graph_TaskSet00(gfxCtx, gameState);
+ gfxCtx->gfxPoolIdx++;
+ gfxCtx->framebufferIdx++;
+ }
+
+ {
+ OSTime time = osGetTime();
+
+ D_801FBAE8 = sRSPGFXTotalTime;
+ D_801FBAE0 = gRSPAudioTotalTime;
+ D_801FBAF0 = gRDPTotalTime;
+ sRSPGFXTotalTime = 0;
+ gRSPAudioTotalTime = 0;
+ gRDPTotalTime = 0;
+
+ if (sGraphTaskStartTime != 0) {
+ lastRenderFrameDuration = time - sGraphTaskStartTime;
+ }
+ sGraphTaskStartTime = time;
+ }
+}
+
+void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
+ gameState->unk_A3 = 0;
+
+ Graph_UpdateGame(gameState);
+ Graph_ExecuteAndDraw(gfxCtx, gameState);
+}
+
+void Graph_ThreadEntry(void* arg) {
+ GraphicsContext gfxCtx;
+ GameStateOverlay* nextOvl = &gGameStateOverlayTable[0];
+ GameStateOverlay* ovl;
+ GameState* gameState;
+ u32 size;
+ s32 pad[2];
+
+ gZBuffer = SystemArena_Malloc(sizeof(*gZBuffer) + sizeof(*gWorkBuffer) + 64 - 1);
+ gZBuffer = (void*)ALIGN64((u32)gZBuffer);
+
+ gWorkBuffer = (void*)((u8*)gZBuffer + sizeof(*gZBuffer));
+
+ gGfxSPTaskOutputBuffer2 = gGfxSPTaskOutputBuffer = SystemArena_Malloc(sizeof(*gGfxSPTaskOutputBuffer));
+
+ gGfxSPTaskOutputBufferEnd = (u8*)gGfxSPTaskOutputBuffer + sizeof(*gGfxSPTaskOutputBuffer);
+ gGfxSPTaskOutputBufferEnd2 = (u8*)gGfxSPTaskOutputBuffer2 + sizeof(*gGfxSPTaskOutputBuffer2);
+
+ func_80178978();
+ Fault_SetFB(D_801FBB90, SCREEN_WIDTH, SCREEN_HEIGHT);
+ Graph_Init(&gfxCtx);
+
+ while (nextOvl) {
+ ovl = nextOvl;
+
+ Overlay_LoadGameState(ovl);
+
+ size = ovl->instanceSize;
+
+ func_800809F4(ovl->vromStart);
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_Init.s")
+ gameState = SystemArena_Malloc(size);
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_Destroy.s")
+ bzero(gameState, size);
+ GameState_Init(gameState, ovl->init, &gfxCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_Render.s")
+ while (GameState_IsRunning(gameState)) {
+ Graph_Update(&gfxCtx, gameState);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_FrameSetup.s")
+ nextOvl = Graph_GetNextGameState(gameState);
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_RenderFrame.s")
+ if (size) {}
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_DoFrame.s")
+ GameState_Destroy(gameState);
+ SystemArena_Free(gameState);
-#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_ThreadEntry.s")
+ Overlay_FreeGameState(ovl);
+ }
+ Graph_Destroy(&gfxCtx);
+}
diff --git a/src/code/graphalloc.c b/src/code/graphalloc.c
new file mode 100644
index 000000000..cbae8ebe4
--- /dev/null
+++ b/src/code/graphalloc.c
@@ -0,0 +1,29 @@
+#include "global.h"
+
+Gfx* Graph_GfxPlusOne(Gfx* gfx) {
+ return &gfx[1];
+}
+
+Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst) {
+ gSPBranchList(gfx, dst);
+ return dst;
+}
+
+/**
+ * Allocates a structure of `size` into the display list buffer`gfx`,
+ * returning a pointer to the start of the buffer.
+ * Since the alloc may not itself be display list commands, a BranchList
+ * command is used to step over this region.
+ */
+void* Graph_DlistAlloc(Gfx** gfx, size_t size) {
+ u8* start;
+ Gfx* end;
+
+ size = ALIGN8(size);
+ start = (u8*)&(*gfx)[1];
+ end = (Gfx*)(start + size);
+ gSPBranchList(*gfx, end);
+
+ *gfx = end;
+ return start;
+}
diff --git a/src/code/sched.c b/src/code/sched.c
index a5a3a8558..ecd984b05 100644
--- a/src/code/sched.c
+++ b/src/code/sched.c
@@ -179,7 +179,7 @@ halt_rdp:
if (dpTask->type == M_GFXTASK) {
// Try to stop DP
osSyncPrintf("DP止めようとします\n");
- bzero(dpTask->output_buff, (u32)dpTask->output_buff_size - (u32)dpTask->output_buff);
+ bzero(dpTask->outputBuff, (u32)dpTask->outputBuffSize - (u32)dpTask->outputBuff);
osSendMesg(&sched->interruptQ, RDP_DONE_MSG, OS_MESG_NOBLOCK);
}
}
@@ -336,8 +336,8 @@ void Sched_RunTask(SchedContext* sched, OSScTask* spTask, OSScTask* dpTask) {
if (spTask->list.t.type == M_AUDTASK) {
// Set global pointers to audio task data for use in audio processing
- gAudioSPDataPtr = spTask->list.t.data_ptr;
- gAudioSPDataSize = spTask->list.t.data_size;
+ gAudioSPDataPtr = spTask->list.t.dataPtr;
+ gAudioSPDataSize = spTask->list.t.dataSize;
}
// Begin task execution
@@ -527,7 +527,7 @@ void Sched_FaultClient(void* param1, void* param2) {
spTask = sched->curRSPTask;
if (spTask != NULL) {
FaultDrawer_Printf("RSPTask %08x %08x %02x %02x\n%01x %08x %08x\n", spTask, spTask->next, spTask->state,
- spTask->flags, spTask->list.t.type, spTask->list.t.data_ptr, spTask->list.t.data_size);
+ spTask->flags, spTask->list.t.type, spTask->list.t.dataPtr, spTask->list.t.dataSize);
}
dpTask = sched->curRDPTask;
diff --git a/src/code/sys_cmpdma.c b/src/code/sys_cmpdma.c
index c7317a7b7..c670645fc 100644
--- a/src/code/sys_cmpdma.c
+++ b/src/code/sys_cmpdma.c
@@ -8,9 +8,9 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/func_801789D4.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/get_framebuffer.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/SysCfb_GetFbPtr.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/get_zbuffer.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/SysCfb_GetZBuffer.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/func_80178A24.s")
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c
index a4d5b9379..a09d95200 100644
--- a/src/code/sys_matrix.c
+++ b/src/code/sys_matrix.c
@@ -87,11 +87,3 @@ void Matrix_StatePop(void) {
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotationAroundUnitVector_f.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotationAroundUnitVector_s.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182C90.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182CA0.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182CBC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182CCC.s")
diff --git a/src/code/sys_ucode.c b/src/code/sys_ucode.c
index 973606702..a832f9d38 100644
--- a/src/code/sys_ucode.c
+++ b/src/code/sys_ucode.c
@@ -1,7 +1,9 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/func_80182CE0.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCodeBoot.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/func_80183020.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCodeBootSize.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/func_80183058.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCode.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCodeData.s")
diff --git a/src/code/title_setup.c b/src/code/title_setup.c
index 324f8df3e..7df67a3b2 100644
--- a/src/code/title_setup.c
+++ b/src/code/title_setup.c
@@ -62,6 +62,6 @@ void TitleSetup_Destroy(GameState* gameState) {
}
void TitleSetup_Init(GameState* gameState) {
- gameState->destroy = &TitleSetup_Destroy;
+ gameState->destroy = TitleSetup_Destroy;
TitleSetup_InitImpl(gameState);
}
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 8d87e539b..03a362fc6 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -319,7 +319,7 @@ void Actor_SetScale(Actor* actor, f32 scale) {
void Actor_SetObjectSegment(GlobalContext* globalCtx, Actor* actor) {
// TODO: Segment number enum
- gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[actor->objBankIndex].segment);
+ gSegments[0x06] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[actor->objBankIndex].segment);
}
#if 0
diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c
index cf27d2251..f293c81c2 100644
--- a/src/code/z_effect_soft_sprite_old_init.c
+++ b/src/code/z_effect_soft_sprite_old_init.c
@@ -50,7 +50,7 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur
SkinMatrix_SetScale(&mfScale, scale, scale, scale);
SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->mf_187FC, &mfTrans11DA0);
SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
- gSegments[6] = PHYSICAL_TO_VIRTUAL(object);
+ gSegments[0x06] = PHYSICAL_TO_VIRTUAL(object);
gSPSegment(POLY_XLU_DISP++, 0x06, object);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c
index df55d2488..0e9c435c6 100644
--- a/src/code/z_prenmi.c
+++ b/src/code/z_prenmi.c
@@ -19,7 +19,7 @@ void PreNMI_Update(PreNMIContext* prenmiCtx) {
void PreNMI_Draw(PreNMIContext* prenmiCtx) {
GraphicsContext* gfxCtx = prenmiCtx->state.gfxCtx;
- func_8012CF0C(gfxCtx, 1, 1, 0, 0, 0);
+ func_8012CF0C(gfxCtx, true, true, 0, 0, 0);
OPEN_DISPS(gfxCtx);
@@ -35,7 +35,7 @@ void PreNMI_Main(PreNMIContext* prenmiCtx) {
PreNMI_Update(prenmiCtx);
PreNMI_Draw(prenmiCtx);
- prenmiCtx->state.unkA3 = 1;
+ prenmiCtx->state.unk_A3 = 1;
}
void PreNMI_Destroy(PreNMIContext* prenmiCtx) {
diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c
index 0498885a0..09e026e8f 100644
--- a/src/code/z_rcp.c
+++ b/src/code/z_rcp.c
@@ -762,7 +762,7 @@ Gfx sFillSetupDL[] = {
G_TD_CLAMP | G_TP_PERSP | G_CYC_FILL | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2),
gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH),
- gsSPDisplayList(&D_0E0001C8),
+ gsSPDisplayList(D_0E000000.setScissor),
gsDPSetBlendColor(0x00, 0x00, 0x00, 0x08),
gsSPClipRatio(FRUSTRATIO_2),
gsSPEndDisplayList(),
@@ -1223,82 +1223,110 @@ Gfx* Gfx_PrimColor(GraphicsContext* gfxCtx, s32 lodfrac, s32 r, s32 g, s32 b, s3
}
#ifdef NON_MATCHING
-// regalloc, some reorderings
-void func_8012CF0C(GraphicsContext* gfxCtx, s32 iParm2, s32 iParm3, u8 r, u8 g, u8 b) {
+// Regalloc differences, minor reorderings
+void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g, u8 b) {
+ Gfx* masterGfx;
+ void* zbuffer;
s32 i;
- Gfx* gfx;
-
- gSegments[0] = 0;
- gSegments[14] = (u32)graphDlEntry;
- gSegments[15] = (u32)gfxCtx->framebuffer;
-
- gfx = graphDlEntry + 0x16;
- gSPDisplayList(gfx + 0, &D_0E000140);
- gSPDisplayList(gfx + 1, &sFillSetupDL);
- gDPSetColorImage(gfx + 2, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, 0x0F000000);
- if (gfxCtx->zbuffer != NULL) {
- gDPSetDepthImage(gfx + 3, gfxCtx->zbuffer);
+
+ gSegments[0x00] = 0;
+ gSegments[0x0F] = gfxCtx->curFrameBuffer;
+ gSegments[0x0E] = gGfxMasterDL;
+
+ zbuffer = gfxCtx->zbuffer;
+
+ // Set up Framebuffer and Z-Buffer
+
+ masterGfx = gGfxMasterDL->setupBuffers;
+
+ gSPDisplayList(&masterGfx[0], D_0E000000.syncSegments);
+ gSPDisplayList(&masterGfx[1], sFillSetupDL);
+ gDPSetColorImage(&masterGfx[2], G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, &D_0F000000);
+ if (zbuffer != NULL) {
+ gDPSetDepthImage(&masterGfx[3], zbuffer);
} else {
- gDPSetDepthImage(gfx + 3, 0x0F000000);
+ gDPSetDepthImage(&masterGfx[3], &D_0F000000);
}
- gSPEndDisplayList(gfx + 4);
+ gSPEndDisplayList(&masterGfx[4]);
+
+ // Set Scissor
- gfx = graphDlEntry + 0x39;
- gDPSetScissor(gfx + 0, G_SC_NON_INTERLACE, 0, 0, D_801FBBCC, D_801FBBCE);
- gSPEndDisplayList(gfx + 1);
+ masterGfx = gGfxMasterDL->setScissor;
- gfx = graphDlEntry + 0x9;
- if (gfxCtx->zbuffer == NULL) {
- gSPEndDisplayList(gfx + 0);
+ gDPSetScissor(&masterGfx[0], G_SC_NON_INTERLACE, 0, 0, D_801FBBCC, D_801FBBCE);
+ gSPEndDisplayList(&masterGfx[1]);
+
+ // Clear Z-Buffer
+
+ masterGfx = gGfxMasterDL->clearZBuffer;
+
+ if (zbuffer == NULL) {
+ gSPEndDisplayList(&masterGfx[0]);
} else {
- gDPSetColorImage(gfx + 0, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, gfxCtx->zbuffer);
- gDPPipeSync(gfx + 1);
- gDPSetCycleType(gfx + 2, G_CYC_FILL);
- gDPSetRenderMode(gfx + 3, G_RM_NOOP, G_RM_NOOP2);
- gDPSetFillColor(gfx + 4, (GPACK_RGBA5551(0xFF, 0xFF, 0xF0, 0) << 16) | GPACK_RGBA5551(0xFF, 0xFF, 0xF0, 0));
- gSPDisplayList(gfx + 5, &D_0E0002C8);
- gDPSetColorImage(gfx + 6, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, gfxCtx->zbuffer);
- gSPEndDisplayList(gfx + 7);
+ gDPSetColorImage(&masterGfx[0], G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, zbuffer);
+ gDPPipeSync(&masterGfx[1]);
+ gDPSetCycleType(&masterGfx[2], G_CYC_FILL);
+ gDPSetRenderMode(&masterGfx[3], G_RM_NOOP, G_RM_NOOP2);
+ gDPSetFillColor(&masterGfx[4], (GPACK_RGBA5551(255, 255, 240, 0) << 16) | GPACK_RGBA5551(255, 255, 240, 0));
+ gSPDisplayList(&masterGfx[5], D_0E000000.clearFillRect);
+ gDPSetColorImage(&masterGfx[6], G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, zbuffer);
+ gSPEndDisplayList(&masterGfx[7]);
}
- gfx = graphDlEntry + 0x11;
- gDPSetColorImage(gfx + 0, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, 0x0F000000);
- gDPSetCycleType(gfx + 1, G_CYC_FILL);
- gDPSetRenderMode(gfx + 2, G_RM_NOOP, G_RM_NOOP2);
- gDPSetFillColor(gfx + 3, GPACK_RGBA5551(r, g, b, 0));
- gSPBranchList(gfx + 4, &D_0E0002C8);
-
- gfx = graphDlEntry + 0x59;
- gDPFillRectangle(gfx + 0, 0, 0, D_801FBBCC - 1, D_801FBBCE - 1);
- gDPPipeSync(gfx + 1);
- gSPEndDisplayList(gfx + 2);
-
- gfx = graphDlEntry + 0x5C;
- gDPFillRectangle(gfx + 0, 0, 0, D_801FBBCC, D_801FBBCE);
- gDPPipeSync(gfx + 1);
- gSPEndDisplayList(gfx + 2);
-
- gfx = graphDlEntry + 0x28;
- for (i = 0; i < 0x10; i++) {
- if (i == 0xE) {
- gSPNoOp(gfx + i);
+ // Clear Framebuffer
+
+ masterGfx = gGfxMasterDL->clearFrameBuffer;
+
+ gDPSetColorImage(&masterGfx[0], G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, &D_0F000000);
+ gDPSetCycleType(&masterGfx[1], G_CYC_FILL);
+ gDPSetRenderMode(&masterGfx[2], G_RM_NOOP, G_RM_NOOP2);
+ gDPSetFillColor(&masterGfx[3], (GPACK_RGBA5551(r, g, b, 1) << 16) | GPACK_RGBA5551(r, g, b, 1));
+ gSPBranchList(&masterGfx[4], D_0E000000.clearFillRect);
+
+ // Fillrect used by the above buffer clearing routines
+
+ masterGfx = gGfxMasterDL->clearFillRect;
+
+ gDPFillRectangle(&masterGfx[0], 0, 0, D_801FBBCC - 1, D_801FBBCE - 1);
+ gDPPipeSync(&masterGfx[1]);
+ gSPEndDisplayList(&masterGfx[2]);
+
+ // General Fillrect?
+
+ masterGfx = gGfxMasterDL->fillRect;
+
+ gDPFillRectangle(&masterGfx[0], 0, 0, D_801FBBCC, D_801FBBCE);
+ gDPPipeSync(&masterGfx[1]);
+ gSPEndDisplayList(&masterGfx[2]);
+
+ // Sync SP Segments with current CPU Segments
+
+ masterGfx = gGfxMasterDL->syncSegments;
+
+ for (i = 0; i < ARRAY_COUNT(gSegments); i++) {
+ if (i == 0x0E) {
+ gSPNoOp(&masterGfx[i]);
} else {
- gSPSegment(gfx + i, i, gSegments[i]);
+ gSPSegment(&masterGfx[i], i, gSegments[i]);
}
}
- gSPEndDisplayList(gfx + i);
+ gSPEndDisplayList(&masterGfx[i]);
- gSPDisplayList(gfxCtx->polyOpa.p++, graphDlEntry + 0x16);
- gSPDisplayList(gfxCtx->polyXlu.p++, graphDlEntry + 0x16);
- gSPDisplayList(gfxCtx->overlay.p++, graphDlEntry + 0x16);
- gSPDisplayList(gfxCtx->unk1B8.p++, graphDlEntry + 0x16);
+ OPEN_DISPS(gfxCtx);
- if (iParm3) {
- gSPDisplayList(gfxCtx->polyOpa.p++, &D_0E000048);
+ gSPDisplayList(POLY_OPA_DISP++, gGfxMasterDL->setupBuffers);
+ gSPDisplayList(POLY_XLU_DISP++, gGfxMasterDL->setupBuffers);
+ gSPDisplayList(OVERLAY_DISP++, gGfxMasterDL->setupBuffers);
+ gSPDisplayList(DEBUG_DISP++, gGfxMasterDL->setupBuffers);
+
+ if (clearZb) {
+ gSPDisplayList(gfxCtx->polyOpa.p++, D_0E000000.clearZBuffer);
}
- if (iParm2) {
- gSPDisplayList(gfxCtx->polyOpa.p++, &D_0E000088);
+ if (clearFb) {
+ gSPDisplayList(gfxCtx->polyOpa.p++, D_0E000000.clearFrameBuffer);
}
+
+ CLOSE_DISPS(gfxCtx);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8012CF0C.s")
@@ -1306,9 +1334,9 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 iParm2, s32 iParm3, u8 r, u8 g,
void func_8012D374(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
if ((R_PAUSE_MENU_MODE < 2) && (D_801F6D10 < 2)) {
- func_8012CF0C(gfxCtx, 1, 1, r, g, b);
+ func_8012CF0C(gfxCtx, true, true, r, g, b);
} else {
- func_8012CF0C(gfxCtx, 0, 0, r, g, b);
+ func_8012CF0C(gfxCtx, false, false, r, g, b);
}
}
diff --git a/src/code/z_room.c b/src/code/z_room.c
index 5163f1f29..fe4b51d68 100644
--- a/src/code/z_room.c
+++ b/src/code/z_room.c
@@ -111,7 +111,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) {
roomCtx->unk31 = 0;
roomCtx->currRoom.segment = roomCtx->activeRoomVram;
// TODO: Segment number enum
- gSegments[3] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram);
+ gSegments[0x03] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram);
Scene_ProcessHeader(globalCtx, (SceneCmd*)roomCtx->currRoom.segment);
func_80123140(globalCtx, GET_PLAYER(globalCtx));
@@ -137,7 +137,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) {
void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) {
if (room->segment != NULL) {
// TODO: Segment number enum
- gSegments[3] = PHYSICAL_TO_VIRTUAL(room->segment);
+ gSegments[0x03] = PHYSICAL_TO_VIRTUAL(room->segment);
roomDrawFuncs[room->mesh->type0.type](globalCtx, room, flags);
}
return;
diff --git a/src/code/z_scene.c b/src/code/z_scene.c
index b744af5d0..a0be4a75f 100644
--- a/src/code/z_scene.c
+++ b/src/code/z_scene.c
@@ -53,7 +53,7 @@ void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) {
objectCtx->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize);
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, GAMEPLAY_KEEP);
- gSegments[4] = PHYSICAL_TO_VIRTUAL(objectCtx->status[objectCtx->mainKeepIndex].segment);
+ gSegments[0x04] = PHYSICAL_TO_VIRTUAL(objectCtx->status[objectCtx->mainKeepIndex].segment);
}
void Object_UpdateBank(ObjectContext* objectCtx) {
@@ -228,7 +228,7 @@ void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) {
if (cmd->specialFiles.subKeepIndex != 0) {
globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.subKeepIndex);
// TODO: Segment number enum?
- gSegments[5] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
+ gSegments[0x05] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
}
if (cmd->specialFiles.cUpElfMsgNum != 0) {
diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c
index 4cd9734f6..c8ab534de 100644
--- a/src/code/z_skelanime.c
+++ b/src/code/z_skelanime.c
@@ -210,7 +210,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
OPEN_DISPS(globalCtx->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
+ gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
Matrix_StatePush();
rootLimb = (LodLimb*)Lib_SegmentedToVirtual(skeleton[0]);
@@ -428,7 +428,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
OPEN_DISPS(globalCtx->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
+ gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
Matrix_StatePush();
@@ -555,7 +555,7 @@ void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
mtx = (Mtx*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
- gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
+ gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
Matrix_StatePush();
@@ -822,7 +822,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
mtx = (Mtx*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
- gSPSegment(gfx++, 0xD, mtx);
+ gSPSegment(gfx++, 0x0D, mtx);
Matrix_StatePush();