Add log macros

- Add log macros required to match `Graph_GetNextGameState`
This commit is contained in:
Random 2020-04-04 19:28:53 +02:00
parent fed29c029c
commit 168d90b6b0
12 changed files with 31 additions and 37 deletions

View File

@ -39,4 +39,13 @@
(curState)->init = newInit; \ (curState)->init = newInit; \
(curState)->size = sizeof(newStruct); (curState)->size = sizeof(newStruct);
#define LOG(exp, value, format, file, line) \
LogUtils_LogThreadId(file, line); \
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_TIME(exp, value, file, line) LOG(exp, value, "%lld", file, line)
#define LOG_VALUE(exp, value, file, line) LOG(exp, value, "%d", file, line)
#endif #endif

View File

@ -98,7 +98,6 @@ void LogUtils_CheckValidPointer(const char* exp, void* ptr0, const char* file, s
} }
} }
// there's probalby a macro like this : MACRO(exp) LogUtils_LogThreadId(__FILE__, __LINE__); osSyncPrintf(exp)
void LogUtils_LogThreadId(const char* name, s32 line) { void LogUtils_LogThreadId(const char* name, s32 line) {
osSyncPrintf("<%d %s %d>", osGetThreadId(NULL), name, line); osSyncPrintf("<%d %s %d>", osGetThreadId(NULL), name, line);
} }

View File

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

View File

@ -124,8 +124,7 @@ GameStateOverlay* Graph_GetNextGameState() {
return &gGameStateOverlayTable[5]; return &gGameStateOverlayTable[5];
} }
LogUtils_LogThreadId("../graph.c", 696); LOG_ADDRESS("game_init_func", game_init_func, "../graph.c", 696);
osSyncPrintf("game_init_func = %08x\n", game_init_func);
return NULL; return NULL;
} }

View File

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

View File

@ -47,8 +47,8 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) {
} }
} }
LogUtils_LogThreadId("../z_elf_message.c", 156); // "Unplanned conditions"
osSyncPrintf("\"企画外 条件\" = %s\n", "企画外 条件"); // "Unplanned conditions" LOG_STRING("\"企画外 条件\"", "企画外 条件", "../z_elf_message.c", 156);
__assert("0", "../z_elf_message.c", 157); __assert("0", "../z_elf_message.c", 157);
return false; return false;
@ -138,8 +138,8 @@ u16 ElfMessage_GetTextFromMsgs(ElfMessage* msg) {
case 0xE0: case 0xE0:
return msg->byte2 | 0x100; return msg->byte2 | 0x100;
default: default:
LogUtils_LogThreadId("../z_elf_message.c", 281); // "Unplanned conditions"
osSyncPrintf("\"企画外 条件\" = %s\n", "企画外 条件"); // "Unplanned conditions" LOG_STRING("\"企画外 条件\"", "企画外 条件", "../z_elf_message.c", 281);
__assert("0", "../z_elf_message.c", 282); __assert("0", "../z_elf_message.c", 282);
} }
msg++; msg++;

View File

@ -30,15 +30,11 @@ void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n"); osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n");
sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(func_80826CB4); sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(func_80826CB4);
sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(func_808262B8); sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(func_808262B8);
// Note : the line numbers suggests there was a macro (see logutils.c)
LogUtils_LogThreadId("../z_kaleido_scope_call.c", 98); LOG_ADDRESS("kaleido_scope_move", func_80826CB4, "../z_kaleido_scope_call.c", 98);
osSyncPrintf("kaleido_scope_move = %08x\n", func_80826CB4); LOG_ADDRESS("kaleido_scope_move_func", sKaleidoScopeUpdateFunc, "../z_kaleido_scope_call.c", 99);
LogUtils_LogThreadId("../z_kaleido_scope_call.c", 99); LOG_ADDRESS("kaleido_scope_draw", func_808262B8, "../z_kaleido_scope_call.c", 100);
osSyncPrintf("kaleido_scope_move_func = %08x\n", sKaleidoScopeUpdateFunc); LOG_ADDRESS("kaleido_scope_draw_func", sKaleidoScopeDrawFunc, "../z_kaleido_scope_call.c", 101);
LogUtils_LogThreadId("../z_kaleido_scope_call.c", 100);
osSyncPrintf("kaleido_scope_draw = %08x\n", func_808262B8);
LogUtils_LogThreadId("../z_kaleido_scope_call.c", 101);
osSyncPrintf("kaleido_scope_draw_func = %08x\n", sKaleidoScopeDrawFunc);
func_8006ECF4(globalCtx); func_8006ECF4(globalCtx);
} }

