diff --git a/include/global.h b/include/global.h index d28c29f..5d83160 100644 --- a/include/global.h +++ b/include/global.h @@ -17,7 +17,7 @@ struct Input; #define Y65430UnkStruct_MAGIC 0x434D5052 // 'CMPR' -typedef void (*Y65430UnkFunc)(void*, UNK_TYPE, size_t); +typedef void (*Y65520UnkFunc)(void*, UNK_TYPE, size_t); typedef struct MallocRecord { /* 0x00 */ u32 allocP; @@ -53,10 +53,13 @@ Y511F0UnkStruct2* func_80050C8C(u16 arg0); Y65430UnkStruct* func_80064D1C(u32); void* func_80064DD0(u32 size); // malloc? void func_80064E84(Y65430UnkStruct*); + +// 65520 +s32 func_80064FEC(void); void func_80065528(void* arg0, void* arg1, s32 arg2); void func_80065728(MallocRecord*, s32, s32); void func_8006758C(void*, UNK_TYPE, size_t); -void func_800675D0(void*, UNK_TYPE, size_t, Y65430UnkFunc); +void func_800675D0(void*, UNK_TYPE, size_t, Y65520UnkFunc); // 6DF40 void func_8006F500(void); @@ -99,6 +102,8 @@ extern MallocRecord mallocRecord; extern UNK_TYPE D_800DA83C; extern Y511F0UnkStruct D_800DA840[]; extern MallocRecord D_800F8E58; +extern s32 D_800F93F0; +extern s32 D_800F93F4; extern u8 D_800FAAF8; extern u8 D_800FAB1C; extern u8 D_800FAB20; diff --git a/src/main/O2/65430.c b/src/main/O2/65430.c index 0c0f41f..875fd80 100644 --- a/src/main/O2/65430.c +++ b/src/main/O2/65430.c @@ -1,13 +1,5 @@ #include "global.h" -#include "PRinternal/viint.h" - -#include "fault.h" -#include "segment_symbols.h" -#include "stack.h" -#include "stackcheck.h" -#include "ys64thread.h" - void func_80064830(Y65430UnkStruct* arg0) { func_80064E84(arg0); } @@ -36,529 +28,3 @@ s32 func_800648DC(void** arg0, u16 arg1) { *arg0 = temp_v0; return 1; } - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064920.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064AA8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064AD4.s") - -void func_80064B38(void) { - func_80065728(&mallocRecord, 20, 0); -} - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064B64.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064BAC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064C14.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064C8C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064CB8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064D1C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064DD0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064E84.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064F38.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064F94.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80064FEC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006502C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065060.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006509C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800650B0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800650D8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006515C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800651B0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065200.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065284.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006528C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800652B4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065308.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065368.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065388.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800653CC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800653D8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065408.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065414.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065474.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065490.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800654B4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065528.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800655F4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800656BC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065728.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800657CC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006586C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800658D8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006593C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065954.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065984.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800659EC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065A54.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065ABC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065AEC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065B50.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065BC8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065C44.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065CD4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065DE4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065E4C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065F30.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80065FD0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006607C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066190.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800662B8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800663F4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066428.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066448.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066468.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800664B0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006671C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800667D4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066894.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006692C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800669C0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066A4C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066AD8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066D08.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066DE4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066E88.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066F2C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80066FA0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067114.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067170.s") - -void Idle_InitVideo(void); -void Main_ThreadEntry(void* arg); - -extern OSThread sMainThread; -extern STACK(sMainStack, 0x2700); -extern StackEntry sMainStackInfo; - -extern OSMesgQueue sPiMgrCmdQueue; -extern OSMesg sPiMgrCmdBuff[8]; - -#ifdef NON_MATCHING -// Getting extra nops with the infinite loop, file split? -void Idle_ThreadEntry(void* arg) { - osCreateViManager(OS_PRIORITY_VIMGR); - Idle_InitVideo(); - osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_DITHER_OFF | OS_VI_GAMMA_OFF); - osViBlack(true); - osCreatePiManager(OS_PRIORITY_PIMGR, &sPiMgrCmdQueue, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff)); - StackCheck_Init(&sMainStackInfo, sMainStack, STACK_TOP(sMainStack), 0, 0x1000, "main"); - osCreateThread(&sMainThread, Y_THREAD_ID_MAIN, Main_ThreadEntry, arg, STACK_TOP(sMainStack), Y_PRIORITY_MAIN); - D_80108624 = IO_READ(SP_IMEM_START); - D_80108628 = IO_READ(SP_DMEM_START); - func_8006F500(); - osStartThread(&sMainThread); - osSetThreadPri(NULL, OS_PRIORITY_IDLE); - - for (;;) {} -} -#else -void Idle_ThreadEntry(void* arg); -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/Idle_ThreadEntry.s") -#endif - -void Idle_InitVideo(void) { - switch (osTvType) { - case OS_TV_TYPE_PAL: - osViSetMode(&osViModeTable[OS_VI_PAL_LAN1]); - break; - - case OS_TV_TYPE_NTSC: - osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]); - break; - - case OS_TV_TYPE_MPAL: - osViSetMode(&osViModeTable[OS_VI_MPAL_LAN1]); - break; - } -} - -void bootclear(void) { - bzero(SEGMENT_VRAM_END(main), osMemSize - K0_TO_PHYS(SEGMENT_VRAM_END(main))); -} - -extern STACK(sBootStack, 0x2000); -extern StackEntry sBootStackInfo; - -extern OSThread sIdleThread; -extern STACK(sIdleStack, 0x200); -extern StackEntry sIdleStackInfo; - -void bootproc(void) { - StackCheck_Init(&sBootStackInfo, sBootStack, STACK_TOP(sBootStack), 0, -1, "boot"); - osInitialize(); - bootclear(); - StackCheck_Init(&sIdleStackInfo, sIdleStack, STACK_TOP(sIdleStack), 0, 0x100, "idle"); - osCreateThread(&sIdleThread, Y_THREAD_ID_IDLE, Idle_ThreadEntry, NULL, STACK_TOP(sIdleStack), Y_PRIORITY_IDLE); - osStartThread(&sIdleThread); -} - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067508.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067530.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006758C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800675D0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800675F0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006767C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800676F8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800677CC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800677F8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067818.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067838.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067878.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800678B0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800678D0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800678F0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067930.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067970.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067990.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800679B0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800679D0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800679F0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067A10.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067A30.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067A50.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067A78.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067AAC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067ACC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067AF4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067B1C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067B3C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067B74.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067BBC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067BF8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067C30.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067C68.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067CAC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067CE4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067D28.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067D38.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067D48.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067D5C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067D94.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067DD8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067E24.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067E68.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067E78.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067E98.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067EB8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067ED8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067EF8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067F18.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067F38.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067F58.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067F78.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80067FF4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006806C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068190.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006820C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006823C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800682D4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068320.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068340.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800683A4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068418.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068438.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068470.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800684E8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068560.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800685AC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800685F0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006863C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006872C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800687B8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068890.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800688CC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006899C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800689E8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800689F0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068AB0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068B0C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068B2C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068BC0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068C00.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068C74.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068CD4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068CF8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068D24.s") - -void func_80068D8C(void) { -} - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068D94.s") - -void func_80068E24(void); -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068E24.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068ED4.s") - -void func_80068F10(void); -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80068F10.s") - -void Main_ThreadEntry(UNUSED void* arg) { - Fault_Init(); - func_80068F10(); - func_80068E24(); -} - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80069030.s") - -void func_8006915C(void) { - D_800FAAF8 = 0; - D_800FAB1C = 0; - D_800FAB20 = 1; - func_800748B0(&D_8010DF40); -} - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006919C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006920C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800692D4.s") - -void func_800694BC(s32 arg0); -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800694BC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80069508.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006958C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80069610.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80069644.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80069684.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800696D4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80069728.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006976C.s") - -s32 func_800697F0(void); -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800697F0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_8006988C.s") - -void func_80069900(void); -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_80069900.s") - -void func_80069C10(void); - -void func_80069964(void) { - func_80069C10(); - if (func_800697F0() != 0) { - func_80065728(&D_800F8E58, 0x400, 0); - func_80069900(); - } - func_800694BC(D_800F8E58.allocP >> 0x1E); -} - -u16 func_800699BC(EepBuffer* arg0); -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800699BC.s") - -extern EepMgr gEepMgr; -extern EepBuffer sEepBuff[2]; -extern STACK(sEepStack, 0x300); -extern EepBuffer sEepCache[2]; -extern StackEntry sEepStackInfo; - -s32 func_80069A80(void* arg0) { - func_80065528(&sEepBuff[0].data, arg0, ARRAY_COUNT(sEepBuff[0].data)); - sEepBuff[0].unk3FA = func_800699BC(sEepBuff); - sEepBuff[0].magic = EEPBUFFER_MAGIC; - sEepBuff[1] = sEepBuff[0]; - - eepmgr_SendWrite(&gEepMgr, sEepBuff); - if (func_8007D508(&gEepMgr) != 0) { - return 1; - } - - return 0; -} - -s32 func_80069B34(UNK_PTR arg0) { - eepmgr_SendRead(&gEepMgr, sEepBuff); - - if (func_8007D508(&gEepMgr) != 0) { - return 1; - } - - if ((sEepBuff[0].unk3FA == func_800699BC(&sEepBuff[0])) && (sEepBuff[0].magic == EEPBUFFER_MAGIC)) { - func_80065528(arg0, &sEepBuff[0].data, ARRAY_COUNT(sEepBuff[0].data)); - return 0; - } - - if ((sEepBuff[1].unk3FA == func_800699BC(&sEepBuff[1])) && (sEepBuff[1].magic == EEPBUFFER_MAGIC)) { - func_80065528(arg0, &sEepBuff[1].data, ARRAY_COUNT(sEepBuff[1].data)); - return 0; - } - - return 1; -} - -void func_80069C10(void) { - StackCheck_Init(&sEepStackInfo, sEepStack, STACK_TOP(sEepStack), 0, 0x100, "eepmgr"); - eepmgr_Create(&gEepMgr, &D_8010DF40, EEPROM_TYPE_16K, sEepCache, Y_THREAD_ID_EEPMGR, Y_PRIORITY_EEPMGR, - STACK_TOP(sEepStack)); -} diff --git a/src/main/O2/65520.c b/src/main/O2/65520.c new file mode 100644 index 0000000..1fdda93 --- /dev/null +++ b/src/main/O2/65520.c @@ -0,0 +1,531 @@ +#include "global.h" + +#include "PRinternal/viint.h" + +#include "fault.h" +#include "segment_symbols.h" +#include "stack.h" +#include "stackcheck.h" +#include "ys64thread.h" + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064920.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064AA8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064AD4.s") + +void func_80064B38(void) { + func_80065728(&mallocRecord, 20, 0); +} + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064B64.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064BAC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064C14.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064C8C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064CB8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064D1C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064DD0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064E84.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064F38.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064F94.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80064FEC.s") + +s32 func_8006502C(void) { + return (D_800F93F4 - D_800F93F0) - func_80064FEC(); +} + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065060.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006509C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800650B0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800650D8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006515C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800651B0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065200.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065284.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006528C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800652B4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065308.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065368.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065388.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800653CC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800653D8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065408.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065414.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065474.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065490.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800654B4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065528.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800655F4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800656BC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065728.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800657CC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006586C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800658D8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006593C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065954.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065984.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800659EC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065A54.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065ABC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065AEC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065B50.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065BC8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065C44.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065CD4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065DE4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065E4C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065F30.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80065FD0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006607C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066190.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800662B8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800663F4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066428.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066448.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066468.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800664B0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006671C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800667D4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066894.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006692C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800669C0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066A4C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066AD8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066D08.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066DE4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066E88.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066F2C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80066FA0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067114.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067170.s") + +void Idle_InitVideo(void); +void Main_ThreadEntry(void* arg); + +extern OSThread sMainThread; +extern STACK(sMainStack, 0x2700); +extern StackEntry sMainStackInfo; + +extern OSMesgQueue sPiMgrCmdQueue; +extern OSMesg sPiMgrCmdBuff[8]; + +void Idle_ThreadEntry(void* arg) { + osCreateViManager(OS_PRIORITY_VIMGR); + Idle_InitVideo(); + osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_DITHER_OFF | OS_VI_GAMMA_OFF); + osViBlack(true); + osCreatePiManager(OS_PRIORITY_PIMGR, &sPiMgrCmdQueue, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff)); + StackCheck_Init(&sMainStackInfo, sMainStack, STACK_TOP(sMainStack), 0, 0x1000, "main"); + osCreateThread(&sMainThread, Y_THREAD_ID_MAIN, Main_ThreadEntry, arg, STACK_TOP(sMainStack), Y_PRIORITY_MAIN); + D_80108624 = IO_READ(SP_IMEM_START); + D_80108628 = IO_READ(SP_DMEM_START); + func_8006F500(); + osStartThread(&sMainThread); + osSetThreadPri(NULL, OS_PRIORITY_IDLE); + + for (;;) {} +} + +void Idle_InitVideo(void) { + switch (osTvType) { + case OS_TV_TYPE_PAL: + osViSetMode(&osViModeTable[OS_VI_PAL_LAN1]); + break; + + case OS_TV_TYPE_NTSC: + osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]); + break; + + case OS_TV_TYPE_MPAL: + osViSetMode(&osViModeTable[OS_VI_MPAL_LAN1]); + break; + } +} + +void bootclear(void) { + bzero(SEGMENT_VRAM_END(main), osMemSize - K0_TO_PHYS(SEGMENT_VRAM_END(main))); +} + +extern STACK(sBootStack, 0x2000); +extern StackEntry sBootStackInfo; + +extern OSThread sIdleThread; +extern STACK(sIdleStack, 0x200); +extern StackEntry sIdleStackInfo; + +void bootproc(void) { + StackCheck_Init(&sBootStackInfo, sBootStack, STACK_TOP(sBootStack), 0, -1, "boot"); + osInitialize(); + bootclear(); + StackCheck_Init(&sIdleStackInfo, sIdleStack, STACK_TOP(sIdleStack), 0, 0x100, "idle"); + osCreateThread(&sIdleThread, Y_THREAD_ID_IDLE, Idle_ThreadEntry, NULL, STACK_TOP(sIdleStack), Y_PRIORITY_IDLE); + osStartThread(&sIdleThread); +} + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067508.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067530.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006758C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800675D0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800675F0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006767C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800676F8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800677CC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800677F8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067818.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067838.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067878.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800678B0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800678D0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800678F0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067930.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067970.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067990.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800679B0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800679D0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800679F0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067A10.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067A30.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067A50.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067A78.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067AAC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067ACC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067AF4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067B1C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067B3C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067B74.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067BBC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067BF8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067C30.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067C68.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067CAC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067CE4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067D28.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067D38.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067D48.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067D5C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067D94.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067DD8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067E24.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067E68.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067E78.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067E98.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067EB8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067ED8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067EF8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067F18.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067F38.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067F58.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067F78.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80067FF4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006806C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068190.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006820C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006823C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800682D4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068320.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068340.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800683A4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068418.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068438.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068470.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800684E8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068560.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800685AC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800685F0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006863C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006872C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800687B8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068890.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800688CC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006899C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800689E8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800689F0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068AB0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068B0C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068B2C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068BC0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068C00.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068C74.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068CD4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068CF8.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068D24.s") + +void func_80068D8C(void) { +} + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068D94.s") + +void func_80068E24(void); +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068E24.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068ED4.s") + +void func_80068F10(void); +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80068F10.s") + +void Main_ThreadEntry(UNUSED void* arg) { + Fault_Init(); + func_80068F10(); + func_80068E24(); +} + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80069030.s") + +void func_8006915C(void) { + D_800FAAF8 = 0; + D_800FAB1C = 0; + D_800FAB20 = 1; + func_800748B0(&D_8010DF40); +} + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006919C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006920C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800692D4.s") + +void func_800694BC(s32 arg0); +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800694BC.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80069508.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006958C.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80069610.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80069644.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80069684.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800696D4.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80069728.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006976C.s") + +s32 func_800697F0(void); +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800697F0.s") + +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_8006988C.s") + +void func_80069900(void); +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_80069900.s") + +void func_80069C10(void); + +void func_80069964(void) { + func_80069C10(); + if (func_800697F0() != 0) { + func_80065728(&D_800F8E58, 0x400, 0); + func_80069900(); + } + func_800694BC(D_800F8E58.allocP >> 0x1E); +} + +u16 func_800699BC(EepBuffer* arg0); +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65520/func_800699BC.s") + +extern EepMgr gEepMgr; +extern EepBuffer sEepBuff[2]; +extern STACK(sEepStack, 0x300); +extern EepBuffer sEepCache[2]; +extern StackEntry sEepStackInfo; + +s32 func_80069A80(void* arg0) { + func_80065528(&sEepBuff[0].data, arg0, ARRAY_COUNT(sEepBuff[0].data)); + sEepBuff[0].unk3FA = func_800699BC(sEepBuff); + sEepBuff[0].magic = EEPBUFFER_MAGIC; + sEepBuff[1] = sEepBuff[0]; + + eepmgr_SendWrite(&gEepMgr, sEepBuff); + if (func_8007D508(&gEepMgr) != 0) { + return 1; + } + + return 0; +} + +s32 func_80069B34(UNK_PTR arg0) { + eepmgr_SendRead(&gEepMgr, sEepBuff); + + if (func_8007D508(&gEepMgr) != 0) { + return 1; + } + + if ((sEepBuff[0].unk3FA == func_800699BC(&sEepBuff[0])) && (sEepBuff[0].magic == EEPBUFFER_MAGIC)) { + func_80065528(arg0, &sEepBuff[0].data, ARRAY_COUNT(sEepBuff[0].data)); + return 0; + } + + if ((sEepBuff[1].unk3FA == func_800699BC(&sEepBuff[1])) && (sEepBuff[1].magic == EEPBUFFER_MAGIC)) { + func_80065528(arg0, &sEepBuff[1].data, ARRAY_COUNT(sEepBuff[1].data)); + return 0; + } + + return 1; +} + +void func_80069C10(void) { + StackCheck_Init(&sEepStackInfo, sEepStack, STACK_TOP(sEepStack), 0, 0x100, "eepmgr"); + eepmgr_Create(&gEepMgr, &D_8010DF40, EEPROM_TYPE_16K, sEepCache, Y_THREAD_ID_EEPMGR, Y_PRIORITY_EEPMGR, + STACK_TOP(sEepStack)); +} diff --git a/yamls/us/main.yaml b/yamls/us/main.yaml index 6f1bbcb..b8ee92d 100644 --- a/yamls/us/main.yaml +++ b/yamls/us/main.yaml @@ -51,6 +51,7 @@ - [0x63870, asm] - [0x63A30, asm] - [0x65430, c, O2/65430] + - [0x65520, c, O2/65520] - [0x6A8A0, asm, unitManager] - [0x6CB50, asm] - [0x6CB60, asm] @@ -324,7 +325,7 @@ - [0xB18A0, rodata, nxgotoManager] - [0xB1900, rodata] # 5E4C0 - [0xB1960, rodata] # 5E4C0 - - [0xB19A0, .rodata, O2/65430] # Probably main, but also has utility.c in rodata? + - [0xB19A0, .rodata, O2/65520] # Probably main, but also has utility.c in rodata? - [0xB1B20, rodata, unitManager] - [0xB1C60, rodata, 6CB80] - [0xB1C90, rodata] # 6DF40