diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2024-01-24 04:00:46 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-24 14:00:46 +0200 |
| commit | ba44ade90c3f04f5c163278fcadc4361c263acbb (patch) | |
| tree | 3b7948dc4dcf260ff61230da15ddea595635cbc8 /include | |
| parent | b2310b84b65e62d9f1a82a5b9e52766b325b765f (diff) | |
more various JSystem work (#2046)
* most of J3DAnmLoader done
* J3D / JKernel / JUTConsole work
* remove asm
* fix build
* dol 50%
Diffstat (limited to 'include')
| -rw-r--r-- | include/JSystem/J2DGraph/J2DAnimation.h | 2 | ||||
| -rw-r--r-- | include/JSystem/J2DGraph/J2DAnmLoader.h | 13 | ||||
| -rw-r--r-- | include/JSystem/J2DGraph/J2DPicture.h | 9 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DAnimation.h | 268 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DCluster.h | 52 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DSkinDeform.h | 1 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DMatBlock.h | 18 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DPacket.h | 3 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DTevs.h | 2 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphLoader/J3DAnmLoader.h | 9 | ||||
| -rw-r--r-- | include/JSystem/JGadget/linklist.h | 290 | ||||
| -rw-r--r-- | include/JSystem/JKernel/JKRDvdAramRipper.h | 3 | ||||
| -rw-r--r-- | include/JSystem/JKernel/JKRDvdArchive.h | 2 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/ctb.h | 3 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/stb.h | 2 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTConsole.h | 7 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_m3d_g_lin.h | 1 | ||||
| -rw-r--r-- | include/dolphin/gd.h | 19 |
18 files changed, 446 insertions, 258 deletions
diff --git a/include/JSystem/J2DGraph/J2DAnimation.h b/include/JSystem/J2DGraph/J2DAnimation.h index 1e3f84653b..b2ab398cee 100644 --- a/include/JSystem/J2DGraph/J2DAnimation.h +++ b/include/JSystem/J2DGraph/J2DAnimation.h @@ -56,7 +56,7 @@ public: /* 8030A358 */ virtual ~J2DAnmVtxColor() {} /* 8030363C */ virtual void getColor(u8, u16, _GXColor*) const; u16 getAnmTableNum(u8 param_0) const { return mAnmTableNum[param_0]; } - J3DAnmVtxColorIndexDataItem* getAnmVtxColorIndexData(u8 param_0, u16 param_1) const { return mVtxColorIndexData[param_0]->field_0x0 + param_1; } + J3DAnmVtxColorIndexData* getAnmVtxColorIndexData(u8 param_0, u16 param_1) const { return &mVtxColorIndexData[param_0][param_1]; } u16* getVtxColorIndexPointer(u8 param_0) const { return mVtxColorIndexPointer[param_0]; } /* 0x10 */ u16 mAnmTableNum[2]; diff --git a/include/JSystem/J2DGraph/J2DAnmLoader.h b/include/JSystem/J2DGraph/J2DAnmLoader.h index c135b48320..73d000fcca 100644 --- a/include/JSystem/J2DGraph/J2DAnmLoader.h +++ b/include/JSystem/J2DGraph/J2DAnmLoader.h @@ -16,18 +16,6 @@ public: void* mpResource; }; -struct J3DAnmTransformKeyData { - /* 0x00 */ u8 _0[0x8]; - /* 0x08 */ u8 _8; - /* 0x09 */ u8 _9; - /* 0x0A */ s16 mFrameMax; - /* 0x0C */ u16 _C; - /* 0x0E */ u8 _E[0x14 - 0xE]; - /* 0x14 */ s32 mTableOffset; - /* 0x18 */ s32 mScaleOffset; - /* 0x1C */ s32 mRotationOffset; - /* 0x20 */ s32 mTranslateOffset; -}; struct J3DAnmTextureSRTKeyData; struct J3DAnmColorKeyData; struct J3DAnmVtxColorKeyData; @@ -37,6 +25,7 @@ struct J3DAnmColorFullData; struct J3DAnmTexPatternFullData; struct J3DAnmVisibilityFullData; struct J3DAnmVtxColorFullData; +struct J3DAnmTransformKeyData; class J2DAnmKeyLoader_v15 : public J2DAnmLoader { public: diff --git a/include/JSystem/J2DGraph/J2DPicture.h b/include/JSystem/J2DGraph/J2DPicture.h index b3ff43f6ee..40570ca8d4 100644 --- a/include/JSystem/J2DGraph/J2DPicture.h +++ b/include/JSystem/J2DGraph/J2DPicture.h @@ -12,10 +12,17 @@ struct ResTIMG; struct ResTLUT; enum J2DMirror { - /* 0x0 */ MIRROR0, // temp, figure out later + /* 0 */ MIRROR0, // temp, figure out later + /* 1 */ J2DMirror_Y = (1 << 0), + /* 2 */ J2DMirror_X = (1 << 1), }; enum J2DBinding { + /* 1 */ J2DBind_Bottom = (1 << 0), + /* 2 */ J2DBind_Top = (1 << 1), + /* 4 */ J2DBind_Right = (1 << 2), + /* 8 */ J2DBind_Left = (1 << 3), + /* 0xF */ BIND15 = 15, // temp, figure out later }; diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index a35eed551d..be944dd686 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -5,6 +5,26 @@ #include "JSystem/JUtility/JUTNameTab.h" #include "global.h" +struct JUTDataBlockHeader { + /* 0x0 */ u32 mType; + /* 0x4 */ u32 mSize; + + const JUTDataBlockHeader* getNext() const { // fake inline + return reinterpret_cast<const JUTDataBlockHeader*>(reinterpret_cast<const u8*>(this) + + mSize); + } +}; + +struct JUTDataFileHeader { // actual struct name unknown + /* 0x00 */ u32 mMagic; + /* 0x04 */ u32 mType; + /* 0x08 */ u32 mFileSize; + /* 0x0C */ u32 mBlockNum; + /* 0x10 */ u8 _10[0x1C - 0x10]; + /* 0x1C */ u32 mSeAnmOffset; // Only exists for some BCKs + /* 0x20 */ JUTDataBlockHeader mFirstBlock; +}; + typedef struct _GXColor GXColor; typedef struct _GXColorS10 GXColorS10; @@ -21,13 +41,9 @@ struct J3DAnmColorKeyTable { J3DAnmKeyTableBase mAInfo; }; // Size = 0x18 -struct J3DAnmVtxColorIndexDataItem { - u16 count; - u32 offset; -}; - struct J3DAnmVtxColorIndexData { - J3DAnmVtxColorIndexDataItem field_0x0[4]; + /* 0x00 */ u16 mNum; + /* 0x04 */ void* mpData; }; struct J3DAnmColorFullTable { @@ -285,8 +301,55 @@ struct J3DAnmColorFullData { /* PlaceHolder Structure */ STATIC_ASSERT(sizeof(J3DAnmColorFullData) == 0x34); +struct J3DAnmClusterKeyTable { + /* 0x00 */ J3DAnmKeyTableBase mWeightTable; +}; + +struct J3DAnmTransformKeyData { + /* 0x00 */ JUTDataBlockHeader mHeader; + /* 0x08 */ u8 field_0x8; + /* 0x09 */ u8 field_0x9; + /* 0x0A */ s16 mFrameMax; + /* 0x0C */ u16 field_0xc; + /* 0x10 */ int field_0x10; + /* 0x14 */ s32 mTableOffset; + /* 0x18 */ s32 field_0x18; + /* 0x1c */ s32 field_0x1c; + /* 0x20 */ s32 field_0x20; +}; + +struct J3DAnmClusterKeyData { + /* 0x00 */ JUTDataBlockHeader mHeader; + /* 0x08 */ u8 field_0x8; + /* 0x0A */ s16 mFrameMax; + /* 0x0C */ s32 field_0xc; + /* 0x10 */ s32 mTableOffset; + /* 0x14 */ s32 mWeightOffset; +}; + +struct J3DAnmClusterFullData { + /* 0x00 */ JUTDataBlockHeader mHeader; + /* 0x08 */ u8 field_0x8; + /* 0x0A */ s16 mFrameMax; + /* 0x0C */ s32 field_0xc; + /* 0x10 */ s32 mTableOffset; + /* 0x14 */ s32 mWeightOffset; +}; + +struct J3DAnmClusterFullTable { + u16 mMaxFrame; + u16 mOffset; +}; + class J3DAnmBase { public: + J3DAnmBase() { + mAttribute = 0; + field_0x5 = 0; + mFrameMax = 0; + mFrame = 0.0f; + } + J3DAnmBase(s16 i_frameMax) { mAttribute = 0; field_0x5 = 0; @@ -295,13 +358,13 @@ public: } virtual ~J3DAnmBase(); + virtual s32 getKind() const = 0; u8 getAttribute() const { return mAttribute; } s16 getFrameMax() const { return mFrameMax; } f32 getFrame() const { return mFrame; } void setFrame(f32 frame) { mFrame = frame; } -private: /* 0x4 */ u8 mAttribute; /* 0x5 */ u8 field_0x5; /* 0x6 */ s16 mFrameMax; @@ -316,21 +379,20 @@ public: /* 8003C77C */ virtual s32 getKind() const; virtual void getTransform(u16, J3DTransformInfo*) const = 0; -private: - /* 0x0C */ f32* field_0xc; - /* 0x10 */ s16* field_0x10; - /* 0x14 */ f32* field_0x14; + /* 0x0C */ f32* mScaleData; + /* 0x10 */ s16* mRotData; + /* 0x14 */ f32* mTransData; /* 0x18 */ s16 field_0x18; /* 0x1A */ s16 field_0x1a; - /* 0x1C */ s16 field_0x1c; + /* 0x1C */ u16 field_0x1c; /* 0x1E */ s16 field_0x1e; }; // Size: 0x20 class J3DAnmTransformKey : public J3DAnmTransform { public: J3DAnmTransformKey() : J3DAnmTransform(0, NULL, NULL, NULL) { - field_0x20 = 0; - field_0x24 = 0; + mDecShift = 0; + mAnmTable = 0; } /* 80329A34 */ void calcTransform(f32, u16, J3DTransformInfo*) const; @@ -339,19 +401,19 @@ public: /* 8003C800 */ virtual s32 getKind() const; /* 8003C808 */ virtual void getTransform(u16, J3DTransformInfo*) const; -private: - /* 0x20 */ int field_0x20; - /* 0x24 */ int field_0x24; + /* 0x20 */ int mDecShift; + /* 0x24 */ J3DAnmTransformKeyTable* mAnmTable; }; // Size: 0x28 class J3DAnmTransformFull : public J3DAnmTransform { public: + J3DAnmTransformFull() : J3DAnmTransform(0, NULL, NULL, NULL) { mAnmTable = NULL; } + /* 8032C2AC */ virtual ~J3DAnmTransformFull(); /* 8032C318 */ virtual s32 getKind() const; /* 80328E90 */ virtual void getTransform(u16, J3DTransformInfo*) const; -private: - /* 0x20 */ int field_0x20; + /* 0x20 */ J3DAnmTransformFullTable* mAnmTable; }; // Size: 0x24 class J3DAnmTransformFullWithLerp : public J3DAnmTransformFull { @@ -380,34 +442,33 @@ public: } u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; } - u16 getUpdateMaterialNum() const { return field_0x14 / 3; } - -private: - /* 0x0C */ int field_0xc; - /* 0x10 */ int field_0x10; - /* 0x14 */ u16 field_0x14; - /* 0x16 */ u16 field_0x16; - /* 0x18 */ u16 field_0x18; - /* 0x1A */ u16 field_0x1a; - /* 0x1C */ int field_0x1c; - /* 0x20 */ int field_0x20; - /* 0x24 */ int field_0x24; - /* 0x28 */ u8 mUpdateTexMtxID[4]; + u16 getUpdateMaterialNum() const { return mTrackNum / 3; } + + /* 0x0C */ int mDecShift; + /* 0x10 */ J3DAnmTransformKeyTable* mAnmTable; + /* 0x14 */ u16 mTrackNum; + /* 0x16 */ u16 mScaleNum; + /* 0x18 */ u16 mRotNum; + /* 0x1A */ u16 mTransNum; + /* 0x1C */ f32* mScaleData; + /* 0x20 */ s16* mRotData; + /* 0x24 */ f32* mTransData; + /* 0x28 */ u8* mUpdateTexMtxID; /* 0x2C */ u16* mUpdateMaterialID; - /* 0x30 */ JUTNameTab field_0x30; - /* 0x40 */ int field_0x40; + /* 0x30 */ JUTNameTab mUpdateMaterialName; + /* 0x40 */ Vec* mSRTCenter; /* 0x44 */ u16 field_0x44; /* 0x46 */ u16 field_0x46; /* 0x48 */ u16 field_0x48; /* 0x4A */ u16 field_0x4a; - /* 0x4C */ int field_0x4c; - /* 0x50 */ int field_0x50; - /* 0x54 */ int field_0x54; - /* 0x58 */ int field_0x58; - /* 0x5C */ u8 field_0x5c[4]; - /* 0x60 */ u16* field_0x60; - /* 0x64 */ JUTNameTab field_0x64; - /* 0x74 */ u8 field_0x74[4]; + /* 0x4C */ void* field_0x4c; + /* 0x50 */ void* field_0x50; + /* 0x54 */ void* field_0x54; + /* 0x58 */ void* field_0x58; + /* 0x5C */ u8* mPostUpdateTexMtxID; + /* 0x60 */ u16* mPostUpdateMaterialID; + /* 0x64 */ JUTNameTab mPostUpdateMaterialName; + /* 0x74 */ Vec* mPostSRTCenter; /* 0x78 */ u32 mTexMtxCalcType; }; // Size: 0x7C @@ -426,8 +487,7 @@ public: bool isValidUpdateMaterialID(u16 id) const { return mUpdateMaterialID[id] != 0xFFFF; } J3DAnmTexPatternFullTable* getAnmTable() { return mAnmTable; } -private: - /* 0x0C */ void* field_0xc; + /* 0x0C */ u16* mTextureIndex; /* 0x10 */ J3DAnmTexPatternFullTable* mAnmTable; /* 0x14 */ u16 field_0x14; /* 0x16 */ u16 mUpdateMaterialNum; @@ -452,31 +512,30 @@ public: u16 getCRegUpdateMaterialID(u16 idx) const { return mCRegUpdateMaterialID[idx]; } u16 getKRegUpdateMaterialID(u16 idx) const { return mKRegUpdateMaterialID[idx]; } -private: /* 0x0C */ u16 mCRegUpdateMaterialNum; /* 0x0E */ u16 mKRegUpdateMaterialNum; - /* 0x10 */ u16 field_0x10; - /* 0x12 */ u16 field_0x12; - /* 0x14 */ u16 field_0x14; - /* 0x16 */ u16 field_0x16; - /* 0x18 */ u16 field_0x18; - /* 0x1A */ u16 field_0x1a; - /* 0x1C */ u16 field_0x1c; - /* 0x1E */ u16 field_0x1e; + /* 0x10 */ u16 mCRegDataCountR; + /* 0x12 */ u16 mCRegDataCountG; + /* 0x14 */ u16 mCRegDataCountB; + /* 0x16 */ u16 mCRegDataCountA; + /* 0x18 */ u16 mKRegDataCountR; + /* 0x1A */ u16 mKRegDataCountG; + /* 0x1C */ u16 mKRegDataCountB; + /* 0x1E */ u16 mKRegDataCountA; /* 0x20 */ u16* mCRegUpdateMaterialID; - /* 0x24 */ JUTNameTab field_0x24; + /* 0x24 */ JUTNameTab mCRegUpdateMaterialName; /* 0x34 */ u16* mKRegUpdateMaterialID; - /* 0x38 */ JUTNameTab field_0x38; - /* 0x48 */ void* field_0x48; - /* 0x4C */ void* field_0x4c; - /* 0x50 */ int field_0x50; - /* 0x54 */ int field_0x54; - /* 0x58 */ int field_0x58; - /* 0x5C */ int field_0x5c; - /* 0x60 */ int field_0x60; - /* 0x64 */ int field_0x64; - /* 0x68 */ int field_0x68; - /* 0x6C */ int field_0x6c; + /* 0x38 */ JUTNameTab mKRegUpdateMaterialName; + /* 0x48 */ J3DAnmCRegKeyTable* mAnmCRegKeyTable; + /* 0x4C */ J3DAnmKRegKeyTable* mAnmKRegKeyTable; + /* 0x50 */ s16* mAnmCRegDataR; + /* 0x54 */ s16* mAnmCRegDataG; + /* 0x58 */ s16* mAnmCRegDataB; + /* 0x5C */ s16* mAnmCRegDataA; + /* 0x60 */ s16* mAnmKRegDataR; + /* 0x64 */ s16* mAnmKRegDataG; + /* 0x68 */ s16* mAnmKRegDataB; + /* 0x6C */ s16* mAnmKRegDataA; }; // Size: 0x70 class J3DAnmColor : public J3DAnmBase { @@ -492,14 +551,13 @@ public: bool isValidUpdateMaterialID(u16 id) const { return mUpdateMaterialID[id] != 0xFFFF; } u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; } -private: /* 0x0C */ u16 field_0xc; /* 0x0E */ u16 field_0xe; /* 0x10 */ u16 field_0x10; /* 0x12 */ u16 field_0x12; /* 0x14 */ u16 mUpdateMaterialNum; /* 0x18 */ u16* mUpdateMaterialID; - /* 0x1C */ JUTNameTab field_0x1c; + /* 0x1C */ JUTNameTab mUpdateMaterialName; }; // Size: 0x2C class J3DAnmColorKey : public J3DAnmColor { @@ -510,12 +568,11 @@ public: /* 8032BEB0 */ virtual s32 getKind() const; /* 8032AB54 */ virtual void getColor(u16, _GXColor*) const; -private: - /* 0x2C */ int field_0x2c; - /* 0x30 */ int field_0x30; - /* 0x34 */ int field_0x34; - /* 0x38 */ int field_0x38; - /* 0x3C */ int field_0x3c; + /* 0x2C */ s16* field_0x2c; + /* 0x30 */ s16* field_0x30; + /* 0x34 */ s16* field_0x34; + /* 0x38 */ s16* field_0x38; + /* 0x3C */ J3DAnmColorKeyTable* field_0x3c; }; class J3DAnmColorFull : public J3DAnmColor { @@ -526,12 +583,11 @@ public: /* 8032BEB0 */ virtual s32 getKind() const; /* 8032AB54 */ virtual void getColor(u16, _GXColor*) const; -private: - /* 0x2C */ int field_0x2c; - /* 0x30 */ int field_0x30; - /* 0x34 */ int field_0x34; - /* 0x38 */ int field_0x38; - /* 0x3C */ int field_0x3c; + /* 0x2C */ u8* mColorR; + /* 0x30 */ u8* mColorG; + /* 0x34 */ u8* mColorB; + /* 0x38 */ u8* mColorA; + /* 0x3C */ J3DAnmColorFullTable* mAnmTable; }; class J3DAnmVtxColor : public J3DAnmBase { @@ -542,9 +598,8 @@ public: virtual s32 getKind() const; virtual void getColor(u8, u16, _GXColor*) const; -private: - /* 0x0C */ s16 mAnmTableNum[2]; - /* 0x10 */ int mAnmVtxColorIndexData[2]; + /* 0x0C */ u16 mAnmTableNum[2]; + /* 0x10 */ J3DAnmVtxColorIndexData* mAnmVtxColorIndexData[2]; }; // Size: 0x18 class J3DAnmVtxColorKey : public J3DAnmVtxColor { @@ -555,49 +610,77 @@ public: /* 8032BFBC */ virtual s32 getKind() const; /* 8032A53C */ virtual void getColor(u8, u16, _GXColor*) const; -private: - /* 0x18 */ int field_0x18[2]; + /* 0x1C */ J3DAnmColorKeyTable* mpTable[2]; + /* 0x24 */ s16* mColorR; + /* 0x28 */ s16* mColorG; + /* 0x2C */ s16* mColorB; + /* 0x30 */ s16* mColorA; }; class J3DAnmVtxColorFull : public J3DAnmVtxColor { +public: /* 8032A30C */ J3DAnmVtxColorFull(); /* 8032BFC4 */ virtual ~J3DAnmVtxColorFull(); /* 8032C030 */ virtual s32 getKind() const; /* 8032A368 */ virtual void getColor(u8, u16, _GXColor*) const; -private: - /* 0x18 */ int field_0x18[2]; + /* 0x1C */ J3DAnmColorFullTable* mpTable[2]; + /* 0x24 */ u8* mColorR; + /* 0x28 */ u8* mColorG; + /* 0x2C */ u8* mColorB; + /* 0x30 */ u8* mColorA; }; class J3DAnmCluster : public J3DAnmBase { public: + J3DAnmCluster(s16 param_1, f32* param_2) : J3DAnmBase(param_1) { mWeight = param_2; } + /* 8032BCAC */ virtual ~J3DAnmCluster(); /* 8032BF44 */ virtual s32 getKind() const; /* 8032BF4C */ virtual f32 getWeight(u16) const; -private: - /* 0x0C */ f32* field_0xc; + /* 0x0C */ f32* mWeight; }; // Size: 0x10 class J3DAnmClusterFull : public J3DAnmCluster { public: + J3DAnmClusterFull() : J3DAnmCluster(0, 0) { mAnmTable = NULL; } + /* 8032BCAC */ virtual ~J3DAnmClusterFull(); /* 8032BF44 */ virtual s32 getKind() const; /* 8032BF4C */ virtual f32 getWeight(u16) const; -private: - /* 0x10 */ int field_0x10; + /* 0x10 */ J3DAnmClusterFullTable* mAnmTable; }; class J3DAnmClusterKey : public J3DAnmCluster { public: + J3DAnmClusterKey() : J3DAnmCluster(0, NULL) { mAnmTable = NULL; } + /* 8032C044 */ virtual ~J3DAnmClusterKey(); /* 8032C0B0 */ virtual s32 getKind() const; /* 8032A218 */ virtual f32 getWeight(u16) const; -private: - /* 0x10 */ int field_0x10; + /* 0x10 */ J3DAnmClusterKeyTable* mAnmTable; +}; + +class J3DAnmVisibilityFull : public J3DAnmBase { +public: + J3DAnmVisibilityFull() : J3DAnmBase(0) { + mUpdateMaterialNum = 0; + field_0xe = 0; + mAnmTable = NULL; + mVisibility = NULL; + } + + /* 8033979C */ virtual ~J3DAnmVisibilityFull(); + /* 803397F8 */ virtual s32 getKind() const; + + /* 0x0C */ u16 mUpdateMaterialNum; + /* 0x0E */ u16 field_0xe; + /* 0x10 */ J3DAnmVisibilityFullTable* mAnmTable; + /* 0x14 */ u8* mVisibility; }; class J3DFrameCtrl { @@ -639,7 +722,6 @@ public: mState = 0; } -private: /* 0x04 */ u8 mAttribute; /* 0x05 */ u8 mState; /* 0x06 */ s16 mStart; diff --git a/include/JSystem/J3DGraphAnimator/J3DCluster.h b/include/JSystem/J3DGraphAnimator/J3DCluster.h index 4db7189f2d..221fd98d99 100644 --- a/include/JSystem/J3DGraphAnimator/J3DCluster.h +++ b/include/JSystem/J3DGraphAnimator/J3DCluster.h @@ -13,6 +13,20 @@ class JUTNameTab; class J3DCluster { public: + void operator=(const J3DCluster& other) { + mMaxAngle = other.mMaxAngle; + mMinAngle = other.mMinAngle; + mClusterKey = other.mClusterKey; + mFlags = other.mFlags; + mKeyNum = other.mKeyNum; + mPosNum = other.mPosNum; + field_0x14 = other.field_0x14; + field_0x16 = other.field_0x16; + field_0x18 = other.field_0x18; + mClusterVertex = other.mClusterVertex; + mDeformer = other.mDeformer; + } + J3DDeformer* getDeformer() { return mDeformer; } void setDeformer(J3DDeformer* deformer) { mDeformer = deformer; } @@ -30,7 +44,20 @@ public: /* 0x20 */ J3DDeformer* mDeformer; }; -struct J3DClusterKey {}; +class J3DClusterKey { +public: + void operator=(const J3DClusterKey& other) { + mPosNum = other.mPosNum; + mNrmNum = other.mNrmNum; + field_0x4 = other.field_0x4; + field_0x8 = other.field_0x8; + } + + /* 0x00 */ u16 mPosNum; + /* 0x02 */ u16 mNrmNum; + /* 0x04 */ void* field_0x4; + /* 0x08 */ void* field_0x8; +}; // Size: 0x0C class J3DDeformData { public: @@ -40,11 +67,13 @@ public: /* 8032E274 */ void deform(J3DModel*); /* 8032E364 */ void setAnm(J3DAnmCluster*); - J3DCluster* getClusterPointer(u16 index) { - return &mClusterPointer[index]; - } + J3DCluster* getClusterPointer(u16 index) { return &mClusterPointer[index]; } + u16 getClusterNum() const { return mClusterNum; } + u16 getClusterKeyNum() const { return mClusterKeyNum; } + J3DClusterKey* getClusterKeyPointer(u16 i) { return &mClusterKeyPointer[i]; } + f32* getVtxPos() { return mVtxPos; } + f32* getVtxNrm() { return mVtxNrm; } -private: /* 0x00 */ u16 mClusterNum; /* 0x02 */ u16 mClusterKeyNum; /* 0x04 */ u16 mClusterVertexNum; @@ -59,4 +88,17 @@ private: /* 0x24 */ JUTNameTab* mClusterKeyName; }; // Size: 0x28 +class J3DClusterVertex { +public: + void operator=(const J3DClusterVertex& other) { + mNum = other.mNum; + field_0x4 = other.field_0x4; + field_0x8 = other.field_0x8; + } + + /* 0x00 */ u16 mNum; + /* 0x04 */ u16* field_0x4; + /* 0x08 */ u16* field_0x8; +}; // Size: 0x0C + #endif /* J3DCLUSTER_H */ diff --git a/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h b/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h index ac68a97489..6adf2c350e 100644 --- a/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h +++ b/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h @@ -80,7 +80,6 @@ public: void offFlag(u32 i_flag) { mFlags &= ~i_flag; } void setAnmCluster(J3DAnmCluster* anm) { mAnmCluster = anm; } -private: /* 0x00 */ J3DDeformData* mDeformData; /* 0x04 */ J3DAnmCluster* mAnmCluster; /* 0x08 */ f32* field_0x8; diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h index 46f5dc49f7..4f8e8bf0aa 100644 --- a/include/JSystem/J3DGraphBase/J3DMatBlock.h +++ b/include/JSystem/J3DGraphBase/J3DMatBlock.h @@ -102,7 +102,6 @@ public: /* 80322DA0 */ virtual void setTexMtxOffset(u32); /* 80317180 */ virtual ~J3DTexGenBlockPatched(); -private: /* 0x04 */ u32 mTexGenNum; /* 0x08 */ J3DTexCoord mTexCoord[8]; /* 0x38 */ J3DTexMtx* mTexMtx[8]; @@ -126,7 +125,6 @@ public: /* 80322CC0 */ virtual J3DNBTScale* getNBTScale(); /* 80322CC8 */ virtual ~J3DTexGenBlockBasic(); -private: /* 0x5C */ J3DNBTScale mNBTScale; }; // Size: 0x6C @@ -147,7 +145,6 @@ public: /* 80322DFC */ virtual J3DNBTScale* getNBTScale(); /* 80322E04 */ virtual ~J3DTexGenBlock4(); -private: /* 0x5C */ J3DNBTScale mNBTScale; }; // Size: 0x6C @@ -275,7 +272,6 @@ public: /* 80322C08 */ virtual void setTevRegOffset(u32); /* 80322C10 */ virtual ~J3DTevBlockPatched(); -private: /* 0x08 */ u16 mTexNo[8]; /* 0x18 */ J3DTevOrder mTevOrder[8]; /* 0x38 */ J3DTevStage mTevStage[8]; @@ -346,7 +342,6 @@ public: /* 80322348 */ virtual void setTevRegOffset(u32); /* 80322350 */ virtual ~J3DTevBlock4(); -private: /* 0x08 */ u16 mTexNo[4]; /* 0x10 */ J3DTevOrder mTevOrder[4]; /* 0x20 */ u8 mTevStageNum; @@ -419,7 +414,6 @@ public: /* 8032270C */ virtual void setTevRegOffset(u32); /* 80322714 */ virtual ~J3DTevBlock2(); -private: /* 0x08 */ u16 mTexNo[2]; /* 0x0C */ J3DTevOrder mTevOrder[2]; /* 0x14 */ J3DGXColorS10 mTevColor[4]; @@ -492,7 +486,6 @@ public: /* 80321F7C */ virtual void setTevRegOffset(u32); /* 80321F84 */ virtual ~J3DTevBlock16(); -private: /* 0x008 */ u16 mTexNo[8]; /* 0x018 */ J3DTevOrder mTevOrder[16]; /* 0x058 */ u8 mTevStageNum; @@ -546,7 +539,6 @@ public: /* 803228EC */ virtual bool getTexNoOffset() const; /* 803228F4 */ virtual ~J3DTevBlock1(); -private: /* 0x08 */ u16 mTexNo[1]; /* 0x0A */ J3DTevOrder mTevOrder[1]; /* 0x0E */ J3DTevStage mTevStage[1]; @@ -749,7 +741,6 @@ public: /* 80321A68 */ virtual void setFogOffset(u32); /* 80321A70 */ virtual ~J3DPEBlockFull(); -private: /* 0x04 */ J3DFog mFog; /* 0x30 */ J3DAlphaComp mAlphaComp; /* 0x34 */ J3DBlend mBlend; @@ -789,7 +780,6 @@ public: /* 80321BBC */ virtual bool getDither() const; /* 80321BC4 */ virtual ~J3DPEBlockFogOff(); -private: /* 0x04 */ J3DAlphaComp mAlphaComp; /* 0x08 */ J3DBlend mBlend; /* 0x0C */ J3DZMode mZMode; @@ -889,7 +879,6 @@ public: /* 8032348C */ virtual bool getIndTexCoordScale(u32); /* 803234A0 */ virtual ~J3DIndBlockFull(); -private: /* 0x04 */ u8 mIndTexStageNum; /* 0x05 */ J3DIndTexOrder mIndTexOrder[4]; /* 0x18 */ J3DIndTexMtx mIndTexMtx[3]; @@ -908,6 +897,10 @@ struct J3DColorChanInfo { extern J3DColorChanInfo j3dDefaultColorChanInfo; +/* static inline u32 setChanCtrlMacro(u8 param_0, GXColorSrc param_1, GXColorSrc param_2, u32 param_3, GXDiffuseFn param_4, GXAttnFn param_5) { + +} */ + struct J3DColorChan { /* 8000E47C */ J3DColorChan() { setColorChanInfo(j3dDefaultColorChanInfo); @@ -1032,7 +1025,6 @@ public: /* 80323010 */ virtual void setColorChanOffset(u32); /* 80323018 */ virtual ~J3DColorBlockLightOn(); -private: /* 0x04 */ J3DGXColor mMatColor[2]; /* 0x0C */ J3DGXColor mAmbColor[2]; /* 0x14 */ u8 mColorChanNum; @@ -1078,7 +1070,6 @@ public: /* 80323250 */ virtual void setColorChanOffset(u32); /* 803170DC */ virtual ~J3DColorBlockLightOff(); -private: /* 0x04 */ J3DGXColor mMatColor[2]; /* 0x0C */ u8 mColorChanNum; /* 0x0E */ J3DColorChan mColorChan[4]; @@ -1103,7 +1094,6 @@ public: /* 803230D8 */ virtual bool getAmbColor(u32); /* 803230EC */ virtual ~J3DColorBlockAmbientOn(); -private: /* 0x20 */ J3DGXColor mAmbColor[2]; }; // Size: 0x28 diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h index 00827b8969..cb853c9c74 100644 --- a/include/JSystem/J3DGraphBase/J3DPacket.h +++ b/include/JSystem/J3DGraphBase/J3DPacket.h @@ -194,7 +194,10 @@ public: J3DMaterial* getMaterial() const { return mpMaterial; } J3DShapePacket* getShapePacket() const { return mpShapePacket; } void setShapePacket(J3DShapePacket* packet) { mpShapePacket = packet; } + void setMaterial(J3DMaterial* pMaterial) { mpMaterial = pMaterial; } + void setTexture(J3DTexture* pTexture) { mpTexture = pTexture; } void setInitShapePacket(J3DShapePacket* packet) { mpInitShapePacket = packet; } + void setMaterialID(u32 id) { mDiffFlag = id; } void setMaterialAnmID(J3DMaterialAnm* materialAnm) { mpMaterialAnm = materialAnm; } bool isChanged() const { return mDiffFlag & 0x80000000; } bool isEnabled_Diff() const { return mpInitShapePacket->getDisplayListObj() != NULL; } diff --git a/include/JSystem/J3DGraphBase/J3DTevs.h b/include/JSystem/J3DGraphBase/J3DTevs.h index 8d63bd4d92..35bfd28691 100644 --- a/include/JSystem/J3DGraphBase/J3DTevs.h +++ b/include/JSystem/J3DGraphBase/J3DTevs.h @@ -126,6 +126,8 @@ struct J3DTevSwapModeInfo { }; // Size: 0x4 struct J3DNBTScale; +struct J3DTexCoord; void loadNBTScale(J3DNBTScale& param_0); +void loadTexCoordGens(u32 param_0, J3DTexCoord* param_1); #endif /* J3DTEVS_H */ diff --git a/include/JSystem/J3DGraphLoader/J3DAnmLoader.h b/include/JSystem/J3DGraphLoader/J3DAnmLoader.h index 9378663410..15df300e0f 100644 --- a/include/JSystem/J3DGraphLoader/J3DAnmLoader.h +++ b/include/JSystem/J3DGraphLoader/J3DAnmLoader.h @@ -3,15 +3,18 @@ #include "dolphin/types.h" -enum J3DAnmLoaderDataBaseFlag { J3DLOADER_UNK_FLAG0 }; +enum J3DAnmLoaderDataBaseFlag { + J3DLOADER_UNK_FLAG0, + J3DLOADER_UNK_FLAG1, +}; class J3DAnmBase; struct J3DAnmLoaderDataBase { - /* 80337B40 */ static void* load(void const*, J3DAnmLoaderDataBaseFlag); + /* 80337B40 */ static J3DAnmBase* load(void const*, J3DAnmLoaderDataBaseFlag); /* 80338134 */ static void setResource(J3DAnmBase*, void const*); - static void* load(void const* param_0) { return load(param_0, J3DLOADER_UNK_FLAG0); } + static J3DAnmBase* load(void const* param_0) { return load(param_0, J3DLOADER_UNK_FLAG0); } }; #endif /* J3DANMLOADER_H */ diff --git a/include/JSystem/JGadget/linklist.h b/include/JSystem/JGadget/linklist.h index 6c89cbeb75..8e8e9178bc 100644 --- a/include/JSystem/JGadget/linklist.h +++ b/include/JSystem/JGadget/linklist.h @@ -2,7 +2,6 @@ #define LINKLIST_H #include "dolphin/types.h" -#include "JSystem/JUtility/JUTAssert.h" namespace JGadget { struct TLinkListNode { @@ -11,46 +10,84 @@ struct TLinkListNode { mPrev = NULL; } - TLinkListNode* getNext() { return mNext; } - TLinkListNode* getPrev() { return mPrev; } + TLinkListNode* getNext() const { return mNext; } + TLinkListNode* getPrev() const { return mPrev; } +public: /* 0x0 */ TLinkListNode* mNext; /* 0x4 */ TLinkListNode* mPrev; }; // Size: 0x8 struct TNodeLinkList { struct iterator { - iterator(TLinkListNode* pNode) { node = pNode; } - iterator(const iterator& iter) { *this = iter; } + explicit iterator(TLinkListNode* pNode) { node = pNode; } + iterator& operator++() { node = node->getNext(); - return *this; + return *this; } iterator& operator--() { node = node->getPrev(); - return *this; + return *this; + } + iterator operator++(int) { + const iterator old(*this); + (void)++*this; + return old; } - TLinkListNode* operator->() { return node; } + iterator operator--(int) { + const iterator old(*this); + (void)--*this; + return old; + } + friend bool operator==(iterator a, iterator b) { return a.node == b.node; } + friend bool operator!=(iterator a, iterator b) { return !(a == b); } - inline friend bool operator==(iterator a, iterator b) { return a.node == b.node; } + TLinkListNode* operator->() const { return node; } + TLinkListNode& operator*() const { return *node; } - TLinkListNode* node; + public: + /* 0x00 */ TLinkListNode* node; }; struct const_iterator { - const_iterator(TLinkListNode* pNode) { node = pNode; } + explicit const_iterator(TLinkListNode* pNode) { node = pNode; } const_iterator(const const_iterator& iter) { *this = iter; } - const_iterator(iterator iter) { *this = iter; } - TLinkListNode* operator->() const { return node; } + explicit const_iterator(iterator it) { node = it.node; } + const_iterator& operator++() { node = node->getNext(); - return *this; + return *this; + } + const_iterator& operator--() { + node = node->getPrev(); + return *this; + } + const_iterator operator++(int) { + const const_iterator old(*this); + (void)++*this; + return old; + } + const_iterator operator--(int) { + const const_iterator old(*this); + (void)--*this; + return old; } + friend bool operator==(const_iterator a, const_iterator b) { return a.node == b.node; } + friend bool operator!=(const_iterator a, const_iterator b) { return !(a == b); } + + friend bool operator==(const_iterator a, iterator b) { return a.node == b.node; } + friend bool operator!=(const_iterator a, iterator b) { return !(a == b); } - TLinkListNode* node; + const TLinkListNode* operator->() const { return node; } + const TLinkListNode& operator*() const { return *node; } + + public: + /* 0x00 */ TLinkListNode* node; }; TNodeLinkList() : ocObject_() { Initialize_(); } + ~TNodeLinkList(); void Initialize_() { count = 0; @@ -58,31 +95,47 @@ struct TNodeLinkList { ocObject_.mPrev = &ocObject_; } - iterator end() { - iterator iter(&ocObject_); - return iter; - } - - iterator begin() { - return iterator(ocObject_.getNext()); - } - + iterator begin() { return iterator(ocObject_.getNext()); } + const_iterator begin() const { return const_iterator(ocObject_.getNext()); } + iterator end() { return iterator(&ocObject_); } + const_iterator end() const { return const_iterator((TLinkListNode*)(&ocObject_)); } u32 size() { return count; } bool empty() { return size() == 0; } - iterator pop_front() { - return erase(begin()); + iterator pop_front() { return erase(begin()); } + + iterator erase(JGadget::TNodeLinkList::iterator, JGadget::TNodeLinkList::iterator); + iterator erase(JGadget::TNodeLinkList::iterator); + void splice(JGadget::TNodeLinkList::iterator, JGadget::TNodeLinkList&, + JGadget::TNodeLinkList::iterator); + iterator Find(const JGadget::TLinkListNode*); + iterator Insert(JGadget::TNodeLinkList::iterator, JGadget::TLinkListNode*); + iterator Erase(JGadget::TLinkListNode*); + void Remove(JGadget::TLinkListNode*); + + bool Iterator_isEnd_(const_iterator it) const { return it.node == &ocObject_; } + template <typename Predicate> + void Remove_if(Predicate predicate, TNodeLinkList& tList) { + iterator it = begin(); + + while (!Iterator_isEnd_(const_iterator(it))) { + if (predicate(*it)) { + iterator itPrev = it; + ++it; + tList.splice(tList.end(), *this, itPrev); + } else { + ++it; + } + } } - /* 802DCA1C */ ~TNodeLinkList(); - /* 802DCAA0 */ iterator erase(JGadget::TNodeLinkList::iterator, JGadget::TNodeLinkList::iterator); - /* 802DCA58 */ iterator erase(JGadget::TNodeLinkList::iterator); - /* 802DCB08 */ void splice(JGadget::TNodeLinkList::iterator, JGadget::TNodeLinkList&, - JGadget::TNodeLinkList::iterator); - /* 802DCBA8 */ iterator Insert(JGadget::TNodeLinkList::iterator, JGadget::TLinkListNode*); - /* 802DCBD4 */ iterator Erase(JGadget::TLinkListNode*); - /* 802DCBF8 */ void Remove(JGadget::TLinkListNode*); + template <typename Predicate> + void remove_if(Predicate predicate) { + TNodeLinkList list; + Remove_if(predicate, list); + } - /* 0x00 */ int count; +public: + /* 0x00 */ u32 count; /* 0x04 */ TLinkListNode ocObject_; }; // Size: 0xC @@ -90,108 +143,105 @@ template <typename T, int I> struct TLinkList : public TNodeLinkList { TLinkList() : TNodeLinkList() {} - struct iterator : TNodeLinkList::iterator { - iterator(TNodeLinkList::iterator iter) : TNodeLinkList::iterator(iter) {} - T& operator*() { return *operator->(); } - T* operator->() { - TLinkListNode* node = TNodeLinkList::iterator::operator->(); - JUT_ASSERT(541, node != 0); - return Element_toValue(node); + struct iterator { + explicit iterator(TNodeLinkList::iterator iter) : base(iter) {} + + iterator& operator++() { + ++base; + return *this; } iterator& operator--() { - TNodeLinkList::iterator::operator--(); + --base; return *this; } - // Stack issues. See JStudio::ctb::TControl::getObject - inline friend bool operator==(iterator a, iterator b) { - TNodeLinkList::iterator ita = a; - TNodeLinkList::iterator itb = b; - return operator==(ita,itb); + iterator operator++(int) { + const iterator old(*this); + ++*this; + return old; + } + iterator operator--(int) { + const iterator old(*this); + --*this; + return old; } - inline friend bool operator!=(iterator a, iterator b) { return !(a == b); } + friend bool operator==(iterator a, iterator b) { return a.base == b.base; } + friend bool operator!=(iterator a, iterator b) { return !(a == b); } + + T* operator->() const { return Element_toValue(base.operator->()); } + T& operator*() const { return *operator->(); } + + public: + /* 0x00 */ TNodeLinkList::iterator base; }; - struct const_iterator : TNodeLinkList::const_iterator { - const_iterator(TNodeLinkList::const_iterator iter) : TNodeLinkList::const_iterator(iter) {} - const_iterator(iterator iter) : TNodeLinkList::const_iterator(iter) {} - const T* operator->() const { - return Element_toValue(TNodeLinkList::const_iterator::operator->()); - } - const T& operator*() const { return *operator->(); } + struct const_iterator { + explicit const_iterator(TNodeLinkList::const_iterator iter) : base(iter) {} + explicit const_iterator(iterator iter) : base(iter.base) {} + const_iterator& operator++() { - TNodeLinkList::const_iterator::operator++(); + ++base; return *this; } - - friend bool operator==(const_iterator a, const_iterator b) { return a == b; } + const_iterator& operator--() { + --base; + return *this; + } + const_iterator operator++(int) { + const const_iterator old(*this); + ++*this; + return old; + } + const_iterator operator--(int) { + const const_iterator old(*this); + --*this; + return old; + } + friend bool operator==(const_iterator a, const_iterator b) { return a.base == b.base; } friend bool operator!=(const_iterator a, const_iterator b) { return !(a == b); } - }; - - TLinkListNode* Element_toNode(T* element) const { return &element->ocObject_; } - static T* Element_toValue(TLinkListNode* node) { return (T*)((char*)node - offsetof(T, ocObject_)); } - iterator Insert(TLinkList::iterator iter, T* element) { - TLinkListNode* node = Element_toNode(element); - return TNodeLinkList::Insert(iter, node); - } + const T* operator->() const { return Element_toValue(base.operator->()); } + const T& operator*() const { return *operator->(); } - iterator Erase(T* element) { - TLinkListNode* node = Element_toNode(element); - return ((TNodeLinkList*)this)->Erase(node); - } + public: + /* 0x00 */ TNodeLinkList::const_iterator base; + }; - TLinkList::iterator end() { - return iterator(TNodeLinkList::end()); + static const TLinkListNode* Element_toNode(const T* element) { + (void)element; // Debug-only assert + return reinterpret_cast<const TLinkListNode*>(reinterpret_cast<const char*>(element) - I); } - - TLinkList::const_iterator end() const { - return TLinkList::const_iterator(((TLinkList*)this)->end()); + static TLinkListNode* Element_toNode(T* element) { + (void)element; // Debug-only assert + return reinterpret_cast<TLinkListNode*>(reinterpret_cast<char*>(element) - I); } - - TLinkList::iterator begin() { - return iterator(TNodeLinkList::begin()); + static const T* Element_toValue(const TLinkListNode* node) { + (void)node; // Debug-only assert + return reinterpret_cast<const T*>(reinterpret_cast<const char*>(node) + I); } - - TLinkList::const_iterator begin() const { - return TLinkList::const_iterator(((TLinkList*)this)->begin()); + static T* Element_toValue(TLinkListNode* node) { + (void)node; // Debug-only assert + return reinterpret_cast<T*>(reinterpret_cast<char*>(node) + I); } - void Push_back(T* element) { - TLinkList::iterator iter = TLinkList::end(); - this->Insert(iter, element); + iterator Insert(iterator iter, T* element) { + return iterator(TNodeLinkList::Insert(iter.base, Element_toNode(element))); } - - T& front() { - JUT_ASSERT(642, !empty()); - return *begin(); - } - - T& back() { - JUT_ASSERT(652, !empty()); - return *--TLinkList::end(); + iterator Erase(T* element) { return iterator(TNodeLinkList::Erase(Element_toNode(element))); } + + iterator begin() { return iterator(TNodeLinkList::begin()); } + const_iterator begin() const { return const_iterator(const_cast<TLinkList*>(this)->begin()); } + iterator end() { return iterator(TNodeLinkList::end()); } + const_iterator end() const { return const_iterator(const_cast<TLinkList*>(this)->end()); } + T& front() { return *begin(); } + T& back() { return *--end(); } + void Push_front(T* element) { Insert(begin(), element); } + void Push_back(T* element) { Insert(end(), element); } + iterator Find(const T* element) { + return iterator(TNodeLinkList::Find(Element_toNode(element))); } + void Remove(T* element) { TNodeLinkList::Remove(Element_toNode(element)); } }; -template<typename T, int I> -bool operator==(const typename TLinkList<T, I>::const_iterator iter1, const typename TLinkList<T, I>::const_iterator iter2) { - return iter1->node == iter2->node; -} - -template<typename T, int I> -bool operator!=(const typename TLinkList<T, I>::const_iterator iter1, const typename TLinkList<T, I>::const_iterator iter2) { - return !(iter1 == iter2); -} - -// template<typename T, int I> -// inline bool operator==(typename TLinkList<T, I>::iterator iter1, typename TLinkList<T, I>::iterator iter2) { -// return iter1->node == iter2->node; -// } - -// template<typename T, int I> -// inline bool operator!=(typename TLinkList<T, I>::iterator iter1, typename TLinkList<T, I>::iterator iter2) { -// return !(iter1 == iter2); -// } - template <typename T, int I> struct TLinkList_factory : public TLinkList<T, I> { virtual ~TLinkList_factory() {} @@ -208,14 +258,14 @@ struct TLinkList_factory : public TLinkList<T, I> { template <typename T, int I> struct TEnumerator { - inline TEnumerator(typename TLinkList<T,I>::const_iterator _current, typename TLinkList<T,I>::const_iterator _end) : - current(_current), end(_end) - {} + inline TEnumerator(typename TLinkList<T, I>::const_iterator _current, + typename TLinkList<T, I>::const_iterator _end) + : current(_current), end(_end) {} bool isEnd() const { return current.node == end.node; } operator bool() const { return isEnd(); } T& operator*() { - T& rv = (T&)*current; + T& rv = (T&)*current; ++current; return rv; } @@ -226,8 +276,8 @@ struct TEnumerator { template <typename T, int I> struct TContainerEnumerator_const : public TEnumerator<T, I> { - inline TContainerEnumerator_const(const T* param_0) : TEnumerator<T,I>(param_0->begin(), param_0->end()) - {} + inline TContainerEnumerator_const(const T* param_0) + : TEnumerator<T, I>(param_0->begin(), param_0->end()) {} }; }; // namespace JGadget diff --git a/include/JSystem/JKernel/JKRDvdAramRipper.h b/include/JSystem/JKernel/JKRDvdAramRipper.h index 15d133e58f..29e62f94eb 100644 --- a/include/JSystem/JKernel/JKRDvdAramRipper.h +++ b/include/JSystem/JKernel/JKRDvdAramRipper.h @@ -45,8 +45,9 @@ public: static void setSZSBufferSize(u32 size) { sSZSBufferSize = size; } // TODO: fix type - static u8 sDvdAramAsyncList[12]; + static JSUList<JKRADCommand> sDvdAramAsyncList; static u32 sSZSBufferSize; + static bool errorRetry; }; inline JKRAramBlock *JKRDvdToAram(s32 entrynum, u32 p2, JKRExpandSwitch expSwitch, u32 p4, u32 p5, u32 *p6) { diff --git a/include/JSystem/JKernel/JKRDvdArchive.h b/include/JSystem/JKernel/JKRDvdArchive.h index fe72cd8f3a..83333ad96d 100644 --- a/include/JSystem/JKernel/JKRDvdArchive.h +++ b/include/JSystem/JKernel/JKRDvdArchive.h @@ -23,7 +23,7 @@ public: private: /* 0x00 */ // vtable /* 0x04 */ // JKRArchive - /* 0x64 */ s32 field_0x64; + /* 0x64 */ s32 mDataOffset; /* 0x68 */ JKRDvdFile* mDvdFile; }; diff --git a/include/JSystem/JStudio/JStudio/ctb.h b/include/JSystem/JStudio/JStudio/ctb.h index 85caa0d2cd..a3ea31c3fd 100644 --- a/include/JSystem/JStudio/JStudio/ctb.h +++ b/include/JSystem/JStudio/JStudio/ctb.h @@ -4,6 +4,7 @@ #include "JSystem/JGadget/binary.h" #include "JSystem/JGadget/linklist.h" #include "JSystem/JStudio/JStudio/object-id.h" +#include "JSystem/JUtility/JUTAssert.h" namespace JStudio { namespace ctb { @@ -134,7 +135,7 @@ struct TControl { TFactory* getFactory() { return pFactory_; } /* 0x4 */ TFactory* pFactory_; - /* 0x8 */ JGadget::TLinkList<TObject, 2> mList; + /* 0x8 */ JGadget::TLinkList<TObject, -12> mList; }; struct TParse : public JGadget::binary::TParse_header_block { diff --git a/include/JSystem/JStudio/JStudio/stb.h b/include/JSystem/JStudio/JStudio/stb.h index ec5dfbb2e8..0e68ccbf76 100644 --- a/include/JSystem/JStudio/JStudio/stb.h +++ b/include/JSystem/JStudio/JStudio/stb.h @@ -146,7 +146,7 @@ private: /* 0x04 */ u32 _4; /* 0x08 */ u32 _8; /* 0x0C */ TFactory* pFactory; - /* 0x10 */ JGadget::TLinkList<TObject, 12> mObjectContainer; + /* 0x10 */ JGadget::TLinkList<TObject, -12> mObjectContainer; /* 0x1C */ u32 mStatus; /* 0x20 */ TObject_control mObject_control; /* 0x54 */ s32 _54; diff --git a/include/JSystem/JUtility/JUTConsole.h b/include/JSystem/JUtility/JUTConsole.h index e45bde9ddc..c2633d7088 100644 --- a/include/JSystem/JUtility/JUTConsole.h +++ b/include/JSystem/JUtility/JUTConsole.h @@ -89,10 +89,7 @@ public: void scrollToLastLine() { scroll(mMaxLines); } void scrollToFirstLine() { scroll(-mMaxLines); } -private: /* 0x18 */ JGadget::TLinkListNode mListNode; - -private: /* 0x20 */ u32 field_0x20; /* 0x24 */ int mMaxLines; /* 0x28 */ u8* mBuf; @@ -133,8 +130,10 @@ public: static JUTConsoleManager* sManager; + typedef JGadget::TLinkList<JUTConsole, -offsetof(JUTConsole, mListNode)> ConsoleList; + private: - /* 0x00 */ JGadget::TLinkList<JUTConsole, 4> mLinkList; + /* 0x00 */ ConsoleList soLink_; /* 0x0C */ JUTConsole* mActiveConsole; /* 0x10 */ JUTConsole* mDirectConsole; }; // Size: 0x14 diff --git a/include/SSystem/SComponent/c_m3d_g_lin.h b/include/SSystem/SComponent/c_m3d_g_lin.h index 640c872f5b..fe5b0dbec2 100644 --- a/include/SSystem/SComponent/c_m3d_g_lin.h +++ b/include/SSystem/SComponent/c_m3d_g_lin.h @@ -27,6 +27,7 @@ public: const cXyz& GetEndP(void) const { return mEnd; } cXyz& GetEndP(void) { return mEnd; } cXyz& GetEnd() { return mEnd; } + const cXyz& GetEnd() const { return mEnd; } }; // Size = 0x1C STATIC_ASSERT(0x1C == sizeof(cM3dGLin)); diff --git a/include/dolphin/gd.h b/include/dolphin/gd.h index 246f0fdbb7..a35a19b8ac 100644 --- a/include/dolphin/gd.h +++ b/include/dolphin/gd.h @@ -4,4 +4,23 @@ #include "dolphin/gd/GDBase.h" #include "dolphin/gd/GDGeometry.h" +#ifdef __cplusplus +extern "C" { +#endif + +static inline u16 __GDLightID2Index(GXLightID id) { + u16 lightIdx = (31 - __cntlzw(id)); + if (lightIdx > 7) + lightIdx = 0; + return lightIdx; +} + +static inline u16 __GDLightID2Offset(GXLightID id) { + return __GDLightID2Index(id) * 0x10; +} + +#ifdef __cplusplus +}; +#endif + #endif /* GD_H */ |