View File

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

View File

@ -520,14 +520,10 @@ void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32
for (i = 0; i < limbCount; i++, dst++, index++) { for (i = 0; i < limbCount; i++, dst++, index++) {
if ((dst == NULL) || (index == NULL) || (frameRotationValueTable == NULL) || (rotationValueTable == NULL)) { if ((dst == NULL) || (index == NULL) || (frameRotationValueTable == NULL) || (rotationValueTable == NULL)) {
if (1) {} // Necessary to match. if (1) {} // Necessary to match.
LogUtils_LogThreadId("../z_skelanime.c", 1392); LOG_ADDRESS("out", dst, "../z_skelanime.c", 1392);
osSyncPrintf("out = %08x\n", dst); LOG_ADDRESS("ref_tbl", index, "../z_skelanime.c", 1393);
LogUtils_LogThreadId("../z_skelanime.c", 1393); LOG_ADDRESS("frame_tbl", frameRotationValueTable, "../z_skelanime.c", 1394);
osSyncPrintf("ref_tbl = %08x\n", index); LOG_ADDRESS("tbl", rotationValueTable, "../z_skelanime.c", 1395);
LogUtils_LogThreadId("../z_skelanime.c", 1394);
osSyncPrintf("frame_tbl = %08x\n", frameRotationValueTable);
LogUtils_LogThreadId("../z_skelanime.c", 1395);
osSyncPrintf("tbl = %08x\n", rotationValueTable);
} }
dst->x = index->x >= limit ? frameRotationValueTable[index->x] : rotationValueTable[index->x]; dst->x = index->x >= limit ? frameRotationValueTable[index->x] : rotationValueTable[index->x];

View File

@ -55,9 +55,8 @@ void ArrowFire_Init(ArrowFire* this, GlobalContext* globalCtx) {
void ArrowFire_Destroy(ArrowFire* this, GlobalContext* globalCtx) { void ArrowFire_Destroy(ArrowFire* this, GlobalContext* globalCtx) {
func_800876C8(globalCtx); func_800876C8(globalCtx);
LogUtils_LogThreadId("../z_arrow_fire.c", 421);
// Translates to: ""Disappearance" = Disappearance" // Translates to: ""Disappearance" = Disappearance"
osSyncPrintf("\"消滅\" = %s\n", "消滅"); LOG_STRING("\"消滅\"", "消滅", "../z_arrow_fire.c", 421);
} }
void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx) { void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx) {

View File

@ -55,9 +55,8 @@ void ArrowIce_Init(ArrowIce* this, GlobalContext* globalCtx) {
void ArrowIce_Destroy(ArrowIce* this, GlobalContext* globalCtx) { void ArrowIce_Destroy(ArrowIce* this, GlobalContext* globalCtx) {
func_800876C8(globalCtx); func_800876C8(globalCtx);
LogUtils_LogThreadId("../z_arrow_ice.c", 415);
// Translates to: ""Disappearance" = Disappearance" // Translates to: ""Disappearance" = Disappearance"
osSyncPrintf("\"消滅\" = %s\n", "消滅"); LOG_STRING("\"消滅\"", "消滅", "../z_arrow_ice.c", 415);
} }
void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) { void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) {

View File

@ -55,9 +55,8 @@ void ArrowLight_Init(ArrowLight* this, GlobalContext* globalCtx) {
void ArrowLight_Destroy(ArrowLight* this, GlobalContext* globalCtx) { void ArrowLight_Destroy(ArrowLight* this, GlobalContext* globalCtx) {
func_800876C8(globalCtx); func_800876C8(globalCtx);
LogUtils_LogThreadId("../z_arrow_light.c", 403);
// Translates to: ""Disappearance" = Disappearance" // Translates to: ""Disappearance" = Disappearance"
osSyncPrintf("\"消滅\" = %s\n", "消滅"); LOG_STRING("\"消滅\"", "消滅", "../z_arrow_light.c", 403);
} }
void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx) { void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx) {