diff options
| author | Pheenoh <pheenoh@gmail.com> | 2023-08-10 03:57:49 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-10 03:57:49 -0600 |
| commit | d24b09c2d9e303df68abd7f3417babfc00d83c78 (patch) | |
| tree | 52f020141957595ac866109832723941a8f7025f /libs | |
| parent | 244892aeb849a9ad9801aa9828e6282d29df87f0 (diff) | |
d_file_select work + misc changes (#1873)
* setup TU
* JASResArcLoader OK
* d_a_obj_stoneMark work
* some funcs in d_a_obj_stoneMark
* many changes
* quat, d_a_obj_stone, d_a_alink, fix python script, tidy makefile
* d_file_select functions + pr cleanup
* match many dfile_select_c methods
* m_Do_main OK
* selFileWakuAnm & bookIconAnm
* selCopyFileWakuAnm & copyBookIconAnm
* dataDelEffAnm & dataCopyEffAnm
* selectDataBaseMoveAnmInitSet & selectDataBaseMoveAnm
* dataSelectIn
* _move & dataSelectInit
* match a few more
* comment
* J2DPicture::drawTexCoord
* draw_function
* dScnPly_Create + fix typing on request_of_phase_process_fn
* checkpoint
* checkpoint
* checkpoint
* checkpoint 2 (fixed)
* dFile_select_c::dataSelectAnmSet
* dFile_select_c::selectDataOpenMove
* dFile_select_c::copySelMoveAnmInitSet
* fix brightcheck issues
* rm comments, fix status update
* small mod to pr template
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/JSystem/J2DGraph/J2DPicture.cpp | 59 | ||||
| -rw-r--r-- | libs/MSL_C/MSL_Common/Src/alloc.c | 51 | ||||
| -rw-r--r-- | libs/MSL_C/MSL_Common/Src/arith.c | 23 | ||||
| -rw-r--r-- | libs/SSystem/SComponent/c_phase.cpp | 14 |
4 files changed, 131 insertions, 16 deletions
diff --git a/libs/JSystem/J2DGraph/J2DPicture.cpp b/libs/JSystem/J2DGraph/J2DPicture.cpp index d0b1fd80e2..489c5506bb 100644 --- a/libs/JSystem/J2DGraph/J2DPicture.cpp +++ b/libs/JSystem/J2DGraph/J2DPicture.cpp @@ -711,16 +711,73 @@ asm void J2DPicture::drawOut(JGeometry::TBox2<f32> const& param_0, /* 802FE380-802FE5D0 2F8CC0 0250+00 1/0 0/0 0/0 .text * drawTexCoord__10J2DPictureFffffssssssssPA3_A4_f */ +#ifdef NONMATCHING +// matches with literals +void J2DPicture::drawTexCoord(f32 param_0, f32 param_1, f32 param_2, f32 param_3, s16 param_4, + s16 param_5, s16 param_6, s16 param_7, s16 param_8, s16 param_9, + s16 param_10, s16 param_11, Mtx* param_12) { + + if (mTextureCount != 0) { + for (u8 i = 0; i < mTextureCount; i++) { + load(i); + } + + f32 tmp1 = param_0 + param_2; + f32 tmp2 = param_1 + param_3; + + GXSetNumTexGens(mTextureCount); + + JUtility::TColor black[4]; + + Mtx outputMtx; + + getNewColor(black); + setTevMode(); + PSMTXConcat((MtxP)param_12,mGlobalMtx,outputMtx); + + GXLoadPosMtxImm(outputMtx,0); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS,GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0,GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0,GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0,GX_VA_POS,GX_CLR_RGBA,GX_F32,0); + GXSetVtxAttrFmt(GX_VTXFMT0,GX_VA_TEX0,GX_CLR_RGBA,GX_RGBA4,8); + GXBegin(GX_QUADS,GX_VTXFMT0,4); + + GXPosition3f32(param_0,param_1,0.0f); + GXColor1u32(black[0]); + GXTexCoord2s16(param_4,param_5); + + GXPosition3f32(tmp1,param_1,0.0f); + GXColor1u32(black[1]); + GXTexCoord2s16(param_6,param_7); + + GXPosition3f32(tmp1,tmp2,0.0f); + GXColor1u32(black[3]); + GXTexCoord2s16(param_10,param_11); + + GXPosition3f32(param_0,tmp2,0.0f); + GXColor1u32(black[2]); + GXTexCoord2s16(param_8,param_9); + + i_GXEnd(); + + GXSetVtxAttrFmt(GX_VTXFMT0,GX_VA_TEX0,GX_CLR_RGBA,GX_RGBX8,0xf); + GXSetVtxAttrFmt(GX_VTXFMT0,GX_VA_POS,GX_CLR_RGBA,GX_RGBA4,0); + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void J2DPicture::drawTexCoord(f32 param_0, f32 param_1, f32 param_2, f32 param_3, s16 param_4, s16 param_5, s16 param_6, s16 param_7, s16 param_8, s16 param_9, - s16 param_10, s16 param_11, f32 (*param_12)[3][4]) { + s16 param_10, s16 param_11, Mtx* param_12) { nofralloc #include "asm/JSystem/J2DGraph/J2DPicture/drawTexCoord__10J2DPictureFffffssssssssPA3_A4_f.s" } #pragma pop +#endif /* 802FE5D0-802FEA60 2F8F10 0490+00 3/3 0/0 0/0 .text setTevMode__10J2DPictureFv */ #pragma push diff --git a/libs/MSL_C/MSL_Common/Src/alloc.c b/libs/MSL_C/MSL_Common/Src/alloc.c index 56c27b1f83..3937a44c16 100644 --- a/libs/MSL_C/MSL_Common/Src/alloc.c +++ b/libs/MSL_C/MSL_Common/Src/alloc.c @@ -1,16 +1,16 @@ #include "MSL_C/MSL_Common/Src/alloc.h" #include "MSL_C/MSL_Common/Src/string.h" -static void deallocate_from_fixed_pools(); -static void deallocate_from_var_pools(); +static void deallocate_from_fixed_pools(int**,unsigned int**, unsigned int); +static void deallocate_from_var_pools(int**,unsigned int**); // // External References: // void __sys_free(); -void __end_critical_region(); -void __begin_critical_region(); +void __end_critical_region(int); +void __begin_critical_region(int); extern unsigned char data_804519A0[8]; // @@ -22,6 +22,20 @@ extern unsigned char data_804519A0[8]; static unsigned char protopool[56]; /* 80362B58-80362BC8 35D498 0070+00 0/0 2/2 0/0 .text free */ +#ifdef NONMATCHING +// matches but causes reordering +void free(FILE* file) { + __begin_critical_region(1); + + if (data_804519A0[0] == 0) { + memset(protopool,0,0x34); + data_804519A0[0] = 1; + } + + __pool_free((int**)protopool, (unsigned int**)file); + __end_critical_region(1); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -30,16 +44,39 @@ asm void free(FILE* file) { #include "asm/MSL_C/MSL_Common/Src/alloc/free.s" } #pragma pop +#endif /* 80362BC8-80362C20 35D508 0058+00 1/1 0/0 0/0 .text __pool_free */ +#ifdef NONMATCHING +// matches but causes reordering +void __pool_free(int **param_1, unsigned int **param_2) { + unsigned int var; + + if (param_2) { + if (((unsigned int)param_2[-1] & 1) == 0) { + var = param_2[-1][2]; + } else { + var = (unsigned int)param_2[-2] & 0xfffffff8; + var -= 8; + } + + if (var <= 0x44) { + deallocate_from_fixed_pools(param_1,param_2, var); + } else { + deallocate_from_var_pools(param_1,param_2); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void __pool_free() { +asm void __pool_free(int **param_1, unsigned int **param_2) { nofralloc #include "asm/MSL_C/MSL_Common/Src/alloc/__pool_free.s" } #pragma pop +#endif /* ############################################################################################## */ /* 803A2220-803A2238 02E880 0018+00 1/1 0/0 0/0 .rodata fix_pool_sizes */ @@ -52,7 +89,7 @@ static unsigned char const fix_pool_sizes[24] = { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void deallocate_from_fixed_pools() { +static asm void deallocate_from_fixed_pools(int** param_1,unsigned int** param_2, unsigned int param_3) { nofralloc #include "asm/MSL_C/MSL_Common/Src/alloc/deallocate_from_fixed_pools.s" } @@ -62,7 +99,7 @@ static asm void deallocate_from_fixed_pools() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void deallocate_from_var_pools() { +static asm void deallocate_from_var_pools(int** param_1,unsigned int** param_2) { nofralloc #include "asm/MSL_C/MSL_Common/Src/alloc/deallocate_from_var_pools.s" } diff --git a/libs/MSL_C/MSL_Common/Src/arith.c b/libs/MSL_C/MSL_Common/Src/arith.c index df7d40f114..176efcfbc9 100644 --- a/libs/MSL_C/MSL_Common/Src/arith.c +++ b/libs/MSL_C/MSL_Common/Src/arith.c @@ -2,6 +2,28 @@ #include "MSL_C/math.h" /* 80365078-803650D0 35F9B8 0058+00 0/0 1/1 0/0 .text div */ +#ifdef NONMATCHING +// matches but causes function reordering +div_t div(int numerator, int denominator) { + div_t ret; + int i = 1; + int j = 1; + + if (numerator < 0 ) { + numerator = -numerator; + i = -1; + } + + if (denominator < 0) { + denominator = -denominator; + j = -1; + } + + ret.quot = (numerator / denominator) * (i * j); + ret.rem = numerator * i - j * (ret.quot * denominator); + return ret; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -10,6 +32,7 @@ asm div_t div(int numerator, int denominator) { #include "asm/MSL_C/MSL_Common/Src/arith/div.s" } #pragma pop +#endif /* 803650D0-803650E0 35FA10 0010+00 0/0 66/66 225/225 .text abs */ int abs(int n) { diff --git a/libs/SSystem/SComponent/c_phase.cpp b/libs/SSystem/SComponent/c_phase.cpp index c4c30ecf4e..ce0be092db 100644 --- a/libs/SSystem/SComponent/c_phase.cpp +++ b/libs/SSystem/SComponent/c_phase.cpp @@ -64,18 +64,16 @@ int cPhs_Next(request_of_phase_process_class* pPhase) { /* 802666D8-802667AC 00D4+00 s=1 e=3 z=0 None .text cPhs_Do__FP30request_of_phase_process_classPv */ #ifdef NONMATCHING +// pUserData loading in too early int cPhs_Do(request_of_phase_process_class* pPhase, void* pUserData) { - if (const cPhs__Handler* pHandlerTable = pPhase->mpHandlerTable) { - // the load of pUserData seems to be slightly scrambled.. - const cPhs__Handler pHandler = pHandlerTable[pPhase->id]; - const int newStep = pHandler(pUserData); + if (pPhase->mpHandlerTable) { + int newStep = pPhase->mpHandlerTable[pPhase->id](pUserData); switch (newStep) { case cPhs_ONE_e: return cPhs_Next(pPhase); case cPhs_TWO_e: - const int step2 = cPhs_Next(pPhase); - return step2 == cPhs_ONE_e ? cPhs_TWO_e : cPhs_COMPLEATE_e; + return cPhs_Next(pPhase) == cPhs_ONE_e ? cPhs_TWO_e : cPhs_COMPLEATE_e; case cPhs_COMPLEATE_e: return cPhs_Compleate(pPhase); case cPhs_UNK3_e: @@ -84,9 +82,9 @@ int cPhs_Do(request_of_phase_process_class* pPhase, void* pUserData) { case cPhs_ERROR_e: cPhs_UnCompleate(pPhase); return cPhs_ERROR_e; + default: + return newStep; } - - return newStep; } return cPhs_Compleate(pPhase); |
