diff options
| author | Yanis42 <35189056+Yanis42@users.noreply.github.com> | 2024-01-28 21:46:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-28 15:46:08 -0500 |
| commit | 8a8b6cf90b1b97087f3d40e99eb01fe9af1ae2a5 (patch) | |
| tree | 94c63607ed1782244276038f804cf366ed3bfada /src | |
| parent | f893a83d15a45ab57ba514e7729e19dac93f6437 (diff) | |
Match ``main.c`` - OK (#1645)
* main.c OK
* removed comment
* better match
---------
Co-authored-by: fig02 <fig02srl@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/code/main.c | 36 |
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; |
