1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-21 04:24:43 +00:00

Fixes in PR #50

- Rename "sGraph_UpdateTime" to "sGraphUpdateTime"
- Rename "Graph_Ct"/"Graph_Dt" to "Graph_Init"/"Graph_Destroy"
- Change the LOG_STRING macro
- Rename "LOG_VALUE" to "LOG_NUM"
- Fix brace style
- Rename "UcodeInfo"/"UcodeDisas" to "UCodeInfo"/"UCodeDisas"
- Fix field names in "UCodeDisas"
- Fix typo in "GraphicsContext"
- Change the size of unknown fields in "GraphicsContext" to hex
- Rename "game_init_func" to "gameStateInitFunc"
This commit is contained in:
Random 2020-04-05 12:32:08 +02:00
parent 168d90b6b0
commit 02eaaa2039
12 changed files with 82 additions and 85 deletions

View File

@ -482,10 +482,10 @@ glabel Graph_Update
/* B3D8C8 800C6728 ACCA0000 */ sw $t2, ($a2)
/* B3D8CC 800C672C 240B0000 */ li $t3, 0
/* B3D8D0 800C6730 ACCB0004 */ sw $t3, 4($a2)
/* B3D8D4 800C6734 3C0C8016 */ lui $t4, %hi(sGraph_UpdateTime) # $t4, 0x8016
/* B3D8D8 800C6738 8D8C65D0 */ lw $t4, %lo(sGraph_UpdateTime)($t4)
/* B3D8DC 800C673C 3C0D8016 */ lui $t5, %hi(sGraph_UpdateTime+4) # $t5, 0x8016
/* B3D8E0 800C6740 8DAD65D4 */ lw $t5, %lo(sGraph_UpdateTime+4)($t5)
/* B3D8D4 800C6734 3C0C8016 */ lui $t4, %hi(sGraphUpdateTime) # $t4, 0x8016
/* B3D8D8 800C6738 8D8C65D0 */ lw $t4, %lo(sGraphUpdateTime)($t4)
/* B3D8DC 800C673C 3C0D8016 */ lui $t5, %hi(sGraphUpdateTime+4) # $t5, 0x8016
/* B3D8E0 800C6740 8DAD65D4 */ lw $t5, %lo(sGraphUpdateTime+4)($t5)
/* B3D8E4 800C6744 AFAC0020 */ sw $t4, 0x20($sp)
/* B3D8E8 800C6748 15800002 */ bnez $t4, .L800C6754
/* B3D8EC 800C674C AFAD0024 */ sw $t5, 0x24($sp)
@ -502,10 +502,10 @@ glabel Graph_Update
.L800C6774:
/* B3D914 800C6774 3C048013 */ lui $a0, %hi(D_8012DBC0) # $a0, 0x8013
/* B3D918 800C6778 8C84DBC0 */ lw $a0, %lo(D_8012DBC0)($a0)
/* B3D91C 800C677C 3C018016 */ lui $at, %hi(sGraph_UpdateTime+4) # $at, 0x8016
/* B3D920 800C6780 AC2265D0 */ sw $v0, %lo(sGraph_UpdateTime)($at)
/* B3D91C 800C677C 3C018016 */ lui $at, %hi(sGraphUpdateTime+4) # $at, 0x8016
/* B3D920 800C6780 AC2265D0 */ sw $v0, %lo(sGraphUpdateTime)($at)
/* B3D924 800C6784 10800015 */ beqz $a0, .L800C67DC
/* B3D928 800C6788 AC2365D4 */ sw $v1, %lo(sGraph_UpdateTime+4)($at)
/* B3D928 800C6788 AC2365D4 */ sw $v1, %lo(sGraphUpdateTime+4)($at)
/* B3D92C 800C678C 8FA200CC */ lw $v0, 0xcc($sp)
/* B3D930 800C6790 2401DFFF */ li $at, -8193
/* B3D934 800C6794 94580020 */ lhu $t8, 0x20($v0)

View File

@ -1534,8 +1534,8 @@ void Graph_DisassembleUCode(void* arg0);
void Graph_UCodeFaultClient(void* arg0);
void* Graph_InitTHGA(GraphicsContext* gfxCtx);
GameStateOverlay* Graph_GetNextGameState();
void Graph_Ct(GraphicsContext* gfxCtx);
void Graph_Dt(GraphicsContext* gfxCtx);
void Graph_Init(GraphicsContext* gfxCtx);
void Graph_Destroy(GraphicsContext* gfxCtx);
void Graph_TaskSet00(GraphicsContext* gfxCtx);
void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState);
void Graph_ThreadEntry(void*);

