diff --git a/include/animation.h b/include/animation.h index d8561538..7a5ecff3 100644 --- a/include/animation.h +++ b/include/animation.h @@ -13,9 +13,16 @@ void anim_80289798(Animation *this, s32 arg1); void anim_setDuration(Animation *this, f32 arg1); typedef struct { - u8 pad0[40]; + f32 unk0[4]; + f32 unk10[3]; + f32 unk1C[3]; }Struct_B1400; +typedef struct struct_B1400_1_s{ + Struct_B1400 *unk0; + s32 unk4; +}Struct_B1400_1; + typedef union { struct{ diff --git a/include/structs.h b/include/structs.h index 70cade0e..038ebf52 100644 --- a/include/structs.h +++ b/include/structs.h @@ -835,7 +835,7 @@ typedef struct { }Struct7Fs; typedef struct { - s32 unk0; + struct struct_B1400_1_s *unk0; struct animation_file_s *unk4; f32 unk8; f32 unkC; @@ -847,7 +847,7 @@ typedef struct { f32 unk1C; f32 unk20; s32 unk24; - s32 unk28; + struct struct_B1400_1_s *unk28; f32 unk2C; u8 unk30; // u8 pad31[3]; diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 4f52726c..a1daa62a 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 84.8097% - 84.8097% + 84.9582% + 84.9582% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 7b315d35..9e6cc8a7 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 86.4559% - 86.4559% + 86.5411% + 86.5411% \ No newline at end of file diff --git a/src/core1/code_0.c b/src/core1/code_0.c index 81bfeb40..4e719620 100644 --- a/src/core1/code_0.c +++ b/src/core1/code_0.c @@ -100,7 +100,7 @@ void func_8023DC0C(void){ func_80254028(); func_8025AFB0(); func_8033EF58(); - func_8033BB84(); + assetCache_init(); func_8024F05C(); func_80250C84(); func_8023FB1C(); diff --git a/src/core2/code_B1400.c b/src/core2/code_B1400.c index aed93461..3c299f10 100644 --- a/src/core2/code_B1400.c +++ b/src/core2/code_B1400.c @@ -1,7 +1,6 @@ #include #include "functions.h" #include "variables.h" -#include "animation.h" extern void func_8024128C(Mtx *, s32, f32, f32, f32, f32, f32, f32, f32, f32, f32); extern void func_802ED52C(s32, f32[3], f32); @@ -1051,7 +1050,11 @@ int func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f32 scale, } #endif -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A048.s") +BKModelUnk28List *func_8033A048(BKModelBin *arg0){ + if(arg0->unk28 == 0) + return NULL; + return (BKModelUnk28List *)((s32)arg0 + arg0->unk28); +} s32 func_8033A064(void){ return D_80383700; @@ -1115,7 +1118,9 @@ BKVertexList *func_8033A148(BKModelBin *arg0){ return (BKVertexList *)((s32)arg0 + arg0->vtx_list_offset_10); } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A154.s") +BKModelUnk20List *func_8033A154(BKModelBin *arg0){ + return (arg0->unk20 == 0) ? NULL : (BKModelUnk20List *)((s32)arg0 + arg0->unk20); +} s32 func_8033A170(void){ return D_80370990; @@ -1135,16 +1140,12 @@ void func_8033A1A4(void){ D_80383730 = func_802EA154(); } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A1FC.s") -#else void func_8033A1FC(void){ s32 i; for(i = 0; i < 0x2A; i++){ D_80383658[i] = 0; } } -#endif void func_8033A238(s32 arg0){ D_80383700 = arg0; @@ -1273,33 +1274,3 @@ void func_8033A4D8(void){ D_80383730 = func_802EA374(D_80383730); } } - -///BREAk??? - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A510.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A57C.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A5B8.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A670.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A6B0.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A6F0.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A710.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A750.s") - -void func_8033A8F0(Struct_B1400 **arg0, s32 arg1, f32 arg2[4]){ - func_80345250(*arg0 + arg1, arg2); -} - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A928.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A968.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A9A8.s") - -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B1400/func_8033A9E4.s") diff --git a/src/core2/code_B3580.c b/src/core2/code_B3580.c new file mode 100644 index 00000000..a448fcd4 --- /dev/null +++ b/src/core2/code_B3580.c @@ -0,0 +1,128 @@ +#include +#include "functions.h" +#include "variables.h" +#include "animation.h" + + +extern void func_803458E4(f32[4], f32[4], f32[4], f32); + +void func_8033A510(Struct_B1400_1 *arg0) { + Struct_B1400 *end_ptr; + Struct_B1400 *i_ptr; + + i_ptr = arg0->unk0; + end_ptr = i_ptr + arg0->unk4; + for(i_ptr = i_ptr; i_ptr < end_ptr; i_ptr++){ + i_ptr->unk0[0] = i_ptr->unk0[1] = i_ptr->unk0[2] = 0.0f; + i_ptr->unk0[3] = 1.0f; + i_ptr->unk10[0] = i_ptr->unk10[1] = i_ptr->unk10[2] = 1.0f; + i_ptr->unk1C[0] = i_ptr->unk1C[1] = i_ptr->unk1C[2] = 0.0f; + } +} + +void func_8033A57C(Struct_B1400_1 *arg0, s32 arg1, f32 arg2[4]) { + func_80345250(arg2, arg0->unk0[arg1].unk0); + +} + +void func_8033A5B8(Struct_B1400_1 *arg0, s32 arg1, f32 arg2[4], f32 arg3[3], f32 arg4[3]) { + func_80345250(arg2, arg0->unk0[arg1].unk0); + arg3[0] = arg0->unk0[arg1].unk10[0]; + arg3[1] = arg0->unk0[arg1].unk10[1]; + arg3[2] = arg0->unk0[arg1].unk10[2]; + arg4[0] = arg0->unk0[arg1].unk1C[0]; + arg4[1] = arg0->unk0[arg1].unk1C[1]; + arg4[2] = arg0->unk0[arg1].unk1C[2]; +} + +void func_8033A670(Struct_B1400_1 *arg0, s32 arg1, f32 arg2[3]) { + arg2[0] = arg0->unk0[arg1].unk10[0]; + arg2[1] = arg0->unk0[arg1].unk10[1]; + arg2[2] = arg0->unk0[arg1].unk10[2]; +} + +void func_8033A6B0(Struct_B1400_1 *arg0, s32 arg1, f32 arg2[3]) { + arg2[0] = arg0->unk0[arg1].unk1C[0]; + arg2[1] = arg0->unk0[arg1].unk1C[1]; + arg2[2] = arg0->unk0[arg1].unk1C[2]; +} + +void func_8033A6F0(Struct_B1400_1 *arg0){ + free(arg0); +} + +Struct_B1400_1 *func_8033A710(void) { + Struct_B1400_1 *sp1C; + + sp1C = (Struct_B1400_1 *)malloc(sizeof(Struct_B1400_1) + 0x6D*sizeof(Struct_B1400)); + sp1C->unk0 = (Struct_B1400 *) (sp1C + 1); + sp1C->unk4 = 0x6D; + func_8033A510(sp1C); + return sp1C; +} + +//interpolates animation structs? +void func_8033A750(Struct_B1400_1 *arg0, Struct_B1400_1 *arg1, Struct_B1400_1 *arg2, f32 arg3) { + s32 i; + s32 cnt; + Struct_B1400 *start_ptr; + Struct_B1400 *end_ptr; + Struct_B1400 *i_ptr; + Struct_B1400 *j_ptr; + Struct_B1400 *k_ptr; + + start_ptr = arg0->unk0; + j_ptr = arg1->unk0; + k_ptr = arg2->unk0; + end_ptr = start_ptr + arg0->unk4; + for(i_ptr = start_ptr; i_ptr < end_ptr; i_ptr++, j_ptr++, k_ptr++){ + if( (j_ptr->unk0[0] == k_ptr->unk0[0]) + && (j_ptr->unk0[1] == k_ptr->unk0[1]) + && (j_ptr->unk0[2] == k_ptr->unk0[2]) + && (j_ptr->unk0[3] == k_ptr->unk0[3]) + ) { + i_ptr->unk0[0] = j_ptr->unk0[0]; + i_ptr->unk0[1] = j_ptr->unk0[1]; + i_ptr->unk0[2] = j_ptr->unk0[2]; + i_ptr->unk0[3] = j_ptr->unk0[3]; + } else { + func_803458E4(i_ptr, j_ptr, k_ptr, arg3); + } + i_ptr->unk10[0] = j_ptr->unk10[0] + ((k_ptr->unk10[0] - j_ptr->unk10[0]) * arg3); + i_ptr->unk10[1] = j_ptr->unk10[1] + ((k_ptr->unk10[1] - j_ptr->unk10[1]) * arg3); + i_ptr->unk10[2] = j_ptr->unk10[2] + ((k_ptr->unk10[2] - j_ptr->unk10[2]) * arg3); + i_ptr->unk1C[0] = j_ptr->unk1C[0] + ((k_ptr->unk1C[0] - j_ptr->unk1C[0]) * arg3); + i_ptr->unk1C[1] = j_ptr->unk1C[1] + ((k_ptr->unk1C[1] - j_ptr->unk1C[1]) * arg3); + i_ptr->unk1C[2] = j_ptr->unk1C[2] + ((k_ptr->unk1C[2] - j_ptr->unk1C[2]) * arg3); + } +} + + +void func_8033A8F0(Struct_B1400_1 *arg0, s32 arg1, f32 arg2[4]){ + func_80345250(&arg0->unk0[arg1], arg2); +} + +void func_8033A928(Struct_B1400_1 *arg0, s32 arg1, f32 arg2[3]) { + arg0->unk0[arg1].unk10[0] = arg2[0]; + arg0->unk0[arg1].unk10[1] = arg2[1]; + arg0->unk0[arg1].unk10[2] = arg2[2]; +} + +void func_8033A968(Struct_B1400_1 *arg0, s32 arg1, f32 arg2[3]) { + arg0->unk0[arg1].unk1C[0] = arg2[0]; + arg0->unk0[arg1].unk1C[1] = arg2[1]; + arg0->unk0[arg1].unk1C[2] = arg2[2]; +} + +void func_8033A9A8(Struct_B1400_1 *arg0, s32 arg1, f32 arg2[4]){ + f32 sp18[4]; + func_80345C78(sp18, arg2); + func_8033A8F0(arg0, arg1, sp18); +} + +Struct_B1400_1 * func_8033A9E4(Struct_B1400_1 *arg0){ + Struct_B1400_1 *var_v0; + var_v0 = (Struct_B1400_1 *)defrag(arg0); + var_v0->unk0 = (Struct_B1400 *)(var_v0 + 1); + return var_v0; +} diff --git a/src/core2/code_B3A80.c b/src/core2/code_B3A80.c index d2af33a8..e1f832ce 100644 --- a/src/core2/code_B3A80.c +++ b/src/core2/code_B3A80.c @@ -210,7 +210,7 @@ bool func_8033B338(void **sprite_ptr, BKSpriteDisplayData **arg1) { *sprite_ptr = NULL; *arg1 = NULL; - if(sprite_ptr); + // if(sprite_ptr); return TRUE; } @@ -399,7 +399,7 @@ void func_8033BB00(void *arg0, s32 arg1){ } //assetCache_init -void func_8033BB84(void){ +void assetCache_init(void){ D_80370A1C = 0; func_8033B180(); D_80383CD0 = malloc(600); @@ -475,9 +475,8 @@ void *func_8033BDAC(enum asset_e id, void *dst, s32 size) { if (phi_v0 == 0x96) { return 0; } - temp_v1_2 = D_80383CC4[id].offset; - comp_size = D_80383CC4[id + 1].offset; - temp_v1_2; - phi_v1 = temp_v1_2; + phi_v1 = D_80383CC4[id].offset; + comp_size = D_80383CC4[id + 1].offset - phi_v1; if (comp_size & 1) { comp_size++; } diff --git a/subyaml/core2.us.v10.yaml b/subyaml/core2.us.v10.yaml index f77e7d99..ad3ea8f4 100644 --- a/subyaml/core2.us.v10.yaml +++ b/subyaml/core2.us.v10.yaml @@ -332,6 +332,7 @@ segments: - [0xAE5D0, c, code_AE5D0] #DONE - [0xAEDA0, c, code_AEDA0] - [0xB1400, c, code_B1400] + - [0xB3580, c, code_B3580] #DONE - [0xB3A80, c, code_B3A80] - [0xB5040, c, code_B5040] #DONE - [0xB5E00, c, code_B5E00]