// // Generated By: dol2asm // Translation Unit: J3DMtxBuffer // #include "JSystem/J3DGraphAnimator/J3DMtxBuffer.h" #include "JSystem/JKernel/JKRHeap.h" #include "dol2asm.h" #include "dolphin/types.h" // // Forward References: // extern "C" void initialize__12J3DMtxBufferFv(); extern "C" void create__12J3DMtxBufferFP12J3DModelDataUl(); extern "C" void createAnmMtx__12J3DMtxBufferFP12J3DModelData(); extern "C" void createWeightEnvelopeMtx__12J3DMtxBufferFP12J3DModelData(); extern "C" void setNoUseDrawMtx__12J3DMtxBufferFv(); extern "C" void createDoubleDrawMtx__12J3DMtxBufferFP12J3DModelDataUl(); extern "C" void createBumpMtxArray__12J3DMtxBufferFP12J3DModelDataUl(); extern "C" void calcWeightEnvelopeMtx__12J3DMtxBufferFv(); extern "C" void calcDrawMtx__12J3DMtxBufferFUlRC3VecRA3_A4_Cf(); extern "C" void calcNrmMtx__12J3DMtxBufferFv(); extern "C" void calcBBoardMtx__12J3DMtxBufferFv(); extern "C" void J3DCalcViewBaseMtx__FPA4_fRC3VecRA3_A4_CfPA4_f(); extern "C" u8 sNoUseDrawMtx__12J3DMtxBuffer[48]; extern "C" u8 sNoUseNrmMtx__12J3DMtxBuffer[36 + 4 /* padding */]; extern "C" void* sNoUseDrawMtxPtr__12J3DMtxBuffer; extern "C" void* sNoUseNrmMtxPtr__12J3DMtxBuffer; // // External References: // extern "C" void* __nwa__FUl(); extern "C" void* __nwa__FUli(); extern "C" void J3DCalcBBoardMtx__FPA4_f(); extern "C" void J3DCalcYBBoardMtx__FPA4_f(); extern "C" void J3DPSCalcInverseTranspose__FPA4_fPA3_f(); extern "C" void J3DPSMtxArrayConcat__FPA4_fPA4_fPA4_fUl(); extern "C" void countBumpMtxNum__8J3DShapeCFv(); extern "C" void _savegpr_19(); extern "C" void _savegpr_24(); extern "C" void _savegpr_27(); extern "C" void _savegpr_28(); extern "C" void _savegpr_29(); extern "C" void _restgpr_19(); extern "C" void _restgpr_24(); extern "C" void _restgpr_27(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); // // Declarations: // /* 80326214-80326258 320B54 0044+00 0/0 1/1 0/0 .text initialize__12J3DMtxBufferFv */ void J3DMtxBuffer::initialize() { mJointTree = NULL; mpScaleFlagArr = NULL; mpEvlpScaleFlagArr = NULL; mpAnmMtx = NULL; mpWeightEvlpMtx = NULL; mpDrawMtxArr[0] = NULL; mpDrawMtxArr[1] = NULL; mpNrmMtxArr[0] = NULL; mpNrmMtxArr[1] = NULL; mpBumpMtxArr[0] = NULL; mpBumpMtxArr[1] = NULL; mFlags = 1; mCurrentViewNo = 0; mpUserAnmMtx = NULL; } /* 80326258-80326364 320B98 010C+00 0/0 1/1 0/0 .text create__12J3DMtxBufferFP12J3DModelDataUl */ enum { J3DMdlDataFlag_ConcatView = 0x10, J3DMdlDataFlag_NoAnimation = 0x100, }; static inline u32 getMdlDataFlag_MtxLoadType(u32 flag) { return flag & 0x10; } s32 J3DMtxBuffer::create(J3DModelData* p_modelData, u32 flag) { s32 ret; mFlags = flag; mJointTree = &p_modelData->getJointTree(); ret = createAnmMtx(p_modelData); if (ret != kJ3DError_Success) return ret; ret = createWeightEnvelopeMtx(p_modelData); if (ret != kJ3DError_Success) return ret; if (p_modelData->checkFlag(J3DMdlDataFlag_NoAnimation)) { setNoUseDrawMtx(); } else { switch (getMdlDataFlag_MtxLoadType(p_modelData->getFlag())) { case J3DMdlDataFlag_ConcatView: ret = setNoUseDrawMtx(); break; case 0: default: ret = createDoubleDrawMtx(p_modelData, flag); break; } } if (ret != kJ3DError_Success) return ret; if (p_modelData->getFlag() & J3DMdlDataFlag_ConcatView) { p_modelData->setBumpFlag(0); } else { ret = createBumpMtxArray(p_modelData, flag); if (ret != kJ3DError_Success) return ret; } return ret; } /* 80326364-803263F0 320CA4 008C+00 1/1 0/0 0/0 .text createAnmMtx__12J3DMtxBufferFP12J3DModelData */ s32 J3DMtxBuffer::createAnmMtx(J3DModelData* p_modelData) { if (p_modelData->getJointNum() != 0) { mpScaleFlagArr = new u8[p_modelData->getJointNum()]; mpAnmMtx = new Mtx[p_modelData->getJointNum()]; mpUserAnmMtx = mpAnmMtx; } if (mpScaleFlagArr == NULL) return kJ3DError_Alloc; return mpAnmMtx == NULL ? kJ3DError_Alloc : kJ3DError_Success; } /* 803263F0-8032648C 320D30 009C+00 1/1 0/0 0/0 .text * createWeightEnvelopeMtx__12J3DMtxBufferFP12J3DModelData */ s32 J3DMtxBuffer::createWeightEnvelopeMtx(J3DModelData* p_modelData) { if (p_modelData->getWEvlpMtxNum() != 0) { mpEvlpScaleFlagArr = new u8[p_modelData->getWEvlpMtxNum()]; mpWeightEvlpMtx = new Mtx[p_modelData->getWEvlpMtxNum()]; } if (p_modelData->getWEvlpMtxNum() != 0 && mpEvlpScaleFlagArr == NULL) return kJ3DError_Alloc; if (p_modelData->getWEvlpMtxNum() != 0 && mpWeightEvlpMtx == NULL) return kJ3DError_Alloc; return kJ3DError_Success; } /* ############################################################################################## */ /* 804371C0-804371F0 063EE0 0030+00 1/0 0/0 0/0 .bss sNoUseDrawMtx__12J3DMtxBuffer */ Mtx J3DMtxBuffer::sNoUseDrawMtx; /* 804371F0-80437218 063F10 0024+04 1/0 0/0 0/0 .bss sNoUseNrmMtx__12J3DMtxBuffer */ Mtx33 J3DMtxBuffer::sNoUseNrmMtx; /* 80450970-80450974 -00001 0004+00 1/1 0/0 0/0 .sdata sNoUseDrawMtxPtr__12J3DMtxBuffer */ Mtx* J3DMtxBuffer::sNoUseDrawMtxPtr = &J3DMtxBuffer::sNoUseDrawMtx; /* 80450974-80450978 -00001 0004+00 1/1 0/0 0/0 .sdata sNoUseNrmMtxPtr__12J3DMtxBuffer */ Mtx33* J3DMtxBuffer::sNoUseNrmMtxPtr = &J3DMtxBuffer::sNoUseNrmMtx; /* 8032648C-803264B8 320DCC 002C+00 1/1 0/0 0/0 .text setNoUseDrawMtx__12J3DMtxBufferFv */ s32 J3DMtxBuffer::setNoUseDrawMtx() { mpDrawMtxArr[1] = &sNoUseDrawMtxPtr; mpDrawMtxArr[0] = &sNoUseDrawMtxPtr; mpNrmMtxArr[1] = &sNoUseNrmMtxPtr; mpNrmMtxArr[0] = &sNoUseNrmMtxPtr; mpBumpMtxArr[1] = NULL; mpBumpMtxArr[0] = NULL; return kJ3DError_Success; } /* 803264B8-80326664 320DF8 01AC+00 1/1 0/0 0/0 .text * createDoubleDrawMtx__12J3DMtxBufferFP12J3DModelDataUl */ s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* p_modelData, u32 num) { if (num != 0) { for (s32 i = 0; i < 2; i++) { mpDrawMtxArr[i] = new Mtx*[num]; mpNrmMtxArr[i] = new Mtx33*[num]; mpBumpMtxArr[i] = NULL; } } if (num != 0) { for (u32 i = 0; i < 2; i++) { if (mpDrawMtxArr[i] == NULL) return kJ3DError_Alloc; if (mpNrmMtxArr[i] == NULL) return kJ3DError_Alloc; } } for (s32 i = 0; i < 2; i++) { for (u32 j = 0; j < num; j++) { if (p_modelData->getDrawMtxNum() != 0) { mpDrawMtxArr[i][j] = new (0x20) Mtx[p_modelData->getDrawMtxNum()]; mpNrmMtxArr[i][j] = new (0x20) Mtx33[p_modelData->getDrawMtxNum()]; } } } for (s32 i = 0; i < 2; i++) { for (u32 j = 0; j < num; j++) { if (p_modelData->getDrawMtxNum() != 0) { if (mpDrawMtxArr[i][j] == NULL) return kJ3DError_Alloc; if (mpNrmMtxArr[i][j] == NULL) return kJ3DError_Alloc; } } } return kJ3DError_Success; } /* 80326664-803268D4 320FA4 0270+00 1/1 0/0 0/0 .text * createBumpMtxArray__12J3DMtxBufferFP12J3DModelDataUl */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* param_0, u32 param_1) { nofralloc #include "asm/JSystem/J3DGraphAnimator/J3DMtxBuffer/createBumpMtxArray__12J3DMtxBufferFP12J3DModelDataUl.s" } #pragma pop /* ############################################################################################## */ /* 80450978-80450980 0003F8 0008+00 1/1 0/0 0/0 .sdata J3DUnit01 */ SECTION_SDATA static u8 J3DUnit01[8] = { 0x00, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, }; /* 803268D4-80326ACC 321214 01F8+00 0/0 1/1 0/0 .text calcWeightEnvelopeMtx__12J3DMtxBufferFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void J3DMtxBuffer::calcWeightEnvelopeMtx() { nofralloc #include "asm/JSystem/J3DGraphAnimator/J3DMtxBuffer/calcWeightEnvelopeMtx__12J3DMtxBufferFv.s" } #pragma pop /* 80326ACC-80326D3C 32140C 0270+00 0/0 1/1 0/0 .text * calcDrawMtx__12J3DMtxBufferFUlRC3VecRA3_A4_Cf */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, f32 const (¶m_2)[3][4]) { nofralloc #include "asm/JSystem/J3DGraphAnimator/J3DMtxBuffer/calcDrawMtx__12J3DMtxBufferFUlRC3VecRA3_A4_Cf.s" } #pragma pop extern void J3DPSCalcInverseTranspose(Mtx p1, Mtx33 p2); /* 80326D3C-80326EF0 32167C 01B4+00 0/0 1/1 0/0 .text calcNrmMtx__12J3DMtxBufferFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void J3DMtxBuffer::calcNrmMtx() { nofralloc #include "asm/JSystem/J3DGraphAnimator/J3DMtxBuffer/calcNrmMtx__12J3DMtxBufferFv.s" } #pragma pop /* ############################################################################################## */ /* 80456420-80456424 004A20 0004+00 1/1 0/0 0/0 .sdata2 @1320 */ SECTION_SDATA2 static f32 lit_1320 = 1.0f; /* 80456424-80456428 004A24 0004+00 1/1 0/0 0/0 .sdata2 @1321 */ SECTION_SDATA2 static u8 lit_1321[4] = { 0x00, 0x00, 0x00, 0x00, }; /* 80326EF0-80327048 321830 0158+00 0/0 1/1 0/0 .text calcBBoardMtx__12J3DMtxBufferFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void J3DMtxBuffer::calcBBoardMtx() { nofralloc #include "asm/JSystem/J3DGraphAnimator/J3DMtxBuffer/calcBBoardMtx__12J3DMtxBufferFv.s" } #pragma pop /* 80327048-80327100 321988 00B8+00 1/1 1/1 0/0 .text * J3DCalcViewBaseMtx__FPA4_fRC3VecRA3_A4_CfPA4_f */ void J3DCalcViewBaseMtx(Mtx view, Vec const& scale, const Mtx& base, Mtx dst) { Mtx m; m[0][0] = base[0][0] * scale.x; m[0][1] = base[0][1] * scale.y; m[0][2] = base[0][2] * scale.z; m[0][3] = base[0][3]; m[1][0] = base[1][0] * scale.x; m[1][1] = base[1][1] * scale.y; m[1][2] = base[1][2] * scale.z; m[1][3] = base[1][3]; m[2][0] = base[2][0] * scale.x; m[2][1] = base[2][1] * scale.y; m[2][2] = base[2][2] * scale.z; m[2][3] = base[2][3]; MTXConcat(view, m, dst); }