View File

@ -44,8 +44,8 @@
osSyncPrintf(exp " = " format "\n", value);
#define LOG_ADDRESS(exp, value, file, line) LOG(exp, value, "%08x", file, line)
#define LOG_STRING(exp, value, file, line) LOG(exp, value, "%s", file, line)
#define LOG_STRING(string, file, line) LOG(#string, string, "%s", file, line)
#define LOG_TIME(exp, value, file, line) LOG(exp, value, "%lld", file, line)
#define LOG_VALUE(exp, value, file, line) LOG(exp, value, "%d", file, line)
#define LOG_NUM(exp, value, file, line) LOG(exp, value, "%d", file, line)
#endif

View File

@ -235,8 +235,7 @@ typedef struct {
/* 0x000C */ Gfx* d;
} TwoHeadGfxArena; // size = 0x10
typedef struct OSScTask
{
typedef struct OSScTask {
/* 0x00 */ struct OSScTask* next;
/* 0x04 */ u32 state;
/* 0x08 */ u32 flags;
@ -246,18 +245,17 @@ typedef struct OSScTask
/* 0x54 */ OSMesg msg;
} OSScTask;
typedef struct GraphicsContex
{
typedef struct GraphicsContext {
/* 0x0000 */ Gfx* polyOpaBuffer;
/* 0x0004 */ Gfx* polyXluBuffer;
/* 0x0008 */ char unk_008[8];
/* 0x0008 */ char unk_008[0x08];
/* 0x0010 */ Gfx* overlayBuffer;
/* 0x0014 */ u32 unk_014;
/* 0x0018 */ char unk_018[0x20];
/* 0x0038 */ OSMesg msgBuff[8];
/* 0x0038 */ OSMesg msgBuff[0x08];
/* 0x0058 */ OSMesgQueue* schedMsgQ;
/* 0x005C */ OSMesgQueue queue;
/* 0x0074 */ char unk_074[4];
/* 0x0074 */ char unk_074[0x04];
/* 0x0078 */ OSScTask task; // size of OSScTask might be wrong
/* 0x00D0 */ char unk_0D0[0xE0];
/* 0x01B0 */ Gfx* workBuffer;
@ -270,14 +268,14 @@ typedef struct GraphicsContex
/* 0x02C8 */ TwoHeadGfxArena polyXlu;
/* 0x02D8 */ u32 gfxPoolIdx;
/* 0x02DC */ u16* curFrameBuffer;
/* 0x02E0 */ char unk_2E0[4];
/* 0x02E0 */ char unk_2E0[0x04];
/* 0x02E4 */ u32 viFeatures;
/* 0x02E8 */ s32 fbIdx;
/* 0x02EC */ void (*callback)(struct GraphicsContex*, u32);
/* 0x02F0 */ u32 callbackParam;
/* 0x02F4 */ f32 xScale;
/* 0x02F8 */ f32 yScale;
/* 0x02FC */ char unk_2FC[4];
/* 0x02FC */ char unk_2FC[0x04];
} GraphicsContext; // size = 0x300
typedef struct {
@ -1363,32 +1361,32 @@ typedef struct {
typedef struct {
/* 0x00 */ u32 idx;
/* 0x04 */ void* ptr;
} UcodeInfo; // size = 0x8
} UCodeInfo; // size = 0x8
typedef struct {
/* 0x00 */ u32 segments[NUM_SEGMENTS];
/* 0x40 */ u32 dl_stack[18];
/* 0x88 */ u32 dl_depth;
/* 0x8C */ u32 dl_cnt;
/* 0x90 */ u32 vtx_cnt;
/* 0x94 */ u32 spvtx_cnt;
/* 0x98 */ u32 tri1_cnt;
/* 0x9C */ u32 tri2_cnt;
/* 0xA0 */ u32 quad_cnt;
/* 0xA4 */ u32 line_cnt;
/* 0xA8 */ u32 loaducode_cnt;
/* 0x40 */ u32 dlStack[18];
/* 0x88 */ u32 dlDepth;
/* 0x8C */ u32 dlCnt;
/* 0x90 */ u32 vtxCnt;
/* 0x94 */ u32 spvtxCnt;
/* 0x98 */ u32 tri1Cnt;
/* 0x9C */ u32 tri2Cnt;
/* 0xA0 */ u32 quadCnt;
/* 0xA4 */ u32 lineCnt;
/* 0xA8 */ u32 loaducodeCnt;
/* 0xAC */ u32 pipeSyncRequired;
/* 0xB0 */ u32 tileSyncRequired;
/* 0xB4 */ u32 loadSyncRequired;
/* 0xB8 */ u32 sync_err;
/* 0xB8 */ u32 syncErr;
/* 0xBC */ u32 enableLog;
/* 0xC0 */ u32 ucodeInfoIdx;
/* 0xC4 */ u32 ucodeInfoCount;
/* 0xC8 */ UcodeInfo* ucodeInfo;
/* 0xC8 */ UCodeInfo* ucodeInfo;
/* 0xCC */ u32 modeH;
/* 0xD0 */ u32 modeL;
/* 0xD4 */ u32 geometryMode;
} UcodeDisas; // size = 0xD8
} UCodeDisas; // size = 0xD8
typedef struct {
/* 0x00 */ u16* fb1;

View File

@ -1884,8 +1884,8 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk
osSyncPrintf("%c", 7);
osSyncPrintf(VT_FGCOL(RED));
osSyncPrintf("dmaEntryMsgQが一杯です。キューサイズの再検討をおすすめします。");
LOG_VALUE("(sizeof(dmaEntryMsgBufs) / sizeof(dmaEntryMsgBufs[0]))", ARRAY_COUNT(sDmaMgrMsgs),
"../z_std_dma.c", 952);
LOG_NUM("(sizeof(dmaEntryMsgBufs) / sizeof(dmaEntryMsgBufs[0]))", ARRAY_COUNT(sDmaMgrMsgs),
"../z_std_dma.c", 952);
osSyncPrintf(VT_RST);
}
}

View File

@ -7,17 +7,17 @@
#define GFXPOOL_HEAD_MAGIC 0x1234
#define GFXPOOL_TAIL_MAGIC 0x5678
OSTime sGraph_UpdateTime;
OSTime sGraphUpdateTime;
OSTime sGraphSetTaskTime;
FaultClient sGraphFaultClient;
CfbInfo sGraphCfbInfos[3];
FaultClient sGraphUcodeFaultClient;
UcodeInfo D_8012D230[3] = {
UCodeInfo D_8012D230[3] = {
{ 1, D_80155F50 }, { 2, NULL }, { 3, D_801120C0 + 0xFB0 }, // D_80113070
};
UcodeInfo D_8012D248[3] = {
UCodeInfo D_8012D248[3] = {
{ 1, D_80155F50 }, { 2, NULL }, { 3, D_801120C0 + 0xFB0 }, // D_80113070
};
@ -34,7 +34,7 @@ void Graph_FaultClient() {
}
void Graph_DisassembleUCode(void* arg0) {
UcodeDisas disassembler;
UCodeDisas disassembler;
if (HREG(80) == 7 && HREG(81) != 0) {
func_800D7F5C(&disassembler);
@ -42,35 +42,34 @@ void Graph_DisassembleUCode(void* arg0) {
func_800DAC80(&disassembler, 3, D_8012D230);
func_800DAC90(&disassembler, D_80155F50);
func_800D8400(&disassembler, arg0);
HREG(93) = disassembler.dl_cnt;
HREG(84) =
disassembler.tri2_cnt * 2 + disassembler.tri1_cnt + (disassembler.quad_cnt * 2) + disassembler.line_cnt;
HREG(85) = disassembler.vtx_cnt;
HREG(86) = disassembler.spvtx_cnt;
HREG(87) = disassembler.tri1_cnt;
HREG(88) = disassembler.tri2_cnt;
HREG(89) = disassembler.quad_cnt;
HREG(90) = disassembler.line_cnt;
HREG(91) = disassembler.sync_err;
HREG(92) = disassembler.loaducode_cnt;
HREG(93) = disassembler.dlCnt;
HREG(84) = disassembler.tri2Cnt * 2 + disassembler.tri1Cnt + (disassembler.quadCnt * 2) + disassembler.lineCnt;
HREG(85) = disassembler.vtxCnt;
HREG(86) = disassembler.spvtxCnt;
HREG(87) = disassembler.tri1Cnt;
HREG(88) = disassembler.tri2Cnt;
HREG(89) = disassembler.quadCnt;
HREG(90) = disassembler.lineCnt;
HREG(91) = disassembler.syncErr;
HREG(92) = disassembler.loaducodeCnt;
if (HREG(82) == 1 || HREG(82) == 2) {
osSyncPrintf("vtx_cnt=%d\n", disassembler.vtx_cnt);
osSyncPrintf("spvtx_cnt=%d\n", disassembler.spvtx_cnt);
osSyncPrintf("tri1_cnt=%d\n", disassembler.tri1_cnt);
osSyncPrintf("tri2_cnt=%d\n", disassembler.tri2_cnt);
osSyncPrintf("quad_cnt=%d\n", disassembler.quad_cnt);
osSyncPrintf("line_cnt=%d\n", disassembler.line_cnt);
osSyncPrintf("sync_err=%d\n", disassembler.sync_err);
osSyncPrintf("loaducode_cnt=%d\n", disassembler.loaducode_cnt);
osSyncPrintf("dl_depth=%d\n", disassembler.dl_depth);
osSyncPrintf("dl_cnt=%d\n", disassembler.dl_cnt);
osSyncPrintf("vtx_cnt=%d\n", disassembler.vtxCnt);
osSyncPrintf("spvtx_cnt=%d\n", disassembler.spvtxCnt);
osSyncPrintf("tri1_cnt=%d\n", disassembler.tri1Cnt);
osSyncPrintf("tri2_cnt=%d\n", disassembler.tri2Cnt);
osSyncPrintf("quad_cnt=%d\n", disassembler.quadCnt);
osSyncPrintf("line_cnt=%d\n", disassembler.lineCnt);
osSyncPrintf("sync_err=%d\n", disassembler.syncErr);
osSyncPrintf("loaducode_cnt=%d\n", disassembler.loaducodeCnt);
osSyncPrintf("dl_depth=%d\n", disassembler.dlDepth);
osSyncPrintf("dl_cnt=%d\n", disassembler.dlCnt);
}
func_800D7FC4(&disassembler);
}
}
void Graph_UCodeFaultClient(void* arg0) {
UcodeDisas disassembler;
UCodeDisas disassembler;
func_800D7F5C(&disassembler);
disassembler.enableLog = true;
@ -102,33 +101,33 @@ void* Graph_InitTHGA(GraphicsContext* gfxCtx) {
}
GameStateOverlay* Graph_GetNextGameState() {
void* game_init_func;
void* gameStateInitFunc;
game_init_func = func_800C546C();
if (game_init_func == TitleSetup_Init) {
gameStateInitFunc = func_800C546C();
if (gameStateInitFunc == TitleSetup_Init) {
return &gGameStateOverlayTable[0];
}
if (game_init_func == func_80801E44) {
if (gameStateInitFunc == func_80801E44) {
return &gGameStateOverlayTable[1];
}
if (game_init_func == Title_Init) {
if (gameStateInitFunc == Title_Init) {
return &gGameStateOverlayTable[2];
}
if (game_init_func == func_800BCA64) {
if (gameStateInitFunc == func_800BCA64) {
return &gGameStateOverlayTable[3];
}
if (game_init_func == Opening_Init) {
if (gameStateInitFunc == Opening_Init) {
return &gGameStateOverlayTable[4];
}
if (game_init_func == func_80811A20) {
if (gameStateInitFunc == func_80811A20) {
return &gGameStateOverlayTable[5];
}
LOG_ADDRESS("game_init_func", game_init_func, "../graph.c", 696);
LOG_ADDRESS("game_init_func", gameStateInitFunc, "../graph.c", 696);
return NULL;
}
void Graph_Ct(GraphicsContext* gfxCtx) {
void Graph_Init(GraphicsContext* gfxCtx) {
bzero(gfxCtx, sizeof(GraphicsContext));
gfxCtx->gfxPoolIdx = 0;
gfxCtx->fbIdx = 0;
@ -141,7 +140,7 @@ void Graph_Ct(GraphicsContext* gfxCtx) {
Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, 0, 0);
}
void Graph_Dt(GraphicsContext* gfxCtx) {
void Graph_Destroy(GraphicsContext* gfxCtx) {
func_800D3210();
Fault_RemoveClient(&sGraphFaultClient);
}
@ -377,10 +376,10 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
D_8016A560 = 0;
D_8016A580 = 0;
if (sGraph_UpdateTime != 0) {
D_8016A548 = time - sGraph_UpdateTime;
if (sGraphUpdateTime != 0) {
D_8016A548 = time - sGraphUpdateTime;
}
sGraph_UpdateTime = time;
sGraphUpdateTime = time;
if (D_8012DBC0 && (!~(gameState->input[0].padPressed | ~Z_TRIG)) &&
(!~(gameState->input[0].raw.pad | ~(L_TRIG | R_TRIG)))) {
@ -412,7 +411,7 @@ void Graph_ThreadEntry(void* arg0) {
// Start graphic thread execution
osSyncPrintf("グラフィックスレッド実行開始\n");
Graph_Ct(&gfxCtx);
Graph_Init(&gfxCtx);
while (nextOvl) {
ovl = nextOvl;
@ -443,7 +442,7 @@ void Graph_ThreadEntry(void* arg0) {
SystemArena_FreeDebug(gameState, "../graph.c", 1227);
Overlay_FreeGameState(ovl);
}
Graph_Dt(&gfxCtx);
Graph_Destroy(&gfxCtx);
// End of graphic thread execution
osSyncPrintf("グラフィックスレッド実行終了\n");
}

View File

@ -143,7 +143,7 @@ void func_800C740C(PadMgr* padmgr) {
} else if (var4 == 11) {
padmgr->unk_2AE[var3] = 2;
} else if (var4 == 4) {
LOG_VALUE("++errcnt", ++D_8012D284, "../padmgr.c", 282);
LOG_NUM("++errcnt", ++D_8012D284, "../padmgr.c", 282);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", var3 + 1, "コントローラパックの通信エラー");
osSyncPrintf(VT_RST);

View File

@ -48,7 +48,7 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) {
}
// "Unplanned conditions"
LOG_STRING("\"企画外 条件\"", "企画外 条件", "../z_elf_message.c", 156);
LOG_STRING("企画外 条件", "../z_elf_message.c", 156);
__assert("0", "../z_elf_message.c", 157);
return false;
@ -139,7 +139,7 @@ u16 ElfMessage_GetTextFromMsgs(ElfMessage* msg) {
return msg->byte2 | 0x100;
default:
// "Unplanned conditions"
LOG_STRING("\"企画外 条件\"", "企画外 条件", "../z_elf_message.c", 281);
LOG_STRING("企画外 条件", "../z_elf_message.c", 281);
__assert("0", "../z_elf_message.c", 282);
}
msg++;

View File

@ -558,7 +558,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
j = 0;
roomList = globalCtx->roomList;
transitionActor = &globalCtx->transitionActorList[0];
LOG_VALUE("game_play->room_rom_address.num", globalCtx->nbRooms, "../z_room.c", 912);
LOG_NUM("game_play->room_rom_address.num", globalCtx->nbRooms, "../z_room.c", 912);
for (j = 0; j < globalCtx->nbTransitionActors; j++) {
frontRoom = transitionActor->frontRoom;

View File

@ -56,7 +56,7 @@ void ArrowFire_Init(ArrowFire* this, GlobalContext* globalCtx) {
void ArrowFire_Destroy(ArrowFire* this, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
// Translates to: ""Disappearance" = Disappearance"
LOG_STRING("\"消滅\"", "消滅", "../z_arrow_fire.c", 421);
LOG_STRING("消滅", "../z_arrow_fire.c", 421);
}
void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx) {

View File

@ -56,7 +56,7 @@ void ArrowIce_Init(ArrowIce* this, GlobalContext* globalCtx) {
void ArrowIce_Destroy(ArrowIce* this, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
// Translates to: ""Disappearance" = Disappearance"
LOG_STRING("\"消滅\"", "消滅", "../z_arrow_ice.c", 415);
LOG_STRING("消滅", "../z_arrow_ice.c", 415);
}
void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) {

View File

@ -56,7 +56,7 @@ void ArrowLight_Init(ArrowLight* this, GlobalContext* globalCtx) {
void ArrowLight_Destroy(ArrowLight* this, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
// Translates to: ""Disappearance" = Disappearance"
LOG_STRING("\"消滅\"", "消滅", "../z_arrow_light.c", 403);
LOG_STRING("消滅", "../z_arrow_light.c", 403);
}
void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx) {