From 87b779d7126f6d95b299423e03948c567df6ddfc Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Thu, 29 Sep 2022 22:18:49 -0500 Subject: [PATCH] core2/code_B5E00.c progress --- README.md | 2 +- progress/progress_core2.svg | 4 ++-- progress/progress_total.svg | 6 +++--- src/core2/code_6DA30.c | 43 ++++++++++++++++++++----------------- src/core2/code_AC520.c | 7 +++--- src/core2/code_B5E00.c | 39 ++++++++++++++++----------------- src/core2/code_D89E0.c | 2 +- subyaml/core2.us.v10.yaml | 2 +- 8 files changed, 52 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 7e103dca..e46c468a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (88.9275%) +# banjo (88.9659%) diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index abca599b..50885ec2 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 87.7140% - 87.7140% + 87.7809% + 87.7809% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 7836d0b0..71d05da0 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 88.9275% - 88.9275% + 88.9659% + 88.9659% \ No newline at end of file diff --git a/src/core2/code_6DA30.c b/src/core2/code_6DA30.c index 04b97a05..9c575969 100644 --- a/src/core2/code_6DA30.c +++ b/src/core2/code_6DA30.c @@ -111,29 +111,32 @@ enum asset_e func_802F49C0(void){ } // this function reassigns the referenced font mask pixel -// using the texture @ pixel (x,y) -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6DA30/func_802F4A24.s") -/*void func_802F4A24(BKSpriteTextureBlock *arg0, u32 *arg1, s32 arg2, s32 arg3) { - s32 temp_lo; - s32 temp_t0; - u32 red; - u32 blue; - u32 green; - u32 alpha; - s32 _x = MIN(MAX(0, arg2), arg0->w - 1); - s32 _y = MIN(MAX(0, arg3), arg0->h - 1); - - temp_t0 = ((u16 *) (arg0 + 1))[_x + _y * arg0->w]; +// using the texture @ pixel (x,y) +void func_802F4A24(BKSpriteTextureBlock *texture, u32 *font, s32 x, s32 y) { + u16 *var_v0; + s32 r5; + s32 g5; + s32 b5; + s32 a8; + s32 i8; + x = MIN(MAX(0, x), texture->w - 1); + y = MIN(MAX(0, y), texture->h - 1); - if(temp_t0); - blue = ((temp_t0 >> 1) & ((1<< 5) - 1)); - green = ((temp_t0 >> 6) & ((1<< 5) - 1)); - red = ((temp_t0 >> 11) & ((1<< 5) - 1)); - temp_lo = (s32) ((*arg1 >> 11) & 0xFF) / 0x1F; + var_v0 = ((u16*)(texture + 1)) + x + y * texture->w; + r5 = ((*var_v0 >> 11) & 0x1F); + g5 = ((*var_v0 >> 6) & 0x1F); + b5 = ((*var_v0 >> 1) & 0x1F); + + a8 = (*font >> 0) & 0xff; + i8 = (*font >> 8) & 0xff; - *arg1 = (( ((red * temp_lo) << 0x18) | ((green * temp_lo) << 0x10)) | ((blue * temp_lo) << 8)) | (*arg1 & 0xff); -}//*/ + r5*=(i8/ 0x1F); + g5*=(i8/ 0x1F); + b5*=(i8/ 0x1F); + + *font = (r5 << 0x18) | (g5 << 0x10) | (b5 << 8) | (a8 << 0); +} //this function applies the texture to the font alpha mask. void func_802F4B58(BKSpriteTextureBlock *alphaMask, BKSpriteTextureBlock *texture){ diff --git a/src/core2/code_AC520.c b/src/core2/code_AC520.c index 30be88ed..f441b2d3 100644 --- a/src/core2/code_AC520.c +++ b/src/core2/code_AC520.c @@ -237,7 +237,6 @@ void func_80333D48(BKVertexList *arg0, f32 position[3], f32 rotation[3], f32 sca f32 sp68[3]; Struct_core2_AC520_0 *struct_ptr; f32 temp_f0; - s8* tmp; func_803334B0(position, rotation, scale, arg4, func_802EC920(arg0)); if (D_80383570.unk44 == (&D_80383570.unk4[0])) { @@ -246,7 +245,7 @@ void func_80333D48(BKVertexList *arg0, f32 position[3], f32 rotation[3], f32 sca } ref_ptr = vtxList_getVertices(arg5); func_802EC8FC(arg0, &i_ptr, &end_ptr); - for(; i_ptr < end_ptr; i_ptr++, ref_ptr++){ + for(i_ptr = i_ptr; i_ptr < end_ptr; i_ptr++, ref_ptr++){ sp68[0] = sp68[1] = sp68[2] = 0.0f; sp74[0] = ref_ptr->v.ob[0];\ @@ -269,10 +268,10 @@ void func_80333D48(BKVertexList *arg0, f32 position[3], f32 rotation[3], f32 sca } } } - + i_ptr->v.cn[0] = (s8)((ref_ptr->v.cn[0]*sp68[0])/256.0); i_ptr->v.cn[1] = (s8)((ref_ptr->v.cn[1]*sp68[1])/256.0); i_ptr->v.cn[2] = (s8)((ref_ptr->v.cn[2]*sp68[2])/256.0); } } -#endif; +#endif diff --git a/src/core2/code_B5E00.c b/src/core2/code_B5E00.c index 24afd639..107bdf53 100644 --- a/src/core2/code_B5E00.c +++ b/src/core2/code_B5E00.c @@ -66,45 +66,42 @@ void func_8033CE40(void) { } #endif -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B5E00/func_8033CFD4.s") -#else -int func_8033CFD4(s32 gamenum){ - s32 prev = D_80383F00[gamenum]; - s32 next = D_80383F04; - u32 i; +s32 func_8033CFD4(s32 gamenum){ + s32 next; + s32 var_s3; + u32 i = 3; s32 tmp_s1; - SaveData *tmp_s2; + SaveData *var_a1; - D_80383F00[gamenum] = next; - bcopy(&D_80383D20[D_80383F00[prev]], &D_80383D20[next], 0x78); - tmp_s2 = &D_80383D20[D_80383F04]; - tmp_s2->unk1 = gamenum + 1; - savedata_update_crc(tmp_s2, 0x78); - for(i = 3; i > 0; i--){//L8033D070 - tmp_s1 = func_8033CC98(next, tmp_s2); + + var_s3 = D_80383F04; + next = D_80383F00[gamenum]; + D_80383F00[gamenum] = D_80383F04; + bcopy(&D_80383D20[next], &D_80383D20[var_s3], 0x78); + var_a1 = D_80383D20 + var_s3; + var_a1->unk1 = gamenum + 1; + savedata_update_crc(var_a1, sizeof(SaveData)); + for(tmp_s1 = 1; tmp_s1 && i > 0; i--){//L8033D070 + tmp_s1 = func_8033CC98(var_s3, var_a1); if(!tmp_s1){ func_8033CE14(gamenum); } - if(!tmp_s1) - break; } if(!tmp_s1){ for(i = 3; i > 0; i--){//L8033D070 - tmp_s1 = func_8033CCD0(prev); + tmp_s1 = func_8033CCD0(next); if(!tmp_s1) break; } } if(tmp_s1){ - D_80383F00[gamenum] = prev; + D_80383F00[gamenum] = next; } else{ - D_80383F04 = prev; + D_80383F04 = next; } return tmp_s1; } -#endif void func_8033D0FC(s32 gamenum){ s32 filenum = D_80383F00[gamenum]; diff --git a/src/core2/code_D89E0.c b/src/core2/code_D89E0.c index 3284cd17..c3f4337f 100644 --- a/src/core2/code_D89E0.c +++ b/src/core2/code_D89E0.c @@ -291,7 +291,7 @@ f32 func_803603AC(Actor *this, s32 arg1, u8 arg2){ sp2C[2] = (this->position[2] - sp20[2]); den =(sp2C[0]*sp2C[0] + sp2C[2]*sp2C[2]); - if(den); + // if(den); num = (sp2C[1] - arg1); if(num == 0.0 || den == 0.0) return 0.0f; diff --git a/subyaml/core2.us.v10.yaml b/subyaml/core2.us.v10.yaml index d76923ac..c418e22d 100644 --- a/subyaml/core2.us.v10.yaml +++ b/subyaml/core2.us.v10.yaml @@ -84,7 +84,7 @@ segments: - [0x13900, c, code_13900] #DONE - [0x13A00, c, code_13A00] #DONE - [0x13FC0, c, code_13FC0] #DONE - - [0x13FC0, c, code_14420] #DONE + - [0x14420, c, code_14420] #DONE - [0x15F20, c, code_15F20] #DONE - [0x16010, c, code_16010] #DONE - [0x16C60, c, code_16C60] #DONE