Merge pull request #83 from RevoSucks/decompile_6A40

decompile 6A40
This commit is contained in:
Revo 2023-09-02 22:12:27 -04:00 committed by GitHub
commit 146d1fe43d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 1 deletions

View File

@ -43,7 +43,7 @@ segments:
- [0x5580, asm] # there's a split here according to PAL
- [0x60A0, asm] #
- [0x6430, c, controller] # controller code
- [0x6A40, asm] #
- [0x6A40, c]
- [0x6BC0, asm] #
- [0x75F0, asm] # stage loader
- [0x8EC0, c, crash_screen] # crash handler

61
src/6A40.c Normal file
View File

@ -0,0 +1,61 @@
#include <ultra64.h>
struct UnkStruct800A7428 {
u32 *unk0;
u32 *unk4;
u32 unk8;
s32 unkC;
s16 unk10;
};
extern struct UnkStruct800A7428 D_800A7428;
extern Gfx* gDisplayListHead;
void func_80005EDC(void);
void func_80005E40(u32 arg0, s32 arg1) {
D_800A7428.unk10 = 0;
D_800A7428.unkC = arg0;
D_800A7428.unk0 = main_pool_alloc_with_func(arg0, arg1, 'DYN0', NULL);
D_800A7428.unk4 = main_pool_alloc_with_func(arg0, arg1, 'DYN1', NULL);
func_80005EDC();
}
void func_80005EAC(void) {
main_pool_try_free(D_800A7428.unk4);
main_pool_try_free(D_800A7428.unk0);
}
void func_80005EDC(void) {
s32 *temp_v0 = (s32*)&D_800A7428;
D_800A7428.unk10 ^= 1;
temp_v0 += D_800A7428.unk10;
D_800A7428.unk8 = *temp_v0 + D_800A7428.unkC;
gDisplayListHead = *temp_v0;
}
void func_80005F1C(s32* arg0, s32* arg1) {
s32 *ptr = (s32*)&D_800A7428;
*arg1 = (uintptr_t)gDisplayListHead - ptr[D_800A7428.unk10];
*arg0 = ptr[D_800A7428.unk10];
}
u32 func_80005F5C(s32 arg0) {
u32 temp_v0;
u32 ret;
arg0 = ALIGN8(arg0);
temp_v0 = (D_800A7428.unk8 - arg0);
ret = 0;
if (temp_v0 >= (uintptr_t)gDisplayListHead) {
D_800A7428.unk8 = temp_v0;
ret = temp_v0;
}
return ret;
}
s32 func_80005F9C(void) {
return D_800A7428.unk8 - (uintptr_t)gDisplayListHead;
}