1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-11 03:39:59 +00:00

Match `main.c` - OK (#1645)

* main.c OK

* removed comment

* better match

---------

Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
Yanis42 2024-01-28 21:46:08 +01:00 committed by GitHub
parent f893a83d15
commit 8a8b6cf90b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,12 +25,14 @@ AudioMgr gAudioMgr;
OSMesgQueue sSerialEventQueue; OSMesgQueue sSerialEventQueue;
OSMesg sSerialMsgBuf[1]; OSMesg sSerialMsgBuf[1];
#ifdef OOT_DEBUG
void Main_LogSystemHeap(void) { void Main_LogSystemHeap(void) {
PRINTF(VT_FGCOL(GREEN)); PRINTF(VT_FGCOL(GREEN));
// "System heap size% 08x (% dKB) Start address% 08x" // "System heap size% 08x (% dKB) Start address% 08x"
PRINTF("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, gSystemHeap); PRINTF("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, gSystemHeap);
PRINTF(VT_RST); PRINTF(VT_RST);
} }
#endif
void Main(void* arg) { void Main(void* arg) {
IrqMgrClient irqClient; IrqMgrClient irqClient;
@ -38,9 +40,6 @@ void Main(void* arg) {
OSMesg irqMgrMsgBuf[60]; OSMesg irqMgrMsgBuf[60];
uintptr_t systemHeapStart; uintptr_t systemHeapStart;
uintptr_t fb; uintptr_t fb;
void* debugHeapStart;
u32 debugHeapSize;
s16* msg;
PRINTF("mainproc 実行開始\n"); // "Start running" PRINTF("mainproc 実行開始\n"); // "Start running"
gScreenWidth = SCREEN_WIDTH; gScreenWidth = SCREEN_WIDTH;
@ -55,15 +54,25 @@ void Main(void* arg) {
// "System heap initalization" // "System heap initalization"
PRINTF("システムヒープ初期化 %08x-%08x %08x\n", systemHeapStart, fb, gSystemHeapSize); PRINTF("システムヒープ初期化 %08x-%08x %08x\n", systemHeapStart, fb, gSystemHeapSize);
SystemHeap_Init((void*)systemHeapStart, gSystemHeapSize); // initializes the system heap SystemHeap_Init((void*)systemHeapStart, gSystemHeapSize); // initializes the system heap
if (osMemSize >= 0x800000) {
debugHeapStart = SysCfb_GetFbEnd(); #ifdef OOT_DEBUG
debugHeapSize = PHYS_TO_K0(0x600000) - (uintptr_t)debugHeapStart; {
} else { void* debugHeapStart;
debugHeapSize = 0x400; u32 debugHeapSize;
debugHeapStart = SYSTEM_ARENA_MALLOC(debugHeapSize, "../main.c", 565);
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); #endif
DebugArena_Init(debugHeapStart, debugHeapSize);
Regs_Init(); Regs_Init();
R_ENABLE_ARENA_DBG = 0; R_ENABLE_ARENA_DBG = 0;
@ -71,7 +80,9 @@ void Main(void* arg) {
osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuf, ARRAY_COUNT(sSerialMsgBuf)); osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuf, ARRAY_COUNT(sSerialMsgBuf));
osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL); osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL);
#ifdef OOT_DEBUG
Main_LogSystemHeap(); Main_LogSystemHeap();
#endif
osCreateMesgQueue(&irqMgrMsgQueue, irqMgrMsgBuf, ARRAY_COUNT(irqMgrMsgBuf)); osCreateMesgQueue(&irqMgrMsgQueue, irqMgrMsgBuf, ARRAY_COUNT(irqMgrMsgBuf));
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, STACK_TOP(sIrqMgrStack), 0, 0x100, "irqmgr"); StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, STACK_TOP(sIrqMgrStack), 0, 0x100, "irqmgr");
@ -97,7 +108,8 @@ void Main(void* arg) {
osSetThreadPri(NULL, THREAD_PRI_MAIN); osSetThreadPri(NULL, THREAD_PRI_MAIN);
while (true) { while (true) {
msg = NULL; s16* msg = NULL;
osRecvMesg(&irqMgrMsgQueue, (OSMesg*)&msg, OS_MESG_BLOCK); osRecvMesg(&irqMgrMsgQueue, (OSMesg*)&msg, OS_MESG_BLOCK);
if (msg == NULL) { if (msg == NULL) {
break; break;