Link J3DModelLoader.cpp

This commit is contained in:
HeartPiece 2024-04-03 23:24:12 +11:00
parent 1b30e361f2
commit 81fc1aaa9b
12 changed files with 219 additions and 4152 deletions

File diff suppressed because it is too large Load Diff

View File

@ -234,7 +234,7 @@ LIBS = [
["JSystem/J3D/J3DJoint", False],
["JSystem/J3D/J3DMaterialFactory", False],
["JSystem/J3D/J3DBinaryFormat", True],
["JSystem/J3D/J3DModelLoader", False],
["JSystem/J3D/J3DModelLoader", True],
["JSystem/J3D/J3DJointFactory", True],
["JSystem/J3D/J3DShapeFactory", True],
["JSystem/J3D/J3DAnmLoader", True],

View File

@ -50,16 +50,16 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASChannel.cpp">JAudio//JAS/JASChannel.cpp</a> | 35219 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAParticle.cpp">JParticle/JPAParticle.cpp</a> | 39432 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DMaterialFactory.cpp">J2D/J2DMaterialFactory.cpp</a> | 39435 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASAramStream.cpp">JAudio//JAS/JASAramStream.cpp</a> | 40005 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DTevs.cpp">J3D/J3DTevs.cpp</a> | 44519 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DAnimation.cpp">J3D/J3DAnimation.cpp</a> | 46687 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DModelLoader.cpp">J3D/J3DModelLoader.cpp</a> | 47976 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASSeqParser.cpp">JAudio//JAS/JASSeqParser.cpp</a> | 48203 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JMessage/processor.cpp">JMessage/processor.cpp</a> | 49155 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/functionvalue.cpp">JStudio/functionvalue.cpp</a> | 50053 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTGamePad.cpp">JUtility/JUTGamePad.cpp</a> | 52317 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAISound.cpp">JAudio//JAI/JAISound.cpp</a> | 55221 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAISeMgr.cpp">JAudio//JAI/JAISeMgr.cpp</a> | 61174 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAIStreamMgr.cpp">JAudio//JAI/JAIStreamMgr.cpp</a> | 62631 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAFieldBlock.cpp">JParticle/JPAFieldBlock.cpp</a> | 69401 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DWindowEx.cpp">J2D/J2DWindowEx.cpp</a> | 72267 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialFactory.cpp">J3D/J3DMaterialFactory.cpp</a> | 75520 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAResource.cpp">JParticle/JPAResource.cpp</a> | 80652 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASTrack.cpp">JAudio//JAS/JASTrack.cpp</a> | 83922 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DPicture.cpp">J2D/J2DPicture.cpp</a> | 85153 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAISequenceMgr.cpp">JAudio//JAI/JAISequenceMgr.cpp</a> | 88860 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPABaseShape.cpp">JParticle/JPABaseShape.cpp</a> | 105536 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DPictureEx.cpp">J2D/J2DPictureEx.cpp</a> | 110986 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DMatBlock.cpp">J2D/J2DMatBlock.cpp</a> | 116704 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/jstudio-object.cpp">JStudio/jstudio-object.cpp</a> | 123297 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMatBlock.cpp">J3D/J3DMatBlock.cpp</a> | 165716 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASSeqParser.cpp">JAudio//JAS/JASSeqParser.cpp</a> | 48203 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JMessage/processor.cpp">JMessage/processor.cpp</a> | 49155 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/functionvalue.cpp">JStudio/functionvalue.cpp</a> | 50053 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTGamePad.cpp">JUtility/JUTGamePad.cpp</a> | 52317 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAISound.cpp">JAudio//JAI/JAISound.cpp</a> | 55221 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAISeMgr.cpp">JAudio//JAI/JAISeMgr.cpp</a> | 61174 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAIStreamMgr.cpp">JAudio//JAI/JAIStreamMgr.cpp</a> | 62631 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAFieldBlock.cpp">JParticle/JPAFieldBlock.cpp</a> | 69401 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DWindowEx.cpp">J2D/J2DWindowEx.cpp</a> | 72267 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialFactory.cpp">J3D/J3DMaterialFactory.cpp</a> | 75520 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAResource.cpp">JParticle/JPAResource.cpp</a> | 80652 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASTrack.cpp">JAudio//JAS/JASTrack.cpp</a> | 83922 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DPicture.cpp">J2D/J2DPicture.cpp</a> | 85153 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAISequenceMgr.cpp">JAudio//JAI/JAISequenceMgr.cpp</a> | 88860 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPABaseShape.cpp">JParticle/JPABaseShape.cpp</a> | 105536 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DPictureEx.cpp">J2D/J2DPictureEx.cpp</a> | 110986 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DMatBlock.cpp">J2D/J2DMatBlock.cpp</a> | 116704 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/jstudio-object.cpp">JStudio/jstudio-object.cpp</a> | 123297 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMatBlock.cpp">J3D/J3DMatBlock.cpp</a> | 165716 | | |
### <section id="plugProjectEbisawaU">plugProjectEbisawaU</section>
| File | Size (bytes) | File | Size (bytes) |

View File

@ -47,6 +47,9 @@ struct J3DJoint {
J3DMtxCalc* getCurrentMtxCalc() { return mCurrentMtxCalc; };
J3DJoint* getChild() { return mChild; }
void setMtxType(u8 type) { mKind = (mKind & ~0xF0) | (type << 4); }
void resetMtxType() { mKind &= 0x0F; }
static J3DMtxCalc* mCurrentMtxCalc;
u32 mCallBackUserData; // _00

View File

@ -47,6 +47,7 @@ struct J3DJointTree {
J3DMtxCalc* getBasicMtxCalc() const { return mTransformCalc; }
Mtx& getInvJointMtx(s32 idx) const { return mInvJointMtx[idx]; }
u32 getModelDataType() const { return mModelDataType; }
const J3DModelHierarchy* getHierarchy() const { return mHierarchy; }
// VTBL _00
J3DModelHierarchy* mHierarchy; // _04

View File

@ -130,6 +130,7 @@ struct J3DMaterialFactory {
void modifyPatchedCurrentMtx(J3DMaterial*, int) const;
/** @fabricated */
u16 getMaterialID(int idx) const { return mMatRemapTable[idx]; }
inline J3DMaterialInitData& getMaterialInitData(s32 index) const { return mInitData[mMatRemapTable[index]]; }
u8 getMaterialMode(int idx) const { return getMaterialInitData(idx).mPixelEngineMode; }
@ -211,6 +212,7 @@ struct J3DMaterialInitData_v21 {
struct J3DMaterialFactory_v21 {
J3DMaterialFactory_v21(const J3DMaterialBlock_v21&);
u16 countUniqueMaterials();
J3DMaterial* create(J3DMaterial*, int, u32) const;
J3DGXColor newMatColor(int, int) const;
@ -237,7 +239,7 @@ struct J3DMaterialFactory_v21 {
J3DNBTScale newNBTScale(int) const;
/** @fabricated */
// inline s32 getMaterialInitDataIndex(s32 initDataIndexIndex) const { return _08[initDataIndexIndex]; }
u16 getMaterialID(int idx) const { return mMatRemapTable[idx]; }
inline J3DMaterialInitData_v21& getMaterialInitData(s32 index) const { return mInitData[mMatRemapTable[index]]; }
u16 mMaterialNum; // _00
@ -267,13 +269,6 @@ struct J3DMaterialFactory_v21 {
u8* mZCompareInfo; // _60
u8* mDitherInfo; // _64
J3DNBTScaleInfo* mNBTScaleInfo; // _68
void* _6C; // _6C
void* _70; // _70
void* _74; // _74
void* _78; // _78
void* _7C; // _7C
void* _80; // _80
void* _84; // _84
};
#endif

View File

@ -157,6 +157,7 @@ struct J3DModelData {
GXColor* getVtxColorArray(u8 idx) const { return mVertexData.getVtxColorArray(idx); }
u32 getVertexNum() const { return mVertexData.getVtxNum(); }
u32 getVertexColorNum() const { return mVertexData.getColNum(); }
const J3DModelHierarchy* getHierarchy() const { return mJointTree.getHierarchy(); }
u8 getDrawMtxFlag(u16 idx) const { return mJointTree.getDrawMtxFlag(idx); }
u16 getDrawMtxIndex(u16 idx) const { return mJointTree.getDrawMtxIndex(idx); }

View File

@ -25,23 +25,19 @@ struct J3DModelLoader {
{
}
virtual J3DModelData* load(const void*, u32); // _08
virtual J3DMaterialTable* loadMaterialTable(const void*); // _0C
virtual J3DModelData* loadBinaryDisplayList(const void*, u32); // _10
virtual int calcLoadSize(const void*, u32); // _14
virtual int calcLoadMaterialTableSize(const void*); // _18
virtual int calcLoadBinaryDisplayListSize(const void*, u32); // _1C
virtual u16 countMaterialNum(const void*); // _20
virtual void setupBBoardInfo(); // _24
/**
* @reifiedAddress{8006FAA0}
* @reifiedFile{JSystem/J3D/J3DModelLoader.cpp}
*/
virtual ~J3DModelLoader() {}; // _28 (weak)
virtual void readMaterial(const J3DMaterialBlock*, u32); // _2C (weak)
virtual void readMaterial_v21(const J3DMaterialBlock_v21*, u32); // _30 (weak)
virtual void readMaterialTable(const J3DMaterialBlock*, u32); // _34 (weak)
virtual void readMaterialTable_v21(const J3DMaterialBlock_v21*, u32); // _38 (weak)
virtual J3DModelData* load(const void*, u32); // _08
virtual J3DMaterialTable* loadMaterialTable(const void*); // _0C
virtual J3DModelData* loadBinaryDisplayList(const void*, u32); // _10
virtual int calcLoadSize(const void*, u32); // _14
virtual int calcLoadMaterialTableSize(const void*); // _18
virtual int calcLoadBinaryDisplayListSize(const void*, u32); // _1C
virtual u16 countMaterialNum(const void*); // _20
virtual void setupBBoardInfo(); // _24
virtual ~J3DModelLoader() { } // _28 (weak)
virtual void readMaterial(const J3DMaterialBlock*, u32) { } // _2C (weak)
virtual void readMaterial_v21(const J3DMaterialBlock_v21*, u32) { } // _30 (weak)
virtual void readMaterialTable(const J3DMaterialBlock*, u32) { } // _34 (weak)
virtual void readMaterialTable_v21(const J3DMaterialBlock_v21*, u32) { } // _38 (weak)
virtual size_t calcSizeMaterial(const J3DMaterialBlock*, u32) { return 0; } // _3C (weak)
virtual size_t calcSizeMaterialTable(const J3DMaterialBlock*, u32) { return 0; } // _40 (weak)
@ -106,5 +102,6 @@ inline u32 getMdlDataFlag_TevStageNum(u32 flag) { return (flag >> 16) & 0x1F; }
inline u32 getMdlDataFlag_TexGenFlag(u32 flag) { return flag & 0x0C000000; }
inline u32 getMdlDataFlag_PEFlag(u32 flag) { return flag & 0x30000000; }
inline u32 getMdlDataFlag_ColorFlag(u32 flag) { return flag & 0xC0000000; }
inline u32 getBdlFlag_MaterialType(u32 flag) { return flag & 0x3000; }
#endif

View File

@ -12,15 +12,7 @@ inline u8 JSUHiByte(u16 data)
return data;
}
template <typename T>
T* JSUConvertOffsetToPtr(const void* base, const void* offset)
{
if (offset == 0) {
return nullptr;
}
return (T*)((s32)(base) + (s32)(offset));
}
// these two templates need to be in this order for weak function ordering lol
template <typename T>
T* JSUConvertOffsetToPtr(const void* base, u32 offset)
{
@ -30,4 +22,13 @@ T* JSUConvertOffsetToPtr(const void* base, u32 offset)
return (T*)((s32)base + offset);
}
template <typename T>
T* JSUConvertOffsetToPtr(const void* base, const void* offset)
{
if (offset == 0) {
return nullptr;
}
return (T*)((s32)(base) + (s32)(offset));
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ J3D_FILES:=\
$(BUILD_DIR)/asm/JSystem/J3D/J3DJoint.o\
$(BUILD_DIR)/asm/JSystem/J3D/J3DMaterialFactory.o\
$(BUILD_DIR)/src/JSystem/J3D/J3DBinaryFormat.o\
$(BUILD_DIR)/asm/JSystem/J3D/J3DModelLoader.o\
$(BUILD_DIR)/src/JSystem/J3D/J3DModelLoader.o\
$(BUILD_DIR)/src/JSystem/J3D/J3DJointFactory.o\
$(BUILD_DIR)/src/JSystem/J3D/J3DShapeFactory.o\
$(BUILD_DIR)/src/JSystem/J3D/J3DAnmLoader.o\

View File

@ -925,3 +925,5 @@ You have 4104 out of 10000 Pokos and 107 out of 201 treasures.",2024-03-28 17:38
You have 4117 out of 10000 Pokos and 107 out of 201 treasures.",2024-04-03 21:52:26.765250
4119,1916748,0.4119954809954191,107,382133,0.5360591760467752,"
You have 4119 out of 10000 Pokos and 107 out of 201 treasures.",2024-04-03 22:13:13.274480
4137,1924968,0.41376232924765793,107,382349,0.5363621825445812,"
You have 4137 out of 10000 Pokos and 107 out of 201 treasures.",2024-04-03 23:20:20.868490

1 code_count_in_pokos code_completion_in_bytes code_completion_in_percentage data_count_in_treasures data_completion_in_bytes data_completion_in_percentage sentence created_at
925
926
927
928
929