diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 901afb21..4f52726c 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 84.6613% - 84.6613% + 84.8097% + 84.8097% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index c64fe34a..7b315d35 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 86.3708% - 86.3708% + 86.4559% + 86.4559% \ No newline at end of file diff --git a/src/core2/code_B7B20.c b/src/core2/code_B7B20.c index 42ca3626..0520db10 100644 --- a/src/core2/code_B7B20.c +++ b/src/core2/code_B7B20.c @@ -3,14 +3,77 @@ #include "variables.h" -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B7B20/func_8033EAB0.s") +void func_8033EAB0(s32 arg0[3], s32 arg1[3], s32 arg2[3], s32 arg3[3]) { + s32 i; + for(i = 0; i < 3; i++){ + arg0[i] = arg2[i]; + arg1[i] = arg3[i]; + } +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B7B20/func_8033EAF8.s") +s32 func_8033EAF8(s32 arg0[3], s32 arg1[3], f32 arg2[3], f32 arg3[3]) { + f32 sp14[3]; + f32 temp_f2; + f32 var_f0; + s32 var_a0; + s32 var_v0; + s32 var_v1; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B7B20/func_8033EC10.s") + var_f0 = 0.0f; + for(var_v0 = 0; var_v0 < 2; var_v0++){ + for(var_v1 = 0; var_v1 < 2; var_v1++){ + for(var_a0 = 0; var_a0 < 2; var_a0++){ + sp14[0] = (f32)((var_v0) ? arg0[0] : arg1[0]) - arg2[0]; + sp14[1] = (f32)((var_v1) ? arg0[1] : arg1[1]) - arg2[1]; + sp14[2] = (f32)((var_a0) ? arg0[2] : arg1[2]) - arg2[2]; + temp_f2 = (arg3[0] * sp14[0]) + (arg3[1] * sp14[1]) + (arg3[2] * sp14[2]); + if (var_f0 < temp_f2) { + var_f0 = temp_f2; + } + } + } + } + return (s32) var_f0; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B7B20/func_8033EC70.s") +bool func_8033EC10(s32 arg0[3], s32 arg1[3], s32 arg2[3]) { + s32 i; + for(i = 0; i < 3; i++){ + if (arg0[i] >= arg2[i]) { + return FALSE; + } + if (arg2[i] >= arg1[i]) { + return FALSE; + } + } + return TRUE; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B7B20/func_8033ECD8.s") +bool func_8033EC70(s32 arg0[3], s32 arg1[3], s32 arg2[3], s32 arg3) { + s32 i; + for(i = 0; i < 3; i++){ + if (arg0[i] >= (arg2[i] + arg3)) { + return FALSE; + } + if ((arg2[i] - arg3) >= arg1[i]) { + return FALSE; + } + } + return TRUE; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B7B20/func_8033EDF0.s") +void func_8033ECD8(s32 arg0[3], s32 arg1[3], s32 arg2) { + s32 i; + for(i = 0; i < 3; i++){ + arg0[i] = (arg0[i] >= 0) ? arg0[i]/ arg2 : arg0[i]/ arg2 - 1; + arg1[i] = (arg1[i] >= 0) ? arg1[i]/ arg2 : arg1[i]/ arg2 - 1; + } +} + +void func_8033EDF0(s32 arg0[3], s32 arg1[3], f32 arg2[3]) { + s32 i; + for(i = 0; i < 3; i++){ + arg0[i] += arg2[i]; + arg1[i] += arg2[i]; + } +} diff --git a/src/core2/code_B8080.c b/src/core2/code_B8080.c index 71aaf724..18db99d6 100644 --- a/src/core2/code_B8080.c +++ b/src/core2/code_B8080.c @@ -186,8 +186,8 @@ BKModel *func_8033F5F8(BKMeshList *arg0, BKVertexList *arg1) { sp40 = (BKModel *)malloc((func_802E9F60() * sizeof(BKVtxRef)) + (arg0->meshCount_0 * sizeof(BKMesh)) + sizeof(BKModel)); sp40->meshList_0 = arg0; sp40->vtxList_4 = arg1; - phi_s3 = arg0 + 1; - phi_s5 = (sp40 + 1); + phi_s3 = (BKMesh *)(arg0 + 1); + phi_s5 = (BKMesh *)(sp40 + 1); for(phi_s6 = 0; phi_s6 < arg0->meshCount_0; phi_s6++){ phi_s5->uid_0 = (s16) phi_s3->uid_0; phi_s5->vtxCount_2 = (s16) phi_s3->vtxCount_2; @@ -195,10 +195,10 @@ BKModel *func_8033F5F8(BKMeshList *arg0, BKVertexList *arg1) { phi_s0 = (BKVtxRef *)(phi_s5 + 1); for(phi_s1 = 0; phi_s1 < phi_s3->vtxCount_2; phi_s1++){ phi_s0[phi_s1].unk10 = phi_s2[phi_s1]; - memcpy(&phi_s0->v, arg1 + (phi_s0->unk10 * sizeof(Vtx)) + sizeof(BKVertexList), sizeof(Vtx)); + memcpy(&phi_s0->v, (Vtx *)(arg1 + 1) + phi_s0->unk10, sizeof(Vtx)); } - phi_s3 = (s32)phi_s3 + (phi_s3->vtxCount_2 * sizeof(Vtx)) + sizeof(BKMesh); - phi_s5 = (s32)phi_s5 + (phi_s5->vtxCount_2 * sizeof(BKVtxRef)) + sizeof(BKMesh); + phi_s3 = (BKMesh *)((Vtx *)(phi_s3 + 1) + phi_s3->vtxCount_2); + phi_s3 = (BKMesh *)((BKVtxRef *)(phi_s5 + 1) + phi_s5->vtxCount_2); } return sp40; } diff --git a/src/core2/code_C3B20.c b/src/core2/code_C3B20.c index 1a6803fa..899139ae 100644 --- a/src/core2/code_C3B20.c +++ b/src/core2/code_C3B20.c @@ -113,13 +113,11 @@ void func_8034ADB4(Struct61s *arg0, s32 *arg1, s32 cnt){ } } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_C3B20/func_8034AE08.s") -#else void func_8034AE08(Struct61s *arg0, void *arg1, s32 arg2) { - u32 capacity; u32 curr_offset; + u32 capacity; u32 end_ptr; + u32 var_v0; if (arg0->unk14 == 2) { //read asset memcpy(arg1, arg0->unk4, arg2); @@ -130,22 +128,21 @@ void func_8034AE08(Struct61s *arg0, void *arg1, s32 arg2) { arg0->unkC = (void *) ((u32)arg0->unkC + arg2); } else if (arg0->unk14 == 4) { // write bin??? - if ((u32)arg0->unk10 < (u32)arg0->unkC + arg2) { - curr_offset = (u32)arg0->unkC - (u32)arg0->unk8; - capacity = ((u32)arg0->unk10 - (u32)arg0->unk8); - capacity *= 2; - while (((u32)arg0->unk8 + capacity) < (u32)arg0->unkC + arg2) { + if ((u8*)arg0->unk10 < (u8*)arg0->unkC + arg2) { + curr_offset = (u8*)arg0->unkC - (u8*)arg0->unk8; + capacity = ((u8*)arg0->unk10 - (u8*)arg0->unk8)*2; + while (((u8*)arg0->unk8 + capacity) < (u8*)arg0->unkC + arg2) { capacity *= 2; } - arg0->unk8 = realloc(arg0->unk8, capacity); - arg0->unkC = (u32)arg0->unk8 + curr_offset; - arg0->unk10 = (u32)arg0->unk8 + capacity; + var_v0 = realloc(arg0->unk8, capacity); + arg0->unk8 = var_v0; + arg0->unkC = var_v0 + curr_offset; + arg0->unk10 = var_v0 + capacity; } memcpy(arg0->unkC, arg1, arg2); arg0->unkC = (u32)arg0->unkC + arg2; } } -#endif void func_8034AF24(Struct61s *arg0, s16 *arg1){ func_8034AE08(arg0, arg1, sizeof(s16)); diff --git a/subyaml/core2.us.v10.yaml b/subyaml/core2.us.v10.yaml index 6f623d59..f77e7d99 100644 --- a/subyaml/core2.us.v10.yaml +++ b/subyaml/core2.us.v10.yaml @@ -341,7 +341,7 @@ segments: - [0xB6C60, c, code_B6C60] #DONE - [0xB6CE0, c, code_B6CE0] #DONE - [0xB6EA0, c, code_B6EA0] #DONE - - [0xB7B20, c, code_B7B20] + - [0xB7B20, c, code_B7B20] #DONE - [0xB7F40, c, code_B7F40] #DONE - [0xB8020, c, code_B8020] #DONE - [0xB8070, c, code_B8070] #DONE @@ -361,7 +361,7 @@ segments: - [0xC31A0, c, code_C31A0] #DONE - [0xC3400, c, rand] #DONE - [0xC3A40, c, code_C3A40] #DONE - - [0xC3B20, c, code_C3B20] + - [0xC3B20, c, code_C3B20] #DONE - [0xC4320, c, code_C4320] #DONE - [0xC4F40, c, code_C4F40] #DONE - [0xC5440, c, code_C5440] #DONE