J2DGraph debug (#3028)

* J2DGraph debug

* J2DGraph debug
This commit is contained in:
Jcw87
2026-01-11 19:00:04 -08:00
committed by GitHub
parent 6e76f12dd3
commit 2dd7e2ea62
27 changed files with 1200 additions and 931 deletions
+62 -65
View File
@@ -27,9 +27,13 @@ enum J2DAnmKind {
class J2DAnmBase {
public:
J2DAnmBase() {
mFrame = 0;
mFrame = 0.0f;
mFrameMax = 0;
}
J2DAnmBase(s16 frameMax) {
mFrame = 0.0f;
mFrameMax = frameMax;
}
virtual ~J2DAnmBase() {}
virtual void searchUpdateMaterialID(J2DScreen*) {}
@@ -54,10 +58,10 @@ class J2DAnmVtxColor : public J2DAnmBase {
public:
J2DAnmVtxColor() {
mKind = KIND_VTX_COLOR;
for (s32 i = 0; i < ARRAY_SIZEU(mAnmTableNum); i++) {
for (int i = 0; i < ARRAY_SIZE(mAnmTableNum); i++) {
mAnmTableNum[i] = NULL;
}
for (s32 i = 0; i < ARRAY_SIZEU(mVtxColorIndexData); i++) {
for (int i = 0; i < ARRAY_SIZE(mVtxColorIndexData); i++) {
mVtxColorIndexData[i] = NULL;
}
}
@@ -92,7 +96,7 @@ struct J3DTextureSRTInfo;
class J2DAnmVtxColorKey : public J2DAnmVtxColor {
public:
J2DAnmVtxColorKey() {
for (s32 i = 0; i < ARRAY_SIZEU(mInfoTable); i++) {
for (int i = 0; i < ARRAY_SIZE(mInfoTable); i++) {
mInfoTable[i] = NULL;
}
}
@@ -113,7 +117,7 @@ public:
class J2DAnmVtxColorFull : public J2DAnmVtxColor {
public:
J2DAnmVtxColorFull() {
for (s32 i = 0; i < ARRAY_SIZEU(mInfoTable); i++) {
for (int i = 0; i < ARRAY_SIZE(mInfoTable); i++) {
mInfoTable[i] = NULL;
}
}
@@ -155,7 +159,7 @@ public:
*/
class J2DAnmTransform : public J2DAnmBase {
public:
J2DAnmTransform(f32* pScaleValues, s16* pRotationValues, f32* pTranslateValues) {
J2DAnmTransform(s16 frameMax, f32* pScaleValues, s16* pRotationValues, f32* pTranslateValues) : J2DAnmBase(frameMax) {
mScaleValues = pScaleValues;
mRotationValues = pRotationValues;
mTranslateValues = pTranslateValues;
@@ -175,18 +179,18 @@ public:
*/
class J2DAnmTransformKey : public J2DAnmTransform {
public:
J2DAnmTransformKey() : J2DAnmTransform(NULL, NULL, NULL) {
J2DAnmTransformKey() : J2DAnmTransform(0, NULL, NULL, NULL) {
field_0x24 = 0;
mInfoTable = NULL;
}
virtual ~J2DAnmTransformKey() {}
virtual void getTransform(u16 p1, J3DTransformInfo* pInfo) const {
this->calcTransform(getFrame(), p1, pInfo);
this->calcTransform(mFrame, p1, pInfo);
}
virtual void calcTransform(f32, u16, J3DTransformInfo*) const;
/* 0x1C */ u8 field_0x1c[6];
/* 0x22 */ s16 field_0x22;
/* 0x22 */ u16 field_0x22;
/* 0x24 */ u32 field_0x24;
/* 0x28 */ J3DAnmTransformKeyTable* mInfoTable;
};
@@ -197,7 +201,7 @@ public:
*/
class J2DAnmTransformFull : public J2DAnmTransform {
public:
J2DAnmTransformFull() : J2DAnmTransform(NULL, NULL, NULL) { mTableInfo = NULL; }
J2DAnmTransformFull() : J2DAnmTransform(0, NULL, NULL, NULL) { mTableInfo = NULL; }
virtual ~J2DAnmTransformFull() {}
virtual void getTransform(u16, J3DTransformInfo*) const;
@@ -214,21 +218,13 @@ class J2DAnmTextureSRTKey : public J2DAnmBase {
public:
J2DAnmTextureSRTKey() {
field_0x10 = 0;
field_0x1e = 0;
field_0x1c = 0;
field_0x1a = 0;
mUpdateMaterialNum = 0;
mUpdateMaterialNum = field_0x1a = field_0x1c = field_0x1e = 0;
mInfoTable = NULL;
mTranslationValues = NULL;
mScaleValues = NULL;
mScaleValues = mTranslationValues = NULL;
mRotationValues = NULL;
field_0x4c = 0;
field_0x4a = 0;
field_0x48 = 0;
field_0x4e = 0;
field_0x4e = field_0x48 = field_0x4a = field_0x4c = 0;
field_0x5c = NULL;
field_0x58 = NULL;
field_0x50 = NULL;
field_0x50 = field_0x58 = NULL;
field_0x54 = NULL;
field_0x7c = 0;
mKind = KIND_TEXTURE_SRT;
@@ -238,9 +234,15 @@ public:
virtual ~J2DAnmTextureSRTKey() {}
virtual void searchUpdateMaterialID(J2DScreen*);
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum / 3; }
u16 getUpdateMaterialID(u16 i) const { return mUpdateMaterialID[i]; }
u8 getUpdateTexMtxID(u16 i) const { return mUpdateTexMtxID[i]; }
void getTransform(u16 param_1, J3DTextureSRTInfo* param_2) {
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);
}
@@ -279,8 +281,13 @@ public:
class J2DAnmTexPattern : public J2DAnmBase {
public:
struct J2DAnmTexPatternTIMGPointer {
J2DAnmTexPatternTIMGPointer();
~J2DAnmTexPatternTIMGPointer();
J2DAnmTexPatternTIMGPointer() {
mRes = NULL;
mPalette = NULL;
}
~J2DAnmTexPatternTIMGPointer() {
delete mPalette;
}
/* 0x0 */ ResTIMG* mRes;
/* 0x4 */ JUTPalette* mPalette;
@@ -302,7 +309,10 @@ public:
virtual ~J2DAnmTexPattern() { delete[] mTIMGPtrArray; }
virtual void searchUpdateMaterialID(J2DScreen*);
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
u16 getUpdateMaterialID(u16 i) const { return mUpdateMaterialID[i]; }
u16 getUpdateMaterialID(u16 i) const {
J3D_PANIC(619, i < mUpdateMaterialNum, "Error : range over.");
return mUpdateMaterialID[i];
}
J3DAnmTexPatternFullTable* getAnmTable() const { return mAnmTable; }
/* 0x10 */ u16* mValues;
@@ -321,39 +331,31 @@ public:
class J2DAnmTevRegKey : public J2DAnmBase {
public:
J2DAnmTevRegKey() {
mKRegUpdateMaterialNum = 0;
mCRegUpdateMaterialNum = 0;
field_0x1a = 0;
field_0x18 = 0;
field_0x16 = 0;
field_0x14 = 0;
field_0x22 = 0;
field_0x20 = 0;
field_0x1e = 0;
field_0x1c = 0;
mKRegUpdateMaterialID = NULL;
mCRegUpdateMaterialID = NULL;
mCAValues = NULL;
mCBValues = NULL;
mCGValues = NULL;
mCRValues = NULL;
mKAValues = NULL;
mKBValues = NULL;
mKGValues = NULL;
mKRValues = NULL;
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;
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 { return mCRegUpdateMaterialID[i]; }
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 { return mKRegUpdateMaterialID[i]; }
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; }
@@ -391,10 +393,7 @@ public:
class J2DAnmColor : public J2DAnmBase {
public:
J2DAnmColor() {
field_0x16 = 0;
field_0x14 = 0;
field_0x12 = 0;
field_0x10 = 0;
field_0x10 = field_0x12 = field_0x14 = field_0x16 = 0;
mUpdateMaterialNum = 0;
mUpdateMaterialID = NULL;
mKind = KIND_COLOR;
@@ -403,7 +402,10 @@ public:
virtual void searchUpdateMaterialID(J2DScreen*);
virtual void getColor(u16, _GXColor*) const {}
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
u16 getUpdateMaterialID(u16 i) const { return mUpdateMaterialID[i]; }
u16 getUpdateMaterialID(u16 i) const {
J3D_PANIC(224, i < mUpdateMaterialNum, "Error : range over.");
return mUpdateMaterialID[i];
}
/* 0x10 */ u16 field_0x10;
/* 0x12 */ u16 field_0x12;
@@ -475,17 +477,12 @@ public:
/* 0x40 */ J3DAnmColorFullTable* mInfoTable;
};
template <typename T>
inline f32 J2DHermiteInterpolation(f32, T*, T*, T*, T*, T*, T*);
template <>
inline f32 J2DHermiteInterpolation<f32>(f32 f1, f32* f2, f32* f3, f32* f4, f32* f5, f32* f6,
f32* f7) {
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);
}
template <>
inline f32 J2DHermiteInterpolation<s16>(__REGISTER f32 pp1, __REGISTER s16* pp2, __REGISTER s16* pp3,
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__
@@ -49,6 +49,8 @@ public:
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;
+1 -1
View File
@@ -13,7 +13,7 @@ struct J2DResReference {
/* 0x00 */ u16 mCount;
/* 0x02 */ u16 mOffsets[1];
s8* getResReference(u16) const;
char* getResReference(u16) const;
char* getName(u16) const;
};
File diff suppressed because it is too large Load Diff
@@ -133,7 +133,7 @@ public:
J2DBlend newBlend(int) const;
u8 newDither(int) const;
u32 getMaterialMode(int idx) const {
u8 getMaterialMode(int idx) const {
return field_0x4[field_0x8[idx]].field_0x0;
}
+1
View File
@@ -22,6 +22,7 @@ public:
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) {
JGeometry::TBox2<f32> ortho(x, y, x + width, y + height);
setOrtho(ortho, far, near);
+1
View File
@@ -174,6 +174,7 @@ public:
void show() { mVisible = true; }
void hide() { mVisible = false; }
bool isInfluencedAlpha() const { return mIsInfluencedAlpha; }
bool isConnectParent() const { return mConnected; }
u64 getUserInfo() const { return mUserInfoTag; }
+4
View File
@@ -17,6 +17,7 @@ enum J2DMirror {
};
enum J2DBinding {
/* 0 */ J2DBind_None = 0,
/* 1 */ J2DBind_Bottom = (1 << 0),
/* 2 */ J2DBind_Top = (1 << 1),
/* 4 */ J2DBind_Right = (1 << 2),
@@ -189,6 +190,9 @@ public:
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*);
+8 -1
View File
@@ -103,6 +103,7 @@ public:
mInfo = info;
return *this;
}
void setIndTexOrderInfo(const J2DIndTexOrderInfo& info) { mInfo = info; }
void load(u8);
private:
@@ -147,6 +148,7 @@ public:
mIndTexMtxInfo = info;
return *this;
}
void setIndTexMtxInfo(const J2DIndTexMtxInfo& info) { mIndTexMtxInfo = info; }
void load(u8);
void load(u32);
void calc();
@@ -191,6 +193,7 @@ public:
mInfo = info;
return *this;
}
void setIndTexCoordScaleInfo(const J2DIndTexCoordScaleInfo& info) { mInfo = info; }
void load(u8);
private:
@@ -426,7 +429,7 @@ public:
}
void setTexSel(u8 param_0) {
field_0x7 = (field_0x7 & ~0x0c) | (param_0 * 4);
field_0x7 = (field_0x7 & ~0x0c) | (param_0 << 2);
}
void setRasSel(u8 param_0) {
@@ -632,6 +635,10 @@ public:
u8 getMatSrc() const { return mColorChan & 1; }
void operator=(const J2DColorChan& other) {
mColorChan = other.mColorChan;
}
private:
/* 0x0 */ u16 mColorChan;
};
+24 -10
View File
@@ -447,6 +447,14 @@ struct TVec2 {
y += other.y;
}
bool equals(const TVec2<T>& other) const {
bool result = false;
if (this->x == other.x && this->y == other.y) {
result = true;
}
return result;
}
bool isAbove(const TVec2<T>& other) const {
return (x >= other.x) && (y >= other.y) ? true : false;
}
@@ -463,6 +471,10 @@ struct TVec2 {
return TUtil<f32>::sqrt(squared());
}
bool operator==(const TVec2<T>& other) const {
return equals(other);
}
T x;
T y;
};
@@ -497,6 +509,18 @@ template<> struct TBox<TVec2<f32> > {
return isValid();
}
void absolute() {
if (this->isValid()) {
return;
}
TBox<TVec2<f32> > box(*this);
this->i.setMin(box.i);
this->i.setMin(box.f);
this->f.setMax(box.i);
this->f.setMax(box.f);
}
TVec2<f32> i, f;
};
@@ -509,16 +533,6 @@ struct TBox2 : public TBox<TVec2<T> > {
}
TBox2(f32 x0, f32 y0, f32 x1, f32 y1) { set(x0, y0, x1, y1); }
void absolute() {
if (!this->isValid()) {
TBox2<T> box(*this);
this->i.setMin(box.i);
this->i.setMin(box.f);
this->f.setMax(box.i);
this->f.setMax(box.f);
}
}
void set(const TBox<TVec2<T> >& other) { set(other.i, other.f); }
void set(const TVec2<f32>& i, const TVec2<f32>& f) { this->i.set(i), this->f.set(f); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { this->i.set(x0, y0); this->f.set(x1, y1); }
@@ -89,6 +89,10 @@ public:
return *this;
}
s32 read(bool& val) {
return read(&val, sizeof(bool));
}
s32 read(u8& val) {
return read(&val, sizeof(u8));
}