summaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2026-04-21 05:12:46 -0700
committerGitHub <noreply@github.com>2026-04-21 08:12:46 -0400
commit57e41795f53f8d43d67e94f89b1b532e30cf8aec (patch)
treeb188e62dc98f6a0cace751c37f83236d5192afa5 /src/boot
parentfa85e7cda5de980151ab71279b6a1bf2eca9b23f (diff)
String macros (#1871)
* PRINTF * T * fault * yaz0 * __osMalloc * audio_thread_manager * graph * padmgr * sched * z_play * z_arrow_ice * z_arrow_light * z_elf_msg * z_elf_msg3 * z_elf_msg4 * z_elf_msg5 * z_mir_ray * stackcheck * Include versions in macros.h * Fix workaround for permuter
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/fault.c27
-rw-r--r--src/boot/libc64/__osMalloc.c35
-rw-r--r--src/boot/libu64/stackcheck.c31
-rw-r--r--src/boot/yaz0.c4
4 files changed, 49 insertions, 48 deletions
diff --git a/src/boot/fault.c b/src/boot/fault.c
index 7d167e41c..bc7d60f19 100644
--- a/src/boot/fault.c
+++ b/src/boot/fault.c
@@ -122,7 +122,9 @@ end:
osSetIntMask(mask);
if (alreadyExists) {
- osSyncPrintf(VT_COL(RED, WHITE) "fault_AddClient: %08x は既にリスト中にある\n" VT_RST, client);
+ osSyncPrintf(VT_COL(RED, WHITE) T("fault_AddClient: %08x は既にリスト中にある\n",
+ "fault_AddClient: %08x is already in the list\n") VT_RST,
+ client);
}
}
@@ -159,7 +161,9 @@ void Fault_RemoveClient(FaultClient* client) {
osSetIntMask(mask);
if (listIsEmpty) {
- osSyncPrintf(VT_COL(RED, WHITE) "fault_RemoveClient: %08x リスト不整合です\n" VT_RST, client);
+ osSyncPrintf(VT_COL(RED, WHITE) T("fault_RemoveClient: %08x リスト不整合です\n",
+ "fault_RemoveClient: %08x list inconsistency\n") VT_RST,
+ client);
}
}
@@ -200,7 +204,9 @@ end:
osSetIntMask(mask);
if (alreadyExists) {
- osSyncPrintf(VT_COL(RED, WHITE) "fault_AddressConverterAddClient: %08x は既にリスト中にある\n" VT_RST, client);
+ osSyncPrintf(VT_COL(RED, WHITE) T("fault_AddressConverterAddClient: %08x は既にリスト中にある\n",
+ "fault_AddressConverterAddClient: %08x is already in the list\n") VT_RST,
+ client);
}
}
@@ -234,7 +240,8 @@ void Fault_RemoveAddrConvClient(FaultAddrConvClient* client) {
osSetIntMask(mask);
if (listIsEmpty) {
- osSyncPrintf(VT_COL(RED, WHITE) "fault_AddressConverterRemoveClient: %08x は既にリスト中にある\n" VT_RST,
+ osSyncPrintf(VT_COL(RED, WHITE) T("fault_AddressConverterRemoveClient: %08x は既にリスト中にある\n",
+ "fault_AddressConverterRemoveClient: %08x is already in the list\n") VT_RST,
client);
}
}
@@ -982,20 +989,20 @@ void Fault_ThreadEntry(void* arg) {
if (msg == FAULT_MSG_CPU_BREAK) {
sFaultInstance->msgId = (u32)FAULT_MSG_CPU_BREAK;
- // "Fault manager: OS_EVENT_CPU_BREAK received"
- osSyncPrintf("フォルトマネージャ:OS_EVENT_CPU_BREAKを受信しました\n");
+ osSyncPrintf(T("フォルトマネージャ:OS_EVENT_CPU_BREAKを受信しました\n",
+ "Fault manager: OS_EVENT_CPU_BREAK received\n"));
} else if (msg == FAULT_MSG_FAULT) {
sFaultInstance->msgId = (u32)FAULT_MSG_FAULT;
- // "Fault manager: OS_EVENT_FAULT received"
- osSyncPrintf("フォルトマネージャ:OS_EVENT_FAULTを受信しました\n");
+ osSyncPrintf(
+ T("フォルトマネージャ:OS_EVENT_FAULTを受信しました\n", "Fault manager: OS_EVENT_FAULT received\n"));
} else if (msg == FAULT_MSG_UNK) {
Fault_UpdatePad();
faultedThread = NULL;
continue;
} else {
sFaultInstance->msgId = (u32)FAULT_MSG_UNK;
- // "Fault manager: received an unknown message"
- osSyncPrintf("フォルトマネージャ:不明なメッセージを受信しました\n");
+ osSyncPrintf(T("フォルトマネージャ:不明なメッセージを受信しました\n",
+ "Fault manager: received an unknown message\n"));
}
faultedThread = __osGetCurrFaultedThread();
diff --git a/src/boot/libc64/__osMalloc.c b/src/boot/libc64/__osMalloc.c
index f22f143e9..0d1065238 100644
--- a/src/boot/libc64/__osMalloc.c
+++ b/src/boot/libc64/__osMalloc.c
@@ -425,26 +425,18 @@ void __osFree(Arena* arena, void* ptr) {
node = (ArenaNode*)((uintptr_t)ptr - sizeof(ArenaNode));
if (!NODE_IS_VALID(node)) {
-#if MM_VERSION < N64_US
- // __osFree:Unauthorized release(%08x)\n
- (void)"__osFree:不正解放(%08x)\n";
-#endif
+ PRINTF(T("__osFree:不正解放(%08x)\n", "__osFree:Unauthorized release(%08x)\n"));
goto cleanup;
}
if (node->isFree) {
-#if MM_VERSION < N64_US
- // __osFree:Double release(%08x)\n
- (void)"__osFree:二重解放(%08x)\n";
-#endif
+ PRINTF(T("__osFree:二重解放(%08x)\n", "__osFree:Double release(%08x)\n"));
goto cleanup;
}
if (!CHECK_CORRECT_ARENA(node, arena)) {
-#if MM_VERSION < N64_US
- // __osFree:arena(%08x) and __osMallocのarena(%08x) do not match\n
- (void)"__osFree:arena(%08x)が__osMallocのarena(%08x)と一致しない\n";
-#endif
+ PRINTF(T("__osFree:arena(%08x)が__osMallocのarena(%08x)と一致しない\n",
+ "__osFree:arena(%08x) and __osMallocのarena(%08x) do not match\n"));
goto cleanup;
}
@@ -499,20 +491,18 @@ void __osFreeDebug(Arena* arena, void* ptr, const char* file, int line) {
node = (ArenaNode*)((uintptr_t)ptr - sizeof(ArenaNode));
if (!NODE_IS_VALID(node)) {
- // __osFree:Unauthorized release(%08x)\n
- (void)"__osFree:不正解放(%08x)\n";
+ PRINTF(T("__osFree:不正解放(%08x)\n", "__osFree:Unauthorized release(%08x)\n"));
goto cleanup;
}
if (node->isFree) {
- // __osFree:Double release(%08x)\n
- (void)"__osFree:二重解放(%08x)\n";
+ PRINTF(T("__osFree:二重解放(%08x)\n", "__osFree:Double release(%08x)\n"));
goto cleanup;
}
if (!CHECK_CORRECT_ARENA(node, arena)) {
- // __osFree:arena(%08x) and __osMallocのarena(%08x) do not match\n
- (void)"__osFree:arena(%08x)が__osMallocのarena(%08x)と一致しない\n";
+ PRINTF(T("__osFree:arena(%08x)が__osMallocのarena(%08x)と一致しない\n",
+ "__osFree:arena(%08x) and __osMallocのarena(%08x) do not match\n"));
goto cleanup;
}
@@ -689,21 +679,18 @@ s32 __osCheckArena(Arena* arena) {
ArenaImpl_Lock(arena);
- // "Checking the contents of the arena..."
- (void)"アリーナの内容をチェックしています... (%08x)\n";
+ (void)T("アリーナの内容をチェックしています... (%08x)\n", "Checking the contents of the arena... (%08x)\n");
for (iter = arena->head; iter != NULL; iter = iter->next) {
if (!NODE_IS_VALID(iter)) {
- // "Oops!!"
- (void)"おおっと!! (%08x %08x)\n";
+ (void)T("おおっと!! (%08x %08x)\n", "Oops!! (%08x %08x)\n");
err = 1;
break;
}
}
- // "The arena still looks good"
- (void)"アリーナはまだ、いけそうです\n";
+ (void)T("アリーナはまだ、いけそうです\n", "The arena still looks good\n");
ArenaImpl_Unlock(arena);
diff --git a/src/boot/libu64/stackcheck.c b/src/boot/libu64/stackcheck.c
index 46a609fcb..8b07188cd 100644
--- a/src/boot/libu64/stackcheck.c
+++ b/src/boot/libu64/stackcheck.c
@@ -1,9 +1,19 @@
#include "libu64/stackcheck.h"
+
+#include "macros.h"
#include "stdbool.h"
#include "stdint.h"
#include "versions.h"
+#if MM_VERSION < N64_US || DEBUG_FEATURES
+#define STACKCHECK_PRINTF osSyncPrintf
+#elif IDO_PRINTF_WORKAROUND
+#define STACKCHECK_PRINTF(args) (void)0
+#else
+#define STACKCHECK_PRINTF(format, ...) (void)0
+#endif
+
StackEntry* sStackInfoListStart = NULL;
StackEntry* sStackInfoListEnd = NULL;
@@ -22,10 +32,9 @@ void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 i
for (iter = sStackInfoListStart; iter != NULL; iter = iter->next) {
if (iter == entry) {
-#if MM_VERSION < N64_US
- // is already in the list
- osSyncPrintf("stackcheck_init: %08x は既にリスト中にある\n", entry);
-#endif
+ STACKCHECK_PRINTF(
+ T("stackcheck_init: %08x は既にリスト中にある\n", "stackcheck_init: %08x is already in the list\n"),
+ entry);
return;
}
}
@@ -74,10 +83,8 @@ void StackCheck_Cleanup(StackEntry* entry) {
}
if (inconsistency) {
-#if MM_VERSION < N64_US
- // List is inconsistent
- osSyncPrintf("stackcheck_cleanup: %08x リスト不整合です\n", entry);
-#endif
+ STACKCHECK_PRINTF(
+ T("stackcheck_cleanup: %08x リスト不整合です\n", "stackcheck_cleanup: %08x list inconsistency\n"), entry);
}
}
@@ -104,10 +111,10 @@ StackStatus StackCheck_GetState(StackEntry* entry) {
status = STACK_STATUS_OK;
}
-#if MM_VERSION < N64_US
- osSyncPrintf("head=%08x tail=%08x last=%08x used=%08x free=%08x [%s]\n", entry->head, entry->tail, last, used, free,
- (entry->name != NULL) ? entry->name : "(null)");
-#else
+ STACKCHECK_PRINTF("head=%08x tail=%08x last=%08x used=%08x free=%08x [%s]\n", entry->head, entry->tail, last, used,
+ free, (entry->name != NULL) ? entry->name : "(null)");
+
+#if MM_VERSION >= N64_US
(void)"(null)";
#endif
diff --git a/src/boot/yaz0.c b/src/boot/yaz0.c
index 70e42e77b..16d8d3245 100644
--- a/src/boot/yaz0.c
+++ b/src/boot/yaz0.c
@@ -1,3 +1,4 @@
+#include "macros.h"
#include "fault.h"
#include "libc64/sprintf.h"
#include "libc64/sleep.h"
@@ -55,8 +56,7 @@ void* Yaz0_NextDMA(u8* curSrcPos) {
} else {
oldPri = osGetThreadPri(NULL);
osSetThreadPri(NULL, OS_PRIORITY_APPMAX);
- // Compression/decompression error
- osSyncPrintf("圧縮展開異常\n");
+ osSyncPrintf(T("圧縮展開異常\n", "compression/decompression error\n"));
osSetThreadPri(NULL, oldPri);
}