summaryrefslogtreecommitdiff
path: root/src/code/main.c
diff options
context:
space:
mode:
authorshawlucas <lgs84@cornell.edu>2020-03-23 14:41:50 -0700
committershawlucas <lgs84@cornell.edu>2020-03-23 14:41:50 -0700
commit09afb8d5528118e287d3b126dd9f8a4e803b5ea7 (patch)
tree9763c68b8511f23f7801939cac736bf96a502d54 /src/code/main.c
parent2d97f0dd58dc3b3aaecc99010716f2ce21b9eed5 (diff)
parent8e316933d596204aa42fcfc2587fee480b4e114e (diff)
Merge branch 'master' of https://github.com/zeldaret/oot
Diffstat (limited to 'src/code/main.c')
-rw-r--r--src/code/main.c62
1 files changed, 28 insertions, 34 deletions
diff --git a/src/code/main.c b/src/code/main.c
index 987654a41..5e2b9a89e 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -23,21 +23,19 @@ StackEntry sSchedStackInfo;
StackEntry sAudioStackInfo;
StackEntry sPadMgrStackInfo;
StackEntry sIrqMgrStackInfo;
-u8 gAudioMgr[0x298]; //type should be AudioMgr
+u8 gAudioMgr[0x298]; // type should be AudioMgr
OSMesgQueue sSiIntMsgQ;
OSMesg sSiIntMsgBuf[1];
-
-void Main_LogSystemHeap()
-{
+void Main_LogSystemHeap() {
osSyncPrintf(VT_FGCOL(GREEN));
- //System heap size% 08x (% dKB) Start address% 08x
- osSyncPrintf("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, gSystemHeap);
+ // System heap size% 08x (% dKB) Start address% 08x
+ osSyncPrintf("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024,
+ gSystemHeap);
osSyncPrintf(VT_RST);
}
-void Main(void* arg0)
-{
+void Main(void* arg0) {
IrqMgrClient irqClient;
OSMesgQueue irqMgrMsgQ;
OSMesg irqMgrMsgBuf[60];
@@ -45,9 +43,9 @@ void Main(void* arg0)
u32 fb;
s32 debugHeap;
s32 debugHeapSize;
- s16 *msg;
+ s16* msg;
- osSyncPrintf("mainproc 実行開始\n"); //Start running
+ osSyncPrintf("mainproc 実行開始\n"); // Start running
gScreenWidth = SCREEN_WIDTH;
gScreenHeight = SCREEN_HEIGHT;
gAppNmiBufferPtr = (PreNmiBuff*)osAppNmiBuffer;
@@ -57,15 +55,12 @@ void Main(void* arg0)
sysHeap = (u32)gSystemHeap;
fb = SysCfb_GetFbPtr(0);
gSystemHeapSize = (fb - sysHeap);
- osSyncPrintf("システムヒープ初期化 %08x-%08x %08x\n", sysHeap, fb, gSystemHeapSize); //System heap initalization
- SystemHeap_Init(sysHeap, gSystemHeapSize); //initializes the system heap
- if (osMemSize >= 0x800000U)
- {
+ osSyncPrintf("システムヒープ初期化 %08x-%08x %08x\n", sysHeap, fb, gSystemHeapSize); // System heap initalization
+ SystemHeap_Init(sysHeap, gSystemHeapSize); // initializes the system heap
+ if (osMemSize >= 0x800000U) {
debugHeap = SysCfb_GetFbEnd();
- debugHeapSize = (s32) (0x80600000 - debugHeap);
- }
- else
- {
+ debugHeapSize = (s32)(0x80600000 - debugHeap);
+ } else {
debugHeapSize = 0x400;
debugHeap = SystemArena_MallocDebug(debugHeapSize, "../main.c", 0x235);
}
@@ -81,43 +76,42 @@ void Main(void* arg0)
Main_LogSystemHeap();
osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, 0x3c);
- StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack+sizeof(sIrqMgrStack), 0, 0x100, "irqmgr");
+ StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 0x100, "irqmgr");
IrqMgr_Create(&gIrqMgr, &sGraphStackInfo, 0x11, 1);
- osSyncPrintf("タスクスケジューラの初期化\n"); //Initialize the task scheduler
- StackCheck_Init(&sSchedStackInfo, sSchedStack, sSchedStack+sizeof(sSchedStack), 0, 0x100, "sched");
+ osSyncPrintf("タスクスケジューラの初期化\n"); // Initialize the task scheduler
+ StackCheck_Init(&sSchedStackInfo, sSchedStack, sSchedStack + sizeof(sSchedStack), 0, 0x100, "sched");
func_800C9874(&gSchedContext, &sAudioStack, 0xf, D_80013960, 1, &gIrqMgr);
IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ);
- StackCheck_Init(&sAudioStackInfo, sAudioStack, sAudioStack+sizeof(sAudioStack), 0, 0x100, "audio");
- func_800C3FEC(&gAudioMgr, sAudioStack+sizeof(sAudioStack), 0xc, 0xa, &gSchedContext, &gIrqMgr);
+ StackCheck_Init(&sAudioStackInfo, sAudioStack, sAudioStack + sizeof(sAudioStack), 0, 0x100, "audio");
+ func_800C3FEC(&gAudioMgr, sAudioStack + sizeof(sAudioStack), 0xc, 0xa, &gSchedContext, &gIrqMgr);
- StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, sPadMgrStack+sizeof(sPadMgrStack), 0, 0x100, "padmgr");
+ StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, sPadMgrStack + sizeof(sPadMgrStack), 0, 0x100, "padmgr");
PadMgr_Init(&gPadMgr, &sSiIntMsgQ, &gIrqMgr, 7, 0xe, &sIrqMgrStack);
func_800C3FC4(&gAudioMgr);
- StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack+sizeof(sGraphStack), 0, 0x100, "graph");
- osCreateThread(&sGraphThread, 4, Graph_ThreadEntry, arg0, sGraphStack+sizeof(sGraphStack), 0xb);
+ StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack + sizeof(sGraphStack), 0, 0x100, "graph");
+ osCreateThread(&sGraphThread, 4, Graph_ThreadEntry, arg0, sGraphStack + sizeof(sGraphStack), 0xb);
osStartThread(&sGraphThread);
osSetThreadPri(0, 0xf);
- while (true)
- {
+ while (true) {
msg = NULL;
osRecvMesg(&irqMgrMsgQ, &msg, OS_MESG_BLOCK);
- if (msg == NULL)
+ if (msg == NULL) {
break;
- if (*msg == OS_SC_PRE_NMI_MSG)
- {
- osSyncPrintf("main.c: リセットされたみたいだよ\n"); //Looks like it's been reset
+ }
+ if (*msg == OS_SC_PRE_NMI_MSG) {
+ osSyncPrintf("main.c: リセットされたみたいだよ\n"); // Looks like it's been reset
PreNmiBuff_SetReset(gAppNmiBufferPtr);
}
}
- osSyncPrintf("mainproc 後始末\n"); //Cleanup
+ osSyncPrintf("mainproc 後始末\n"); // Cleanup
osDestroyThread(&sGraphThread);
func_800FBFD8();
- osSyncPrintf("mainproc 実行終了\n"); //End of execution
+ osSyncPrintf("mainproc 実行終了\n"); // End of execution
}