diff --git a/splat.yaml b/splat.yaml index 4179540..1a9e88f 100644 --- a/splat.yaml +++ b/splat.yaml @@ -98,7 +98,7 @@ segments: - [0x189D0, asm] - [0x18F30, asm] - [0x18F80, asm] - - [0x19050, asm, "libultra/sched/sched"] + - [0x19050, asm] - [0x19DD0, c] - [0x19E10, asm] - [0x19E30, asm, "dma_load_loop"] @@ -136,17 +136,19 @@ segments: - [0x1C760, asm, "libultra/io/pidma"] - [0x1C810, asm] - [0x1C950, asm] - - [0x1C9F0, asm] - - [0x1D220, asm] - - [0x1DD30, asm] - - [0x1DE40, asm] - - [0x1EB10, asm] - - [0x1EF30, asm] + - [0x1C9F0, asm, "libultra/audio/drvrNew"] + - [0x1D220, asm, "libultra/audio/load"] + - [0x1DD30, asm, "libultra/audio/auxbus"] + - [0x1DE40, asm, "libultra/audio/env"] + - [0x1EB10, asm, "libultra/audio/mainbus"] + - [0x1EC80, asm, "libultra/audio/resample"] + - [0x1EF30, asm, "libultra/audio/reverb"] - [0x1FAD0, asm, "libultra/audio/save"] + - [0x1FBA0, asm, "libultra/audio/sl"] - [0x1FC50, asm] - - [0x1FC90, asm] - - [0x1FCE0, asm] - - [0x1FD20, asm] + - [0x1FC90, asm, "libultra/audio/heapalloc"] + - [0x1FCE0, asm, "libultra/audio/copy"] + - [0x1FD20, asm, "libultra/audio/synthesizer"] - [0x20360, asm, "libultra/audio/syndelete"] - [0x20370, asm, "libultra/audio/synallocfx"] - [0x20410, asm, "libultra/os/invaldcache"] @@ -167,7 +169,7 @@ segments: - [0x22E90, asm, "libultra/gu/rotateRPY"] - [0x231B0, asm, "libultra/gu/sinf"] - [0x23780, asm, "libc/bzero"] - - [0x238B0, asm] + - [0x238B0, asm, "libc/sprintf"] - [0x23940, asm] - [0x23970, asm, "libultra/os/createmesgqueue"] - [0x239A0, asm, "libultra/os/jammesg"] @@ -175,27 +177,26 @@ segments: - [0x23C10, asm, "libultra/os/sendmesg"] - [0x23DF0, asm, "libultra/io/spgetstat"] - [0x23E00, asm, "libultra/io/sptask"] - - [0x23E00, asm] - - [0x24040, asm] - - [0x24060, asm] - - [0x240B0, asm] + - [0x24040, asm, "libultra/io/sptaskyield"] + - [0x24060, asm, "libultra/io/sptaskyielded"] + - [0x240B0, asm, "libultra/sched/sched"] - [0x24AC0, asm, "libultra/io/sirawdma"] - [0x24B70, asm, "libultra/io/siacs"] - [0x24C60, asm, "libultra/os/createthread"] - [0x24D50, asm, "libultra/os/setthreadpri"] - [0x24E20, asm, "libultra/os/startthread"] - - [0x24F40, asm] - - [0x25000, asm] + - [0x24F40, asm, "libultra/os/stopthread"] + - [0x25000, asm, "libultra/os/thread"] - [0x25040, asm, "libultra/os/yieldthread"] - [0x25090, asm, "libultra/os/gettime"] - - [0x25120, asm] + - [0x25120, asm, "libultra/os/settime"] - [0x25140, asm, "libultra/os/settimer"] - - [0x251E0, asm] + - [0x251E0, asm, "libultra/os/timerintr"] - [0x254E0, asm, "libultra/os/probetlb"] - [0x255A0, asm] - [0x255E0, asm] - [0x25620, asm, "libultra/io/vimgr"] - - [0x25960, asm] + - [0x25960, asm, "libultra/io/visetevent"] - [0x259C0, asm] - [0x25A10, asm] - [0x25B80, asm] @@ -207,9 +208,9 @@ segments: - [0x265E0, asm] - [0x26BC0, asm] - [0x26D80, asm] - - [0x26E90, c] + - [0x26E90, asm, "libultra/io/pfsinitpak"] - [0x27260, asm] - - [0x272C0, asm] + - [0x272C0, asm, "libultra/io/pfsgetstatus"] - [0x274D0, asm] - [0x27540, asm, "libultra/io/contpfs"] - [0x27FD0, asm, "libultra/io/contramread"] @@ -238,12 +239,16 @@ segments: - [0x29E50, asm] - [0x29FC0, asm] - [0x29FE0, asm] - - [0x2AAD0, hasm, "libreultra/os/getcause"] - - [0x2AAE0, hasm, "libreultra/os/getcount"] - - [0x2AAF0, hasm, "libreultra/os/getsr"] - - [0x2AB00, hasm, "libreultra/os/setcompare"] - - [0x2AB10, hasm, "libreultra/os/setfpccsr"] - - [0x2AB60, asm] + - [0x2AAD0, hasm, "libultra/os/getcause"] + - [0x2AAE0, hasm, "libultra/os/getcount"] + - [0x2AAF0, hasm, "libultra/os/getsr"] + - [0x2AB00, hasm, "libultra/os/setcompare"] + - [0x2AB10, hasm, "libultra/os/setfpccsr"] + - [0x2AB20, asm, "libultra/os/setsr"] + - [0x2AB30, asm] + - [0x2AB40, asm, "libultra/io/sp"] + - [0x2AB60, asm, "libultra/io/spsetstat"] + - [0x2AB70, asm, "libultra/io/spsetpc"] - [0x2AC30, asm] - [0x2AC80, asm] - [0x2ACD0, asm] @@ -252,7 +257,8 @@ segments: - [0x2AF00, hasm, "libultra/os/unmaptlball"] - [0x2AF50, asm, "libultra/io/vi"] - [0x2B060, asm] - - [0x2B070, asm] + - [0x2B070, asm, "libultra/io/pfschecker"] + - [0x2B790, asm] - [0x2BA70, asm] - [0x2C750, asm] - [0x2C770, asm] @@ -322,32 +328,43 @@ segments: dir: overlays/overlay0 start: 0x3F1B0 vram: 0x800E9C20 + bss_size: 0x7F690 subsegments: - [0x3F1B0, c] - [0x3FE70, asm] - [0x40640, asm] - - [0x40E80, bin] - # - type: code - # dir: overlays/overlay1 - # start: 0x40E80 - # vram: 0x8016AF80 - # subsegments: - # - [0x40E80, asm] - # - [0x420D0, asm] - # - [0x42C30, asm] - # - [0x42C90, asm] - # - [0x43100, asm] - # - [0x45CB0, asm] - # - [0x46090, asm] - # - [0x49510, asm] - # - [0x495E0, asm] - # - [0x49820, asm] - # - [0x49A30, asm] - # - [0x4D5C0, asm] - # - [0x4D938, asm] + - { start: 0x40E80, type: bss, vram: 0x800EB8F0 } + + - type: code + dir: overlays/overlay1 + start: 0x40E80 + vram: 0x8016AF80 + bss_size: 0x6C60 + subsegments: + - [0x40E80, asm] + - [0x420D0, asm] + - [0x42C30, asm] + - [0x42C90, asm] + - [0x43100, asm] + - [0x45CB0, asm] + - [0x46090, asm] + - [0x49510, asm] + - [0x495E0, asm] + - [0x49820, asm] + - [0x49A30, asm] + - [0x4D5C0, asm] + - [0x4EF10, asm] + - [0x514B0, asm] + - [0x5AC70, asm] + - [0x5AFF0, asm] + - [0x5C060, asm] + - [0x5C1D0, asm] + - [0x5C210, asm] + + - { start: 0x66E10, type: bss, vram: 0x80190F10 } - # - [0x66E10, bin] + - [0x66E10, bin] # - type: code # dir: overlays/unknown @@ -391,9 +408,11 @@ segments: # dir: overlays/overlay4 # start: 0x23A3A0 # vram: 0x801D0840 + # bss_size: 0x0 # subsegments: # - [0x23A3A0, asm] - # - [0x23B220, asm] + + # - { start: 0x23B220, type: bss, vram: 0x801D16C0 } # - type: code @@ -411,18 +430,15 @@ segments: - [0x2447A0, bin] - - type: code - dir: overlays/overlay99 - name: overlay99 - start: 0x002AE3C0 - vram: 0x8031DFC0 - follows_vram: main - exclusive_ram_id: ovl_99 - subsegments: - - [0x2AE3C0, c] - - [0x2B5230, asm] - - [0x2B6F40, asm] - - [0x2B8610, asm] + # - type: code + # dir: overlays/overlay99 + # start: 0x002AE3C0 + # vram: 0x8031DFC0 + # subsegments: + # - [0x2AE3C0, c] + # - [0x2B5230, asm] + # - [0x2B6F40, asm] + # - [0x2B8610, asm] - [0x2B89C0, bin] diff --git a/src/1A050.c b/src/1A050.c index 8665533..db61c1b 100644 --- a/src/1A050.c +++ b/src/1A050.c @@ -3,13 +3,19 @@ #include void romCopy(const void* src, const void* dst, const s32 len); +s32 func_80089CF8(s16 arg0, s32 arg1); OSPiHandle* CART_HANDLE; OSMesgQueue MQ_800BE030; OSMesg OSMESG_800BE048[0x32]; +OSThread THREAD_CONTROLLER; +extern s32 D_800C4BD8; + +void func_80089C50(void) { + D_800C4BD8 = 0x80; +} -INCLUDE_ASM(const s32, "1A050", func_80089C50); INCLUDE_ASM(const s32, "1A050", __init_controllers); @@ -25,11 +31,41 @@ INCLUDE_ASM(const s32, "1A050", __init_controllers); // return sp28; // } -INCLUDE_ASM(const s32, "1A050", func_80089CF8); +// INCLUDE_ASM(const s32, "1A050", func_80089CF8); +extern OSMesgQueue MQ_800E7988; -INCLUDE_ASM(const s32, "1A050", func_80089D5C); +s32 func_80089CF8(s16 arg0, s32 arg1) { + typedef struct { + /* 0x0 */ s16 unk0; + /* 0x4 */ OSMesgQueue* msgQueue; + /* 0x8 */ s32 unk8; + /* 0xC */ s32 unkC; + } Message; // size 0x10 + + OSMesgQueue sp10; + Message msg; + OSMesg sp38; // maybe this is part of the struct? + + msg.unk0 = arg0; + msg.unkC = arg1; + msg.msgQueue = &sp10; + + osCreateMesgQueue(&sp10, &sp38, 1 /* size */); + osSendMesg(&MQ_800E7988, &msg, OS_MESG_BLOCK); + osRecvMesg(&sp10, NULL, OS_MESG_BLOCK); + + return msg.unk8; +} + +void func_80089D5C(void) { + func_80089CF8(0x7F00, 0); +} + + +void __start_controller_thread(void) { + osStartThread(&THREAD_CONTROLLER); +} -INCLUDE_ASM(const s32, "1A050", __start_controller_thread); INCLUDE_ASM(const s32, "1A050", __controller_thread_80089D9C); diff --git a/src/26E90.c b/src/26E90.c index cae449e..eb80a0a 100644 --- a/src/26E90.c +++ b/src/26E90.c @@ -2,6 +2,6 @@ INCLUDE_ASM(const s32, "26E90", func_80096A90); -INCLUDE_ASM(const s32, "26E90", func_80096B90); +INCLUDE_ASM(const s32, "26E90", osPfsInitPak); INCLUDE_ASM(const s32, "26E90", func_80096D88); diff --git a/src/overlays/overlay0/3F1B0.c b/src/overlays/overlay0/3F1B0.c index eee87d3..dd1e36d 100644 --- a/src/overlays/overlay0/3F1B0.c +++ b/src/overlays/overlay0/3F1B0.c @@ -2,6 +2,8 @@ #include +void func_800EA488(void*); + INCLUDE_ASM(const s32, "overlays/overlay0/3F1B0", func_800E9C20); // extern void romCopy(const void* src, const void* dst, const s32 len); @@ -44,13 +46,103 @@ INCLUDE_ASM(const s32, "overlays/overlay0/3F1B0", func_800EA0E4); INCLUDE_ASM(const s32, "overlays/overlay0/3F1B0", func_800EA1C8); -INCLUDE_ASM(const s32, "overlays/overlay0/3F1B0", func_800EA3BC); +typedef struct { + /* 0x00 */ s32 field_0x0; + /* 0x04 */ s32 field_0x4; + /* 0x08 */ s32 field_0x8; + /* 0x0c */ s32 field_0xc; + /* 0x10 */ s32 field_0x10; + /* 0x14 */ s32 field_0x14; + /* 0x18 */ s32 field_0x18; + /* 0x1C */ s32 field_0x1c; + /* 0x20 */ s32 field_0x20; + /* 0x24 */ unsigned long handle; + /* 0x28 */ s32 field_0x28; + /* 0x2C */ s32 field_0x2c; + /* 0x30 */ s32 field_0x30; + /* 0x34 */ s32 field_0x34; + /* 0x38 */ s32 field_0x38; + /* 0x3C */ s32 field_0x3c; + /* 0x40 */ s32 field_0x40; + /* 0x44 */ s32 field_0x44; + /* 0x48 */ u8* addr; +} Arg; + +void func_800EA3BC(Arg* arg0) { + s32 temp_a1; + s32 temp_v0; + s32 temp_v1; + + temp_v0 = arg0->field_0x4; + temp_v1 = arg0->field_0x8; + temp_a1 = arg0->field_0xc; + + arg0->field_0x4 = 0; + arg0->field_0x8 = 0; + arg0->field_0xc = 0; + + arg0->field_0x2c = temp_v0; + arg0->field_0x30 = temp_v1; + arg0->field_0x34 = temp_a1; +} + + +extern void func_80081A54(s32, s32); +extern s32 func_80081B08(s32); + +extern s32 D_800EB0E8; + +void func_800EA3E4(Arg* arg0) { + s32 var_v0; + + if (func_80081B08(arg0->handle) == 0) { + D_800EB0E8 = 0; + func_800EA488(arg0); + return; + } + if (arg0->field_0x38 == 0) { + if (arg0->field_0x34 != 0) { + func_80081A54(arg0->handle, arg0->field_0x34); + arg0->field_0x3c = arg0->field_0x34 + 3; + } else { + func_80081A54(arg0->handle, 1); + arg0->field_0x3c = 3; + } + arg0->field_0x38 = 2; + arg0->field_0x40 = arg0->field_0x2c; + return; + } + arg0->field_0x40 = arg0->field_0x2c; +} -INCLUDE_ASM(const s32, "overlays/overlay0/3F1B0", func_800EA3E4); INCLUDE_ASM(const s32, "overlays/overlay0/3F1B0", func_800EA488); -INCLUDE_ASM(const s32, "overlays/overlay0/3F1B0", func_800EA568); +// INCLUDE_ASM(const s32, "overlays/overlay0/3F1B0", func_800EA568); + +extern s32 func_80081770(s32); +extern void func_80081DF0(u8*); + +extern u8 D_80104710; + +void func_800EA568(Arg* arg0) { + + if (arg0->field_0x18 != 0) { + if (func_80081B08(arg0->handle) != 0) { + func_80081A54(arg0->handle, 0); + } + } else { + if ((arg0->field_0x28 != -1) && (func_80081B08(arg0->field_0x28) != 0)) { + func_80081A54(arg0->field_0x28, 0); + } + } + + arg0->field_0x28 = arg0->handle; + func_80081DF0(&D_80104710); + arg0->handle = func_80081770(arg0->field_0x2c - 1); + arg0->field_0x20 = arg0->field_0x2c; +} + INCLUDE_ASM(const s32, "overlays/overlay0/3F1B0", func_800EA604); diff --git a/symbol_addrs.txt b/symbol_addrs.txt index 7979839..06b1681 100644 --- a/symbol_addrs.txt +++ b/symbol_addrs.txt @@ -15,6 +15,64 @@ __set_fp_8008A660 = 0x8008A660; musCurrentPtrBank = 0x800B182C; +__osSetTimerIntr = 0x80094F70; +__osInsertTimer = 0x80094FD0; +osSetTime = 0x80094D20; +osStopThread = 0x80094B40; +osSpTaskYield = 0x80093C40; +sprintf = 0x800934B0; + +alHeapDBAlloc = 0x8008F890; +alSaveNew = 0x8008CDD8; +alMainBusNew = 0x8008CD7C; +alAuxBusNew = 0x8008CD20; +alLoadNew = 0x8008CBE4; +alLoadParam = 0x8008D600; +alResampleNew = 0x8008CC94; +alResampleParam = 0x8008EA6C; +alEnvmixerNew = 0x8008CB2C; +alEnvmixerParam = 0x8008DF40; +alAuxBusParam = 0x8008DA0C; +alAudioFrame = 0x8008FBEC; +__allocParam = 0x8008FD9C; +__freeParam = 0x8008FDC8; +_collectPVoices = 0x8008FDE0; +_freePVoice = 0x8008FE34; +_timeToSamplesNoRound = 0x8008FE74; +_timeToSamples = 0x8008FEBC; +__nextSampleTime = 0x8008FF08; +init_lpfilter = 0x8008C5F0; +alMainBusPull = 0x8008E710; +alResamplePull = 0x8008E880; +alEnvmixerPull = 0x8008DA40; +_pullSubFrame = 0x8008E014; +_frexpf = 0x8008E2E8; +_ldexpf = 0x8008E3C8; +_getRate = 0x8008E3EC; +_getVol = 0x8008E66C; +alAuxBusPull = 0x8008D930; +_decodeChunk = 0x8008D7AC; +alRaw16Pull = 0x8008D264; +alAdpcmPull = 0x8008CE20; +alFilterNew = 0x8008E6F0; +alFxPull = 0x8008EB30; +alFxParamHdl = 0x8008EEB8; +_loadOutputBuffer = 0x8008F0A8; +_loadBuffer = 0x8008F2C0; +_saveBuffer = 0x8008F430; +_filterBuffer = 0x8008F5A0; +_doModFunc = 0x8008F63C; + +osPfsChecker = 0x8009AC70; +corrupted_init = 0x8009B0D0; +corrupted = 0x8009B228; +__osPfsGetStatus = 0x80096EC0; +__osPfsRequestOneChannel = 0x80096FB0; +__osPfsGetOneChannelData = 0x80097044; +osPfsInitPak = 0x80096B90; + + + __osContRamRead = 0x80097BD0; __osContRamWrite = 0x80097DC0; @@ -25,13 +83,27 @@ __osCheckPackId = 0x800974A4; __osGetId = 0x80097608; __osCheckId = 0x800977D4; __osPfsRWInode = 0x8009788C; +__scHandleRSP = 0x800940EC; +__scHandleRetrace = 0x80093FEC; +osScGetCmdQ = 0x80093EE0; +osScRemoveClient = 0x80093E50; +osScAddClient = 0x80093DF8; +osCreateScheduler = 0x80093CB0; +__scMain = 0x80093EE8; +osSpTaskYielded = 0x80093C60; osSpTaskLoad = 0x80093A00; osSpTaskStartGo = 0x80093C0C; -__osSpSetStatus = 0x8009A770; __osSpRawStartDma = 0x8009A7A0; __osSpDeviceBusy = 0x8009A740; __osSpSetPc = 0x8009A770; +__osGetCause = 0x8009A6D0; +__osGetSR = 0x8009A6F0; +__osSetCompare = 0x8009A700; +__osSetFpcCsr = 0x8009A710; +__osSetSR = 0x8009A720; +__osSpGetStatus = 0x800939F0; +__osSpSetStatus = 0x8009A760; osDpSetNextBuffer = 0x8009A630; __scExec = 0x800943A4; @@ -43,7 +115,7 @@ __scHandleRDP = 0x800941DC; osViModeTable = 0x800AA7E0; osViSetMode = 0x800955C0; osViSetEvent = 0x80095560; -osCreateScheduler = 0x80088C50; +__osViNext = 0x800ABBD4; osViBlack = 0x80089BE4; osViSetSpecialFeatures = 0x80095610; @@ -51,11 +123,7 @@ __init_controllers = 0x80089C60; MusFxBankInitialize = 0x80081F7C; // rom:0x1237C -osGetCause = 0x8009A6D0; -osGetSR = 0x8009A6F0; -osSetCompare = 0x8009A700; -osSetFpcCsr = 0x8009A710; -osSetSR = 0x8009A720; + osUnmapTLBAll = 0x8009AB00; osMapTLBRdb = 0x8009AAA0; @@ -121,13 +189,11 @@ THREAD_800B9C88 = 0x800B9C88; __thread_8007AC30 = 0x8007AC30; __thread_8008AFE0 = 0x8008AFE0; -__thread_80093EE8 = 0x80093EE8; __thread_80088F08 = 0x80088F08; __thread_80089200 = 0x80089200; __thread_800893C0 = 0x800893C0; __thread_80089540 = 0x80089540; -__scMain = 0x80089358; FP_800A9E84 = 0x800A9E84; @@ -319,7 +385,7 @@ __osTimerServicesInit = 0x80094DE0; __osSiAccessQueue = 0x800E9BC8; __osViInit = 0x8009AB50; __osBaseCounter = 0x800C4814; -__osCurrentTime = 0x800C4C40; +__osCurrentTime = 0x800C4C40; // type:u64 __osContinitialized = 0x800AA720; __osMaxControllers = 0x800C4C1C; __osSiCreateAccessQueue = 0x80094770; @@ -350,7 +416,6 @@ __osSiRelAccess = 0x80094830; __osSiGetAccess = 0x800947C4; __osSiAccessQueueEnabled = 0x800AA780; -__osSpGetStatus = 0x800939F0; viMgrMain = 0x800953C0;