Skip to content

Commit

Permalink
j2d/j3d work
Browse files Browse the repository at this point in the history
  • Loading branch information
hatal175 committed Nov 10, 2024
1 parent bec20e3 commit e368cc7
Show file tree
Hide file tree
Showing 22 changed files with 731 additions and 2,665 deletions.
12 changes: 6 additions & 6 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,8 +973,8 @@ def MatchingFor(*versions):
Object(NonMatching, "JSystem/J2DGraph/J2DWindowEx.cpp"),
Object(NonMatching, "JSystem/J2DGraph/J2DPictureEx.cpp"),
Object(Matching, "JSystem/J2DGraph/J2DTextBoxEx.cpp"),
Object(NonMatching, "JSystem/J2DGraph/J2DAnmLoader.cpp"),
Object(NonMatching, "JSystem/J2DGraph/J2DAnimation.cpp"),
Object(Matching, "JSystem/J2DGraph/J2DAnmLoader.cpp", extra_cflags=['-pragma "nosyminline off"']),
Object(Matching, "JSystem/J2DGraph/J2DAnimation.cpp"),
Object(Matching, "JSystem/J2DGraph/J2DManage.cpp"),
],
),
Expand Down Expand Up @@ -1002,7 +1002,7 @@ def MatchingFor(*versions):
[
Object(Matching, "JSystem/J3DGraphAnimator/J3DShapeTable.cpp"),
Object(Matching, "JSystem/J3DGraphAnimator/J3DJointTree.cpp"),
Object(Equivalent, "JSystem/J3DGraphAnimator/J3DModelData.cpp"),
Object(Matching, "JSystem/J3DGraphAnimator/J3DModelData.cpp", extra_cflags=['-pragma "nosyminline off"']),
Object(NonMatching, "JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp"),
Object(Matching, "JSystem/J3DGraphAnimator/J3DModel.cpp"),
Object(Equivalent, "JSystem/J3DGraphAnimator/J3DAnimation.cpp"),
Expand All @@ -1018,12 +1018,12 @@ def MatchingFor(*versions):
[
Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory.cpp"),
Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.cpp"),
Object(Equivalent, "JSystem/J3DGraphLoader/J3DClusterLoader.cpp"),
Object(Equivalent, "JSystem/J3DGraphLoader/J3DModelLoader.cpp"),
Object(Matching, "JSystem/J3DGraphLoader/J3DClusterLoader.cpp", extra_cflags=['-pragma "nosyminline off"']),
Object(Matching, "JSystem/J3DGraphLoader/J3DModelLoader.cpp", extra_cflags=['-pragma "nosyminline off"']),
Object(NonMatching, "JSystem/J3DGraphLoader/J3DModelLoaderCalcSize.cpp"),
Object(Matching, "JSystem/J3DGraphLoader/J3DJointFactory.cpp"),
Object(Matching, "JSystem/J3DGraphLoader/J3DShapeFactory.cpp"),
Object(Equivalent, "JSystem/J3DGraphLoader/J3DAnmLoader.cpp"),
Object(Matching, "JSystem/J3DGraphLoader/J3DAnmLoader.cpp", extra_cflags=['-pragma "nosyminline off"']),
],
),
JSystemLib(
Expand Down
5 changes: 4 additions & 1 deletion include/JSystem/J2DGraph/J2DAnimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ class J2DAnmTextureSRTKey : public J2DAnmBase {
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum / 3; }
u16 getUpdateMaterialID(u16 i) const { return mUpdateMaterialID[i]; }
u8 getUpdateTexMtxID(u16 i) const { return mUpdateTexMtxID[i]; }
void getTransform(u16 param_1, J3DTextureSRTInfo* param_2) {
calcTransform(mFrame, param_1, param_2);
}

/* 0x10 */ int field_0x10;
/* 0x14 */ J3DAnmTransformKeyTable* mInfoTable;
Expand Down Expand Up @@ -388,7 +391,7 @@ class J2DAnmColor : public J2DAnmBase {
}
/* 801842FC */ virtual ~J2DAnmColor() {}
/* 8030AF24 */ virtual void searchUpdateMaterialID(J2DScreen*);
/* 802EB390 */ virtual void getColor(u16, _GXColor*) const;
/* 802EB390 */ virtual void getColor(u16, _GXColor*) const {}
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
u16 getUpdateMaterialID(u16 i) const { return mUpdateMaterialID[i]; }

Expand Down
82 changes: 42 additions & 40 deletions include/JSystem/J2DGraph/J2DMatBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ struct J2DGXColorS10 : public GXColorS10 {
a = other.a;
}

// J2DGXColorS10& operator=(const GXColorS10& other) {
// r = other.r;
// g = other.g;
// b = other.b;
// a = other.a;
// return *this;
// }
J2DGXColorS10& operator=(const GXColorS10& other) {
r = other.r;
g = other.g;
b = other.b;
a = other.a;
return *this;
}
};

