mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-26 14:46:16 +00:00
Run format.sh
This commit is contained in:
parent
f818fb5299
commit
fed29c029c
3 changed files with 90 additions and 131 deletions
|
@ -1360,14 +1360,12 @@ typedef struct {
|
||||||
/* 0x20 */ f32 unk_20;
|
/* 0x20 */ f32 unk_20;
|
||||||
} UnkQuakeCalcStruct; // size = 0x24
|
} UnkQuakeCalcStruct; // size = 0x24
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
/* 0x00 */ u32 idx;
|
/* 0x00 */ u32 idx;
|
||||||
/* 0x04 */ void* ptr;
|
/* 0x04 */ void* ptr;
|
||||||
} UcodeInfo; // size = 0x8
|
} UcodeInfo; // size = 0x8
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
/* 0x00 */ u32 segments[NUM_SEGMENTS];
|
/* 0x00 */ u32 segments[NUM_SEGMENTS];
|
||||||
/* 0x40 */ u32 dl_stack[18];
|
/* 0x40 */ u32 dl_stack[18];
|
||||||
/* 0x88 */ u32 dl_depth;
|
/* 0x88 */ u32 dl_depth;
|
||||||
|
@ -1392,8 +1390,7 @@ typedef struct
|
||||||
/* 0xD4 */ u32 geometryMode;
|
/* 0xD4 */ u32 geometryMode;
|
||||||
} UcodeDisas; // size = 0xD8
|
} UcodeDisas; // size = 0xD8
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
/* 0x00 */ u16* fb1;
|
/* 0x00 */ u16* fb1;
|
||||||
/* 0x04 */ u16* swapbuffer;
|
/* 0x04 */ u16* swapbuffer;
|
||||||
/* 0x08 */ OSViMode* viMode;
|
/* 0x08 */ OSViMode* viMode;
|
||||||
|
|
188
src/code/graph.c
188
src/code/graph.c
|
@ -4,8 +4,8 @@
|
||||||
#include <vt.h>
|
#include <vt.h>
|
||||||
#include <PR/os_cont.h>
|
#include <PR/os_cont.h>
|
||||||
|
|
||||||
#define GFXPOOL_HEAD_MAGIC 0x1234
|
#define GFXPOOL_HEAD_MAGIC 0x1234
|
||||||
#define GFXPOOL_TAIL_MAGIC 0x5678
|
#define GFXPOOL_TAIL_MAGIC 0x5678
|
||||||
|
|
||||||
OSTime sGraph_UpdateTime;
|
OSTime sGraph_UpdateTime;
|
||||||
OSTime sGraphSetTaskTime;
|
OSTime sGraphSetTaskTime;
|
||||||
|
@ -14,45 +14,37 @@ CfbInfo sGraphCfbInfos[3];
|
||||||
FaultClient sGraphUcodeFaultClient;
|
FaultClient sGraphUcodeFaultClient;
|
||||||
|
|
||||||
UcodeInfo D_8012D230[3] = {
|
UcodeInfo D_8012D230[3] = {
|
||||||
{ 1, D_80155F50 },
|
{ 1, D_80155F50 }, { 2, NULL }, { 3, D_801120C0 + 0xFB0 }, // D_80113070
|
||||||
{ 2, NULL },
|
|
||||||
{ 3, D_801120C0+0xFB0 }, // D_80113070
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UcodeInfo D_8012D248[3] = {
|
UcodeInfo D_8012D248[3] = {
|
||||||
{ 1, D_80155F50 },
|
{ 1, D_80155F50 }, { 2, NULL }, { 3, D_801120C0 + 0xFB0 }, // D_80113070
|
||||||
{ 2, NULL },
|
|
||||||
{ 3, D_801120C0+0xFB0 }, // D_80113070
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void Graph_FaultClient()
|
void Graph_FaultClient() {
|
||||||
{
|
|
||||||
void* nextFb;
|
void* nextFb;
|
||||||
void* newFb;
|
void* newFb;
|
||||||
|
|
||||||
nextFb = osViGetNextFramebuffer();
|
nextFb = osViGetNextFramebuffer();
|
||||||
newFb = ((u32)SysCfb_GetFbPtr(0) != (u32)nextFb)
|
newFb = ((u32)SysCfb_GetFbPtr(0) != (u32)nextFb) ? SysCfb_GetFbPtr(0) : SysCfb_GetFbPtr(1);
|
||||||
? SysCfb_GetFbPtr(0)
|
|
||||||
: SysCfb_GetFbPtr(1);
|
|
||||||
|
|
||||||
osViSwapBuffer(newFb);
|
osViSwapBuffer(newFb);
|
||||||
Fault_WaitForInput();
|
Fault_WaitForInput();
|
||||||
osViSwapBuffer(nextFb);
|
osViSwapBuffer(nextFb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph_DisassembleUCode(void* arg0)
|
void Graph_DisassembleUCode(void* arg0) {
|
||||||
{
|
|
||||||
UcodeDisas disassembler;
|
UcodeDisas disassembler;
|
||||||
|
|
||||||
if (HREG(80) == 7 && HREG(81) != 0)
|
if (HREG(80) == 7 && HREG(81) != 0) {
|
||||||
{
|
|
||||||
func_800D7F5C(&disassembler);
|
func_800D7F5C(&disassembler);
|
||||||
disassembler.enableLog = HREG(83);
|
disassembler.enableLog = HREG(83);
|
||||||
func_800DAC80(&disassembler, 3, D_8012D230);
|
func_800DAC80(&disassembler, 3, D_8012D230);
|
||||||
func_800DAC90(&disassembler, D_80155F50);
|
func_800DAC90(&disassembler, D_80155F50);
|
||||||
func_800D8400(&disassembler, arg0);
|
func_800D8400(&disassembler, arg0);
|
||||||
HREG(93) = disassembler.dl_cnt;
|
HREG(93) = disassembler.dl_cnt;
|
||||||
HREG(84) = disassembler.tri2_cnt * 2 + disassembler.tri1_cnt + (disassembler.quad_cnt * 2) + disassembler.line_cnt;
|
HREG(84) =
|
||||||
|
disassembler.tri2_cnt * 2 + disassembler.tri1_cnt + (disassembler.quad_cnt * 2) + disassembler.line_cnt;
|
||||||
HREG(85) = disassembler.vtx_cnt;
|
HREG(85) = disassembler.vtx_cnt;
|
||||||
HREG(86) = disassembler.spvtx_cnt;
|
HREG(86) = disassembler.spvtx_cnt;
|
||||||
HREG(87) = disassembler.tri1_cnt;
|
HREG(87) = disassembler.tri1_cnt;
|
||||||
|
@ -61,8 +53,7 @@ void Graph_DisassembleUCode(void* arg0)
|
||||||
HREG(90) = disassembler.line_cnt;
|
HREG(90) = disassembler.line_cnt;
|
||||||
HREG(91) = disassembler.sync_err;
|
HREG(91) = disassembler.sync_err;
|
||||||
HREG(92) = disassembler.loaducode_cnt;
|
HREG(92) = disassembler.loaducode_cnt;
|
||||||
if (HREG(82) == 1 || HREG(82) == 2)
|
if (HREG(82) == 1 || HREG(82) == 2) {
|
||||||
{
|
|
||||||
osSyncPrintf("vtx_cnt=%d\n", disassembler.vtx_cnt);
|
osSyncPrintf("vtx_cnt=%d\n", disassembler.vtx_cnt);
|
||||||
osSyncPrintf("spvtx_cnt=%d\n", disassembler.spvtx_cnt);
|
osSyncPrintf("spvtx_cnt=%d\n", disassembler.spvtx_cnt);
|
||||||
osSyncPrintf("tri1_cnt=%d\n", disassembler.tri1_cnt);
|
osSyncPrintf("tri1_cnt=%d\n", disassembler.tri1_cnt);
|
||||||
|
@ -78,8 +69,7 @@ void Graph_DisassembleUCode(void* arg0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph_UCodeFaultClient(void* arg0)
|
void Graph_UCodeFaultClient(void* arg0) {
|
||||||
{
|
|
||||||
UcodeDisas disassembler;
|
UcodeDisas disassembler;
|
||||||
|
|
||||||
func_800D7F5C(&disassembler);
|
func_800D7F5C(&disassembler);
|
||||||
|
@ -90,8 +80,7 @@ void Graph_UCodeFaultClient(void* arg0)
|
||||||
func_800D7FC4(&disassembler);
|
func_800D7FC4(&disassembler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Graph_InitTHGA(GraphicsContext* gfxCtx)
|
void* Graph_InitTHGA(GraphicsContext* gfxCtx) {
|
||||||
{
|
|
||||||
GfxPool* pool;
|
GfxPool* pool;
|
||||||
|
|
||||||
pool = &gGfxPools[gfxCtx->gfxPoolIdx & 1];
|
pool = &gGfxPools[gfxCtx->gfxPoolIdx & 1];
|
||||||
|
@ -112,8 +101,7 @@ void* Graph_InitTHGA(GraphicsContext* gfxCtx)
|
||||||
gfxCtx->unk_014 = 0;
|
gfxCtx->unk_014 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameStateOverlay* Graph_GetNextGameState()
|
GameStateOverlay* Graph_GetNextGameState() {
|
||||||
{
|
|
||||||
void* game_init_func;
|
void* game_init_func;
|
||||||
|
|
||||||
game_init_func = func_800C546C();
|
game_init_func = func_800C546C();
|
||||||
|
@ -135,13 +123,13 @@ GameStateOverlay* Graph_GetNextGameState()
|
||||||
if (game_init_func == func_80811A20) {
|
if (game_init_func == func_80811A20) {
|
||||||
return &gGameStateOverlayTable[5];
|
return &gGameStateOverlayTable[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
LogUtils_LogThreadId("../graph.c", 696); osSyncPrintf("game_init_func = %08x\n", game_init_func);
|
LogUtils_LogThreadId("../graph.c", 696);
|
||||||
|
osSyncPrintf("game_init_func = %08x\n", game_init_func);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph_Ct(GraphicsContext* gfxCtx)
|
void Graph_Ct(GraphicsContext* gfxCtx) {
|
||||||
{
|
|
||||||
bzero(gfxCtx, sizeof(GraphicsContext));
|
bzero(gfxCtx, sizeof(GraphicsContext));
|
||||||
gfxCtx->gfxPoolIdx = 0;
|
gfxCtx->gfxPoolIdx = 0;
|
||||||
gfxCtx->fbIdx = 0;
|
gfxCtx->fbIdx = 0;
|
||||||
|
@ -154,16 +142,14 @@ void Graph_Ct(GraphicsContext* gfxCtx)
|
||||||
Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, 0, 0);
|
Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph_Dt(GraphicsContext* gfxCtx)
|
void Graph_Dt(GraphicsContext* gfxCtx) {
|
||||||
{
|
|
||||||
func_800D3210();
|
func_800D3210();
|
||||||
Fault_RemoveClient(&sGraphFaultClient);
|
Fault_RemoveClient(&sGraphFaultClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close to matching, reordering at the end
|
// Close to matching, reordering at the end
|
||||||
#ifdef NON_MATCHING
|
#ifdef NON_MATCHING
|
||||||
void Graph_TaskSet00(GraphicsContext* gfxCtx)
|
void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
||||||
{
|
|
||||||
static u32 D_8012D260 = 0;
|
static u32 D_8012D260 = 0;
|
||||||
static s32 sGraphCfbInfoIdx = 0;
|
static s32 sGraphCfbInfoIdx = 0;
|
||||||
|
|
||||||
|
@ -187,8 +173,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx)
|
||||||
|
|
||||||
osRecvMesg(mq, &msg, OS_MESG_BLOCK);
|
osRecvMesg(mq, &msg, OS_MESG_BLOCK);
|
||||||
osStopTimer(&timer);
|
osStopTimer(&timer);
|
||||||
if (msg == (OSMesg)666)
|
if (msg == (OSMesg)666) {
|
||||||
{
|
|
||||||
osSyncPrintf(VT_FGCOL(RED));
|
osSyncPrintf(VT_FGCOL(RED));
|
||||||
osSyncPrintf("RCPが帰ってきませんでした。"); // "RCP did not return."
|
osSyncPrintf("RCPが帰ってきませんでした。"); // "RCP did not return."
|
||||||
osSyncPrintf(VT_RST);
|
osSyncPrintf(VT_RST);
|
||||||
|
@ -197,8 +182,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx)
|
||||||
LogUtils_LogHexDump(gGfxSPTaskYieldBuffer, sizeof(gGfxSPTaskYieldBuffer));
|
LogUtils_LogHexDump(gGfxSPTaskYieldBuffer, sizeof(gGfxSPTaskYieldBuffer));
|
||||||
|
|
||||||
SREG(6) = -1;
|
SREG(6) = -1;
|
||||||
if (D_8012D260)
|
if (D_8012D260) {
|
||||||
{
|
|
||||||
temp = D_8012D260;
|
temp = D_8012D260;
|
||||||
HREG(80) = 7;
|
HREG(80) = 7;
|
||||||
HREG(81) = 1;
|
HREG(81) = 1;
|
||||||
|
@ -210,12 +194,12 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx)
|
||||||
}
|
}
|
||||||
osRecvMesg(mq, &msg, OS_MESG_NOBLOCK);
|
osRecvMesg(mq, &msg, OS_MESG_NOBLOCK);
|
||||||
D_8012D260 = gfxCtx->workBuffer;
|
D_8012D260 = gfxCtx->workBuffer;
|
||||||
if (gfxCtx->callback)
|
if (gfxCtx->callback) {
|
||||||
gfxCtx->callback(gfxCtx, gfxCtx->callbackParam);
|
gfxCtx->callback(gfxCtx, gfxCtx->callbackParam);
|
||||||
|
}
|
||||||
|
|
||||||
time = osGetTime();
|
time = osGetTime();
|
||||||
if (D_8016A550)
|
if (D_8016A550) {
|
||||||
{
|
|
||||||
D_8016A558 = (D_8016A558 + time) - D_8016A550;
|
D_8016A558 = (D_8016A558 + time) - D_8016A550;
|
||||||
D_8016A550 = time;
|
D_8016A550 = time;
|
||||||
}
|
}
|
||||||
|
@ -240,14 +224,13 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx)
|
||||||
Graph_OpenDisp(gfxArr, gfxCtx, "../graph.c", 828);
|
Graph_OpenDisp(gfxArr, gfxCtx, "../graph.c", 828);
|
||||||
task->data_size = (u32)gfxCtx->work.p - (u32)gfxCtx->workBuffer;
|
task->data_size = (u32)gfxCtx->work.p - (u32)gfxCtx->workBuffer;
|
||||||
Graph_CloseDisp(gfxArr, gfxCtx, "../graph.c", 830);
|
Graph_CloseDisp(gfxArr, gfxCtx, "../graph.c", 830);
|
||||||
|
|
||||||
task->yield_data_ptr = gGfxSPTaskYieldBuffer;
|
task->yield_data_ptr = gGfxSPTaskYieldBuffer;
|
||||||
task->yield_data_size = sizeof(gGfxSPTaskYieldBuffer);
|
task->yield_data_size = sizeof(gGfxSPTaskYieldBuffer);
|
||||||
|
|
||||||
scTask->next = NULL;
|
scTask->next = NULL;
|
||||||
scTask->flags = OS_SC_RCP_MASK | OS_SC_SWAPBUFFER | OS_SC_LAST_TASK;
|
scTask->flags = OS_SC_RCP_MASK | OS_SC_SWAPBUFFER | OS_SC_LAST_TASK;
|
||||||
if (SREG(33) & 1)
|
if (SREG(33) & 1) {
|
||||||
{
|
|
||||||
SREG(33) &= ~1;
|
SREG(33) &= ~1;
|
||||||
scTask->flags &= ~OS_SC_SWAPBUFFER;
|
scTask->flags &= ~OS_SC_SWAPBUFFER;
|
||||||
gfxCtx->fbIdx--;
|
gfxCtx->fbIdx--;
|
||||||
|
@ -256,7 +239,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx)
|
||||||
scTask->msg = NULL;
|
scTask->msg = NULL;
|
||||||
scTask->msgQ = mq;
|
scTask->msgQ = mq;
|
||||||
|
|
||||||
cfb = sGraphCfbInfos + sGraphCfbInfoIdx++;
|
cfb = sGraphCfbInfos + sGraphCfbInfoIdx++;
|
||||||
cfb->fb1 = gfxCtx->curFrameBuffer;
|
cfb->fb1 = gfxCtx->curFrameBuffer;
|
||||||
cfb->swapbuffer = gfxCtx->curFrameBuffer;
|
cfb->swapbuffer = gfxCtx->curFrameBuffer;
|
||||||
cfb->viMode = gfxCtx->viMode;
|
cfb->viMode = gfxCtx->viMode;
|
||||||
|
@ -281,14 +264,13 @@ u32 sGraphCfbInfoIdx = 0;
|
||||||
|
|
||||||
// Very close to matching, stack usage
|
// Very close to matching, stack usage
|
||||||
#ifdef NON_MATCHING
|
#ifdef NON_MATCHING
|
||||||
void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState)
|
void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||||
{
|
u32 problem; // 0xC4 -> 0xD4
|
||||||
u32 problem; // 0xC4 -> 0xD4
|
Gfx* gfxArr[5]; // 0xB0 -> 0xC0
|
||||||
Gfx* gfxArr[5]; // 0xB0 -> 0xC0
|
Gfx* gfxArr2[9]; // 0x8C -> 0x9C
|
||||||
Gfx* gfxArr2[9]; // 0x8C -> 0x9C
|
Gfx* gfxArr3[9]; // 0x68 -> 0x78
|
||||||
Gfx* gfxArr3[9]; // 0x68 -> 0x78
|
|
||||||
u64 time;
|
u64 time;
|
||||||
GfxPool* pool; // 0x4C -> 0x6C
|
GfxPool* pool; // 0x4C -> 0x6C
|
||||||
|
|
||||||
gameState->unk_A0 = 0;
|
gameState->unk_A0 = 0;
|
||||||
Graph_InitTHGA(gfxCtx);
|
Graph_InitTHGA(gfxCtx);
|
||||||
|
@ -299,17 +281,17 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState)
|
||||||
gDPNoOpString(gfxCtx->polyXlu.p++, "POLY_XLU_DISP 開始", 0);
|
gDPNoOpString(gfxCtx->polyXlu.p++, "POLY_XLU_DISP 開始", 0);
|
||||||
gDPNoOpString(gfxCtx->overlay.p++, "OVERLAY_DISP 開始", 0);
|
gDPNoOpString(gfxCtx->overlay.p++, "OVERLAY_DISP 開始", 0);
|
||||||
Graph_CloseDisp(gfxArr, gfxCtx, "../graph.c", 975);
|
Graph_CloseDisp(gfxArr, gfxCtx, "../graph.c", 975);
|
||||||
|
|
||||||
func_800C4A98(gameState); // Game_ReqPadData
|
func_800C4A98(gameState); // Game_ReqPadData
|
||||||
func_800C4AC8(gameState); // Game_SetGameFrame
|
func_800C4AC8(gameState); // Game_SetGameFrame
|
||||||
|
|
||||||
Graph_OpenDisp(gfxArr2, gfxCtx, "../graph.c", 987);
|
Graph_OpenDisp(gfxArr2, gfxCtx, "../graph.c", 987);
|
||||||
gDPNoOpString(gfxCtx->work.p++, "WORK_DISP 終了", 0);
|
gDPNoOpString(gfxCtx->work.p++, "WORK_DISP 終了", 0);
|
||||||
gDPNoOpString(gfxCtx->polyOpa.p++, "POLY_OPA_DISP 終了", 0);
|
gDPNoOpString(gfxCtx->polyOpa.p++, "POLY_OPA_DISP 終了", 0);
|
||||||
gDPNoOpString(gfxCtx->polyXlu.p++, "POLY_XLU_DISP 終了", 0);
|
gDPNoOpString(gfxCtx->polyXlu.p++, "POLY_XLU_DISP 終了", 0);
|
||||||
gDPNoOpString(gfxCtx->overlay.p++, "OVERLAY_DISP 終了", 0);
|
gDPNoOpString(gfxCtx->overlay.p++, "OVERLAY_DISP 終了", 0);
|
||||||
Graph_CloseDisp(gfxArr2, gfxCtx, "../graph.c", 996);
|
Graph_CloseDisp(gfxArr2, gfxCtx, "../graph.c", 996);
|
||||||
|
|
||||||
Graph_OpenDisp(gfxArr3, gfxCtx, "../graph.c", 999);
|
Graph_OpenDisp(gfxArr3, gfxCtx, "../graph.c", 999);
|
||||||
gSPBranchList(gfxCtx->work.p++, gfxCtx->polyOpaBuffer);
|
gSPBranchList(gfxCtx->work.p++, gfxCtx->polyOpaBuffer);
|
||||||
gSPBranchList(gfxCtx->polyOpa.p++, gfxCtx->polyXluBuffer);
|
gSPBranchList(gfxCtx->polyOpa.p++, gfxCtx->polyXluBuffer);
|
||||||
|
@ -361,7 +343,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState)
|
||||||
osSyncPrintf(VT_COL(RED, WHITE) "ダイナミック領域末尾が破壊されています\n" VT_RST);
|
osSyncPrintf(VT_COL(RED, WHITE) "ダイナミック領域末尾が破壊されています\n" VT_RST);
|
||||||
Fault_AddHungupAndCrash("../graph.c", 1076);
|
Fault_AddHungupAndCrash("../graph.c", 1076);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (THGA_IsCrash(&gfxCtx->polyOpa)) {
|
if (THGA_IsCrash(&gfxCtx->polyOpa)) {
|
||||||
problem = true;
|
problem = true;
|
||||||
osSyncPrintf("%c", 7);
|
osSyncPrintf("%c", 7);
|
||||||
|
@ -386,7 +368,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState)
|
||||||
gfxCtx->gfxPoolIdx++;
|
gfxCtx->gfxPoolIdx++;
|
||||||
gfxCtx->fbIdx++;
|
gfxCtx->fbIdx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
func_800F3054();
|
func_800F3054();
|
||||||
time = osGetTime();
|
time = osGetTime();
|
||||||
D_8016A538 = D_8016A568;
|
D_8016A538 = D_8016A568;
|
||||||
|
@ -401,7 +383,8 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState)
|
||||||
}
|
}
|
||||||
sGraph_UpdateTime = time;
|
sGraph_UpdateTime = time;
|
||||||
|
|
||||||
if (D_8012DBC0 && (!~(gameState->input[0].padPressed | ~Z_TRIG)) && (!~(gameState->input[0].raw.pad | ~(L_TRIG | R_TRIG)))) {
|
if (D_8012DBC0 && (!~(gameState->input[0].padPressed | ~Z_TRIG)) &&
|
||||||
|
(!~(gameState->input[0].raw.pad | ~(L_TRIG | R_TRIG)))) {
|
||||||
gSaveContext.game_mode = 0;
|
gSaveContext.game_mode = 0;
|
||||||
SET_NEXT_GAMESTATE(gameState, func_80801E44, char[0x240]); // TODO : SelectContext
|
SET_NEXT_GAMESTATE(gameState, func_80801E44, char[0x240]); // TODO : SelectContext
|
||||||
gameState->running = false;
|
gameState->running = false;
|
||||||
|
@ -418,23 +401,21 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState)
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_Update.s")
|
#pragma GLOBAL_ASM("asm/non_matchings/code/graph/Graph_Update.s")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Graph_ThreadEntry(void* arg0)
|
void Graph_ThreadEntry(void* arg0) {
|
||||||
{
|
|
||||||
GraphicsContext gfxCtx;
|
GraphicsContext gfxCtx;
|
||||||
GameState* gameState;
|
GameState* gameState;
|
||||||
u32 size;
|
u32 size;
|
||||||
GameStateOverlay* nextOvl;
|
GameStateOverlay* nextOvl;
|
||||||
GameStateOverlay* ovl;
|
GameStateOverlay* ovl;
|
||||||
char faultMsg[0x50];
|
char faultMsg[0x50];
|
||||||
|
|
||||||
nextOvl = &gGameStateOverlayTable[0];
|
nextOvl = &gGameStateOverlayTable[0];
|
||||||
|
|
||||||
// Start graphic thread execution
|
// Start graphic thread execution
|
||||||
osSyncPrintf("グラフィックスレッド実行開始\n");
|
osSyncPrintf("グラフィックスレッド実行開始\n");
|
||||||
Graph_Ct(&gfxCtx);
|
Graph_Ct(&gfxCtx);
|
||||||
|
|
||||||
while(nextOvl)
|
while (nextOvl) {
|
||||||
{
|
|
||||||
ovl = nextOvl;
|
ovl = nextOvl;
|
||||||
Overlay_LoadGameState(ovl);
|
Overlay_LoadGameState(ovl);
|
||||||
|
|
||||||
|
@ -443,106 +424,95 @@ void Graph_ThreadEntry(void* arg0)
|
||||||
osSyncPrintf("クラスサイズ=%dバイト\n", size);
|
osSyncPrintf("クラスサイズ=%dバイト\n", size);
|
||||||
|
|
||||||
gameState = SystemArena_MallocDebug(size, "../graph.c", 1196);
|
gameState = SystemArena_MallocDebug(size, "../graph.c", 1196);
|
||||||
|
|
||||||
if (!gameState)
|
if (!gameState) {
|
||||||
{
|
|
||||||
// Failure to secure
|
// Failure to secure
|
||||||
osSyncPrintf("確保失敗\n");
|
osSyncPrintf("確保失敗\n");
|
||||||
|
|
||||||
sprintf(faultMsg, "CLASS SIZE= %d bytes", size);
|
sprintf(faultMsg, "CLASS SIZE= %d bytes", size);
|
||||||
Fault_AddHungupAndCrashImpl("GAME CLASS MALLOC FAILED", faultMsg);
|
Fault_AddHungupAndCrashImpl("GAME CLASS MALLOC FAILED", faultMsg);
|
||||||
}
|
}
|
||||||
func_800C5080(gameState, ovl->init, &gfxCtx); //Game_Ct
|
func_800C5080(gameState, ovl->init, &gfxCtx); // Game_Ct
|
||||||
|
|
||||||
while (func_800C547C(gameState)) //Game_IsGameStateRunning
|
while (func_800C547C(gameState)) // Game_IsGameStateRunning
|
||||||
{
|
{
|
||||||
Graph_Update(&gfxCtx, gameState);
|
Graph_Update(&gfxCtx, gameState);
|
||||||
}
|
}
|
||||||
|
|
||||||
nextOvl = Graph_GetNextGameState(gameState);
|
nextOvl = Graph_GetNextGameState(gameState);
|
||||||
func_800C5360(gameState); //Game_Dt
|
func_800C5360(gameState); // Game_Dt
|
||||||
SystemArena_FreeDebug(gameState, "../graph.c", 1227);
|
SystemArena_FreeDebug(gameState, "../graph.c", 1227);
|
||||||
Overlay_FreeGameState(ovl);
|
Overlay_FreeGameState(ovl);
|
||||||
|
|
||||||
}
|
}
|
||||||
Graph_Dt(&gfxCtx);
|
Graph_Dt(&gfxCtx);
|
||||||
// End of graphic thread execution
|
// End of graphic thread execution
|
||||||
osSyncPrintf("グラフィックスレッド実行終了\n");
|
osSyncPrintf("グラフィックスレッド実行終了\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size)
|
void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size) {
|
||||||
{
|
|
||||||
TwoHeadGfxArena* thga = &gfxCtx->polyOpa;
|
TwoHeadGfxArena* thga = &gfxCtx->polyOpa;
|
||||||
|
|
||||||
if (HREG(59) == 1)
|
if (HREG(59) == 1) {
|
||||||
{
|
osSyncPrintf("graph_alloc siz=%d thga size=%08x bufp=%08x head=%08x tail=%08x\n", size, thga->size, thga->bufp,
|
||||||
osSyncPrintf("graph_alloc siz=%d thga size=%08x bufp=%08x head=%08x tail=%08x\n", size, thga->size,
|
thga->p, thga->d);
|
||||||
thga->bufp, thga->p, thga->d);
|
|
||||||
}
|
}
|
||||||
return THGA_AllocEnd(&gfxCtx->polyOpa, ALIGN16(size));
|
return THGA_AllocEnd(&gfxCtx->polyOpa, ALIGN16(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size)
|
void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) {
|
||||||
{
|
|
||||||
TwoHeadGfxArena* thga = &gfxCtx->polyOpa;
|
TwoHeadGfxArena* thga = &gfxCtx->polyOpa;
|
||||||
|
|
||||||
if (HREG(59) == 1)
|
if (HREG(59) == 1) {
|
||||||
{
|
osSyncPrintf("graph_alloc siz=%d thga size=%08x bufp=%08x head=%08x tail=%08x\n", size, thga->size, thga->bufp,
|
||||||
osSyncPrintf("graph_alloc siz=%d thga size=%08x bufp=%08x head=%08x tail=%08x\n", size, thga->size,
|
thga->p, thga->d);
|
||||||
thga->bufp, thga->p, thga->d);
|
|
||||||
}
|
}
|
||||||
return THGA_AllocEnd(&gfxCtx->polyOpa, ALIGN16(size));
|
return THGA_AllocEnd(&gfxCtx->polyOpa, ALIGN16(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph_OpenDisp(Gfx** gfxArr, GraphicsContext* gfxCtx, const char* file, s32 line)
|
void Graph_OpenDisp(Gfx** gfxArr, GraphicsContext* gfxCtx, const char* file, s32 line) {
|
||||||
{
|
if (HREG(80) == 7 && HREG(82) != 4) {
|
||||||
if (HREG(80) == 7 && HREG(82) != 4)
|
|
||||||
{
|
|
||||||
gfxArr[0] = gfxCtx->polyOpa.p;
|
gfxArr[0] = gfxCtx->polyOpa.p;
|
||||||
gfxArr[1] = gfxCtx->polyXlu.p;
|
gfxArr[1] = gfxCtx->polyXlu.p;
|
||||||
gfxArr[2] = gfxCtx->overlay.p;
|
gfxArr[2] = gfxCtx->overlay.p;
|
||||||
|
|
||||||
gDPNoOpOpenDisp(gfxCtx->polyOpa.p++, file, line);
|
gDPNoOpOpenDisp(gfxCtx->polyOpa.p++, file, line);
|
||||||
gDPNoOpOpenDisp(gfxCtx->polyXlu.p++, file, line);
|
gDPNoOpOpenDisp(gfxCtx->polyXlu.p++, file, line);
|
||||||
gDPNoOpOpenDisp(gfxCtx->overlay.p++, file, line);
|
gDPNoOpOpenDisp(gfxCtx->overlay.p++, file, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph_CloseDisp(Gfx** gfxArr, GraphicsContext* gfxCtx, const char* file, s32 line)
|
void Graph_CloseDisp(Gfx** gfxArr, GraphicsContext* gfxCtx, const char* file, s32 line) {
|
||||||
{
|
if (HREG(80) == 7 && HREG(82) != 4) {
|
||||||
if (HREG(80) == 7 && HREG(82) != 4)
|
if (gfxArr[0] + 1 == gfxCtx->polyOpa.p) {
|
||||||
{
|
|
||||||
if (gfxArr[0] + 1 == gfxCtx->polyOpa.p)
|
|
||||||
gfxCtx->polyOpa.p = gfxArr[0];
|
gfxCtx->polyOpa.p = gfxArr[0];
|
||||||
else
|
} else {
|
||||||
gDPNoOpCloseDisp(gfxCtx->polyOpa.p++, file, line);
|
gDPNoOpCloseDisp(gfxCtx->polyOpa.p++, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
if (gfxArr[1] + 1 == gfxCtx->polyXlu.p)
|
if (gfxArr[1] + 1 == gfxCtx->polyXlu.p) {
|
||||||
gfxCtx->polyXlu.p = gfxArr[1];
|
gfxCtx->polyXlu.p = gfxArr[1];
|
||||||
else
|
} else {
|
||||||
gDPNoOpCloseDisp(gfxCtx->polyXlu.p++, file, line);
|
gDPNoOpCloseDisp(gfxCtx->polyXlu.p++, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
if (gfxArr[2] + 1 == gfxCtx->overlay.p)
|
if (gfxArr[2] + 1 == gfxCtx->overlay.p) {
|
||||||
gfxCtx->overlay.p = gfxArr[2];
|
gfxCtx->overlay.p = gfxArr[2];
|
||||||
else
|
} else {
|
||||||
gDPNoOpCloseDisp(gfxCtx->overlay.p++, file, line);
|
gDPNoOpCloseDisp(gfxCtx->overlay.p++, file, line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx* Graph_GfxPlusOne(Gfx* gfx)
|
Gfx* Graph_GfxPlusOne(Gfx* gfx) {
|
||||||
{
|
return gfx + 1;
|
||||||
return gfx+1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst)
|
Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst) {
|
||||||
{
|
|
||||||
gSPBranchList(gfx, dst);
|
gSPBranchList(gfx, dst);
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Graph_DlistAlloc(Gfx** gfx, u32 size)
|
void* Graph_DlistAlloc(Gfx** gfx, u32 size) {
|
||||||
{
|
|
||||||
u8* ptr;
|
u8* ptr;
|
||||||
Gfx* dst;
|
Gfx* dst;
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,18 @@
|
||||||
#include <global.h>
|
#include <global.h>
|
||||||
|
|
||||||
#define GAMESTATE_OVERLAY(name, init, destroy, size) \
|
#define GAMESTATE_OVERLAY(name, init, destroy, size) \
|
||||||
{ \
|
{ \
|
||||||
NULL, \
|
NULL, (u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \
|
||||||
(u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, \
|
_ovl_##name##SegmentEnd, 0, init, destroy, 0, 0, 0, size \
|
||||||
_ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, \
|
|
||||||
0, init, destroy, 0, 0, 0, size \
|
|
||||||
}
|
|
||||||
#define GAMESTATE_OVERLAY_INTERNAL(init, destroy, size) \
|
|
||||||
{ \
|
|
||||||
NULL, \
|
|
||||||
0, 0, \
|
|
||||||
NULL, NULL, \
|
|
||||||
0, init, destroy, 0, 0, 0, size \
|
|
||||||
}
|
}
|
||||||
|
#define GAMESTATE_OVERLAY_INTERNAL(init, destroy, size) \
|
||||||
|
{ NULL, 0, 0, NULL, NULL, 0, init, destroy, 0, 0, 0, size }
|
||||||
|
|
||||||
GameStateOverlay gGameStateOverlayTable[] =
|
GameStateOverlay gGameStateOverlayTable[] = {
|
||||||
{
|
|
||||||
GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)),
|
GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)),
|
||||||
GAMESTATE_OVERLAY(select, func_80801E44, func_80801E0C, 0x240), // TODO : sizeof(SelectContext)
|
GAMESTATE_OVERLAY(select, func_80801E44, func_80801E0C, 0x240), // TODO : sizeof(SelectContext)
|
||||||
GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)),
|
GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)),
|
||||||
GAMESTATE_OVERLAY_INTERNAL(func_800BCA64, func_800BC8EC, sizeof(GlobalContext)),
|
GAMESTATE_OVERLAY_INTERNAL(func_800BCA64, func_800BC8EC, sizeof(GlobalContext)),
|
||||||
GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),
|
GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),
|
||||||
GAMESTATE_OVERLAY(file_choose, func_80811A20, func_80811A18, 0x1CAE0),
|
GAMESTATE_OVERLAY(file_choose, func_80811A20, func_80811A18, 0x1CAE0),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue