From 16ec9b1e13abca7ef2a978bd1b99935f2dd3b2ab Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 28 Aug 2024 20:01:41 +0200 Subject: [PATCH] T() macro 7 (#2102) * T() macro in most of the rest of code (except z_message, z_actor, ucode_disas, gfxprint, game, fault, db_camera) * remaining T() macro in boot * format * review --- src/boot/logutils.c | 11 ++++++++--- src/boot/stackcheck.c | 8 ++++++-- src/code/code_800430A0.c | 9 +++++---- src/code/debug_malloc.c | 4 ++-- src/code/sched.c | 9 +++------ src/code/z_eff_shield_particle.c | 3 ++- src/code/z_jpeg.c | 31 ++++++++++++++++--------------- src/code/z_kanfont.c | 2 +- src/code/z_map_mark.c | 4 ++-- src/code/z_skin_matrix.c | 6 ++++-- 10 files changed, 49 insertions(+), 38 deletions(-) diff --git a/src/boot/logutils.c b/src/boot/logutils.c index a501a32bcd..aa67313134 100644 --- a/src/boot/logutils.c +++ b/src/boot/logutils.c @@ -84,19 +84,24 @@ void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* fi u32 mask = (unk - 1); if (value & mask) { - PRINTF(VT_COL(RED, WHITE) "%s %d:%s(%08x) は バウンダリ(%d)違反です\n" VT_RST, file, line, name, value, unk); + PRINTF(VT_COL(RED, WHITE) T("%s %d:%s(%08x) は バウンダリ(%d)違反です\n", + "%s %d:%s(%08x) is a boundary (%d) violation\n") VT_RST, + file, line, name, value, unk); } } void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line) { if (ptr == NULL) { - PRINTF(VT_COL(RED, WHITE) "%s %d:%s は はヌルポインタです\n" VT_RST, file, line, exp); + PRINTF(VT_COL(RED, WHITE) T("%s %d:%s は はヌルポインタです\n", "%s %d:%s is a null pointer\n") VT_RST, file, + line, exp); } } void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line) { if (ptr == NULL || (u32)ptr < 0x80000000 || (0x80000000 + osMemSize) <= (u32)ptr) { - PRINTF(VT_COL(RED, WHITE) "%s %d:ポインタ %s(%08x) が異常です\n" VT_RST, file, line, exp, ptr); + PRINTF(VT_COL(RED, WHITE) T("%s %d:ポインタ %s(%08x) が異常です\n", "%s %d: Pointer %s(%08x) is invalid\n") + VT_RST, + file, line, exp, ptr); } } diff --git a/src/boot/stackcheck.c b/src/boot/stackcheck.c index aa0972d2f8..e33ec5b197 100644 --- a/src/boot/stackcheck.c +++ b/src/boot/stackcheck.c @@ -20,7 +20,9 @@ void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 i iter = sStackInfoListStart; while (iter) { if (iter == entry) { - PRINTF(VT_COL(RED, WHITE) "stackcheck_init: %08x は既にリスト中にある\n" VT_RST, entry); + PRINTF(VT_COL(RED, WHITE) T("stackcheck_init: %08x は既にリスト中にある\n", + "stackcheck_init: %08x is already in the list\n") VT_RST, + entry); return; } iter = iter->next; @@ -68,7 +70,9 @@ void StackCheck_Cleanup(StackEntry* entry) { } } if (inconsistency) { - PRINTF(VT_COL(RED, WHITE) "stackcheck_cleanup: %08x リスト不整合です\n" VT_RST, entry); + PRINTF(VT_COL(RED, WHITE) T("stackcheck_cleanup: %08x リスト不整合です\n", + "stackcheck_cleanup: %08x list inconsistent\n") VT_RST, + entry); } } diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c index a13ecce7e1..64c1eee817 100644 --- a/src/code/code_800430A0.c +++ b/src/code/code_800430A0.c @@ -42,10 +42,11 @@ void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Act PRINTF(VT_FGCOL(RED)); //! @bug file and line are not passed to PRINTF - // "Position is not valid" - PRINTF( - "BGCheckCollection_typicalActorPos():位置が妥当ではありません。\npos (%f,%f,%f) file:%s line:%d\n", - pos.x, pos.y, pos.z); + PRINTF(T("BGCheckCollection_typicalActorPos():位置が妥当ではありません。\n" + "pos (%f,%f,%f) file:%s line:%d\n", + "BGCheckCollection_typicalActorPos(): Position is not valid. \n" + "pos (%f,%f,%f) file:%s line:%d\n"), + pos.x, pos.y, pos.z); PRINTF(VT_RST); } #endif diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index ccccbb154a..3e31f78455 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -97,8 +97,8 @@ void* DebugArena_Calloc(u32 num, u32 size) { #if OOT_DEBUG void DebugArena_Display(void) { - // "Zelda heap display" ("Zelda" should probably have been changed to "Debug") - PRINTF("ゼルダヒープ表示\n"); + // Likely copypasted from ZeldaArena_Display, should say "Debug" + PRINTF(T("ゼルダヒープ表示\n", "Zelda heap display\n")); __osDisplayArena(&sDebugArena); } #endif diff --git a/src/code/sched.c b/src/code/sched.c index 1deaa74b23..77860aa511 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -176,8 +176,7 @@ void Sched_QueueTask(Scheduler* sc, OSScTask* task) { 463); if (type == M_AUDTASK) { - // "You have entered an audio task" - SCHED_DEBUG_PRINTF("オーディオタスクをエントリしました\n"); + SCHED_DEBUG_PRINTF(T("オーディオタスクをエントリしました\n", "You have entered an audio task\n")); // Add to audio queue if (sc->audioListTail != NULL) { @@ -191,8 +190,7 @@ void Sched_QueueTask(Scheduler* sc, OSScTask* task) { sc->doAudio = true; } else { - // "Entered graph task" - SCHED_DEBUG_PRINTF("グラフタスクをエントリしました\n"); + SCHED_DEBUG_PRINTF(T("グラフタスクをエントリしました\n", "Entered graph task\n")); // Add to graphics queue if (sc->gfxListTail != NULL) { @@ -606,8 +604,7 @@ void Sched_ThreadEntry(void* arg) { Scheduler* sc = (Scheduler*)arg; while (true) { - // "%08d: standby" - SCHED_DEBUG_PRINTF("%08d:待機中\n", (u32)OS_CYCLES_TO_USEC(osGetTime())); + SCHED_DEBUG_PRINTF(T("%08d:待機中\n", "%08d: standby\n"), (u32)OS_CYCLES_TO_USEC(osGetTime())); // Await interrupt messages, either from the OS, IrqMgr, or another thread osRecvMesg(&sc->interruptQueue, &msg, OS_MESG_BLOCK); diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index b1e46cadd0..c66934a4ff 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -19,7 +19,8 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) { this->numElements = initParams->numElements; if (this->numElements > ARRAY_COUNT(this->elements)) { PRINTF(VT_FGCOL(RED)); - PRINTF("EffectShieldParticle_ct():パーティクル数がオーバしてます。\n"); + PRINTF(T("EffectShieldParticle_ct():パーティクル数がオーバしてます。\n", + "EffectShieldParticle_ct(): Number of particles exceeded.\n")); PRINTF(VT_RST); return; } diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 38aec24781..deee31dfde 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -178,22 +178,23 @@ void Jpeg_ParseMarkers(u8* ptr, JpegContext* ctx) { case MARKER_SOF: { // Start of Frame, stores important metadata of the image. // Only used for extracting the sampling factors (ctx->mode). - PRINTF("MARKER_SOF %d " - "精度%02x " // "accuracy" - "垂直%d " // "vertical" - "水平%d " // "horizontal" - "compo%02x " - "(1:Y)%d (H0=2,V0=1(422) or 2(420))%02x (量子化テーブル)%02x " - "(2:Cb)%d (H1=1,V1=1)%02x (量子化テーブル)%02x " - "(3:Cr)%d (H2=1,V2=1)%02x (量子化テーブル)%02x\n", + PRINTF(T("MARKER_SOF %d " + "精度%02x 垂直%d 水平%d compo%02x " + "(1:Y)%d (H0=2,V0=1(422) or 2(420))%02x (量子化テーブル)%02x " + "(2:Cb)%d (H1=1,V1=1)%02x (量子化テーブル)%02x " + "(3:Cr)%d (H2=1,V2=1)%02x (量子化テーブル)%02x\n", + "MARKER_SOF %d " + "accuracy%02x vertical%d horizontal%d compo%02x " + "(1:Y)%d (H0=2,V0=1(422) or 2(420))%02x (quantization tables)%02x " + "(2:Cb)%d (H1=1,V1=1)%02x (quantization tables)%02x " + "(3:Cr)%d (H2=1,V2=1)%02x (quantization tables)%02x\n"), Jpeg_GetUnalignedU16(ptr), - ptr[2], // precision - Jpeg_GetUnalignedU16(ptr + 3), // height - Jpeg_GetUnalignedU16(ptr + 5), // width - ptr[7], // component count (assumed to be 3) - ptr[8], ptr[9], ptr[10], // Y component - ptr[11], ptr[12], ptr[13], // Cb component - ptr[14], ptr[15], ptr[16] // Cr component + // precision, height, width, component count (assumed to be 3) + ptr[2], Jpeg_GetUnalignedU16(ptr + 3), Jpeg_GetUnalignedU16(ptr + 5), ptr[7], + // + ptr[8], ptr[9], ptr[10], // Y component + ptr[11], ptr[12], ptr[13], // Cb component + ptr[14], ptr[15], ptr[16] // Cr component ); if (ptr[9] == 0x21) { diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index 30fa15d41e..81c83ce346 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -77,7 +77,7 @@ void Font_LoadOrderedFont(Font* font) { fontBufIndex = 0; for (codePointIndex = 0; font->msgBuf[codePointIndex] != MESSAGE_END; codePointIndex++) { if (codePointIndex > (len * 1)) { - PRINTF("ERROR!! エラー!!! error───!!!!\n"); + PRINTF(T("ERROR!! エラー!!! error───!!!!\n", "ERROR!! Error!!! error───!!!!\n")); return; } diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index eaaf4c1e72..4fc7d7cfab 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -72,8 +72,8 @@ void MapMark_DrawForDungeon(PlayState* play) { interfaceCtx = &play->interfaceCtx; if ((gMapData != NULL) && (play->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) { - // "Room number exceeded, yikes %d/%d MapMarkDraw processing interrupted" - PRINTF(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n", + PRINTF(VT_COL(RED, WHITE) T("部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n", + "Room number exceeded, yikes %d/%d \nMapMarkDraw processing interrupted\n"), VT_RST, play->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]); return; } diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 98f8fc4d24..e5d0dfe99b 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -253,7 +253,8 @@ s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) { // Therefore src is a singular matrix (0 determinant). PRINTF(VT_COL(YELLOW, BLACK)); - PRINTF("Skin_Matrix_InverseMatrix():逆行列つくれません\n"); + PRINTF(T("Skin_Matrix_InverseMatrix():逆行列つくれません\n", + "Skin_Matrix_InverseMatrix(): Cannot create inverse matrix\n")); PRINTF(VT_RST); return 2; } @@ -589,7 +590,8 @@ Mtx* SkinMatrix_MtxFToNewMtx(GraphicsContext* gfxCtx, MtxF* src) { Mtx* mtx = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); if (mtx == NULL) { - PRINTF("Skin_Matrix_to_Mtx_new() 確保失敗:NULLを返して終了\n"); + PRINTF(T("Skin_Matrix_to_Mtx_new() 確保失敗:NULLを返して終了\n", + "Skin_Matrix_to_Mtx_new() allocation failed: Return NULL and exit\n")); return NULL; } SkinMatrix_MtxFToMtx(src, mtx);