struct J2DTevSwapModeInfo;
Expand All @@ -49,33 +49,33 @@ struct J2DTevSwapModeInfo;
class J2DTevBlock {
public:
/* 802F2A40 */ virtual void initialize();
/* 802EB1D0 */ virtual void setGX();
/* 802EB1D0 */ virtual void setGX() {}
/* 802F2A44 */ virtual void loadTexture(_GXTexMapID, u32);
virtual u32 getType() = 0;
virtual u8 getMaxStage() = 0;
/* 802EB1DC */ virtual void setTexNo(u32, u16);
/* 802EA170 */ virtual u32 getTexNo(u32) const;
/* 802EB1DC */ virtual void setTexNo(u32, u16) {}
/* 802EA170 */ virtual u32 getTexNo(u32) const { return 0xFFFF; }
/* 802F2A48 */ virtual void setFontNo(u16);
/* 802EA164 */ virtual u16 getFontNo() const;
/* 802EA164 */ virtual u16 getFontNo() const { return 0xFFFF; }
/* 802F2A4C */ virtual void setTevOrder(u32, J2DTevOrder);
/* 802EA144 */ virtual J2DTevOrder* getTevOrder(u32);
/* 802EB1D8 */ virtual void setTevColor(u32, J2DGXColorS10);
/* 802EA13C */ virtual J2DGXColorS10* getTevColor(u32);
/* 802EB1D4 */ virtual void setTevKColor(u32, JUtility::TColor);
/* 802EA15C */ virtual JUtility::TColor* getTevKColor(u32);
/* 802EA144 */ virtual J2DTevOrder* getTevOrder(u32) { return NULL; }
/* 802EB1D8 */ virtual void setTevColor(u32, J2DGXColorS10) {}
/* 802EA13C */ virtual J2DGXColorS10* getTevColor(u32) { return NULL; }
/* 802EB1D4 */ virtual void setTevKColor(u32, JUtility::TColor) {}
/* 802EA15C */ virtual JUtility::TColor* getTevKColor(u32) { return NULL; }
/* 802F2A50 */ virtual void setTevKColorSel(u32, u8);
/* 802EA154 */ virtual u8 getTevKColorSel(u32);
/* 802EA154 */ virtual u8 getTevKColorSel(u32) { return 0; }
/* 802F2A54 */ virtual void setTevKAlphaSel(u32, u8);
/* 802EA14C */ virtual u8 getTevKAlphaSel(u32);
/* 802EA14C */ virtual u8 getTevKAlphaSel(u32) { return 0; }
/* 802F2A58 */ virtual void setTevStageNum(u8);
/* 802EA17C */ virtual u8 getTevStageNum() const;
/* 802EA17C */ virtual u8 getTevStageNum() const { return 1; }
/* 802F2A5C */ virtual void setTevStage(u32, J2DTevStage);
/* 802EA134 */ virtual J2DTevStage* getTevStage(u32);
/* 802EA134 */ virtual J2DTevStage* getTevStage(u32) { return NULL; }
/* 802F2A60 */ virtual void setTevSwapModeInfo(u32, J2DTevSwapModeInfo);
/* 802F2A64 */ virtual void setTevSwapModeTable(u32, J2DTevSwapModeTable);
/* 802EA12C */ virtual J2DTevSwapModeTable* getTevSwapModeTable(u32);
/* 802EA12C */ virtual J2DTevSwapModeTable* getTevSwapModeTable(u32) { return NULL; }
/* 802F2A68 */ virtual void setIndTevStage(u32, J2DIndTevStage);
/* 802EA184 */ virtual J2DIndTevStage* getIndTevStage(u32);
/* 802EA184 */ virtual J2DIndTevStage* getIndTevStage(u32) { return NULL; }
/* 802F2A7C */ virtual bool insertTexture(u32, ResTIMG const*);
/* 802F2A74 */ virtual bool insertTexture(u32, ResTIMG const*, JUTPalette*);
/* 802F2A6C */ virtual bool insertTexture(u32, JUTTexture*);
Expand Down Expand Up @@ -235,7 +235,7 @@ class J2DTevBlock2 : public J2DTevBlock {
/* 0x05C */ J2DIndTevStage mIndTevStage[2];
/* 0x064 */ JUTTexture* mTexture[2];
/* 0x06C */ JUTPalette* mPalette[2];
/* 0x064 */ JUTFont* mFont;
/* 0x074 */ JUTFont* mFont;
/* 0x078 */ u8 mUndeleteFlag;
}; // Size: 0x7C

Expand Down Expand Up @@ -567,17 +567,17 @@ class J2DPEBlock {
*/
class J2DIndBlock {
public:
/* 802EB24C */ virtual void initialize();
/* 802EB1CC */ virtual void setGX();
/* 802EB24C */ virtual void initialize() {}
/* 802EB1CC */ virtual void setGX() {}
virtual u32 getType() = 0;
/* 802EB250 */ virtual void setIndTexStageNum(u8);
/* 802EA1A4 */ virtual u8 getIndTexStageNum() const;
/* 802EB254 */ virtual void setIndTexOrder(u32, J2DIndTexOrder);
/* 802EA19C */ virtual J2DIndTexOrder* getIndTexOrder(u32);
/* 802EB258 */ virtual void setIndTexMtx(u32, J2DIndTexMtx);
/* 802EA194 */ virtual J2DIndTexMtx* getIndTexMtx(u32);
/* 802EB25C */ virtual void setIndTexCoordScale(u32, J2DIndTexCoordScale);
/* 802EA18C */ virtual J2DIndTexCoordScale* getIndTexCoordScale(u32);
/* 802EB250 */ virtual void setIndTexStageNum(u8) {}
/* 802EA1A4 */ virtual u8 getIndTexStageNum() const { return 0; }
/* 802EB254 */ virtual void setIndTexOrder(u32, J2DIndTexOrder) {}
/* 802EA19C */ virtual J2DIndTexOrder* getIndTexOrder(u32) { return NULL; }
/* 802EB258 */ virtual void setIndTexMtx(u32, J2DIndTexMtx) {}
/* 802EA194 */ virtual J2DIndTexMtx* getIndTexMtx(u32) { return NULL; }
/* 802EB25C */ virtual void setIndTexCoordScale(u32, J2DIndTexCoordScale) {}
/* 802EA18C */ virtual J2DIndTexCoordScale* getIndTexCoordScale(u32) { return NULL; }
/* 802EB13C */ virtual ~J2DIndBlock() {}
};

Expand Down Expand Up @@ -617,9 +617,9 @@ class J2DIndBlockNull : public J2DIndBlock {
public:
J2DIndBlockNull() {}

/* 802EB1E0 */ virtual void setGX();
/* 802EB1E4 */ virtual u32 getType();
/* 802EB1F0 */ virtual ~J2DIndBlockNull();
/* 802EB1E0 */ virtual void setGX() {}
/* 802EB1E4 */ virtual u32 getType() { return 'IBLN'; }
/* 802EB1F0 */ virtual ~J2DIndBlockNull() {}
};

/**
Expand All @@ -644,6 +644,7 @@ class J2DTexGenBlock {
void setTexGenNum(u32 num) { mTexGenNum = num; }
void setTexCoord(u32 i, J2DTexCoord coord) { mTexGenCoord[i] = coord; }
void setTexMtx(u32 i, J2DTexMtx* mtx) { mTexMtx[i] = mtx; }
J2DTexCoord& getTexCoord(u32 i) { return mTexGenCoord[i]; }

/* 802EB620 */ virtual ~J2DTexGenBlock();
}; // Size: 0x48
Expand All @@ -659,7 +660,7 @@ struct J2DColorChanInfo {
/* 0x0 */ u8 field_0x3;
};

inline u8 J2DCalcColorChanID(u8 param_1) { return param_1; }
inline u8 J2DCalcColorChanID(const J2DColorChanInfo& info) { return info.field_0x1; }
extern const J2DColorChanInfo j2dDefaultColorChanInfo;

/**
Expand All @@ -672,12 +673,13 @@ class J2DColorChan {
setColorChanInfo(j2dDefaultColorChanInfo);
}
J2DColorChan(const J2DColorChanInfo& info) {
mColorChan = J2DCalcColorChanID(info.field_0x1);
mColorChan = J2DCalcColorChanID(info);
}

void setColorChanInfo(const J2DColorChanInfo& info) {
mColorChan = J2DCalcColorChanID(info.field_0x1);
mColorChan = J2DCalcColorChanID(info);
}

u16 getMatSrc() const { return mColorChan & 1; }

private:
Expand All @@ -701,7 +703,7 @@ class J2DColorBlock {
/* 802EB394 */ void initialize();
/* 802EB424 */ void setGX();

/* 802EB0F4 */ virtual ~J2DColorBlock();
/* 802EB0F4 */ virtual ~J2DColorBlock() {}

JUtility::TColor* getMatColor(u32 i) { return &mMatColor[i]; }
J2DColorChan* getColorChan(u32 i) { return &mColorChan[i]; }
Expand Down
18 changes: 9 additions & 9 deletions include/JSystem/J2DGraph/J2DMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class J2DMaterial {
struct J2DMaterialAnmPointer {
/* 802EA79C */ J2DMaterialAnmPointer();

/* 0x00 */ J2DAnmBase* field_0x0;
/* 0x04 */ J2DAnmBase* field_0x4;
/* 0x08 */ J2DAnmBase* field_0x8;
/* 0x0C */ J2DAnmBase* field_0xc;
/* 0x10 */ u16 field_0x10;
/* 0x12 */ u16 field_0x12[8];
/* 0x22 */ u16 field_0x22[8];
/* 0x32 */ u16 field_0x32[4];
/* 0x3A */ u16 field_0x3a[4];
/* 0x00 */ J2DAnmColor* mColorAnm;
/* 0x04 */ J2DAnmTextureSRTKey* mSRTAnm;
/* 0x08 */ J2DAnmTexPattern* mPatternAnm;
/* 0x0C */ J2DAnmTevRegKey* mTevAnm;
/* 0x10 */ u16 mColorIds;
/* 0x12 */ u16 mSRTIds[8];
/* 0x22 */ u16 mPatternIds[8];
/* 0x32 */ u16 mTevCRegIds[4];
/* 0x3A */ u16 mTevKRegIds[4];
}; // Size: 0x44

/* 802EA1AC */ J2DMaterial();
Expand Down
14 changes: 8 additions & 6 deletions include/JSystem/J2DGraph/J2DTevs.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
*
*/
struct J2DTextureSRTInfo {
/* 0x00 */ f32 field_0x0;
/* 0x04 */ f32 field_0x4;
/* 0x08 */ f32 field_0x8;
/* 0x0C */ f32 field_0xc;
/* 0x10 */ f32 field_0x10;
/* 0x00 */ f32 mScaleX;
/* 0x04 */ f32 mScaleY;
/* 0x08 */ f32 mRotationDeg;
/* 0x0C */ f32 mTranslationX;
/* 0x10 */ f32 mTranslationY;
}; // Size: 0x14

/**
Expand Down Expand Up @@ -274,6 +274,7 @@ class J2DTexCoord {
*(J2DTexCoordInfo*)this = info;
}
void setTexCoordInfo(const J2DTexCoordInfo& info) { mTexCoordInfo = info; }
void setTexGenMtx(u8 texGenMtx) { mTexCoordInfo.mTexGenMtx = texGenMtx; }
s32 getTexGenType() { return mTexCoordInfo.mTexGenType; }
s32 getTexGenSrc() { return mTexCoordInfo.mTexGenSrc; }
s32 getTexGenMtx() { return mTexCoordInfo.mTexGenMtx; }
Expand Down Expand Up @@ -513,14 +514,15 @@ inline u8 J2DCalcTevSwapTable(u8 param_0, u8 param_1, u8 param_2, u8 param_3) {
}

extern const J2DTevSwapModeTableInfo j2dDefaultTevSwapModeTable;
extern const u8 data_804561AC;

/**
* @ingroup jsystem-j2d
*
*/
class J2DTevSwapModeTable {
public:
/* 802F1934 */ J2DTevSwapModeTable();
/* 802F1934 */ J2DTevSwapModeTable() { field_0x0 = data_804561AC; }
J2DTevSwapModeTable(const J2DTevSwapModeTableInfo& info) {
field_0x0 = J2DCalcTevSwapTable(info.field_0x0, info.field_0x1, info.field_0x2, info.field_0x3);
}
Expand Down
1 change: 1 addition & 0 deletions include/JSystem/J3DGraphAnimator/J3DJointTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class J3DJointTree {
void setHierarchy(J3DModelHierarchy* hierarchy) { mHierarchy = hierarchy; }
void setBasicMtxCalc(J3DMtxCalc* calc) { mBasicMtxCalc = calc; }
u16 getWEvlpMtxNum() const { return mWEvlpMtxNum; }
u16* getWEvlpMixIndex() const { return mWEvlpMixMtxIndex; }
u8 getWEvlpMixMtxNum(u16 idx) const { return mWEvlpMixMtxNum[idx]; }
u16 * getWEvlpMixMtxIndex() const { return mWEvlpMixMtxIndex; }
f32 * getWEvlpMixWeight() const { return mWEvlpMixWeight; }
Expand Down
6 changes: 5 additions & 1 deletion src/JSystem/J2DGraph/J2DAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,4 +905,8 @@ J2DAnmTexPattern::J2DAnmTexPatternTIMGPointer::J2DAnmTexPatternTIMGPointer() {

J2DAnmTexPattern::J2DAnmTexPatternTIMGPointer::~J2DAnmTexPatternTIMGPointer() {
delete mPalette;
}
}

static void dummyDelete(J2DAnmTexPattern* pattern) {
delete pattern;
}
Loading

0 comments on commit e368cc7

Please sign in to comment.