From ecef7a5aa4806efcdfae300809544ee6db6976e3 Mon Sep 17 00:00:00 2001 From: Donkey Kong Date: Thu, 21 Nov 2024 21:59:17 +1030 Subject: [PATCH] 41.7744% --- decompressed.us.yaml | 3 +- include/functions.h | 4 +- progress/progress.global_asm.csv | 18 ++-- progress/progress.total.csv | 18 ++-- progress/progress_global_asm.svg | 4 +- progress/progress_total.svg | 4 +- src/global_asm/code_126260.c | 25 +++-- src/global_asm/code_131B0.c | 36 ++++--- src/global_asm/code_17B90.c | 42 +++++++- src/global_asm/code_201B0.c | 168 ++++++++++++++++++++++++++----- src/global_asm/code_36880.c | 3 +- src/global_asm/code_478F0.c | 22 ++-- src/global_asm/code_6710.c | 6 +- src/global_asm/code_80150.c | 2 +- src/global_asm/code_F56F0.c | 15 +-- src/minecart/code_25F0.c | 2 +- 16 files changed, 267 insertions(+), 105 deletions(-) diff --git a/decompressed.us.yaml b/decompressed.us.yaml index bd5646a..0e0e3ea 100644 --- a/decompressed.us.yaml +++ b/decompressed.us.yaml @@ -225,7 +225,7 @@ segments: - [0x20169F0, c, done/code_169F0] - [0x2016A20, c, code_16A20] - [0x2016B60, hasm, code_16B60] - - [0x2017490, hasm, code_17490] # hasm + - [0x2017490, hasm, code_17490] - [0x2017540, c, code_17540] - [0x2017800, c, code_17800] - [0x2017B40, c, done/code_17B40] @@ -463,6 +463,7 @@ segments: - [0x21632C0, .rodata, code_117880] - [0x21633A0, rodata] # code_119370 - [0x21633D0, rodata] # TODO: code_1?????, split needed + - [0x2163800, .rodata, code_126260] - [0x2163840, .rodata, code_127B00] - [0x2163870, .rodata, code_1292F0] - [0x2163880, rodata] # code_1295B0, code12E800? diff --git a/include/functions.h b/include/functions.h index 372921c..021cdd2 100644 --- a/include/functions.h +++ b/include/functions.h @@ -504,7 +504,7 @@ void func_global_asm_80613214(Actor *actor); // TODO: func_global_asm_8061324C has no documented signature // TODO: func_global_asm_80613358 has no documented signature // TODO: func_global_asm_806133C8 has no documented signature -s16 func_global_asm_80613448(Actor *arg0); +// TODO: func_global_asm_80613448 has no documented signature but has been matched // TODO: func_global_asm_806134B4 has no documented signature void func_global_asm_806136B4(Actor *arg0); void func_global_asm_80613794(Actor *arg0, u8 arg1); @@ -680,7 +680,7 @@ void func_global_asm_8061C2D8(Actor *camera, s32 arg1); void func_global_asm_8061C2F0(Actor *camera, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, u8 arg7); void func_global_asm_8061C39C(Actor *camera); void func_global_asm_8061C458(Actor *camera, s32 arg1); -void func_global_asm_8061C464(Actor *arg0, Actor *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, f32 arg10); +void func_global_asm_8061C464(Actor *arg0, Actor *arg1, u8 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 arg9, f32 argA); void func_global_asm_8061C518(Actor *arg0, Actor *arg1, u8 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 arg9, f32 argA); void func_global_asm_8061C600(Actor *arg0, Actor *arg1, u8 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 arg9, f32 argA); void func_global_asm_8061C6A8(Actor *arg0, Actor *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, f32 arg10); diff --git a/progress/progress.global_asm.csv b/progress/progress.global_asm.csv index d5606ad..543a3b1 100644 --- a/progress/progress.global_asm.csv +++ b/progress/progress.global_asm.csv @@ -185,9 +185,9 @@ us,asm,func_global_asm_80635214,56,no us,asm,func_global_asm_807146A4,60,yes us,asm,func_global_asm_806D19A8,440,yes us,asm,func_global_asm_8069AB74,1148,no -us,asm,func_global_asm_8061D898,156,no +us,asm,func_global_asm_8061D898,156,yes us,asm,func_global_asm_80695B50,92,yes -us,asm,func_global_asm_8061CF24,92,no +us,asm,func_global_asm_8061CF24,92,yes us,asm,func_global_asm_8070F570,92,yes us,asm,func_global_asm_807197B4,600,no us,asm,func_global_asm_8068C2EC,12,yes @@ -449,7 +449,7 @@ us,asm,func_global_asm_80684BB0,488,yes us,asm,func_global_asm_8061159C,12,yes us,asm,func_global_asm_8067E3D0,108,yes us,asm,func_global_asm_806D97A4,124,yes -us,asm,func_global_asm_8072167C,256,no +us,asm,func_global_asm_8072167C,256,yes us,asm,func_global_asm_8069FA40,864,yes us,asm,func_global_asm_806739D8,104,no us,asm,func_global_asm_806B3C30,100,yes @@ -1029,7 +1029,7 @@ us,asm,func_global_asm_80674B90,644,no us,asm,func_global_asm_806B4DCC,808,yes us,asm,func_global_asm_806951E8,1340,no us,asm,func_global_asm_806CF878,160,yes -us,asm,func_global_asm_8061C464,180,no +us,asm,func_global_asm_8061C464,180,yes us,asm,func_global_asm_806EBF34,64,yes us,asm,func_global_asm_80677148,1220,no us,asm,func_global_asm_806DABE4,444,yes @@ -1993,7 +1993,7 @@ us,asm,func_global_asm_806787CC,32,yes us,asm,func_global_asm_80690F30,1664,no us,asm,func_global_asm_807245D8,24,yes us,asm,func_global_asm_806B50F4,72,yes -us,asm,func_global_asm_80721560,76,no +us,asm,func_global_asm_80721560,76,yes us,asm,func_global_asm_806CFDEC,68,yes us,asm,func_global_asm_80612CA0,112,yes us,asm,func_global_asm_8072FCC4,272,no @@ -2454,7 +2454,7 @@ us,asm,func_global_asm_8062BB2C,412,no us,asm,func_global_asm_8061138C,124,yes us,asm,func_global_asm_8072F09C,132,yes us,asm,func_global_asm_80714998,16,yes -us,asm,func_global_asm_80613448,108,no +us,asm,func_global_asm_80613448,108,yes us,asm,func_global_asm_80645700,456,yes us,asm,func_global_asm_80731D20,328,no us,asm,func_global_asm_8070E2AC,160,yes @@ -2767,7 +2767,7 @@ us,asm,func_global_asm_806E8244,608,yes us,asm,func_global_asm_8063DC58,528,no us,asm,func_global_asm_806FDA8C,44,yes us,asm,func_global_asm_80712F10,184,yes -us,asm,func_global_asm_80625A80,188,no +us,asm,func_global_asm_80625A80,188,yes us,asm,func_global_asm_80667174,12,yes us,asm,func_global_asm_806D01AC,160,yes us,asm,func_global_asm_806CEC04,608,no @@ -3344,7 +3344,7 @@ us,asm,func_global_asm_80676730,44,yes us,asm,setIntroStoryPlaying,16,yes us,asm,func_global_asm_8073A8BC,68,yes us,asm,alSeqFileNew,100,yes -us,asm,func_global_asm_8061B7E0,96,no +us,asm,func_global_asm_8061B7E0,96,yes us,asm,func_global_asm_80612910,96,no us,asm,func_global_asm_806A2B08,24,yes us,asm,func_global_asm_80688EA4,64,yes @@ -3433,7 +3433,7 @@ us,asm,func_global_asm_8072CFE8,164,yes us,asm,func_global_asm_806F7378,40,yes us,asm,func_global_asm_8060866C,96,yes us,asm,func_global_asm_8064E4F8,100,yes -us,asm,func_global_asm_8061D968,132,no +us,asm,func_global_asm_8061D968,132,yes us,asm,func_global_asm_805FF5A0,136,yes us,asm,func_global_asm_80666FC8,328,yes us,asm,func_global_asm_8068E9B0,136,yes diff --git a/progress/progress.total.csv b/progress/progress.total.csv index 03b9db2..46c752e 100644 --- a/progress/progress.total.csv +++ b/progress/progress.total.csv @@ -185,9 +185,9 @@ us,asm,func_global_asm_80635214,56,no us,asm,func_global_asm_807146A4,60,yes us,asm,func_global_asm_806D19A8,440,yes us,asm,func_global_asm_8069AB74,1148,no -us,asm,func_global_asm_8061D898,156,no +us,asm,func_global_asm_8061D898,156,yes us,asm,func_global_asm_80695B50,92,yes -us,asm,func_global_asm_8061CF24,92,no +us,asm,func_global_asm_8061CF24,92,yes us,asm,func_global_asm_8070F570,92,yes us,asm,func_global_asm_807197B4,600,no us,asm,func_global_asm_8068C2EC,12,yes @@ -449,7 +449,7 @@ us,asm,func_global_asm_80684BB0,488,yes us,asm,func_global_asm_8061159C,12,yes us,asm,func_global_asm_8067E3D0,108,yes us,asm,func_global_asm_806D97A4,124,yes -us,asm,func_global_asm_8072167C,256,no +us,asm,func_global_asm_8072167C,256,yes us,asm,func_global_asm_8069FA40,864,yes us,asm,func_global_asm_806739D8,104,no us,asm,func_global_asm_806B3C30,100,yes @@ -1029,7 +1029,7 @@ us,asm,func_global_asm_80674B90,644,no us,asm,func_global_asm_806B4DCC,808,yes us,asm,func_global_asm_806951E8,1340,no us,asm,func_global_asm_806CF878,160,yes -us,asm,func_global_asm_8061C464,180,no +us,asm,func_global_asm_8061C464,180,yes us,asm,func_global_asm_806EBF34,64,yes us,asm,func_global_asm_80677148,1220,no us,asm,func_global_asm_806DABE4,444,yes @@ -1993,7 +1993,7 @@ us,asm,func_global_asm_806787CC,32,yes us,asm,func_global_asm_80690F30,1664,no us,asm,func_global_asm_807245D8,24,yes us,asm,func_global_asm_806B50F4,72,yes -us,asm,func_global_asm_80721560,76,no +us,asm,func_global_asm_80721560,76,yes us,asm,func_global_asm_806CFDEC,68,yes us,asm,func_global_asm_80612CA0,112,yes us,asm,func_global_asm_8072FCC4,272,no @@ -2454,7 +2454,7 @@ us,asm,func_global_asm_8062BB2C,412,no us,asm,func_global_asm_8061138C,124,yes us,asm,func_global_asm_8072F09C,132,yes us,asm,func_global_asm_80714998,16,yes -us,asm,func_global_asm_80613448,108,no +us,asm,func_global_asm_80613448,108,yes us,asm,func_global_asm_80645700,456,yes us,asm,func_global_asm_80731D20,328,no us,asm,func_global_asm_8070E2AC,160,yes @@ -2767,7 +2767,7 @@ us,asm,func_global_asm_806E8244,608,yes us,asm,func_global_asm_8063DC58,528,no us,asm,func_global_asm_806FDA8C,44,yes us,asm,func_global_asm_80712F10,184,yes -us,asm,func_global_asm_80625A80,188,no +us,asm,func_global_asm_80625A80,188,yes us,asm,func_global_asm_80667174,12,yes us,asm,func_global_asm_806D01AC,160,yes us,asm,func_global_asm_806CEC04,608,no @@ -3344,7 +3344,7 @@ us,asm,func_global_asm_80676730,44,yes us,asm,setIntroStoryPlaying,16,yes us,asm,func_global_asm_8073A8BC,68,yes us,asm,alSeqFileNew,100,yes -us,asm,func_global_asm_8061B7E0,96,no +us,asm,func_global_asm_8061B7E0,96,yes us,asm,func_global_asm_80612910,96,no us,asm,func_global_asm_806A2B08,24,yes us,asm,func_global_asm_80688EA4,64,yes @@ -3433,7 +3433,7 @@ us,asm,func_global_asm_8072CFE8,164,yes us,asm,func_global_asm_806F7378,40,yes us,asm,func_global_asm_8060866C,96,yes us,asm,func_global_asm_8064E4F8,100,yes -us,asm,func_global_asm_8061D968,132,no +us,asm,func_global_asm_8061D968,132,yes us,asm,func_global_asm_805FF5A0,136,yes us,asm,func_global_asm_80666FC8,328,yes us,asm,func_global_asm_8068E9B0,136,yes diff --git a/progress/progress_global_asm.svg b/progress/progress_global_asm.svg index af5a502..311edce 100644 --- a/progress/progress_global_asm.svg +++ b/progress/progress_global_asm.svg @@ -17,7 +17,7 @@ global_asm - 39.0137% - 39.0137% + 39.1180% + 39.1180% diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 411cb9c..9a02369 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Donkey Kong 64 (US) - 41.6965% - 41.6965% + 41.7744% + 41.7744% diff --git a/src/global_asm/code_126260.c b/src/global_asm/code_126260.c index 8ae4fd3..ec8d0a7 100644 --- a/src/global_asm/code_126260.c +++ b/src/global_asm/code_126260.c @@ -1,8 +1,16 @@ #include #include "functions.h" - -// #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_126260/func_global_asm_80721560.s") +// rodata +/* +extern f64 D_global_asm_8075EB00 = 0.1; +extern f64 D_global_asm_8075EB08 = 0.001; +extern f64 D_global_asm_8075EB10 = 0.001; +extern f64 D_global_asm_8075EB18 = 0.1; +extern f64 D_global_asm_8075EB20 = 0.02; +extern f64 D_global_asm_8075EB28 = 255; +extern f64 D_global_asm_8075EB30 = 0.05; +*/ typedef struct struct807FDB60 { u8 pad[0x4]; @@ -75,22 +83,17 @@ void func_global_asm_807215EC(void) { func_global_asm_807215D0(1, 1); } -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_126260/func_global_asm_8072167C.s") - extern s16 D_global_asm_80755680; extern f32 D_global_asm_80755684; extern f32 D_global_asm_80755688; extern f32 D_global_asm_8075568C; -extern f64 D_global_asm_8075EB00; -/* void func_global_asm_8072167C(s16 arg0, s16 arg1, s16 arg2, s16 arg3) { - D_global_asm_80755680 = D_global_asm_80755680 + (arg3 - D_global_asm_80755680) * D_global_asm_8075EB00; - D_global_asm_80755684 = D_global_asm_80755684 + (arg0 - D_global_asm_80755684) * D_global_asm_8075EB00; - D_global_asm_80755688 = D_global_asm_80755688 + (arg1 - D_global_asm_80755688) * D_global_asm_8075EB00; - D_global_asm_8075568C = D_global_asm_8075568C + (arg2 - D_global_asm_8075568C) * D_global_asm_8075EB00; + D_global_asm_80755680 += (arg3 - D_global_asm_80755680) * 0.1; + D_global_asm_80755684 += (arg0 - D_global_asm_80755684) * 0.1; + D_global_asm_80755688 += (arg1 - D_global_asm_80755688) * 0.1; + D_global_asm_8075568C += (arg2 - D_global_asm_8075568C) * 0.1; } -*/ extern u8 D_807FDB74; extern u8 D_807FDB75; diff --git a/src/global_asm/code_131B0.c b/src/global_asm/code_131B0.c index 50dce97..f6693a3 100644 --- a/src/global_asm/code_131B0.c +++ b/src/global_asm/code_131B0.c @@ -270,26 +270,9 @@ void func_global_asm_8060F1D0(Struct131B0_2 *arg0, Struct131B0_1 *arg1) { } } +// close, doable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_131B0/func_global_asm_8060F208.s") -extern OSTime D_global_asm_807F04D0; - -/* -void func_global_asm_8060F208(Struct131B0_2 *arg0) { - if (arg0->unk274 != 0) { - func_global_asm_8060FA5C(); - } else { - D_global_asm_807F04D0 = 0; - func_global_asm_8060F960(arg0, 0); - } -} -*/ - -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_131B0/func_global_asm_8060F254.s") - -// 64 bit stuff -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_131B0/func_global_asm_8060F54C.s") - s32 func_global_asm_8060F854(Struct131B0_2 *, Struct131B0_2_unk274 *); extern OSTime D_807F04C0; extern OSTime D_807F04C8; @@ -301,7 +284,22 @@ extern OSTime D_807F0510; extern s8 D_global_asm_80746828; /* -Close +void func_global_asm_8060F208(Struct131B0_2 *arg0) { + if (arg0->unk274 != NULL) { + func_global_asm_8060FA5C(); + } else { + D_807F04D0 = 0; + func_global_asm_8060F960(arg0, 0); + } +} +*/ + +#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_131B0/func_global_asm_8060F254.s") + +// 64 bit stuff, close +#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_131B0/func_global_asm_8060F54C.s") + +/* void func_global_asm_8060F54C(Struct131B0_2 *arg0) { Struct131B0_2_unk274 *temp_s0; Struct131B0_2_unk268 *temp_v0; diff --git a/src/global_asm/code_17B90.c b/src/global_asm/code_17B90.c index f512b7b..2f8af97 100644 --- a/src/global_asm/code_17B90.c +++ b/src/global_asm/code_17B90.c @@ -47,8 +47,32 @@ void func_global_asm_80613214(Actor *actor) { // Possibly the code responsible for loading textures dynamically #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_17B90/func_global_asm_806133C8.s") -// cheeky little struct array loop, doable -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_17B90/func_global_asm_80613448.s") +typedef struct { + u16 modelIndex; + s16 unk2; + Actor_unk0 *unk4; + s32 unk8; +} Struct807FB630; + +extern Struct807FB630 D_807FB630[]; +extern u16 D_807FBB30; + +u16 func_global_asm_80613448(Actor *arg0) { + Actor_unk0 *var_v0 = arg0->unk0; + s32 searchIndex; + + searchIndex = D_807FBB30; + while (searchIndex >= 0) { + if (var_v0 == D_807FB630[searchIndex].unk4) { + break; + } + searchIndex--; + } + if (searchIndex >= 0) { + return D_807FB630[searchIndex].modelIndex; + } + return 0; +} // matrix initialization #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_17B90/func_global_asm_806134B4.s") @@ -118,6 +142,20 @@ void func_global_asm_80613C48(Actor *arg0, s16 arg1, f32 arg2, f32 arg3) { #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_17B90/func_global_asm_80613FB0.s") +typedef struct { + u16 *unk0; + u16 unk4; +} Struct807FBB58; + +extern Struct807FBB58 D_807FBB58[]; + +/* +void func_global_asm_80613FB0(Actor *arg0, u16 arg1, f32 arg2, u8 arg3) { + u16 lu = arg0->unk58 - 2; + func_global_asm_80614014(arg0, D_807FBB58[arg1].unk0[lu], arg2, arg3); +} +*/ + typedef struct { f32 unk0; u16 unk4; diff --git a/src/global_asm/code_201B0.c b/src/global_asm/code_201B0.c index 7e95130..bb987f8 100644 --- a/src/global_asm/code_201B0.c +++ b/src/global_asm/code_201B0.c @@ -22,11 +22,23 @@ typedef struct CutsceneBank_CamBank { s16 *length_array; } CutsceneBank_CamBank; +typedef struct { + s32 unk0; + s32 unk4; + s32 unk8; + s32 unkC; + s16 unk10; + s16 unk12; + s16 unk14; + s16 unk16; + s32 unk18; +} CutsceneBank_LockRegion; + typedef struct CutsceneBank { CutsceneBank_unk0 unk0[24]; s16 lock_count; u8 padC2[2]; - void *lock_regions; + CutsceneBank_LockRegion *lock_regions; u8 *lock_chunks; s16 cutscene_count; u8 padCE[2]; @@ -44,7 +56,7 @@ extern u8 D_global_asm_8076A0B1; extern u8 D_global_asm_8076A0B3; extern Actor *D_807F5CE8; extern s16 D_807F5CEC; -extern s16 D_807F5CF0; +extern u16 D_807F5CF0; extern u16 D_807F5CF4; extern f32 D_807F5CFC; extern f32 D_807F5D00; @@ -66,7 +78,7 @@ extern s8 D_807F5CFA; extern Actor *D_807F5D0C; extern s8 D_807F5D14; extern OSTime D_global_asm_807476D0; -extern s8 D_global_asm_807476D8; +extern u8 D_global_asm_807476D8; extern s16 D_global_asm_807476E4; extern s16 D_global_asm_807476F0; extern u8 D_global_asm_80770DC9; @@ -136,7 +148,23 @@ void func_global_asm_8061B660(Struct8061B660 *arg0, f32 *arg1, f32 *arg2, f32 *a } */ -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_8061B7E0.s") +extern f32 D_global_asm_807574A0; + +typedef struct { + u8 unk0[0x90 - 0x0]; + f32 unk90; + u8 unk94[0xFA - 0x94]; + s8 unkFA; +} Struct8061B7E0; + +void func_global_asm_8061B7E0(Actor *arg0, Struct8061B7E0 *arg1, f32 x, f32 z) { + f32 y; + + y = D_global_asm_807574A0; + arg1->unkFA = 0; + func_global_asm_8066635C(arg0, x, y, z, &y); + arg1->unkFA = func_global_asm_8066715C(&arg1->unk90); +} typedef struct { u8 unk0[0xF7 - 0x0]; @@ -238,7 +266,53 @@ void func_global_asm_8061C458(Actor *camera, s32 arg1) { aaD->unk48 = arg1; } -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_8061C464.s") +typedef struct { + Actor *unk0; + Actor *unk4; + s16 unk8; + s16 unkA; + s16 unkC; + s16 unkE; + s16 unk10; + s16 unk12; + s16 unk14; + // s16 unk16 padding, appears to be unused + f32 unk18; +} AAD_8061C464_unk44; + +typedef struct { + s32 *unk0; + u8 unk4[0x44 - 0x4]; + AAD_8061C464_unk44 unk44; // This is really weird, the function below uses a pointer to the substruct + u8 unk48[0xF3 - 0x60]; + u8 unkF3; +} AAD_8061C464; + +void func_global_asm_8061C464(Actor *arg0, Actor *arg1, u8 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 arg9, f32 argA) { + AAD_8061C464 *aaD; + AAD_8061C464_unk44 *aaD44; + + aaD = ((AAD_8061C464*)arg0->additional_actor_data); + aaD44 = &aaD->unk44; + if (arg1) { + aaD44->unk0 = arg1; + aaD44->unk4 = arg1; + aaD44->unk8 = arg3; + aaD44->unkA = arg4; + aaD44->unkC = arg5; + aaD44->unkE = arg6; + aaD44->unk10 = arg7; + aaD44->unk12 = arg8; + aaD44->unk14 = arg9; + aaD44->unk18 = argA; + if (aaD->unkF3 == 3) { + func_global_asm_806EAB44(player_pointer, 0); + } + aaD->unkF3 = arg2; + } else { + func_global_asm_806224CC(arg0, aaD->unk0); + } +} void func_global_asm_8061C518(Actor *arg0, Actor *arg1, u8 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 arg9, f32 argA) { f32 sp3C; @@ -250,7 +324,7 @@ void func_global_asm_8061C518(Actor *arg0, Actor *arg1, u8 arg2, s16 arg3, s16 a D_global_asm_8076A0B3 = 0; D_global_asm_8076A0B1 |= 0x10; arg1->animation_state->scale[1] = D_global_asm_807574E0; - func_global_asm_8061C6A8(arg0, arg1, (s32) arg2, (s32) arg3, (s32) arg4, (s32) arg5, (s32) arg6, (s32) arg7, (s32) arg8, (s32) arg9, argA); + func_global_asm_8061C6A8(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, argA); arg1->animation_state->scale[1] = sp3C; global_properties_bitfield &= ~1; } @@ -261,7 +335,19 @@ void func_global_asm_8061C600(Actor *arg0, Actor *arg1, u8 arg2, s16 arg3, s16 a } D_global_asm_8076A0B3 = 0; D_global_asm_8076A0B1 |= 0x10; - func_global_asm_8061C464(arg0, arg1, (s32) arg2, (s32) arg3, (s32) arg4, (s32) arg5, (s32) arg6, (s32) arg7, (s32) arg8, (s32) arg9, argA); + func_global_asm_8061C464( + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + argA + ); } #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_8061C6A8.s") @@ -390,29 +476,28 @@ void func_global_asm_8061CC30(void) { D_global_asm_807476EC = 1; } +// close, doable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/playCutscene.s") /* -s32 playCutscene(Actor *arg0, s16 arg1, s32 arg2) { +s32 playCutscene(Actor *arg0, s16 arg1, u8 arg2) { u16 sp26; s32 is_global; - s32 temp_a2; sp26 = 0; if ((is_cutscene_active == 1) && (D_807F5CF4 & 0x80)) { return 0; } - is_global = (u8) arg2 & 4; - temp_a2 = (u8) arg2; - if ((is_global != 0) && (current_map != MAP_TEST_MAP)) { + is_global = arg2 & 4; + if ((is_global) && (current_map != MAP_TEST_MAP)) { D_global_asm_807476FC = &D_807F5B10[1]; } else { D_global_asm_807476FC = &D_807F5B10[0]; } - if (spawnActor(ACTOR_CUTSCENE_CONTROLLER, 0) != 0) { + if (spawnActor(ACTOR_CUTSCENE_CONTROLLER, 0)) { D_807F5D0C = last_spawned_actor; last_spawned_actor->noclip_byte = 1; - if ((is_global == 0) && (D_global_asm_807FBB64 & 1)) { + if ((!is_global) && (D_global_asm_807FBB64 & 1)) { func_boss_80029140(&arg1); } if (arg0 != NULL) { @@ -421,14 +506,14 @@ s32 playCutscene(Actor *arg0, s16 arg1, s32 arg2) { D_807F5CE8 = character_change_array->player_pointer; } is_cutscene_active = 1; - if (!(temp_a2 & 8)) { + if (!(arg2 & 8)) { D_global_asm_8076A0B1 |= 0x10; D_global_asm_8076A0B3 = 0; } D_global_asm_807476D0 = osGetTime(); D_global_asm_807476F4 = arg1; D_global_asm_807476F8 = arg1; - D_807F5CF4 = (u8) arg2; + D_807F5CF4 = arg2; D_807F5CFA = 0; D_global_asm_807476D8 = 0; D_global_asm_807476E4 = 0; @@ -456,16 +541,23 @@ s32 playCutscene(Actor *arg0, s16 arg1, s32 arg2) { func_global_asm_806119F0(0x8E32B6F7U); D_807F5CE0 = osGetTime(); D_807F5D14 = 0; - } else if (isIntroStoryPlaying() == 0) { + } else if (!isIntroStoryPlaying()) { D_807F5CE0 = 0; } - return sp26; } - return 0; + return sp26; } */ -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_8061CF24.s") +void func_global_asm_8061CF24(s16 *arg0, s16 *arg1, s16 *arg2, s16 *arg3) { + if (D_807F5CF4 & 0x20) { + *arg0 = D_807F5D04; + *arg1 = D_807F5D06; + *arg2 = D_807F5D08; + *arg3 = D_807F5D0A; + D_807F5CF4 &= 0xFFDF; + } +} void func_global_asm_8061CF80(s16 arg0) { D_807F5CEE = arg0; @@ -567,7 +659,13 @@ void func_global_asm_8061D4E4(Actor *arg0) { // heavy use of rodata, don't bother until it's migrated #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_8061D6A8.s") -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_8061D898.s") +void func_global_asm_8061D898(void) { + D_807F5D0C->unk168 = 0; + D_807F5D0C->unk160 = 0.0; + D_807F5CF2 = D_global_asm_807476FC->camera_bank[D_global_asm_807476F4].point_array[D_807F5CF0]; + D_807F5CEC = D_global_asm_807476FC->camera_bank[D_global_asm_807476F4].length_array[D_807F5CF0]; + func_global_asm_806F3DB0(); +} void func_global_asm_8061D934(u8 arg0) { D_global_asm_807476F4 = arg0; @@ -575,8 +673,21 @@ void func_global_asm_8061D934(u8 arg0) { func_global_asm_8061D898(); } -// hmm, causes fiddly signature for func_global_asm_8061D898 -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_8061D968.s") +extern u16 D_807F5CF8; + +void func_global_asm_8061D968(u8 arg0, u8 arg1) { + if (D_global_asm_807476D8) { + if (--D_global_asm_807476D8) { + D_807F5CF0 = D_807F5CF8; + func_global_asm_8061D898(); + } + } else { + D_global_asm_807476D8 = arg1; + D_807F5CF8 = arg0; + D_807F5CF0 = arg0; + func_global_asm_8061D898(); + } +} void func_global_asm_8061D9EC(s32 arg0, s32 arg1, s32 arg2) { loading_zone_transition_type = 0; @@ -994,7 +1105,16 @@ void func_global_asm_80625994(Actor *arg0, f32 arg1, f32 *arg2, f32 *arg3, f32 * #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_806259FC.s") -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_201B0/func_global_asm_80625A80.s") +extern s16 D_807F5CD2; +extern s16 D_807F5CD4; +extern s16 D_807F5CD8; + +s16 func_global_asm_80625A80(s32 lockRegionIndex) { + CutsceneBank_LockRegion *lockRegion; + + lockRegion = &D_global_asm_807476FC->lock_regions[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") diff --git a/src/global_asm/code_36880.c b/src/global_asm/code_36880.c index 1779dad..748721a 100644 --- a/src/global_asm/code_36880.c +++ b/src/global_asm/code_36880.c @@ -165,7 +165,8 @@ s32 func_global_asm_80631EB8(u16 arg0) { return FALSE; } -// regalloc +// regalloc, close, doable +// https://decomp.me/scratch/L4Vuz #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_36880/func_global_asm_80631F58.s") /* diff --git a/src/global_asm/code_478F0.c b/src/global_asm/code_478F0.c index c57e41b..35c9e7f 100644 --- a/src/global_asm/code_478F0.c +++ b/src/global_asm/code_478F0.c @@ -1594,20 +1594,20 @@ typedef struct { void func_global_asm_8064B3F8(Struct8064B3F8 **arg0, s16 arg1, s16 arg2, s16 arg3) { Struct8064B3F8 *temp_t0; Struct8064B3F8 *temp_a0; - f32 temp; - f32 temp2; - f32 temp3; - s32 temp4; + f32 x; + f32 y; + f32 z; + s32 objectModel2Index; temp_t0 = *arg0; + objectModel2Index = func_global_asm_80659470(arg1); + x = D_global_asm_807F6000[objectModel2Index].x_position; + y = D_global_asm_807F6000[objectModel2Index].y_position; + z = D_global_asm_807F6000[objectModel2Index].z_position; temp_a0 = &arg0[arg3]; - temp4 = func_global_asm_80659470(arg1); - temp = D_global_asm_807F6000[temp4].x_position; - temp2 = D_global_asm_807F6000[temp4].y_position; - temp3 = D_global_asm_807F6000[temp4].z_position; - temp_a0->unk14 = (temp_t0->unk0 - temp) / arg2; - temp_a0->unk18 = (temp_t0->unk4 - temp2) / arg2; - temp_a0->unk1C = (temp_t0->unk8 - temp3) / arg2; + temp_a0->unk14 = (temp_t0->unk0 - x) / arg2; + temp_a0->unk18 = (temp_t0->unk4 - y) / arg2; + temp_a0->unk1C = (temp_t0->unk8 - z) / arg2; } */ diff --git a/src/global_asm/code_6710.c b/src/global_asm/code_6710.c index 8fd7ac9..440543f 100644 --- a/src/global_asm/code_6710.c +++ b/src/global_asm/code_6710.c @@ -14,7 +14,7 @@ extern u8 D_global_asm_80770598[]; extern u8 D_global_asm_80770560[]; extern f32 D_global_asm_80770568[]; extern s16 D_global_asm_80770628[]; -extern s16 D_global_asm_80770710[]; +extern s16 D_80770710[]; extern f32 D_global_asm_80770B68[]; extern f32 D_global_asm_80770BC0[]; extern f32 D_global_asm_80770C18[]; @@ -541,7 +541,7 @@ s16 func_global_asm_80604D70(Actor *arg0, s16 arg1, u8 arg2, s32 arg3, u8 arg4, // TODO: Very close, call to func_global_asm_80605314 is pulling a1 from temp reg instead of stack void func_global_asm_80604CBC(Actor *arg0, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5, f32 arg6, s8 arg7) { if (arg0->unk6E[arg4] != -1) { - if (arg1 != D_global_asm_80770710[D_global_asm_80770628[arg0->unk6E[arg4]]]) { + if (arg1 != D_80770710[D_global_asm_80770628[arg0->unk6E[arg4]]]) { func_global_asm_80605314(arg0, arg4); } else { return; @@ -587,7 +587,7 @@ void func_global_asm_80605380(s16 arg0) { D_global_asm_80770658[D_global_asm_807707A0[D_global_asm_80770628[arg0]].unk0[D_global_asm_80770740[D_global_asm_80770628[arg0]]]] = D_global_asm_80770658[D_global_asm_807707A0[D_global_asm_80770628[arg0]].unk0[D_global_asm_80770658[arg0]]]; D_global_asm_807707A0[D_global_asm_80770628[arg0]].unk0[D_global_asm_80770658[arg0]] = D_global_asm_807707A0[D_global_asm_80770628[arg0]].unk0[D_global_asm_80770740[D_global_asm_80770628[arg0]]]; } else { - D_global_asm_80770710[D_global_asm_80770628[arg0]] = 0; + D_80770710[D_global_asm_80770628[arg0]] = 0; D_global_asm_807706F8[D_global_asm_80770628[arg0]] = 0; } if (D_global_asm_80770740[D_global_asm_80770628[arg0]] < 0 || D_global_asm_80770740[D_global_asm_80770628[arg0]] >= 0x17) { diff --git a/src/global_asm/code_80150.c b/src/global_asm/code_80150.c index 5e2e01e..90faf1a 100644 --- a/src/global_asm/code_80150.c +++ b/src/global_asm/code_80150.c @@ -24,7 +24,7 @@ u8 func_global_asm_8067B450(void) { return isFlagSet(D_global_asm_8074E7A0[i].unk4, FLAG_TYPE_PERMANENT); } } - return 0; + return FALSE; } */ diff --git a/src/global_asm/code_F56F0.c b/src/global_asm/code_F56F0.c index 5d19e81..1ad5ced 100644 --- a/src/global_asm/code_F56F0.c +++ b/src/global_asm/code_F56F0.c @@ -169,11 +169,11 @@ void func_global_asm_806F0B34(Actor *arg0) { } } -void func_global_asm_806F0C18(Actor *arg0) { - s32 temp_v0; - PlayerAdditionalActorData *temp_v0_2; +// TODO: Why is s16 required in the signature here? u16 breaks the switch case codegen +s16 func_global_asm_80613448(Actor *arg0); - temp_v0 = func_global_asm_80613448(arg0); +void func_global_asm_806F0C18(Actor *arg0) { + s32 temp_v0 = func_global_asm_80613448(arg0); switch (temp_v0) { case 0x1: case 0x2: @@ -212,10 +212,11 @@ void func_global_asm_806F0C18(Actor *arg0) { break; } if (arg0->interactable & 1) { - temp_v0_2 = arg0->additional_actor_data; - if (temp_v0_2->unk8C != 0) { + PlayerAdditionalActorData *aaD; + aaD = arg0->PaaD; + if (aaD->unk8C != 0) { func_global_asm_806F0B34(arg0); - temp_v0_2->unk8C = 0; + aaD->unk8C = 0; } } } diff --git a/src/minecart/code_25F0.c b/src/minecart/code_25F0.c index 7526923..5c07e47 100644 --- a/src/minecart/code_25F0.c +++ b/src/minecart/code_25F0.c @@ -314,7 +314,7 @@ void func_minecart_80026DA8(void) { if (a11C->control_state == 6) { if (current_actor_pointer->unk15F != 0) { current_actor_pointer->unk15F = current_actor_pointer->unk15F - 0xC; - func_global_asm_8061C464(extra_player_info_pointer->unk104, extra_player_info_pointer->vehicle_actor_pointer, 4, (s32) (s16) ((s32) (current_actor_pointer->unk15F << 0xC) / 360), 0x64, 0, 5, 0x23, 0x14, 0, 0.2f); + func_global_asm_8061C464(extra_player_info_pointer->unk104, extra_player_info_pointer->vehicle_actor_pointer, 4, ((current_actor_pointer->unk15F << 0xC) / 360), 0x64, 0, 5, 0x23, 0x14, 0, 0.2f); } } if (a11C->control_state != 6) {