From 6dd8bca0e3ce3c115f70a45567bebe431f5b50bc Mon Sep 17 00:00:00 2001 From: Donkey Kong Date: Fri, 22 Nov 2024 17:31:29 +1030 Subject: [PATCH] 41.8074% --- progress/progress.global_asm.csv | 4 ++-- progress/progress.total.csv | 4 ++-- progress/progress_global_asm.svg | 4 ++-- progress/progress_total.svg | 6 ++--- src/global_asm/code_100180.c | 1 - src/global_asm/code_104F0.c | 6 ++--- src/global_asm/code_17B90.c | 2 +- src/global_asm/code_201B0.c | 40 ++++++++++++++++++++++++++++++-- src/global_asm/code_2F550.c | 2 +- src/global_asm/code_6AF80.c | 8 +++---- src/global_asm/code_A7710.c | 8 +++---- src/global_asm/code_F9450.c | 1 + 12 files changed, 60 insertions(+), 26 deletions(-) diff --git a/progress/progress.global_asm.csv b/progress/progress.global_asm.csv index 543a3b1..5353686 100644 --- a/progress/progress.global_asm.csv +++ b/progress/progress.global_asm.csv @@ -1709,7 +1709,7 @@ us,asm,func_global_asm_8062A130,248,yes us,asm,func_global_asm_806D0DE4,216,yes us,asm,func_global_asm_80682E38,532,yes us,asm,func_global_asm_80733B88,172,no -us,asm,func_global_asm_8061F18C,300,no +us,asm,func_global_asm_8061F18C,300,yes us,asm,func_global_asm_8067880C,8,yes us,asm,func_global_asm_806118FC,152,yes us,asm,func_global_asm_8063DA78,148,yes @@ -2271,7 +2271,7 @@ us,asm,func_global_asm_8062E3B4,404,no us,asm,func_global_asm_80659110,128,yes us,asm,func_global_asm_806EA628,448,no us,asm,func_global_asm_8062A228,36,yes -us,asm,func_global_asm_80625B3C,244,no +us,asm,func_global_asm_80625B3C,244,yes us,asm,func_global_asm_80677D58,36,yes us,asm,func_global_asm_806D1420,328,yes us,asm,func_global_asm_8060F1D0,56,yes diff --git a/progress/progress.total.csv b/progress/progress.total.csv index 46c752e..134421f 100644 --- a/progress/progress.total.csv +++ b/progress/progress.total.csv @@ -1709,7 +1709,7 @@ us,asm,func_global_asm_8062A130,248,yes us,asm,func_global_asm_806D0DE4,216,yes us,asm,func_global_asm_80682E38,532,yes us,asm,func_global_asm_80733B88,172,no -us,asm,func_global_asm_8061F18C,300,no +us,asm,func_global_asm_8061F18C,300,yes us,asm,func_global_asm_8067880C,8,yes us,asm,func_global_asm_806118FC,152,yes us,asm,func_global_asm_8063DA78,148,yes @@ -2271,7 +2271,7 @@ us,asm,func_global_asm_8062E3B4,404,no us,asm,func_global_asm_80659110,128,yes us,asm,func_global_asm_806EA628,448,no us,asm,func_global_asm_8062A228,36,yes -us,asm,func_global_asm_80625B3C,244,no +us,asm,func_global_asm_80625B3C,244,yes us,asm,func_global_asm_80677D58,36,yes us,asm,func_global_asm_806D1420,328,yes us,asm,func_global_asm_8060F1D0,56,yes diff --git a/progress/progress_global_asm.svg b/progress/progress_global_asm.svg index 311edce..dde9cc8 100644 --- a/progress/progress_global_asm.svg +++ b/progress/progress_global_asm.svg @@ -17,7 +17,7 @@ global_asm - 39.1180% - 39.1180% + 39.1622% + 39.1622% diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 9a02369..e653be2 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Donkey Kong 64 (US) - 41.7744% - 41.7744% + 41.8074% + 41.8074% diff --git a/src/global_asm/code_100180.c b/src/global_asm/code_100180.c index bed036f..9d575c3 100644 --- a/src/global_asm/code_100180.c +++ b/src/global_asm/code_100180.c @@ -228,7 +228,6 @@ s16 func_global_asm_806FD7A8(s16 arg0, u8 arg1) { } */ - u8 func_global_asm_806FD894(s16 arg0) { if (arg0 & 0x80) { arg0 ^= 0x80; diff --git a/src/global_asm/code_104F0.c b/src/global_asm/code_104F0.c index 1308979..da77cce 100644 --- a/src/global_asm/code_104F0.c +++ b/src/global_asm/code_104F0.c @@ -464,9 +464,9 @@ void func_global_asm_8060C758(u8 fileIndex, s32 arg1) { void func_global_asm_8060C830(u8 fileIndex, s32 arg1) { current_file = fileIndex; - func_global_asm_8060C758(fileIndex, 0); + func_global_asm_8060C758(fileIndex, FALSE); if (func_global_asm_8060C6B8(0xF, 0, 0, 3) == fileIndex) { - func_global_asm_8060C758(3, 0); + func_global_asm_8060C758(3, FALSE); } if (arg1) { func_global_asm_8060B8F8(1); @@ -631,7 +631,7 @@ void func_global_asm_8060DC3C(u8 fileIndex, s32 arg1) { current_file = fileIndex; current_character_index[0] = 0; // DK if (func_global_asm_8060C6B8(0xD, 0, 0, fileIndex) == 0) { - func_global_asm_8060C758(fileIndex, 0); + func_global_asm_8060C758(fileIndex, FALSE); } if (arg1 != 0) { func_global_asm_8060BA14(); diff --git a/src/global_asm/code_17B90.c b/src/global_asm/code_17B90.c index 2f8af97..91928dc 100644 --- a/src/global_asm/code_17B90.c +++ b/src/global_asm/code_17B90.c @@ -16,7 +16,7 @@ extern u16 *D_807FBB54; // Displaylist stuff? #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_17B90/func_global_asm_80612E90.s") -// Displaylist stuff +// Displaylist stuff, searching a DL for 0xD9 (G_GEOMETRYMODE) commands #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_17B90/func_global_asm_806130A4.s") void func_global_asm_80613194(Actor *actor, s16 arg1) { diff --git a/src/global_asm/code_201B0.c b/src/global_asm/code_201B0.c index bb987f8..1b70d7c 100644 --- a/src/global_asm/code_201B0.c +++ b/src/global_asm/code_201B0.c @@ -844,7 +844,23 @@ void func_global_asm_8061F164(AAD_8061F164 *aaD, s16 arg1) { } } -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_8061F18C.s") +typedef struct { + Actor *unk0; +} AAD_8061F18C; + +void func_global_asm_8061F18C(Actor *arg0, f32 arg1, f32 arg2, f32 arg3) { + AAD_8061F18C *aaD; + s16 sp2A; + s16 pad; + s16 sp26; + f32 d; + + aaD = arg0->additional_actor_data; + sp2A = func_global_asm_80665DE0(aaD->unk0->x_position, aaD->unk0->z_position, arg1, arg3); + sp26 = func_global_asm_806CC14C(sp2A, func_global_asm_80665DE0(aaD->unk0->x_position, aaD->unk0->z_position, arg0->unk88, arg0->unk90)); + d = sqrtf(((arg1 - arg0->unk88) * (arg1 - arg0->unk88)) + ((arg2 - arg0->unk8C) * (arg2 - arg0->unk8C)) + ((arg3 - arg0->unk90) * (arg3 - arg0->unk90))); + func_global_asm_8061F164(aaD, d * MAX(1.0, sp26 * 0.0009765625)); +} void func_global_asm_8061F2B8(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7, f32 arg8, f32 *arg9, f32 *argA, f32 *argB) { f32 d2; @@ -1116,7 +1132,27 @@ s16 func_global_asm_80625A80(s32 lockRegionIndex) { return ((lockRegion->unk10 - D_807F5CD2) / 400) + (((lockRegion->unk14 - D_807F5CD4) / 400) * D_807F5CD8); } -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_80625B3C.s") +void func_global_asm_80625B3C(s16 *arg0, s16 *arg1, s16 *arg2) { + s16 i; + + *arg0 = 0x7FFF; + *arg2 = 0x7FFF; + *arg1 = -0x8000; + for (i = 0; i < D_global_asm_807476FC->lock_count; i++) { + if (D_global_asm_807476FC->lock_regions[i].unk10 < *arg0) { + *arg0 = D_global_asm_807476FC->lock_regions[i].unk10; + } + if (*arg1 < D_global_asm_807476FC->lock_regions[i].unk10) { + *arg1 = D_global_asm_807476FC->lock_regions[i].unk10; + } + if (D_global_asm_807476FC->lock_regions[i].unk14 < *arg2) { + *arg2 = D_global_asm_807476FC->lock_regions[i].unk14; + } + } + *arg0 -= 200; + *arg1 += 200; + *arg2 -= 200; +} #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_80625C30.s") diff --git a/src/global_asm/code_2F550.c b/src/global_asm/code_2F550.c index 9af607d..014aa31 100644 --- a/src/global_asm/code_2F550.c +++ b/src/global_asm/code_2F550.c @@ -9,7 +9,7 @@ extern void *D_global_asm_807F5E60; extern s8 D_global_asm_807F5FEC; extern s32 D_global_asm_807F6C28; -// rodata, close +// close #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_2F550/func_global_asm_8062A850.s") /* diff --git a/src/global_asm/code_6AF80.c b/src/global_asm/code_6AF80.c index 9427f7a..b863ad9 100644 --- a/src/global_asm/code_6AF80.c +++ b/src/global_asm/code_6AF80.c @@ -1366,10 +1366,8 @@ void func_global_asm_8066B4AC(s32 arg0, s32 arg1, s32 arg2) { /* // TODO: Pretty close, s16/u16 and stack nonsense s32 func_global_asm_8066B4D4(s32 arg0, s32 arg1, s32 *arg2, s32 *arg3) { - s16 var_t0; - s32 sp40; - s32 sp3C; - s32 sp38; + s32 var_t0; + u64 sp38; s32 sp2C; s32 temp_v0; s32 *temp_t1; @@ -1380,7 +1378,7 @@ s32 func_global_asm_8066B4D4(s32 arg0, s32 arg1, s32 *arg2, s32 *arg3) { if (temp_v0 & 0x80000000) { sp2C = 8; func_global_asm_8060B140(D_dk64_boot_8000DDCC + (temp_v0 & 0x7FFFFFFF), &sp38, &sp2C, 0, 0, 0, 0); - var_t0 = __ull_rshift(sp38, sp3C, 0, 0x30); + var_t0 = sp38 >> 0x30; func_global_asm_8066B4D4(arg0, var_t0, arg2, arg3); } else { *arg2 = D_dk64_boot_8000DDCC + temp_v0; diff --git a/src/global_asm/code_A7710.c b/src/global_asm/code_A7710.c index af40b0e..39bfbe3 100644 --- a/src/global_asm/code_A7710.c +++ b/src/global_asm/code_A7710.c @@ -4,7 +4,6 @@ // close #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_A7710/func_global_asm_806A2A10.s") -/* typedef struct { s32 unk0; s32 unk4; @@ -12,18 +11,19 @@ typedef struct { s32 unkC; } AAD_global_asm_806A2A10; +/* void func_global_asm_806A2A10(s16 arg0, s16 arg1, u8 arg2) { spawnActor(ACTOR_TIMER_CONTROLLER, 0); - if ((arg0 & 0x8000) != 0) { - last_spawned_actor->unk15F = 0xB; + if (arg0 & 0x8000) { arg2--; + last_spawned_actor->unk15F = 0xB; } else { last_spawned_actor->unk15F = 6; } current_actor_pointer->unk11C = last_spawned_actor; extra_player_info_pointer->unk1A8 = last_spawned_actor; ((AAD_global_asm_806A2A10*)last_spawned_actor->additional_data_pointer)->unkC = arg2; - last_spawned_actor->x_position = (s16) (arg0 & 0x7FFF); + last_spawned_actor->x_position = (s16)(arg0 & 0x7FFF); last_spawned_actor->y_position = arg1; last_spawned_actor->control_state = 1; last_spawned_actor->shadow_opacity = 0; diff --git a/src/global_asm/code_F9450.c b/src/global_asm/code_F9450.c index 3c91dcc..b5c5db0 100644 --- a/src/global_asm/code_F9450.c +++ b/src/global_asm/code_F9450.c @@ -181,6 +181,7 @@ void func_global_asm_806F50C8(s16 arg0, s16 arg1, s16 arg2, u8 arg3, u8 arg4, u8 *var_v1 = temp_v0_2; } +// looks like it loops through linked lists and frees them #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_F9450/func_global_asm_806F5270.s") typedef struct globalASMStruct36 GlobalASMStruct36;