summaryrefslogtreecommitdiff
path: root/src/code/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/code/main.c')
-rw-r--r--src/code/main.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/code/main.c b/src/code/main.c
index 3ae05797b..15a17084f 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -25,12 +25,14 @@ AudioMgr gAudioMgr;
OSMesgQueue sSerialEventQueue;
OSMesg sSerialMsgBuf[1];
+#ifdef OOT_DEBUG
void Main_LogSystemHeap(void) {
PRINTF(VT_FGCOL(GREEN));
// "System heap size% 08x (% dKB) Start address% 08x"
PRINTF("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, gSystemHeap);
PRINTF(VT_RST);
}
+#endif
void Main(void* arg) {
IrqMgrClient irqClient;
@@ -38,9 +40,6 @@ void Main(void* arg) {
OSMesg irqMgrMsgBuf[60];
uintptr_t systemHeapStart;
uintptr_t fb;
- void* debugHeapStart;
- u32 debugHeapSize;
- s16* msg;
PRINTF("mainproc 実行開始\n"); // "Start running"
gScreenWidth = SCREEN_WIDTH;
@@ -55,15 +54,25 @@ void Main(void* arg) {
// "System heap initalization"
PRINTF("システムヒープ初期化 %08x-%08x %08x\n", systemHeapStart, fb, gSystemHeapSize);
SystemHeap_Init((void*)systemHeapStart, gSystemHeapSize); // initializes the system heap
- if (osMemSize >= 0x800000) {
- debugHeapStart = SysCfb_GetFbEnd();
- debugHeapSize = PHYS_TO_K0(0x600000) - (uintptr_t)debugHeapStart;
- } else {
- debugHeapSize = 0x400;
- debugHeapStart = SYSTEM_ARENA_MALLOC(debugHeapSize, "../main.c", 565);
+
+#ifdef OOT_DEBUG
+ {
+ void* debugHeapStart;
+ u32 debugHeapSize;
+
+ if (osMemSize >= 0x800000) {
+ debugHeapStart = SysCfb_GetFbEnd();
+ debugHeapSize = PHYS_TO_K0(0x600000) - (uintptr_t)debugHeapStart;
+ } else {
+ debugHeapSize = 0x400;
+ debugHeapStart = SYSTEM_ARENA_MALLOC(debugHeapSize, "../main.c", 565);
+ }
+
+ PRINTF("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize);
+ DebugArena_Init(debugHeapStart, debugHeapSize);
}
- PRINTF("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize);
- DebugArena_Init(debugHeapStart, debugHeapSize);
+#endif
+
Regs_Init();
R_ENABLE_ARENA_DBG = 0;
@@ -71,7 +80,9 @@ void Main(void* arg) {
osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuf, ARRAY_COUNT(sSerialMsgBuf));
osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL);
+#ifdef OOT_DEBUG
Main_LogSystemHeap();
+#endif
osCreateMesgQueue(&irqMgrMsgQueue, irqMgrMsgBuf, ARRAY_COUNT(irqMgrMsgBuf));
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, STACK_TOP(sIrqMgrStack), 0, 0x100, "irqmgr");
@@ -97,7 +108,8 @@ void Main(void* arg) {
osSetThreadPri(NULL, THREAD_PRI_MAIN);
while (true) {
- msg = NULL;
+ s16* msg = NULL;
+
osRecvMesg(&irqMgrMsgQueue, (OSMesg*)&msg, OS_MESG_BLOCK);
if (msg == NULL) {
break;