core2/code_B3A80.c done

This commit is contained in:
Banjo Kazooie
2022-11-08 18:38:55 -06:00
parent ddbc35423b
commit dffb1f1698
5 changed files with 43 additions and 54 deletions

View File

@@ -1,4 +1,4 @@
# banjo (93.6257%) # banjo (93.7175%)
<img src="./progress/progress_total.svg"> <img src="./progress/progress_total.svg">

View File

@@ -17,7 +17,7 @@
<text x="22.0" y="14">core2</text> <text x="22.0" y="14">core2</text>
</g> </g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="78.5" y="15" fill="#010101" fill-opacity=".3">92.0874%</text> <text x="78.5" y="15" fill="#010101" fill-opacity=".3">92.2473%</text>
<text x="77.5" y="14">92.0874%</text> <text x="77.5" y="14">92.2473%</text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -9,7 +9,7 @@
</mask> </mask>
<g mask="url(#anybadge_1)"> <g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h150v20H0z"/> <path fill="#555" d="M0 0h150v20H0z"/>
<path fill="#1de000" d="M150 0h67v20H150z"/> <path fill="#1ce000" d="M150 0h67v20H150z"/>
<path fill="url(#b)" d="M0 0h217v20H0z"/> <path fill="url(#b)" d="M0 0h217v20H0z"/>
</g> </g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
@@ -17,7 +17,7 @@
<text x="75.0" y="14">Banjo-Kazooie (us.v10)</text> <text x="75.0" y="14">Banjo-Kazooie (us.v10)</text>
</g> </g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="184.5" y="15" fill="#010101" fill-opacity=".3">93.6257%</text> <text x="184.5" y="15" fill="#010101" fill-opacity=".3">93.7175%</text>
<text x="183.5" y="14">93.6257%</text> <text x="183.5" y="14">93.7175%</text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -94,9 +94,6 @@ s32 func_8033AC30(AnimationFile *this){
return this->elem_cnt; return this->elem_cnt;
} }
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B3A80/func_8033AC38.s")
#else
f32 func_8033AC38(AnimationFile *this, AnimationFileElement *elem, f32 arg2){ f32 func_8033AC38(AnimationFile *this, AnimationFileElement *elem, f32 arg2){
AnimationFileData *var_a0; AnimationFileData *var_a0;
AnimationFileData *var_a2; AnimationFileData *var_a2;
@@ -112,7 +109,7 @@ f32 func_8033AC38(AnimationFile *this, AnimationFileElement *elem, f32 arg2){
sp38[3] = (var_a2->unk0_15 == 1 && elem->data_cnt >= 2) ? (f32)(var_a2 + 1)->unk2/64 : sp38[2]; sp38[3] = (var_a2->unk0_15 == 1 && elem->data_cnt >= 2) ? (f32)(var_a2 + 1)->unk2/64 : sp38[2];
return func_80340A4C((arg2 - this->unk0)/(var_a2->unk0_13 - this->unk0), 4, sp38); return func_80340A4C((arg2 - this->unk0)/(var_a2->unk0_13 - this->unk0), 4, sp38);
} }
var_a0 = &elem->data[elem->data_cnt-1]; var_a0 = var_a2 + elem->data_cnt;
var_a0--; var_a0--;
if ((s32) arg2 >= (var_a0->unk0_13)) { if ((s32) arg2 >= (var_a0->unk0_13)) {
sp38[1] = (f32) var_a0->unk2 / 64; sp38[1] = (f32) var_a0->unk2 / 64;
@@ -128,25 +125,25 @@ f32 func_8033AC38(AnimationFile *this, AnimationFileElement *elem, f32 arg2){
var_v0 = &var_a2[(var_a0 - var_a2)/2]; var_v0 = &var_a2[(var_a0 - var_a2)/2];
if (var_v0->unk0_13 <= (s32)arg2) { if (var_v0->unk0_13 <= (s32)arg2) {
var_a2 = var_v0; var_a2 = var_v0;
var_v0 = var_v0 + 1; if (!var_a2);
} else { } else {
var_a0 = var_v0; var_a0 = var_v0;
var_v0 = var_a2 + 1;
} }
var_v0 = var_a2 + 1;
} }
sp38[1] = (f32) var_a2->unk2 / 64; sp38[1] = (f32) var_a2->unk2 / 64;
sp38[2] = (f32) var_a0->unk2 / 64; sp38[2] = (f32) var_a0->unk2 / 64;
temp_f12 = (arg2 - var_a2->unk0_13) / (var_a0->unk0_13 - var_a2->unk0_13); temp_f12 = (arg2 - var_a2->unk0_13) / (var_a0->unk0_13 - var_a2->unk0_13);
if ((var_a2->unk0_14 == 0) && (var_a0->unk0_15 == 0)) { if ((var_a2->unk0_14 == 0) && (var_a0->unk0_15 == 0)) {
return ((sp38[2] - sp38[1]) * temp_f12) + sp38[1]; return sp38[1] + ((sp38[2] - sp38[1]) * temp_f12);
} }
sp38[0] = (var_a2->unk0_14 == 1 && (var_a2 - 1) >= &elem->data[0]) ? (f32)(var_a2 - 1)->unk2/64 : sp38[1]; sp38[0] = (var_a2->unk0_14 == 1 && (var_a2 - 1) >= &elem->data[0]) ? (f32)(var_a2 - 1)->unk2/64 : sp38[1];
sp38[3] = (var_a0->unk0_15 == 1 && (var_a0 + 1) < &elem->data[elem->data_cnt]) ? (f32)(var_a0 + 1)->unk2/64 : sp38[2]; sp38[3] = (var_a0->unk0_15 == 1 && (var_a0 + 1) < &elem->data[elem->data_cnt]) ? (f32)(var_a0 + 1)->unk2/64 : sp38[2];
return func_80340A4C(temp_f12, 4, sp38); return func_80340A4C(temp_f12, 4, sp38);
} }
#endif
void func_8033AFB8(Struct_B1400 *arg0, s32 arg1, f32 arg2[3][3]){ void func_8033AFB8(Struct_B1400 *arg0, s32 arg1, f32 arg2[3][3]){
f32 sp18[4]; f32 sp18[4];
@@ -475,28 +472,14 @@ void func_8033BD8C(void* arg0){
func_8033B0D0(arg0); func_8033B0D0(arg0);
} }
#ifndef NONMATCHING s32 func_8033BDAC(enum asset_e id, void *dst, s32 size) {
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B3A80/func_8033BDAC.s")
#else
void *func_8033BDAC(enum asset_e id, void *dst, s32 size) {
s32 comp_size; s32 comp_size;
u8 sp2B; s32 var_s0;
s32 aligned_decomp_size; s32 sp34;
s32 sp20;
s16 *temp_a0;
s32 temp_s0;
s32 temp_s1;
s32 temp_t0;
s32 temp_v0;
s32 temp_v0_3;
s32 temp_v1_2;
s32 temp_v1_3;
u8 temp_v1;
void *temp_v0_2;
s32 phi_v0; s32 phi_v0;
s8 phi_v0_2; s32 comp_ptr;
s32 decomp_ptr; u8 sp2B;
s32 phi_v1; s32 sp20;
//find asset in cache //find asset in cache
for(phi_v0 = 0; phi_v0 < D_80370A14 && id != D_80383CDC[phi_v0]; phi_v0++); for(phi_v0 = 0; phi_v0 < D_80370A14 && id != D_80383CDC[phi_v0]; phi_v0++);
@@ -504,48 +487,54 @@ void *func_8033BDAC(enum asset_e id, void *dst, s32 size) {
if (phi_v0 == 0x96) { if (phi_v0 == 0x96) {
return 0; return 0;
} }
phi_v1 = D_80383CC4[id].offset; comp_ptr = D_80383CC4[id + 1].offset - D_80383CC4[id].offset;
comp_size = D_80383CC4[id + 1].offset - phi_v1; if (comp_ptr & 1) {
if (comp_size & 1) { comp_ptr++;
comp_size++;
} }
sp34 = comp_ptr;
if (D_80383CC4[id].compFlag & 1) { if (D_80383CC4[id].compFlag & 1) {
func_8033BAB0(id, 0, 0x10, &D_80383CB0); func_8033BAB0(id, 0, 0x10, &D_80383CB0);
D_80370A10 = rarezip_get_uncompressed_size(&D_80383CB0); D_80370A10 = rarezip_get_uncompressed_size(&D_80383CB0);
// get aligned uncompressed size // get aligned uncompressed size
aligned_decomp_size = D_80370A10; var_s0 = D_80370A10;
if (aligned_decomp_size & 0xF) { if (var_s0 & 0xF) {
aligned_decomp_size = (aligned_decomp_size - (aligned_decomp_size & 0xF)) + 0x10; var_s0 = (var_s0 - (var_s0 & 0xF)) + 0x10;
} }
if (size >= (comp_size + aligned_decomp_size)) { if (size >= (comp_ptr + var_s0)) {
sp2B = 1; sp2B = 1;
decomp_ptr = (s32)dst + aligned_decomp_size; comp_ptr = (s32)dst + var_s0;
} }
else if(size >= aligned_decomp_size) { else if(size >= var_s0) {
sp2B = 2; sp2B = 2;
decomp_ptr = malloc(size); comp_ptr = malloc(comp_ptr);
} }
else{ else{
return 0; return 0;
} }
} }
else{ else{
if (comp_size & (0x10 -1)) { var_s0 = comp_ptr;
comp_size = (comp_size - (comp_size & (0x10 -1))) + 0x10; if(comp_ptr & (0x10 -1))
var_s0 = (comp_ptr - (comp_ptr & (0x10 -1))) + 0x10;
if(size >= comp_ptr){
comp_ptr = dst;
} }
if(size < comp_size) else{
return 0; return 0;
} }
func_802405F0(decomp_ptr, D_80383CC4[id].offset + D_80383CCC, comp_size); }
comp_size = D_80383CC4[id].offset + D_80383CCC;
func_802405F0(comp_ptr, comp_size, sp34);
if (D_80383CC4[id].compFlag & 1) { if (D_80383CC4[id].compFlag & 1) {
rarezip_inflate(decomp_ptr, dst); rarezip_inflate(comp_ptr, dst);
osWritebackDCache(dst, D_80370A10); osWritebackDCache(dst, D_80370A10);
if (sp2B == 2) { if (sp2B == 2) {
free(decomp_ptr); free(comp_ptr);
} }
} }
return decomp_ptr; return var_s0;
} }
#endif

View File

@@ -333,7 +333,7 @@ segments:
- [0xAEDA0, c, code_AEDA0] - [0xAEDA0, c, code_AEDA0]
- [0xB1400, c, code_B1400] - [0xB1400, c, code_B1400]
- [0xB3580, c, code_B3580] #DONE - [0xB3580, c, code_B3580] #DONE
- [0xB3A80, c, code_B3A80] - [0xB3A80, c, code_B3A80] #DONE
- [0xB5040, c, code_B5040] #DONE - [0xB5040, c, code_B5040] #DONE
- [0xB5E00, c, code_B5E00] #DONE - [0xB5E00, c, code_B5E00] #DONE
- [0xB62B0, c, code_B62B0] #DONE - [0xB62B0, c, code_B62B0] #DONE