diff --git a/README.md b/README.md index 89f0487b..c1d81df7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (98.9690%) +# banjo (98.9919%) diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 4b9e4c90..1756c95e 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.4207% - 98.4207% + 98.4605% + 98.4605% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index a4567662..6888b26e 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 98.9690% - 98.9690% + 98.9919% + 98.9919% \ No newline at end of file diff --git a/src/core2/code_5BEB0.c b/src/core2/code_5BEB0.c index 6909f77d..46e756a3 100644 --- a/src/core2/code_5BEB0.c +++ b/src/core2/code_5BEB0.c @@ -94,27 +94,32 @@ void mapSavestate_save(enum map_e map){ #define AS_BOOL(expr) ((expr)? TRUE : FALSE) void mapSavestate_apply(enum map_e map_id) { - s32 var_s0 = 0x1F; - u32* t; - u32 aligned_index; + s32 iBit = 0; + u32* flag_ptr; + u32* word_ptr; + ActorListSaveState *actor_list_ptr; + u32 bit_value; if(D_8037E650[map_id] == NULL) return; - t = reinterpret_cast(u32*, D_8037E650[map_id]); - mapSpecificFlags_setAll(*t); - var_s0++; + flag_ptr = reinterpret_cast(u32*, D_8037E650[map_id]); + mapSpecificFlags_setAll(*flag_ptr); + iBit += 8 * sizeof(u32); func_80308230(1); func_803083B0(-1); - - while (func_803083B0( AS_BOOL(((u32*)D_8037E650[map_id])[var_s0 >> 5] & (1 << (var_s0 & 0x1f)))) != -1) { - var_s0++; + + while ( + bit_value = AS_BOOL((((u32*)D_8037E650[map_id])[iBit >> 5] & (1 << (iBit & 0x1f)))), + func_803083B0(bit_value) != -1 + ) { + iBit++; } func_80308230(0); - aligned_index = ((var_s0 + ((1 << 7) - 1)) >> 7); - func_8032A09C(D_8037E650[map_id], (ActorListSaveState *)D_8037E650[map_id] + (aligned_index << 2)); - free((void *)D_8037E650[map_id] ); + actor_list_ptr = (ActorListSaveState *)D_8037E650[map_id] + (((iBit + (0x80 - 1)) >> 7) * 4); + func_8032A09C(D_8037E650[map_id], actor_list_ptr); + free((void*)D_8037E650[map_id] ); D_8037E650[map_id] = NULL; } diff --git a/src/core2/code_B9770.c b/src/core2/code_B9770.c index de44c69d..7d550971 100644 --- a/src/core2/code_B9770.c +++ b/src/core2/code_B9770.c @@ -495,41 +495,40 @@ s32 func_80341C78(s32 arg0[3]) { return -1; } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341D5C.s") -#else -s32 func_80341D5C(s32 arg0[3], s32 arg1[3]){ - int i, j; - struct56s *a0; - f32 (*a2)[3]; - f32 spC[3]; - f32 sp0[3]; - - spC[0] = (f32)arg0[0]; - spC[1] = (f32)arg0[1]; - spC[2] = (f32)arg0[2]; - - sp0[0] = (f32)arg1[0]; - sp0[1] = (f32)arg1[1]; - sp0[2] = (f32)arg1[2]; - - for(i = 0; i < D_80371E78; i++){ - a2 = D_80371E70[i]->unk8; - for(j = 0; j < D_80371E70[i]->unk0; j++){ - if( spC[0] == a2[j][0] - && spC[1] == a2[j][1] - && spC[2] == a2[j][2] - && sp0[0] == a2[j +1][0] - && sp0[1] == a2[j +1][1] - && sp0[2] == a2[j +1][2] - ){ - return i; - } - } +s32 func_80341D5C(s32 arg0[3], s32 arg1[3]) +{ + int i; + int j; + struct56s *a0; + f32 (*a2)[3]; + f32 spC[3]; + f32 sp0[3]; + struct56s *new_var; + spC[0] = (f32) arg0[0]; + spC[1] = (f32) arg0[1]; + spC[2] = (f32) arg0[2]; + sp0[0] = (f32) arg1[0]; + sp0[1] = (f32) arg1[1]; + sp0[2] = (f32) arg1[2]; + for (i = 0; i < D_80371E78; i++) + { + a2 = a0 + 1; + new_var = D_80371E70[i]; + a0 = new_var; + a2 = a0 + 1; + for (j = 0; j < new_var->unk0; j++) + { + if (((spC[0] == a2[j][0]) && (spC[1] == a2[j][1]) && (spC[2] == a2[j][2])) \ + && ((sp0[0] == a2[j + 1][0]) && (sp0[1] == a2[j + 1][1]) && (sp0[2] == a2[j + 1][2]))) + { + return i; + } } - return -1; + + } + + return -1; } -#endif s32 func_80341EC4(f32 arg0[3]){ s32 sp1C[3];