From 8f493432e5090aa02653a4f90ee25092491a840a Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 4 May 2024 21:37:09 -0500 Subject: [PATCH] Progress update (98.8633%) --- README.md | 2 +- progress/progress_core1.svg | 6 ++-- progress/progress_core2.svg | 4 +-- progress/progress_total.svg | 6 ++-- src/core1/code_0.c | 41 ++++++++++++-------------- src/core1/code_13990.c | 58 +++++++++++++++++++++++-------------- src/core1/code_2BD0.c | 18 +++++------- src/core2/code_BEF20.c | 31 ++++++++------------ 8 files changed, 82 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index 86eedbba..1b9e3f03 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (98.6934%) +# banjo (98.8633%) diff --git a/progress/progress_core1.svg b/progress/progress_core1.svg index 64b21518..86e5696c 100644 --- a/progress/progress_core1.svg +++ b/progress/progress_core1.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core1 - 98.4321% - 98.4321% + 99.1399% + 99.1399% \ No newline at end of file diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 609fff7c..7b8a9d65 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.1193% - 98.1193% + 98.2363% + 98.2363% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 4f542984..6f9ee442 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 98.6934% - 98.6934% + 98.8633% + 98.8633% \ No newline at end of file diff --git a/src/core1/code_0.c b/src/core1/code_0.c index 6b8b87d3..61e7c179 100644 --- a/src/core1/code_0.c +++ b/src/core1/code_0.c @@ -129,18 +129,12 @@ void func_8023DCF4(void){ D_80275618--; } - - -#ifndef NOMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_0/mainLoop.s") -#else void mainLoop(void){ - s32 x; - s32 y; - s32 r; - s32 g; - s32 b; + s32 x, y; + s32 r, g, b, a; + u16 tmp; u16 rgba; + s32 offset; if((func_8023DB5C() & 0x7f) == 0x11) sns_write_payload_over_heap(); @@ -182,23 +176,24 @@ void mainLoop(void){ ){ s32 offset; //render weird CRC failure image - for(x= 0x1e; x< framebuffer_height - 0x1e; x++){//L8023DEB4 - g = x >> 3; - for(y = 0x14; y < 0xeb; y++){ - b = ((func_8023DB5C() << 3) + y*y + x*x) >> 3; - r = y >> 3; - rgba = _SHIFTL(b, 1, 5); - rgba |= _SHIFTL(r, 11, 5 ); - rgba |= _SHIFTL(g, 6, 5); - rgba |= _SHIFTL(1, 0, 1 ); - offset = ((framebuffer_width - 0xff)/2 + y + x*framebuffer_width); - D_803A5D00[0][offset] = rgba; - D_803A5D00[1][offset] = rgba; + for(y= 0x1e; y < framebuffer_height - 0x1e; y++){//L8023DEB4 + for(x = 0x14; x < 0xeb; x++){ + tmp = ((8 * func_8023DB5C()) + ((x*x) + (y*y))); + + r = _SHIFTL(x>>3, 11, 5); + g = _SHIFTL(y>>3, 6, 5); + b = _SHIFTL(tmp>>3, 1, 5); + a = 1; + + rgba = b | r | g | a; + + offset = ((framebuffer_width - 0xFF) / 2) + x + (y*framebuffer_width); + D_803A5D00[0][offset] = (s32) rgba; + D_803A5D00[1][offset] = (s32) rgba; } } }//L8023DF70 } -#endif void __mainMethod(void *arg0){ core1_init(); diff --git a/src/core1/code_13990.c b/src/core1/code_13990.c index 1df9f7b8..37aa7aa8 100644 --- a/src/core1/code_13990.c +++ b/src/core1/code_13990.c @@ -42,32 +42,27 @@ void mlMtxApply(Mtx *mPtr){ func_80245A7C(D_80282FD0, mPtr); } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_802514BC.s") -#else -void func_802514BC(Mtx *arg0) { - s32 i, j, k; - f32 tmp; - f32 sp38[4][4]; - f32 (*sp34)[4]; - f32 (*var_s0)[4]; +void func_802514BC(Mtx* arg0) { + s32 row; + s32 col; + s32 i; + f32 sum; + f32 prod[4][4]; - - sp34 = reinterpret_cast(f32 *, *D_80282FD0); - var_s0 = reinterpret_cast(f32 *, arg0); - - for(i = 0; i < 4; i++){ - for(j = 0; j < 4; j++){ - tmp = 0.0f; - for(k = 0; k < 4; k++){ - tmp += var_s0[i][k] * sp34[k][j]; + for(row = 0; row < 4; row++, arg0 = &arg0->m[1][0]) + { + for(col = 0; col < 4; col++) + { + sum = 0.0; + for(i = 0; i < 4; i++) + { + sum += reinterpret_cast(f32, arg0->m[0][i]) * reinterpret_cast(f32, D_80282FD0->m[i][col]); } - sp38[i][j] = tmp; + prod[row][col] = sum; } } - func_80253010(sp34, &sp38, sizeof(Mtx)); + func_80253010(D_80282FD0, prod, sizeof(Mtx)); } -#endif void func_802515D4(f32 arg0[3][3]) { f32 var_f0; @@ -163,7 +158,26 @@ void func_80251878(f32* arg0) { D_80282FD0 = var_a2; } -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_802519C8.s") +void func_802519C8(Mtx * arg0, Mtx * arg1) { + s32 row; + s32 col; + Mtx * dst = (D_80282FD0 + 1); + + for (row = 0; row < 4; row++, arg1 = &arg1->m[1][0]) + { + for (col = 0; col < 4; col++) + { + reinterpret_cast(f32, dst->m[row][col]) = + ( + reinterpret_cast(f32, arg1->m[0][0]) * reinterpret_cast(f32, arg0->m[0][col]) + + reinterpret_cast(f32, arg1->m[0][1]) * reinterpret_cast(f32, arg0->m[1][col]) + + reinterpret_cast(f32, arg1->m[0][2]) * reinterpret_cast(f32, arg0->m[2][col]) + + reinterpret_cast(f32, arg1->m[0][3]) * reinterpret_cast(f32, arg0->m[3][col]) + ); + } + } + D_80282FD0 = (dst + 0); +} //mlMtx void mlMtxIdent(void){ diff --git a/src/core1/code_2BD0.c b/src/core1/code_2BD0.c index 122c0804..3f06cb29 100644 --- a/src/core1/code_2BD0.c +++ b/src/core1/code_2BD0.c @@ -8,32 +8,28 @@ OSMesgQueue D_8027E0AC; OSMesg D_8027E0C8[16]; //g_PimgrMesgBuffer OSMesgQueue D_8027E108; //g_PimgrMesgQueue - -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_2BD0/func_802405F0.s") -#else -void func_802405F0(u32 arg0, u32 arg1, s32 size){ - int i; +void func_802405F0(u32 * arg0, s32 arg1, s32 size){ s32 block_cnt; s32 block_remainder; s32 block_size = 0x20000; + int i; osWritebackDCache(arg0, size); - block_cnt = size/block_size; + block_cnt = size / block_size; + block_remainder = size % block_size; + for(i = 0; i < block_cnt; i++){ - osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_size, &D_8027E0AC); + osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, 0x20000, &D_8027E0AC); osRecvMesg(&D_8027E0AC, NULL, 1); - arg0 += 0x20000; arg1 += 0x20000; + arg0 += 0x8000; } - block_remainder = size%0x20000; osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_remainder, &D_8027E0AC); osRecvMesg(&D_8027E0AC, NULL, 1); osInvalDCache(arg0, size); } -#endif void piMgr_create(void){ osCreateMesgQueue(&D_8027E0AC, &D_8027E0A8, 1); diff --git a/src/core2/code_BEF20.c b/src/core2/code_BEF20.c index 41f8410b..78180a43 100644 --- a/src/core2/code_BEF20.c +++ b/src/core2/code_BEF20.c @@ -47,9 +47,7 @@ s32 item_getCount(enum item_e item){ return D_80385F30[item]; } - -#ifdef NONMATCHING -s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ +s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){ s32 oldVal; s32 sp40; s32 sp3C; @@ -58,10 +56,7 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ s32 sp30; s32 sp2C; s32 sp28; - s32 sp24; //without this var newVal is too high, but sp1C is correct - s32 newVal; - - + oldVal = D_80385F30[item]; if(func_80255D04()) @@ -77,8 +72,9 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ diff = 0; } } - newVal = MAX(0, D_80385F30[item] + diff); - D_80385F30[item] = newVal; + + sp28 = D_80385F30[item] = MAX(0, D_80385F30[item] + diff); + // sp20; sp34 = ((fileProgressFlag_get(FILEPROG_B9_DOUBLE_HEALTH))? 2 : 1); D_80385F30[ITEM_15_HEALTH_TOTAL] = MIN(sp34*8, D_80385F30[ITEM_15_HEALTH_TOTAL]); @@ -104,7 +100,7 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ sp38 = 0; break; } - if(sp38 != 0){ + if(sp38){ D_80385F30[item] = MIN(sp38, D_80385F30[item]); } if(!arg2){ @@ -114,8 +110,8 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ } sp3C = item_empty(item); - if(item < ITEM_6_HOURGLASS && sp3C) - D_80385F30[item + ITEM_6_HOURGLASS] = FALSE; + if(item < 6 && sp3C) + D_80385F30[item + ITEM_6_HOURGLASS] = 0; switch(item){ case ITEM_14_HEALTH: @@ -124,17 +120,17 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ break; case ITEM_17_AIR: sp30 = func_80301D24(oldVal); - sp2C = func_80301D24(newVal); + sp2C = func_80301D24(sp28); if(sp3C){ - bs_checkInterrupt(BS_INTR_11_DROWN); + bs_checkInterrupt(0x11); D_80385FE4 = 1; } - if(sp2C != 0 && sp30 != sp2C ){ + if(sp2C && sp30 != sp2C ){ if(sp2C < sp30){ func_8025A6EC(SFX_AIR_METER_DROPPING, 28000); } else{ - func_8030E760(SFX_3E9_UNKNOWN, 1.2f, 28000); + func_8030E760(0x3e9, 1.2f, 28000); } } break; @@ -152,9 +148,6 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ } return D_80385F30[item]; } -#else -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80345FB4.s") -#endif s32 func_803463D4(enum item_e item, s32 diff){ func_80345FB4(item, diff, 0);