Reorganize library code into libs/ (#3119)

* Reorganize files into libs/{dolphin,JSystem,PowerPC_EABI_Support,revolution,TRK_MINNOW_DOLPHIN}

* Update configure.py and project.py for new libs structure

* Refactor `#include <dolphin/x.h>` -> `<x.h>`

* Remove `__REVOLUTION_SDK__` forwards from dolphin

* Fix dolphin/ references in revolution

* Wrap `#include <dolphin.h>` in `!__REVOLUTION_SDK__`

* Always build TRK against dolphin headers

* Resolve revolution SDK header resolution issues
This commit is contained in:
Luke Street
2026-03-01 15:35:36 -07:00
committed by GitHub
parent c9a46bd65b
commit 4df8ccc871
1740 changed files with 583 additions and 825 deletions
@@ -0,0 +1,533 @@
#ifndef J2DANIMATION_H
#define J2DANIMATION_H
#include "JSystem/JMath/JMath.h"
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
typedef struct _GXColor GXColor;
typedef struct _GXColorS10 GXColorS10;
class J2DScreen;
class JUTPalette;
struct ResTIMG;
enum J2DAnmKind {
KIND_TRANSFORM = 0,
KIND_COLOR = 1,
KIND_TEX_PATTERN = 2,
KIND_TEXTURE_SRT = 4,
KIND_TEV_REG = 5,
KIND_VISIBILITY = 6,
KIND_VTX_COLOR = 7
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmBase {
public:
J2DAnmBase() {
mFrame = 0.0f;
mFrameMax = 0;
}
J2DAnmBase(s16 frameMax) {
mFrame = 0.0f;
mFrameMax = frameMax;
}
virtual ~J2DAnmBase() {}
virtual void searchUpdateMaterialID(J2DScreen*) {}
s16 getFrameMax() const { return mFrameMax; }
void setFrame(f32 frame) { mFrame = frame; }
f32 getFrame() const { return mFrame; }
J2DAnmKind getKind() const { return mKind; }
/* 0x0 */ // vtable
/* 0x4 */ u8 field_0x4;
/* 0x5 */ u8 field_0x5;
/* 0x6 */ s16 mFrameMax;
/* 0x8 */ f32 mFrame;
/* 0xC */ J2DAnmKind mKind;
}; // Size: 0x10
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmVtxColor : public J2DAnmBase {
public:
J2DAnmVtxColor() {
mKind = KIND_VTX_COLOR;
for (int i = 0; i < ARRAY_SIZE(mAnmTableNum); i++) {
mAnmTableNum[i] = 0;
}
for (int i = 0; i < ARRAY_SIZE(mVtxColorIndexData); i++) {
mVtxColorIndexData[i] = NULL;
}
}
virtual ~J2DAnmVtxColor() {}
virtual void getColor(u8, u16, _GXColor*) const {}
u16 getAnmTableNum(u8 param_0) const {
J3D_PANIC(342, param_0 < 2, "Error : range over.");
return mAnmTableNum[param_0];
}
J3DAnmVtxColorIndexData* getAnmVtxColorIndexData(u8 param_1, u16 param_2) const {
J3D_PANIC(344, param_1 < 2, "Error : range over.");
J3D_PANIC(345, param_2 < mAnmTableNum[param_1], "Error : range over.");
return &mVtxColorIndexData[param_1][param_2];
}
u16* getVtxColorIndexPointer(u8 param_0) const {
J3D_PANIC(351, param_0 < 2, "Error : range over.");
return mVtxColorIndexPointer[param_0];
}
/* 0x10 */ u16 mAnmTableNum[2];
/* 0x14 */ J3DAnmVtxColorIndexData* mVtxColorIndexData[2];
/* 0x1C */ u16* mVtxColorIndexPointer[2];
}; // Size: 0x24
struct J3DTransformInfo;
struct J3DTextureSRTInfo;
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmVtxColorKey : public J2DAnmVtxColor {
public:
J2DAnmVtxColorKey() {
for (int i = 0; i < ARRAY_SIZE(mInfoTable); i++) {
mInfoTable[i] = NULL;
}
}
virtual ~J2DAnmVtxColorKey() {}
virtual void getColor(u8, u16, _GXColor*) const;
/* 0x24 */ J3DAnmColorKeyTable* mInfoTable[2];
/* 0x2C */ s16* mRValues;
/* 0x30 */ s16* mGValues;
/* 0x34 */ s16* mBValues;
/* 0x38 */ s16* mAValues;
}; // Size: 0x3C
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmVtxColorFull : public J2DAnmVtxColor {
public:
J2DAnmVtxColorFull() {
for (int i = 0; i < ARRAY_SIZE(mInfoTable); i++) {
mInfoTable[i] = NULL;
}
}
virtual ~J2DAnmVtxColorFull() {}
virtual void getColor(u8, u16, _GXColor*) const;
/* 0x24 */ J3DAnmColorFullTable* mInfoTable[2];
/* 0x2C */ u8* mRValues;
/* 0x30 */ u8* mGValues;
/* 0x34 */ u8* mBValues;
/* 0x38 */ u8* mAValues;
}; // Size: 0x3C
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmVisibilityFull : public J2DAnmBase {
public:
J2DAnmVisibilityFull() {
field_0x10 = 0;
mTable = NULL;
field_0x12 = 0;
mValues = NULL;
mKind = KIND_VISIBILITY;
}
virtual ~J2DAnmVisibilityFull() {}
void getVisibility(u16, u8*) const;
/* 0x10 */ u16 field_0x10;
/* 0x12 */ u16 field_0x12;
/* 0x14 */ J3DAnmVisibilityFullTable* mTable;
/* 0x18 */ u8* mValues;
}; // Size: 0x1C
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmTransform : public J2DAnmBase {
public:
J2DAnmTransform(s16 frameMax, f32* pScaleValues, s16* pRotationValues, f32* pTranslateValues) : J2DAnmBase(frameMax) {
mScaleValues = pScaleValues;
mRotationValues = pRotationValues;
mTranslateValues = pTranslateValues;
mKind = KIND_TRANSFORM;
}
virtual ~J2DAnmTransform() {}
virtual void getTransform(u16, J3DTransformInfo*) const {}
/* 0x10 */ f32* mScaleValues;
/* 0x14 */ s16* mRotationValues;
/* 0x18 */ f32* mTranslateValues;
}; // Size: 0x1C
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmTransformKey : public J2DAnmTransform {
public:
J2DAnmTransformKey() : J2DAnmTransform(0, NULL, NULL, NULL) {
field_0x24 = 0;
mInfoTable = NULL;
}
virtual ~J2DAnmTransformKey() {}
virtual void getTransform(u16 p1, J3DTransformInfo* pInfo) const {
this->calcTransform(mFrame, p1, pInfo);
}
virtual void calcTransform(f32, u16, J3DTransformInfo*) const;
/* 0x1C */ u8 field_0x1c[6];
/* 0x22 */ u16 field_0x22;
/* 0x24 */ u32 field_0x24;
/* 0x28 */ J3DAnmTransformKeyTable* mInfoTable;
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmTransformFull : public J2DAnmTransform {
public:
J2DAnmTransformFull() : J2DAnmTransform(0, NULL, NULL, NULL) { mTableInfo = NULL; }
virtual ~J2DAnmTransformFull() {}
virtual void getTransform(u16, J3DTransformInfo*) const;
/* 0x1C */ u8 field_0x1c[6];
/* 0x22 */ u16 field_0x22;
/* 0x24 */ J3DAnmTransformFullTable* mTableInfo;
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmTextureSRTKey : public J2DAnmBase {
public:
J2DAnmTextureSRTKey() {
field_0x10 = 0;
mUpdateMaterialNum = field_0x1a = field_0x1c = field_0x1e = 0;
mInfoTable = NULL;
mScaleValues = mTranslationValues = NULL;
mRotationValues = NULL;
field_0x4e = field_0x48 = field_0x4a = field_0x4c = 0;
field_0x5c = NULL;
field_0x50 = field_0x58 = NULL;
field_0x54 = NULL;
field_0x7c = 0;
mKind = KIND_TEXTURE_SRT;
}
void calcTransform(f32, u16, J3DTextureSRTInfo*) const;
virtual ~J2DAnmTextureSRTKey() {}
virtual void searchUpdateMaterialID(J2DScreen*);
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum / 3; }
u16 getUpdateMaterialID(u16 i) const {
J3D_PANIC(514, i < mUpdateMaterialNum / 3 && i >= 0, "Error : range over.");
return mUpdateMaterialID[i];
}
u8 getUpdateTexMtxID(u16 i) const {
J3D_PANIC(513, i < mUpdateMaterialNum / 3 && i >= 0, "Error : range over.");
return mUpdateTexMtxID[i];
}
void getTransform(u16 param_1, J3DTextureSRTInfo* param_2) const {
calcTransform(mFrame, param_1, param_2);
}
/* 0x10 */ int field_0x10;
/* 0x14 */ J3DAnmTransformKeyTable* mInfoTable;
/* 0x18 */ u16 mUpdateMaterialNum;
/* 0x1A */ u16 field_0x1a;
/* 0x1C */ u16 field_0x1c;
/* 0x1E */ u16 field_0x1e;
/* 0x20 */ f32* mScaleValues;
/* 0x24 */ s16* mRotationValues;
/* 0x28 */ f32* mTranslationValues;
/* 0x2C */ u8* mUpdateTexMtxID;
/* 0x30 */ u16* mUpdateMaterialID;
/* 0x34 */ JUTNameTab field_0x34;
/* 0x44 */ Vec* field_0x44;
/* 0x48 */ u16 field_0x48;
/* 0x4A */ u16 field_0x4a;
/* 0x4C */ u16 field_0x4c;
/* 0x4E */ u16 field_0x4e;
/* 0x50 */ f32* field_0x50;
/* 0x54 */ s16* field_0x54;
/* 0x58 */ f32* field_0x58;
/* 0x5C */ J3DAnmTransformKeyTable* field_0x5c;
/* 0x60 */ u8* field_0x60;
/* 0x64 */ u16* field_0x64;
/* 0x68 */ JUTNameTab field_0x68;
/* 0x78 */ Vec* field_0x78;
/* 0x7C */ int field_0x7c;
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmTexPattern : public J2DAnmBase {
public:
struct J2DAnmTexPatternTIMGPointer {
J2DAnmTexPatternTIMGPointer() {
mRes = NULL;
mPalette = NULL;
}
~J2DAnmTexPatternTIMGPointer() {
delete mPalette;
}
/* 0x0 */ ResTIMG* mRes;
/* 0x4 */ JUTPalette* mPalette;
}; // Size: 0x8
J2DAnmTexPattern() {
mValues = NULL;
mAnmTable = NULL;
mKind = KIND_TEX_PATTERN;
mUpdateMaterialNum = 0;
mUpdateMaterialID = NULL;
mTIMGPtrArray = NULL;
}
void getTexNo(u16, u16*) const;
ResTIMG* getResTIMG(u16) const;
JUTPalette* getPalette(u16) const;
virtual ~J2DAnmTexPattern() { delete[] mTIMGPtrArray; }
virtual void searchUpdateMaterialID(J2DScreen*);
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
u16 getUpdateMaterialID(u16 i) const {
J3D_PANIC(619, i < mUpdateMaterialNum, "Error : range over.");
return mUpdateMaterialID[i];
}
J3DAnmTexPatternFullTable* getAnmTable() const { return mAnmTable; }
/* 0x10 */ u16* mValues;
/* 0x14 */ J3DAnmTexPatternFullTable* mAnmTable;
/* 0x18 */ u16 field_0x18;
/* 0x1A */ u16 mUpdateMaterialNum;
/* 0x1C */ u16* mUpdateMaterialID;
/* 0x20 */ JUTNameTab field_0x20;
/* 0x30 */ J2DAnmTexPatternTIMGPointer* mTIMGPtrArray;
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmTevRegKey : public J2DAnmBase {
public:
J2DAnmTevRegKey() {
mCRegUpdateMaterialNum = mKRegUpdateMaterialNum = 0;
field_0x14 = field_0x16 = field_0x18 = field_0x1a = 0;
field_0x1c = field_0x1e = field_0x20 = field_0x22 = 0;
mCRegUpdateMaterialID = mKRegUpdateMaterialID = NULL;
mCRValues = mCGValues = mCBValues = mCAValues = NULL;
mKRValues = mKGValues = mKBValues = mKAValues = NULL;
mKind = KIND_TEV_REG;
}
void getTevColorReg(u16, GXColorS10*) const;
void getTevKonstReg(u16, GXColor*) const;
virtual ~J2DAnmTevRegKey() {}
virtual void searchUpdateMaterialID(J2DScreen* pScreen);
u16 getCRegUpdateMaterialNum() const { return mCRegUpdateMaterialNum; }
u16 getCRegUpdateMaterialID(u16 i) const {
J3D_PANIC(770, i < mCRegUpdateMaterialNum, "Error : range over.");
return mCRegUpdateMaterialID[i];
}
u16 getKRegUpdateMaterialNum() const { return mKRegUpdateMaterialNum; }
u16 getKRegUpdateMaterialID(u16 i) const {
J3D_PANIC(778, i < mKRegUpdateMaterialNum, "Error : range over.");
return mKRegUpdateMaterialID[i];
}
J3DAnmCRegKeyTable* getAnmCRegKeyTable() const { return mAnmCRegKeyTable; }
J3DAnmKRegKeyTable* getAnmKRegKeyTable() const { return mAnmKRegKeyTable; }
/* 0x10 */ u16 mCRegUpdateMaterialNum;
/* 0x12 */ u16 mKRegUpdateMaterialNum;
/* 0x14 */ u16 field_0x14;
/* 0x16 */ u16 field_0x16;
/* 0x18 */ u16 field_0x18;
/* 0x1A */ u16 field_0x1a;
/* 0x1C */ u16 field_0x1c;
/* 0x1E */ u16 field_0x1e;
/* 0x20 */ u16 field_0x20;
/* 0x22 */ u16 field_0x22;
/* 0x24 */ u16* mCRegUpdateMaterialID;
/* 0x28 */ JUTNameTab mCRegNameTab;
/* 0x38 */ u16* mKRegUpdateMaterialID;
/* 0x3C */ JUTNameTab mKRegNameTab;
/* 0x4C */ J3DAnmCRegKeyTable* mAnmCRegKeyTable;
/* 0x50 */ J3DAnmKRegKeyTable* mAnmKRegKeyTable;
/* 0x54 */ s16* mCRValues;
/* 0x58 */ s16* mCGValues;
/* 0x5C */ s16* mCBValues;
/* 0x60 */ s16* mCAValues;
/* 0x64 */ s16* mKRValues;
/* 0x68 */ s16* mKGValues;
/* 0x6C */ s16* mKBValues;
/* 0x70 */ s16* mKAValues;
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmColor : public J2DAnmBase {
public:
J2DAnmColor() {
field_0x10 = field_0x12 = field_0x14 = field_0x16 = 0;
mUpdateMaterialNum = 0;
mUpdateMaterialID = NULL;
mKind = KIND_COLOR;
}
virtual ~J2DAnmColor() {}
virtual void searchUpdateMaterialID(J2DScreen*);
virtual void getColor(u16, _GXColor*) const {}
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
u16 getUpdateMaterialID(u16 i) const {
J3D_PANIC(224, i < mUpdateMaterialNum, "Error : range over.");
return mUpdateMaterialID[i];
}
/* 0x10 */ u16 field_0x10;
/* 0x12 */ u16 field_0x12;
/* 0x14 */ u16 field_0x14;
/* 0x16 */ u16 field_0x16;
/* 0x18 */ u16 mUpdateMaterialNum;
/* 0x1C */ u16* mUpdateMaterialID;
/* 0x20 */ JUTNameTab field_0x20;
}; // Size: 0x30
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmColorKey : public J2DAnmColor {
public:
J2DAnmColorKey() {
mRValues = NULL;
mGValues = NULL;
mBValues = NULL;
mAValues = NULL;
mInfoTable = NULL;
}
virtual ~J2DAnmColorKey() {}
virtual void getColor(u16, _GXColor*) const;
/* 0x30 */ s16* mRValues;
/* 0x34 */ s16* mGValues;
/* 0x38 */ s16* mBValues;
/* 0x3C */ s16* mAValues;
/* 0x40 */ J3DAnmColorKeyTable* mInfoTable;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DAnmColorFullInfo {
/* 0x00 */ u16 mRMaxFrame;
/* 0x02 */ u16 mROffset;
/* 0x04 */ u16 mGMaxFrame;
/* 0x06 */ u16 mGOffset;
/* 0x08 */ u16 mBMaxFrame;
/* 0x0A */ u16 mBOffset;
/* 0x0C */ u16 mAMaxFrame;
/* 0x0E */ u16 mAOffset;
}; // Size = 0x10
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmColorFull : public J2DAnmColor {
public:
J2DAnmColorFull() {
mRValues = NULL;
mGValues = NULL;
mBValues = NULL;
mAValues = NULL;
mInfoTable = NULL;
}
virtual ~J2DAnmColorFull() {}
virtual void getColor(u16, _GXColor*) const;
/* 0x30 */ u8* mRValues;
/* 0x34 */ u8* mGValues;
/* 0x38 */ u8* mBValues;
/* 0x3C */ u8* mAValues;
/* 0x40 */ J3DAnmColorFullTable* mInfoTable;
};
inline f32 J2DHermiteInterpolation(f32 f1, const f32* f2, const f32* f3, const f32* f4, const f32* f5, const f32* f6,
const f32* f7) {
return JMAHermiteInterpolation(f1, *f2, *f3, *f4, *f5, *f6, *f7);
}
inline f32 J2DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER s16* pp2, __REGISTER s16* pp3,
__REGISTER s16* pp4, __REGISTER s16* pp5, __REGISTER s16* pp6,
__REGISTER s16* pp7) {
#ifdef __MWERKS__
__REGISTER f32 p1 = pp1;
__REGISTER f32 ff8;
__REGISTER f32 ff7;
__REGISTER f32 ff6;
__REGISTER f32 ff5;
__REGISTER f32 ff4;
__REGISTER f32 ff3;
__REGISTER f32 ff2;
__REGISTER f32 ff0;
__REGISTER f32 fout;
__REGISTER s16* p2 = pp2;
__REGISTER s16* p3 = pp3;
__REGISTER s16* p4 = pp4;
__REGISTER s16* p5 = pp5;
__REGISTER s16* p6 = pp6;
__REGISTER s16* p7 = pp7;
// clang-format off
asm {
psq_l ff2, 0(p2), 0x1, 5
psq_l ff0, 0(p5), 0x1, 5
psq_l ff7, 0(p3), 0x1, 5
fsubs ff5, ff0, ff2
psq_l ff6, 0(p6), 0x1, 5
fsubs ff3, p1, ff2
psq_l ff0, 0(p7), 0x1, 5
fsubs ff4, ff6, ff7
fdivs ff3, ff3, ff5
psq_l fout, 0(p4), 0x1, 5
fmadds ff0, ff0, ff5, ff7
fmuls ff2, ff3, ff3
fnmsubs ff4, ff5, fout, ff4
fsubs ff0, ff0, ff6
fsubs ff0, ff0, ff4
fmuls ff0, ff2, ff0
fmadds fout, ff5, fout, ff0
fmadds fout, fout, ff3, ff7
fmadds fout, ff4, ff2, fout
fsubs fout, fout, ff0
}
// clang-format on
return fout;
#endif
}
#endif /* J2DANIMATION_H */
@@ -0,0 +1,88 @@
#ifndef J2DANMLOADER_H
#define J2DANMLOADER_H
#include "JSystem/J2DGraph/J2DAnimation.h"
/**
* @ingroup jsystem-j2d
*
*/
struct J2DAnmLoaderDataBase {
static J2DAnmBase* load(void const*);
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmLoader {
public:
virtual void* load(void const*) = 0;
virtual void setResource(J2DAnmBase*, void const*) = 0;
virtual ~J2DAnmLoader() {}
void* mpResource;
};
struct J3DAnmTextureSRTKeyData;
struct J3DAnmColorKeyData;
struct J3DAnmVtxColorKeyData;
struct J3DAnmTevRegKeyData;
struct J3DAnmTransformFullData;
struct J3DAnmColorFullData;
struct J3DAnmTexPatternFullData;
struct J3DAnmVisibilityFullData;
struct J3DAnmVtxColorFullData;
struct J3DAnmTransformKeyData;
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmKeyLoader_v15 : public J2DAnmLoader {
public:
J2DAnmKeyLoader_v15();
void readAnmTransform(J3DAnmTransformKeyData const*);
void setAnmTransform(J2DAnmTransformKey*, J3DAnmTransformKeyData const*);
void readAnmTextureSRT(J3DAnmTextureSRTKeyData const*);
void setAnmTextureSRT(J2DAnmTextureSRTKey*, J3DAnmTextureSRTKeyData const*);
void readAnmColor(J3DAnmColorKeyData const*);
void setAnmColor(J2DAnmColorKey*, J3DAnmColorKeyData const*);
void readAnmVtxColor(J3DAnmVtxColorKeyData const*);
void setAnmVtxColor(J2DAnmVtxColorKey*, J3DAnmVtxColorKeyData const*);
void readAnmTevReg(J3DAnmTevRegKeyData const*);
void setAnmTevReg(J2DAnmTevRegKey*, J3DAnmTevRegKeyData const*);
virtual void* load(void const*);
virtual void setResource(J2DAnmBase*, void const*);
virtual ~J2DAnmKeyLoader_v15();
// /* 0x04 */ void* _4;
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DAnmFullLoader_v15 : public J2DAnmLoader {
public:
J2DAnmFullLoader_v15();
void readAnmTransform(J3DAnmTransformFullData const*);
void setAnmTransform(J2DAnmTransformFull*, J3DAnmTransformFullData const*);
void readAnmColor(J3DAnmColorFullData const*);
void setAnmColor(J2DAnmColorFull*, J3DAnmColorFullData const*);
void readAnmTexPattern(J3DAnmTexPatternFullData const*);
void setAnmTexPattern(J2DAnmTexPattern*, J3DAnmTexPatternFullData const*);
void readAnmVisibility(J3DAnmVisibilityFullData const*);
void setAnmVisibility(J2DAnmVisibilityFull*, J3DAnmVisibilityFullData const*);
void readAnmVtxColor(J3DAnmVtxColorFullData const*);
void setAnmVtxColor(J2DAnmVtxColorFull*, J3DAnmVtxColorFullData const*);
virtual void* load(void const*);
virtual void setResource(J2DAnmBase*, void const*);
virtual ~J2DAnmFullLoader_v15();
// void* _4;
};
#endif /* J2DANMLOADER_H */
@@ -0,0 +1,70 @@
#ifndef J2DGRAFCONTEXT_H
#define J2DGRAFCONTEXT_H
#include "JSystem/JGeometry.h"
#include "JSystem/JUtility/TColor.h"
#include <mtx.h>
/**
* @ingroup jsystem-j2d
*
*/
class J2DGrafContext {
public:
struct Blend {
/* 0x0 */ u8 mType;
/* 0x1 */ u8 mSrcFactor;
/* 0x2 */ u8 mDstFactor;
};
J2DGrafContext(f32 x, f32 y, f32 width, f32 height);
void scissor(JGeometry::TBox2<f32> const& bounds);
void scissor(f32 x, f32 y, f32 width, f32 height) {
scissor(JGeometry::TBox2<f32>(x, y, x + width, y + height));
}
void setColor(JUtility::TColor c) { this->setColor(c, c, c, c); }
void setColor(JUtility::TColor colorTL, JUtility::TColor colorTR,
JUtility::TColor colorBR, JUtility::TColor colorBL);
void setLineWidth(u8);
void fillBox(JGeometry::TBox2<f32> const& box);
void drawFrame(JGeometry::TBox2<f32> const& box);
void line(JGeometry::TVec2<f32> start, JGeometry::TVec2<f32> end);
void lineTo(JGeometry::TVec2<f32> pos);
void lineTo(f32 x, f32 y) { this->lineTo(JGeometry::TVec2<f32>(x, y)); }
void moveTo(f32 x, f32 y) { this->moveTo(JGeometry::TVec2<f32>(x, y)); }
void moveTo(JGeometry::TVec2<f32> pos) { mPrevPos = pos; }
virtual ~J2DGrafContext() {}
virtual void place(JGeometry::TBox2<f32> const& bounds);
virtual void place(f32 x, f32 y, f32 width, f32 height) {
JGeometry::TBox2<f32> box(x, y, x + width, y + height);
this->place(box);
}
virtual void setPort();
virtual void setup2D();
virtual void setScissor();
virtual s32 getGrafType() const { return 0; }
virtual void setLookat() {}
JGeometry::TBox2<f32>* getBounds() { return &mBounds; }
public:
/* 0x04 */ JGeometry::TBox2<f32> mBounds;
/* 0x14 */ JGeometry::TBox2<f32> mScissorBounds;
/* 0x24 */ JUtility::TColor mColorTL;
/* 0x28 */ JUtility::TColor mColorTR;
/* 0x2C */ JUtility::TColor mColorBR;
/* 0x30 */ JUtility::TColor mColorBL;
/* 0x34 */ u8 mLineWidth;
/* 0x38 */ JGeometry::TVec2<f32> mPrevPos;
/* 0x40 */ Mtx44 mMtx44;
/* 0x80 */ Mtx mPosMtx;
/* 0xB0 */ Blend field_0xb0;
/* 0xB3 */ Blend mLinePart;
/* 0xB6 */ Blend mBoxPart;
};
#endif /* J2DGRAFCONTEXT_H */
@@ -0,0 +1,43 @@
#ifndef J2DMANAGE_H
#define J2DMANAGE_H
#include <types.h>
class JSUInputStream;
/**
* @ingroup jsystem-j2d
*
*/
struct J2DResReference {
/* 0x00 */ u16 mCount;
/* 0x02 */ u16 mOffsets[1];
char* getResReference(u16) const;
char* getName(u16) const;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DataManageLink {
/* 0x00 */ void* mData;
/* 0x04 */ char* mName;
/* 0x08 */ J2DataManageLink* mNext;
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DDataManage {
private:
/* 0x00 */ J2DataManageLink* mList;
public:
void* get(char const*);
void* get(JSUInputStream*);
};
#endif /* J2DMANAGE_H */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,63 @@
#ifndef J2DMATERIAL_H
#define J2DMATERIAL_H
#include "JSystem/J2DGraph/J2DAnimation.h"
#include "JSystem/J2DGraph/J2DMatBlock.h"
/**
* @ingroup jsystem-j2d
*
*/
class J2DMaterial {
public:
struct J2DMaterialAnmPointer {
J2DMaterialAnmPointer();
/* 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
J2DMaterial();
void setGX();
static J2DTevBlock* createTevBlock(int, bool);
static J2DIndBlock* createIndBlock(int, bool);
void makeAnmPointer();
void setAnimation(J2DAnmTextureSRTKey*);
void setAnimation(J2DAnmTexPattern*);
void setAnimation(J2DAnmTevRegKey*);
void setAnimation(J2DAnmColor*);
void animation();
virtual ~J2DMaterial();
u16 getIndex() const { return mIndex; }
J2DColorBlock* getColorBlock() { return &mColorBlock; }
J2DTexGenBlock* getTexGenBlock() { return &mTexGenBlock; }
J2DPEBlock* getPEBlock() { return &mPEBlock; }
J2DTevBlock* getTevBlock() { return mTevBlock; }
J2DIndBlock* getIndBlock() { return mIndBlock; }
bool isVisible() const { return mVisible; }
int getMaterialAlphaCalc() const { return mMaterialAlphaCalc; }
// private:
/* 0x04 */ void* field_0x4;
/* 0x08 */ int field_0x8;
/* 0x0C */ u16 mIndex;
/* 0x0E */ bool mVisible;
/* 0x0F */ u8 mMaterialAlphaCalc;
/* 0x10 */ J2DColorBlock mColorBlock;
/* 0x28 */ J2DTexGenBlock mTexGenBlock;
/* 0x70 */ J2DTevBlock* mTevBlock;
/* 0x74 */ J2DIndBlock* mIndBlock;
/* 0x78 */ J2DPEBlock mPEBlock;
/* 0x84 */ J2DMaterialAnmPointer* mAnmPointer;
};
#endif /* J2DMATERIAL_H */
@@ -0,0 +1,171 @@
#ifndef J2DMATERIALFACTORY_H
#define J2DMATERIALFACTORY_H
#include "JSystem/J2DGraph/J2DManage.h"
#include "JSystem/J2DGraph/J2DMatBlock.h"
/**
* @ingroup jsystem-j2d
*
*/
struct J2DMaterialBlock {
u32 field_0x0;
u32 field_0x4;
u16 field_0x8;
u16 field_0xa;
u32 field_0xc;
u32 field_0x10;
u32 field_0x14;
u32 field_0x18;
u32 field_0x1c;
u32 field_0x20;
u32 field_0x24;
u32 field_0x28;
u32 field_0x2c;
u32 field_0x30;
u32 field_0x34;
u32 field_0x38;
u32 field_0x3c;
u32 field_0x40;
u32 field_0x44;
u32 field_0x48;
u32 field_0x4c;
u32 field_0x50;
u32 field_0x54;
u32 field_0x58;
u32 field_0x5c;
u32 field_0x60;
u32 field_0x64;
};
typedef struct _GXColor GXColor;
typedef struct _GXColorS10 GXColorS10;
struct J2DAlphaCompInfo;
struct J2DBlendInfo;
struct J2DColorChanInfo;
class J2DMaterial;
/**
* @ingroup jsystem-j2d
*
*/
struct J2DIndInitData {
u8 field_0x0;
u8 field_0x1;
u8 field_0x2[2];
J2DIndTexOrderInfo field_0x4[4];
J2DIndTexMtxInfo field_0xc[3];
J2DIndTexCoordScaleInfo field_0x60[4];
J2DIndTevStageInfo field_0x68[4];
u8 field_0xac[0x90];
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DMaterialInitData {
u8 field_0x0;
u8 field_0x1;
u8 field_0x2;
u8 field_0x3;
u8 field_0x4;
u8 field_0x5;
u8 field_0x6;
u8 field_0x7;
u16 field_0x8[2];
u16 field_0xc[4];
u16 field_0x14[8];
u16 field_0x24[0xa];
u16 field_0x38[8];
u16 field_0x48;
u16 field_0x4a[4];
u8 field_0x52[0x10];
u8 field_0x62[0x10];
u16 field_0x72[0x10];
u16 field_0x92[0x4];
u16 field_0x9a[0x10];
u16 field_0xba[0x10];
u16 field_0xda[0x4];
u16 field_0xe2;
u16 field_0xe4;
u16 field_0xe6;
};
struct J2DTevStageInfo;
struct J2DTevSwapModeTableInfo;
struct J2DTevSwapModeInfo;
struct J2DTevOrderInfo;
struct J2DTexCoordInfo;
struct J2DTexMtxInfo;
class JKRArchive;
/**
* @ingroup jsystem-j2d
*
*/
class J2DMaterialFactory {
public:
J2DMaterialFactory(J2DMaterialBlock const&);
u32 countStages(int) const;
J2DMaterial* create(J2DMaterial*, int, u32, J2DResReference*, J2DResReference*,
JKRArchive*) const;
JUtility::TColor newMatColor(int, int) const;
u8 newColorChanNum(int) const;
J2DColorChan newColorChan(int, int) const;
u32 newTexGenNum(int) const;
J2DTexCoord newTexCoord(int, int) const;
J2DTexMtx* newTexMtx(int, int) const;
u8 newCullMode(int) const;
u16 newTexNo(int, int) const;
u16 newFontNo(int) const;
J2DTevOrder newTevOrder(int, int) const;
J2DGXColorS10 newTevColor(int, int) const;
JUtility::TColor newTevKColor(int, int) const;
u8 newTevStageNum(int) const;
J2DTevStage newTevStage(int, int) const;
J2DTevSwapModeTable newTevSwapModeTable(int, int) const;
u8 newIndTexStageNum(int) const;
J2DIndTexOrder newIndTexOrder(int, int) const;
J2DIndTexMtx newIndTexMtx(int, int) const;
J2DIndTevStage newIndTevStage(int, int) const;
J2DIndTexCoordScale newIndTexCoordScale(int, int) const;
J2DAlphaComp newAlphaComp(int) const;
J2DBlend newBlend(int) const;
u8 newDither(int) const;
u8 getMaterialMode(int idx) const {
return field_0x4[field_0x8[idx]].field_0x0;
}
u8 getMaterialAlphaCalc(int idx) const {
return field_0x4[field_0x8[idx]].field_0x6;
}
private:
/* 0x00 */ u16 field_0x0;
/* 0x02 */ u16 field_0x2;
/* 0x04 */ J2DMaterialInitData* field_0x4;
/* 0x08 */ u16* field_0x8;
/* 0x0C */ J2DIndInitData* field_0xc;
/* 0x10 */ GXColor* field_0x10;
/* 0x14 */ u8* field_0x14;
/* 0x18 */ J2DColorChanInfo* field_0x18;
/* 0x1C */ u8* field_0x1c;
/* 0x20 */ J2DTexCoordInfo* field_0x20;
/* 0x24 */ J2DTexMtxInfo* field_0x24;
/* 0x28 */ u16* field_0x28;
/* 0x2C */ u16* field_0x2c;
/* 0x30 */ _GXCullMode* field_0x30;
/* 0x34 */ J2DTevOrderInfo* field_0x34;
/* 0x38 */ _GXColorS10* field_0x38;
/* 0x3C */ GXColor* field_0x3c;
/* 0x40 */ u8* field_0x40;
/* 0x44 */ J2DTevStageInfo* field_0x44;
/* 0x48 */ J2DTevSwapModeInfo* field_0x48;
/* 0x4C */ J2DTevSwapModeTableInfo* field_0x4c;
/* 0x50 */ J2DAlphaCompInfo* field_0x50;
/* 0x54 */ J2DBlendInfo* field_0x54;
/* 0x58 */ u8* field_0x58;
};
#endif /* J2DMATERIALFACTORY_H */
@@ -0,0 +1,43 @@
#ifndef J2DORTHOGRAPH_H
#define J2DORTHOGRAPH_H
#include "JSystem/J2DGraph/J2DGrafContext.h"
/**
* @ingroup jsystem-j2d
*
*/
class J2DOrthoGraph : public J2DGrafContext {
public:
J2DOrthoGraph();
J2DOrthoGraph(f32 x, f32 y, f32 width, f32 height, f32 far, f32 near);
void setOrtho(JGeometry::TBox2<f32> const& bounds, f32 far, f32 near);
void scissorBounds(JGeometry::TBox2<f32>*, JGeometry::TBox2<f32> const*);
virtual ~J2DOrthoGraph() {}
virtual void setPort();
virtual s32 getGrafType() const { return 1; }
virtual void setLookat();
f32 getWidthPower() { return mBounds.getWidth() / mOrtho.getWidth(); }
f32 getHeightPower() { return mBounds.getHeight() / mOrtho.getHeight(); }
const JGeometry::TBox2<f32>* getOrtho() const { return &mOrtho; }
void setOrtho(f32 x, f32 y, f32 width, f32 height, f32 far, f32 near) {
setOrtho(JGeometry::TBox2<f32>(x, y, x + width, y + height), far, near);
}
private:
/* 0xBC */ JGeometry::TBox2<f32> mOrtho;
/* 0xCC */ f32 mNear;
/* 0xD0 */ f32 mFar;
};
void J2DDrawLine(f32 x1, f32 y1, f32 x2, f32 y2, JUtility::TColor color,
int line_width);
void J2DFillBox(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color);
void J2DFillBox(JGeometry::TBox2<f32> const& box, JUtility::TColor color);
void J2DDrawFrame(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color, u8 line_width);
void J2DDrawFrame(JGeometry::TBox2<f32> const& box, JUtility::TColor color, u8 line_width);
#endif /* J2DORTHOGRAPH_H */
@@ -0,0 +1,240 @@
#ifndef J2DPANE_H
#define J2DPANE_H
#include "JSystem/JGeometry.h"
#include "JSystem/JSupport/JSUList.h"
#include <gx.h>
#include <mtx.h>
class J2DAnmBase;
class J2DAnmColor;
class J2DAnmTransform;
class J2DAnmTevRegKey;
class J2DAnmTextureSRTKey;
class J2DAnmVisibilityFull;
class J2DAnmVtxColor;
class J2DGrafContext;
class J2DScreen;
class J2DAnmTexPattern;
class JKRArchive;
class JSURandomInputStream;
struct ResFONT;
struct ResTIMG;
enum J2DRotateAxis {
/* 0x78 */ ROTATE_X = 'x',
/* 0x79 */ ROTATE_Y = 'y',
/* 0x7A */ ROTATE_Z = 'z'
};
enum J2DBasePosition {
J2DBasePosition_0,
J2DBasePosition_1,
J2DBasePosition_2,
J2DBasePosition_3,
J2DBasePosition_4,
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DPaneHeader {
/* 0x0 */ u32 mKind;
/* 0x4 */ u32 mSize;
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DPane {
public:
J2DPane();
J2DPane(J2DPane*, bool, u64, const JGeometry::TBox2<f32>&);
J2DPane(u64, const JGeometry::TBox2<f32>&);
J2DPane(J2DPane* other, JSURandomInputStream* stream, u8 arg3);
void initiate();
void initialize(J2DPane*, bool, u64, const JGeometry::TBox2<f32>&);
void initialize(u64 tag, const JGeometry::TBox2<f32>& dim);
void makePaneStream(J2DPane* other, JSURandomInputStream* stream);
void changeUseTrans(J2DPane* other);
bool appendChild(J2DPane* child);
bool insertChild(J2DPane* before, J2DPane* child);
void draw(f32 a1, f32 a2, const J2DGrafContext* ctx, bool a4, bool a5);
void place(const JGeometry::TBox2<f32>& dim);
JGeometry::TBox2<f32>& getBounds();
void rotate(f32 offsetX, f32 offsetY, J2DRotateAxis axis, f32 angle);
void rotate(f32 angle);
void clip(const JGeometry::TBox2<f32>& bounds);
void setBasePosition(J2DBasePosition position);
void setInfluencedAlpha(bool arg1, bool arg2);
Vec getGlbVtx(u8 arg1) const;
J2DPane* getFirstChildPane();
J2DPane* getNextChildPane();
J2DPane* getParentPane();
void makePaneExStream(J2DPane* other, JSURandomInputStream* stream);
void* getPointer(JSURandomInputStream* stream, u32 size, JKRArchive* archive);
void animationTransform();
void updateTransform(const J2DAnmTransform* transform);
virtual ~J2DPane();
/* vt 0x0C */ virtual u16 getTypeID() const { return 16; }
/* vt 0x10 */ virtual void move(f32 x, f32 y);
/* vt 0x14 */ virtual void add(f32 x, f32 y);
/* vt 0x18 */ virtual void resize(f32 x, f32 y);
/* vt 0x1C */ virtual void setCullBack(bool cull) {
GXCullMode mode;
if (cull) {
mode = GX_CULL_BACK;
} else {
mode = GX_CULL_NONE;
}
setCullBack(mode);
}
/* vt 0x20 */ virtual void setCullBack(_GXCullMode cmode);
/* vt 0x24 */ virtual void setAlpha(u8 alpha) {
mAlpha = alpha;
};
/* vt 0x28 */ virtual bool setConnectParent(bool connected) {
mConnected = false;
return false;
}
/* vt 0x2C */ virtual void calcMtx() {
if (mPaneTree.getParent() != NULL) {
makeMatrix(mTranslateX, mTranslateY);
}
}
/* vt 0x30 */ virtual void update() {}
/* vt 0x34 */ virtual void drawSelf(f32 arg1, f32 arg2) {}
/* vt 0x38 */ virtual void drawSelf(f32 arg1, f32 arg2, Mtx* mtx) {}
/* vt 0x3C */ virtual J2DPane* search(u64 tag);
/* vt 0x40 */ virtual J2DPane* searchUserInfo(u64 tag);
/* vt 0x44 */ virtual void makeMatrix(f32 a, f32 b) {
makeMatrix(a, b, -mBounds.i.x, -mBounds.i.y);
}
/* vt 0x48 */ virtual void makeMatrix(f32 a, f32 b, f32 c, f32 d);
/* vt 0x4C */ virtual bool isUsed(const ResTIMG* timg);
/* vt 0x50 */ virtual bool isUsed(const ResFONT* font);
/* vt 0x54 */ virtual void clearAnmTransform();
/* vt 0x58 */ virtual void rewriteAlpha() {}
/* vt 0x5C */ virtual void setAnimation(J2DAnmBase* anm);
/* vt 0x60 */ virtual void setAnimation(J2DAnmTransform* anm);
/* vt 0x64 */ virtual void setAnimation(J2DAnmColor* anm) {}
/* vt 0x68 */ virtual void setAnimation(J2DAnmTexPattern* anm) {}
/* vt 0x6C */ virtual void setAnimation(J2DAnmTextureSRTKey* anm) {}
/* vt 0x70 */ virtual void setAnimation(J2DAnmTevRegKey* anm) {}
/* vt 0x74 */ virtual void setAnimation(J2DAnmVisibilityFull* anm) {}
/* vt 0x78 */ virtual void setAnimation(J2DAnmVtxColor* anm) {}
/* vt 0x7C */ virtual const J2DAnmTransform* animationTransform(const J2DAnmTransform* transform);
/* vt 0x80 */ virtual void setVisibileAnimation(J2DAnmVisibilityFull* visibility);
/* vt 0x84 */ virtual void setAnimationVF(J2DAnmVisibilityFull* p_visibility) {
setAnimation(p_visibility);
}
/* vt 0x88 */ virtual void setVtxColorAnimation(J2DAnmVtxColor* vtx_color);
/* vt 0x8C */ virtual void setAnimationVC(J2DAnmVtxColor* p_vtxColor) {
setAnimation(p_vtxColor);
}
/* vt 0x90 */ virtual const J2DAnmTransform* animationPane(const J2DAnmTransform* transform);
f32 getHeight() const { return mBounds.getHeight(); }
f32 getWidth() const { return mBounds.getWidth(); }
JSUTree<J2DPane>* getFirstChild() { return mPaneTree.getFirstChild(); }
JSUTree<J2DPane>* getEndChild() { return mPaneTree.getEndChild(); }
const JSUTree<J2DPane>* getPaneTree() { return &mPaneTree; }
u8 getAlpha() const { return mAlpha; }
f32 getScaleX() const { return mScaleX; }
f32 getScaleY() const { return mScaleY; }
f32 getTranslateX() const { return mTranslateX; }
f32 getTranslateY() const { return mTranslateY; }
f32 getRotateZ() const { return mRotateZ; }
f32 getRotOffsetX() const { return mRotateOffsetX; }
f32 getRotOffsetY() const { return mRotateOffsetY; }
MtxP getGlbMtx() { return mGlobalMtx; }
const JGeometry::TBox2<f32>& getGlbBounds() const { return mGlobalBounds; }
void setMtx(Mtx m) { MTXCopy(m, mPositionMtx); }
void translate(f32 transX, f32 transY) {
mTranslateX = transX;
mTranslateY = transY;
calcMtx();
}
void scale(f32 scaleH, f32 scaleV) {
mScaleX = scaleH;
mScaleY = scaleV;
calcMtx();
}
void rotateY(f32 rotate) {
mRotateY = rotate;
calcMtx();
}
int getKind() const { return mKind; }
bool isVisible() const { return mVisible; }
void show() { mVisible = true; }
void hide() { mVisible = false; }
bool isInfluencedAlpha() const { return mIsInfluencedAlpha; }
bool isConnectParent() const { return mConnected; }
u64 getUserInfo() const { return mUserInfoTag; }
void setUserInfo(u64 info) { mUserInfoTag = info; }
const Mtx* getMtx() const { return &mPositionMtx; }
static s16 J2DCast_F32_to_S16(f32 value, u8 arg2);
static JGeometry::TBox2<f32> static_mBounds;
public:
/* 0x04 */ u16 field_0x4;
/* 0x08 */ int mKind;
/* 0x10 */ u64 mInfoTag;
/* 0x18 */ u64 mUserInfoTag;
/* 0x20 */ JGeometry::TBox2<f32> mBounds;
/* 0x30 */ JGeometry::TBox2<f32> mGlobalBounds;
/* 0x40 */ JGeometry::TBox2<f32> mClipRect;
/* 0x50 */ Mtx mPositionMtx;
/* 0x80 */ Mtx mGlobalMtx;
/* 0xB0 */ bool mVisible;
/* 0xB1 */ u8 mCullMode;
/* 0xB2 */ u8 mAlpha;
/* 0xB3 */ u8 mColorAlpha;
/* 0xB4 */ bool mIsInfluencedAlpha;
/* 0xB5 */ bool mConnected;
/* 0xB6 */ char mRotAxis;
/* 0xB7 */ u8 mBasePosition;
/* 0xB8 */ f32 mRotateX;
/* 0xBC */ f32 mRotateY;
/* 0xC0 */ f32 mRotateZ;
/* 0xC4 */ f32 mRotateOffsetX;
/* 0xC8 */ f32 mRotateOffsetY;
/* 0xCC */ f32 mScaleX;
/* 0xD0 */ f32 mScaleY;
/* 0xD4 */ f32 mTranslateX;
/* 0xD8 */ f32 mTranslateY;
/* 0xDC */ JSUTree<J2DPane> mPaneTree;
/* 0xF8 */ const J2DAnmTransform* mTransform;
#if !(PLATFORM_WII || PLATFORM_SHIELD)
/* 0xFC */ u32 _fc;
#endif
};
#endif /* J2DPANE_H */
@@ -0,0 +1,230 @@
#ifndef J2DPICTURE_H
#define J2DPICTURE_H
#include "JSystem/J2DGraph/J2DPane.h"
#include "JSystem/JUtility/JUTTexture.h"
#include "JSystem/JUtility/TColor.h"
class J2DMaterial;
class JUTPalette;
struct ResTIMG;
struct ResTLUT;
enum J2DMirror {
/* 0 */ MIRROR0, // temp, figure out later
/* 1 */ J2DMirror_Y = (1 << 0),
/* 2 */ J2DMirror_X = (1 << 1),
};
enum J2DBinding {
/* 0 */ J2DBind_None = 0,
/* 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
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DPicHeader {
/* 0x0 */ u32 mTag;
/* 0x4 */ u32 mSize;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DScrnBlockPictureParameter {
/* 0x00 */ u16 field_0x0;
/* 0x02 */ u16 mMaterialNum;
/* 0x04 */ u16 field_0x4;
/* 0x06 */ u16 field_0x6;
/* 0x08 */ u16 field_0x8[4];
/* 0x10 */ JGeometry::TVec2<s16> field_0x10[4];
/* 0x20 */ u32 mCornerColor[4];
}; // Size: 0x30
/**
* @ingroup jsystem-j2d
*
*/
class J2DPicture : public J2DPane {
public:
virtual ~J2DPicture();
virtual u16 getTypeID() const { return 18; }
virtual void drawSelf(f32, f32);
virtual void drawSelf(f32, f32, Mtx*);
virtual void initiate(ResTIMG const*, ResTLUT const*);
virtual bool prepareTexture(u8);
virtual bool append(ResTIMG const* param_0, f32 param_1) {
return insert(param_0, mTextureNum, param_1);
}
virtual bool append(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) {
return insert(param_0, param_1, mTextureNum, param_2);
}
virtual bool append(char const* param_0, f32 param_1) {
return insert(param_0, mTextureNum, param_1);
}
virtual bool append(char const* param_0, JUTPalette* param_1, f32 param_2) {
return insert(param_0, param_1, mTextureNum, param_2);
}
virtual bool append(JUTTexture* param_0, f32 param_1) {
return insert(param_0, mTextureNum, param_1);
}
virtual void prepend(ResTIMG const* param_0, f32 param_1) {
insert(param_0, 0, param_1);
}
virtual void prepend(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) {
insert(param_0, param_1, 0, param_2);
}
virtual void prepend(char const* param_0, f32 param_1) {
insert(param_0, 0, param_1);
}
virtual void prepend(char const* param_0, JUTPalette* param_1, f32 param_2) {
insert(param_0, param_1, 0, param_2);
}
virtual void prepend(JUTTexture* param_0, f32 param_1) {
insert(param_0, 0, param_1);
}
virtual bool insert(ResTIMG const* param_0, u8 param_1, f32 param_2) {
return insert(param_0, NULL, param_1, param_2);
}
virtual bool insert(ResTIMG const*, JUTPalette*, u8, f32);
virtual bool insert(char const* param_0, u8 param_1, f32 param_2) {
return insert(param_0, NULL, param_1, param_2);
}
virtual bool insert(char const*, JUTPalette*, u8, f32);
virtual bool insert(JUTTexture*, u8, f32);
virtual bool remove(u8);
virtual bool remove() { return remove(mTextureNum - 1); }
virtual bool remove(JUTTexture*);
virtual void draw(f32 param_0, f32 param_1, bool param_2, bool param_3,
bool param_4) {
draw(param_0, param_1, 0, param_2, param_3, param_4);
}
virtual void draw(f32 param_0, f32 param_1, u8 param_2, bool param_3,
bool param_4, bool param_5) {
if (param_2 < mTextureNum && mTexture[param_2] != NULL) {
draw(param_0, param_1, mTexture[param_2]->getWidth(), mTexture[param_2]->getHeight(),
param_3, param_4, param_5);
}
}
virtual void draw(f32, f32, f32, f32, bool, bool, bool);
virtual void drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3,
f32 param_4, f32 param_5) {
if (mTexture[0] != NULL) {
drawOut(JGeometry::TBox2<f32>(param_0, param_1, param_0 + param_2, param_1 + param_3),
JGeometry::TBox2<f32>(param_4, param_5, param_4 + mTexture[0]->getWidth(),
param_5 + mTexture[0]->getHeight()));
}
}
virtual void drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3,
f32 param_4, f32 param_5, f32 param_6, f32 param_7) {
drawOut(JGeometry::TBox2<f32>(param_0, param_1, param_0 + param_2, param_1 + param_3),
JGeometry::TBox2<f32>(param_4, param_5, param_4 + param_6, param_5 + param_7));
}
virtual void drawOut(JGeometry::TBox2<f32> const&, JGeometry::TBox2<f32> const&);
virtual void load(_GXTexMapID param_0, u8 param_1) {
if (param_1 < mTextureNum && param_1 < 2 && mTexture[param_1] != NULL) {
mTexture[param_1]->load(param_0);
}
}
virtual void load(u8 param_0) { load((_GXTexMapID)param_0, param_0); }
virtual void setBlendRatio(f32 param_0, f32 param_1) {
setBlendColorRatio(param_0, param_1);
setBlendAlphaRatio(param_0, param_1);
}
virtual void setBlendColorRatio(f32, f32);
virtual void setBlendAlphaRatio(f32, f32);
virtual const ResTIMG* changeTexture(ResTIMG const*, u8);
virtual const ResTIMG* changeTexture(char const*, u8);
virtual const ResTIMG* changeTexture(ResTIMG const*, u8, JUTPalette*);
virtual const ResTIMG* changeTexture(char const*, u8, JUTPalette*);
virtual JUTTexture* getTexture(u8 param_0) const {
if (param_0 < 2) {
return mTexture[param_0];
}
return NULL;
}
virtual u8 getTextureCount() const { return mTextureNum; }
/* vt 0x128 */ virtual bool setBlack(JUtility::TColor i_black) {
mBlack = i_black;
return true;
}
/* vt 0x12C */ virtual bool setWhite(JUtility::TColor i_white) {
mWhite = i_white;
return true;
}
virtual bool setBlackWhite(JUtility::TColor i_black, JUtility::TColor i_white) {
mBlack = i_black;
mWhite = i_white;
return true;
}
virtual JUtility::TColor getBlack() const {
return mBlack;
}
virtual JUtility::TColor getWhite() const {
return mWhite;
}
virtual J2DMaterial* getMaterial() const { return NULL; }
virtual void drawFullSet(f32, f32, f32, f32, Mtx*);
virtual void drawTexCoord(f32, f32, f32, f32, s16, s16, s16, s16, s16, s16, s16,
s16, Mtx*);
virtual u8 getUsableTlut(u8);
virtual bool isUsed(ResTIMG const*);
virtual bool isUsed(ResFONT const* param_0) { return J2DPane::isUsed(param_0); }
virtual void rewriteAlpha() {}
J2DPicture(u64, JGeometry::TBox2<f32> const&, ResTIMG const*, ResTLUT const*);
J2DPicture(ResTIMG const*);
J2DPicture(J2DPane*, JSURandomInputStream*, JKRArchive*);
J2DPicture();
J2DPicture(J2DPane*, JSURandomInputStream*, J2DMaterial*);
void private_readStream(J2DPane*, JSURandomInputStream*, JKRArchive*);
void private_initiate(ResTIMG const*, ResTLUT const*);
void initinfo();
void setTevMode();
static void swap(f32&, f32&);
J2DBinding getBinding() const;
void setMirror(J2DMirror);
bool isTumble() const;
void setBlendKonstColor();
void setBlendKonstAlpha();
void getNewColor(JUtility::TColor*);
void setTexCoord(JGeometry::TVec2<s16>*, JUTTexture const*, J2DBinding,
J2DMirror, bool);
void setTexCoord(JUTTexture const*, J2DBinding, J2DMirror, bool);
GXTlut getTlutID(ResTIMG const*, u8);
void setCornerColor(JUtility::TColor c0, JUtility::TColor c1, JUtility::TColor c2,
JUtility::TColor c3) {
mCornerColor[0] = c0;
mCornerColor[1] = c1;
mCornerColor[2] = c2;
mCornerColor[3] = c3;
}
void setCornerColor(JUtility::TColor c0) {
setCornerColor(c0, c0, c0, c0);
}
protected:
/* 0x100 */ JUTTexture* mTexture[2];
/* 0x108 */ u8 mTextureNum;
/* 0x109 */ u8 field_0x109;
/* 0x10A */ JGeometry::TVec2<s16> field_0x10a[4];
/* 0x11C */ f32 field_0x11c[2];
/* 0x124 */ f32 field_0x124[2];
/* 0x12C */ JUTPalette* mPalette;
/* 0x130 */ JUtility::TColor mWhite;
/* 0x134 */ JUtility::TColor mBlack;
/* 0x138 */ JUtility::TColor mCornerColor[4];
/* 0x148 */ JUtility::TColor mBlendKonstColor;
/* 0x14C */ JUtility::TColor mBlendKonstAlpha;
};
#endif /* J2DPICTURE_H */
@@ -0,0 +1,117 @@
#ifndef J2DPICTUREEX_H
#define J2DPICTUREEX_H
#include "JSystem/J2DGraph/J2DPicture.h"
#include "JSystem/J2DGraph/J2DTevs.h"
class J2DMaterial;
/**
* @ingroup jsystem-j2d
*
*/
class J2DPictureEx : public J2DPicture {
public:
enum stage_enum {
STAGE_0,
STAGE_1,
STAGE_2,
STAGE_3,
STAGE_4,
STAGE_5,
STAGE_6,
STAGE_7,
};
J2DPictureEx(J2DPane*, JSURandomInputStream*, u32, J2DMaterial*);
void insertCommon(u8, f32);
bool isInsert(u8) const;
bool isRemove(u8) const;
void setTevOrder(u8, u8, bool);
void setTevStage(u8, u8, bool);
void setStage(J2DTevStage*, J2DPictureEx::stage_enum);
void setTevKColor(u8);
void setTevKColorSel(u8);
void setTevKAlphaSel(u8);
void shiftSetBlendRatio(u8, f32, bool, bool);
bool getBlackWhite(JUtility::TColor*, JUtility::TColor*) const;
bool isSetBlackWhite(JUtility::TColor, JUtility::TColor) const;
virtual ~J2DPictureEx();
virtual void setCullBack(bool);
virtual void setCullBack(_GXCullMode);
virtual void setAlpha(u8);
virtual void drawSelf(f32, f32, f32 (*)[3][4]);
virtual bool isUsed(ResTIMG const*);
virtual bool isUsed(ResFONT const*);
virtual void rewriteAlpha();
virtual void setAnimation(J2DAnmBase*);
virtual void setAnimation(J2DAnmTransform* transform) { J2DPane::setAnimation(transform); }
virtual void setAnimation(J2DAnmColor*);
virtual void setAnimation(J2DAnmTexPattern*);
virtual void setAnimation(J2DAnmTextureSRTKey*);
virtual void setAnimation(J2DAnmTevRegKey*);
virtual void setAnimation(J2DAnmVisibilityFull*);
virtual void setAnimation(J2DAnmVtxColor*);
virtual const J2DAnmTransform* animationPane(J2DAnmTransform const*);
virtual void initiate(ResTIMG const*, ResTLUT const*);
virtual bool prepareTexture(u8);
virtual bool append(ResTIMG const*, f32);
virtual bool append(ResTIMG const*, JUTPalette*, f32);
virtual bool append(char const*, f32);
virtual bool append(char const*, JUTPalette*, f32);
virtual bool append(JUTTexture*, f32);
virtual void prepend(ResTIMG const*, f32);
virtual void prepend(ResTIMG const*, JUTPalette*, f32);
virtual void prepend(char const*, f32);
virtual void prepend(char const*, JUTPalette*, f32);
virtual void prepend(JUTTexture*, f32);
virtual bool insert(ResTIMG const*, u8, f32);
virtual bool insert(ResTIMG const*, JUTPalette*, u8, f32);
virtual bool insert(char const*, u8, f32);
virtual bool insert(char const*, JUTPalette*, u8, f32);
virtual bool insert(JUTTexture*, u8, f32);
virtual bool remove(u8);
virtual bool remove();
virtual bool remove(JUTTexture*);
virtual void draw(f32, f32, bool, bool, bool);
virtual void draw(f32, f32, u8, bool, bool, bool);
virtual void draw(f32, f32, f32, f32, bool, bool, bool);
virtual void drawOut(f32, f32, f32, f32, f32, f32);
virtual void drawOut(f32, f32, f32, f32, f32, f32, f32, f32);
virtual void drawOut(JGeometry::TBox2<f32> const&, JGeometry::TBox2<f32> const&);
virtual void load(_GXTexMapID, u8);
virtual void load(u8);
virtual void setBlendColorRatio(f32, f32);
virtual void setBlendAlphaRatio(f32, f32);
virtual const ResTIMG* changeTexture(ResTIMG const*, u8);
virtual const ResTIMG* changeTexture(char const*, u8);
virtual const ResTIMG* changeTexture(ResTIMG const*, u8, JUTPalette*);
virtual const ResTIMG* changeTexture(char const*, u8, JUTPalette*);
virtual JUTTexture* getTexture(u8) const;
virtual u8 getTextureCount() const;
virtual bool setBlack(JUtility::TColor);
virtual bool setWhite(JUtility::TColor);
virtual bool setBlackWhite(JUtility::TColor, JUtility::TColor);
virtual JUtility::TColor getBlack() const;
virtual JUtility::TColor getWhite() const;
virtual J2DMaterial* getMaterial() const { return mMaterial; }
virtual void drawFullSet(f32, f32, f32, f32, f32 (*)[3][4]);
virtual void drawTexCoord(f32, f32, f32, f32, s16, s16, s16, s16, s16, s16, s16,
s16, f32 (*)[3][4]);
virtual u8 getUsableTlut(u8);
private:
/* 0x150 */ J2DMaterial* mMaterial;
/* 0x154 */ u16 field_0x154;
/* 0x156 */ u16 field_0x156;
/* 0x158 */ u16 field_0x158[4];
/* 0x160 */ f32 field_0x160[6]; // related to blend color ratio
/* 0x178 */ f32 field_0x178[6]; // related to blend alpha ratio
/* 0x190 */ u8 field_0x190;
/* 0x194 */ J2DAnmVisibilityFull* field_0x194;
/* 0x198 */ J2DAnmVtxColor* field_0x198;
/* 0x19C */ u8 field_0x19c;
};
#endif /* J2DPICTUREEX_H */
@@ -0,0 +1,103 @@
#ifndef J2DPRINT_H
#define J2DPRINT_H
#include "JSystem/J2DGraph/J2DTextBox.h"
#include <cstdarg>
class JUTFont;
class J2DPrint;
extern "C" f32 J2DPrint_print_alpha_va(J2DPrint*, u8, const char*, va_list);
/**
* @ingroup jsystem-j2d
*
*/
class J2DPrint {
public:
struct TSize {
/* 0x0 */ f32 field_0x0;
/* 0x4 */ f32 field_0x4;
};
J2DPrint(JUTFont*, JUtility::TColor, JUtility::TColor);
void initiate();
J2DPrint(JUTFont*, f32, f32, JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
static u8* setBuffer(size_t);
void setFontSize();
void locate(f32, f32);
f32 print(f32, f32, u8, char const*, ...);
void printReturn(char const*, f32, f32, J2DTextBoxHBinding, J2DTextBoxVBinding,
f32, f32, u8);
f32 parse(u8 const*, int, int, u16*, J2DPrint::TSize&, u8, bool);
void doCtrlCode(int);
u16 doEscapeCode(u8 const**, u8);
void initchar();
s32 getNumberS32(u8 const**, s32, s32, int);
f32 getNumberF32(u8 const**, f32, f32, int);
virtual ~J2DPrint();
JUTFont* getFont() const { return mFont; }
f32 getCursorV() const { return mCursorV; }
void setCharColor(JUtility::TColor color) { mCharColor = color; }
void setGradColor(JUtility::TColor color) { mGradColor = color; }
f32 print_va(u8 alpha, const char* fmt, va_list args) {
return J2DPrint_print_alpha_va(this, alpha, fmt, args);
}
void setFontSize(f32 sizeX, f32 sizeY) {
f32 x;
if (sizeX > 0.0f) {
x = sizeX;
} else {
x = 0.0f;
}
mFontSizeX = x;
f32 y;
if (sizeY > 0.0f) {
y = sizeY;
} else {
y = 0.0f;
}
mFontSizeY = y;
}
static char* mStrBuff;
static size_t mStrBuffSize;
private:
void private_initiate(JUTFont*, f32, f32, JUtility::TColor, JUtility::TColor,
JUtility::TColor, JUtility::TColor, bool);
/* 0x04 */ JUTFont* mFont;
/* 0x08 */ JUtility::TColor field_0x8;
/* 0x0C */ JUtility::TColor field_0xc;
/* 0x10 */ f32 field_0x10;
/* 0x14 */ f32 field_0x14;
/* 0x18 */ f32 mScaleX;
/* 0x1C */ f32 mScaleY;
/* 0x20 */ s16 field_0x20;
/* 0x22 */ bool field_0x22;
/* 0x24 */ f32 field_0x24;
/* 0x28 */ f32 field_0x28;
/* 0x2C */ f32 mCursorH;
/* 0x30 */ f32 mCursorV;
/* 0x34 */ f32 field_0x34;
/* 0x38 */ JUtility::TColor mBlackColor;
/* 0x3C */ JUtility::TColor mWhiteColor;
/* 0x40 */ JUtility::TColor mCharColor;
/* 0x44 */ JUtility::TColor mGradColor;
/* 0x48 */ f32 mCharSpacing;
/* 0x4C */ f32 mLineSpacing;
/* 0x50 */ f32 mFontSizeX;
/* 0x54 */ f32 mFontSizeY;
/* 0x58 */ s16 field_0x58;
/* 0x5A */ bool field_0x5a;
}; // Size: 0x5C
#endif /* J2DPRINT_H */
@@ -0,0 +1,103 @@
#ifndef J2DSCREEN_H
#define J2DSCREEN_H
#include "JSystem/J2DGraph/J2DManage.h"
#include "JSystem/J2DGraph/J2DPane.h"
#include "JSystem/JUtility/TColor.h"
class J2DMaterial;
class JUTNameTab;
/**
* @ingroup jsystem-j2d
*
*/
struct J2DScrnHeader {
/* 0x00 */ u32 mTag;
/* 0x04 */ u32 mType;
/* 0x08 */ u32 mFileSize;
/* 0x0C */ u32 mBlockNum;
/* 0x10 */ u8 padding[0x10];
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DScrnInfoHeader {
/* 0x0 */ u32 mTag;
/* 0x4 */ u32 mSize;
/* 0x8 */ u16 mWidth;
/* 0xA */ u16 mHeight;
/* 0xC */ u32 mColor;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DScrnBlockHeader {
/* 0x00 */ u32 mTag;
/* 0x04 */ s32 mSize;
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DScreen : public J2DPane {
public:
virtual ~J2DScreen();
virtual u16 getTypeID() const;
virtual void calcMtx();
virtual void drawSelf(f32, f32, Mtx*);
virtual J2DPane* search(u64);
virtual J2DPane* searchUserInfo(u64);
virtual bool isUsed(ResTIMG const*);
virtual bool isUsed(ResFONT const*);
virtual void clearAnmTransform() { J2DPane::clearAnmTransform(); }
virtual void setAnimation(J2DAnmColor*);
virtual void setAnimation(J2DAnmTransform* i_bck) { J2DPane::setAnimation(i_bck); }
virtual void setAnimation(J2DAnmTextureSRTKey*);
virtual void setAnimation(J2DAnmVtxColor*);
virtual void setAnimation(J2DAnmTexPattern*);
virtual void setAnimation(J2DAnmVisibilityFull*);
virtual void setAnimation(J2DAnmTevRegKey*);
virtual void setAnimation(J2DAnmBase*);
virtual void setAnimationVF(J2DAnmVisibilityFull*);
virtual void setAnimationVC(J2DAnmVtxColor*);
virtual J2DPane* createPane(J2DScrnBlockHeader const&, JSURandomInputStream*,
J2DPane*, u32);
virtual J2DPane* createPane(J2DScrnBlockHeader const&, JSURandomInputStream*,
J2DPane*, u32, JKRArchive*);
J2DScreen();
void clean();
bool setPriority(char const*, u32, JKRArchive*);
bool setPriority(JSURandomInputStream*, u32, JKRArchive*);
bool private_set(JSURandomInputStream*, u32, JKRArchive*);
bool checkSignature(JSURandomInputStream*);
bool getScreenInformation(JSURandomInputStream*);
s32 makeHierarchyPanes(J2DPane*, JSURandomInputStream*, u32, JKRArchive*);
void draw(f32, f32, J2DGrafContext const*);
J2DResReference* getResReference(JSURandomInputStream*, u32);
bool createMaterial(JSURandomInputStream*, u32, JKRArchive*);
static void* getNameResource(char const*);
void animation();
void setScissor(bool i_scissor) { mScissor = i_scissor; }
static J2DDataManage* getDataManage() { return mDataManage; }
static J2DDataManage* mDataManage;
/* 0x100 */ bool mScissor;
/* 0x102 */ u16 mMaterialNum;
/* 0x104 */ J2DMaterial* mMaterials;
/* 0x108 */ J2DResReference* mTexRes;
/* 0x10C */ J2DResReference* mFontRes;
/* 0x110 */ JUTNameTab* mNameTable;
/* 0x114 */ JUtility::TColor mColor;
};
#endif /* J2DSCREEN_H */
@@ -0,0 +1,654 @@
#ifndef J2DTEVS_H
#define J2DTEVS_H
#include <gx.h>
#include <mtx.h>
#include "global.h"
/**
* @ingroup jsystem-j2d
*
*/
struct J2DTextureSRTInfo {
/* 0x00 */ f32 mScaleX;
/* 0x04 */ f32 mScaleY;
/* 0x08 */ f32 mRotationDeg;
/* 0x0C */ f32 mTranslationX;
/* 0x10 */ f32 mTranslationY;
}; // Size: 0x14
/**
* @ingroup jsystem-j2d
*
*/
struct J2DTexMtxInfo {
enum {
/* 0x0 */ DCC_NONE,
/* 0x1 */ DCC_MAYA,
};
/* 0x00 */ u8 mTexMtxType;
/* 0x01 */ u8 mTexMtxDCC;
/* 0x02 */ u8 field_0x2; // padding ?
/* 0x03 */ u8 field_0x3; // padding ?
/* 0x04 */ Vec mCenter;
/* 0x10 */ J2DTextureSRTInfo mTexSRTInfo;
GXTexMtxType getTexMtxType() const { return (GXTexMtxType)mTexMtxType; }
J2DTexMtxInfo& operator=(const J2DTexMtxInfo& other) {
mCenter = other.mCenter;
mTexMtxType = other.mTexMtxType;
mTexMtxDCC = other.mTexMtxDCC;
mTexSRTInfo = other.mTexSRTInfo;
return *this;
}
}; // Size: 0x24
extern J2DTexMtxInfo const j2dDefaultTexMtxInfo;
/**
* @ingroup jsystem-j2d
*
*/
class J2DTexMtx {
public:
J2DTexMtx() { mInfo = j2dDefaultTexMtxInfo; }
~J2DTexMtx() {}
J2DTexMtx(const J2DTexMtxInfo& info) { mInfo = info; }
void load(u32);
void calc();
void getTextureMtx(J2DTextureSRTInfo const&, Vec, Mtx);
void getTextureMtxMaya(J2DTextureSRTInfo const&, Mtx);
J2DTexMtxInfo& getTexMtxInfo() { return mInfo; }
void setTexMtxInfo(J2DTexMtxInfo info) { mInfo = info; }
private:
/* 0x00 */ J2DTexMtxInfo mInfo;
/* 0x24 */ Mtx mTexMtx;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DIndTexOrderInfo {
/* 0x0 */ u8 mTexCoordID;
/* 0x1 */ u8 mTexMapID;
J2DIndTexOrderInfo& operator=(const J2DIndTexOrderInfo& other) {
mTexCoordID = other.mTexCoordID;
mTexMapID = other.mTexMapID;
return *this;
}
GXTexCoordID getTexCoordID() const { return (GXTexCoordID)mTexCoordID; }
GXTexMapID getTexMapID() const { return (GXTexMapID)mTexMapID; }
};
extern const J2DIndTexOrderInfo j2dDefaultIndTexOrderNull;
/**
* @ingroup jsystem-j2d
*
*/
class J2DIndTexOrder {
public:
J2DIndTexOrder() {
mInfo = j2dDefaultIndTexOrderNull;
}
J2DIndTexOrder(const J2DIndTexOrderInfo& info) {
mInfo = info;
}
J2DIndTexOrder& operator=(const J2DIndTexOrderInfo& info) {
mInfo = info;
return *this;
}
void setIndTexOrderInfo(const J2DIndTexOrderInfo& info) { mInfo = info; }
void load(u8);
private:
/* 0x0 */ J2DIndTexOrderInfo mInfo;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DIndTexMtxInfo {
/* 0x00 */ Mtx23 mMtx;
/* 0x18 */ s8 mScaleExp;
J2DIndTexMtxInfo& operator=(const J2DIndTexMtxInfo& other) {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
mMtx[i][j] = other.mMtx[i][j];
}
}
mScaleExp = other.mScaleExp;
return *this;
}
};
extern J2DIndTexMtxInfo const j2dDefaultIndTexMtxInfo;
/**
* @ingroup jsystem-j2d
*
*/
class J2DIndTexMtx {
public:
~J2DIndTexMtx() {}
J2DIndTexMtx() {
mIndTexMtxInfo = j2dDefaultIndTexMtxInfo;
}
J2DIndTexMtx(const J2DIndTexMtxInfo& info) {
mIndTexMtxInfo = info;
}
J2DIndTexMtx& operator=(const J2DIndTexMtxInfo& info) {
mIndTexMtxInfo = info;
return *this;
}
void setIndTexMtxInfo(const J2DIndTexMtxInfo& info) { mIndTexMtxInfo = info; }
void load(u8);
void load(u32);
void calc();
private:
/* 0x0 */ J2DIndTexMtxInfo mIndTexMtxInfo;
}; // Size: 0x1C
/**
* @ingroup jsystem-j2d
*
*/
struct J2DIndTexCoordScaleInfo {
/* 0x0 */ u8 mScaleS;
/* 0x1 */ u8 mScaleT;
J2DIndTexCoordScaleInfo& operator=(const J2DIndTexCoordScaleInfo& other) {
mScaleS = other.mScaleS;
mScaleT = other.mScaleT;
return *this;
}
GXIndTexScale getScaleS() const { return (GXIndTexScale)mScaleS; }
GXIndTexScale getScaleT() const { return (GXIndTexScale)mScaleT; }
};
extern const J2DIndTexCoordScaleInfo j2dDefaultIndTexCoordScaleInfo;
/**
* @ingroup jsystem-j2d
*
*/
class J2DIndTexCoordScale {
public:
~J2DIndTexCoordScale() {}
J2DIndTexCoordScale() {
mInfo = j2dDefaultIndTexCoordScaleInfo;
}
J2DIndTexCoordScale(const J2DIndTexCoordScaleInfo& info) {
mInfo = info;
}
J2DIndTexCoordScale& operator=(const J2DIndTexCoordScaleInfo& info) {
mInfo = info;
return *this;
}
void setIndTexCoordScaleInfo(const J2DIndTexCoordScaleInfo& info) { mInfo = info; }
void load(u8);
private:
/* 0x0 */ J2DIndTexCoordScaleInfo mInfo;
}; // Size: 0x2
/**
* @ingroup jsystem-j2d
*
*/
struct J2DIndTevStageInfo {
/* 0x0 */ u8 mIndStage;
/* 0x1 */ u8 mIndFormat;
/* 0x2 */ u8 mBiasSel;
/* 0x3 */ u8 mMtxSel;
/* 0x4 */ u8 mWrapS;
/* 0x5 */ u8 mWrapT;
/* 0x6 */ u8 mPrev;
/* 0x7 */ u8 mLod;
/* 0x8 */ u8 mAlphaSel;
/* 0x9 */ u8 field_0x9;
/* 0xa */ u8 field_0xa;
/* 0xb */ u8 field_0xb;
J2DIndTevStageInfo& operator=(const J2DIndTevStageInfo& other) {
mIndStage = other.mIndStage;
mIndFormat = other.mIndFormat;
mBiasSel = other.mBiasSel;
mMtxSel = other.mMtxSel;
mWrapS = other.mWrapS;
mWrapT = other.mWrapT;
mPrev = other.mPrev;
mLod = other.mLod;
mAlphaSel = other.mAlphaSel;
return *this;
}
};
inline u32 J2DCalcIndTevStage(J2DIndTevStageInfo info) {
return (info.mAlphaSel << 22) | (info.mLod << 21) | (info.mPrev << 20) |
(info.mMtxSel << 16) | (info.mWrapT << 11) | (info.mWrapS << 8) |
(info.mBiasSel << 4) | (info.mIndFormat << 2) | (info.mIndStage);
}
extern const J2DIndTevStageInfo j2dDefaultIndTevStageInfo;
/**
* @ingroup jsystem-j2d
*
*/
class J2DIndTevStage {
public:
void load(u8);
J2DIndTevStage() {
mFlags = J2DCalcIndTevStage(j2dDefaultIndTevStageInfo);
}
J2DIndTevStage(const J2DIndTevStageInfo& info) {
mFlags = J2DCalcIndTevStage(info);
}
void setIndTevStageInfo(const J2DIndTevStageInfo& info) { mFlags = J2DCalcIndTevStage(info); }
private:
/* 0x0 */ u32 mFlags;
u8 getIndStage() const { return (mFlags & 0x03); }
u8 getIndFormat() const { return (mFlags >> 2) & 0x03; }
u8 getBiasSel() const { return (mFlags >> 4) & 0x07; }
u8 getWrapS() const { return (mFlags >> 8) & 0x07; }
u8 getWrapT() const { return (mFlags >> 11) & 0x07; }
u8 getMtxSel() const { return (mFlags >> 16) & 0x0F; }
u8 getPrev() const { return (mFlags >> 20) & 0x01; }
u8 getLod() const { return (mFlags >> 21) & 0x01; }
u8 getAlphaSel() const { return (mFlags >> 22) & 0x03; }
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DTexCoordInfo {
/* 0x0 */ u8 mTexGenType;
/* 0x1 */ u8 mTexGenSrc;
/* 0x2 */ u8 mTexGenMtx;
u8 padding; // ?
J2DTexCoordInfo& operator=(const J2DTexCoordInfo& other) {
mTexGenType = other.mTexGenType;
mTexGenSrc = other.mTexGenSrc;
mTexGenMtx = other.mTexGenMtx;
return *this;
}
};
extern J2DTexCoordInfo const j2dDefaultTexCoordInfo[8];
/**
* @ingroup jsystem-j2d
*
*/
class J2DTexCoord {
public:
inline J2DTexCoord() {
mTexCoordInfo = j2dDefaultTexCoordInfo[0];
}
J2DTexCoord(const J2DTexCoordInfo& info) {
mTexCoordInfo = info;
}
void setTexCoordInfo(const J2DTexCoordInfo& info) { mTexCoordInfo = info; }
void setTexGenMtx(u8 texGenMtx) { mTexCoordInfo.mTexGenMtx = texGenMtx; }
u8 getTexGenType() const { return mTexCoordInfo.mTexGenType; }
u8 getTexGenSrc() const { return mTexCoordInfo.mTexGenSrc; }
u8 getTexGenMtx() const { return mTexCoordInfo.mTexGenMtx; }
private:
/* 0x0 */ J2DTexCoordInfo mTexCoordInfo;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DTevOrderInfo {
/* 0x0 */ u8 mTexCoord;
/* 0x1 */ u8 mTexMap;
/* 0x2 */ u8 mColor;
/* 0x3 */ u8 field_0x3;
J2DTevOrderInfo& operator=(const J2DTevOrderInfo& other) {
mTexCoord = other.mTexCoord;
mTexMap = other.mTexMap;
mColor = other.mColor;
return *this;
}
};
extern const J2DTevOrderInfo j2dDefaultTevOrderInfoNull;
/**
* @ingroup jsystem-j2d
*
*/
class J2DTevOrder {
public:
J2DTevOrder() {
mTevOrderInfo = j2dDefaultTevOrderInfoNull;
}
J2DTevOrder(const J2DTevOrderInfo& info) {
*(J2DTevOrderInfo*)this = info;
}
void setTevOrderInfo(const J2DTevOrderInfo& info) {mTevOrderInfo = info; }
u8 getColor() const { return mTevOrderInfo.mColor; }
u8 getTexMap() const { return mTevOrderInfo.mTexMap; }
u8 getTexCoord() const { return mTevOrderInfo.mTexCoord; }
/* 0x0 */ J2DTevOrderInfo mTevOrderInfo;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DTevStageInfo {
/* 0x00 */ u8 field_0x0;
/* 0x01 */ u8 mColorA;
/* 0x02 */ u8 mColorB;
/* 0x03 */ u8 mColorC;
/* 0x04 */ u8 mColorD;
/* 0x05 */ u8 mCOp;
/* 0x06 */ u8 mCBias;
/* 0x07 */ u8 mCScale;
/* 0x08 */ u8 mCClamp;
/* 0x09 */ u8 mCReg;
/* 0x0A */ u8 mAlphaA;
/* 0x0B */ u8 mAlphaB;
/* 0x0C */ u8 mAlphaC;
/* 0x0D */ u8 mAlphaD;
/* 0x0E */ u8 mAOp;
/* 0x0F */ u8 mABias;
/* 0x10 */ u8 mAScale;
/* 0x11 */ u8 mAClamp;
/* 0x12 */ u8 mAReg;
/* 0x13 */ u8 field_0x13;
};
extern J2DTevStageInfo const j2dDefaultTevStageInfo;
/**
* @ingroup jsystem-j2d
*
*/
struct J2DTevSwapModeInfo {
/* 0x0 */ u8 mRasSel;
/* 0x1 */ u8 mTexSel;
/* 0x2 */ u8 field_0x2;
/* 0x3 */ u8 field_0x3;
};
extern const J2DTevSwapModeInfo j2dDefaultTevSwapMode;
/**
* @ingroup jsystem-j2d
*
*/
class J2DTevStage {
public:
J2DTevStage(J2DTevStageInfo const& param_0) {
setTevStageInfo(param_0);
setTevSwapModeInfo(j2dDefaultTevSwapMode);
}
J2DTevStage() {
setTevStageInfo(j2dDefaultTevStageInfo);
setTevSwapModeInfo(j2dDefaultTevSwapMode);
}
void setTevStageInfo(J2DTevStageInfo const& info) {
setColorABCD(info.mColorA, info.mColorB, info.mColorC, info.mColorD);
setTevColorOp(info.mCOp, info.mCBias, info.mCScale, info.mCClamp, info.mCReg);
setAlphaABCD(info.mAlphaA, info.mAlphaB, info.mAlphaC, info.mAlphaD);
setTevAlphaOp(info.mAOp, info.mABias, info.mAScale, info.mAClamp, info.mAReg);
}
void setStageNo(u32 param_0) {
field_0x0 = (param_0 << 1) + 0xc0;
field_0x4 = (param_0 << 1) + 0xc1;
}
void setTevSwapModeInfo(const J2DTevSwapModeInfo& swapInfo) {
setTexSel(swapInfo.mTexSel);
setRasSel(swapInfo.mRasSel);
}
void setTexSel(u8 param_0) {
field_0x7 = (field_0x7 & ~0x0c) | (param_0 << 2);
}
void setRasSel(u8 param_0) {
field_0x7 = (field_0x7 & ~0x03) | param_0;
}
void setColorABCD(u8 a, u8 b, u8 c, u8 d) {
setTevColorAB(a, b);
setTevColorCD(c, d);
}
void setTevColorAB(u8 a, u8 b) { field_0x2 = a << 4 | b; }
void setTevColorCD(u8 c, u8 d) { field_0x3 = c << 4 | d; }
void setTevColorOp(u8 op, u8 bias, u8 scale, u8 clamp, u8 reg) {
field_0x1 = field_0x1 & ~0x04 | op << 2;
if (op <= 1) {
field_0x1 = field_0x1 & ~0x30 | scale << 4;
field_0x1 = field_0x1 & ~0x03 | bias;
} else {
field_0x1 = field_0x1 & ~0x30 | (op >> 1 & 3) << 4;
field_0x1 = field_0x1 & ~0x03 | 3;
}
field_0x1 = field_0x1 & ~0x08 | clamp << 3;
field_0x1 = field_0x1 & ~0xc0 | reg << 6;
}
void setAlphaABCD(u8 a, u8 b, u8 c, u8 d) {
setAlphaA(a);
setAlphaB(b);
setAlphaC(c);
setAlphaD(d);
}
void setAlphaA(u8 a) {
field_0x6 = field_0x6 & ~0xe0 | a << 5;
}
void setAlphaB(u8 b) {
field_0x6 = field_0x6 & ~0x1c | b << 2;
}
void setAlphaC(u8 c) {
field_0x6 = field_0x6 & ~0x03 | c >> 1;
field_0x7 = field_0x7 & ~0x80 | c << 7;
}
void setAlphaD(u8 d) {
field_0x7 = field_0x7 & ~0x70 | d << 4;
}
void setTevAlphaOp(u8 op, u8 bias, u8 scale, u8 clamp, u8 reg) {
field_0x5 = field_0x5 & ~0x04 | op << 2;
if (op <= 1) {
field_0x5 = field_0x5 & ~0x03 | bias;
field_0x5 = field_0x5 & ~0x30 | scale << 4;
} else {
field_0x5 = field_0x5 & ~0x30 | (op >> 1 & 3) << 4;
field_0x5 = field_0x5 & ~0x03 | 3;
}
field_0x5 = field_0x5 & ~0x08 | clamp << 3;
field_0x5 = field_0x5 & ~0xc0 | reg << 6;
}
u8 getColorA() const { return (field_0x2 & 0xf0) >> 4; }
u8 getColorB() const { return field_0x2 & 0x0f; }
u8 getColorC() const { return (field_0x3 & 0xf0) >> 4; }
u8 getColorD() const { return field_0x3 & 0x0f; }
u8 getAlphaA() const { return (field_0x6 & 0xe0) >> 5; }
u8 getAlphaB() const { return (field_0x6 & 0x1c) >> 2; }
u8 getAlphaC() const { return (field_0x6 & 0x03) << 1 | (field_0x7 & 0x80) >> 7; }
u8 getAlphaD() const { return (field_0x7 & 0x70) >> 4; }
u8 getCOp() const {
if (getCBias() != 3) {
return (field_0x1 & 4) >> 2;
}
return ((field_0x1 & 4) >> 2) + 8 + ((field_0x1 & 0x30) >> 3);
}
u8 getCBias() const { return field_0x1 & 0x03; }
u8 getCScale() const { return (field_0x1 & 0x30) >> 4; }
u8 getCClamp() const { return (field_0x1 & 0x08) >> 3; }
u8 getCReg() const { return (field_0x1 & 0xc0) >> 6; }
u8 getAOp() const {
if (getABias() != 3) {
return (field_0x5 & 4) >> 2;
}
return ((field_0x5 & 4) >> 2) + 8 + ((field_0x5 & 0x30) >> 3);
}
u8 getABias() const { return field_0x5 & 0x03; }
u8 getAScale() const { return (field_0x5 & 0x30) >> 4; }
u8 getAClamp() const { return (field_0x5 & 0x08) >> 3; }
u8 getAReg() const { return (field_0x5 & 0xc0) >> 6; }
u8 getRasSel() const { return field_0x7 & 3; }
u8 getTexSel() const { return (field_0x7 & 0x0c) >> 2; }
void operator=(J2DTevStage const& other) {
field_0x1 = other.field_0x1;
field_0x2 = other.field_0x2;
field_0x3 = other.field_0x3;
field_0x5 = other.field_0x5;
field_0x6 = other.field_0x6;
field_0x7 = other.field_0x7;
}
private:
/* 0x0 */ u8 field_0x0;
/* 0x1 */ u8 field_0x1;
/* 0x2 */ u8 field_0x2;
/* 0x3 */ u8 field_0x3;
/* 0x4 */ u8 field_0x4;
/* 0x5 */ u8 field_0x5;
/* 0x6 */ u8 field_0x6;
/* 0x7 */ u8 field_0x7;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DTevSwapModeTableInfo {
/* 0x0 */ u8 field_0x0;
/* 0x1 */ u8 field_0x1;
/* 0x2 */ u8 field_0x2;
/* 0x3 */ u8 field_0x3;
J2DTevSwapModeTableInfo& operator=(const J2DTevSwapModeTableInfo& other) {
field_0x0 = other.field_0x0;
field_0x1 = other.field_0x1;
field_0x2 = other.field_0x2;
field_0x3 = other.field_0x3;
return *this;
}
};
inline u8 J2DCalcTevSwapTable(u8 param_0, u8 param_1, u8 param_2, u8 param_3) {
return (param_0 << 6) + (param_1 << 4) + (param_2 << 2) + param_3;
}
extern const J2DTevSwapModeTableInfo j2dDefaultTevSwapModeTable;
extern const u8 j2dDefaultTevSwapTableID;
/**
* @ingroup jsystem-j2d
*
*/
class J2DTevSwapModeTable {
public:
J2DTevSwapModeTable() { mIdx = j2dDefaultTevSwapTableID; }
J2DTevSwapModeTable(const J2DTevSwapModeTableInfo& info) {
mIdx = J2DCalcTevSwapTable(info.field_0x0, info.field_0x1, info.field_0x2, info.field_0x3);
}
void operator=(const J2DTevSwapModeTable& other) {
mIdx = other.mIdx;
}
void setTevSwapModeTableInfo(const J2DTevSwapModeTableInfo& info) {
mIdx = J2DCalcTevSwapTable(info.field_0x0, info.field_0x1, info.field_0x2, info.field_0x3);
}
u8 getR() const { return mIdx >> 6 & 3; }
u8 getG() const { return mIdx >> 4 & 3; }
u8 getB() const { return mIdx >> 2 & 3; }
u8 getA() const { return mIdx & 3; }
private:
/* 0x0 */ u8 mIdx;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DColorChanInfo {
/* 0x0 */ u8 field_0x0;
/* 0x0 */ u8 field_0x1;
/* 0x0 */ u8 field_0x2;
/* 0x0 */ u8 field_0x3;
J2DColorChanInfo& operator=(const J2DColorChanInfo& other) {
field_0x0 = other.field_0x0;
field_0x1 = other.field_0x1;
field_0x2 = other.field_0x2;
field_0x3 = other.field_0x3;
return *this;
}
};
inline u16 J2DCalcColorChanID(u8 param_0) { return param_0; }
extern const J2DColorChanInfo j2dDefaultColorChanInfo;
/**
* @ingroup jsystem-j2d
*
*/
class J2DColorChan {
public:
J2DColorChan() {
setColorChanInfo(j2dDefaultColorChanInfo);
}
J2DColorChan(const J2DColorChanInfo& info) {
mColorChan = J2DCalcColorChanID(info.field_0x1);
}
void setColorChanInfo(const J2DColorChanInfo& info) {
mColorChan = J2DCalcColorChanID(info.field_0x1);
}
u8 getMatSrc() const { return mColorChan & 1; }
void operator=(const J2DColorChan& other) {
mColorChan = other.mColorChan;
}
private:
/* 0x0 */ u16 mColorChan;
};
extern const GXColor j2dDefaultColInfo;
extern const GXColorS10 j2dDefaultTevColor;
extern const GXColor j2dDefaultTevKColor;
extern const J2DTevOrderInfo j2dDefaultTevOrderInfoNull;
extern const u8 j2dDefaultPEBlockDither;
extern const u8 j2dDefaultTevSwapTableID;
extern const u16 j2dDefaultAlphaCmp;
#endif /* J2DTEVS_H */
@@ -0,0 +1,179 @@
#ifndef J2DTEXTBOX_H
#define J2DTEXTBOX_H
#include "JSystem/J2DGraph/J2DMaterial.h"
#include "JSystem/J2DGraph/J2DPane.h"
class J2DMaterial;
class JUTFont;
enum J2DTextBoxVBinding {
/* 0x0 */ VBIND_CENTER,
/* 0x1 */ VBIND_BOTTOM,
/* 0x2 */ VBIND_TOP
};
enum J2DTextBoxHBinding {
/* 0x0 */ HBIND_CENTER,
/* 0x1 */ HBIND_RIGHT,
/* 0x2 */ HBIND_LEFT
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DTbxBlockHeader {
/* 0x00 */ u32 mTag;
/* 0x04 */ s32 mSize;
};
/**
* @ingroup jsystem-j2d
*
*/
struct J2DTextBoxInfo {
/* 0x00 */ u16 field_0x0;
/* 0x02 */ u16 field_0x2;
/* 0x04 */ u16 mMaterialNum;
/* 0x06 */ s16 mCharSpace;
/* 0x08 */ s16 mLineSpace;
/* 0x0A */ u16 mFontSizeX;
/* 0x0C */ u16 mFontSizeY;
/* 0x0E */ u8 mHBind;
/* 0x0F */ u8 mVBind;
/* 0x10 */ u32 mCharColor;
/* 0x14 */ u32 mGradColor;
/* 0x18 */ u8 mConnected;
/* 0x19 */ char field_0x19[3];
/* 0x1C */ u16 field_0x1c;
/* 0x1E */ u16 field_0x1e;
}; // Size: 0x20
/**
* @ingroup jsystem-j2d
*
*/
class J2DTextBox : public J2DPane {
public:
struct TFontSize {
/* 0x0 */ f32 mSizeX;
/* 0x4 */ f32 mSizeY;
};
virtual ~J2DTextBox();
virtual u16 getTypeID() const;
virtual void resize(f32, f32);
virtual bool setConnectParent(bool);
virtual void drawSelf(f32, f32, Mtx*);
virtual void drawSelf(f32, f32);
virtual bool isUsed(ResTIMG const*);
virtual bool isUsed(ResFONT const*);
virtual void rewriteAlpha();
virtual void draw(f32, f32);
virtual void draw(f32, f32, f32, J2DTextBoxHBinding);
virtual void setFont(JUTFont*);
virtual JUTFont* getFont() const { return mFont; }
virtual bool setBlack(JUtility::TColor);
virtual bool setWhite(JUtility::TColor white) { mWhiteColor = white; return true; }
virtual bool setBlackWhite(JUtility::TColor black, JUtility::TColor white) {
mBlackColor = black;
mWhiteColor = white;
return true;
}
virtual JUtility::TColor getBlack() const {
return mBlackColor;
}
virtual JUtility::TColor getWhite() const {
return mWhiteColor;
}
virtual J2DMaterial* getMaterial() const { return NULL; }
J2DTextBox(u64, JGeometry::TBox2<f32> const&, ResFONT const*, char const*, s16,
J2DTextBoxHBinding, J2DTextBoxVBinding);
J2DTextBox(J2DPane*, JSURandomInputStream*, JKRArchive*);
J2DTextBox(J2DPane*, JSURandomInputStream*, u32, J2DMaterial*);
J2DTextBox();
void initiate(ResFONT const*, char const*, s16, J2DTextBoxHBinding,
J2DTextBoxVBinding);
void private_readStream(J2DPane*, JSURandomInputStream*, JKRArchive*);
char* getStringPtr() const;
s32 setString(s16, char const*, ...);
s32 setString(char const*, ...);
void setFontSize(f32 sizeX, f32 sizeY) {
f32 x;
if (sizeX > 0.0f) {
x = sizeX;
} else {
x = 0.0f;
}
mFontSizeX = x;
f32 y;
if (sizeY > 0.0f) {
y = sizeY;
} else {
y = 0.0f;
}
mFontSizeY = y;
}
void setFontSize(TFontSize size) { setFontSize(size.mSizeX, size.mSizeY); }
void getFontSize(TFontSize& size) const {
size.mSizeX = mFontSizeX;
size.mSizeY = mFontSizeY;
}
void setFontColor(JUtility::TColor i_charColor, JUtility::TColor i_GradientColor) {
mCharColor = i_charColor;
mGradientColor = i_GradientColor;
}
void setCharColor(JUtility::TColor i_charColor) {
mCharColor.set(i_charColor);
}
void setGradColor(JUtility::TColor i_GradientColor) {
mGradientColor.set(i_GradientColor);
}
void setCharSpace(f32 space) { mCharSpacing = space; }
f32 getCharSpace() const { return mCharSpacing; }
void setLineSpace(f32 space) { mLineSpacing = space; }
f32 getLineSpace() const { return mLineSpacing; }
J2DTextBoxVBinding getVBinding() const {
return (J2DTextBoxVBinding)(mFlags & 3);
}
J2DTextBoxHBinding getHBinding() const {
return (J2DTextBoxHBinding)((mFlags >> 2) & 3);
}
JUtility::TColor getCharColor() { return mCharColor; }
JUtility::TColor getGradColor() { return mGradientColor; }
u16 getStringAllocByte() const { return mStringLength; }
// private:
/* 0x0100 */ JUTFont* mFont;
/* 0x0104 */ JUtility::TColor mCharColor;
/* 0x0108 */ JUtility::TColor mGradientColor;
/* 0x010C */ f32 field_0x10c;
/* 0x0110 */ f32 field_0x110;
/* 0x0114 */ f32 mCharSpacing;
/* 0x0118 */ f32 mLineSpacing;
/* 0x011C */ f32 mFontSizeX;
/* 0x0120 */ f32 mFontSizeY;
/* 0x0124 */ char* mStringPtr;
/* 0x0128 */ JUtility::TColor mWhiteColor;
/* 0x012C */ JUtility::TColor mBlackColor;
/* 0x0130 */ u8 mFlags;
/* 0x0131 */ bool mTextFontOwned;
/* 0x0132 */ u16 mStringLength;
#if PLATFORM_GCN
/* 0x0134 */ u8 field_0x134[4];
#endif
}; // Size: 0x138
#endif /* J2DTEXTBOX_H */
@@ -0,0 +1,63 @@
#ifndef J2DTEXTBOXEX_H
#define J2DTEXTBOXEX_H
#include "JSystem/J2DGraph/J2DTextBox.h"
class J2DMaterial;
/**
* @ingroup jsystem-j2d
*
*/
class J2DTextBoxEx : public J2DTextBox {
public:
enum stage_enum {
STAGE_0,
STAGE_1,
STAGE_2,
};
J2DTextBoxEx(J2DPane*, JSURandomInputStream*, u32, J2DMaterial*);
void setTevOrder(bool);
void setTevStage(bool);
void setStage(J2DTevStage*, J2DTextBoxEx::stage_enum);
bool getBlackWhite(JUtility::TColor*, JUtility::TColor*) const;
bool isSetBlackWhite(JUtility::TColor, JUtility::TColor) const;
virtual ~J2DTextBoxEx();
virtual void setCullBack(bool);
virtual void setCullBack(_GXCullMode);
virtual void setAlpha(u8);
virtual void drawSelf(f32, f32, f32 (*)[3][4]);
virtual bool isUsed(ResTIMG const*);
virtual bool isUsed(ResFONT const*);
virtual void rewriteAlpha();
virtual void setAnimation(J2DAnmBase*);
virtual void setAnimation(J2DAnmTransform* transform) { J2DPane::setAnimation(transform); }
virtual void setAnimation(J2DAnmColor*);
virtual void setAnimation(J2DAnmTexPattern*);
virtual void setAnimation(J2DAnmTextureSRTKey*);
virtual void setAnimation(J2DAnmTevRegKey*);
virtual void setAnimation(J2DAnmVisibilityFull*);
virtual void setAnimation(J2DAnmVtxColor*);
virtual const J2DAnmTransform* animationPane(J2DAnmTransform const*);
virtual void draw(f32, f32);
virtual void draw(f32, f32, f32, J2DTextBoxHBinding);
virtual void setFont(JUTFont*);
virtual JUTFont* getFont() const;
virtual bool setBlack(JUtility::TColor);
virtual bool setWhite(JUtility::TColor);
virtual bool setBlackWhite(JUtility::TColor, JUtility::TColor);
virtual JUtility::TColor getBlack() const;
virtual JUtility::TColor getWhite() const;
virtual J2DMaterial* getMaterial() const { return mMaterial; }
private:
/* 0x138 */ J2DMaterial* mMaterial;
/* 0x13C */ u16 field_0x13c;
/* 0x13E */ u16 field_0x13e;
/* 0x140 */ u8 field_0x140;
/* 0x144 */ J2DAnmVisibilityFull* mVisibilityAnm;
}; // Size: 0x148
#endif /* J2DTEXTBOXEX_H */
@@ -0,0 +1,129 @@
#ifndef J2DWINDOW_H
#define J2DWINDOW_H
#include "JSystem/J2DGraph/J2DMaterial.h"
#include "JSystem/J2DGraph/J2DPane.h"
class JSURandomInputStream;
class JUTTexture;
enum J2DTextureBase {
TEXTUREBASE_0 = 0,
TEXTUREBASE_1 = 1,
TEXTUREBASE_2 = 2,
TEXTUREBASE_3 = 3,
};
enum J2DWindowMirror {
WINDOWMIRROR_39 = 39,
WINDOWMIRROR_114 = 114,
WINDOWMIRROR_141 = 141,
WINDOWMIRROR_216 = 216,
};
/**
* @ingroup jsystem-j2d
*
*/
class J2DWindow : public J2DPane {
public:
struct TMaterial {
/* 0x00 */ J2DMaterial* field_0x0;
/* 0x04 */ J2DMaterial* field_0x4;
/* 0x08 */ J2DMaterial* field_0x8;
/* 0x0C */ J2DMaterial* field_0xc;
/* 0x10 */ J2DMaterial* field_0x10;
}; // Size: 0x14
struct TContentsColor {
TContentsColor() {}
/* 0x0 */ JUtility::TColor field_0x0;
/* 0x4 */ JUtility::TColor field_0x4;
/* 0x8 */ JUtility::TColor field_0x8;
/* 0xC */ JUtility::TColor field_0xc;
}; // Size: 0x10
J2DWindow(J2DPane*, JSURandomInputStream*, J2DMaterial*);
J2DWindow(J2DPane*, JSURandomInputStream*, JKRArchive*);
J2DWindow();
J2DWindow(u64, const JGeometry::TBox2<f32>&, const char*, J2DTextureBase, const ResTLUT*);
void initiate(const ResTIMG*, const ResTIMG*, const ResTIMG*, const ResTIMG*, const ResTLUT*, J2DWindowMirror, const JGeometry::TBox2<f32>&);
void private_readStream(J2DPane*, JSURandomInputStream*, JKRArchive*);
void initinfo();
void initinfo2();
static J2DWindowMirror convertMirror(J2DTextureBase);
void draw_private(JGeometry::TBox2<f32> const&, JGeometry::TBox2<f32> const&);
void setContentsColor(JUtility::TColor, JUtility::TColor, JUtility::TColor,
JUtility::TColor);
void drawFrameTexture(JUTTexture*, f32, f32, f32, f32, u16, u16, u16, u16, bool);
void drawFrameTexture(JUTTexture*, f32, f32, bool, bool, bool);
void drawContentsTexture(f32, f32, f32, f32);
void setTevMode(JUTTexture*, JUtility::TColor, JUtility::TColor);
virtual ~J2DWindow();
/* vt 0x0C */ virtual u16 getTypeID() const { return 17; }
/* vt 0x18 */ virtual void resize(f32, f32);
/* vt 0x34 */ virtual void drawSelf(f32, f32);
/* vt 0x38 */ virtual void drawSelf(f32, f32, Mtx*);
/* vt 0x94 */ virtual void draw(JGeometry::TBox2<f32> const&);
/* vt 0x98 */ virtual void draw(JGeometry::TBox2<f32> const&, JGeometry::TBox2<f32> const&);
/* vt 0x9C */ virtual void draw(f32 left, f32 top, f32 width, f32 height) { draw(JGeometry::TBox2<f32>(left, top, left + width, top + height)); }
/* vt 0xA0 */ virtual bool setBlack(JUtility::TColor);
/* vt 0xA4 */ virtual bool setWhite(JUtility::TColor);
/* vt 0xA8 */ virtual bool setBlackWhite(JUtility::TColor, JUtility::TColor);
/* vt 0xAC */ virtual JUtility::TColor getBlack() const;
/* vt 0xB0 */ virtual JUtility::TColor getWhite() const;
/* vt 0xB4 */ virtual JUTTexture* getFrameTexture(u8, u8) const;
/* vt 0xB8 */ virtual JUTTexture* getContentsTexture(u8 param_1) const {
if (param_1 != 0) {
return NULL;
}
return field_0x110;
}
/* vt 0xBC */ virtual void getMaterial(J2DWindow::TMaterial& mat) const {
mat.field_0x0 = NULL;
mat.field_0x4 = NULL;
mat.field_0x8 = NULL;
mat.field_0xc = NULL;
mat.field_0x10 = NULL;
}
/* vt 0xC0 */ virtual J2DMaterial* getFrameMaterial(u8) const { return NULL; }
/* vt 0xC4 */ virtual J2DMaterial* getContentsMaterial() const { return NULL; }
/* vt 0xC8 */ virtual void drawContents(JGeometry::TBox2<f32> const&);
/* vt 0x4C */ virtual bool isUsed(const ResTIMG*);
/* vt 0x50 */ virtual bool isUsed(const ResFONT* font) { return J2DPane::isUsed(font); }
/* vt 0x58 */ virtual void rewriteAlpha() {}
bool isField0x145Set(u8 flag) { return field_0x145 & flag; }
void getContentsColor(TContentsColor& param_0) const {
param_0.field_0x0 = field_0x128;
param_0.field_0x4 = field_0x12C;
param_0.field_0x8 = field_0x130;
param_0.field_0xc = field_0x134;
}
void setContentsColor(JUtility::TColor param_0) {
setContentsColor(param_0, param_0, param_0, param_0);
}
protected:
/* 0x100 */ JUTTexture* field_0x100;
/* 0x104 */ JUTTexture* field_0x104;
/* 0x108 */ JUTTexture* field_0x108;
/* 0x10C */ JUTTexture* field_0x10c;
/* 0x110 */ JUTTexture* field_0x110;
/* 0x114 */ JGeometry::TBox2<f32> field_0x114;
/* 0x124 */ JUTPalette* mPalette;
/* 0x128 */ JUtility::TColor field_0x128;
/* 0x12C */ JUtility::TColor field_0x12C;
/* 0x130 */ JUtility::TColor field_0x130;
/* 0x134 */ JUtility::TColor field_0x134;
/* 0x138 */ JUtility::TColor mWhite;
/* 0x13C */ JUtility::TColor mBlack;
/* 0x140 */ s16 field_0x140;
/* 0x142 */ s16 field_0x142;
/* 0x144 */ u8 field_0x144;
/* 0x145 */ u8 field_0x145;
}; // Size: 0x148
#endif /* J2DWINDOW_H */
@@ -0,0 +1,77 @@
#ifndef J2DWINDOWEX_H
#define J2DWINDOWEX_H
#include "JSystem/J2DGraph/J2DWindow.h"
/**
* @ingroup jsystem-j2d
*
*/
class J2DWindowEx : public J2DWindow {
public:
enum stage_enum {
STAGE_ENUM_0,
STAGE_ENUM_1,
STAGE_ENUM_2,
STAGE_ENUM_3,
STAGE_ENUM_4,
};
J2DWindowEx(J2DPane*, JSURandomInputStream*, u32, J2DMaterial*);
void setMinSize();
void draw_private(JGeometry::TBox2<f32> const&, JGeometry::TBox2<f32> const&);
void drawFrameTexture(f32, f32, f32, f32, u16, u16, u16, u16, J2DMaterial*,
bool);
void setTevOrder(bool);
void setTevStage(bool);
void setStage(J2DTevStage*, J2DWindowEx::stage_enum);
bool getBlackWhite(JUtility::TColor*, JUtility::TColor*) const;
bool isSetBlackWhite(JUtility::TColor, JUtility::TColor) const;
bool isNeedSetAnm(u8);
virtual ~J2DWindowEx();
virtual void setCullBack(bool);
virtual void setCullBack(_GXCullMode);
virtual void setAlpha(u8);
virtual void drawSelf(f32, f32, f32 (*)[3][4]);
virtual bool isUsed(ResTIMG const*);
virtual bool isUsed(ResFONT const*);
virtual void rewriteAlpha();
virtual void setAnimation(J2DAnmBase*);
virtual void setAnimation(J2DAnmTransform* transform) { J2DPane::setAnimation(transform); }
virtual void setAnimation(J2DAnmColor*);
virtual void setAnimation(J2DAnmTexPattern*);
virtual void setAnimation(J2DAnmTextureSRTKey*);
virtual void setAnimation(J2DAnmTevRegKey*);
virtual void setAnimation(J2DAnmVisibilityFull*);
virtual void setAnimation(J2DAnmVtxColor*);
virtual const J2DAnmTransform* animationPane(J2DAnmTransform const*);
virtual void draw(JGeometry::TBox2<f32> const&);
virtual void draw(JGeometry::TBox2<f32> const&, JGeometry::TBox2<f32> const&);
virtual void draw(f32, f32, f32, f32);
virtual bool setBlack(JUtility::TColor);
virtual bool setWhite(JUtility::TColor);
virtual bool setBlackWhite(JUtility::TColor, JUtility::TColor);
virtual JUtility::TColor getBlack() const;
virtual JUtility::TColor getWhite() const;
virtual JUTTexture* getFrameTexture(u8, u8) const;
virtual JUTTexture* getContentsTexture(u8) const;
virtual void getMaterial(J2DWindow::TMaterial&) const;
virtual J2DMaterial* getFrameMaterial(u8) const;
virtual J2DMaterial* getContentsMaterial() const;
virtual void drawContents(JGeometry::TBox2<f32> const&);
private:
/* 0x148 */ J2DMaterial* mFrameMaterial[4];
/* 0x158 */ u16 field_0x158[4];
/* 0x160 */ J2DMaterial* mContentsMaterial;
/* 0x164 */ u16 field_0x164;
/* 0x166 */ u16 field_0x166;
/* 0x168 */ u16 field_0x168[4];
/* 0x170 */ u8 field_0x170;
/* 0x174 */ J2DAnmVisibilityFull* mAnmVisibilityFull;
/* 0x178 */ J2DAnmVtxColor* mAnmVtxColor;
/* 0x17C */ u8 field_0x17c;
};
#endif /* J2DWINDOWEX_H */