mirror of
https://github.com/zeldaret/tp
synced 2026-05-23 06:54:28 -04:00
some J3D/misc cleanup (#2628)
* some j3d cleanup * begin using uintptr_t * j3dgraphbase cleanup * j3dgraphanimator cleanup
This commit is contained in:
@@ -22251,9 +22251,9 @@ sMtxPtrTbl__21J3DShapeMtxConcatView = .sbss:0x804515B8; // type:object size:0x8
|
||||
sTexGenBlock__17J3DDifferedTexMtx = .sbss:0x804515C0; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sTexMtxObj__17J3DDifferedTexMtx = .sbss:0x804515C4; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInterruptFlag$903 = .sbss:0x804515C8; // type:object size:0x4 scope:local align:4 data:4byte
|
||||
sInitInterruptFlag = .sbss:0x804515CC; // type:object size:0x1 scope:local align:1 data:byte
|
||||
init$465 = .sbss:0x804515CC; // type:object size:0x1 scope:local align:1 data:byte
|
||||
sOldVcdVatCmd__8J3DShape = .sbss:0x804515D0; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
data_804515D4 = .sbss:0x804515D4; // type:object size:0x4 scope:local align:4 data:byte
|
||||
sEnvelopeFlag__8J3DShape = .sbss:0x804515D4; // type:object size:0x4 scope:local align:4 data:byte
|
||||
SizeOfJ3DColorBlockLightOffLoad = .sbss:0x804515D8; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
SizeOfJ3DColorBlockAmbientOnLoad = .sbss:0x804515DC; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
entryNum__13J3DDrawBuffer = .sbss:0x804515E0; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
@@ -26427,7 +26427,7 @@ j2dDefaultAlphaCmp = .sdata2:0x804561AE; // type:object size:0x2 scope:global al
|
||||
@1171 = .sdata2:0x804563B8; // type:object size:0x8 scope:local align:8 data:double
|
||||
j3dDefaultColInfo = .sdata2:0x804563C0; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
j3dDefaultAmbInfo = .sdata2:0x804563C4; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
data_804563C8 = .sdata2:0x804563C8; // type:object size:0x1 scope:global align:1 data:byte
|
||||
j3dDefaultNumChans = .sdata2:0x804563C8; // type:object size:0x1 scope:global align:1 data:byte
|
||||
j3dDefaultTevOrderInfoNull = .sdata2:0x804563CC; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
j3dDefaultIndTexOrderNull = .sdata2:0x804563D0; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
j3dDefaultTevColor = .sdata2:0x804563D4; // type:object size:0x8 scope:global align:4 data:4byte
|
||||
|
||||
@@ -56,10 +56,10 @@ class J2DAnmVtxColor : public J2DAnmBase {
|
||||
public:
|
||||
J2DAnmVtxColor() {
|
||||
mKind = KIND_VTX_COLOR;
|
||||
for (s32 i = 0; i < ARRAY_SIZE(mAnmTableNum); i++) {
|
||||
for (s32 i = 0; i < ARRAY_SIZEU(mAnmTableNum); i++) {
|
||||
mAnmTableNum[i] = NULL;
|
||||
}
|
||||
for (s32 i = 0; i < ARRAY_SIZE(mVtxColorIndexData); i++) {
|
||||
for (s32 i = 0; i < ARRAY_SIZEU(mVtxColorIndexData); i++) {
|
||||
mVtxColorIndexData[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ struct J3DTextureSRTInfo;
|
||||
class J2DAnmVtxColorKey : public J2DAnmVtxColor {
|
||||
public:
|
||||
J2DAnmVtxColorKey() {
|
||||
for (s32 i = 0; i < ARRAY_SIZE(mInfoTable); i++) {
|
||||
for (s32 i = 0; i < ARRAY_SIZEU(mInfoTable); i++) {
|
||||
mInfoTable[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
class J2DAnmVtxColorFull : public J2DAnmVtxColor {
|
||||
public:
|
||||
J2DAnmVtxColorFull() {
|
||||
for (s32 i = 0; i < ARRAY_SIZE(mInfoTable); i++) {
|
||||
for (s32 i = 0; i < ARRAY_SIZEU(mInfoTable); i++) {
|
||||
mInfoTable[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef J3DASSERT_H
|
||||
#define J3DASSERT_H
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
#define J3D_ASSERT_NULLPTR(LINE, COND) JUT_ASSERT_MSG(LINE, (COND) != 0, "Error : null pointer.")
|
||||
#define J3D_ASSERT_RANGE(LINE, COND) JUT_ASSERT_MSG(LINE, (COND) != 0, "Error : range over.")
|
||||
#define J3D_ASSERT_NONZEROARG(LINE, COND) JUT_ASSERT_MSG(LINE, (COND) != 0, "Error : non-zero argument is specified 0.")
|
||||
#define J3D_ASSERT_ALLOCMEM(LINE, COND) JUT_ASSERT_MSG(LINE, (COND) != 0, "Error : allocate memory.")
|
||||
|
||||
#endif /* J3DASSERT_H */
|
||||
@@ -476,10 +476,10 @@ public:
|
||||
mFrame = 0.0f;
|
||||
}
|
||||
|
||||
J3DAnmBase(s16 i_frameMax) {
|
||||
J3DAnmBase(s16 frameMax) {
|
||||
mAttribute = 0;
|
||||
field_0x5 = 0;
|
||||
mFrameMax = i_frameMax;
|
||||
mFrameMax = frameMax;
|
||||
mFrame = 0.0f;
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ public:
|
||||
/* 0x18 */ s16 field_0x18;
|
||||
/* 0x1A */ s16 field_0x1a;
|
||||
/* 0x1C */ u16 field_0x1c;
|
||||
/* 0x1E */ s16 field_0x1e;
|
||||
/* 0x1E */ u16 field_0x1e;
|
||||
}; // Size: 0x20
|
||||
|
||||
/**
|
||||
@@ -533,8 +533,8 @@ public:
|
||||
|
||||
/* 8003B8D0 */ virtual ~J3DAnmTransformKey() {}
|
||||
/* 8003C800 */ virtual s32 getKind() const { return 8; }
|
||||
/* 8003C808 */ virtual void getTransform(u16 param_0, J3DTransformInfo* param_1) const {
|
||||
calcTransform(mFrame, param_0, param_1);
|
||||
/* 8003C808 */ virtual void getTransform(u16 jointNo, J3DTransformInfo* pTransform) const {
|
||||
calcTransform(mFrame, jointNo, pTransform);
|
||||
}
|
||||
|
||||
/* 0x20 */ int mDecShift;
|
||||
@@ -585,25 +585,25 @@ public:
|
||||
/* 8032C198 */ virtual ~J3DAnmTextureSRTKey() {}
|
||||
/* 8032C220 */ virtual s32 getKind() const { return 4; }
|
||||
|
||||
void getTransform(u16 param_0, J3DTextureSRTInfo* pSRTInfo) const {
|
||||
calcTransform(getFrame(), param_0, pSRTInfo);
|
||||
void getTransform(u16 jointNo, J3DTextureSRTInfo* pSRTInfo) const {
|
||||
calcTransform(getFrame(), jointNo, pSRTInfo);
|
||||
}
|
||||
|
||||
u16 getUpdateMaterialID(u16 idx) const {
|
||||
J3D_ASSERT(1029, idx < mTrackNum / 3, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(1029, idx < mTrackNum / 3);
|
||||
return mUpdateMaterialID[idx];
|
||||
}
|
||||
u16 getUpdateMaterialNum() const { return mTrackNum / 3; }
|
||||
u16 getPostUpdateMaterialNum() const { return field_0x4a / 3; }
|
||||
|
||||
int getUpdateTexMtxID(u16 idx) const {
|
||||
J3D_ASSERT(1017, idx < mTrackNum / 3, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(1017, idx < mTrackNum / 3);
|
||||
return mUpdateTexMtxID[idx];
|
||||
}
|
||||
bool isValidUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx] != 0xffff; }
|
||||
u32 getTexMtxCalcType() { return mTexMtxCalcType; }
|
||||
Vec* getSRTCenter(u16 idx) {
|
||||
J3D_ASSERT(1047, idx < mTrackNum / 3, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(1047, idx < mTrackNum / 3);
|
||||
return &mSRTCenter[idx];
|
||||
}
|
||||
|
||||
@@ -650,7 +650,7 @@ public:
|
||||
/* 8032BD94 */ virtual s32 getKind() const { return 2; }
|
||||
|
||||
u16 getUpdateMaterialID(u16 idx) const {
|
||||
J3D_ASSERT(2288, idx < mUpdateMaterialNum, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(2288, idx < mUpdateMaterialNum);
|
||||
return mUpdateMaterialID[idx];
|
||||
}
|
||||
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
|
||||
@@ -684,19 +684,19 @@ public:
|
||||
u16 getKRegUpdateMaterialNum() const { return mKRegUpdateMaterialNum; }
|
||||
|
||||
u16 getCRegUpdateMaterialID(u16 idx) const {
|
||||
J3D_ASSERT(2100, idx < mCRegUpdateMaterialNum, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(2100, idx < mCRegUpdateMaterialNum);
|
||||
return mCRegUpdateMaterialID[idx];
|
||||
}
|
||||
u16 getKRegUpdateMaterialID(u16 idx) const {
|
||||
J3D_ASSERT(2140, idx < mKRegUpdateMaterialNum, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(2140, idx < mKRegUpdateMaterialNum);
|
||||
return mKRegUpdateMaterialID[idx];
|
||||
}
|
||||
|
||||
const J3DAnmCRegKeyTable* getAnmCRegKeyTable() const { return mAnmCRegKeyTable; }
|
||||
const J3DAnmKRegKeyTable* getAnmKRegKeyTable() const { return mAnmKRegKeyTable; }
|
||||
const J3DAnmCRegKeyTable* getAnmCRegKeyTable() { return mAnmCRegKeyTable; }
|
||||
const J3DAnmKRegKeyTable* getAnmKRegKeyTable() { return mAnmKRegKeyTable; }
|
||||
|
||||
bool isValidCRegUpdateMaterialID(u16 idx) { return mCRegUpdateMaterialID[idx] != 0xffff; }
|
||||
bool isValidKRegUpdateMaterialID(u16 idx) { return mKRegUpdateMaterialID[idx] != 0xffff; }
|
||||
bool isValidCRegUpdateMaterialID(u16 idx) const { return mCRegUpdateMaterialID[idx] != 0xffff; }
|
||||
bool isValidKRegUpdateMaterialID(u16 idx) const { return mKRegUpdateMaterialID[idx] != 0xffff; }
|
||||
|
||||
/* 0x0C */ u16 mCRegUpdateMaterialNum;
|
||||
/* 0x0E */ u16 mKRegUpdateMaterialNum;
|
||||
@@ -740,7 +740,7 @@ public:
|
||||
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
|
||||
bool isValidUpdateMaterialID(u16 id) const { return mUpdateMaterialID[id] != 0xFFFF; }
|
||||
u16 getUpdateMaterialID(u16 idx) const {
|
||||
J3D_ASSERT(1578, idx < mUpdateMaterialNum, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(1578, idx < mUpdateMaterialNum);
|
||||
return mUpdateMaterialID[idx];
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ public:
|
||||
*/
|
||||
class J3DAnmCluster : public J3DAnmBase {
|
||||
public:
|
||||
J3DAnmCluster(s16 param_1, f32* param_2) : J3DAnmBase(param_1) { mWeight = param_2; }
|
||||
J3DAnmCluster(s16 frameMax, f32* pWeight) : J3DAnmBase(frameMax) { mWeight = pWeight; }
|
||||
|
||||
/* 8032BCAC */ virtual ~J3DAnmCluster() {}
|
||||
/* 8032BF44 */ virtual s32 getKind() const { return 3; }
|
||||
@@ -866,7 +866,7 @@ public:
|
||||
*/
|
||||
class J3DAnmClusterFull : public J3DAnmCluster {
|
||||
public:
|
||||
J3DAnmClusterFull() : J3DAnmCluster(0, 0) { mAnmTable = NULL; }
|
||||
J3DAnmClusterFull() : J3DAnmCluster(0, NULL) { mAnmTable = NULL; }
|
||||
|
||||
/* 8032BCAC */ virtual ~J3DAnmClusterFull() {}
|
||||
/* 8032BF44 */ virtual s32 getKind() const { return 12; }
|
||||
@@ -965,10 +965,10 @@ public:
|
||||
}; // Size: 0x14
|
||||
|
||||
struct J3DMtxCalcAnmBase: public J3DMtxCalc {
|
||||
J3DMtxCalcAnmBase(J3DAnmTransform* param_0) { mAnmTransform = param_0; }
|
||||
J3DMtxCalcAnmBase(J3DAnmTransform* pAnmTransform) { mAnmTransform = pAnmTransform; }
|
||||
/* 8000D8EC */ ~J3DMtxCalcAnmBase() {}
|
||||
/* 80014FB8 */ J3DAnmTransform* getAnmTransform() { return mAnmTransform; }
|
||||
/* 80014FC0 */ void setAnmTransform(J3DAnmTransform* param_0) { mAnmTransform = param_0; }
|
||||
/* 80014FC0 */ void setAnmTransform(J3DAnmTransform* pAnmTransform) { mAnmTransform = pAnmTransform; }
|
||||
|
||||
J3DAnmTransform* mAnmTransform;
|
||||
};
|
||||
@@ -980,29 +980,33 @@ struct J3DMtxCalcAnimationAdaptorBase {
|
||||
|
||||
template <typename A0>
|
||||
struct J3DMtxCalcAnimationAdaptorDefault : public J3DMtxCalcAnimationAdaptorBase {
|
||||
J3DMtxCalcAnimationAdaptorDefault(J3DAnmTransform* param_0) {}
|
||||
void calc(J3DMtxCalcAnmBase* param_0) {
|
||||
J3DMtxCalcAnimationAdaptorDefault(J3DAnmTransform* pAnmTransform) {}
|
||||
|
||||
void calc(J3DMtxCalcAnmBase* pMtxCalc) {
|
||||
J3DTransformInfo transform;
|
||||
J3DTransformInfo* transform_p;
|
||||
if (param_0->getAnmTransform() != NULL) {
|
||||
if (pMtxCalc->getAnmTransform() != NULL) {
|
||||
u16 jnt_no = J3DMtxCalc::getJoint()->getJntNo();
|
||||
param_0->getAnmTransform()->getTransform(jnt_no, &transform);
|
||||
pMtxCalc->getAnmTransform()->getTransform(jnt_no, &transform);
|
||||
transform_p = &transform;
|
||||
} else {
|
||||
transform_p = &J3DMtxCalc::getJoint()->getTransformInfo();
|
||||
}
|
||||
|
||||
A0::calcTransform(*transform_p);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename A0, typename B0>
|
||||
struct J3DMtxCalcAnimation : public J3DMtxCalcAnmBase {
|
||||
J3DMtxCalcAnimation(J3DAnmTransform* param_0) : J3DMtxCalcAnmBase(param_0), field_0x8(param_0) {}
|
||||
J3DMtxCalcAnimation(J3DAnmTransform* pAnmTransform) : J3DMtxCalcAnmBase(pAnmTransform), field_0x8(pAnmTransform) {}
|
||||
~J3DMtxCalcAnimation() {}
|
||||
void setAnmTransform(J3DAnmTransform* param_0) {
|
||||
mAnmTransform = param_0;
|
||||
field_0x8.change(param_0);
|
||||
|
||||
void setAnmTransform(J3DAnmTransform* pAnmTransform) {
|
||||
mAnmTransform = pAnmTransform;
|
||||
field_0x8.change(pAnmTransform);
|
||||
}
|
||||
|
||||
void init(const Vec& param_0, const Mtx& param_1) { B0::init(param_0, param_1); }
|
||||
void calc() { field_0x8.calc(this); }
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef J3DCLUSTER_H
|
||||
#define J3DCLUSTER_H
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
|
||||
class J3DDeformer;
|
||||
class J3DClusterKey;
|
||||
@@ -81,13 +80,13 @@ public:
|
||||
/* 8032E364 */ void setAnm(J3DAnmCluster*);
|
||||
|
||||
J3DCluster* getClusterPointer(u16 index) {
|
||||
J3D_ASSERT(186, (index < mClusterNum), "Error : range over.");
|
||||
J3D_ASSERT_RANGE(186, (index < mClusterNum));
|
||||
return &mClusterPointer[index];
|
||||
}
|
||||
u16 getClusterNum() const { return mClusterNum; }
|
||||
u16 getClusterKeyNum() const { return mClusterKeyNum; }
|
||||
J3DClusterKey* getClusterKeyPointer(u16 i) {
|
||||
J3D_ASSERT(199, (i < mClusterKeyNum), "Error : range over.");
|
||||
J3D_ASSERT_RANGE(199, (i < mClusterKeyNum));
|
||||
return &mClusterKeyPointer[i];
|
||||
}
|
||||
f32* getVtxPos() { return mVtxPos; }
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DTransform.h"
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
|
||||
class J3DAnmTransform;
|
||||
class J3DJoint;
|
||||
@@ -29,7 +30,7 @@ public:
|
||||
|
||||
static J3DMtxBuffer* getMtxBuffer() { return mMtxBuffer; }
|
||||
static J3DJoint* getJoint() {
|
||||
J3D_ASSERT(185, mJoint != NULL, "Error : null pointer.")
|
||||
J3D_ASSERT_NULLPTR(185, mJoint != NULL)
|
||||
return mJoint;
|
||||
}
|
||||
static void setJoint(J3DJoint* joint) { mJoint = joint; }
|
||||
@@ -51,7 +52,17 @@ public:
|
||||
/* 8032F254 */ void entryIn();
|
||||
/* 8032F3F8 */ void recursiveCalc();
|
||||
|
||||
u32 getType() const { return 'NJNT'; }
|
||||
|
||||
J3DMaterial* getMesh() { return mMesh; }
|
||||
void addMesh(J3DMaterial* pMesh) {
|
||||
if (mMesh != NULL) {
|
||||
pMesh->setNext(mMesh);
|
||||
}
|
||||
|
||||
mMesh = pMesh;
|
||||
}
|
||||
|
||||
u16 getJntNo() const { return mJntNo; }
|
||||
u8 getScaleCompensate() const { return mScaleCompensate; }
|
||||
J3DJoint* getYounger() { return mYounger; }
|
||||
@@ -67,13 +78,13 @@ public:
|
||||
J3DMtxCalc* getMtxCalc() { return mMtxCalc; }
|
||||
J3DMtxCalc* getCurrentMtxCalc() { return mCurrentMtxCalc; };
|
||||
J3DJoint* getChild() { return mChild; }
|
||||
u8 getMtxType() { return (mKind & 0xf0) >> 4; }
|
||||
u8 getMtxType() const { return (mKind & 0xf0) >> 4; }
|
||||
void setMtxType(u8 type) { mKind = (mKind & ~0xf0) | (type << 4); }
|
||||
f32 getRadius() const { return mBoundingSphereRadius; }
|
||||
|
||||
static J3DMtxCalc* mCurrentMtxCalc;
|
||||
|
||||
inline u8 getKind() { return mKind & 15; }
|
||||
u8 getKind() { return mKind & 15; }
|
||||
|
||||
private:
|
||||
friend struct J3DJointFactory;
|
||||
|
||||
@@ -64,14 +64,14 @@ public:
|
||||
JUTNameTab* getJointName() const { return mJointName; }
|
||||
J3DJoint* getRootNode() { return mRootNode; }
|
||||
J3DJoint* getJointNodePointer(u16 idx) const {
|
||||
J3D_ASSERT(139, idx < mJointNum, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(139, idx < mJointNum);
|
||||
return mJointNodePointer[idx];
|
||||
}
|
||||
J3DMtxCalc* getBasicMtxCalc() const { return mBasicMtxCalc; }
|
||||
J3DMtxCalc* getBasicMtxCalc() { return mBasicMtxCalc; }
|
||||
Mtx& getInvJointMtx(int idx) { return mInvJointMtx[idx]; }
|
||||
u32 getModelDataType() const { return mModelDataType; }
|
||||
void setModelDataType(u32 type) { mModelDataType = type; }
|
||||
bool checkFlag(u32 flag) { return mFlags & flag; }
|
||||
bool checkFlag(u32 flag) const { return mFlags & flag ? true : false; }
|
||||
void setFlag(u32 flag) { mFlags = flag; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
|
||||
|
||||
typedef struct _GXColor GXColor;
|
||||
typedef struct _GXColorS10 GXColorS10;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
@@ -13,11 +10,14 @@ typedef struct _GXColorS10 GXColorS10;
|
||||
class J3DMatColorAnm {
|
||||
public:
|
||||
/* 8003B2B8 */ ~J3DMatColorAnm() {}
|
||||
|
||||
/* 8003B2F4 */ J3DMatColorAnm() : field_0x0(0), mAnmFlag(1), mAnmColor(NULL) {}
|
||||
J3DMatColorAnm(u16 param_1, J3DAnmColor* param_2) {
|
||||
|
||||
J3DMatColorAnm(u16 param_1, J3DAnmColor* pAnmColor) {
|
||||
field_0x0 = param_1;
|
||||
mAnmFlag = 1;
|
||||
mAnmColor = param_2;
|
||||
mAnmColor = pAnmColor;
|
||||
J3D_ASSERT_NULLPTR(56, pAnmColor != NULL);
|
||||
}
|
||||
|
||||
void operator=(J3DMatColorAnm const& other) {
|
||||
@@ -28,7 +28,11 @@ public:
|
||||
|
||||
void setAnmFlag(bool flag) { mAnmFlag = flag; }
|
||||
bool getAnmFlag() const { return mAnmFlag; }
|
||||
void calc(_GXColor* pColor) const { mAnmColor->getColor(field_0x0, pColor); }
|
||||
|
||||
void calc(GXColor* pColor) const {
|
||||
J3D_ASSERT_NULLPTR(507, pColor != NULL);
|
||||
mAnmColor->getColor(field_0x0, pColor);
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x0 */ u16 field_0x0;
|
||||
@@ -36,6 +40,43 @@ private:
|
||||
/* 0x4 */ J3DAnmColor* mAnmColor;
|
||||
}; // Size: 0x8
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DTexMtxAnm {
|
||||
public:
|
||||
/* 8003B264 */ ~J3DTexMtxAnm() {}
|
||||
/* 8003B2A0 */ J3DTexMtxAnm() : field_0x0(0), mAnmFlag(1), mAnmTransform(NULL) {}
|
||||
|
||||
J3DTexMtxAnm(u16 param_1, J3DAnmTextureSRTKey* pSRTKey) {
|
||||
field_0x0 = param_1;
|
||||
mAnmFlag = 1;
|
||||
mAnmTransform = pSRTKey;
|
||||
J3D_ASSERT_NULLPTR(134, pSRTKey != NULL);
|
||||
}
|
||||
|
||||
void operator=(J3DTexMtxAnm const& other) {
|
||||
mAnmTransform = other.mAnmTransform;
|
||||
field_0x0 = other.field_0x0;
|
||||
mAnmFlag = other.mAnmFlag;
|
||||
}
|
||||
|
||||
void setAnmFlag(bool flag) { mAnmFlag = flag; }
|
||||
|
||||
void calc(J3DTextureSRTInfo* pSRTInfo) const {
|
||||
J3D_ASSERT_NULLPTR(519, pSRTInfo != NULL);
|
||||
mAnmTransform->getTransform(field_0x0, pSRTInfo);
|
||||
}
|
||||
|
||||
bool getAnmFlag() const { return mAnmFlag; }
|
||||
|
||||
private:
|
||||
/* 0x0 */ u16 field_0x0;
|
||||
/* 0x2 */ u16 mAnmFlag;
|
||||
/* 0x4 */ J3DAnmTextureSRTKey* mAnmTransform;
|
||||
}; // Size: 0x8
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
@@ -44,11 +85,14 @@ class J3DTexNoAnm {
|
||||
public:
|
||||
/* 8003B1F8 */ ~J3DTexNoAnm() {}
|
||||
/* 8003B240 */ J3DTexNoAnm() : field_0x4(0), mAnmFlag(1), mAnmTexPattern(NULL) {}
|
||||
J3DTexNoAnm(u16 param_1, J3DAnmTexPattern* param_2) {
|
||||
|
||||
J3DTexNoAnm(u16 param_1, J3DAnmTexPattern* pAnmTexPattern) {
|
||||
field_0x4 = param_1;
|
||||
mAnmFlag = 1;
|
||||
mAnmTexPattern = param_2;
|
||||
mAnmTexPattern = pAnmTexPattern;
|
||||
J3D_ASSERT_NULLPTR(214, pAnmTexPattern != NULL);
|
||||
}
|
||||
|
||||
/* 8003C82C */ virtual void calc(u16* param_0) const { mAnmTexPattern->getTexNo(field_0x4, param_0); }
|
||||
|
||||
void operator=(J3DTexNoAnm const& other) {
|
||||
@@ -71,49 +115,19 @@ private:
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DTexMtxAnm {
|
||||
class J3DTevColorAnm {
|
||||
public:
|
||||
/* 8003B264 */ ~J3DTexMtxAnm() {}
|
||||
/* 8003B2A0 */ J3DTexMtxAnm() : field_0x0(0), mAnmFlag(1), mAnmTransform(NULL) {}
|
||||
J3DTexMtxAnm(u16 param_1, J3DAnmTextureSRTKey* param_2) {
|
||||
/* 8003B1A4 */ ~J3DTevColorAnm() {}
|
||||
/* 8003B1E0 */ J3DTevColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
|
||||
|
||||
J3DTevColorAnm(u16 param_1, J3DAnmTevRegKey* pTevRegKey) {
|
||||
field_0x0 = param_1;
|
||||
mAnmFlag = 1;
|
||||
mAnmTransform = param_2;
|
||||
mAnmTevReg = pTevRegKey;
|
||||
J3D_ASSERT_NULLPTR(293, pTevRegKey != NULL);
|
||||
}
|
||||
|
||||
void operator=(J3DTexMtxAnm const& other) {
|
||||
mAnmTransform = other.mAnmTransform;
|
||||
field_0x0 = other.field_0x0;
|
||||
mAnmFlag = other.mAnmFlag;
|
||||
}
|
||||
|
||||
void setAnmFlag(bool flag) { mAnmFlag = flag; }
|
||||
void calc(J3DTextureSRTInfo* pSRTInfo) const {
|
||||
mAnmTransform->getTransform(field_0x0, pSRTInfo);
|
||||
}
|
||||
bool getAnmFlag() const { return mAnmFlag; }
|
||||
|
||||
private:
|
||||
/* 0x0 */ u16 field_0x0;
|
||||
/* 0x2 */ u16 mAnmFlag;
|
||||
/* 0x4 */ J3DAnmTextureSRTKey* mAnmTransform;
|
||||
}; // Size: 0x8
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DTevKColorAnm {
|
||||
public:
|
||||
/* 8003B150 */ ~J3DTevKColorAnm() {}
|
||||
/* 8003B18C */ J3DTevKColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
|
||||
J3DTevKColorAnm(u16 param_1, J3DAnmTevRegKey* param_2) {
|
||||
field_0x0 = param_1;
|
||||
mAnmFlag = 1;
|
||||
mAnmTevReg = param_2;
|
||||
}
|
||||
|
||||
void operator=(J3DTevKColorAnm const& other) {
|
||||
void operator=(J3DTevColorAnm const& other) {
|
||||
mAnmTevReg = other.mAnmTevReg;
|
||||
field_0x0 = other.field_0x0;
|
||||
mAnmFlag = other.mAnmFlag;
|
||||
@@ -121,7 +135,11 @@ public:
|
||||
|
||||
void setAnmFlag(bool flag) { mAnmFlag = flag; }
|
||||
bool getAnmFlag() const { return mAnmFlag; }
|
||||
void calc(_GXColor* pColor) const { mAnmTevReg->getTevKonstReg(field_0x0, pColor); }
|
||||
|
||||
void calc(GXColorS10* pColor) const {
|
||||
J3D_ASSERT_NULLPTR(545, pColor != NULL);
|
||||
mAnmTevReg->getTevColorReg(field_0x0, pColor);
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x0 */ u16 field_0x0;
|
||||
@@ -133,17 +151,19 @@ private:
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DTevColorAnm {
|
||||
class J3DTevKColorAnm {
|
||||
public:
|
||||
/* 8003B1A4 */ ~J3DTevColorAnm() {}
|
||||
/* 8003B1E0 */ J3DTevColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
|
||||
J3DTevColorAnm(u16 param_1, J3DAnmTevRegKey* param_2) {
|
||||
/* 8003B150 */ ~J3DTevKColorAnm() {}
|
||||
/* 8003B18C */ J3DTevKColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
|
||||
|
||||
J3DTevKColorAnm(u16 param_1, J3DAnmTevRegKey* pTevRegKey) {
|
||||
field_0x0 = param_1;
|
||||
mAnmFlag = 1;
|
||||
mAnmTevReg = param_2;
|
||||
mAnmTevReg = pTevRegKey;
|
||||
J3D_ASSERT_NULLPTR(371, pTevRegKey != NULL);
|
||||
}
|
||||
|
||||
void operator=(J3DTevColorAnm const& other) {
|
||||
void operator=(J3DTevKColorAnm const& other) {
|
||||
mAnmTevReg = other.mAnmTevReg;
|
||||
field_0x0 = other.field_0x0;
|
||||
mAnmFlag = other.mAnmFlag;
|
||||
@@ -151,7 +171,11 @@ public:
|
||||
|
||||
void setAnmFlag(bool flag) { mAnmFlag = flag; }
|
||||
bool getAnmFlag() const { return mAnmFlag; }
|
||||
void calc(_GXColorS10* pColor) const { mAnmTevReg->getTevColorReg(field_0x0, pColor); }
|
||||
|
||||
void calc(GXColor* pColor) const {
|
||||
J3D_ASSERT_NULLPTR(558, pColor != NULL);
|
||||
mAnmTevReg->getTevKonstReg(field_0x0, pColor);
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x0 */ u16 field_0x0;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef J3DMATERIALATTACH_H
|
||||
#define J3DMATERIALATTACH_H
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
|
||||
class J3DMaterial;
|
||||
class J3DTexture;
|
||||
@@ -33,7 +32,7 @@ public:
|
||||
/* 8032F604 */ virtual ~J3DMaterialTable();
|
||||
|
||||
J3DMaterial* getMaterialNodePointer(u16 idx) const {
|
||||
J3D_ASSERT(92, idx < mMaterialNum, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(92, idx < mMaterialNum);
|
||||
return mMaterialNodePointer[idx];
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
#include "dolphin/types.h"
|
||||
|
||||
enum J3DMdlFlag {
|
||||
J3DMdlFlag_None = 0x0,
|
||||
/* 0x00001 */ J3DMdlFlag_Unk00001 = 0x1,
|
||||
/* 0x00002 */ J3DMdlFlag_Unk00002 = 0x2,
|
||||
/* 0x00004 */ J3DMdlFlag_SkinPosCpu = 0x4,
|
||||
/* 0x00008 */ J3DMdlFlag_SkinNrmCpu = 0x8,
|
||||
/* 0x00010 */ J3DMdlFlag_Unk00010 = 0x10,
|
||||
/* 0x20000 */ J3DMdlFlag_Unk20000 = 0x20000,
|
||||
/* 0x40000 */ J3DMdlFlag_Unk40000 = 0x40000,
|
||||
/* 0x80000 */ J3DMdlFlag_Unk80000 = 0x80000,
|
||||
J3DMdlFlag_None = 0x0,
|
||||
/* 0x00001 */ J3DMdlFlag_Unk1 = 0x1,
|
||||
/* 0x00002 */ J3DMdlFlag_UseDefaultJ3D = 0x2,
|
||||
/* 0x00004 */ J3DMdlFlag_SkinPosCpu = 0x4,
|
||||
/* 0x00008 */ J3DMdlFlag_SkinNrmCpu = 0x8,
|
||||
/* 0x00010 */ J3DMdlFlag_EnableLOD = 0x10,
|
||||
/* 0x20000 */ J3DMdlFlag_UseSharedDL = 0x20000,
|
||||
/* 0x40000 */ J3DMdlFlag_UseSingleDL = 0x40000,
|
||||
/* 0x80000 */ J3DMdlFlag_DifferedDLBuffer = 0x80000,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -45,9 +45,10 @@ public:
|
||||
J3DModel() {
|
||||
initialize();
|
||||
}
|
||||
J3DModel(J3DModelData* param_0, u32 param_1, u32 param_2) {
|
||||
|
||||
J3DModel(J3DModelData* pModelData, u32 mdlFlags, u32 mtxBufferFlag) {
|
||||
initialize();
|
||||
entryModelData(param_0, param_1, param_2);
|
||||
entryModelData(pModelData, mdlFlags, mtxBufferFlag);
|
||||
}
|
||||
|
||||
/* 80327100 */ void initialize();
|
||||
@@ -66,6 +67,8 @@ public:
|
||||
/* 803281B4 */ void calcBumpMtx();
|
||||
/* 803282B8 */ void calcBBoardMtx();
|
||||
/* 803282EC */ void prepareShapePackets();
|
||||
void ptrToIndex();
|
||||
void makeDL();
|
||||
|
||||
/* 80327CA4 */ virtual void update();
|
||||
/* 80327E4C */ virtual void entry();
|
||||
@@ -85,21 +88,22 @@ public:
|
||||
|
||||
Mtx& getBaseTRMtx() { return mBaseTransformMtx; }
|
||||
void setBaseTRMtx(Mtx m) { MTXCopy(m, mBaseTransformMtx); }
|
||||
u32 getMtxCalcMode() const { return mFlags & 0x03; }
|
||||
u32 getMtxCalcMode() { return mFlags & (J3DMdlFlag_Unk1 | J3DMdlFlag_UseDefaultJ3D); }
|
||||
J3DVertexBuffer* getVertexBuffer() { return (J3DVertexBuffer*)&mVertexBuffer; }
|
||||
J3DMatPacket* getMatPacket(u16 idx) const { return &mMatPacket[idx]; }
|
||||
J3DShapePacket* getShapePacket(u16 idx) const { return &mShapePacket[idx]; }
|
||||
J3DMtxBuffer* getMtxBuffer() const { return mMtxBuffer; }
|
||||
J3DMtxBuffer* getMtxBuffer() { return mMtxBuffer; }
|
||||
void setScaleFlag(int idx, u8 flag) { mMtxBuffer->setScaleFlag(idx, flag); }
|
||||
Mtx33* getBumpMtxPtr(int idx) const { return mMtxBuffer->getBumpMtxPtr(idx); }
|
||||
Mtx33* getNrmMtxPtr() const { return mMtxBuffer->getNrmMtxPtr(); }
|
||||
Mtx* getDrawMtxPtr() const { return mMtxBuffer->getDrawMtxPtr(); }
|
||||
Mtx33* getBumpMtxPtr(int idx) { return mMtxBuffer->getBumpMtxPtr(idx); }
|
||||
Mtx33* getNrmMtxPtr() { return mMtxBuffer->getNrmMtxPtr(); }
|
||||
Mtx* getDrawMtxPtr() { return mMtxBuffer->getDrawMtxPtr(); }
|
||||
void setBaseScale(const Vec& scale) { mBaseScale = scale; }
|
||||
void setUserArea(u32 area) { mUserArea = area; }
|
||||
u32 getUserArea() const { return mUserArea; }
|
||||
Vec* getBaseScale() { return &mBaseScale; }
|
||||
void setAnmMtx(int jointNo, Mtx m) { mMtxBuffer->setAnmMtx(jointNo, m); }
|
||||
MtxP getAnmMtx(int jointNo) { return mMtxBuffer->getAnmMtx(jointNo); }
|
||||
MtxP getWeightAnmMtx(int i) { return mMtxBuffer->getWeightAnmMtx(i); }
|
||||
J3DSkinDeform* getSkinDeform() { return mSkinDeform; }
|
||||
|
||||
/* 0x04 */ J3DModelData* mModelData;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "JSystem/J3DGraphBase/J3DVertex.h"
|
||||
|
||||
typedef struct _GXColor GXColor;
|
||||
class JUTNameTab;
|
||||
|
||||
/**
|
||||
@@ -68,7 +67,7 @@ public:
|
||||
bool checkFlag(u32 flag) const { return (mFlags & flag) ? true : false; }
|
||||
u32 getFlag() const { return mFlags; }
|
||||
void const* getRawData() const { return mpRawData; }
|
||||
u16 checkBumpFlag() const { return mbHasBumpArray; }
|
||||
bool checkBumpFlag() const { return mbHasBumpArray == 1; }
|
||||
void setBumpFlag(u32 flag) { mbHasBumpArray = flag; }
|
||||
bool checkBBoardFlag() const { return mbHasBillboard == 1; }
|
||||
bool isLocked() { return mMaterialTable.isLocked(); }
|
||||
|
||||
@@ -25,28 +25,28 @@ public:
|
||||
/* 80326D3C */ void calcNrmMtx();
|
||||
/* 80326EF0 */ void calcBBoardMtx();
|
||||
|
||||
MtxP getAnmMtx(int idx) const { return mpAnmMtx[idx]; }
|
||||
MtxP getAnmMtx(int idx) { return mpAnmMtx[idx]; }
|
||||
void setAnmMtx(int i, Mtx m) { MTXCopy(m, (MtxP)mpAnmMtx[i]); }
|
||||
MtxP getWeightAnmMtx(int idx) const { return mpWeightEvlpMtx[idx]; }
|
||||
MtxP getUserAnmMtx(int idx) const { return mpUserAnmMtx[idx]; }
|
||||
MtxP getWeightAnmMtx(int idx) { return mpWeightEvlpMtx[idx]; }
|
||||
MtxP getUserAnmMtx(int idx) { return mpUserAnmMtx[idx]; }
|
||||
|
||||
void setScaleFlag(int idx, u8 flag) { mpScaleFlagArr[idx] = flag; }
|
||||
u32* getCurrentViewNoPtr() { return &mCurrentViewNo; }
|
||||
u8* getScaleFlagArray() const { return mpScaleFlagArr; }
|
||||
u8 getScaleFlag(int idx) const { return mpScaleFlagArr[idx]; }
|
||||
u8 getEnvScaleFlag(int idx) const { return mpEvlpScaleFlagArr[idx]; }
|
||||
Mtx** getDrawMtxPtrPtr() const { return mpDrawMtxArr[1]; }
|
||||
Mtx* getDrawMtxPtr() const { return mpDrawMtxArr[1][mCurrentViewNo]; }
|
||||
Mtx* getDrawMtx(int idx) const { return &mpDrawMtxArr[1][mCurrentViewNo][idx]; }
|
||||
Mtx33** getNrmMtxPtrPtr() const { return mpNrmMtxArr[1]; }
|
||||
Mtx33* getNrmMtxPtr() const { return mpNrmMtxArr[1][mCurrentViewNo]; }
|
||||
Mtx33* getNrmMtx(u16 idx) const { return &mpNrmMtxArr[1][mCurrentViewNo][idx]; }
|
||||
Mtx** getDrawMtxPtrPtr() { return mpDrawMtxArr[1]; }
|
||||
Mtx* getDrawMtxPtr() { return mpDrawMtxArr[1][mCurrentViewNo]; }
|
||||
Mtx* getDrawMtx(int idx) { return &mpDrawMtxArr[1][mCurrentViewNo][idx]; }
|
||||
Mtx33** getNrmMtxPtrPtr() { return mpNrmMtxArr[1]; }
|
||||
Mtx33* getNrmMtxPtr() { return mpNrmMtxArr[1][mCurrentViewNo]; }
|
||||
Mtx33* getNrmMtx(int idx) { return &mpNrmMtxArr[1][mCurrentViewNo][idx]; }
|
||||
Mtx33*** getBumpMtxPtrPtr() const { return mpBumpMtxArr[1]; }
|
||||
Mtx33* getBumpMtxPtr(int idx) const { return mpBumpMtxArr[1][idx][mCurrentViewNo]; }
|
||||
Mtx33* getBumpMtxPtr(int idx) { return mpBumpMtxArr[1][idx][mCurrentViewNo]; }
|
||||
J3DJointTree* getJointTree() const { return mJointTree; }
|
||||
|
||||
void setNrmMtx(int idx, Mtx* mtx) {
|
||||
J3DPSMtx33CopyFrom34(*mtx, mpNrmMtxArr[1][mCurrentViewNo][idx]);
|
||||
void setNrmMtx(int idx, Mtx mtx) {
|
||||
J3DPSMtx33CopyFrom34(mtx, mpNrmMtxArr[1][mCurrentViewNo][idx]);
|
||||
}
|
||||
|
||||
void swapDrawMtx() {
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
static Mtx* sNoUseDrawMtxPtr;
|
||||
static Mtx33* sNoUseNrmMtxPtr;
|
||||
|
||||
private:
|
||||
/* 0x00 */ J3DJointTree* mJointTree;
|
||||
/* 0x04 */ u8* mpScaleFlagArr;
|
||||
/* 0x08 */ u8* mpEvlpScaleFlagArr;
|
||||
@@ -75,7 +74,7 @@ private:
|
||||
/* 0x14 */ Mtx** mpDrawMtxArr[2];
|
||||
/* 0x1C */ Mtx33** mpNrmMtxArr[2];
|
||||
/* 0x24 */ Mtx33*** mpBumpMtxArr[2];
|
||||
/* 0x2C */ u32 mFlags;
|
||||
/* 0x2C */ u32 mMtxNum;
|
||||
/* 0x30 */ u32 mCurrentViewNo;
|
||||
/* 0x34 */ Mtx* mpUserAnmMtx;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
u16 getShapeNum() const { return mShapeNum; }
|
||||
J3DShape* getShapeNodePointer(u16 idx) const {
|
||||
J3D_ASSERT(85, idx < mShapeNum, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(85, idx < mShapeNum);
|
||||
return mShapeNodePointer[idx];
|
||||
}
|
||||
|
||||
|
||||
@@ -53,14 +53,14 @@ public:
|
||||
Mtx3P getNrmMtx(int i) { return mNrmMtx[i]; }
|
||||
void onFlag(u32 flag) { mFlags |= flag; }
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
bool checkFlag(u32 flag) { return mFlags & flag; }
|
||||
bool checkFlag(u32 flag) { return mFlags & flag ? true : false; }
|
||||
|
||||
/* 8032E064 */ virtual void deform(J3DVertexBuffer*, J3DMtxBuffer*);
|
||||
/* 8032E1B0 */ virtual ~J3DSkinDeform();
|
||||
|
||||
static u16* sWorkArea_WEvlpMixMtx[1024];
|
||||
static f32* sWorkArea_WEvlpMixWeight[1024];
|
||||
static u16 sWorkArea_MtxReg[1024 + 4 /* padding */];
|
||||
static u16 sWorkArea_MtxReg[1024];
|
||||
|
||||
private:
|
||||
/* 0x04 */ u16* mPosData;
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
/* 8032EBCC */ void normalizeWeight(int, f32*);
|
||||
|
||||
void offFlag(u32 i_flag) { mFlags &= ~i_flag; }
|
||||
bool checkFlag(u32 i_flag) { return mFlags & i_flag; }
|
||||
bool checkFlag(u32 i_flag) { return mFlags & i_flag ? true : false; }
|
||||
void setAnmCluster(J3DAnmCluster* anm) { mAnmCluster = anm; }
|
||||
void normalize(f32* i_vec) { VECNormalize((Vec*)i_vec, (Vec*)i_vec); }
|
||||
|
||||
|
||||
@@ -33,8 +33,23 @@ class J3DDrawPacket;
|
||||
class J3DMatPacket;
|
||||
class J3DShapePacket;
|
||||
|
||||
typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*);
|
||||
typedef void (J3DDrawBuffer::*drawFunc)() const;
|
||||
enum J3DDrawBufDrawMode {
|
||||
J3DDrawBufDrawMode_Head,
|
||||
J3DDrawBufDrawMode_Tail,
|
||||
|
||||
J3DDrawBufDrawMode_MAX,
|
||||
};
|
||||
|
||||
enum J3DDrawBufSortMode {
|
||||
J3DDrawBufSortMode_Mat,
|
||||
J3DDrawBufSortMode_MatAnm,
|
||||
J3DDrawBufSortMode_Z,
|
||||
J3DDrawBufSortMode_Model,
|
||||
J3DDrawBufSortMode_Invalid,
|
||||
J3DDrawBufSortMode_Non,
|
||||
|
||||
J3DDrawBufSortMode_MAX,
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
@@ -42,24 +57,13 @@ typedef void (J3DDrawBuffer::*drawFunc)() const;
|
||||
*/
|
||||
class J3DDrawBuffer {
|
||||
public:
|
||||
enum EDrawType {
|
||||
DRAW_HEAD,
|
||||
DRAW_TAIL,
|
||||
};
|
||||
|
||||
enum ESortType {
|
||||
SORT_MAT,
|
||||
SORT_MAT_ANM,
|
||||
SORT_Z,
|
||||
SORT_MODEL,
|
||||
SORT_INVALID,
|
||||
SORT_NON,
|
||||
};
|
||||
typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*);
|
||||
typedef void (J3DDrawBuffer::*drawFunc)() const;
|
||||
|
||||
J3DDrawBuffer() { initialize(); }
|
||||
~J3DDrawBuffer();
|
||||
void initialize();
|
||||
J3DError allocBuffer(u32);
|
||||
int allocBuffer(u32);
|
||||
void frameInit();
|
||||
int entryMatSort(J3DMatPacket*);
|
||||
int entryMatAnmSort(J3DMatPacket*);
|
||||
@@ -72,18 +76,19 @@ public:
|
||||
void drawHead() const;
|
||||
void drawTail() const;
|
||||
|
||||
u32 getEntryTableSize() { return mBufSize; }
|
||||
u32 getEntryTableSize() { return mEntryTableSize; }
|
||||
int getSortMode() { return mSortMode; }
|
||||
|
||||
inline void calcZRatio();
|
||||
void setNonSort() { mSortType = 5; }
|
||||
void setZSort() { mSortType = 2; }
|
||||
void setNonSort() { mSortMode = J3DDrawBufSortMode_Non; }
|
||||
void setZSort() { mSortMode = J3DDrawBufSortMode_Z; }
|
||||
void setZMtx(MtxP mtx) { mpZMtx = mtx; }
|
||||
|
||||
public:
|
||||
/* 0x00 */ J3DPacket** mpBuf;
|
||||
/* 0x04 */ u32 mBufSize;
|
||||
/* 0x08 */ u32 mDrawType;
|
||||
/* 0x0C */ u32 mSortType;
|
||||
/* 0x00 */ J3DPacket** mpBuffer;
|
||||
/* 0x04 */ u32 mEntryTableSize;
|
||||
/* 0x08 */ u32 mDrawMode;
|
||||
/* 0x0C */ u32 mSortMode;
|
||||
/* 0x10 */ f32 mZNear;
|
||||
/* 0x14 */ f32 mZFar;
|
||||
/* 0x18 */ f32 mZRatio;
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef J3DFIFO_H
|
||||
#define J3DFIFO_H
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <dolphin/gd.h>
|
||||
|
||||
inline void J3DFifoLoadBPCmd(u32 regval) {
|
||||
GXCmd1u8(GX_LOAD_BP_REG);
|
||||
GXCmd1u32(regval);
|
||||
}
|
||||
|
||||
inline void J3DFifoWriteXFCmdHdr(u16 addr, u8 len) {
|
||||
GXCmd1u8(GX_LOAD_XF_REG);
|
||||
GXCmd1u16(len - 1);
|
||||
GXCmd1u16(addr);
|
||||
}
|
||||
|
||||
inline void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr) {
|
||||
GXWGFifo.u8 = cmd;
|
||||
GXWGFifo.u16 = indx;
|
||||
GXWGFifo.u16 = addr;
|
||||
}
|
||||
|
||||
inline void J3DFifoWriteCPCmd(u8 cmd, u32 param) {
|
||||
GXWGFifo.u8 = GX_LOAD_CP_REG;
|
||||
GXWGFifo.u8 = cmd;
|
||||
GXWGFifo.u32 = param;
|
||||
}
|
||||
|
||||
inline void J3DFifoLoadCPCmd(u8 reg, u32 value) {
|
||||
GXCmd1u8(GX_LOAD_CP_REG);
|
||||
GXCmd1u8(reg);
|
||||
GXCmd1u32(value);
|
||||
}
|
||||
|
||||
inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) {
|
||||
GXWGFifo.u8 = GX_LOAD_XF_REG;
|
||||
GXWGFifo.u16 = (len - 1);
|
||||
GXWGFifo.u16 = cmd;
|
||||
}
|
||||
|
||||
inline void J3DFifoLoadXFCmdHdr(u16 addr, u8 len) {
|
||||
GXCmd1u8(GX_LOAD_XF_REG);
|
||||
GXCmd1u16(len - 1);
|
||||
GXCmd1u16(addr);
|
||||
}
|
||||
|
||||
inline void J3DFifoLoadPosMtxIndx(u16 index, u32 addr) {
|
||||
GXCmd1u8(GX_LOAD_INDX_A);
|
||||
GXCmd1u16(index);
|
||||
GXCmd1u16(((sizeof(Vec) - 1) << 12) | (u16)(addr * 4));
|
||||
}
|
||||
|
||||
inline void J3DFifoLoadNrmMtxIndx3x3(u16 index, u32 addr) {
|
||||
GXCmd1u8(GX_LOAD_INDX_B);
|
||||
GXCmd1u16(index);
|
||||
GXCmd1u16(((9 - 1) << 12) | (u16)((addr * 3) + 0x400));
|
||||
}
|
||||
|
||||
void J3DFifoLoadPosMtxImm(f32 (*)[4], u32);
|
||||
void J3DFifoLoadNrmMtxImm(f32 (*)[4], u32);
|
||||
void J3DFifoLoadNrmMtxImm3x3(f32 (*)[3], u32);
|
||||
void J3DFifoLoadNrmMtxToTexMtx(f32 (*)[4], u32);
|
||||
void J3DFifoLoadNrmMtxToTexMtx3x3(f32 (*)[3], u32);
|
||||
void J3DFifoLoadTexCached(GXTexMapID, u32, GXTexCacheSize, u32, GXTexCacheSize);
|
||||
|
||||
#endif /* J3DFIFO_H */
|
||||
@@ -2,64 +2,62 @@
|
||||
#define J3DGD_H
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include "dolphin/gd/GDBase.h"
|
||||
#include <dolphin/gd.h>
|
||||
|
||||
inline void J3DGDWrite_u8(u8 param) {
|
||||
__GDWrite(param);
|
||||
inline void J3DGDWrite_u8(u8 data) {
|
||||
__GDWrite(data);
|
||||
}
|
||||
|
||||
inline void J3DGDWrite_u16(u16 param) {
|
||||
__GDWrite((param & 0xffff) >> 8);
|
||||
__GDWrite(param & 0xff);
|
||||
inline void J3DGDWrite_u16(u16 data) {
|
||||
__GDWrite((u8)((data >> 8)));
|
||||
__GDWrite((u8)((data >> 0) & 0xFF));
|
||||
}
|
||||
|
||||
inline void J3DGDWrite_u32(u32 param) {
|
||||
__GDWrite((param >> 24) & 0xff);
|
||||
__GDWrite((param >> 16) & 0xff);
|
||||
__GDWrite((param >> 8) & 0xff);
|
||||
__GDWrite(param & 0xff);
|
||||
inline void J3DGDWrite_u32(u32 data) {
|
||||
__GDWrite((u8)((data >> 24) & 0xFF));
|
||||
__GDWrite((u8)((data >> 16) & 0xFF));
|
||||
__GDWrite((u8)((data >> 8) & 0xFF));
|
||||
__GDWrite((u8)((data >> 0) & 0xFF));
|
||||
}
|
||||
|
||||
inline void J3DGDWrite_f32(f32 param) {
|
||||
u32 tmp = *(u32*)¶m;
|
||||
J3DGDWrite_u32(tmp);
|
||||
inline void J3DGDWrite_f32(f32 data) {
|
||||
union {
|
||||
f32 f;
|
||||
u32 u;
|
||||
} fid;
|
||||
fid.f = data;
|
||||
J3DGDWrite_u32(fid.u);
|
||||
}
|
||||
|
||||
inline void J3DGDWriteBPCmd(u32 cmd) {
|
||||
J3DGDWrite_u8(0x61);
|
||||
J3DGDWrite_u32(cmd);
|
||||
inline void J3DGDWriteBPCmd(u32 regval) {
|
||||
J3DGDWrite_u8(GX_LOAD_BP_REG);
|
||||
J3DGDWrite_u32(regval);
|
||||
}
|
||||
|
||||
inline void J3DFifoLoadBPCmd(u32 cmd) {
|
||||
GXWGFifo.u8 = 0x61;
|
||||
GXWGFifo.u32 = cmd;
|
||||
}
|
||||
|
||||
inline void J3DGDWriteXFCmd(u16 addr, u32 cmd) {
|
||||
J3DGDWrite_u8(0x10);
|
||||
inline void J3DGDWriteXFCmd(u16 addr, u32 val) {
|
||||
J3DGDWrite_u8(GX_LOAD_XF_REG);
|
||||
J3DGDWrite_u16(0);
|
||||
J3DGDWrite_u16(addr);
|
||||
J3DGDWrite_u32(cmd);
|
||||
J3DGDWrite_u32(val);
|
||||
}
|
||||
|
||||
inline void J3DGDWriteXFCmdHdr(u16 addr, u8 len) {
|
||||
J3DGDWrite_u8(0x10);
|
||||
J3DGDWrite_u8(GX_LOAD_XF_REG);
|
||||
J3DGDWrite_u16(len - 1);
|
||||
J3DGDWrite_u16(addr);
|
||||
}
|
||||
|
||||
inline void J3DFifoWriteXFCmdHdr(u16 addr, u8 len) {
|
||||
GXWGFifo.u8 = 0x10;
|
||||
GXWGFifo.u16 = len - 1;
|
||||
GXWGFifo.u16 = addr;
|
||||
inline void J3DGXCmd1f32ptr(f32* data) {
|
||||
GXCmd1u32(*(u32*)data);
|
||||
}
|
||||
|
||||
inline void J3DGXCmd1f32ptr(f32* value) {
|
||||
GXWGFifo.u32 = *(u32*)value;
|
||||
}
|
||||
|
||||
inline void J3DGXCmd1f32(f32 value) {
|
||||
GXWGFifo.u32 = *(u32*)&value;
|
||||
inline void J3DGXCmd1f32(f32 data) {
|
||||
union {
|
||||
f32 f;
|
||||
u32 u;
|
||||
} fid;
|
||||
fid.f = data;
|
||||
GXCmd1u32(fid.u);
|
||||
}
|
||||
|
||||
inline void J3DGDWriteCPCmd(u8 reg, u32 value) {
|
||||
@@ -96,18 +94,6 @@ void J3DGDSetTevKColor(GXTevKColorID, GXColor);
|
||||
void J3DGDSetTevColorS10(GXTevRegID, GXColorS10);
|
||||
void J3DGDSetFog(GXFogType, f32, f32, f32, f32, GXColor);
|
||||
void J3DGDSetFogRangeAdj(u8, u16, _GXFogAdjTable*);
|
||||
void J3DFifoLoadPosMtxImm(f32 (*)[4], u32);
|
||||
void J3DFifoLoadNrmMtxImm(f32 (*)[4], u32);
|
||||
void J3DFifoLoadNrmMtxImm3x3(f32 (*)[3], u32);
|
||||
void J3DFifoLoadNrmMtxToTexMtx(f32 (*)[4], u32);
|
||||
void J3DFifoLoadNrmMtxToTexMtx3x3(f32 (*)[3], u32);
|
||||
void J3DFifoLoadTexCached(GXTexMapID, u32, GXTexCacheSize, u32, GXTexCacheSize);
|
||||
|
||||
static inline void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr) {
|
||||
GXWGFifo.u8 = cmd;
|
||||
GXWGFifo.u16 = indx;
|
||||
GXWGFifo.u16 = addr;
|
||||
}
|
||||
|
||||
inline void J3DGDSetNumChans(u8 numChans) {
|
||||
J3DGDWriteXFCmd(0x1009, numChans);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
|
||||
#include "JSystem/J3DGraphBase/J3DPacket.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShape.h"
|
||||
#include "dolphin/types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
class J3DJoint;
|
||||
class J3DMaterialAnm;
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
J3DIndBlock* getIndBlock() { return mIndBlock; }
|
||||
J3DJoint* getJoint() { return mJoint; }
|
||||
J3DMaterialAnm* getMaterialAnm() {
|
||||
if ((u32)mMaterialAnm < 0xC0000000) {
|
||||
if ((uintptr_t)mMaterialAnm < 0xC0000000) {
|
||||
return mMaterialAnm;
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -89,6 +89,21 @@ public:
|
||||
void setZCompLoc(u8 i_comploc) { mPEBlock->setZCompLoc(i_comploc); }
|
||||
void setMaterialMode(u32 i_mode) { mMaterialMode = i_mode; }
|
||||
|
||||
void addShape(J3DShape* pShape) {
|
||||
J3D_ASSERT_NULLPTR(618, pShape != NULL);
|
||||
mShape = pShape;
|
||||
}
|
||||
|
||||
void setNext(J3DMaterial* pMaterial) {
|
||||
J3D_ASSERT_NULLPTR(623, pMaterial != NULL);
|
||||
mNext = pMaterial;
|
||||
}
|
||||
|
||||
void setJoint(J3DJoint* pJoint) {
|
||||
J3D_ASSERT_NULLPTR(628, pJoint != NULL);
|
||||
mJoint = pJoint;
|
||||
}
|
||||
|
||||
public:
|
||||
/* 0x04 */ J3DMaterial* mNext;
|
||||
/* 0x08 */ J3DShape* mShape;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "dolphin/gd/GDBase.h"
|
||||
#include <stdint.h>
|
||||
|
||||
class J3DMatPacket;
|
||||
|
||||
@@ -16,27 +17,42 @@ class J3DTexMtx;
|
||||
class J3DTexMtxObj;
|
||||
class J3DTexture;
|
||||
|
||||
inline u32 getDiffFlag_LightObjNum(u32 param_1) {
|
||||
return (param_1 & 0xf0) >> 4;
|
||||
enum J3DDiffFlag {
|
||||
J3DDiffFlag_MatColor = 0x1,
|
||||
J3DDiffFlag_ColorChan = 0x2,
|
||||
J3DDiffFlag_AmbColor = 0x4,
|
||||
J3DDiffFlag_TexGen = 0x1000,
|
||||
J3DDiffFlag_TevReg = 0x1000000,
|
||||
J3DDiffFlag_KonstColor = 0x2000000, // is this right?
|
||||
J3DDiffFlag_TexCoordScale = 0x4000000,
|
||||
J3DDiffFlag_TevStageIndirect = 0x8000000,
|
||||
J3DDiffFlag_Fog = 0x10000000,
|
||||
J3DDiffFlag_Blend = 0x20000000,
|
||||
J3DDiffFlag_Unk40000000 = 0x40000000,
|
||||
J3DDiffFlag_Changed = 0x80000000,
|
||||
};
|
||||
|
||||
inline u32 getDiffFlag_LightObjNum(u32 diffFlags) {
|
||||
return (diffFlags & 0xf0) >> 4;
|
||||
}
|
||||
|
||||
inline u32 getDiffFlag_TexGenNum(u32 param_1) {
|
||||
return (param_1 & 0xf00) >> 8;
|
||||
inline u32 getDiffFlag_TexGenNum(u32 diffFlags) {
|
||||
return (diffFlags & 0xf00) >> 8;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TexMtxSize(int param_1) {
|
||||
inline int calcDifferedBufferSize_TexMtxSize(u32 param_1) {
|
||||
return param_1 * 0x35;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TexGenSize(int param_1) {
|
||||
inline int calcDifferedBufferSize_TexGenSize(u32 param_1) {
|
||||
return param_1 * 0x3d + 10;
|
||||
}
|
||||
|
||||
inline u32 getDiffFlag_TexNoNum(u32 param_1) {
|
||||
return (param_1 & 0xf0000) >> 0x10;
|
||||
inline u32 getDiffFlag_TexNoNum(u32 diffFlags) {
|
||||
return (diffFlags & 0xf0000) >> 0x10;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TexNoSize(int param_1) {
|
||||
inline int calcDifferedBufferSize_TexNoSize(u32 param_1) {
|
||||
return param_1 * 0x37;
|
||||
}
|
||||
|
||||
@@ -46,15 +62,15 @@ inline u32 calcDifferedBufferSize_TexNoAndTexCoordScaleSize(u32 param_1) {
|
||||
return res;
|
||||
}
|
||||
|
||||
inline u32 getDiffFlag_TevStageNum(u32 param_1) {
|
||||
return (param_1 & 0xf00000) >> 0x14;
|
||||
inline u32 getDiffFlag_TevStageNum(u32 diffFlags) {
|
||||
return (diffFlags & 0xf00000) >> 0x14;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TevStageSize(int param_1) {
|
||||
inline int calcDifferedBufferSize_TevStageSize(u32 param_1) {
|
||||
return param_1 * 10;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TevStageDirectSize(int param_1) {
|
||||
inline int calcDifferedBufferSize_TevStageDirectSize(u32 param_1) {
|
||||
return param_1 * 5;
|
||||
}
|
||||
|
||||
@@ -65,15 +81,15 @@ inline int calcDifferedBufferSize_TevStageDirectSize(int param_1) {
|
||||
class J3DDisplayListObj {
|
||||
public:
|
||||
J3DDisplayListObj() {
|
||||
mpData[0] = NULL;
|
||||
mpData[1] = NULL;
|
||||
mpDisplayList[0] = NULL;
|
||||
mpDisplayList[1] = NULL;
|
||||
mSize = 0;
|
||||
mCapacity = 0;
|
||||
mMaxSize = 0;
|
||||
}
|
||||
|
||||
J3DError newDisplayList(u32);
|
||||
J3DError newSingleDisplayList(u32);
|
||||
J3DError single_To_Double();
|
||||
int single_To_Double();
|
||||
void setSingleDisplayList(void*, u32);
|
||||
void swapBuffer();
|
||||
void callDL() const;
|
||||
@@ -82,15 +98,15 @@ public:
|
||||
void beginPatch();
|
||||
u32 endPatch();
|
||||
|
||||
u8* getDisplayList(int idx) const { return (u8*)mpData[idx]; }
|
||||
u32 getDisplayListSize() const { return mSize; }
|
||||
u8* getDisplayList(int idx) { return (u8*)mpDisplayList[idx]; }
|
||||
u32 getDisplayListSize() { return mSize; }
|
||||
|
||||
static GDLObj sGDLObj;
|
||||
static s32 sInterruptFlag;
|
||||
|
||||
/* 0x0 */ void* mpData[2];
|
||||
/* 0x0 */ void* mpDisplayList[2];
|
||||
/* 0x8 */ u32 mSize;
|
||||
/* 0xC */ u32 mCapacity;
|
||||
/* 0xC */ u32 mMaxSize;
|
||||
}; // Size: 0x10
|
||||
|
||||
/**
|
||||
@@ -102,7 +118,7 @@ public:
|
||||
J3DPacket() {
|
||||
mpNextPacket = NULL;
|
||||
mpFirstChild = NULL;
|
||||
mpUserData = NULL;
|
||||
mpUserArea = NULL;
|
||||
}
|
||||
|
||||
void addChildPacket(J3DPacket*);
|
||||
@@ -115,8 +131,8 @@ public:
|
||||
mpFirstChild = NULL;
|
||||
}
|
||||
|
||||
void* getUserArea() { return mpUserData; }
|
||||
void setUserArea(u32 area) { mpUserData = (void*)area; }
|
||||
void* getUserArea() const { return mpUserArea; }
|
||||
void setUserArea(uintptr_t area) { mpUserArea = (void*)area; }
|
||||
|
||||
virtual int entry(J3DDrawBuffer*);
|
||||
virtual void draw();
|
||||
@@ -125,7 +141,7 @@ public:
|
||||
public:
|
||||
/* 0x04 */ J3DPacket* mpNextPacket;
|
||||
/* 0x08 */ J3DPacket* mpFirstChild;
|
||||
/* 0x0C */ void* mpUserData;
|
||||
/* 0x0C */ void* mpUserArea;
|
||||
}; // Size: 0x10
|
||||
|
||||
/**
|
||||
@@ -140,29 +156,34 @@ public:
|
||||
J3DError newSingleDisplayList(u32);
|
||||
virtual void draw();
|
||||
|
||||
J3DDisplayListObj* getDisplayListObj() const { return mpDisplayListObj; }
|
||||
J3DDisplayListObj* getDisplayListObj() { return mpDisplayListObj; }
|
||||
void setDisplayListObj(J3DDisplayListObj* pObj) { mpDisplayListObj = pObj; }
|
||||
|
||||
void beginPatch() { mpDisplayListObj->beginPatch(); }
|
||||
void endPatch() { mpDisplayListObj->endPatch(); }
|
||||
|
||||
void callDL() const { getDisplayListObj()->callDL(); }
|
||||
void callDL() const { mpDisplayListObj->callDL(); }
|
||||
void beginDL() { mpDisplayListObj->beginDL(); }
|
||||
void endDL() { mpDisplayListObj->endDL(); }
|
||||
|
||||
void* getDisplayList(int i) { return mpDisplayListObj->mpDisplayList[i]; }
|
||||
u32 getDisplayListSize() const { return mpDisplayListObj->mSize; }
|
||||
|
||||
enum {
|
||||
LOCKED = 0x01,
|
||||
};
|
||||
|
||||
bool checkFlag(u32 flag) const { return (mFlags & flag) != 0; }
|
||||
bool checkFlag(u32 flag) const { return (mFlags & flag) ? true : false; }
|
||||
void onFlag(u32 flag) { mFlags |= flag; }
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
void lock() { onFlag(LOCKED); }
|
||||
void unlock() { offFlag(LOCKED); }
|
||||
J3DTexMtxObj* getTexMtxObj() const { return mpTexMtxObj; }
|
||||
J3DTexMtxObj* getTexMtxObj() { return mpTexMtxObj; }
|
||||
bool isLocked() const { return checkFlag(1); }
|
||||
|
||||
public:
|
||||
/* 0x10 */ u32 mFlags;
|
||||
/* 0x14 */ char mPad0[0x0C]; // unk
|
||||
/* 0x14 */ char unk_0x14[0x20 - 0x14];
|
||||
/* 0x20 */ J3DDisplayListObj* mpDisplayListObj;
|
||||
/* 0x24 */ J3DTexMtxObj* mpTexMtxObj;
|
||||
}; // Size: 0x28
|
||||
@@ -175,15 +196,23 @@ class J3DShapePacket : public J3DDrawPacket {
|
||||
public:
|
||||
J3DShapePacket();
|
||||
u32 calcDifferedBufferSize(u32);
|
||||
J3DError newDifferedDisplayList(u32);
|
||||
int newDifferedDisplayList(u32);
|
||||
void prepareDraw() const;
|
||||
void drawFast();
|
||||
|
||||
virtual ~J3DShapePacket();
|
||||
virtual void draw();
|
||||
|
||||
void setShape(J3DShape* pShape) { mpShape = pShape; }
|
||||
void setModel(J3DModel* pModel) { mpModel = pModel; }
|
||||
void setShape(J3DShape* pShape) {
|
||||
J3D_ASSERT_NULLPTR(523, pShape != NULL);
|
||||
mpShape = pShape;
|
||||
}
|
||||
|
||||
void setModel(J3DModel* pModel) {
|
||||
J3D_ASSERT_NULLPTR(533, pModel != NULL);
|
||||
mpModel = pModel;
|
||||
}
|
||||
|
||||
void setMtxBuffer(J3DMtxBuffer* pMtxBuffer) { mpMtxBuffer = pMtxBuffer; }
|
||||
void setBaseMtxPtr(Mtx* pMtx) { mpBaseMtxPtr = pMtx; }
|
||||
|
||||
@@ -214,13 +243,22 @@ 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 setMaterial(J3DMaterial* pMaterial) {
|
||||
J3D_ASSERT_NULLPTR(646, pMaterial != NULL);
|
||||
mpMaterial = pMaterial;
|
||||
}
|
||||
|
||||
void setTexture(J3DTexture* pTexture) {
|
||||
J3D_ASSERT_NULLPTR(651, pTexture != NULL);
|
||||
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; }
|
||||
BOOL isChanged() { return mDiffFlag & J3DDiffFlag_Changed; }
|
||||
bool isEnabled_Diff() { return mpInitShapePacket->getDisplayListObj() != NULL; }
|
||||
|
||||
virtual ~J3DMatPacket();
|
||||
virtual int entry(J3DDrawBuffer*);
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define J3DSHAPE_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/gx.h"
|
||||
#include "mtx.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
#include "JSystem/J3DGraphBase/J3DFifo.h"
|
||||
#include <dolphin/mtx.h>
|
||||
|
||||
class J3DShapeMtx;
|
||||
|
||||
@@ -18,18 +18,6 @@ public:
|
||||
u32 mMtxIdxRegB;
|
||||
};
|
||||
|
||||
static inline void J3DFifoWriteCPCmd(u8 cmd, u32 param) {
|
||||
GXWGFifo.u8 = GX_LOAD_CP_REG;
|
||||
GXWGFifo.u8 = cmd;
|
||||
GXWGFifo.u32 = param;
|
||||
}
|
||||
|
||||
static inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) {
|
||||
GXWGFifo.u8 = GX_LOAD_XF_REG;
|
||||
GXWGFifo.u16 = (len - 1);
|
||||
GXWGFifo.u16 = cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
@@ -50,10 +38,10 @@ public:
|
||||
u32 getMtxIdxRegA() const { return mMtxIdxRegA; }
|
||||
u32 getMtxIdxRegB() const { return mMtxIdxRegB; }
|
||||
|
||||
inline void load() const {
|
||||
J3DFifoWriteCPCmd(0x30, mMtxIdxRegA); // CP_MATINDEX_A
|
||||
J3DFifoWriteCPCmd(0x40, mMtxIdxRegB); // CP_MATINDEX_B
|
||||
J3DFifoWriteXFCmd(0x1018, 2);
|
||||
void load() const {
|
||||
J3DFifoLoadCPCmd(CP_REG_MTXIDXA_ID, mMtxIdxRegA);
|
||||
J3DFifoLoadCPCmd(CP_REG_MTXIDXB_ID, mMtxIdxRegB);
|
||||
J3DFifoLoadXFCmdHdr(GX_XF_REG_MATRIXINDEX0, 2);
|
||||
GXCmd1u32(mMtxIdxRegA);
|
||||
GXCmd1u32(mMtxIdxRegB);
|
||||
}
|
||||
@@ -65,110 +53,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class J3DMaterial;
|
||||
class J3DVertexData;
|
||||
class J3DDrawMtxData;
|
||||
|
||||
enum J3DShpFlag {
|
||||
J3DShpFlag_Visible = 0x0001,
|
||||
J3DShpFlag_SkinPosCpu = 0x0004,
|
||||
J3DShpFlag_SkinNrmCpu = 0x0008,
|
||||
J3DShpFlag_Hidden = 0x0010,
|
||||
J3DShpFlag_EnableLod = 0x0100,
|
||||
J3DShpFlag_NoMtx = 0x0200,
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DShape {
|
||||
public:
|
||||
J3DShape() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
enum {
|
||||
kVcdVatDLSize = 0xC0,
|
||||
};
|
||||
|
||||
/* 80314B48 */ void initialize();
|
||||
/* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32);
|
||||
/* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr);
|
||||
/* 80314DA8 */ void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
|
||||
/* 80314E28 */ u16 countBumpMtxNum() const;
|
||||
/* 80314EEC */ void loadVtxArray() const;
|
||||
/* 80314F5C */ bool isSameVcdVatCmd(J3DShape*);
|
||||
/* 80314F98 */ void makeVtxArrayCmd();
|
||||
/* 80315260 */ void makeVcdVatCmd();
|
||||
/* 80315300 */ void loadPreDrawSetting() const;
|
||||
/* 80315398 */ void setArrayAndBindPipeline() const;
|
||||
|
||||
/* 803155E0 */ virtual void draw() const;
|
||||
/* 8031544C */ virtual void drawFast() const;
|
||||
/* 80315628 */ virtual void simpleDraw() const;
|
||||
/* 803156AC */ virtual void simpleDrawCache() const;
|
||||
|
||||
void onFlag(u32 flag) { mFlags |= flag; }
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
bool checkFlag(u32 flag) const { return !!(mFlags & flag); }
|
||||
void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) { mDrawMtxData = pMtxData; }
|
||||
void setVertexDataPointer(J3DVertexData* pVtxData) { mVertexData = pVtxData; }
|
||||
void* getVcdVatCmd() { return mVcdVatCmd; }
|
||||
void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; }
|
||||
void show() { offFlag(J3DShpFlag_Visible); }
|
||||
void hide() { onFlag(J3DShpFlag_Visible); }
|
||||
void setCurrentViewNoPtr(u32* pViewNoPtr) { mCurrentViewNo = pViewNoPtr; }
|
||||
void setCurrentMtx(J3DCurrentMtx& mtx) { mCurrentMtx = mtx; }
|
||||
void setScaleFlagArray(u8* pScaleFlagArray) { mScaleFlagArray = pScaleFlagArray; }
|
||||
void setDrawMtx(Mtx** pDrawMtx) { mDrawMtx = pDrawMtx; }
|
||||
void setNrmMtx(Mtx33** pNrmMtx) { mNrmMtx = pNrmMtx; }
|
||||
void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; }
|
||||
bool getNBTFlag() const { return mHasNBT; }
|
||||
u32 getBumpMtxOffset() const { return mBumpMtxOffset; }
|
||||
void setBumpMtxOffset(u32 offset) { mBumpMtxOffset = offset; }
|
||||
GXVtxDescList* getVtxDesc() { return mVtxDesc; }
|
||||
|
||||
J3DMaterial* getMaterial() const { return mMaterial; }
|
||||
u16 getIndex() const { return mIndex; }
|
||||
u32 getTexMtxLoadType() const { return mFlags & 0xF000; }
|
||||
u32 getMtxGroupNum() const { return mMtxGroupNum; }
|
||||
J3DShapeDraw* getShapeDraw(u16 idx) { return mShapeDraw[idx]; }
|
||||
J3DShapeMtx* getShapeMtx(u16 idx) { return mShapeMtx[idx]; }
|
||||
Vec* getMin() { return &mMin; }
|
||||
Vec* getMax() { return &mMax; }
|
||||
|
||||
static void resetVcdVatCache() { sOldVcdVatCmd = NULL; }
|
||||
|
||||
static void* sOldVcdVatCmd;
|
||||
|
||||
private:
|
||||
friend struct J3DShapeFactory;
|
||||
friend class J3DJointTree;
|
||||
|
||||
/* 0x04 */ J3DMaterial* mMaterial;
|
||||
/* 0x08 */ u16 mIndex;
|
||||
/* 0x0A */ u16 mMtxGroupNum;
|
||||
/* 0x0C */ u32 mFlags;
|
||||
/* 0x10 */ f32 mRadius;
|
||||
/* 0x14 */ Vec mMin;
|
||||
/* 0x20 */ Vec mMax;
|
||||
/* 0x2C */ u8* mVcdVatCmd;
|
||||
/* 0x30 */ GXVtxDescList* mVtxDesc;
|
||||
/* 0x34 */ bool mHasNBT;
|
||||
/* 0x38 */ J3DShapeMtx** mShapeMtx;
|
||||
/* 0x3C */ J3DShapeDraw** mShapeDraw;
|
||||
/* 0x40 */ J3DCurrentMtx mCurrentMtx;
|
||||
/* 0x48 */ bool mHasPNMTXIdx;
|
||||
/* 0x4C */ J3DVertexData* mVertexData;
|
||||
/* 0x50 */ J3DDrawMtxData* mDrawMtxData;
|
||||
/* 0x54 */ u8* mScaleFlagArray;
|
||||
/* 0x58 */ Mtx** mDrawMtx;
|
||||
/* 0x5C */ Mtx33** mNrmMtx;
|
||||
/* 0x60 */ u32* mCurrentViewNo;
|
||||
/* 0x64 */ u32 mBumpMtxOffset;
|
||||
};
|
||||
|
||||
typedef void (J3DShapeMtx::*J3DShapeMtx_LoadFunc)(int, u16) const;
|
||||
|
||||
/**
|
||||
@@ -197,15 +81,16 @@ public:
|
||||
static u16 sMtxLoadCache[10];
|
||||
static u32 sCurrentPipeline;
|
||||
static u8* sCurrentScaleFlag;
|
||||
static u8 sNBTFlag;
|
||||
static u8 sLODFlag;
|
||||
static bool sNBTFlag;
|
||||
static bool sLODFlag;
|
||||
static u32 sTexMtxLoadType;
|
||||
|
||||
static void setCurrentPipeline(u32 pipeline) {
|
||||
J3D_ASSERT(91, pipeline < 4, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(91, pipeline < 4);
|
||||
sCurrentPipeline = pipeline;
|
||||
}
|
||||
static void setLODFlag(u8 flag) { sLODFlag = flag; }
|
||||
|
||||
static void setLODFlag(bool flag) { sLODFlag = flag; }
|
||||
static u32 getLODFlag() { return sLODFlag; }
|
||||
static void resetMtxLoadCache();
|
||||
|
||||
@@ -213,4 +98,133 @@ protected:
|
||||
/* 0x04 */ u16 mUseMtxIndex;
|
||||
};
|
||||
|
||||
class J3DMaterial;
|
||||
class J3DVertexData;
|
||||
class J3DDrawMtxData;
|
||||
|
||||
enum J3DShpFlag {
|
||||
J3DShpFlag_Visible = 0x0001,
|
||||
J3DShpFlag_SkinPosCpu = 0x0004,
|
||||
J3DShpFlag_SkinNrmCpu = 0x0008,
|
||||
J3DShpFlag_Hidden = 0x0010,
|
||||
J3DShpFlag_EnableLod = 0x0100,
|
||||
J3DShpFlag_NoMtx = 0x0200,
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DShape {
|
||||
public:
|
||||
J3DShape() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
static const int kVcdVatDLSize = 0xC0;
|
||||
|
||||
/* 80314B48 */ void initialize();
|
||||
/* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32);
|
||||
/* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr);
|
||||
/* 80314DA8 */ void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
|
||||
/* 80314E28 */ u16 countBumpMtxNum() const;
|
||||
/* 80314EEC */ void loadVtxArray() const;
|
||||
/* 80314F5C */ bool isSameVcdVatCmd(J3DShape*);
|
||||
/* 80314F98 */ void makeVtxArrayCmd();
|
||||
/* 80315260 */ void makeVcdVatCmd();
|
||||
/* 80315300 */ void loadPreDrawSetting() const;
|
||||
/* 80315398 */ void setArrayAndBindPipeline() const;
|
||||
|
||||
/* 803155E0 */ virtual void draw() const;
|
||||
/* 8031544C */ virtual void drawFast() const;
|
||||
/* 80315628 */ virtual void simpleDraw() const;
|
||||
/* 803156AC */ virtual void simpleDrawCache() const;
|
||||
|
||||
void loadCurrentMtx() const;
|
||||
|
||||
void onFlag(u32 flag) { mFlags |= flag; }
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
bool checkFlag(u32 flag) const { return (mFlags & flag) != 0; }
|
||||
|
||||
void setMaterial(J3DMaterial* pMaterial) {
|
||||
J3D_ASSERT_NULLPTR(509, pMaterial != NULL);
|
||||
mMaterial = pMaterial;
|
||||
}
|
||||
|
||||
void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) {
|
||||
J3D_ASSERT_NULLPTR(554, pMtxData != NULL);
|
||||
mDrawMtxData = pMtxData;
|
||||
}
|
||||
|
||||
void setVertexDataPointer(J3DVertexData* pVtxData) {
|
||||
J3D_ASSERT_NULLPTR(657, pVtxData != NULL);
|
||||
mVertexData = pVtxData;
|
||||
}
|
||||
|
||||
void* getVcdVatCmd() { return mVcdVatCmd; }
|
||||
void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; }
|
||||
void show() { offFlag(J3DShpFlag_Visible); }
|
||||
void hide() { onFlag(J3DShpFlag_Visible); }
|
||||
|
||||
void setCurrentViewNoPtr(u32* pViewNoPtr) {
|
||||
J3D_ASSERT_NULLPTR(584, pViewNoPtr != NULL);
|
||||
mCurrentViewNo = pViewNoPtr;
|
||||
}
|
||||
|
||||
void setCurrentMtx(J3DCurrentMtx& mtx) { mCurrentMtx = mtx; }
|
||||
|
||||
void setScaleFlagArray(u8* pScaleFlagArray) {
|
||||
J3D_ASSERT_NULLPTR(595, pScaleFlagArray != NULL);
|
||||
mScaleFlagArray = pScaleFlagArray;
|
||||
}
|
||||
|
||||
void setDrawMtx(Mtx** pDrawMtx) { mDrawMtx = pDrawMtx; }
|
||||
void setNrmMtx(Mtx33** pNrmMtx) { mNrmMtx = pNrmMtx; }
|
||||
void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; }
|
||||
bool getNBTFlag() const { return mHasNBT; }
|
||||
u32 getBumpMtxOffset() const { return mBumpMtxOffset; }
|
||||
void setBumpMtxOffset(u32 offset) { mBumpMtxOffset = offset; }
|
||||
GXVtxDescList* getVtxDesc() { return mVtxDesc; }
|
||||
|
||||
J3DMaterial* getMaterial() const { return mMaterial; }
|
||||
u16 getIndex() const { return mIndex; }
|
||||
u32 getTexMtxLoadType() const { return mFlags & 0xF000; }
|
||||
u32 getMtxGroupNum() const { return mMtxGroupNum; }
|
||||
J3DShapeDraw* getShapeDraw(u16 idx) { return mShapeDraw[idx]; }
|
||||
J3DShapeMtx* getShapeMtx(u16 idx) { return mShapeMtx[idx]; }
|
||||
Vec* getMin() { return &mMin; }
|
||||
Vec* getMax() { return &mMax; }
|
||||
|
||||
static void resetVcdVatCache() { sOldVcdVatCmd = NULL; }
|
||||
|
||||
static void* sOldVcdVatCmd;
|
||||
static bool sEnvelopeFlag;
|
||||
|
||||
private:
|
||||
friend struct J3DShapeFactory;
|
||||
friend class J3DJointTree;
|
||||
|
||||
/* 0x04 */ J3DMaterial* mMaterial;
|
||||
/* 0x08 */ u16 mIndex;
|
||||
/* 0x0A */ u16 mMtxGroupNum;
|
||||
/* 0x0C */ u32 mFlags;
|
||||
/* 0x10 */ f32 mRadius;
|
||||
/* 0x14 */ Vec mMin;
|
||||
/* 0x20 */ Vec mMax;
|
||||
/* 0x2C */ u8* mVcdVatCmd;
|
||||
/* 0x30 */ GXVtxDescList* mVtxDesc;
|
||||
/* 0x34 */ bool mHasNBT;
|
||||
/* 0x38 */ J3DShapeMtx** mShapeMtx;
|
||||
/* 0x3C */ J3DShapeDraw** mShapeDraw;
|
||||
/* 0x40 */ J3DCurrentMtx mCurrentMtx;
|
||||
/* 0x48 */ bool mHasPNMTXIdx;
|
||||
/* 0x4C */ J3DVertexData* mVertexData;
|
||||
/* 0x50 */ J3DDrawMtxData* mDrawMtxData;
|
||||
/* 0x54 */ u8* mScaleFlagArray;
|
||||
/* 0x58 */ Mtx** mDrawMtx;
|
||||
/* 0x5C */ Mtx33** mNrmMtx;
|
||||
/* 0x60 */ u32* mCurrentViewNo;
|
||||
/* 0x64 */ u32 mBumpMtxOffset;
|
||||
};
|
||||
|
||||
#endif /* J3DSHAPE_H */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define J3DSHAPEMTX_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DShape.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
#include "dolphin/mtx.h"
|
||||
|
||||
class J3DTexMtx;
|
||||
@@ -14,15 +15,21 @@ class J3DTexGenBlock;
|
||||
class J3DTexMtxObj {
|
||||
public:
|
||||
Mtx& getMtx(u16 idx) {
|
||||
J3D_ASSERT(0x113, idx <= mTexMtxNum, "Error : range over");
|
||||
J3D_ASSERT_RANGE(275, idx < mTexMtxNum);
|
||||
return mpTexMtx[idx];
|
||||
}
|
||||
|
||||
void setMtx(u16 idx, const Mtx mtx) {
|
||||
J3D_ASSERT_RANGE(288, idx < mTexMtxNum);
|
||||
MTXCopy(mtx, mpTexMtx[idx]);
|
||||
}
|
||||
|
||||
Mtx44& getEffectMtx(u16 idx) {
|
||||
J3D_ASSERT(0x125, idx <= mTexMtxNum, "Error : range over");
|
||||
J3D_ASSERT_RANGE(293, idx < mTexMtxNum);
|
||||
return mpEffectMtx[idx];
|
||||
}
|
||||
|
||||
u16 getNumTexMtx() const { return mTexMtxNum; }
|
||||
void setMtx(u16 idx, Mtx const* mtx) { MTXCopy(*mtx, mpTexMtx[idx]); }
|
||||
|
||||
/* 0x00 */ Mtx* mpTexMtx;
|
||||
/* 0x04 */ Mtx44* mpEffectMtx;
|
||||
@@ -37,7 +44,7 @@ class J3DDifferedTexMtx {
|
||||
public:
|
||||
/* 8031322C */ static void loadExecute(f32 const (*)[4]);
|
||||
|
||||
static inline void load(Mtx m) {
|
||||
static inline void load(const Mtx m) {
|
||||
if (sTexGenBlock != NULL)
|
||||
loadExecute(m);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ struct J3DFogInfo {
|
||||
struct J3DNBTScaleInfo {
|
||||
/* 8032587C */ J3DNBTScaleInfo& operator=(J3DNBTScaleInfo const&);
|
||||
|
||||
/* 0x0 */ bool mbHasScale;
|
||||
/* 0x0 */ u8 mbHasScale;
|
||||
/* 0x4 */ Vec mScale;
|
||||
}; // Size: 0x10
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <dolphin/mtx.h>
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
|
||||
// Perhaps move to a new J3DEnum.h?
|
||||
enum J3DError {
|
||||
@@ -11,9 +11,11 @@ enum J3DError {
|
||||
kJ3DError_Alloc = 4,
|
||||
};
|
||||
|
||||
enum J3DSysDrawBuffer {
|
||||
/* 0x0 */ J3DSys_OPA_BUFFER_e,
|
||||
/* 0x1 */ J3DSys_XLU_BUFFER_e
|
||||
enum J3DSysDrawBuf {
|
||||
/* 0x0 */ J3DSysDrawBuf_Opa,
|
||||
/* 0x1 */ J3DSysDrawBuf_Xlu,
|
||||
|
||||
/* 0x2 */ J3DSysDrawBuf_MAX
|
||||
};
|
||||
|
||||
class J3DMtxCalc;
|
||||
@@ -53,25 +55,25 @@ struct J3DSys {
|
||||
/* 0x03C */ J3DMatPacket* mMatPacket;
|
||||
/* 0x040 */ J3DShapePacket* mShapePacket;
|
||||
/* 0x044 */ J3DShape* mShape;
|
||||
/* 0x048 */ J3DDrawBuffer* mDrawBuffer[2];
|
||||
/* 0x048 */ J3DDrawBuffer* mDrawBuffer[J3DSysDrawBuf_MAX];
|
||||
/* 0x050 */ u32 mDrawMode;
|
||||
/* 0x054 */ u32 mMaterialMode;
|
||||
/* 0x058 */ J3DTexture* mTexture;
|
||||
/* 0x05C */ u8 field_0x5c[0x04];
|
||||
/* 0x05C */ u8 unk_0x5c[0x60 - 0x5C];
|
||||
/* 0x060 */ u32 mTexCacheRegionNum;
|
||||
/* 0x064 */ GXTexRegion mTexCacheRegion[8];
|
||||
/* 0x0E4 */ u8 field_0xe4[0x20];
|
||||
/* 0x0E4 */ u8 unk_0xe4[0x104 - 0xE4];
|
||||
/* 0x104 */ Mtx* mModelDrawMtx;
|
||||
/* 0x108 */ Mtx33* mModelNrmMtx;
|
||||
/* 0x10C */ void* mVtxPos;
|
||||
/* 0x110 */ void* mVtxNrm;
|
||||
/* 0x114 */ _GXColor* mVtxCol;
|
||||
/* 0x114 */ GXColor* mVtxCol;
|
||||
/* 0x118 */ Vec* mNBTScale;
|
||||
|
||||
/* 8030FDE8 */ J3DSys();
|
||||
/* 8030FEC0 */ void loadPosMtxIndx(int, u16) const;
|
||||
/* 8030FEE4 */ void loadNrmMtxIndx(int, u16) const;
|
||||
/* 8030FF0C */ void setTexCacheRegion(_GXTexCacheSize);
|
||||
/* 8030FF0C */ void setTexCacheRegion(GXTexCacheSize);
|
||||
/* 803100BC */ void drawInit();
|
||||
/* 8031073C */ void reinitGX();
|
||||
/* 8031079C */ void reinitGenMode();
|
||||
@@ -82,16 +84,15 @@ struct J3DSys {
|
||||
/* 80310D44 */ void reinitIndStages();
|
||||
/* 80310E3C */ void reinitPixelProc();
|
||||
|
||||
enum DrawMode {
|
||||
/* 0x3 */ OPA_TEX_EDGE = 3,
|
||||
/* 0x4 */ XLU,
|
||||
enum J3DSysDrawMode {
|
||||
J3DSysDrawMode_OpaTexEdge = 3,
|
||||
J3DSysDrawMode_Xlu
|
||||
};
|
||||
|
||||
MtxP getViewMtx() { return mViewMtx; }
|
||||
|
||||
void setDrawModeOpaTexEdge() { mDrawMode = OPA_TEX_EDGE; }
|
||||
|
||||
void setDrawModeXlu() { mDrawMode = XLU; }
|
||||
void setDrawModeOpaTexEdge() { mDrawMode = J3DSysDrawMode_OpaTexEdge; }
|
||||
void setDrawModeXlu() { mDrawMode = J3DSysDrawMode_Xlu; }
|
||||
|
||||
void* getVtxPos() { return mVtxPos; }
|
||||
void setVtxPos(void* pVtxPos) { mVtxPos = pVtxPos; }
|
||||
@@ -99,15 +100,35 @@ struct J3DSys {
|
||||
void* getVtxNrm() { return mVtxNrm; }
|
||||
void setVtxNrm(void* pVtxNrm) { mVtxNrm = pVtxNrm; }
|
||||
|
||||
void* getVtxCol() const { return mVtxCol; }
|
||||
void setVtxCol(_GXColor* pVtxCol) { mVtxCol = pVtxCol; }
|
||||
void* getVtxCol() { return mVtxCol; }
|
||||
void setVtxCol(GXColor* pVtxCol) { mVtxCol = pVtxCol; }
|
||||
|
||||
void setDrawBuffer(J3DDrawBuffer* buffer, int type) {
|
||||
J3D_ASSERT_RANGE(114, type >= 0 && type < J3DSysDrawBuf_MAX);
|
||||
J3D_ASSERT_NULLPTR(115, buffer);
|
||||
mDrawBuffer[type] = buffer;
|
||||
}
|
||||
|
||||
J3DDrawBuffer* getDrawBuffer(int type) {
|
||||
J3D_ASSERT_RANGE(121, type >= 0 && type < J3DSysDrawBuf_MAX);
|
||||
return mDrawBuffer[type];
|
||||
}
|
||||
|
||||
void setMatPacket(J3DMatPacket* pPacket) {
|
||||
J3D_ASSERT_NULLPTR(162, pPacket != NULL);
|
||||
mMatPacket = pPacket;
|
||||
}
|
||||
|
||||
void setShapePacket(J3DShapePacket* pPacket) {
|
||||
J3D_ASSERT_NULLPTR(172, pPacket != NULL);
|
||||
mShapePacket = pPacket;
|
||||
}
|
||||
|
||||
void setModel(J3DModel* pModel) {
|
||||
J3D_ASSERT(200, pModel, "Error : null pointer.");
|
||||
J3D_ASSERT_NULLPTR(200, pModel != NULL);
|
||||
mModel = pModel;
|
||||
}
|
||||
void setShapePacket(J3DShapePacket* pPacket) { mShapePacket = pPacket; }
|
||||
void setMatPacket(J3DMatPacket* pPacket) { mMatPacket = pPacket; }
|
||||
|
||||
J3DMatPacket* getMatPacket() { return mMatPacket; }
|
||||
void setMaterialMode(u32 mode) { mMaterialMode = mode; }
|
||||
|
||||
@@ -124,34 +145,20 @@ struct J3DSys {
|
||||
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
|
||||
bool checkFlag(u32 flag) { return mFlags & flag; }
|
||||
bool checkFlag(u32 flag) { return mFlags & flag ? true : false; }
|
||||
|
||||
void setModelDrawMtx(Mtx* pMtxArr) {
|
||||
J3D_ASSERT_NULLPTR(230, pMtxArr);
|
||||
mModelDrawMtx = pMtxArr;
|
||||
GXSetArray(GX_POS_MTX_ARRAY, mModelDrawMtx, sizeof(*mModelDrawMtx));
|
||||
}
|
||||
|
||||
void setModelNrmMtx(Mtx33* pMtxArr) {
|
||||
JUT_ASSERT_MSG(241, pMtxArr, "Error : null pointer.");
|
||||
J3D_ASSERT_NULLPTR(241, pMtxArr);
|
||||
mModelNrmMtx = pMtxArr;
|
||||
GXSetArray(GX_NRM_MTX_ARRAY, mModelNrmMtx, sizeof(*mModelNrmMtx));
|
||||
}
|
||||
|
||||
// Type 0: Opa Buffer
|
||||
// Type 1: Xlu Buffer
|
||||
void setDrawBuffer(J3DDrawBuffer* buffer, int type) {
|
||||
J3D_ASSERT(114, type >= 0 && type < 2, "Error : range over.");
|
||||
J3D_ASSERT(115, buffer, "Error : null pointer.");
|
||||
mDrawBuffer[type] = buffer;
|
||||
}
|
||||
|
||||
// Type 0: Opa Buffer
|
||||
// Type 1: Xlu Buffer
|
||||
J3DDrawBuffer* getDrawBuffer(int type) {
|
||||
J3D_ASSERT(121, type >= 0 && type < 2, "Error : range over.");
|
||||
return mDrawBuffer[type];
|
||||
}
|
||||
|
||||
Mtx& getModelDrawMtx(u16 no) { return mModelDrawMtx[no]; }
|
||||
J3DShapePacket* getShapePacket() { return mShapePacket; }
|
||||
|
||||
|
||||
@@ -153,6 +153,16 @@ struct J3DTevStage {
|
||||
return *this;
|
||||
}
|
||||
|
||||
J3DTevStage& operator=(J3DTevStage& other) {
|
||||
mTevColorOp = other.mTevColorOp;
|
||||
mTevColorAB = other.mTevColorAB;
|
||||
mTevColorCD = other.mTevColorCD;
|
||||
mTevAlphaOp = other.mTevAlphaOp;
|
||||
mTevAlphaAB = other.mTevAlphaAB;
|
||||
mTevSwapModeInfo = other.mTevSwapModeInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
/* 0x1 */ u8 mTevColorOp;
|
||||
/* 0x2 */ u8 mTevColorAB;
|
||||
@@ -214,6 +224,16 @@ struct J3DIndTevStage {
|
||||
J3DGDWriteBPCmd(mInfo | (param_1 + 0x10) * 0x1000000);
|
||||
}
|
||||
|
||||
J3DIndTevStage& operator=(const J3DIndTevStage& other) {
|
||||
mInfo = other.mInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
J3DIndTevStage& operator=(J3DIndTevStage& other) {
|
||||
mInfo = other.mInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* 0x0 */ u32 mInfo;
|
||||
};
|
||||
|
||||
@@ -264,6 +284,11 @@ struct J3DTevSwapModeTable {
|
||||
return *this;
|
||||
}
|
||||
|
||||
J3DTevSwapModeTable& operator=(J3DTevSwapModeTable& other) {
|
||||
mIdx = other.mIdx;
|
||||
return *this;
|
||||
}
|
||||
|
||||
u8 calcTevSwapTableID(u8 param_0, u8 param_1, u8 param_2, u8 param_3) {
|
||||
return 0x40 * param_0 + 0x10 * param_1 + 4 * param_2 + param_3;
|
||||
}
|
||||
@@ -281,6 +306,7 @@ extern const GXColor j3dDefaultAmbInfo;
|
||||
extern const GXColorS10 j3dDefaultTevColor;
|
||||
extern const GXColor j3dDefaultTevKColor;
|
||||
extern u8 j3dAlphaCmpTable[768];
|
||||
extern const u8 j3dDefaultNumChans;
|
||||
|
||||
struct J3DNBTScale;
|
||||
struct J3DTexCoord;
|
||||
@@ -290,5 +316,9 @@ void loadTexNo(u32 param_0, u16 const& param_1);
|
||||
void patchTexNo_PtrToIdx(u32 texID, u16 const& idx);
|
||||
bool isTexNoReg(void* param_0);
|
||||
u16 getTexNoReg(void* param_0);
|
||||
void makeTexCoordTable();
|
||||
void makeAlphaCmpTable();
|
||||
void makeZModeTable();
|
||||
void makeTevSwapTable();
|
||||
|
||||
#endif /* J3DTEVS_H */
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define J3DTEXTURE_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DStruct.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
#include "JSystem/JUtility/JUTTexture.h"
|
||||
#include "dolphin/types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
@@ -13,25 +13,28 @@
|
||||
class J3DTexture {
|
||||
private:
|
||||
/* 0x0 */ u16 mNum;
|
||||
/* 0x2 */ u16 field_0x2;
|
||||
/* 0x2 */ u16 unk_0x2;
|
||||
/* 0x4 */ ResTIMG* mpRes;
|
||||
|
||||
public:
|
||||
J3DTexture(u16 num, ResTIMG* res) : mNum(num), field_0x2(0), mpRes(res) {}
|
||||
/* 8031204C */ void loadGX(u16, _GXTexMapID) const;
|
||||
J3DTexture(u16 num, ResTIMG* res) : mNum(num), unk_0x2(0), mpRes(res) {}
|
||||
|
||||
/* 8031204C */ void loadGX(u16, GXTexMapID) const;
|
||||
/* 803121A4 */ void entryNum(u16);
|
||||
/* 8031221C */ void addResTIMG(u16, ResTIMG const*);
|
||||
/* 803366A4 */ virtual ~J3DTexture() {}
|
||||
|
||||
u16 getNum() const { return mNum; }
|
||||
ResTIMG* getResTIMG(u16 entry) const {
|
||||
J3D_ASSERT(72, entry < mNum, "Error : range over.");
|
||||
return &mpRes[entry];
|
||||
|
||||
ResTIMG* getResTIMG(u16 index) const {
|
||||
J3D_ASSERT_RANGE(72, index < mNum);
|
||||
return &mpRes[index];
|
||||
}
|
||||
void setResTIMG(u16 entry, const ResTIMG& timg) {
|
||||
mpRes[entry] = timg;
|
||||
mpRes[entry].imageOffset = ((mpRes[entry].imageOffset + (u32)&timg - (u32)(mpRes + entry)));
|
||||
mpRes[entry].paletteOffset = ((mpRes[entry].paletteOffset + (u32)&timg - (u32)(mpRes + entry)));
|
||||
|
||||
void setResTIMG(u16 index, const ResTIMG& timg) {
|
||||
mpRes[index] = timg;
|
||||
mpRes[index].imageOffset = ((mpRes[index].imageOffset + (uintptr_t)&timg - (uintptr_t)(mpRes + index)));
|
||||
mpRes[index].paletteOffset = ((mpRes[index].paletteOffset + (uintptr_t)&timg - (uintptr_t)(mpRes + index)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,9 +49,11 @@ public:
|
||||
J3DTexMtx() {
|
||||
mTexMtxInfo = j3dDefaultTexMtxInfo;
|
||||
}
|
||||
|
||||
J3DTexMtx(const J3DTexMtxInfo& info) {
|
||||
mTexMtxInfo = info;
|
||||
}
|
||||
|
||||
/* 803238C4 */ void load(u32) const;
|
||||
/* 80323900 */ void calc(const Mtx);
|
||||
/* 80323920 */ void calcTexMtx(const Mtx);
|
||||
@@ -103,7 +108,7 @@ struct J3DTexCoord : public J3DTexCoordInfo {
|
||||
void setTexMtxReg(u16 reg) { mTexMtxReg = reg; }
|
||||
J3DTexCoord& operator=(const J3DTexCoord& other) {
|
||||
// Fake match (__memcpy or = doesn't match)
|
||||
*(u32*)this = *(u32*)&other;
|
||||
*(uintptr_t*)this = *(uintptr_t*)&other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef J3DTRANSFORM_H
|
||||
#define J3DTRANSFORM_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "dolphin/mtx.h"
|
||||
#include <dolphin/mtx.h>
|
||||
|
||||
struct J3DTextureSRTInfo;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ struct J3DVtxColorCalc {
|
||||
class J3DVertexData {
|
||||
public:
|
||||
J3DVertexData();
|
||||
~J3DVertexData() {}
|
||||
|
||||
void* getVtxPosArray() const { return mVtxPosArray; }
|
||||
void* getVtxNrmArray() const { return mVtxNrmArray; }
|
||||
@@ -38,10 +39,10 @@ public:
|
||||
u32 getNrmNum() const { return mNrmNum; }
|
||||
u32 getVtxNum() const { return mVtxNum; }
|
||||
GXVtxAttrFmtList* getVtxAttrFmtList() const { return mVtxAttrFmtList; }
|
||||
u8 getVtxPosFrac() { return mVtxPosFrac; }
|
||||
u8 getVtxNrmFrac() { return mVtxNrmFrac; }
|
||||
int getVtxPosType() { return mVtxPosType; }
|
||||
int getVtxNrmType() { return mVtxNrmType; }
|
||||
u8 getVtxPosFrac() const { return mVtxPosFrac; }
|
||||
u8 getVtxNrmFrac() const { return mVtxNrmFrac; }
|
||||
int getVtxPosType() const { return mVtxPosType; }
|
||||
int getVtxNrmType() const { return mVtxNrmType; }
|
||||
|
||||
void setVtxPosFrac(u8 frac) { mVtxPosFrac = frac; }
|
||||
void setVtxPosType(GXCompType type) { mVtxPosType = type; }
|
||||
@@ -148,8 +149,4 @@ private:
|
||||
/* 0x34 */ GXColor* mCurrentVtxCol;
|
||||
}; // Size: 0x38
|
||||
|
||||
struct VertexNormal {
|
||||
Vec data;
|
||||
};
|
||||
|
||||
#endif /* J3DVERTEX_H */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define JAISEQDATAMGR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
@@ -28,10 +29,10 @@ struct JAISeqData {
|
||||
*/
|
||||
struct JAISeqDataRegion {
|
||||
bool intersects(JAISeqData& seqData) const {
|
||||
if ((u32)addr + size < (u32)seqData.field_0x0) {
|
||||
if ((uintptr_t)addr + size < (uintptr_t)seqData.field_0x0) {
|
||||
return false;
|
||||
}
|
||||
if ((u32)seqData.field_0x0 + seqData.field_0x4 < (u32)addr) {
|
||||
if ((uintptr_t)seqData.field_0x0 + seqData.field_0x4 < (uintptr_t)addr) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
if (!this->field_0x4.test(i)) {
|
||||
continue;
|
||||
}
|
||||
if ((u32)this->mHeaps[i].getBase() != param_0) {
|
||||
if ((uintptr_t)this->mHeaps[i].getBase() != param_0) {
|
||||
continue;
|
||||
}
|
||||
this->field_0x4.reset(i);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "JSystem/JGadget/std-memory.h"
|
||||
#include <algorithm.h>
|
||||
#include <msl_memory.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace JGadget {
|
||||
namespace vector {
|
||||
@@ -105,7 +106,7 @@ struct TVector {
|
||||
}
|
||||
|
||||
T* insert(T* pos, const T& val) {
|
||||
u32 diff = (int)((u32)pos - (u32)begin()) / 4;
|
||||
u32 diff = (int)((uintptr_t)pos - (uintptr_t)begin()) / 4;
|
||||
insert(pos, 1, val);
|
||||
return pBegin_ + diff;
|
||||
}
|
||||
@@ -118,7 +119,7 @@ struct TVector {
|
||||
if (pBegin_ == 0) {
|
||||
return 0;
|
||||
}
|
||||
return (int)((u32)pEnd_ - (u32)pBegin_) / 4;
|
||||
return (int)((uintptr_t)pEnd_ - (uintptr_t)pBegin_) / 4;
|
||||
}
|
||||
|
||||
u32 capacity() { return mCapacity; }
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <dolphin.h>
|
||||
#include "JSystem/JSupport/JSUMemoryStream.h"
|
||||
#include "JSystem/JHostIO/JORReflexible.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define MCTX_MSG_RESET 0
|
||||
#define MCTX_MSG_GET_ROOT_OBJ 2
|
||||
@@ -29,7 +30,7 @@
|
||||
#define DEFINE_GEN_CHECKBOX(T, kind) \
|
||||
void genCheckBox(const char* label, T* pSrc, T mask, u32 style, JOREventListener* pListener, \
|
||||
u16 posX, u16 posY, u16 width, u16 height) { \
|
||||
genCheckBoxSub(kind, label, (u32)pSrc, style, *pSrc, mask, pListener, posX, posY, width, \
|
||||
genCheckBoxSub(kind, label, (uintptr_t)pSrc, style, *pSrc, mask, pListener, posX, posY, width, \
|
||||
height); \
|
||||
}
|
||||
|
||||
@@ -43,7 +44,7 @@
|
||||
#define DEFINE_GEN_SLIDER(T, kind) \
|
||||
void genSlider(const char* label, T* pSrc, T rangeMin, T rangeMax, u32 style, \
|
||||
JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height) { \
|
||||
genSliderSub(kind, label, (u32)pSrc, style, *pSrc, rangeMin, rangeMax, pListener, posX, \
|
||||
genSliderSub(kind, label, (uintptr_t)pSrc, style, *pSrc, rangeMin, rangeMax, pListener, posX, \
|
||||
posY, width, height); \
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@
|
||||
#define DEFINE_START_COMBO_BOX(T, kind) \
|
||||
void startComboBox(const char* label, T* pSrc, u32 style, \
|
||||
JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height) { \
|
||||
startSelectorSub('CMBX', kind, label, (u32)pSrc, style, *pSrc, pListener, posX, \
|
||||
startSelectorSub('CMBX', kind, label, (uintptr_t)pSrc, style, *pSrc, pListener, posX, \
|
||||
posY, width, height); \
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@
|
||||
|
||||
#define DEFINE_UPDATE_SLIDER(T) \
|
||||
void updateSlider(u32 mode, T* pSrc, T rangeMin, T rangeMax, u32 param_5) { \
|
||||
updateSliderSub(mode, (u32) pSrc, *pSrc, rangeMin, rangeMax, param_5); \
|
||||
updateSliderSub(mode, (uintptr_t)pSrc, *pSrc, rangeMin, rangeMax, param_5); \
|
||||
}
|
||||
|
||||
#define DEFINE_UPDATE_SLIDER_ID(T) \
|
||||
@@ -252,7 +253,7 @@ public:
|
||||
void updateEditBoxID(u32 mode, u32 id, const char* string, u32 param_3, u16 length);
|
||||
|
||||
void updateCheckBox(u32 mode, u8* pSrc, u8 mask, u32 param_4) {
|
||||
updateCheckBoxSub(mode, (u32) pSrc, *pSrc, mask, param_4);
|
||||
updateCheckBoxSub(mode, (uintptr_t)pSrc, *pSrc, mask, param_4);
|
||||
}
|
||||
|
||||
void updateCheckBoxID(u32 mode, u32 id, u8 value, u8 mask, u32 param_4) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define JKREXPHEAP_H
|
||||
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jkernel
|
||||
@@ -34,7 +35,7 @@ public:
|
||||
CMemBlock* getNextBlock() const { return mNext; }
|
||||
u32 getSize() const { return size; }
|
||||
u8 getGroupId() const { return mGroupId; }
|
||||
static CMemBlock* getBlock(void* data) { return (CMemBlock*)((u32)data + -0x10); }
|
||||
static CMemBlock* getBlock(void* data) { return (CMemBlock*)((uintptr_t)data + -0x10); }
|
||||
|
||||
private:
|
||||
/* 0x0 */ u16 mMagic;
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#define JMATRIGONOMETRIC_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "utility.h"
|
||||
#include <utility.h>
|
||||
|
||||
namespace JMath {
|
||||
template<typename T>
|
||||
struct TAngleConstant_;
|
||||
|
||||
@@ -19,7 +20,6 @@ struct TAngleConstant_<f32> {
|
||||
static f32 RADIAN_TO_DEGREE_FACTOR() { return 180.0f / RADIAN_DEG180(); }
|
||||
};
|
||||
|
||||
namespace JMath {
|
||||
/**
|
||||
* @ingroup jsystem-jmath
|
||||
*
|
||||
@@ -73,30 +73,31 @@ struct TAtanTable {
|
||||
* @ingroup jsystem-jmath
|
||||
*
|
||||
*/
|
||||
template<int N, typename T>
|
||||
struct TAsinAcosTable {
|
||||
f32 table[1025];
|
||||
T table[1025];
|
||||
u8 pad[0x1C];
|
||||
|
||||
f32 acos_(f32 x) {
|
||||
T acos_(T x) const {
|
||||
if (x >= 1.0f) {
|
||||
return 0.0f;
|
||||
} else if (x <= -1.0f) {
|
||||
return TAngleConstant_<f32>::RADIAN_DEG180();
|
||||
return TAngleConstant_<T>::RADIAN_DEG180();
|
||||
} else if (x < 0.0f) {
|
||||
return table[(u32)(-x * 1023.5f)] + TAngleConstant_<f32>::RADIAN_DEG090();
|
||||
return table[(u32)(-x * 1023.5f)] + TAngleConstant_<T>::RADIAN_DEG090();
|
||||
} else {
|
||||
return TAngleConstant_<f32>::RADIAN_DEG090() - table[(u32)(x * 1023.5f)];
|
||||
return TAngleConstant_<T>::RADIAN_DEG090() - table[(u32)(x * 1023.5f)];
|
||||
}
|
||||
}
|
||||
|
||||
f32 acosDegree(f32 x) {
|
||||
return acos_(x) * TAngleConstant_<f32>::RADIAN_TO_DEGREE_FACTOR();
|
||||
T acosDegree(T x) const {
|
||||
return acos_(x) * TAngleConstant_<T>::RADIAN_TO_DEGREE_FACTOR();
|
||||
}
|
||||
};
|
||||
|
||||
extern TSinCosTable<13, f32> sincosTable_;
|
||||
extern TAtanTable atanTable_;
|
||||
extern TAsinAcosTable asinAcosTable_;
|
||||
extern TAsinAcosTable<1024, f32> asinAcosTable_;
|
||||
|
||||
inline f32 acosDegree(f32 x) {
|
||||
return asinAcosTable_.acosDegree(x);
|
||||
|
||||
@@ -80,6 +80,11 @@ inline f32 JMAHermiteInterpolation(register f32 p1, register f32 p2, register f3
|
||||
|
||||
namespace JMath {
|
||||
|
||||
template <typename T>
|
||||
inline T fastSqrt(T value) {
|
||||
return JMAFastSqrt(value);
|
||||
}
|
||||
|
||||
inline f32 fastReciprocal(f32 value) {
|
||||
return JMAFastReciprocal(value);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define JPAEMITTER_H
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <stdint.h>
|
||||
#include "JSystem/JParticle/JPAResource.h"
|
||||
#include "JSystem/JParticle/JPAList.h"
|
||||
#include "JSystem/JParticle/JPARandom.h"
|
||||
@@ -197,8 +198,8 @@ public:
|
||||
void stopDrawParticle() { setStatus(JPAEmtrStts_StopDraw); }
|
||||
void playDrawParticle() { clearStatus(JPAEmtrStts_StopDraw); }
|
||||
|
||||
u32 getUserWork() { return mpUserWork; }
|
||||
void setUserWork(u32 userWork) { mpUserWork = userWork; }
|
||||
uintptr_t getUserWork() { return mpUserWork; }
|
||||
void setUserWork(uintptr_t userWork) { mpUserWork = userWork; }
|
||||
u32 getParticleNumber() const {
|
||||
return mAlivePtclBase.getNum() + mAlivePtclChld.getNum();
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ struct TAdaptor_actor : public TAdaptor {
|
||||
};
|
||||
|
||||
TAdaptor_actor()
|
||||
: TAdaptor(mValue, ARRAY_SIZE(mValue))
|
||||
: TAdaptor(mValue, ARRAY_SIZEU(mValue))
|
||||
, mValue()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
#define JSUPPORT_H
|
||||
|
||||
#include <dolphin.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jsupport
|
||||
*
|
||||
*/
|
||||
template <typename T>
|
||||
T* JSUConvertOffsetToPtr(const void* ptr, u32 offset) {
|
||||
T* JSUConvertOffsetToPtr(const void* ptr, uintptr_t offset) {
|
||||
if (offset == 0) {
|
||||
return NULL;
|
||||
} else {
|
||||
return (T*)((s32)ptr + (s32)offset);
|
||||
return (T*)((intptr_t)ptr + (intptr_t)offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +26,7 @@ T* JSUConvertOffsetToPtr(const void* ptr, const void* offset) {
|
||||
if (offset == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return (T*)((s32)ptr + (s32)offset);
|
||||
return (T*)((intptr_t)ptr + (intptr_t)offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define JUT_ASSERT_MSG_F(LINE, COND, MSG, ...) \
|
||||
(COND) ? (void)0 : (JUTAssertion::showAssert_f(JUTAssertion::getSDevice(), __FILE__, LINE, MSG, __VA_ARGS__), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
#define J3D_ASSERT(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
|
||||
#define J3D_PANIC(LINE, COND, MSG) ((COND) != 0 || (OSPanic(__FILE__, LINE, MSG), 0));
|
||||
|
||||
#define JUT_PANIC(LINE, TEXT) \
|
||||
@@ -36,7 +35,6 @@
|
||||
#define JUT_ASSERT(...) (void)0;
|
||||
#define JUT_ASSERT_MSG(...) (void)0;
|
||||
#define JUT_ASSERT_MSG_F(...) (void)0;
|
||||
#define J3D_ASSERT(...) (void)0;
|
||||
#define J3D_PANIC(...) (void)0;
|
||||
#define JUT_PANIC(...)
|
||||
#define JUT_WARN(...)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define JUTTEXTURE_H
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <stdint.h>
|
||||
|
||||
class JUTPalette;
|
||||
|
||||
@@ -24,7 +25,7 @@ struct ResTIMG {
|
||||
/* 0x08 */ u8 indexTexture;
|
||||
/* 0x09 */ u8 colorFormat;
|
||||
/* 0x0A */ u16 numColors;
|
||||
/* 0x0C */ u32 paletteOffset;
|
||||
/* 0x0C */ uintptr_t paletteOffset;
|
||||
/* 0x10 */ u8 mipmapEnabled;
|
||||
/* 0x11 */ u8 doEdgeLOD;
|
||||
/* 0x12 */ u8 biasClamp;
|
||||
@@ -36,7 +37,7 @@ struct ResTIMG {
|
||||
/* 0x18 */ u8 mipmapCount;
|
||||
/* 0x19 */ u8 unknown;
|
||||
/* 0x1A */ s16 LODBias;
|
||||
/* 0x1C */ u32 imageOffset;
|
||||
/* 0x1C */ uintptr_t imageOffset;
|
||||
}; // Size: 0x20
|
||||
|
||||
/**
|
||||
|
||||
@@ -4332,7 +4332,7 @@ public:
|
||||
/* 0x032C0 */ s16 field_0x32c0[2];
|
||||
/* 0x032C4 */ u16 field_0x32c4[2];
|
||||
/* 0x032C8 */ u32 field_0x32c8;
|
||||
/* 0x032CC */ u32 field_0x32cc;
|
||||
/* 0x032CC */ uintptr_t field_0x32cc;
|
||||
/* 0x032D0 */ u32 field_0x32d0;
|
||||
/* 0x032D4 */ u32 field_0x32d4;
|
||||
/* 0x032D8 */ firePointEff_c field_0x32d8[4];
|
||||
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
class dDlst_shadowRealPoly_c : public dDlst_shadowPoly_c {
|
||||
public:
|
||||
/* 800569A0 */ virtual dDlst_shadowTri_c* getTri() { return mShadowTri; }
|
||||
/* 800569A8 */ virtual s32 getTriMax() { return ARRAY_SIZE(mShadowTri); }
|
||||
/* 800569A8 */ virtual s32 getTriMax() { return ARRAY_SIZEU(mShadowTri); }
|
||||
|
||||
/* 0x8 */ dDlst_shadowTri_c mShadowTri[256];
|
||||
};
|
||||
@@ -346,8 +346,8 @@ public:
|
||||
J3DDrawBuffer* getOpaListBG() { return mDrawBuffers[DB_OPA_LIST_BG]; }
|
||||
J3DDrawBuffer* getOpaListDark() { return mDrawBuffers[DB_OPA_LIST_DARK]; }
|
||||
J3DDrawBuffer* getXluListBG() { return mDrawBuffers[DB_XLU_LIST_BG]; }
|
||||
void setXluDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSys_XLU_BUFFER_e); }
|
||||
void setOpaDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSys_OPA_BUFFER_e); }
|
||||
void setXluDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSysDrawBuf_Xlu); }
|
||||
void setOpaDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSysDrawBuf_Opa); }
|
||||
void setXluListSky() { setXluDrawList(mDrawBuffers[DB_XLU_LIST_SKY]); }
|
||||
void setOpaListSky() { setOpaDrawList(mDrawBuffers[DB_OPA_LIST_SKY]); }
|
||||
void setXluListDark() { setXluDrawList(mDrawBuffers[DB_XLU_LIST_DARK]); }
|
||||
|
||||
+12
-12
@@ -81,50 +81,50 @@ public:
|
||||
static int syncAllRes(dRes_info_c* i_resInfo, int i_infoNum);
|
||||
|
||||
int setObjectRes(const char* i_arcName, u8 i_mountDirection, JKRHeap* i_heap) {
|
||||
return setRes(i_arcName, mObjectInfo, ARRAY_SIZE(mObjectInfo), "/res/Object/", i_mountDirection,
|
||||
return setRes(i_arcName, mObjectInfo, ARRAY_SIZEU(mObjectInfo), "/res/Object/", i_mountDirection,
|
||||
i_heap);
|
||||
}
|
||||
|
||||
void* getObjectRes(const char* i_arcName, const char* resName) {
|
||||
return getRes(i_arcName, resName, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return getRes(i_arcName, resName, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
void* getObjectRes(const char* i_arcName, s32 i_index) {
|
||||
return getRes(i_arcName, i_index, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return getRes(i_arcName, i_index, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
void* getObjectIDRes(const char* i_arcName, u16 i_resID) {
|
||||
return getIDRes(i_arcName, i_resID, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return getIDRes(i_arcName, i_resID, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
int syncObjectRes(const char* i_arcName) {
|
||||
return syncRes(i_arcName, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return syncRes(i_arcName, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
int syncStageRes(const char* i_arcName) {
|
||||
return syncRes(i_arcName, mStageInfo, ARRAY_SIZE(mStageInfo));
|
||||
return syncRes(i_arcName, mStageInfo, ARRAY_SIZEU(mStageInfo));
|
||||
}
|
||||
|
||||
int syncAllObjectRes() { return syncAllRes(mObjectInfo, ARRAY_SIZE(mObjectInfo)); }
|
||||
int syncAllObjectRes() { return syncAllRes(mObjectInfo, ARRAY_SIZEU(mObjectInfo)); }
|
||||
|
||||
int deleteObjectRes(const char* i_arcName) {
|
||||
return deleteRes(i_arcName, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return deleteRes(i_arcName, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
int deleteStageRes(const char* i_arcName) {
|
||||
return deleteRes(i_arcName, mStageInfo, ARRAY_SIZE(mStageInfo));
|
||||
return deleteRes(i_arcName, mStageInfo, ARRAY_SIZEU(mStageInfo));
|
||||
}
|
||||
|
||||
void* getStageRes(const char* i_arcName, const char* i_resName) {
|
||||
return getRes(i_arcName, i_resName, mStageInfo, ARRAY_SIZE(mStageInfo));
|
||||
return getRes(i_arcName, i_resName, mStageInfo, ARRAY_SIZEU(mStageInfo));
|
||||
}
|
||||
|
||||
dRes_info_c* getObjectResInfo(const char* i_arcName) {
|
||||
return getResInfo(i_arcName, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return getResInfo(i_arcName, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
dRes_info_c* getStageResInfo(const char* i_arcName) {
|
||||
return getResInfo(i_arcName, mStageInfo, ARRAY_SIZE(mStageInfo));
|
||||
return getResInfo(i_arcName, mStageInfo, ARRAY_SIZEU(mStageInfo));
|
||||
}
|
||||
|
||||
/* 0x0000 */ dRes_info_c mObjectInfo[128];
|
||||
|
||||
+2
-1
@@ -23,7 +23,8 @@
|
||||
|
||||
#define ALIGN_DECL(ALIGNMENT) __attribute__((aligned(ALIGNMENT)))
|
||||
|
||||
#define ARRAY_SIZE(o) (sizeof((o)) / sizeof(*(o)))
|
||||
#define ARRAY_SIZE(o) (s32)(sizeof((o)) / sizeof(*(o)))
|
||||
#define ARRAY_SIZEU(o) (sizeof((o)) / sizeof(*(o)))
|
||||
|
||||
// Align X to the previous N bytes (N must be power of two)
|
||||
#define ALIGN_PREV(X, N) ((X) & ~((N)-1))
|
||||
|
||||
@@ -1217,7 +1217,7 @@ void J2DPictureEx::setAnimation(J2DAnmVtxColor* anm) {
|
||||
if (field_0x158[i] != 0xffff) {
|
||||
for (u16 j = 0; j < anm_table_num; j++) {
|
||||
J3DAnmVtxColorIndexData* data = anm->getAnmVtxColorIndexData(0, j);
|
||||
u16* index = anm->getVtxColorIndexPointer(0) + (u32)data->mpData;
|
||||
u16* index = anm->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData;
|
||||
for (u16 k = 0; k < data->mNum; k++) {
|
||||
if (index[k] == field_0x158[i]) {
|
||||
field_0x198 = anm;
|
||||
@@ -1255,7 +1255,7 @@ const J2DAnmTransform* J2DPictureEx::animationPane(J2DAnmTransform const* anm) {
|
||||
if (field_0x19c & (1 << i)) {
|
||||
for (u16 j = 0; j < anm_table_num; j++) {
|
||||
J3DAnmVtxColorIndexData* data = field_0x198->getAnmVtxColorIndexData(0, j);
|
||||
u16* index = field_0x198->getVtxColorIndexPointer(0) + (u32)data->mpData;
|
||||
u16* index = field_0x198->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData;
|
||||
for (u16 k = 0; k < data->mNum; k++) {
|
||||
if (index[k] == field_0x158[i]) {
|
||||
field_0x198->getColor(0, j, &mCornerColor[i]);
|
||||
|
||||
@@ -237,7 +237,7 @@ f32 J2DPrint::parse(const u8* pString, int length, int param_2, u16* param_3,
|
||||
b2ByteCharacter = true;
|
||||
}
|
||||
|
||||
if (iCharacter == 0 || ((u32)pString - (u32)pStringStart) > length) {
|
||||
if (iCharacter == 0 || ((uintptr_t)pString - (uintptr_t)pStringStart) > length) {
|
||||
if (!param_6 && param_3 != NULL) {
|
||||
param_3[someIndex] = 0.5f + f31;
|
||||
}
|
||||
@@ -284,7 +284,7 @@ f32 J2DPrint::parse(const u8* pString, int length, int param_2, u16* param_3,
|
||||
f31 = 0.0f;
|
||||
}
|
||||
}
|
||||
} else if (b2ByteCharacter && ((u32)pString - (u32)pStringStart > (u32)length)) {
|
||||
} else if (b2ByteCharacter && ((uintptr_t)pString - (uintptr_t)pStringStart > (u32)length)) {
|
||||
if (!param_6 && param_3 != NULL) {
|
||||
param_3[someIndex] = 0.5f + f31;
|
||||
}
|
||||
@@ -560,8 +560,8 @@ s32 J2DPrint::getNumberS32(const u8** ppu8String, s32 defaultValue, s32 errorVal
|
||||
number = strtol((char*)*ppu8String, &pEnd, base);
|
||||
} else if (base == 16) {
|
||||
number = strtoul((char*)*ppu8String, &pEnd, base);
|
||||
if ((u32)pEnd - (u32)*ppu8String != 8) {
|
||||
if ((u32)pEnd - (u32)*ppu8String == 6) {
|
||||
if ((uintptr_t)pEnd - (uintptr_t)*ppu8String != 8) {
|
||||
if ((uintptr_t)pEnd - (uintptr_t)*ppu8String == 6) {
|
||||
number = (number << 8) | 0xFF;
|
||||
} else {
|
||||
*ppu8String = pStringStart;
|
||||
@@ -600,8 +600,8 @@ f32 J2DPrint::getNumberF32(const u8** ppu8String, f32 defaultValue, f32 errorVal
|
||||
number = strtol((char*)*ppu8String, &pEnd, base);
|
||||
} else if (base == 16) {
|
||||
number = strtoul((char*)*ppu8String, &pEnd, base);
|
||||
if ((u32)pEnd - (u32)*ppu8String != 8) {
|
||||
if ((u32)pEnd - (u32)*ppu8String == 6) {
|
||||
if ((uintptr_t)pEnd - (uintptr_t)*ppu8String != 8) {
|
||||
if ((uintptr_t)pEnd - (uintptr_t)*ppu8String == 6) {
|
||||
number = (number << 8) | 0xFF;
|
||||
} else {
|
||||
*ppu8String = pStringStart;
|
||||
|
||||
@@ -920,7 +920,7 @@ void J2DWindowEx::setAnimation(J2DAnmVtxColor* param_0) {
|
||||
for (u16 j = 0; j < uVar3; j++) {
|
||||
J3DAnmVtxColorIndexData* puVar1 = param_0->getAnmVtxColorIndexData(0, j);
|
||||
u16* indexPointer = param_0->getVtxColorIndexPointer(0);
|
||||
u16* indexPointer2 = indexPointer + (u32)puVar1->mpData;
|
||||
u16* indexPointer2 = indexPointer + (uintptr_t)puVar1->mpData;
|
||||
for (u16 k = 0; k < puVar1->mNum; k++) {
|
||||
if (indexPointer2[k] == field_0x168[i]) {
|
||||
mAnmVtxColor = param_0;
|
||||
@@ -964,7 +964,7 @@ const J2DAnmTransform* J2DWindowEx::animationPane(J2DAnmTransform const* param_0
|
||||
for (u16 j = 0; j < uVar3; j++) {
|
||||
J3DAnmVtxColorIndexData* puVar1 = mAnmVtxColor->getAnmVtxColorIndexData(0, j);
|
||||
u16* indexPointer = mAnmVtxColor->getVtxColorIndexPointer(0);
|
||||
u16* indexPointer2 = indexPointer + (u32)puVar1->mpData;
|
||||
u16* indexPointer2 = indexPointer + (uintptr_t)puVar1->mpData;
|
||||
for (u16 k = 0; k < puVar1->mNum; k++) {
|
||||
if (indexPointer2[k] == field_0x168[i]) {
|
||||
mAnmVtxColor->getColor(0, j, local_38[i]);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,8 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DCluster
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DCluster.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/JMath/JMATrigonometric.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/base/PPCArch.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
/* 8032E1F8-8032E230 328B38 0038+00 0/0 1/1 0/0 .text __ct__13J3DDeformDataFv */
|
||||
J3DDeformData::J3DDeformData() {
|
||||
@@ -37,7 +30,7 @@ void J3DDeformData::offAllFlag(u32 i_flag) {
|
||||
/* 8032E274-8032E298 328BB4 0024+00 0/0 1/1 0/0 .text deform__13J3DDeformDataFP8J3DModel
|
||||
*/
|
||||
void J3DDeformData::deform(J3DModel* model) {
|
||||
J3D_ASSERT(110, model, "Error : null pointer");
|
||||
J3D_ASSERT_NULLPTR(110, model);
|
||||
|
||||
deform(model->getVertexBuffer());
|
||||
}
|
||||
@@ -45,7 +38,7 @@ void J3DDeformData::deform(J3DModel* model) {
|
||||
/* 8032E298-8032E364 328BD8 00CC+00 1/1 0/0 0/0 .text deform__13J3DDeformDataFP15J3DVertexBuffer
|
||||
*/
|
||||
void J3DDeformData::deform(J3DVertexBuffer* buffer) {
|
||||
J3D_ASSERT(141, buffer, "Error : null pointer");
|
||||
J3D_ASSERT_NULLPTR(141, buffer);
|
||||
|
||||
buffer->swapVtxPosArrayPointer();
|
||||
buffer->swapVtxNrmArrayPointer();
|
||||
@@ -83,7 +76,7 @@ J3DDeformer::J3DDeformer(J3DDeformData* data) {
|
||||
/* 8032E3BC-8032E4A4 328CFC 00E8+00 1/1 0/0 0/0 .text deform__11J3DDeformerFP15J3DVertexBufferUs
|
||||
*/
|
||||
void J3DDeformer::deform(J3DVertexBuffer* buffer, u16 param_1) {
|
||||
J3D_ASSERT(222, buffer, "Error : null pointer");
|
||||
J3D_ASSERT_NULLPTR(222, buffer);
|
||||
|
||||
u16 var_r31 = 0;
|
||||
if (mAnmCluster != NULL) {
|
||||
@@ -246,19 +239,29 @@ void J3DDeformer::deform_VtxNrmF32(J3DVertexBuffer* i_buffer, J3DCluster* i_clus
|
||||
/* 8032EAB4-8032EBCC 3293F4 0118+00 1/1 0/0 0/0 .text deform__11J3DDeformerFP15J3DVertexBufferUsPf
|
||||
*/
|
||||
void J3DDeformer::deform(J3DVertexBuffer* i_buffer, u16 param_1, f32* i_weights) {
|
||||
if (checkFlag(2) && i_buffer->getVertexData()->getVtxPosType() == 4) {
|
||||
J3DCluster* cluster = mDeformData->getClusterPointer(param_1);
|
||||
u16 offset = 0;
|
||||
for (u16 i = 0; i < param_1; i++) {
|
||||
offset += mDeformData->getClusterPointer(i)->mKeyNum + 1;
|
||||
}
|
||||
J3DClusterKey* clusterKey = mDeformData->getClusterKeyPointer(offset);
|
||||
|
||||
normalizeWeight(cluster->mKeyNum, i_weights);
|
||||
deform_VtxPosF32(i_buffer, cluster, clusterKey, i_weights);
|
||||
if (checkFlag(1) && cluster->mFlags != 0 && i_buffer->getVertexData()->getVtxNrmType() == 4)
|
||||
{
|
||||
deform_VtxNrmF32(i_buffer, cluster, clusterKey, i_weights);
|
||||
J3D_ASSERT_NULLPTR(505, i_buffer != NULL);
|
||||
|
||||
if (checkFlag(2)) {
|
||||
JUT_ASSERT_MSG(512, i_buffer->getVertexData()->getVtxPosType() == 4, "Error : Invalid Verex Format");
|
||||
if (i_buffer->getVertexData()->getVtxPosType() == 4) {
|
||||
J3DCluster* cluster = mDeformData->getClusterPointer(param_1);
|
||||
u16 offset = 0;
|
||||
J3DClusterKey* clusterKey = NULL;
|
||||
|
||||
for (u16 i = 0; i < param_1; i++) {
|
||||
offset += mDeformData->getClusterPointer(i)->mKeyNum + 1;
|
||||
}
|
||||
|
||||
clusterKey = mDeformData->getClusterKeyPointer(offset);
|
||||
|
||||
int var_r23 = cluster->mKeyNum;
|
||||
normalizeWeight(var_r23, i_weights);
|
||||
deform_VtxPosF32(i_buffer, cluster, clusterKey, i_weights);
|
||||
|
||||
if (checkFlag(1) && cluster->mFlags != 0 && i_buffer->getVertexData()->getVtxNrmType() == 4)
|
||||
{
|
||||
deform_VtxNrmF32(i_buffer, cluster, clusterKey, i_weights);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,6 +273,7 @@ void J3DDeformer::normalizeWeight(int i_keyNum, f32* i_weights) {
|
||||
for (u16 i = 0; i < i_keyNum; i++) {
|
||||
totalWeight += i_weights[i];
|
||||
}
|
||||
|
||||
f32 scale = 1.0f / totalWeight;
|
||||
for (u16 i = 0; i < i_keyNum; i++) {
|
||||
i_weights[i] *= scale;
|
||||
|
||||
@@ -24,7 +24,6 @@ void J3DMtxCalcJ3DSysInitMaya::init(Vec const& scale, Mtx const& mtx) {
|
||||
J3DSys::mCurrentS.z);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515F0-804515F4 000AF0 0004+00 3/3 1/1 0/0 .sbss mMtxBuffer__10J3DMtxCalc */
|
||||
J3DMtxBuffer* J3DMtxCalc::mMtxBuffer;
|
||||
|
||||
@@ -180,7 +179,7 @@ void J3DJoint::entryIn() {
|
||||
j3dSys.getDrawBuffer(0)->setZMtx(anmMtx);
|
||||
j3dSys.getDrawBuffer(1)->setZMtx(anmMtx);
|
||||
for (J3DMaterial* mesh = mMesh; mesh != NULL;) {
|
||||
if (mesh->getShape()->checkFlag(1)) {
|
||||
if (mesh->getShape()->checkFlag(J3DShpFlag_Visible)) {
|
||||
mesh = mesh->getNext();
|
||||
} else {
|
||||
J3DMatPacket* matPacket = j3dSys.getModel()->getMatPacket(mesh->getIndex());
|
||||
@@ -207,7 +206,6 @@ void J3DJoint::entryIn() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515F8-80451600 000AF8 0004+04 1/1 1/1 0/0 .sbss mCurrentMtxCalc__8J3DJoint */
|
||||
J3DMtxCalc* J3DJoint::mCurrentMtxCalc;
|
||||
|
||||
@@ -265,4 +263,4 @@ void J3DJoint::recursiveCalc() {
|
||||
if (younger != NULL) {
|
||||
younger->recursiveCalc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,15 @@
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
|
||||
enum {
|
||||
kTypeEnd = 0x00,
|
||||
kTypeBeginChild = 0x01,
|
||||
kTypeEndChild = 0x02,
|
||||
kTypeJoint = 0x10,
|
||||
kTypeMaterial = 0x11,
|
||||
kTypeShape = 0x12,
|
||||
};
|
||||
|
||||
/* 80325A18-80325A9C 320358 0084+00 0/0 1/1 0/0 .text __ct__12J3DJointTreeFv */
|
||||
J3DJointTree::J3DJointTree()
|
||||
: mHierarchy(NULL), mFlags(0), mModelDataType(0), mRootNode(NULL), mBasicMtxCalc(NULL),
|
||||
@@ -13,52 +22,34 @@ J3DJointTree::J3DJointTree()
|
||||
/* 80325A9C-80325C00 3203DC 0164+00 1/0 2/2 0/0 .text
|
||||
* makeHierarchy__12J3DJointTreeFP8J3DJointPPC17J3DModelHierarchyP16J3DMaterialTableP13J3DShapeTable
|
||||
*/
|
||||
void J3DJointTree::makeHierarchy(J3DJoint* pJoint, J3DModelHierarchy const** pHierarchy,
|
||||
void J3DJointTree::makeHierarchy(J3DJoint* pJoint, const J3DModelHierarchy** pHierarchy,
|
||||
J3DMaterialTable* pMaterialTable, J3DShapeTable* pShapeTable) {
|
||||
enum {
|
||||
kTypeEnd = 0x00,
|
||||
kTypeBeginChild = 0x01,
|
||||
kTypeEndChild = 0x02,
|
||||
kTypeJoint = 0x10,
|
||||
kTypeMaterial = 0x11,
|
||||
kTypeShape = 0x12,
|
||||
};
|
||||
|
||||
J3DJoint * curJoint = pJoint;
|
||||
J3D_ASSERT_NULLPTR(95, pHierarchy != NULL);
|
||||
J3DJoint* curJoint = pJoint;
|
||||
|
||||
while (true) {
|
||||
J3DJoint * newJoint = NULL;
|
||||
J3DMaterial * newMaterial = NULL;
|
||||
J3DShape * newShape = NULL;
|
||||
const J3DModelHierarchy * inf = *pHierarchy;
|
||||
u16 val;
|
||||
J3DJoint* newJoint = NULL;
|
||||
J3DMaterial* newMaterial = NULL;
|
||||
J3DShape* newShape = NULL;
|
||||
|
||||
switch (inf->mType) {
|
||||
switch ((*pHierarchy)->mType) {
|
||||
case kTypeBeginChild:
|
||||
*pHierarchy = inf + 1;
|
||||
(*pHierarchy)++;
|
||||
makeHierarchy(curJoint, pHierarchy, pMaterialTable, pShapeTable);
|
||||
break;
|
||||
case kTypeEndChild:
|
||||
*pHierarchy = inf + 1;
|
||||
(*pHierarchy)++;
|
||||
return;
|
||||
case kTypeEnd:
|
||||
return;
|
||||
case kTypeJoint:
|
||||
{
|
||||
J3DJoint ** jointNodePointer = mJointNodePointer;
|
||||
*pHierarchy = inf + 1;
|
||||
newJoint = jointNodePointer[inf->mValue];
|
||||
}
|
||||
newJoint = mJointNodePointer[((*pHierarchy)++)->mValue];
|
||||
break;
|
||||
case kTypeMaterial:
|
||||
*pHierarchy = inf + 1;
|
||||
val = inf->mValue;
|
||||
newMaterial = pMaterialTable->getMaterialNodePointer(val);
|
||||
newMaterial = pMaterialTable->getMaterialNodePointer(((*pHierarchy)++)->mValue);
|
||||
break;
|
||||
case kTypeShape:
|
||||
*pHierarchy = inf + 1;
|
||||
val = inf->mValue;
|
||||
newShape = pShapeTable->getShapeNodePointer(val);
|
||||
newShape = pShapeTable->getShapeNodePointer(((*pHierarchy)++)->mValue);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -68,31 +59,29 @@ void J3DJointTree::makeHierarchy(J3DJoint* pJoint, J3DModelHierarchy const** pHi
|
||||
mRootNode = newJoint;
|
||||
else
|
||||
pJoint->appendChild(newJoint);
|
||||
} else if (newMaterial != NULL) {
|
||||
if (pJoint->getMesh() != NULL)
|
||||
newMaterial->mNext = pJoint->getMesh();
|
||||
pJoint->mMesh = newMaterial;
|
||||
newMaterial->mJoint = pJoint;
|
||||
} else if (newShape != NULL) {
|
||||
newMaterial = pJoint->getMesh();
|
||||
newMaterial->mShape = newShape;
|
||||
newShape->mMaterial = newMaterial;
|
||||
} else if (newMaterial != NULL && pJoint->getType() == 'NJNT') {
|
||||
pJoint->addMesh(newMaterial);
|
||||
newMaterial->setJoint(pJoint);
|
||||
} else if (newShape != NULL && pJoint->getType() == 'NJNT') {
|
||||
J3DMaterial* newMaterial = pJoint->getMesh();
|
||||
newMaterial->addShape(newShape);
|
||||
newShape->setMaterial(newMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 80325C00-80325CAC 320540 00AC+00 0/0 2/2 0/0 .text findImportantMtxIndex__12J3DJointTreeFv */
|
||||
void J3DJointTree::findImportantMtxIndex() {
|
||||
const s32 wEvlpMtxNum = getWEvlpMtxNum();
|
||||
s32 wEvlpMtxNum = getWEvlpMtxNum();
|
||||
u32 tableIdx = 0;
|
||||
const u16 drawFullWgtMtxNum = getDrawFullWgtMtxNum();
|
||||
const u16 * wEvlpMixIndex = getWEvlpMixMtxIndex();
|
||||
const f32 * wEvlpMixWeight = getWEvlpMixWeight();
|
||||
u16 * wEvlpImportantMtxIdx = getWEvlpImportantMtxIndex();
|
||||
u16 drawFullWgtMtxNum = getDrawFullWgtMtxNum();
|
||||
u16* wEvlpMixIndex = getWEvlpMixMtxIndex();
|
||||
f32* wEvlpMixWeight = getWEvlpMixWeight();
|
||||
u16* wEvlpImportantMtxIdx = getWEvlpImportantMtxIndex();
|
||||
|
||||
// Rigid matrices are easy.
|
||||
for (u16 i = 0; i < drawFullWgtMtxNum; i++)
|
||||
wEvlpImportantMtxIdx[i] = mDrawMtxData.mDrawMtxIndex[i];
|
||||
wEvlpImportantMtxIdx[i] = getDrawMtxIndex(i);
|
||||
|
||||
// For envelope matrices, we need to find the matrix with the most contribution.
|
||||
for (s32 i = 0; i < wEvlpMtxNum; i++) {
|
||||
@@ -100,26 +89,25 @@ void J3DJointTree::findImportantMtxIndex() {
|
||||
u16 bestIdx = 0;
|
||||
f32 bestWeight = -0.1f;
|
||||
|
||||
for (s32 j = 0; j < mixNum; j++) {
|
||||
for (s32 j = 0; j < mixNum; j++, tableIdx++) {
|
||||
if (bestWeight < wEvlpMixWeight[tableIdx]) {
|
||||
bestWeight = wEvlpMixWeight[tableIdx];
|
||||
bestIdx = wEvlpMixIndex[tableIdx];
|
||||
}
|
||||
|
||||
tableIdx++;
|
||||
}
|
||||
|
||||
wEvlpImportantMtxIdx[i + mDrawMtxData.mDrawFullWgtMtxNum] = bestIdx;
|
||||
wEvlpImportantMtxIdx[i + getDrawFullWgtMtxNum()] = bestIdx;
|
||||
}
|
||||
}
|
||||
|
||||
/* 80325CAC-80325D1C 3205EC 0070+00 1/0 0/0 0/0 .text
|
||||
* calc__12J3DJointTreeFP12J3DMtxBufferRC3VecRA3_A4_Cf */
|
||||
void J3DJointTree::calc(J3DMtxBuffer* pMtxBuffer, Vec const& scale, f32 const (&mtx)[3][4]) {
|
||||
J3D_ASSERT_NULLPTR(217, pMtxBuffer != NULL);
|
||||
getBasicMtxCalc()->init(scale, mtx);
|
||||
J3DMtxCalc::setMtxBuffer(pMtxBuffer);
|
||||
J3DJoint* root = getRootNode();
|
||||
getBasicMtxCalc()->setMtxBuffer(pMtxBuffer);
|
||||
|
||||
J3DJoint* root = getRootNode();
|
||||
if (root == NULL)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,22 +1,5 @@
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "dol2asm.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" void calc__14J3DMaterialAnmCFP11J3DMaterial();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
extern "C" void __dt__14J3DMaterialAnmFv();
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
void J3DMaterialAnm::initialize() {
|
||||
for (int i = 0; i < ARRAY_SIZE(mMatColorAnm); i++) {
|
||||
@@ -40,10 +23,12 @@ void J3DMaterialAnm::initialize() {
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::calc(J3DMaterial* pMat) const {
|
||||
void J3DMaterialAnm::calc(J3DMaterial* pMaterial) const {
|
||||
J3D_ASSERT_NULLPTR(54, pMaterial != NULL);
|
||||
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mMatColorAnm); i++) {
|
||||
if (mMatColorAnm[i].getAnmFlag()) {
|
||||
_GXColor* color = pMat->getColorBlock()->getMatColor(i);
|
||||
GXColor* color = pMaterial->mColorBlock->getMatColor(i);
|
||||
mMatColorAnm[i].calc(color);
|
||||
}
|
||||
}
|
||||
@@ -52,77 +37,78 @@ void J3DMaterialAnm::calc(J3DMaterial* pMat) const {
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTexNoAnm); i++) {
|
||||
if (mTexNoAnm[i].getAnmFlag()) {
|
||||
mTexNoAnm[i].calc(&tmp);
|
||||
pMat->getTevBlock()->setTexNo(i, tmp);
|
||||
pMaterial->mTevBlock->setTexNo(i, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < 3; i++) {
|
||||
if (mTevColorAnm[i].getAnmFlag()) {
|
||||
_GXColorS10* color = pMat->getTevBlock()->getTevColor(i);
|
||||
GXColorS10* color = pMaterial->mTevBlock->getTevColor(i);
|
||||
mTevColorAnm[i].calc(color);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTevKColorAnm); i++) {
|
||||
if (mTevKColorAnm[i].getAnmFlag()) {
|
||||
_GXColor* color = pMat->getTevBlock()->getTevKColor(i);
|
||||
GXColor* color = pMaterial->mTevBlock->getTevKColor(i);
|
||||
mTevKColorAnm[i].calc(color);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTexMtxAnm); i++) {
|
||||
if (mTexMtxAnm[i].getAnmFlag()) {
|
||||
J3DTexMtx* texMtx = pMat->getTexGenBlock()->getTexMtx(i);
|
||||
mTexMtxAnm[i].calc(&texMtx->getTexMtxInfo().mSRT);
|
||||
J3DTextureSRTInfo* pSRT = &pMaterial->mTexGenBlock->getTexMtx(i)->getTexMtxInfo().mSRT;
|
||||
mTexMtxAnm[i].calc(pSRT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setMatColorAnm(int idx, J3DMatColorAnm* p_matColorAnm) {
|
||||
if (p_matColorAnm == NULL) {
|
||||
void J3DMaterialAnm::setMatColorAnm(int idx, J3DMatColorAnm* pMatColorAnm) {
|
||||
J3D_ASSERT_RANGE(106, idx >= 0 && idx < 2);
|
||||
|
||||
if (pMatColorAnm == NULL) {
|
||||
mMatColorAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mMatColorAnm[idx] = *p_matColorAnm;
|
||||
mMatColorAnm[idx] = *pMatColorAnm;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setTexMtxAnm(int idx, J3DTexMtxAnm* p_texMtxAnm) {
|
||||
if (p_texMtxAnm == NULL) {
|
||||
void J3DMaterialAnm::setTexMtxAnm(int idx, J3DTexMtxAnm* pTexMtxAnm) {
|
||||
J3D_ASSERT_RANGE(117, idx >= 0 && idx < 8);
|
||||
|
||||
if (pTexMtxAnm == NULL) {
|
||||
mTexMtxAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mTexMtxAnm[idx] = *p_texMtxAnm;
|
||||
mTexMtxAnm[idx] = *pTexMtxAnm;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setTexNoAnm(int idx, J3DTexNoAnm* p_texNoAnm) {
|
||||
if (p_texNoAnm == NULL) {
|
||||
void J3DMaterialAnm::setTexNoAnm(int idx, J3DTexNoAnm* pTexNoAnm) {
|
||||
J3D_ASSERT_RANGE(128, idx >= 0 && idx < 8);
|
||||
|
||||
if (pTexNoAnm == NULL) {
|
||||
mTexNoAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mTexNoAnm[idx] = *p_texNoAnm;
|
||||
mTexNoAnm[idx] = *pTexNoAnm;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setTevColorAnm(int idx, J3DTevColorAnm* p_tevColorAnm) {
|
||||
if (p_tevColorAnm == NULL) {
|
||||
void J3DMaterialAnm::setTevColorAnm(int idx, J3DTevColorAnm* pTevColorAnm) {
|
||||
J3D_ASSERT_RANGE(139, idx >= 0 && idx < 4);
|
||||
|
||||
if (pTevColorAnm == NULL) {
|
||||
mTevColorAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mTevColorAnm[idx] = *p_tevColorAnm;
|
||||
mTevColorAnm[idx] = *pTevColorAnm;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setTevKColorAnm(int idx, J3DTevKColorAnm* p_tevKColorAnm) {
|
||||
if (p_tevKColorAnm == NULL) {
|
||||
void J3DMaterialAnm::setTevKColorAnm(int idx, J3DTevKColorAnm* pTevKColorAnm) {
|
||||
J3D_ASSERT_RANGE(150, idx >= 0 && idx < 4);
|
||||
|
||||
if (pTevKColorAnm == NULL) {
|
||||
mTevKColorAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mTevKColorAnm[idx] = *p_tevKColorAnm;
|
||||
mTevKColorAnm[idx] = *pTevKColorAnm;
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803CEE60-803CEE70 02BF80 0010+00 0/0 10/10 74/74 .data __vt__14J3DMaterialAnm */
|
||||
SECTION_DATA extern void* __vt__14J3DMaterialAnm[4] = {
|
||||
(void*)NULL /* RTTI */,
|
||||
(void*)NULL,
|
||||
(void*)__dt__14J3DMaterialAnmFv,
|
||||
(void*)calc__14J3DMaterialAnmCFP11J3DMaterial,
|
||||
};
|
||||
@@ -1,8 +1,3 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DMaterialAttach
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
@@ -38,13 +33,14 @@ J3DMaterialTable::~J3DMaterialTable() {}
|
||||
/* 8032F64C-8032F6F8 329F8C 00AC+00 0/0 1/1 5/5 .text
|
||||
* removeMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor */
|
||||
int J3DMaterialTable::removeMatColorAnimator(J3DAnmColor* pAnmColor) {
|
||||
JUT_ASSERT_MSG(208, pAnmColor != NULL, "Error : null pointer.")
|
||||
J3D_ASSERT_NULLPTR(208, pAnmColor != NULL);
|
||||
int ret = false;
|
||||
|
||||
u16 updateMatNum = pAnmColor->getUpdateMaterialNum();
|
||||
for (u16 i = 0; i < updateMatNum; i++) {
|
||||
if (pAnmColor->isValidUpdateMaterialID(i)) {
|
||||
u16 materialUpdateId = pAnmColor->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(materialUpdateId)->getMaterialAnm();
|
||||
u16 matNo = pAnmColor->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
if (materialAnm == NULL) {
|
||||
ret = true;
|
||||
} else {
|
||||
@@ -52,22 +48,23 @@ int J3DMaterialTable::removeMatColorAnimator(J3DAnmColor* pAnmColor) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 8032F6F8-8032F7B4 32A038 00BC+00 0/0 5/5 10/10 .text
|
||||
* removeTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern */
|
||||
int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* anm) {
|
||||
JUT_ASSERT_MSG(242, anm != NULL, "Error : null pointer.")
|
||||
int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* pAnmTexPattern) {
|
||||
J3D_ASSERT_NULLPTR(242, pAnmTexPattern != NULL);
|
||||
int ret = 0;
|
||||
u16 materialNum = anm->getUpdateMaterialNum();
|
||||
J3DAnmTexPatternFullTable* anm_table = (J3DAnmTexPatternFullTable*)anm->getAnmTable();
|
||||
|
||||
u16 materialNum = pAnmTexPattern->getUpdateMaterialNum();
|
||||
J3DAnmTexPatternFullTable* anm_table = (J3DAnmTexPatternFullTable*)pAnmTexPattern->getAnmTable();
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (anm->isValidUpdateMaterialID(i)) {
|
||||
u16 materialID = anm->getUpdateMaterialID(i);
|
||||
|
||||
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(materialID)->getMaterialAnm();
|
||||
if (pAnmTexPattern->isValidUpdateMaterialID(i)) {
|
||||
u16 matNo = pAnmTexPattern->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
u8 texNo = anm_table[i].mTexNo;
|
||||
if (pMatAnm == NULL)
|
||||
ret = 1;
|
||||
@@ -81,19 +78,20 @@ int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* anm) {
|
||||
|
||||
/* 8032F7B4-8032F880 32A0F4 00CC+00 0/0 4/4 26/26 .text
|
||||
* removeTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
|
||||
int J3DMaterialTable::removeTexMtxAnimator(J3DAnmTextureSRTKey* pAnm) {
|
||||
JUT_ASSERT_MSG(278, pAnm != NULL, "Error : null pointer.")
|
||||
int J3DMaterialTable::removeTexMtxAnimator(J3DAnmTextureSRTKey* pAnmTexSRTKey) {
|
||||
J3D_ASSERT_NULLPTR(278, pAnmTexSRTKey != NULL);
|
||||
s32 ret = 0;
|
||||
u16 materialNum = pAnm->getUpdateMaterialNum();
|
||||
|
||||
u16 materialNum = pAnmTexSRTKey->getUpdateMaterialNum();
|
||||
u16 postUpdateMaterialNum[1];
|
||||
postUpdateMaterialNum[0] = pAnm->getPostUpdateMaterialNum();
|
||||
postUpdateMaterialNum[0] = pAnmTexSRTKey->getPostUpdateMaterialNum();
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (pAnm->isValidUpdateMaterialID(i)) {
|
||||
u16 updateMaterial = pAnm->getUpdateMaterialID(i);
|
||||
J3DMaterial* pMaterial = getMaterialNodePointer(updateMaterial);
|
||||
if (pAnmTexSRTKey->isValidUpdateMaterialID(i)) {
|
||||
u16 matNo = pAnmTexSRTKey->getUpdateMaterialID(i);
|
||||
J3DMaterial* pMaterial = getMaterialNodePointer(matNo);
|
||||
J3DMaterialAnm* pMatAnm = pMaterial->getMaterialAnm();
|
||||
u8 texMtxID = pAnm->getUpdateTexMtxID(i);
|
||||
u8 texMtxID = pAnmTexSRTKey->getUpdateTexMtxID(i);
|
||||
if (pMatAnm == NULL) {
|
||||
ret = 1;
|
||||
} else if (texMtxID != 0xFF) {
|
||||
@@ -107,15 +105,19 @@ int J3DMaterialTable::removeTexMtxAnimator(J3DAnmTextureSRTKey* pAnm) {
|
||||
|
||||
/* 8032F880-8032F9C0 32A1C0 0140+00 0/0 7/7 24/24 .text
|
||||
* removeTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey */
|
||||
int J3DMaterialTable::removeTevRegAnimator(J3DAnmTevRegKey* pAnm) {
|
||||
int J3DMaterialTable::removeTevRegAnimator(J3DAnmTevRegKey* pAnmTevRegKey) {
|
||||
J3D_ASSERT_NULLPTR(320, pAnmTevRegKey != NULL);
|
||||
s32 ret = 0;
|
||||
u16 cRegMaterialNum = pAnm->getCRegUpdateMaterialNum();
|
||||
u16 kRegMaterialNum = pAnm->getKRegUpdateMaterialNum();
|
||||
|
||||
u16 cRegMaterialNum = pAnmTevRegKey->getCRegUpdateMaterialNum();
|
||||
u16 kRegMaterialNum = pAnmTevRegKey->getKRegUpdateMaterialNum();
|
||||
|
||||
for (u16 i = 0; i < cRegMaterialNum; i++) {
|
||||
if (pAnm->getCRegUpdateMaterialID(i) != 0xFFFF) {
|
||||
J3DMaterialAnm * pMatAnm = getMaterialNodePointer(pAnm->getCRegUpdateMaterialID(i))->getMaterialAnm();
|
||||
u32 colorId = pAnm->getAnmCRegKeyTable()[i].mColorId;
|
||||
if (pAnmTevRegKey->isValidCRegUpdateMaterialID(i)) {
|
||||
const u16 spC = pAnmTevRegKey->getCRegUpdateMaterialID(i);
|
||||
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(spC)->getMaterialAnm();
|
||||
const J3DAnmCRegKeyTable* table = pAnmTevRegKey->getAnmCRegKeyTable();
|
||||
const u8 colorId = table[i].mColorId;
|
||||
if (pMatAnm == NULL)
|
||||
ret = 1;
|
||||
else
|
||||
@@ -124,9 +126,11 @@ int J3DMaterialTable::removeTevRegAnimator(J3DAnmTevRegKey* pAnm) {
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < kRegMaterialNum; i++) {
|
||||
if (pAnm->getKRegUpdateMaterialID(i) != 0xFFFF) {
|
||||
J3DMaterialAnm * pMatAnm = getMaterialNodePointer(pAnm->getKRegUpdateMaterialID(i))->getMaterialAnm();
|
||||
u32 colorId = pAnm->getAnmKRegKeyTable()[i].mColorId;
|
||||
if (pAnmTevRegKey->isValidKRegUpdateMaterialID(i)) {
|
||||
const u16 spA = pAnmTevRegKey->getKRegUpdateMaterialID(i);
|
||||
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(spA)->getMaterialAnm();
|
||||
const J3DAnmKRegKeyTable* table = pAnmTevRegKey->getAnmKRegKeyTable();
|
||||
const u8 colorId = table[i].mColorId;
|
||||
if (pMatAnm == NULL) {
|
||||
ret = 1;
|
||||
} else {
|
||||
@@ -140,99 +144,117 @@ int J3DMaterialTable::removeTevRegAnimator(J3DAnmTevRegKey* pAnm) {
|
||||
|
||||
/* 8032F9C0-8032FAF4 32A300 0134+00 1/1 0/0 0/0 .text
|
||||
* createTexMtxForAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
|
||||
int J3DMaterialTable::createTexMtxForAnimator(J3DAnmTextureSRTKey* param_1) {
|
||||
int J3DMaterialTable::createTexMtxForAnimator(J3DAnmTextureSRTKey* pTexSRTKey) {
|
||||
J3D_ASSERT_NULLPTR(382, pTexSRTKey != NULL);
|
||||
int rv = 0;
|
||||
u16 materialNum = param_1->getUpdateMaterialNum();
|
||||
|
||||
u16 materialNum = pTexSRTKey->getUpdateMaterialNum();
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (param_1->isValidUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
|
||||
u8 mtxId = param_1->getUpdateTexMtxID(i);
|
||||
if (material->getMaterialAnm() == 0) {
|
||||
if (pTexSRTKey->isValidUpdateMaterialID(i)) {
|
||||
const u16 matNo = pTexSRTKey->getUpdateMaterialID(i);
|
||||
J3DMaterial* material = getMaterialNodePointer(matNo);
|
||||
u8 texMtx = pTexSRTKey->getUpdateTexMtxID(i);
|
||||
|
||||
J3DMaterialAnm* pMaterialAnm = material->getMaterialAnm();
|
||||
if (pMaterialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
u32 mtxId2 = mtxId;
|
||||
if (mtxId2 != 0xff && material->getTexMtx(mtxId2) == 0) {
|
||||
if (texMtx != 0xff && material->getTexMtx(texMtx) == NULL) {
|
||||
J3DTexMtx* mtx = new J3DTexMtx();
|
||||
rv = 4;
|
||||
material->setTexMtx(mtxId2, mtx);
|
||||
JUT_WARN(420, "matNo<%d> : texMtx%d nothing !\n", i, mtxId);
|
||||
material->setTexMtx(texMtx, mtx);
|
||||
JUT_WARN(420, "matNo<%d> : texMtx%d nothing !\n", matNo, texMtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8032FAF4-8032FBC8 32A434 00D4+00 0/0 1/1 0/0 .text
|
||||
* entryMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor */
|
||||
int J3DMaterialTable::entryMatColorAnimator(J3DAnmColor* param_1) {
|
||||
int J3DMaterialTable::entryMatColorAnimator(J3DAnmColor* pAnmColor) {
|
||||
J3D_ASSERT_NULLPTR(450, pAnmColor != NULL);
|
||||
int rv = 0;
|
||||
u16 materialNum = param_1->getUpdateMaterialNum();
|
||||
|
||||
u16 materialNum = pAnmColor->getUpdateMaterialNum();
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (param_1->isValidUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
if (materialAnm == 0) {
|
||||
if (pAnmColor->isValidUpdateMaterialID(i)) {
|
||||
const u16 matNo = pAnmColor->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
J3DMatColorAnm matColorAnm(i, param_1);
|
||||
J3DMatColorAnm matColorAnm(i, pAnmColor);
|
||||
materialAnm->setMatColorAnm(0, &matColorAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8032FBC8-8032FCC4 32A508 00FC+00 0/0 7/7 1/1 .text
|
||||
* entryTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern */
|
||||
int J3DMaterialTable::entryTexNoAnimator(J3DAnmTexPattern* param_1) {
|
||||
int J3DMaterialTable::entryTexNoAnimator(J3DAnmTexPattern* pAnmTexPattern) {
|
||||
J3D_ASSERT_NULLPTR(489, pAnmTexPattern != NULL);
|
||||
int rv = 0;
|
||||
u16 materialNum = param_1->getUpdateMaterialNum();
|
||||
|
||||
u16 materialNum = pAnmTexPattern->getUpdateMaterialNum();
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (param_1->isValidUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
u8 texNo = param_1->getAnmTable()[i].mTexNo;
|
||||
if (materialAnm == 0) {
|
||||
if (pAnmTexPattern->isValidUpdateMaterialID(i)) {
|
||||
const u16 matNo = pAnmTexPattern->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
const J3DAnmTexPatternFullTable* table = pAnmTexPattern->getAnmTable();
|
||||
const u8 texNo = table[i].mTexNo;
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
J3DTexNoAnm texNoAnm(i, param_1);
|
||||
J3DTexNoAnm texNoAnm(i, pAnmTexPattern);
|
||||
materialAnm->setTexNoAnm(texNo, &texNoAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8032FCC4-8032FE70 32A604 01AC+00 0/0 14/14 6/6 .text
|
||||
* entryTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
|
||||
int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* btk) {
|
||||
JUT_ASSERT_MSG(532, btk != NULL, "Error : null pointer.")
|
||||
int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* pAnmTexSRTKey) {
|
||||
J3D_ASSERT_NULLPTR(532, pAnmTexSRTKey != NULL);
|
||||
int rv = 0;
|
||||
u16 materialNum = btk->getUpdateMaterialNum();
|
||||
rv = createTexMtxForAnimator(btk);
|
||||
u16 materialNum = pAnmTexSRTKey->getUpdateMaterialNum();
|
||||
|
||||
rv = createTexMtxForAnimator(pAnmTexSRTKey);
|
||||
if (rv != 0) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 no = 0; no < materialNum; no++) {
|
||||
if (btk->isValidUpdateMaterialID(no)) {
|
||||
u16 updateMaterialId = btk->getUpdateMaterialID(no);
|
||||
J3DMaterial* material = getMaterialNodePointer((u16)updateMaterialId);
|
||||
if (pAnmTexSRTKey->isValidUpdateMaterialID(no)) {
|
||||
const u16 matNo = pAnmTexSRTKey->getUpdateMaterialID(no);
|
||||
J3DMaterial* material = getMaterialNodePointer(matNo);
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
u8 texMtxID = btk->getUpdateTexMtxID(no);
|
||||
if (materialAnm == 0) {
|
||||
u8 texMtxID = pAnmTexSRTKey->getUpdateTexMtxID(no);
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
if (texMtxID != 0xff) {
|
||||
@@ -240,53 +262,61 @@ int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* btk) {
|
||||
material->getTexCoord(texMtxID)->setTexGenMtx((u8)texMtxID * 3 + 30);
|
||||
}
|
||||
J3DTexMtxInfo& tmtxinfo = material->getTexMtx(texMtxID)->getTexMtxInfo();
|
||||
tmtxinfo.mInfo = (tmtxinfo.mInfo & 0x3f) | (btk->getTexMtxCalcType() << 7);
|
||||
tmtxinfo.mCenter.x = btk->getSRTCenter(no)->x;
|
||||
tmtxinfo.mCenter.y = btk->getSRTCenter(no)->y;
|
||||
tmtxinfo.mCenter.z = btk->getSRTCenter(no)->z;
|
||||
J3DTexMtxAnm texMtxAnm(no, btk);
|
||||
tmtxinfo.mInfo = (tmtxinfo.mInfo & 0x3f) | (pAnmTexSRTKey->getTexMtxCalcType() << 7);
|
||||
tmtxinfo.mCenter.x = pAnmTexSRTKey->getSRTCenter(no)->x;
|
||||
tmtxinfo.mCenter.y = pAnmTexSRTKey->getSRTCenter(no)->y;
|
||||
tmtxinfo.mCenter.z = pAnmTexSRTKey->getSRTCenter(no)->z;
|
||||
J3DTexMtxAnm texMtxAnm(no, pAnmTexSRTKey);
|
||||
materialAnm->setTexMtxAnm(texMtxID, &texMtxAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8032FE70-8032FFEC 32A7B0 017C+00 0/0 10/10 4/4 .text
|
||||
* entryTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey */
|
||||
int J3DMaterialTable::entryTevRegAnimator(J3DAnmTevRegKey* param_1) {
|
||||
int J3DMaterialTable::entryTevRegAnimator(J3DAnmTevRegKey* pAnmTevRegKey) {
|
||||
J3D_ASSERT_NULLPTR(599, pAnmTevRegKey != NULL);
|
||||
int rv = 0;
|
||||
u16 cRegNum = param_1->getCRegUpdateMaterialNum();
|
||||
u16 kRegNum = param_1->getKRegUpdateMaterialNum();
|
||||
|
||||
u16 cRegNum = pAnmTevRegKey->getCRegUpdateMaterialNum();
|
||||
u16 kRegNum = pAnmTevRegKey->getKRegUpdateMaterialNum();
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < cRegNum; i++) {
|
||||
if (param_1->isValidCRegUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getCRegUpdateMaterialID(i));
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
u8 colorId = param_1->getAnmCRegKeyTable()[i].mColorId;
|
||||
if (pAnmTevRegKey->isValidCRegUpdateMaterialID(i)) {
|
||||
const u16 matNo = pAnmTevRegKey->getCRegUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
const J3DAnmCRegKeyTable* table = pAnmTevRegKey->getAnmCRegKeyTable();
|
||||
u8 colorId = table[i].mColorId;
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
J3DTevColorAnm tevColorAnm(i, param_1);
|
||||
J3DTevColorAnm tevColorAnm(i, pAnmTevRegKey);
|
||||
materialAnm->setTevColorAnm(colorId, &tevColorAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < kRegNum; i++) {
|
||||
if (param_1->isValidKRegUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getKRegUpdateMaterialID(i));
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
u32 colorId = param_1->getAnmKRegKeyTable()[i].mColorId;
|
||||
if (pAnmTevRegKey->isValidKRegUpdateMaterialID(i)) {
|
||||
const u16 matNo = pAnmTevRegKey->getKRegUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
const J3DAnmKRegKeyTable* table = pAnmTevRegKey->getAnmKRegKeyTable();
|
||||
const u8 colorId = table[i].mColorId;
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
J3DTevKColorAnm tevKColorAnm(i, param_1);
|
||||
J3DTevKColorAnm tevKColorAnm(i, pAnmTevRegKey);
|
||||
materialAnm->setTevKColorAnm(colorId, &tevKColorAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DModel
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
#define J3D_ASSERTMSG(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
|
||||
#define J3D_WARN1(LINE, MSG, ARG1) JUT_WARN(LINE, MSG, ARG1)
|
||||
|
||||
/* 80327100-80327184 321A40 0084+00 0/0 3/3 0/0 .text initialize__8J3DModelFv */
|
||||
void J3DModel::initialize() {
|
||||
@@ -36,72 +33,80 @@ void J3DModel::initialize() {
|
||||
|
||||
/* 80327184-80327300 321AC4 017C+00 0/0 3/3 0/0 .text
|
||||
* entryModelData__8J3DModelFP12J3DModelDataUlUl */
|
||||
s32 J3DModel::entryModelData(J3DModelData* p_modelData, u32 modelFlag, u32 mtxBufferFlag) {
|
||||
mModelData = p_modelData;
|
||||
s32 J3DModel::entryModelData(J3DModelData* pModelData, u32 mdlFlags, u32 mtxNum) {
|
||||
J3D_ASSERTMSG(83, pModelData != NULL, "Error : null pointer.");
|
||||
J3D_ASSERTMSG(84, mtxNum != 0, "Error : non-zero argument is specified 0.");
|
||||
int ret = kJ3DError_Success;
|
||||
|
||||
mModelData = pModelData;
|
||||
mMtxBuffer = new J3DMtxBuffer();
|
||||
|
||||
if (mMtxBuffer == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
s32 ret = mMtxBuffer->create(p_modelData, mtxBufferFlag);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
ret = createShapePacket(p_modelData);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
ret = createMatPacket(p_modelData, modelFlag);
|
||||
if (ret) {
|
||||
ret = mMtxBuffer->create(pModelData, mtxNum);
|
||||
if (ret != kJ3DError_Success) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
mVertexBuffer.setVertexData(&p_modelData->getVertexData());
|
||||
ret = createShapePacket(pModelData);
|
||||
if (ret != kJ3DError_Success) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = createMatPacket(pModelData, mdlFlags);
|
||||
if (ret != kJ3DError_Success) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
mVertexBuffer.setVertexData(&pModelData->getVertexData());
|
||||
prepareShapePackets();
|
||||
|
||||
if (modelFlag & J3DMdlFlag_Unk00001) {
|
||||
onFlag(J3DMdlFlag_Unk00001);
|
||||
if (mdlFlags & J3DMdlFlag_Unk1) {
|
||||
onFlag(J3DMdlFlag_Unk1);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk00002) {
|
||||
onFlag(J3DMdlFlag_Unk00002);
|
||||
if (mdlFlags & J3DMdlFlag_UseDefaultJ3D) {
|
||||
onFlag(J3DMdlFlag_UseDefaultJ3D);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk00010) {
|
||||
onFlag(J3DMdlFlag_Unk00010);
|
||||
if (mdlFlags & J3DMdlFlag_EnableLOD) {
|
||||
onFlag(J3DMdlFlag_EnableLOD);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk20000) {
|
||||
onFlag(J3DMdlFlag_Unk20000);
|
||||
if (mdlFlags & J3DMdlFlag_UseSharedDL) {
|
||||
onFlag(J3DMdlFlag_UseSharedDL);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk40000) {
|
||||
onFlag(J3DMdlFlag_Unk40000);
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
onFlag(J3DMdlFlag_UseSingleDL);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk80000) {
|
||||
onFlag(J3DMdlFlag_Unk80000);
|
||||
if (mdlFlags & J3DMdlFlag_DifferedDLBuffer) {
|
||||
onFlag(J3DMdlFlag_DifferedDLBuffer);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_SkinPosCpu) {
|
||||
if (mdlFlags & J3DMdlFlag_SkinPosCpu) {
|
||||
J3D_WARN1(149, "%s", "Don't forget to call J3DModel::setSkinDeform\n if you set J3DMdlFlag_SkinPosCpu.");
|
||||
onFlag(J3DMdlFlag_SkinPosCpu);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_SkinNrmCpu) {
|
||||
if (mdlFlags & J3DMdlFlag_SkinNrmCpu) {
|
||||
J3D_WARN1(154, "%s", "Don't forget to call J3DModel::setSkinDeform\n if you set J3DMdlFlag_SkinNrmCpu.");
|
||||
onFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 80327300-803273CC 321C40 00CC+00 1/1 0/0 0/0 .text createShapePacket__8J3DModelFP12J3DModelData
|
||||
*/
|
||||
s32 J3DModel::createShapePacket(J3DModelData* p_modelData) {
|
||||
if (p_modelData->getShapeNum() != 0) {
|
||||
u16 shapeNum = p_modelData->getShapeNum();
|
||||
s32 J3DModel::createShapePacket(J3DModelData* pModelData) {
|
||||
J3D_ASSERTMSG(173, pModelData != NULL, "Error : null pointer.");
|
||||
|
||||
mShapePacket = new J3DShapePacket[shapeNum];
|
||||
if (pModelData->getShapeNum() != 0) {
|
||||
mShapePacket = new J3DShapePacket[pModelData->getShapeNum()];
|
||||
|
||||
if (mShapePacket == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_modelData->getShapeNum(); i++) {
|
||||
J3DShape* shapeNode = p_modelData->getShapeNodePointer(i);
|
||||
mShapePacket[i].setShape(shapeNode);
|
||||
for (int i = 0; i < pModelData->getShapeNum(); i++) {
|
||||
mShapePacket[i].setShape(pModelData->getShapeNodePointer(i));
|
||||
mShapePacket[i].setModel(this);
|
||||
}
|
||||
}
|
||||
@@ -111,76 +116,78 @@ s32 J3DModel::createShapePacket(J3DModelData* p_modelData) {
|
||||
|
||||
/* 803273CC-803275FC 321D0C 0230+00 1/1 0/0 0/0 .text createMatPacket__8J3DModelFP12J3DModelDataUl
|
||||
*/
|
||||
s32 J3DModel::createMatPacket(J3DModelData* p_modelData, u32 flag) {
|
||||
if (p_modelData->getMaterialNum() != 0) {
|
||||
mMatPacket = new J3DMatPacket[p_modelData->getMaterialNum()];
|
||||
s32 J3DModel::createMatPacket(J3DModelData* pModelData, u32 mdlFlags) {
|
||||
J3D_ASSERTMSG(207, pModelData != NULL, "Error : null pointer.");
|
||||
s32 ret = 0;
|
||||
|
||||
if (pModelData->getMaterialNum() != 0) {
|
||||
mMatPacket = new J3DMatPacket[pModelData->getMaterialNum()];
|
||||
|
||||
if (mMatPacket == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
}
|
||||
|
||||
s32 ret;
|
||||
u16 matNum = p_modelData->getMaterialNum();
|
||||
|
||||
u32 singleDLFlag = flag & 0x40000;
|
||||
|
||||
u16 matNum = pModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
J3DMaterial* materialNode = p_modelData->getMaterialNodePointer(i);
|
||||
J3DMatPacket* pkt = mMatPacket + i;
|
||||
J3DMaterial* materialNode = pModelData->getMaterialNodePointer(i);
|
||||
J3DMatPacket* matPacket = mMatPacket + i;
|
||||
J3DShapePacket* shapePacket = mShapePacket + materialNode->getShape()->getIndex();
|
||||
|
||||
u16 shapeIndex = materialNode->getShape()->getIndex();
|
||||
J3DShapePacket* shapePacket = mShapePacket + shapeIndex;
|
||||
matPacket->setMaterial(materialNode);
|
||||
matPacket->setInitShapePacket(shapePacket);
|
||||
matPacket->addShapePacket(shapePacket);
|
||||
matPacket->setTexture(pModelData->getTexture());
|
||||
matPacket->setMaterialID(materialNode->mDiffFlag);
|
||||
|
||||
pkt->setMaterial(materialNode);
|
||||
pkt->setInitShapePacket(shapePacket);
|
||||
pkt->addShapePacket(shapePacket);
|
||||
pkt->setTexture(p_modelData->getTexture());
|
||||
pkt->setMaterialID(materialNode->mDiffFlag);
|
||||
|
||||
if (p_modelData->getModelDataType() == 1) {
|
||||
pkt->mFlags |= 0x01;
|
||||
if (pModelData->getModelDataType() == 1) {
|
||||
matPacket->lock();
|
||||
}
|
||||
|
||||
if (!!(flag & 0x80000)) {
|
||||
pkt->mpDisplayListObj = materialNode->getSharedDisplayListObj();
|
||||
if (mdlFlags & J3DMdlFlag_DifferedDLBuffer) {
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
J3D_ASSERTMSG(253, dlobj != NULL, "Error : User need to call J3DModelData::newSharedDisplayList() before using DifferedDLBuffer.");
|
||||
matPacket->setDisplayListObj(dlobj);
|
||||
} else {
|
||||
if (p_modelData->getModelDataType() == 1) {
|
||||
if (!!(flag & 0x40000)) {
|
||||
pkt->mpDisplayListObj = materialNode->getSharedDisplayListObj();
|
||||
if (pModelData->getModelDataType() == 1) {
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
matPacket->mpDisplayListObj = materialNode->getSharedDisplayListObj();
|
||||
matPacket->setDisplayListObj(matPacket->mpDisplayListObj);
|
||||
} else {
|
||||
J3DDisplayListObj* sharedDL = materialNode->getSharedDisplayListObj();
|
||||
ret = sharedDL->single_To_Double();
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
ret = dlobj->single_To_Double();
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
pkt->mpDisplayListObj = sharedDL;
|
||||
matPacket->setDisplayListObj(dlobj);
|
||||
}
|
||||
} else if (!!(flag & 0x20000)) {
|
||||
if (!!(flag & 0x40000)) {
|
||||
} else if (mdlFlags & J3DMdlFlag_UseSharedDL) {
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
ret = materialNode->newSingleSharedDisplayList(materialNode->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
pkt->mpDisplayListObj = materialNode->getSharedDisplayListObj();
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
matPacket->setDisplayListObj(dlobj);
|
||||
} else {
|
||||
ret = materialNode->newSharedDisplayList(materialNode->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
J3DDisplayListObj* sharedDL = materialNode->getSharedDisplayListObj();
|
||||
ret = sharedDL->single_To_Double();
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
ret = dlobj->single_To_Double();
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
pkt->mpDisplayListObj = sharedDL;
|
||||
matPacket->setDisplayListObj(dlobj);
|
||||
}
|
||||
} else {
|
||||
if (!!(flag & 0x40000)) {
|
||||
ret = pkt->newSingleDisplayList(materialNode->countDLSize());
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
ret = matPacket->newSingleDisplayList(materialNode->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
} else {
|
||||
ret = pkt->newDisplayList(materialNode->countDLSize());
|
||||
ret = matPacket->newDisplayList(materialNode->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
}
|
||||
@@ -192,21 +199,40 @@ s32 J3DModel::createMatPacket(J3DModelData* p_modelData, u32 flag) {
|
||||
}
|
||||
|
||||
/* 803275FC-8032767C 321F3C 0080+00 0/0 1/1 0/0 .text newDifferedDisplayList__8J3DModelFUl */
|
||||
s32 J3DModel::newDifferedDisplayList(u32 flag) {
|
||||
mDiffFlag = flag;
|
||||
s32 J3DModel::newDifferedDisplayList(u32 diffFlags) {
|
||||
mDiffFlag = diffFlags;
|
||||
|
||||
u16 shapeNum = getModelData()->getShapeNum();
|
||||
for (u16 i = 0; i < shapeNum; i++) {
|
||||
s32 ret = mShapePacket[i].newDifferedDisplayList(flag);
|
||||
s32 ret = getShapePacket(i)->newDifferedDisplayList(diffFlags);
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
void J3DModel::ptrToIndex() {
|
||||
j3dSys.setModel(this);
|
||||
j3dSys.setTexture(mModelData->getTexture());
|
||||
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
J3DMatPacket* matPacket = getMatPacket(i);
|
||||
|
||||
GDLObj dlobj;
|
||||
GDInitGDLObj(&dlobj, matPacket->getDisplayList(0), matPacket->getDisplayListSize());
|
||||
GDSetCurrent(&dlobj);
|
||||
|
||||
mModelData->getMaterialNodePointer(i)->getTevBlock()->ptrToIndex();
|
||||
|
||||
GDSetCurrent(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* 8032767C-803276B4 321FBC 0038+00 0/0 4/4 0/0 .text lock__8J3DModelFv */
|
||||
void J3DModel::lock() {
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
|
||||
int matNum = mModelData->getMaterialNum();
|
||||
for (int i = 0; i < matNum; i++) {
|
||||
mMatPacket[i].lock();
|
||||
}
|
||||
@@ -214,24 +240,34 @@ void J3DModel::lock() {
|
||||
|
||||
/* 803276B4-803276EC 321FF4 0038+00 0/0 2/2 0/0 .text unlock__8J3DModelFv */
|
||||
void J3DModel::unlock() {
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
|
||||
int matNum = mModelData->getMaterialNum();
|
||||
for (int i = 0; i < matNum; i++) {
|
||||
mMatPacket[i].unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void J3DModel::makeDL() {
|
||||
j3dSys.setModel(this);
|
||||
j3dSys.setTexture(mModelData->getTexture());
|
||||
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
j3dSys.setMatPacket(&mMatPacket[i]);
|
||||
mModelData->getMaterialNodePointer(i)->makeDisplayList();
|
||||
}
|
||||
}
|
||||
|
||||
/* 803276EC-80327858 32202C 016C+00 1/0 0/0 0/0 .text calcMaterial__8J3DModelFv */
|
||||
void J3DModel::calcMaterial() {
|
||||
j3dSys.setModel(this);
|
||||
|
||||
if (checkFlag(4)) {
|
||||
if (checkFlag(J3DMdlFlag_SkinPosCpu)) {
|
||||
j3dSys.onFlag(4);
|
||||
} else {
|
||||
j3dSys.offFlag(4);
|
||||
}
|
||||
|
||||
if (checkFlag(8)) {
|
||||
if (checkFlag(J3DMdlFlag_SkinNrmCpu)) {
|
||||
j3dSys.onFlag(8);
|
||||
} else {
|
||||
j3dSys.offFlag(8);
|
||||
@@ -249,31 +285,31 @@ void J3DModel::calcMaterial() {
|
||||
material->getMaterialAnm()->calc(material);
|
||||
}
|
||||
|
||||
int jntNo = material->getJoint()->getJntNo();
|
||||
material->calc(getAnmMtx(jntNo));
|
||||
material->calc(getAnmMtx(material->getJoint()->getJntNo()));
|
||||
}
|
||||
}
|
||||
|
||||
/* 80327858-803279A0 322198 0148+00 1/0 0/0 0/0 .text calcDiffTexMtx__8J3DModelFv */
|
||||
// NONMATCHING regalloc
|
||||
void J3DModel::calcDiffTexMtx() {
|
||||
j3dSys.setModel(this);
|
||||
|
||||
for (u16 num = mModelData->getMaterialNum(), i = 0; i < num; i++) {
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
j3dSys.setMatPacket(&mMatPacket[i]);
|
||||
J3DMaterial* materialNode = mModelData->getMaterialNodePointer(i);
|
||||
materialNode->calcDiffTexMtx(getAnmMtx(materialNode->getJoint()->getJntNo()));
|
||||
}
|
||||
|
||||
for (u16 num = mModelData->getShapeNum(), i = 0; i < num; i++) {
|
||||
u16 shapeNum = getModelData()->getShapeNum();
|
||||
for (u16 i = 0; i < shapeNum; i++) {
|
||||
J3DShapePacket* shapePacket = getShapePacket(i);
|
||||
J3DTexGenBlock* texGenBlock =
|
||||
mModelData->getShapeNodePointer(i)->getMaterial()->getTexGenBlock();
|
||||
J3DTexGenBlock* texGenBlock = mModelData->getShapeNodePointer(i)->getMaterial()->getTexGenBlock();
|
||||
|
||||
for (u16 j = 0; (int)j < 8; j++) {
|
||||
J3DTexMtx* texMtxNode = texGenBlock->getTexMtx(j);
|
||||
J3DTexMtxObj* texMtxObj = shapePacket->getTexMtxObj();
|
||||
if (texMtxNode != NULL && texMtxObj != NULL) {
|
||||
texMtxObj->setMtx(j, &texMtxNode->getMtx());
|
||||
texMtxObj->setMtx(j, texMtxNode->getMtx());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,9 +317,10 @@ void J3DModel::calcDiffTexMtx() {
|
||||
|
||||
/* 803279A0-80327A2C 3222E0 008C+00 0/0 2/2 0/0 .text diff__8J3DModelFv */
|
||||
void J3DModel::diff() {
|
||||
for (u16 n = getModelData()->getMaterialNum(), i = 0; i < n; i++) {
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
j3dSys.setMatPacket(&mMatPacket[i]);
|
||||
getModelData()->getMaterialNodePointer(i)->diff(mDiffFlag);
|
||||
mModelData->getMaterialNodePointer(i)->diff(mDiffFlag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,17 +330,19 @@ s32 J3DModel::setDeformData(J3DDeformData* p_deformData, u32 param_1) {
|
||||
mDeformData = p_deformData;
|
||||
|
||||
if (p_deformData == NULL) {
|
||||
return 0;
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
s32 ret = mVertexBuffer.copyLocalVtxArray(param_1);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (param_1 & 4) {
|
||||
p_deformData->offAllFlag(1);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 80327AA0-80327BD4 3223E0 0134+00 0/0 0/0 2/2 .text setSkinDeform__8J3DModelFP13J3DSkinDeformUl
|
||||
@@ -311,46 +350,43 @@ s32 J3DModel::setDeformData(J3DDeformData* p_deformData, u32 param_1) {
|
||||
s32 J3DModel::setSkinDeform(J3DSkinDeform* p_skinDeform, u32 flags) {
|
||||
mSkinDeform = p_skinDeform;
|
||||
|
||||
s32 ret = kJ3DError_Success;
|
||||
|
||||
if (p_skinDeform == NULL) {
|
||||
offFlag(J3DMdlFlag_SkinPosCpu);
|
||||
offFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
return 5;
|
||||
} else {
|
||||
mSkinDeform->initMtxIndexArray(mModelData);
|
||||
}
|
||||
|
||||
ret = mModelData->checkFlag(0x100);
|
||||
mSkinDeform->initMtxIndexArray(mModelData);
|
||||
|
||||
if (mModelData->checkFlag(0x100)) {
|
||||
mSkinDeform->changeFastSkinDL(mModelData);
|
||||
flags &= ~2;
|
||||
flags &= ~4;
|
||||
mSkinDeform->transformVtxPosNrm(mModelData);
|
||||
mSkinDeform->initSkinInfo(mModelData);
|
||||
}
|
||||
|
||||
s32 ret = kJ3DError_Success;
|
||||
if ((~flags & 2)) {
|
||||
ret = mVertexBuffer.allocTransformedVtxPosArray();
|
||||
if (ret != kJ3DError_Success) {
|
||||
mSkinDeform->changeFastSkinDL(mModelData);
|
||||
flags &= ~2;
|
||||
flags &= ~4;
|
||||
mSkinDeform->transformVtxPosNrm(mModelData);
|
||||
mSkinDeform->initSkinInfo(mModelData);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
if ((~flags & 2)) {
|
||||
ret = mVertexBuffer.allocTransformedVtxPosArray();
|
||||
if (ret != kJ3DError_Success) {
|
||||
offFlag(J3DMdlFlag_SkinPosCpu);
|
||||
return ret;
|
||||
}
|
||||
onFlag(J3DMdlFlag_SkinPosCpu);
|
||||
} else {
|
||||
offFlag(J3DMdlFlag_SkinPosCpu);
|
||||
return ret;
|
||||
}
|
||||
onFlag(J3DMdlFlag_SkinPosCpu);
|
||||
} else {
|
||||
offFlag(J3DMdlFlag_SkinPosCpu);
|
||||
}
|
||||
|
||||
if ((~flags & 4)) {
|
||||
ret = mVertexBuffer.allocTransformedVtxNrmArray();
|
||||
if (ret != kJ3DError_Success) {
|
||||
offFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
return ret;
|
||||
}
|
||||
onFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
} else {
|
||||
if ((~flags & 4)) {
|
||||
ret = mVertexBuffer.allocTransformedVtxNrmArray();
|
||||
if (ret != kJ3DError_Success) {
|
||||
offFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
return ret;
|
||||
}
|
||||
onFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
} else {
|
||||
offFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -360,7 +396,7 @@ s32 J3DModel::setSkinDeform(J3DSkinDeform* p_skinDeform, u32 flags) {
|
||||
void J3DModel::calcAnmMtx() {
|
||||
j3dSys.setModel(this);
|
||||
|
||||
if (checkFlag(2)) {
|
||||
if (checkFlag(J3DMdlFlag_UseDefaultJ3D)) {
|
||||
getModelData()->getJointTree().calc(mMtxBuffer, j3dDefaultScale, j3dDefaultMtx);
|
||||
} else {
|
||||
getModelData()->getJointTree().calc(mMtxBuffer, mBaseScale, mBaseTransformMtx);
|
||||
@@ -370,7 +406,7 @@ void J3DModel::calcAnmMtx() {
|
||||
/* 80327C58-80327CA4 322598 004C+00 1/1 1/1 1/1 .text calcWeightEnvelopeMtx__8J3DModelFv
|
||||
*/
|
||||
void J3DModel::calcWeightEnvelopeMtx() {
|
||||
if (getModelData()->getWEvlpMtxNum() != 0 && !checkFlag(0x10)) {
|
||||
if (getModelData()->getWEvlpMtxNum() != 0 && !checkFlag(J3DMdlFlag_EnableLOD)) {
|
||||
if (!getModelData()->checkFlag(0x100)) {
|
||||
mMtxBuffer->calcWeightEnvelopeMtx();
|
||||
}
|
||||
@@ -383,7 +419,6 @@ void J3DModel::update() {
|
||||
entry();
|
||||
}
|
||||
|
||||
|
||||
/* 80327CF0-80327E4C 322630 015C+00 1/0 0/0 0/0 .text calc__8J3DModelFv */
|
||||
void J3DModel::calc() {
|
||||
j3dSys.setModel(this);
|
||||
@@ -400,11 +435,11 @@ void J3DModel::calc() {
|
||||
j3dSys.offFlag(J3DSysFlag_SkinNrmCpu);
|
||||
}
|
||||
|
||||
getModelData()->syncJ3DSysFlags();
|
||||
mModelData->syncJ3DSysFlags();
|
||||
mVertexBuffer.frameInit();
|
||||
|
||||
if (mUnkCalc2 != NULL) {
|
||||
mUnkCalc2->calc(getModelData());
|
||||
mUnkCalc2->calc(mModelData);
|
||||
}
|
||||
|
||||
if (mDeformData != NULL) {
|
||||
@@ -447,11 +482,11 @@ void J3DModel::entry() {
|
||||
j3dSys.offFlag(J3DSysFlag_SkinNrmCpu);
|
||||
}
|
||||
|
||||
getModelData()->syncJ3DSysFlags();
|
||||
j3dSys.setTexture(getModelData()->getTexture());
|
||||
mModelData->syncJ3DSysFlags();
|
||||
j3dSys.setTexture(mModelData->getTexture());
|
||||
|
||||
for (u16 i = 0; i < getModelData()->getJointNum(); i++) {
|
||||
J3DJoint* joint = getModelData()->getJointNodePointer(i);
|
||||
for (u16 i = 0; i < mModelData->getJointNum(); i++) {
|
||||
J3DJoint* joint = mModelData->getJointNodePointer(i);
|
||||
if (joint->getMesh() != NULL) {
|
||||
joint->entryIn();
|
||||
}
|
||||
@@ -463,7 +498,7 @@ void J3DModel::viewCalc() {
|
||||
mMtxBuffer->swapDrawMtx();
|
||||
mMtxBuffer->swapNrmMtx();
|
||||
|
||||
if (mModelData->checkFlag(0x10)) {
|
||||
if (getModelData()->checkFlag(0x10)) {
|
||||
if (getMtxCalcMode() == 2) {
|
||||
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), mBaseScale, mBaseTransformMtx,
|
||||
(MtxP)&mInternalView);
|
||||
@@ -502,17 +537,16 @@ void J3DModel::calcNrmMtx() {
|
||||
|
||||
/* 803281B4-803282B8 322AF4 0104+00 1/1 0/0 0/0 .text calcBumpMtx__8J3DModelFv */
|
||||
void J3DModel::calcBumpMtx() {
|
||||
if (getModelData()->checkBumpFlag() == 1) {
|
||||
if (getModelData()->checkBumpFlag()) {
|
||||
u32 bumpMtxIdx = 0;
|
||||
u16 materialNum = getModelData()->getMaterialNum();
|
||||
u16 i = 0;
|
||||
|
||||
for (; i < materialNum; i++) {
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
J3DMaterial* material = getModelData()->getMaterialNodePointer(i);
|
||||
if (material->getNBTScale()->mbHasScale == 1) {
|
||||
if (material->getNBTScale()->mbHasScale == TRUE) {
|
||||
material->getShape()->calcNBTScale(*material->getNBTScale()->getScale(),
|
||||
getNrmMtxPtr(), getBumpMtxPtr(bumpMtxIdx));
|
||||
DCStoreRange(getBumpMtxPtr(bumpMtxIdx), getModelData()->getDrawMtxNum() * 0x24);
|
||||
DCStoreRange(getBumpMtxPtr(bumpMtxIdx), mModelData->getDrawMtxNum() * sizeof(Mtx33));
|
||||
bumpMtxIdx++;
|
||||
}
|
||||
}
|
||||
@@ -521,23 +555,24 @@ void J3DModel::calcBumpMtx() {
|
||||
|
||||
/* 803282B8-803282EC 322BF8 0034+00 1/1 0/0 0/0 .text calcBBoardMtx__8J3DModelFv */
|
||||
void J3DModel::calcBBoardMtx() {
|
||||
if (mModelData->checkBBoardFlag()) {
|
||||
if (getModelData()->checkBBoardFlag()) {
|
||||
mMtxBuffer->calcBBoardMtx();
|
||||
}
|
||||
}
|
||||
|
||||
/* 803282EC-80328350 322C2C 0064+00 2/2 0/0 0/0 .text prepareShapePackets__8J3DModelFv */
|
||||
void J3DModel::prepareShapePackets() {
|
||||
u16 shapeNum = getModelData()->getShapeNum();
|
||||
u16 shapeNum = mModelData->getShapeNum();
|
||||
|
||||
for (u16 i = 0; i < shapeNum; i++) {
|
||||
J3DShape* xx = mModelData->getShapeNodePointer(i);
|
||||
J3DShapePacket* pkt = getShapePacket(i);
|
||||
pkt->setMtxBuffer(mMtxBuffer);
|
||||
J3DShape* shapeNode = mModelData->getShapeNodePointer(i);
|
||||
J3DShapePacket* shapePacket = &mShapePacket[i];
|
||||
shapePacket->setMtxBuffer(mMtxBuffer);
|
||||
|
||||
if (getMtxCalcMode() == 2) {
|
||||
pkt->setBaseMtxPtr(&mInternalView);
|
||||
shapePacket->setBaseMtxPtr(&mInternalView);
|
||||
} else {
|
||||
pkt->setBaseMtxPtr(&j3dSys.mViewMtx);
|
||||
shapePacket->setBaseMtxPtr((Mtx*)j3dSys.getViewMtx());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
|
||||
/* 80325D88-80325DA0 3206C8 0018+00 1/1 2/2 0/0 .text clear__12J3DModelDataFv */
|
||||
void J3DModelData::clear() {
|
||||
@@ -21,16 +21,17 @@ J3DModelData::J3DModelData() {
|
||||
}
|
||||
|
||||
/* 80325E14-80325EC8 320754 00B4+00 0/0 2/2 0/0 .text newSharedDisplayList__12J3DModelDataFUl */
|
||||
s32 J3DModelData::newSharedDisplayList(u32 flag) {
|
||||
s32 J3DModelData::newSharedDisplayList(u32 mdlFlags) {
|
||||
u16 matNum = getMaterialNum();
|
||||
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
if (!!(flag & 0x40000)) {
|
||||
s32 ret = getMaterialNodePointer(i)->newSingleSharedDisplayList(getMaterialNodePointer(i)->countDLSize());
|
||||
s32 ret;
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
ret = getMaterialNodePointer(i)->newSingleSharedDisplayList(getMaterialNodePointer(i)->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
} else {
|
||||
s32 ret = getMaterialNodePointer(i)->newSharedDisplayList(getMaterialNodePointer(i)->countDLSize());
|
||||
ret = getMaterialNodePointer(i)->newSharedDisplayList(getMaterialNodePointer(i)->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
}
|
||||
@@ -39,22 +40,11 @@ s32 J3DModelData::newSharedDisplayList(u32 flag) {
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515E8-804515EC 000AE8 0004+00 1/1 0/0 0/0 .sbss sInterruptFlag$965 */
|
||||
static s32 sInterruptFlag;
|
||||
|
||||
/* 804515EC-804515F0 000AEC 0004+00 1/1 0/0 0/0 .sbss None */
|
||||
static s8 sInitInterruptFlag;
|
||||
|
||||
/* 80325EC8-80325F94 320808 00CC+00 0/0 1/1 0/0 .text indexToPtr__12J3DModelDataFv */
|
||||
void J3DModelData::indexToPtr() {
|
||||
J3DTexture* tex = getTexture();
|
||||
j3dSys.setTexture(tex);
|
||||
j3dSys.setTexture(getTexture());
|
||||
|
||||
if (!sInitInterruptFlag) {
|
||||
sInterruptFlag = OSDisableInterrupts();
|
||||
sInitInterruptFlag = true;
|
||||
}
|
||||
static BOOL sInterruptFlag = OSDisableInterrupts();
|
||||
OSDisableScheduler();
|
||||
|
||||
GDLObj gdl_obj;
|
||||
@@ -67,6 +57,7 @@ void J3DModelData::indexToPtr() {
|
||||
GDSetCurrent(&gdl_obj);
|
||||
matNode->getTevBlock()->indexToPtr();
|
||||
}
|
||||
|
||||
GDSetCurrent(NULL);
|
||||
OSEnableScheduler();
|
||||
OSRestoreInterrupts(sInterruptFlag);
|
||||
@@ -74,8 +65,7 @@ void J3DModelData::indexToPtr() {
|
||||
|
||||
/* 80325F94-8032600C 3208D4 0078+00 0/0 2/2 0/0 .text makeSharedDL__12J3DModelDataFv */
|
||||
void J3DModelData::makeSharedDL() {
|
||||
J3DTexture* tex = getTexture();
|
||||
j3dSys.setTexture(tex);
|
||||
j3dSys.setTexture(getTexture());
|
||||
|
||||
u16 matNum = getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
@@ -88,8 +78,9 @@ void J3DModelData::makeSharedDL() {
|
||||
void J3DModelData::simpleCalcMaterial(u16 idx, Mtx param_1) {
|
||||
syncJ3DSysFlags();
|
||||
|
||||
J3DMaterial* mat;
|
||||
J3DJoint* jointNode = getJointNodePointer(idx);
|
||||
for (J3DMaterial* mat = jointNode->getMesh(); mat != NULL; mat = mat->getNext()) {
|
||||
for (mat = jointNode->getMesh(); mat != NULL; mat = mat->getNext()) {
|
||||
if (mat->getMaterialAnm() != NULL) {
|
||||
mat->getMaterialAnm()->calc(mat);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DMtxBuffer
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DMtxBuffer.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
/* 804371C0-804371F0 063EE0 0030+00 1/0 0/0 0/0 .bss sNoUseDrawMtx__12J3DMtxBuffer */
|
||||
Mtx J3DMtxBuffer::sNoUseDrawMtx;
|
||||
@@ -43,7 +37,7 @@ void J3DMtxBuffer::initialize() {
|
||||
mpNrmMtxArr[1] = NULL;
|
||||
mpBumpMtxArr[0] = NULL;
|
||||
mpBumpMtxArr[1] = NULL;
|
||||
mFlags = 1;
|
||||
mMtxNum = 1;
|
||||
mCurrentViewNo = 0;
|
||||
mpUserAnmMtx = NULL;
|
||||
}
|
||||
@@ -54,33 +48,33 @@ enum {
|
||||
J3DMdlDataFlag_NoAnimation = 0x100,
|
||||
};
|
||||
|
||||
s32 J3DMtxBuffer::create(J3DModelData* p_modelData, u32 flag) {
|
||||
J3D_ASSERT(76, p_modelData, "Error : null pointer.");
|
||||
J3D_ASSERT(77, flag, "Error : non-zero argument is specified 0.");
|
||||
s32 J3DMtxBuffer::create(J3DModelData* pModelData, u32 mtxNum) {
|
||||
J3D_ASSERT_NULLPTR(76, pModelData != NULL);
|
||||
J3D_ASSERT_NONZEROARG(77, mtxNum != 0);
|
||||
|
||||
s32 ret = 0;
|
||||
mFlags = flag;
|
||||
mJointTree = &p_modelData->getJointTree();
|
||||
s32 ret = kJ3DError_Success;
|
||||
mMtxNum = mtxNum;
|
||||
mJointTree = &pModelData->getJointTree();
|
||||
|
||||
ret = createAnmMtx(p_modelData);
|
||||
ret = createAnmMtx(pModelData);
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
ret = createWeightEnvelopeMtx(p_modelData);
|
||||
ret = createWeightEnvelopeMtx(pModelData);
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
if (p_modelData->checkFlag(J3DMdlDataFlag_NoAnimation)) {
|
||||
if (pModelData->checkFlag(J3DMdlDataFlag_NoAnimation)) {
|
||||
setNoUseDrawMtx();
|
||||
} else {
|
||||
u32 loadType = getMdlDataFlag_MtxLoadType(p_modelData->getFlag());
|
||||
u32 loadType = getMdlDataFlag_MtxLoadType(pModelData->getFlag());
|
||||
switch (loadType) {
|
||||
case J3DMdlDataFlag_ConcatView:
|
||||
ret = setNoUseDrawMtx();
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
ret = createDoubleDrawMtx(p_modelData, flag);
|
||||
ret = createDoubleDrawMtx(pModelData, mtxNum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -88,10 +82,10 @@ s32 J3DMtxBuffer::create(J3DModelData* p_modelData, u32 flag) {
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
if (p_modelData->getFlag() & J3DMdlDataFlag_ConcatView) {
|
||||
p_modelData->setBumpFlag(0);
|
||||
if (pModelData->getFlag() & J3DMdlDataFlag_ConcatView) {
|
||||
pModelData->setBumpFlag(0);
|
||||
} else {
|
||||
ret = createBumpMtxArray(p_modelData, flag);
|
||||
ret = createBumpMtxArray(pModelData, mtxNum);
|
||||
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
@@ -102,10 +96,10 @@ s32 J3DMtxBuffer::create(J3DModelData* p_modelData, u32 flag) {
|
||||
|
||||
/* 80326364-803263F0 320CA4 008C+00 1/1 0/0 0/0 .text createAnmMtx__12J3DMtxBufferFP12J3DModelData
|
||||
*/
|
||||
J3DError J3DMtxBuffer::createAnmMtx(J3DModelData* p_modelData) {
|
||||
if (p_modelData->getJointNum() != 0) {
|
||||
mpScaleFlagArr = new u8[p_modelData->getJointNum()];
|
||||
mpAnmMtx = new Mtx[p_modelData->getJointNum()];
|
||||
J3DError J3DMtxBuffer::createAnmMtx(J3DModelData* pModelData) {
|
||||
if (pModelData->getJointNum() != 0) {
|
||||
mpScaleFlagArr = new u8[pModelData->getJointNum()];
|
||||
mpAnmMtx = new Mtx[pModelData->getJointNum()];
|
||||
mpUserAnmMtx = mpAnmMtx;
|
||||
}
|
||||
|
||||
@@ -115,20 +109,21 @@ s32 J3DMtxBuffer::create(J3DModelData* p_modelData, u32 flag) {
|
||||
if (mpAnmMtx == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 803263F0-8032648C 320D30 009C+00 1/1 0/0 0/0 .text
|
||||
* createWeightEnvelopeMtx__12J3DMtxBufferFP12J3DModelData */
|
||||
s32 J3DMtxBuffer::createWeightEnvelopeMtx(J3DModelData* p_modelData) {
|
||||
if (p_modelData->getWEvlpMtxNum() != 0) {
|
||||
mpEvlpScaleFlagArr = new u8[p_modelData->getWEvlpMtxNum()];
|
||||
mpWeightEvlpMtx = new Mtx[p_modelData->getWEvlpMtxNum()];
|
||||
s32 J3DMtxBuffer::createWeightEnvelopeMtx(J3DModelData* pModelData) {
|
||||
if (pModelData->getWEvlpMtxNum() != 0) {
|
||||
mpEvlpScaleFlagArr = new u8[pModelData->getWEvlpMtxNum()];
|
||||
mpWeightEvlpMtx = new Mtx[pModelData->getWEvlpMtxNum()];
|
||||
}
|
||||
|
||||
if (p_modelData->getWEvlpMtxNum() != 0 && mpEvlpScaleFlagArr == NULL)
|
||||
if (pModelData->getWEvlpMtxNum() != 0 && mpEvlpScaleFlagArr == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
if (p_modelData->getWEvlpMtxNum() != 0 && mpWeightEvlpMtx == NULL)
|
||||
if (pModelData->getWEvlpMtxNum() != 0 && mpWeightEvlpMtx == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
|
||||
return kJ3DError_Success;
|
||||
@@ -145,16 +140,16 @@ s32 J3DMtxBuffer::setNoUseDrawMtx() {
|
||||
|
||||
/* 803264B8-80326664 320DF8 01AC+00 1/1 0/0 0/0 .text
|
||||
* createDoubleDrawMtx__12J3DMtxBufferFP12J3DModelDataUl */
|
||||
s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* p_modelData, u32 num) {
|
||||
if (num != 0) {
|
||||
s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* pModelData, u32 mtxNum) {
|
||||
if (mtxNum != 0) {
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
mpDrawMtxArr[i] = new Mtx*[num];
|
||||
mpNrmMtxArr[i] = new Mtx33*[num];
|
||||
mpDrawMtxArr[i] = new Mtx*[mtxNum];
|
||||
mpNrmMtxArr[i] = new Mtx33*[mtxNum];
|
||||
mpBumpMtxArr[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (num != 0) {
|
||||
if (mtxNum != 0) {
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
if (mpDrawMtxArr[i] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
@@ -164,17 +159,17 @@ s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* p_modelData, u32 num) {
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
for (u32 j = 0; j < num; j++) {
|
||||
if (p_modelData->getDrawMtxNum() != 0) {
|
||||
mpDrawMtxArr[i][j] = new (0x20) Mtx[p_modelData->getDrawMtxNum()];
|
||||
mpNrmMtxArr[i][j] = new (0x20) Mtx33[p_modelData->getDrawMtxNum()];
|
||||
for (u32 j = 0; j < mtxNum; j++) {
|
||||
if (pModelData->getDrawMtxNum() != 0) {
|
||||
mpDrawMtxArr[i][j] = new (0x20) Mtx[pModelData->getDrawMtxNum()];
|
||||
mpNrmMtxArr[i][j] = new (0x20) Mtx33[pModelData->getDrawMtxNum()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
for (u32 j = 0; j < num; j++) {
|
||||
if (p_modelData->getDrawMtxNum() != 0) {
|
||||
for (u32 j = 0; j < mtxNum; j++) {
|
||||
if (pModelData->getDrawMtxNum() != 0) {
|
||||
if (mpDrawMtxArr[i][j] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
if (mpNrmMtxArr[i][j] == NULL)
|
||||
@@ -188,8 +183,9 @@ s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* p_modelData, u32 num) {
|
||||
|
||||
/* 80326664-803268D4 320FA4 0270+00 1/1 0/0 0/0 .text
|
||||
* createBumpMtxArray__12J3DMtxBufferFP12J3DModelDataUl */
|
||||
s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 param_1) {
|
||||
J3D_ASSERT(295, i_modelData, "Error : null pointer.");
|
||||
s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) {
|
||||
J3D_ASSERT_NULLPTR(295, i_modelData != NULL);
|
||||
|
||||
if (i_modelData->getModelDataType() == 0) {
|
||||
u16 bumpMtxNum = 0;
|
||||
u16 materialCount = 0;
|
||||
@@ -202,7 +198,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 param_1) {
|
||||
}
|
||||
}
|
||||
|
||||
if (bumpMtxNum != 0 && param_1 != 0) {
|
||||
if (bumpMtxNum != 0 && mtxNum != 0) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpBumpMtxArr[i] = new Mtx33**[(u16)materialCount];
|
||||
if (mpBumpMtxArr[i] == NULL) {
|
||||
@@ -217,7 +213,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 param_1) {
|
||||
for (u16 j = 0; j < materialNum; j++) {
|
||||
J3DMaterial* material = i_modelData->getMaterialNodePointer(j);
|
||||
if (material->getNBTScale()->mbHasScale == true) {
|
||||
mpBumpMtxArr[i][offset] = new Mtx33*[param_1];
|
||||
mpBumpMtxArr[i][offset] = new Mtx33*[mtxNum];
|
||||
if (mpBumpMtxArr[i][offset] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -233,7 +229,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 param_1) {
|
||||
for (u16 j = 0; j < materialNum; j++) {
|
||||
J3DMaterial* material = i_modelData->getMaterialNodePointer((u16)j);
|
||||
if (material->getNBTScale()->mbHasScale == true) {
|
||||
for (int k = 0; k < param_1; k++) {
|
||||
for (int k = 0; k < mtxNum; k++) {
|
||||
mpBumpMtxArr[i][offset][k] = new (0x20) Mtx33[i_modelData->getDrawMtxNum()];
|
||||
if (mpBumpMtxArr[i][offset][k] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
@@ -273,10 +269,12 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
f32* weights;
|
||||
u8* pScale;
|
||||
Mtx mtx;
|
||||
|
||||
i = -1;
|
||||
max = mJointTree->getWEvlpMtxNum();
|
||||
indices = mJointTree->getWEvlpMixMtxIndex() - 1;
|
||||
weights = mJointTree->getWEvlpMixWeight() - 1;
|
||||
|
||||
while (++i < max) {
|
||||
pScale = &mpEvlpScaleFlagArr[i];
|
||||
*pScale = 1;
|
||||
@@ -284,6 +282,7 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
weightAnmMtx[0][0] = weightAnmMtx[0][1] = weightAnmMtx[0][2] = weightAnmMtx[0][3] =
|
||||
weightAnmMtx[1][0] = weightAnmMtx[1][1] = weightAnmMtx[1][2] = weightAnmMtx[1][3] =
|
||||
weightAnmMtx[2][0] = weightAnmMtx[2][1] = weightAnmMtx[2][2] = weightAnmMtx[2][3] = 0.0f;
|
||||
|
||||
j = 0;
|
||||
mixNum = mJointTree->getWEvlpMixMtxNum(i);
|
||||
do {
|
||||
@@ -291,6 +290,7 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
worldMtx = &mpAnmMtx[idx];
|
||||
invMtx = &mJointTree->getInvJointMtx((u16)idx);
|
||||
MTXConcat(*worldMtx, *invMtx, mtx);
|
||||
|
||||
weight = *++weights;
|
||||
weightAnmMtx[0][0] += mtx[0][0] * weight;
|
||||
weightAnmMtx[0][1] += mtx[0][1] * weight;
|
||||
@@ -304,6 +304,7 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
weightAnmMtx[2][1] += mtx[2][1] * weight;
|
||||
weightAnmMtx[2][2] += mtx[2][2] * weight;
|
||||
weightAnmMtx[2][3] += mtx[2][3] * weight;
|
||||
|
||||
*pScale &= mpScaleFlagArr[idx];
|
||||
} while (++j < mixNum);
|
||||
}
|
||||
@@ -311,12 +312,17 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
|
||||
/* 80326ACC-80326D3C 32140C 0270+00 0/0 1/1 0/0 .text
|
||||
* calcDrawMtx__12J3DMtxBufferFUlRC3VecRA3_A4_Cf */
|
||||
void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, Mtx const& param_2) {
|
||||
void J3DMtxBuffer::calcDrawMtx(u32 mdlFlag, Vec const& param_1, Mtx const& param_2) {
|
||||
Mtx* sp24, *sp20;
|
||||
int sp1C = 0;
|
||||
sp20 = mpAnmMtx;
|
||||
sp24 = mpWeightEvlpMtx;
|
||||
|
||||
MtxP viewMtx;
|
||||
Mtx viewBaseMtx;
|
||||
u16 fullWgtNum;
|
||||
|
||||
switch (param_0) {
|
||||
switch (mdlFlag) {
|
||||
case 0:
|
||||
viewMtx = j3dSys.getViewMtx();
|
||||
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
|
||||
@@ -327,8 +333,7 @@ void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, Mtx const& param
|
||||
J3DPSMtxArrayConcat(viewMtx, *mpWeightEvlpMtx, *getDrawMtx(fullWgtNum),
|
||||
mJointTree->getWEvlpMtxNum());
|
||||
}
|
||||
break;
|
||||
|
||||
return;
|
||||
case 1:
|
||||
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
|
||||
for (u16 i = 0; i < fullWgtNum; i++) {
|
||||
@@ -339,7 +344,6 @@ void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, Mtx const& param
|
||||
MTXCopy(getWeightAnmMtx(i), *getDrawMtx(mJointTree->getDrawFullWgtMtxNum() + i));
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), param_1, param_2, viewBaseMtx);
|
||||
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
|
||||
@@ -351,25 +355,25 @@ void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, Mtx const& param
|
||||
*getDrawMtx(mJointTree->getDrawFullWgtMtxNum()),
|
||||
mJointTree->getWEvlpMtxNum());
|
||||
}
|
||||
break;
|
||||
return;
|
||||
default:
|
||||
JUT_ASSERT_MSG(778, 0, "Error : model flag is invalid.")
|
||||
}
|
||||
}
|
||||
|
||||
extern void J3DPSCalcInverseTranspose(Mtx p1, Mtx33 p2);
|
||||
|
||||
/* 80326D3C-80326EF0 32167C 01B4+00 0/0 1/1 0/0 .text calcNrmMtx__12J3DMtxBufferFv */
|
||||
void J3DMtxBuffer::calcNrmMtx() {
|
||||
u16 drawMtxNum = mJointTree->getDrawMtxNum();
|
||||
for (u16 i = 0; i < drawMtxNum; i++) {
|
||||
if (mJointTree->getDrawMtxFlag(i) == 0) {
|
||||
if (getScaleFlag(mJointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, getDrawMtx(i));
|
||||
setNrmMtx(i, *getDrawMtx(i));
|
||||
} else {
|
||||
J3DPSCalcInverseTranspose(*getDrawMtx(i), *getNrmMtx(i));
|
||||
}
|
||||
} else {
|
||||
if (getEnvScaleFlag(mJointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, getDrawMtx(i));
|
||||
setNrmMtx(i, *getDrawMtx(i));
|
||||
} else {
|
||||
J3DPSCalcInverseTranspose(*getDrawMtx(i), *getNrmMtx(i));
|
||||
}
|
||||
@@ -386,6 +390,7 @@ void J3DMtxBuffer::calcBBoardMtx() {
|
||||
if (mJointTree->getJointNodePointer(index)->getMtxType() == 1) {
|
||||
MtxP drawMtx = *getDrawMtx(i);
|
||||
J3DCalcBBoardMtx(drawMtx);
|
||||
|
||||
Mtx33* nrmMtx = getNrmMtx(i);
|
||||
(*nrmMtx)[0][0] = 1.0f / drawMtx[0][0];
|
||||
(*nrmMtx)[0][1] = 0.0f;
|
||||
|
||||
@@ -30,9 +30,8 @@ void J3DShapeTable::sortVcdVatCmd() {
|
||||
for (u16 next = 0; next < shapeNum; next++) {
|
||||
for (u16 prev = 0; prev < next; prev++) {
|
||||
if (mShapeNodePointer[next]->isSameVcdVatCmd(mShapeNodePointer[prev])) {
|
||||
void* nodeVatCmd = mShapeNodePointer[prev]->getVcdVatCmd();
|
||||
mShapeNodePointer[next]->setVcdVatCmd(nodeVatCmd);
|
||||
mShapeNodePointer[next]->setVcdVatCmd(mShapeNodePointer[prev]->getVcdVatCmd());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DSkinDeform
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DSkinDeform.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "string.h"
|
||||
#include <string.h>
|
||||
|
||||
/* 8032C6E4-8032C704 327024 0020+00 1/1 0/0 0/0 .text __ct__12J3DSkinNListFv */
|
||||
J3DSkinNList::J3DSkinNList() {
|
||||
@@ -78,8 +71,6 @@ void J3DSkinNList::calcSkin_VtxNrmF32(f32 (*param_0)[4], void* param_1, void* pa
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
|
||||
/* 8032C96C-8032C9B0 3272AC 0044+00 0/0 0/0 2/2 .text __ct__13J3DSkinDeformFv */
|
||||
J3DSkinDeform::J3DSkinDeform() {
|
||||
mPosData = NULL;
|
||||
@@ -94,7 +85,6 @@ J3DSkinDeform::J3DSkinDeform() {
|
||||
mSkinNList = NULL;
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80437218-80438218 063F38 1000+00 1/1 0/0 0/0 .bss sWorkArea_WEvlpMixMtx__13J3DSkinDeform */
|
||||
u16* J3DSkinDeform::sWorkArea_WEvlpMixMtx[1024];
|
||||
|
||||
@@ -103,32 +93,34 @@ f32* J3DSkinDeform::sWorkArea_WEvlpMixWeight[1024];
|
||||
|
||||
/* 8032C9B0-8032CF44 3272F0 0594+00 0/0 1/1 0/0 .text
|
||||
* initSkinInfo__13J3DSkinDeformFP12J3DModelData */
|
||||
void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
J3D_ASSERT(322, param_0, "Error : null pointer.");
|
||||
int vtxNum = param_0->getVtxNum();
|
||||
int wevlpMtxNum = param_0->getWEvlpMtxNum();
|
||||
u16* wevlpMtxIndex = param_0->getWEvlpMixMtxIndex();
|
||||
f32* wevlpMixWeights = param_0->getWEvlpMixWeight();
|
||||
void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) {
|
||||
J3D_ASSERT_NULLPTR(322, pModelData != NULL);
|
||||
|
||||
int vtxNum = pModelData->getVtxNum();
|
||||
int wevlpMtxNum = pModelData->getWEvlpMtxNum();
|
||||
u16* wevlpMtxIndex = pModelData->getWEvlpMixMtxIndex();
|
||||
f32* wevlpMixWeights = pModelData->getWEvlpMixWeight();
|
||||
int currentOffset = 0;
|
||||
|
||||
for (int i = 0; i < wevlpMtxNum; i++) {
|
||||
sWorkArea_WEvlpMixMtx[i] = wevlpMtxIndex + currentOffset;
|
||||
sWorkArea_WEvlpMixWeight[i] = wevlpMixWeights + currentOffset;
|
||||
currentOffset += param_0->getWEvlpMixMtxNum(i);
|
||||
currentOffset += pModelData->getWEvlpMixMtxNum(i);
|
||||
}
|
||||
|
||||
if (param_0->getJointNum() != 0) {
|
||||
mSkinNList = new J3DSkinNList[param_0->getJointNum()];
|
||||
if (pModelData->getJointNum() != 0) {
|
||||
mSkinNList = new J3DSkinNList[pModelData->getJointNum()];
|
||||
}
|
||||
|
||||
for (int i = 0; i < param_0->getVtxNum(); i++) {
|
||||
for (int i = 0; i < pModelData->getVtxNum(); i++) {
|
||||
u16 uVar8 = mPosData[i];
|
||||
if (uVar8 != 0xffff) {
|
||||
if (param_0->getDrawMtxFlag(uVar8) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
if (!pModelData->getDrawMtxFlag(uVar8)) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
mSkinNList[drawMtxIndex].field_0x10++;
|
||||
} else {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = param_0->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
mSkinNList[indices[j]].field_0x10++;
|
||||
@@ -136,15 +128,16 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < param_0->getNrmNum(); i++) {
|
||||
|
||||
for (int i = 0; i < pModelData->getNrmNum(); i++) {
|
||||
u16 uVar8 = mNrmData[i];
|
||||
if (uVar8 != 0xffff) {
|
||||
if (param_0->getDrawMtxFlag(uVar8) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
if (!pModelData->getDrawMtxFlag(uVar8)) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
mSkinNList[drawMtxIndex].field_0x12++;
|
||||
} else {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = param_0->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
mSkinNList[indices[j]].field_0x12++;
|
||||
@@ -152,7 +145,8 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (u16 i = 0; i < param_0->getJointNum(); i++) {
|
||||
|
||||
for (u16 i = 0; i < pModelData->getJointNum(); i++) {
|
||||
if (mSkinNList[i].field_0x10) {
|
||||
mSkinNList[i].field_0x0 = new u16[mSkinNList[i].field_0x10];
|
||||
mSkinNList[i].field_0x8 = new f32[mSkinNList[i].field_0x10];
|
||||
@@ -164,17 +158,18 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
mSkinNList[i].field_0x12 = 0;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < param_0->getVtxNum(); i++) {
|
||||
|
||||
for (int i = 0; i < pModelData->getVtxNum(); i++) {
|
||||
u16 uVar8 = mPosData[i];
|
||||
if (uVar8 != 0xffff) {
|
||||
if (param_0->getDrawMtxFlag(uVar8) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
if (!pModelData->getDrawMtxFlag(uVar8)) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int uVar9 = mSkinNList[drawMtxIndex].field_0x10++;
|
||||
mSkinNList[drawMtxIndex].field_0x0[uVar9] = i;
|
||||
mSkinNList[drawMtxIndex].field_0x8[uVar9] = 1.0f;
|
||||
} else {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = param_0->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
f32* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
@@ -185,17 +180,18 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < param_0->getNrmNum(); i++) {
|
||||
|
||||
for (int i = 0; i < pModelData->getNrmNum(); i++) {
|
||||
u16 uVar8 = mNrmData[i];
|
||||
if (uVar8 != 0xffff) {
|
||||
if (param_0->getDrawMtxFlag(uVar8) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
if (!pModelData->getDrawMtxFlag(uVar8)) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int uVar9 = mSkinNList[drawMtxIndex].field_0x12++;
|
||||
mSkinNList[drawMtxIndex].field_0x4[uVar9] = i;
|
||||
mSkinNList[drawMtxIndex].field_0xc[uVar9] = 1.0f;
|
||||
} else {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = param_0->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
f32* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
@@ -210,128 +206,133 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
|
||||
/* 80439218-80439A20 065F38 0800+08 1/1 0/0 0/0 .bss sWorkArea_MtxReg__13J3DSkinDeform
|
||||
*/
|
||||
u16 J3DSkinDeform::sWorkArea_MtxReg[1024 + 4 /* padding */];
|
||||
u16 J3DSkinDeform::sWorkArea_MtxReg[1024];
|
||||
|
||||
/* 8032CF44-8032D378 327884 0434+00 0/0 1/1 0/0 .text
|
||||
* initMtxIndexArray__13J3DSkinDeformFP12J3DModelData */
|
||||
// NONMATCHING - local_58 issue
|
||||
int J3DSkinDeform::initMtxIndexArray(J3DModelData* param_0) {
|
||||
J3D_ASSERT(507, param_0, "Error : null pointer.");
|
||||
// NONMATCHING - matches debug, not retail
|
||||
int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) {
|
||||
J3D_ASSERT_NULLPTR(507, pModelData != NULL);
|
||||
if (mPosData != NULL && mNrmData != NULL) {
|
||||
return 0;
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
mPosData = new u16[param_0->getVtxNum()];
|
||||
mPosData = new u16[pModelData->getVtxNum()];
|
||||
if (mPosData == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
for (int i = 0; i < param_0->getVtxNum(); i++) {
|
||||
for (int i = 0; i < pModelData->getVtxNum(); i++) {
|
||||
mPosData[i] = 0xffff;
|
||||
}
|
||||
|
||||
if (param_0->getNrmNum()) {
|
||||
mNrmData = new u16[param_0->getNrmNum()];
|
||||
if (pModelData->getNrmNum()) {
|
||||
mNrmData = new u16[pModelData->getNrmNum()];
|
||||
if (mNrmData == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
for (int i = 0; i < param_0->getNrmNum(); i++) {
|
||||
for (int i = 0; i < pModelData->getNrmNum(); i++) {
|
||||
mNrmData[i] = 0;
|
||||
}
|
||||
} else {
|
||||
mNrmData = NULL;
|
||||
}
|
||||
|
||||
mPosMtx = new Mtx[param_0->getJointNum()];
|
||||
mNrmMtx = new (32) Mtx33[param_0->getDrawMtxNum()];
|
||||
mPosMtx = new Mtx[pModelData->getJointNum()];
|
||||
mNrmMtx = new (32) Mtx33[pModelData->getDrawMtxNum()];
|
||||
if (mPosMtx == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
if (mNrmMtx == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
for (u16 local_6c = 0; local_6c < param_0->getShapeNum(); local_6c++) {
|
||||
u32 local_28[4] = {0,1,1,2};
|
||||
int r26 = -1;
|
||||
int r25 = -1;
|
||||
int r24 = -1;
|
||||
int stack_3c = -1;
|
||||
for (u16 i = 0; i < pModelData->getShapeNum(); i++) {
|
||||
u32 kSize[4] = {0, 1, 1, 2};
|
||||
int pnmtx_num = -1;
|
||||
int vtx_num = -1;
|
||||
int nrm_num = -1;
|
||||
int tex_num = -1;
|
||||
int r23 = 0;
|
||||
for (GXVtxDescList* local_4c = param_0->getShapeNodePointer(local_6c)->getVtxDesc(); local_4c->attr != 0xff; local_4c++) {
|
||||
switch (local_4c->attr) {
|
||||
for (GXVtxDescList* vtxDesc = pModelData->getShapeNodePointer(i)->getVtxDesc(); vtxDesc->attr != 0xff; vtxDesc++) {
|
||||
switch (vtxDesc->attr) {
|
||||
case GX_VA_PNMTXIDX:
|
||||
r26 = r23;
|
||||
pnmtx_num = r23;
|
||||
break;
|
||||
case GX_VA_POS:
|
||||
r25 = r23;
|
||||
if (local_4c->type != GX_INDEX16) {
|
||||
vtx_num = r23;
|
||||
if (vtxDesc->type != GX_INDEX16) {
|
||||
OSReport(" Invlid Data : CPU Pipeline process GX_INDEX16 Data Only\n");
|
||||
return 6;
|
||||
}
|
||||
break;
|
||||
case GX_VA_NRM:
|
||||
r24 = r23;
|
||||
if (local_4c->type != GX_INDEX16) {
|
||||
nrm_num = r23;
|
||||
if (vtxDesc->type != GX_INDEX16) {
|
||||
OSReport(" Invlid Data : CPU Pipeline process GX_INDEX16 Data Only\n");
|
||||
return 6;
|
||||
}
|
||||
break;
|
||||
case GX_VA_TEX0:
|
||||
stack_3c = r23;
|
||||
if (local_4c->type != GX_INDEX16) {
|
||||
tex_num = r23;
|
||||
if (vtxDesc->type != GX_INDEX16) {
|
||||
OSReport(" Invlid Data : CPU Pipeline process GX_INDEX16 Data Only\n");
|
||||
return 6;
|
||||
}
|
||||
break;
|
||||
}
|
||||
r23 += local_28[(int)local_4c->type];
|
||||
r23 += kSize[(int)vtxDesc->type];
|
||||
}
|
||||
for (u16 local_6e = 0; local_6e < param_0->getShapeNodePointer(local_6c)->getMtxGroupNum(); local_6e++) {
|
||||
J3DShapeMtx* piVar8 = param_0->getShapeNodePointer(local_6c)->getShapeMtx(local_6e);
|
||||
u8* pcVar10 = param_0->getShapeNodePointer(local_6c)->getShapeDraw(local_6e)->getDisplayList();
|
||||
u8* local_58 = pcVar10;
|
||||
|
||||
for (u16 j = 0; j < (u16)pModelData->getShapeNodePointer(i)->getMtxGroupNum(); j++) {
|
||||
J3DShapeMtx* pShapeMtx = pModelData->getShapeNodePointer(i)->getShapeMtx(j);
|
||||
u8* pDList = pModelData->getShapeNodePointer(i)->getShapeDraw(j)->getDisplayList();
|
||||
u8* pDListPos = pDList;
|
||||
int uVar13;
|
||||
for (;
|
||||
(int)local_58 - (int)pcVar10 < param_0->getShapeNodePointer(local_6c)->getShapeDraw(local_6e)->getDisplayListSize();
|
||||
local_58 += r23 * uVar13) {
|
||||
u8 uVar1 = *local_58;
|
||||
local_58++;
|
||||
if (uVar1 != 0xA0 && uVar1 != 0x98) {
|
||||
(int)pDListPos - (int)pDList < pModelData->getShapeNodePointer(i)->getShapeDraw(j)->getDisplayListSize();
|
||||
pDListPos += r23 * uVar13)
|
||||
{
|
||||
u8 command = *pDListPos;
|
||||
pDListPos++;
|
||||
if (command != GX_TRIANGLEFAN && command != GX_TRIANGLESTRIP) {
|
||||
break;
|
||||
}
|
||||
|
||||
uVar13 = *(u16*)local_58;
|
||||
local_58 += 2;
|
||||
uVar13 = *(u16*)pDListPos;
|
||||
pDListPos += 2;
|
||||
for (int local_60 = 0; local_60 < uVar13; local_60++) {
|
||||
u8* iVar5 = local_58 + r23 * local_60;
|
||||
u8 bVar3 = *(iVar5 + r26) / 3U;
|
||||
u16 uVar1 = *(u16*)(iVar5 + r25);
|
||||
u16 uVar2 = *(u16*)(iVar5 + r24);
|
||||
u16 uVar3 = *(u16*)(iVar5 + stack_3c);
|
||||
u16 local_76 = piVar8->getUseMtxIndex(bVar3);
|
||||
u8* iVar5 = pDListPos + r23 * local_60;
|
||||
u8 bVar3 = *(iVar5 + pnmtx_num) / 3U;
|
||||
u16 vtx_idx = *(u16*)(iVar5 + vtx_num);
|
||||
u16 nrm_idx = *(u16*)(iVar5 + nrm_num);
|
||||
u16 uVar3 = *(u16*)(iVar5 + tex_num);
|
||||
u16 local_76 = pShapeMtx->getUseMtxIndex(bVar3);
|
||||
if (local_76 == 0xffff) {
|
||||
local_76 = sWorkArea_MtxReg[bVar3];
|
||||
} else if (r26 != -1) {
|
||||
} else if (pnmtx_num != -1) {
|
||||
sWorkArea_MtxReg[bVar3] = local_76;
|
||||
}
|
||||
J3D_ASSERT(673, local_76 < param_0->getDrawMtxNum(), "Error : range over.");
|
||||
J3D_ASSERT(674, uVar1 < param_0->getVtxNum(), "Error : range over.");
|
||||
mPosData[uVar1] = local_76;
|
||||
if (r24 != -1) {
|
||||
J3D_ASSERT(680, uVar2 < param_0->getNrmNum(), "Error : range over.");
|
||||
mNrmData[uVar2] = local_76;
|
||||
|
||||
J3D_ASSERT_RANGE(673, local_76 < pModelData->getDrawMtxNum());
|
||||
J3D_ASSERT_RANGE(674, vtx_idx < pModelData->getVtxNum());
|
||||
mPosData[vtx_idx] = local_76;
|
||||
|
||||
if (nrm_num != -1) {
|
||||
J3D_ASSERT_RANGE(680, nrm_idx < pModelData->getNrmNum());
|
||||
mNrmData[nrm_idx] = local_76;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r24 == -1) {
|
||||
param_0->getShapeNodePointer(local_6c)->onFlag(0x100);
|
||||
param_0->getShapeNodePointer(local_6c)->offFlag(8);
|
||||
|
||||
if (nrm_num == -1) {
|
||||
pModelData->getShapeNodePointer(i)->onFlag(J3DShpFlag_EnableLod);
|
||||
pModelData->getShapeNodePointer(i)->offFlag(J3DShpFlag_SkinNrmCpu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < param_0->getVtxNum(); i++) {
|
||||
for (int i = 0; i < pModelData->getVtxNum(); i++) {
|
||||
if (mPosData[i] == 0xffff) {
|
||||
field_0x18 = 0x0;
|
||||
mPosData[i] = 0;
|
||||
@@ -340,36 +341,38 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* param_0) {
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 8032D378-8032D5C4 327CB8 024C+00 0/0 1/1 0/0 .text
|
||||
* changeFastSkinDL__13J3DSkinDeformFP12J3DModelData */
|
||||
// NONMATCHING - regalloc, display list access issues
|
||||
void J3DSkinDeform::changeFastSkinDL(J3DModelData* param_0) {
|
||||
J3D_ASSERT(740, param_0, "Error : null pointer.");
|
||||
for (u16 i = 0; i < param_0->getShapeNum(); i++) {
|
||||
u32 local_28[4] = {0,1,1,2};
|
||||
void J3DSkinDeform::changeFastSkinDL(J3DModelData* pModelData) {
|
||||
J3D_ASSERT_NULLPTR(740, pModelData != NULL);
|
||||
for (u16 i = 0; i < pModelData->getShapeNum(); i++) {
|
||||
u32 kSize[4] = {0,1,1,2};
|
||||
int local_30 = -1;
|
||||
int local_34 = 0;
|
||||
J3DShape* pShapeNode = param_0->getShapeNodePointer(i);
|
||||
for (GXVtxDescList* local_3c = pShapeNode->getVtxDesc(); local_3c->attr != GX_VA_NULL; local_3c++) {
|
||||
if (local_3c->attr == GX_VA_PNMTXIDX) {
|
||||
J3DShape* pShapeNode = pModelData->getShapeNodePointer(i);
|
||||
for (GXVtxDescList* vtxDesc = pShapeNode->getVtxDesc(); vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
|
||||
if (vtxDesc->attr == GX_VA_PNMTXIDX) {
|
||||
local_30 = local_34;
|
||||
}
|
||||
local_34 += local_28[local_3c->type];
|
||||
local_34 += kSize[vtxDesc->type];
|
||||
}
|
||||
|
||||
if (local_30 != -1) {
|
||||
for (u16 j = 0; j < pShapeNode->getMtxGroupNum(); j++) {
|
||||
u8* puVar5 = pShapeNode->getShapeDraw(j)->getDisplayList();
|
||||
u8* local_44 = puVar5;
|
||||
u8* puVar10 = puVar5;
|
||||
while (local_44 - puVar5 < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
|
||||
u8 cVar1 = *local_44;
|
||||
for (u16 j = 0; j < (u16)pShapeNode->getMtxGroupNum(); j++) {
|
||||
u8* pDList = pShapeNode->getShapeDraw(j)->getDisplayList();
|
||||
u8* local_44 = pDList;
|
||||
u8* puVar10 = pDList;
|
||||
while (local_44 - pDList < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
|
||||
u8 command = *local_44;
|
||||
local_44++;
|
||||
*puVar10++ = cVar1;
|
||||
if ((cVar1 != 0xA0) && (cVar1 != 0x98))
|
||||
*puVar10++ = command;
|
||||
if (command != GX_TRIANGLEFAN && command != GX_TRIANGLESTRIP)
|
||||
break;
|
||||
|
||||
int uVar9 = *(u16*)local_44;
|
||||
local_44 += 2;
|
||||
*(u16*)puVar10 = uVar9;
|
||||
@@ -381,19 +384,20 @@ void J3DSkinDeform::changeFastSkinDL(J3DModelData* param_0) {
|
||||
}
|
||||
local_44 += local_34 * uVar9;
|
||||
}
|
||||
int pcVar2 = ((int)puVar10 - (int)puVar5 + 0x1f) & ~0x1f;
|
||||
while ((int)puVar10 - (int)puVar5 < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
|
||||
|
||||
int dlistSize = ((int)puVar10 - (int)pDList + 0x1f) & ~0x1f;
|
||||
while ((int)puVar10 - (int)pDList < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
|
||||
*puVar10++ = 0;
|
||||
}
|
||||
pShapeNode->getShapeDraw(j)->setDisplayListSize(pcVar2);
|
||||
DCStoreRange(puVar5, pShapeNode->getShapeDraw(j)->getDisplayListSize());
|
||||
|
||||
pShapeNode->getShapeDraw(j)->setDisplayListSize(dlistSize);
|
||||
DCStoreRange(pDList, pShapeNode->getShapeDraw(j)->getDisplayListSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
;
|
||||
for (u16 i = 0; i < param_0->getShapeNum(); i++) {
|
||||
J3DShape* pShape = param_0->getShapeNodePointer(i);
|
||||
|
||||
for (u16 i = 0; i < pModelData->getShapeNum(); i++) {
|
||||
J3DShape* pShape = pModelData->getShapeNodePointer(i);
|
||||
GXVtxDescList* local_5c = pShape->getVtxDesc();
|
||||
GXVtxDescList* local_60 = local_5c;
|
||||
for (; local_5c->attr != GX_VA_NULL; local_5c++) {
|
||||
@@ -411,21 +415,21 @@ void J3DSkinDeform::changeFastSkinDL(J3DModelData* param_0) {
|
||||
|
||||
/* 8032D5C4-8032D738 327F04 0174+00 1/1 0/0 0/0 .text calcNrmMtx__13J3DSkinDeformFP12J3DMtxBuffer
|
||||
*/
|
||||
void J3DSkinDeform::calcNrmMtx(J3DMtxBuffer* param_0) {
|
||||
J3DJointTree* jointTree = param_0->getJointTree();
|
||||
void J3DSkinDeform::calcNrmMtx(J3DMtxBuffer* pMtxBuffer) {
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
u16 drawMtxNum = jointTree->getDrawMtxNum();
|
||||
for (u16 i = 0; i < drawMtxNum; i++) {
|
||||
if (jointTree->getDrawMtxFlag(i) == 0) {
|
||||
if (param_0->getScaleFlag(jointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, param_0->getAnmMtx(jointTree->getDrawMtxIndex(i)));
|
||||
if (pMtxBuffer->getScaleFlag(jointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, pMtxBuffer->getAnmMtx(jointTree->getDrawMtxIndex(i)));
|
||||
} else {
|
||||
J3DPSCalcInverseTranspose(param_0->getAnmMtx(jointTree->getDrawMtxIndex(i)), getNrmMtx(i));
|
||||
J3DPSCalcInverseTranspose(pMtxBuffer->getAnmMtx(jointTree->getDrawMtxIndex(i)), getNrmMtx(i));
|
||||
}
|
||||
} else {
|
||||
if (param_0->getEnvScaleFlag(jointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, param_0->getWeightAnmMtx(jointTree->getDrawMtxIndex(i)));
|
||||
if (pMtxBuffer->getEnvScaleFlag(jointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, pMtxBuffer->getWeightAnmMtx(jointTree->getDrawMtxIndex(i)));
|
||||
} else {
|
||||
J3DPSCalcInverseTranspose(param_0->getWeightAnmMtx(jointTree->getDrawMtxIndex(i)), getNrmMtx(i));
|
||||
J3DPSCalcInverseTranspose(pMtxBuffer->getWeightAnmMtx(jointTree->getDrawMtxIndex(i)), getNrmMtx(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -433,41 +437,46 @@ void J3DSkinDeform::calcNrmMtx(J3DMtxBuffer* param_0) {
|
||||
|
||||
/* 8032D738-8032D87C 328078 0144+00 0/0 1/1 0/0 .text
|
||||
* transformVtxPosNrm__13J3DSkinDeformFP12J3DModelData */
|
||||
void J3DSkinDeform::transformVtxPosNrm(J3DModelData* param_0) {
|
||||
if (param_0->getWEvlpMtxNum() != 0 && field_0x19 == 0) {
|
||||
int vtmNum = param_0->getVtxNum();
|
||||
int nrmNum = param_0->getNrmNum();
|
||||
void J3DSkinDeform::transformVtxPosNrm(J3DModelData* pModelData) {
|
||||
if (pModelData->getWEvlpMtxNum() != 0 && field_0x19 == 0) {
|
||||
int vtmNum = pModelData->getVtxNum();
|
||||
int nrmNum = pModelData->getNrmNum();
|
||||
|
||||
for (int i = 0; i < vtmNum; i++) {
|
||||
u16 posIndex = mPosData[i];
|
||||
if (param_0->getDrawMtxFlag(posIndex) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(posIndex);
|
||||
Vec* pos = ((Vec*)param_0->getVtxPosArray()) + i;
|
||||
if (pModelData->getDrawMtxFlag(posIndex) == 0) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(posIndex);
|
||||
Vec* pos = ((Vec*)pModelData->getVtxPosArray()) + i;
|
||||
Mtx invMtx;
|
||||
MTXInverse(param_0->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
MTXInverse(pModelData->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
MTXMultVec(invMtx, pos, pos);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < nrmNum; i++) {
|
||||
u16 nrmIndex = mNrmData[i];
|
||||
if (param_0->getDrawMtxFlag(nrmIndex) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(nrmIndex);
|
||||
Vec* nrm = ((Vec*)param_0->getVtxNrmArray()) + i;
|
||||
if (pModelData->getDrawMtxFlag(nrmIndex) == 0) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(nrmIndex);
|
||||
Vec* nrm = ((Vec*)pModelData->getVtxNrmArray()) + i;
|
||||
Mtx invMtx;
|
||||
MTXInverse(param_0->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
MTXInverse(pModelData->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
MTXMultVecSR(invMtx, nrm, nrm);
|
||||
}
|
||||
}
|
||||
|
||||
field_0x19 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 8032D87C-8032D8F4 3281BC 0078+00 1/1 0/0 0/0 .text
|
||||
* calcAnmInvJointMtx__13J3DSkinDeformFP12J3DMtxBuffer */
|
||||
void J3DSkinDeform::calcAnmInvJointMtx(J3DMtxBuffer* param_0) {
|
||||
if (param_0->getJointTree()->getWEvlpMtxNum() != 0) {
|
||||
u16 jointNum = param_0->getJointTree()->getJointNum();
|
||||
Mtx* anmMtx = (Mtx*)param_0->getAnmMtx(0);
|
||||
Mtx* invJointMtx = ¶m_0->getJointTree()->getInvJointMtx(0);
|
||||
void J3DSkinDeform::calcAnmInvJointMtx(J3DMtxBuffer* pMtxBuffer) {
|
||||
J3D_ASSERT_NULLPTR(978, pMtxBuffer != NULL);
|
||||
|
||||
if (pMtxBuffer->getJointTree()->getWEvlpMtxNum() != 0) {
|
||||
int jointNum = pMtxBuffer->getJointTree()->getJointNum();
|
||||
Mtx* anmMtx = (Mtx*)pMtxBuffer->getAnmMtx(0);
|
||||
Mtx* invJointMtx = &pMtxBuffer->getJointTree()->getInvJointMtx(0);
|
||||
Mtx* posMtx = mPosMtx;
|
||||
for (int i = 0; i < jointNum; i++) {
|
||||
MTXConcat(anmMtx[i], invJointMtx[i], posMtx[i]);
|
||||
@@ -477,177 +486,208 @@ void J3DSkinDeform::calcAnmInvJointMtx(J3DMtxBuffer* param_0) {
|
||||
|
||||
/* 8032D8F4-8032DA1C 328234 0128+00 1/1 0/0 0/0 .text
|
||||
* deformFastVtxPos_F32__13J3DSkinDeformCFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
void J3DSkinDeform::deformFastVtxPos_F32(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) const {
|
||||
param_0->swapTransformedVtxPos();
|
||||
J3DJointTree* jointTree = param_1->getJointTree();
|
||||
u32 vtxNum = param_0->getVertexData()->getVtxNum();
|
||||
void* currentVtxPos = param_0->getCurrentVtxPos();
|
||||
void* transformedVtxPos = param_0->getTransformedVtxPos(0);
|
||||
J3DFillZero32B(transformedVtxPos, (vtxNum * sizeof(Vec) + 0x1f) & ~0x1f);
|
||||
void J3DSkinDeform::deformFastVtxPos_F32(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) const {
|
||||
pVtxBuffer->swapTransformedVtxPos();
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
u32 vtxNum = pVtxBuffer->getVertexData()->getVtxNum();
|
||||
int sp14 = jointTree->getDrawMtxNum();
|
||||
void* currentVtxPos = pVtxBuffer->getCurrentVtxPos();
|
||||
void* transformedVtxPos = pVtxBuffer->getTransformedVtxPos(0);
|
||||
|
||||
J3DFillZero32B(transformedVtxPos, OSRoundUp32B(vtxNum * sizeof(Vec)));
|
||||
|
||||
if (jointTree->getWEvlpMtxNum() != 0) {
|
||||
u16 jointNum = jointTree->getJointNum();
|
||||
for (u16 i = 0; i < jointNum; i++) {
|
||||
mSkinNList[i].calcSkin_VtxPosF32(mPosMtx[i], currentVtxPos, transformedVtxPos);
|
||||
J3DSkinNList* skinList = mSkinNList + i;
|
||||
skinList->calcSkin_VtxPosF32(mPosMtx[i], currentVtxPos, transformedVtxPos);
|
||||
}
|
||||
} else {
|
||||
u16 jointNum = jointTree->getJointNum();
|
||||
for (u16 i = 0; i < jointNum; i++) {
|
||||
J3DSkinNList* skinList = mSkinNList + i;
|
||||
skinList->calcSkin_VtxPosF32(param_1->getAnmMtx(i), currentVtxPos, transformedVtxPos);
|
||||
skinList->calcSkin_VtxPosF32(pMtxBuffer->getAnmMtx(i), currentVtxPos, transformedVtxPos);
|
||||
}
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxPos(0), param_0->getVertexData()->getVtxNum() * sizeof(Vec));
|
||||
param_0->setCurrentVtxPos(transformedVtxPos);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxPos(0), pVtxBuffer->getVertexData()->getVtxNum() * sizeof(Vec));
|
||||
pVtxBuffer->setCurrentVtxPos(transformedVtxPos);
|
||||
}
|
||||
|
||||
/* 8032DA1C-8032DB50 32835C 0134+00 1/1 0/0 0/0 .text
|
||||
* deformFastVtxNrm_F32__13J3DSkinDeformCFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
void J3DSkinDeform::deformFastVtxNrm_F32(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) const {
|
||||
param_0->swapTransformedVtxNrm();
|
||||
J3DJointTree* jointTree = param_1->getJointTree();
|
||||
int nrmNum = param_0->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = param_0->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = param_0->getTransformedVtxNrm(0);
|
||||
void J3DSkinDeform::deformFastVtxNrm_F32(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) const {
|
||||
pVtxBuffer->swapTransformedVtxNrm();
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
int nrmNum = pVtxBuffer->getVertexData()->getNrmNum();
|
||||
int sp18 = jointTree->getDrawMtxNum();
|
||||
void* currentVtxNrm = pVtxBuffer->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = pVtxBuffer->getTransformedVtxNrm(0);
|
||||
|
||||
for (int i = 0; i < nrmNum; i++) {
|
||||
((Vec*)transformedVtxNrm)[i].x = 0.0f;
|
||||
((Vec*)transformedVtxNrm)[i].y = 0.0f;
|
||||
((Vec*)transformedVtxNrm)[i].z = 0.0f;
|
||||
((f32*)transformedVtxNrm)[(i * 3) + 0] = 0.0f;
|
||||
((f32*)transformedVtxNrm)[(i * 3) + 1] = 0.0f;
|
||||
((f32*)transformedVtxNrm)[(i * 3) + 2] = 0.0f;
|
||||
}
|
||||
|
||||
if (jointTree->getWEvlpMtxNum() != 0) {
|
||||
u16 jointNum = jointTree->getJointNum();
|
||||
for (u16 i = 0; i < jointNum; i++) {
|
||||
mSkinNList[i].calcSkin_VtxNrmF32(mPosMtx[i], currentVtxNrm, transformedVtxNrm);
|
||||
J3DSkinNList* skinList = mSkinNList + i;
|
||||
skinList->calcSkin_VtxNrmF32(mPosMtx[i], currentVtxNrm, transformedVtxNrm);
|
||||
}
|
||||
} else {
|
||||
u16 jointNum = jointTree->getJointNum();
|
||||
for (u16 i = 0; i < jointNum; i++) {
|
||||
J3DSkinNList* skinList = mSkinNList + i;
|
||||
skinList->calcSkin_VtxNrmF32(param_1->getAnmMtx(i), currentVtxNrm, transformedVtxNrm);
|
||||
skinList->calcSkin_VtxNrmF32(pMtxBuffer->getAnmMtx(i), currentVtxNrm, transformedVtxNrm);
|
||||
}
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxNrm(0), param_0->getVertexData()->getNrmNum() * sizeof(Vec));
|
||||
param_0->setCurrentVtxNrm(transformedVtxNrm);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxNrm(0), pVtxBuffer->getVertexData()->getNrmNum() * sizeof(Vec));
|
||||
pVtxBuffer->setCurrentVtxNrm(transformedVtxNrm);
|
||||
}
|
||||
|
||||
/* 8032DB50-8032DC74 328490 0124+00 1/1 0/0 0/0 .text
|
||||
* deformVtxPos_F32__13J3DSkinDeformCFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
// NONMATCHING - J3DPSMulMtxVec regalloc
|
||||
void J3DSkinDeform::deformVtxPos_F32(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) const {
|
||||
void J3DSkinDeform::deformVtxPos_F32(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) const {
|
||||
Mtx* anmMtx = NULL;
|
||||
Mtx* anmMtxs[2];
|
||||
anmMtxs[0] = (Mtx*)param_1->getAnmMtx(0);
|
||||
anmMtxs[1] = (Mtx*)param_1->getWeightAnmMtx(0);
|
||||
param_0->swapTransformedVtxPos();
|
||||
J3DJointTree* jointTree = param_1->getJointTree();
|
||||
int vtxNum = param_0->getVertexData()->getVtxNum();
|
||||
void* currentVtxPos = param_0->getCurrentVtxPos();
|
||||
void* transformedVtxPos = param_0->getTransformedVtxPos(0);
|
||||
anmMtxs[0] = (Mtx*)pMtxBuffer->getAnmMtx(0);
|
||||
anmMtxs[1] = (Mtx*)pMtxBuffer->getWeightAnmMtx(0);
|
||||
pVtxBuffer->swapTransformedVtxPos();
|
||||
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
int vtxNum = pVtxBuffer->getVertexData()->getVtxNum();
|
||||
int sp8 = jointTree->getDrawMtxNum();
|
||||
void* currentVtxPos = pVtxBuffer->getCurrentVtxPos();
|
||||
void* transformedVtxPos = pVtxBuffer->getTransformedVtxPos(0);
|
||||
|
||||
for (int i = 0; i < vtxNum; i++) {
|
||||
Mtx* anmMtx = anmMtxs[jointTree->getDrawMtxFlag(mPosData[i])];
|
||||
J3DPSMulMtxVec(anmMtx[jointTree->getDrawMtxIndex(mPosData[i])], ((Vec*)currentVtxPos) + i, ((Vec*)transformedVtxPos) + i);
|
||||
anmMtx = anmMtxs[jointTree->getDrawMtxFlag(mPosData[i])];
|
||||
J3DPSMulMtxVec(anmMtx[jointTree->getDrawMtxIndex(mPosData[i])], (Vec*)(((f32*)currentVtxPos) + (i * 3)), (Vec*)(((f32*)transformedVtxPos) + (i * 3)));
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxPos(0), param_0->getVertexData()->getVtxNum() * sizeof(Vec));
|
||||
param_0->setCurrentVtxPos(transformedVtxPos);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxPos(0), pVtxBuffer->getVertexData()->getVtxNum() * sizeof(Vec));
|
||||
pVtxBuffer->setCurrentVtxPos(transformedVtxPos);
|
||||
}
|
||||
|
||||
/* 8032DC74-8032DDB8 3285B4 0144+00 1/1 0/0 0/0 .text
|
||||
* deformVtxPos_S16__13J3DSkinDeformCFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
// NONMATCHING - J3DPSMulMtxVec regalloc
|
||||
void J3DSkinDeform::deformVtxPos_S16(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) const {
|
||||
void J3DSkinDeform::deformVtxPos_S16(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) const {
|
||||
Mtx* anmMtx = NULL;
|
||||
Mtx* anmMtxs[2];
|
||||
anmMtxs[0] = (Mtx*)param_1->getAnmMtx(0);
|
||||
anmMtxs[1] = (Mtx*)param_1->getWeightAnmMtx(0);
|
||||
u8 vtxPosFrac = param_0->getVertexData()->getVtxPosFrac();
|
||||
anmMtxs[0] = (Mtx*)pMtxBuffer->getAnmMtx(0);
|
||||
anmMtxs[1] = (Mtx*)pMtxBuffer->getWeightAnmMtx(0);
|
||||
int vtxPosFrac = pVtxBuffer->getVertexData()->getVtxPosFrac();
|
||||
J3DGQRSetup7(vtxPosFrac, 7, vtxPosFrac, 7);
|
||||
param_0->swapTransformedVtxPos();
|
||||
J3DJointTree* jointTree = param_1->getJointTree();
|
||||
int vtxNum = param_0->getVertexData()->getVtxNum();
|
||||
void* currentVtxPos = param_0->getCurrentVtxPos();
|
||||
void* transformedVtxPos = param_0->getTransformedVtxPos(0);
|
||||
pVtxBuffer->swapTransformedVtxPos();
|
||||
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
int vtxNum = pVtxBuffer->getVertexData()->getVtxNum();
|
||||
int sp8 = jointTree->getDrawMtxNum();
|
||||
void* currentVtxPos = pVtxBuffer->getCurrentVtxPos();
|
||||
void* transformedVtxPos = pVtxBuffer->getTransformedVtxPos(0);
|
||||
|
||||
for (int i = 0; i < vtxNum; i++) {
|
||||
Mtx* anmMtx = anmMtxs[jointTree->getDrawMtxFlag(mPosData[i])];
|
||||
J3DPSMulMtxVec(anmMtx[jointTree->getDrawMtxIndex(mPosData[i])], ((S16Vec*)currentVtxPos) + i, ((S16Vec*)transformedVtxPos) + i);
|
||||
anmMtx = anmMtxs[jointTree->getDrawMtxFlag(mPosData[i])];
|
||||
J3DPSMulMtxVec(anmMtx[jointTree->getDrawMtxIndex(mPosData[i])], (S16Vec*)(((s16*)currentVtxPos) + (i * 3)), (S16Vec*)(((s16*)transformedVtxPos) + (i * 3)));
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxPos(0), param_0->getVertexData()->getVtxNum() * sizeof(S16Vec));
|
||||
param_0->setCurrentVtxPos(transformedVtxPos);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxPos(0), pVtxBuffer->getVertexData()->getVtxNum() * sizeof(S16Vec));
|
||||
pVtxBuffer->setCurrentVtxPos(transformedVtxPos);
|
||||
}
|
||||
|
||||
/* 8032DDB8-8032DEBC 3286F8 0104+00 1/1 0/0 0/0 .text
|
||||
* deformVtxNrm_F32__13J3DSkinDeformCFP15J3DVertexBuffer */
|
||||
// NONMATCHING - J3DPSMulMtxVec regalloc
|
||||
void J3DSkinDeform::deformVtxNrm_F32(J3DVertexBuffer* param_0) const {
|
||||
param_0->swapTransformedVtxNrm();
|
||||
int nrmNum = param_0->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = param_0->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = param_0->getTransformedVtxNrm(0);
|
||||
void J3DSkinDeform::deformVtxNrm_F32(J3DVertexBuffer* pVtxBuffer) const {
|
||||
pVtxBuffer->swapTransformedVtxNrm();
|
||||
int nrmNum = pVtxBuffer->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = pVtxBuffer->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = pVtxBuffer->getTransformedVtxNrm(0);
|
||||
|
||||
for (int i = 0; i < nrmNum; i++) {
|
||||
J3DPSMulMtxVec(mNrmMtx[mNrmData[i]], (Vec*)((u8*)currentVtxNrm + i * 3 * 4), (Vec*)((u8*)transformedVtxNrm + i * 3 * 4));
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxNrm(0), param_0->getVertexData()->getNrmNum() * sizeof(Vec));
|
||||
param_0->setCurrentVtxNrm(transformedVtxNrm);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxNrm(0), pVtxBuffer->getVertexData()->getNrmNum() * sizeof(Vec));
|
||||
pVtxBuffer->setCurrentVtxNrm(transformedVtxNrm);
|
||||
}
|
||||
|
||||
/* 8032DEBC-8032DFDC 3287FC 0120+00 1/1 0/0 0/0 .text
|
||||
* deformVtxNrm_S16__13J3DSkinDeformCFP15J3DVertexBuffer */
|
||||
// NONMATCHING - J3DPSMulMtxVec regalloc
|
||||
void J3DSkinDeform::deformVtxNrm_S16(J3DVertexBuffer* param_0) const {
|
||||
u8 vtxNrmFrac = param_0->getVertexData()->getVtxNrmFrac();
|
||||
void J3DSkinDeform::deformVtxNrm_S16(J3DVertexBuffer* pVtxBuffer) const {
|
||||
int vtxNrmFrac = pVtxBuffer->getVertexData()->getVtxNrmFrac();
|
||||
J3DGQRSetup7(vtxNrmFrac, 7, vtxNrmFrac, 7);
|
||||
param_0->swapTransformedVtxNrm();
|
||||
int nrmNum = param_0->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = param_0->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = param_0->getTransformedVtxNrm(0);
|
||||
pVtxBuffer->swapTransformedVtxNrm();
|
||||
|
||||
int nrmNum = pVtxBuffer->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = pVtxBuffer->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = pVtxBuffer->getTransformedVtxNrm(0);
|
||||
|
||||
for (int i = 0; i < nrmNum; i++) {
|
||||
J3DPSMulMtxVec(mNrmMtx[mNrmData[i]], ((S16Vec*)currentVtxNrm) + i, ((S16Vec*)transformedVtxNrm) + i);
|
||||
J3DPSMulMtxVec(mNrmMtx[mNrmData[i]], (S16Vec*)(((s16*)currentVtxNrm) + (i * 3)), (S16Vec*)(((s16*)transformedVtxNrm) + (i * 3)));
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxNrm(0), param_0->getVertexData()->getNrmNum() * sizeof(S16Vec));
|
||||
param_0->setCurrentVtxNrm(transformedVtxNrm);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxNrm(0), pVtxBuffer->getVertexData()->getNrmNum() * sizeof(S16Vec));
|
||||
pVtxBuffer->setCurrentVtxNrm(transformedVtxNrm);
|
||||
}
|
||||
|
||||
/* 8032DFDC-8032E064 32891C 0088+00 0/0 1/1 0/0 .text deform__13J3DSkinDeformFP8J3DModel
|
||||
*/
|
||||
void J3DSkinDeform::deform(J3DModel* param_0) {
|
||||
if (param_0->checkFlag(4)) {
|
||||
void J3DSkinDeform::deform(J3DModel* pModel) {
|
||||
J3D_ASSERT_NULLPTR(1270, pModel != NULL);
|
||||
|
||||
if (pModel->checkFlag(J3DMdlFlag_SkinPosCpu)) {
|
||||
onFlag(2);
|
||||
} else {
|
||||
offFlag(2);
|
||||
}
|
||||
|
||||
if (param_0->checkFlag(8)) {
|
||||
if (pModel->checkFlag(J3DMdlFlag_SkinNrmCpu)) {
|
||||
onFlag(1);
|
||||
} else {
|
||||
offFlag(1);
|
||||
}
|
||||
deform(param_0->getVertexBuffer(), param_0->getMtxBuffer());
|
||||
|
||||
deform(pModel->getVertexBuffer(), pModel->getMtxBuffer());
|
||||
}
|
||||
|
||||
/* 8032E064-8032E180 3289A4 011C+00 1/0 0/0 0/0 .text
|
||||
* deform__13J3DSkinDeformFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
void J3DSkinDeform::deform(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) {
|
||||
if (param_1->getJointTree()->checkFlag(0x100)) {
|
||||
calcAnmInvJointMtx(param_1);
|
||||
void J3DSkinDeform::deform(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) {
|
||||
J3D_ASSERT_NULLPTR(1299, pVtxBuffer != NULL);
|
||||
J3D_ASSERT_NULLPTR(1300, pMtxBuffer != NULL);
|
||||
|
||||
if (pMtxBuffer->getJointTree()->checkFlag(0x100)) {
|
||||
calcAnmInvJointMtx(pMtxBuffer);
|
||||
}
|
||||
|
||||
if (checkFlag(2) != 0) {
|
||||
if (param_1->getJointTree()->checkFlag(0x100)) {
|
||||
deformFastVtxPos_F32(param_0, param_1);
|
||||
if (pMtxBuffer->getJointTree()->checkFlag(0x100)) {
|
||||
deformFastVtxPos_F32(pVtxBuffer, pMtxBuffer);
|
||||
} else {
|
||||
if (param_0->getVertexData()->getVtxPosType() == 4) {
|
||||
deformVtxPos_F32(param_0, param_1);
|
||||
if (pVtxBuffer->getVertexData()->getVtxPosType() == 4) {
|
||||
deformVtxPos_F32(pVtxBuffer, pMtxBuffer);
|
||||
} else {
|
||||
deformVtxPos_S16(param_0, param_1);
|
||||
deformVtxPos_S16(pVtxBuffer, pMtxBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkFlag(1) != 0) {
|
||||
if (param_1->getJointTree()->checkFlag(0x100)) {
|
||||
deformFastVtxNrm_F32(param_0, param_1);
|
||||
|
||||
if (checkFlag(1)) {
|
||||
if (pMtxBuffer->getJointTree()->checkFlag(0x100)) {
|
||||
deformFastVtxNrm_F32(pVtxBuffer, pMtxBuffer);
|
||||
} else {
|
||||
calcNrmMtx(param_1);
|
||||
if (param_0->getVertexData()->getVtxNrmType() == 4) {
|
||||
deformVtxNrm_F32(param_0);
|
||||
calcNrmMtx(pMtxBuffer);
|
||||
if (pVtxBuffer->getVertexData()->getVtxNrmType() == 4) {
|
||||
deformVtxNrm_F32(pVtxBuffer);
|
||||
} else {
|
||||
deformVtxNrm_S16(param_0);
|
||||
deformVtxNrm_S16(pVtxBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -655,11 +695,10 @@ void J3DSkinDeform::deform(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) {
|
||||
|
||||
/* 8032E180-8032E1B0 328AC0 0030+00 0/0 1/1 0/0 .text calc__15J3DVtxColorCalcFP8J3DModel
|
||||
*/
|
||||
void J3DVtxColorCalc::calc(J3DModel* param_0) {
|
||||
calc(param_0->getVertexBuffer());
|
||||
void J3DVtxColorCalc::calc(J3DModel* pModel) {
|
||||
J3D_ASSERT_NULLPTR(1351, pModel != NULL);
|
||||
calc(pModel->getVertexBuffer());
|
||||
}
|
||||
|
||||
/* 8032E1B0-8032E1F8 328AF0 0048+00 1/0 0/0 0/0 .text __dt__13J3DSkinDeformFv */
|
||||
J3DSkinDeform::~J3DSkinDeform() {}
|
||||
|
||||
/* 803A2028-803A2028 02E688 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
|
||||
@@ -8,26 +8,27 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
void J3DDrawBuffer::calcZRatio() {
|
||||
mZRatio = (mZFar - mZNear) / (f32)mBufSize;
|
||||
mZRatio = (mZFar - mZNear) / (f32)mEntryTableSize;
|
||||
}
|
||||
|
||||
void J3DDrawBuffer::initialize() {
|
||||
mDrawType = DRAW_HEAD;
|
||||
mSortType = SORT_MAT;
|
||||
mDrawMode = J3DDrawBufDrawMode_Head;
|
||||
mSortMode = J3DDrawBufSortMode_Mat;
|
||||
mZNear = 1.0f;
|
||||
mZFar = 10000.0f;
|
||||
mpZMtx = NULL;
|
||||
mpCallBackPacket = NULL;
|
||||
mBufSize = 0x20;
|
||||
mEntryTableSize = 0x20;
|
||||
calcZRatio();
|
||||
}
|
||||
|
||||
J3DError J3DDrawBuffer::allocBuffer(u32 bufSize) {
|
||||
mpBuf = new (0x20) J3DPacket*[bufSize];
|
||||
if (mpBuf == NULL)
|
||||
int J3DDrawBuffer::allocBuffer(u32 size) {
|
||||
mpBuffer = new (0x20) J3DPacket*[size];
|
||||
if (mpBuffer == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
|
||||
mBufSize = bufSize;
|
||||
mEntryTableSize = size;
|
||||
|
||||
frameInit();
|
||||
calcZRatio();
|
||||
return kJ3DError_Success;
|
||||
@@ -36,15 +37,15 @@ J3DError J3DDrawBuffer::allocBuffer(u32 bufSize) {
|
||||
J3DDrawBuffer::~J3DDrawBuffer() {
|
||||
frameInit();
|
||||
|
||||
delete[] mpBuf;
|
||||
mpBuf = NULL;
|
||||
delete[] mpBuffer;
|
||||
mpBuffer = NULL;
|
||||
}
|
||||
|
||||
/* 80325068-8032509C 31F9A8 0034+00 2/2 1/1 0/0 .text frameInit__13J3DDrawBufferFv */
|
||||
void J3DDrawBuffer::frameInit() {
|
||||
u32 bufSize = mBufSize;
|
||||
u32 bufSize = mEntryTableSize;
|
||||
for (u32 i = 0; i < bufSize; i++)
|
||||
mpBuf[i] = NULL;
|
||||
mpBuffer[i] = NULL;
|
||||
|
||||
mpCallBackPacket = NULL;
|
||||
}
|
||||
@@ -52,80 +53,89 @@ void J3DDrawBuffer::frameInit() {
|
||||
/* 8032509C-803251E4 31F9DC 0148+00 2/1 0/0 0/0 .text
|
||||
* entryMatSort__13J3DDrawBufferFP12J3DMatPacket */
|
||||
int J3DDrawBuffer::entryMatSort(J3DMatPacket* pMatPacket) {
|
||||
J3D_ASSERT_NULLPTR(122, pMatPacket != NULL);
|
||||
|
||||
pMatPacket->drawClear();
|
||||
pMatPacket->getShapePacket()->drawClear();
|
||||
|
||||
if (pMatPacket->isChanged()) {
|
||||
pMatPacket->setNextPacket(mpBuf[0]);
|
||||
mpBuf[0] = pMatPacket;
|
||||
pMatPacket->setNextPacket(mpBuffer[0]);
|
||||
mpBuffer[0] = pMatPacket;
|
||||
return 1;
|
||||
}
|
||||
|
||||
J3DTexture* texture = j3dSys.getTexture();
|
||||
u32 hash;
|
||||
J3DTexture* pTexture = j3dSys.getTexture();
|
||||
u16 texNo = pMatPacket->getMaterial()->getTexNo(0);
|
||||
J3D_ASSERT_NULLPTR(150, pTexture != NULL);
|
||||
|
||||
u32 hash;
|
||||
if (texNo == 0xFFFF) {
|
||||
hash = 0;
|
||||
} else {
|
||||
hash = ((u32)texture->getResTIMG(texNo) + texture->getResTIMG(texNo)->imageOffset) >> 5;
|
||||
hash = ((uintptr_t)pTexture->getResTIMG(texNo) + pTexture->getResTIMG(texNo)->imageOffset) >> 5;
|
||||
}
|
||||
u32 slot = hash & (mBufSize - 1);
|
||||
u32 slot = hash & (mEntryTableSize - 1);
|
||||
|
||||
if (mpBuf[slot] == NULL) {
|
||||
mpBuf[slot] = pMatPacket;
|
||||
if (mpBuffer[slot] == NULL) {
|
||||
mpBuffer[slot] = pMatPacket;
|
||||
return 1;
|
||||
} else {
|
||||
for (J3DMatPacket* pkt = (J3DMatPacket*)mpBuf[slot]; pkt != NULL;
|
||||
pkt = (J3DMatPacket*)pkt->getNextPacket())
|
||||
{
|
||||
if (pkt->isSame(pMatPacket)) {
|
||||
pkt->addShapePacket(pMatPacket->getShapePacket());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
J3DMatPacket* packet;
|
||||
for (packet = (J3DMatPacket*)mpBuffer[slot]; packet != NULL; packet = (J3DMatPacket*)packet->getNextPacket())
|
||||
{
|
||||
if (packet->isSame(pMatPacket)) {
|
||||
packet->addShapePacket(pMatPacket->getShapePacket());
|
||||
return 0;
|
||||
}
|
||||
|
||||
pMatPacket->setNextPacket(mpBuf[slot]);
|
||||
mpBuf[slot] = pMatPacket;
|
||||
return 1;
|
||||
}
|
||||
|
||||
pMatPacket->setNextPacket(mpBuffer[slot]);
|
||||
mpBuffer[slot] = pMatPacket;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 803251E4-8032529C 31FB24 00B8+00 1/0 0/0 0/0 .text
|
||||
* entryMatAnmSort__13J3DDrawBufferFP12J3DMatPacket */
|
||||
int J3DDrawBuffer::entryMatAnmSort(J3DMatPacket* pMatPacket) {
|
||||
J3D_ASSERT_NULLPTR(199, pMatPacket != NULL);
|
||||
|
||||
J3DMaterialAnm* pMaterialAnm = pMatPacket->mpMaterialAnm;
|
||||
u32 slot = (u32)pMaterialAnm & (mBufSize - 1);
|
||||
u32 slot = (uintptr_t)pMaterialAnm & (mEntryTableSize - 1);
|
||||
|
||||
if (pMaterialAnm == NULL) {
|
||||
return entryMatSort(pMatPacket);
|
||||
} else {
|
||||
pMatPacket->drawClear();
|
||||
pMatPacket->getShapePacket()->drawClear();
|
||||
if (mpBuf[slot] == NULL) {
|
||||
mpBuf[slot] = pMatPacket;
|
||||
return 1;
|
||||
} else {
|
||||
for (J3DMatPacket* pkt = (J3DMatPacket*)mpBuf[slot]; pkt != NULL;
|
||||
pkt = (J3DMatPacket*)pkt->getNextPacket())
|
||||
{
|
||||
if (pkt->mpMaterialAnm == pMaterialAnm) {
|
||||
pkt->addShapePacket(pMatPacket->getShapePacket());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pMatPacket->setNextPacket(mpBuf[slot]);
|
||||
mpBuf[slot] = pMatPacket;
|
||||
return 1;
|
||||
pMatPacket->drawClear();
|
||||
pMatPacket->getShapePacket()->drawClear();
|
||||
|
||||
if (mpBuffer[slot] == NULL) {
|
||||
mpBuffer[slot] = pMatPacket;
|
||||
return 1;
|
||||
}
|
||||
|
||||
J3DMatPacket* packet;
|
||||
for (packet = (J3DMatPacket*)mpBuffer[slot]; packet != NULL; packet = (J3DMatPacket*)packet->getNextPacket())
|
||||
{
|
||||
if (packet->mpMaterialAnm == pMaterialAnm) {
|
||||
packet->addShapePacket(pMatPacket->getShapePacket());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
pMatPacket->setNextPacket(mpBuffer[slot]);
|
||||
mpBuffer[slot] = pMatPacket;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 8032529C-803253B4 31FBDC 0118+00 1/0 0/0 0/0 .text entryZSort__13J3DDrawBufferFP12J3DMatPacket
|
||||
*/
|
||||
int J3DDrawBuffer::entryZSort(J3DMatPacket* i_packet) {
|
||||
i_packet->drawClear();
|
||||
i_packet->getShapePacket()->drawClear();
|
||||
int J3DDrawBuffer::entryZSort(J3DMatPacket* pMatPacket) {
|
||||
J3D_ASSERT_NULLPTR(257, pMatPacket != NULL);
|
||||
|
||||
pMatPacket->drawClear();
|
||||
pMatPacket->getShapePacket()->drawClear();
|
||||
|
||||
Vec tmp;
|
||||
tmp.x = mpZMtx[0][3];
|
||||
@@ -134,32 +144,33 @@ int J3DDrawBuffer::entryZSort(J3DMatPacket* i_packet) {
|
||||
|
||||
f32 value = -J3DCalcZValue(j3dSys.getViewMtx(), tmp);
|
||||
|
||||
u32 uvar4;
|
||||
u32 index;
|
||||
if (mZNear + mZRatio < value) {
|
||||
if (mZFar - mZRatio > value) {
|
||||
uvar4 = value / mZRatio;
|
||||
index = value / mZRatio;
|
||||
} else {
|
||||
uvar4 = mBufSize - 1;
|
||||
index = mEntryTableSize - 1;
|
||||
}
|
||||
} else {
|
||||
uvar4 = 0;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
u32 idx = (mBufSize - 1) - uvar4;
|
||||
i_packet->setNextPacket(mpBuf[idx]);
|
||||
mpBuf[idx] = i_packet;
|
||||
|
||||
index = (mEntryTableSize - 1) - index;
|
||||
pMatPacket->setNextPacket(mpBuffer[index]);
|
||||
mpBuffer[index] = pMatPacket;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 803253B4-80325404 31FCF4 0050+00 1/0 0/0 0/0 .text
|
||||
* entryModelSort__13J3DDrawBufferFP12J3DMatPacket */
|
||||
int J3DDrawBuffer::entryModelSort(J3DMatPacket* i_packet) {
|
||||
i_packet->drawClear();
|
||||
i_packet->getShapePacket()->drawClear();
|
||||
int J3DDrawBuffer::entryModelSort(J3DMatPacket* pMatPacket) {
|
||||
J3D_ASSERT_NULLPTR(316, pMatPacket != NULL);
|
||||
|
||||
pMatPacket->drawClear();
|
||||
pMatPacket->getShapePacket()->drawClear();
|
||||
|
||||
if (mpCallBackPacket != NULL) {
|
||||
mpCallBackPacket->addChildPacket(i_packet);
|
||||
mpCallBackPacket->addChildPacket(pMatPacket);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -168,57 +179,67 @@ int J3DDrawBuffer::entryModelSort(J3DMatPacket* i_packet) {
|
||||
|
||||
/* 80325404-80325458 31FD44 0054+00 1/0 0/0 0/0 .text
|
||||
* entryInvalidSort__13J3DDrawBufferFP12J3DMatPacket */
|
||||
int J3DDrawBuffer::entryInvalidSort(J3DMatPacket* i_packet) {
|
||||
i_packet->drawClear();
|
||||
i_packet->getShapePacket()->drawClear();
|
||||
int J3DDrawBuffer::entryInvalidSort(J3DMatPacket* pMatPacket) {
|
||||
J3D_ASSERT_NULLPTR(343, pMatPacket != NULL);
|
||||
|
||||
pMatPacket->drawClear();
|
||||
pMatPacket->getShapePacket()->drawClear();
|
||||
|
||||
if (mpCallBackPacket != NULL) {
|
||||
mpCallBackPacket->addChildPacket(i_packet->getShapePacket());
|
||||
mpCallBackPacket->addChildPacket(pMatPacket->getShapePacket());
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int J3DDrawBuffer::entryNonSort(J3DMatPacket* i_packet) {
|
||||
i_packet->drawClear();
|
||||
i_packet->mpShapePacket->drawClear();
|
||||
int J3DDrawBuffer::entryNonSort(J3DMatPacket* pMatPacket) {
|
||||
J3D_ASSERT_NULLPTR(370, pMatPacket != NULL);
|
||||
|
||||
i_packet->setNextPacket(mpBuf[0]);
|
||||
mpBuf[0] = i_packet;
|
||||
pMatPacket->drawClear();
|
||||
pMatPacket->getShapePacket()->drawClear();
|
||||
|
||||
pMatPacket->setNextPacket(mpBuffer[0]);
|
||||
mpBuffer[0] = pMatPacket;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int J3DDrawBuffer::entryImm(J3DPacket* i_packet, u16 index) {
|
||||
i_packet->setNextPacket(mpBuf[index]);
|
||||
mpBuf[index] = i_packet;
|
||||
int J3DDrawBuffer::entryImm(J3DPacket* pPacket, u16 index) {
|
||||
J3D_ASSERT_NULLPTR(394, pPacket != NULL);
|
||||
J3D_ASSERT_RANGE(395, index < mEntryTableSize);
|
||||
|
||||
pPacket->setNextPacket(mpBuffer[index]);
|
||||
mpBuffer[index] = pPacket;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 803CEC30-803CEC78 02BD50 0048+00 0/1 1/1 0/0 .data sortFuncTable__13J3DDrawBuffer */
|
||||
sortFunc J3DDrawBuffer::sortFuncTable[6] = {
|
||||
J3DDrawBuffer::sortFunc J3DDrawBuffer::sortFuncTable[6] = {
|
||||
&J3DDrawBuffer::entryMatSort, &J3DDrawBuffer::entryMatAnmSort, &J3DDrawBuffer::entryZSort,
|
||||
&J3DDrawBuffer::entryModelSort, &J3DDrawBuffer::entryInvalidSort, &J3DDrawBuffer::entryNonSort,
|
||||
};
|
||||
|
||||
/* 803CEC90-803CECA8 02BDB0 0018+00 1/2 0/0 0/0 .data drawFuncTable__13J3DDrawBuffer */
|
||||
drawFunc J3DDrawBuffer::drawFuncTable[2] = {
|
||||
J3DDrawBuffer::drawFunc J3DDrawBuffer::drawFuncTable[2] = {
|
||||
&J3DDrawBuffer::drawHead,
|
||||
&J3DDrawBuffer::drawTail,
|
||||
};
|
||||
|
||||
/* 804515E0-804515E8 000AE0 0004+04 0/0 1/1 0/0 .sbss entryNum__13J3DDrawBuffer */
|
||||
int J3DDrawBuffer::entryNum;
|
||||
|
||||
/* 803254AC-80325500 31FDEC 0054+00 0/0 2/2 0/0 .text draw__13J3DDrawBufferCFv */
|
||||
void J3DDrawBuffer::draw() const {
|
||||
drawFunc func = drawFuncTable[mDrawType];
|
||||
J3D_ASSERT_RANGE(411, mDrawMode < J3DDrawBufDrawMode_MAX);
|
||||
|
||||
drawFunc func = drawFuncTable[mDrawMode];
|
||||
(this->*func)();
|
||||
}
|
||||
|
||||
/* 80325500-80325578 31FE40 0078+00 1/0 0/0 0/0 .text drawHead__13J3DDrawBufferCFv */
|
||||
void J3DDrawBuffer::drawHead() const {
|
||||
u32 size = mBufSize;
|
||||
J3DPacket** buf = mpBuf;
|
||||
u32 size = mEntryTableSize;
|
||||
J3DPacket** buf = mpBuffer;
|
||||
|
||||
for (u32 i = 0; i < size; i++) {
|
||||
for (J3DPacket* packet = buf[i]; packet != NULL; packet = packet->getNextPacket()) {
|
||||
@@ -229,15 +250,9 @@ void J3DDrawBuffer::drawHead() const {
|
||||
|
||||
/* 80325578-803255F0 31FEB8 0078+00 1/0 0/0 0/0 .text drawTail__13J3DDrawBufferCFv */
|
||||
void J3DDrawBuffer::drawTail() const {
|
||||
int num = mBufSize - 1;
|
||||
|
||||
for (int i = num; i >= 0; i--) {
|
||||
for (J3DPacket* packet = mpBuf[i]; packet != NULL; packet = packet->getNextPacket()) {
|
||||
for (int i = mEntryTableSize - 1; i >= 0; i--) {
|
||||
for (J3DPacket* packet = mpBuffer[i]; packet != NULL; packet = packet->getNextPacket()) {
|
||||
packet->draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515E0-804515E8 000AE0 0004+04 0/0 1/1 0/0 .sbss entryNum__13J3DDrawBuffer */
|
||||
int J3DDrawBuffer::entryNum;
|
||||
+399
-304
@@ -3,29 +3,28 @@
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DGD.h"
|
||||
#include "dolphin/gd.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "JSystem/J3DGraphBase/J3DFifo.h"
|
||||
|
||||
/* 8030D098-8030D210 3079D8 0178+00 0/0 1/1 0/0 .text J3DGDSetGenMode__FUcUcUcUc11_GXCullMode */
|
||||
void J3DGDSetGenMode(u8 texGenNum, u8 colorChanNum, u8 tevStageNum, u8 indTexStageNum,
|
||||
GXCullMode cullMode) {
|
||||
GDOverflowCheck(0xa);
|
||||
J3DGDWriteBPCmd(0xfe07fc3f);
|
||||
void J3DGDSetGenMode(u8 nTexGens, u8 nChans, u8 nTevs, u8 nInds,
|
||||
GXCullMode cm) {
|
||||
static u8 cm2hw[4] = {0, 2, 1, 3};
|
||||
J3DGDWriteBPCmd(texGenNum | colorChanNum << 4 | (tevStageNum - 1) << 0xa |
|
||||
cm2hw[cullMode] << 0xe | indTexStageNum << 0x10);
|
||||
|
||||
GDOverflowCheck(10);
|
||||
J3DGDWriteBPCmd(0xFE07FC3F);
|
||||
J3DGDWriteBPCmd(BP_GEN_MODE(nTexGens, nChans, nTevs - 1, cm2hw[cm], nInds));
|
||||
}
|
||||
|
||||
/* 8030D210-8030D364 307B50 0154+00 0/0 1/1 0/0 .text J3DGDSetGenMode_3Param__FUcUcUc */
|
||||
void J3DGDSetGenMode_3Param(u8 texGenNum, u8 tevStageNum, u8 indTexStageNum) {
|
||||
GDOverflowCheck(0xa);
|
||||
J3DGDWriteBPCmd(0xfe073c0f);
|
||||
J3DGDWriteBPCmd(texGenNum | (tevStageNum - 1) << 0xa | indTexStageNum << 0x10);
|
||||
void J3DGDSetGenMode_3Param(u8 nTexGens, u8 nTevs, u8 nInds) {
|
||||
GDOverflowCheck(10);
|
||||
J3DGDWriteBPCmd(0xFE073C0F);
|
||||
J3DGDWriteBPCmd(BP_GEN_MODE(nTexGens, 0, nTevs - 1, 0, nInds));
|
||||
}
|
||||
|
||||
/* 8030D364-8030D65C 307CA4 02F8+00 0/0 1/1 0/0 .text J3DGDSetLightAttn__F10_GXLightIDffffff */
|
||||
void J3DGDSetLightAttn(GXLightID id, f32 a0, f32 a1, f32 a2, f32 k0, f32 k1, f32 k2) {
|
||||
J3DGDWriteXFCmdHdr(0x0604 + __GDLightID2Offset(id), 6);
|
||||
void J3DGDSetLightAttn(GXLightID light, f32 a0, f32 a1, f32 a2, f32 k0, f32 k1, f32 k2) {
|
||||
J3DGDWriteXFCmdHdr(XF_LIGHT_ATTN_ID + __GDLightID2Offset(light), 6);
|
||||
J3DGDWrite_f32(a0);
|
||||
J3DGDWrite_f32(a1);
|
||||
J3DGDWrite_f32(a2);
|
||||
@@ -36,15 +35,15 @@ void J3DGDSetLightAttn(GXLightID id, f32 a0, f32 a1, f32 a2, f32 k0, f32 k1, f32
|
||||
|
||||
/* 8030D65C-8030D76C 307F9C 0110+00 0/0 1/1 0/0 .text J3DGDSetLightColor__F10_GXLightID8_GXColor
|
||||
*/
|
||||
void J3DGDSetLightColor(GXLightID id, GXColor color) {
|
||||
J3DGDWriteXFCmd(0x0603 + __GDLightID2Offset(id),
|
||||
void J3DGDSetLightColor(GXLightID light, GXColor color) {
|
||||
J3DGDWriteXFCmd(XF_LIGHT_COLOR_ID + __GDLightID2Offset(light),
|
||||
(color.r << 24) | (color.g << 16) | (color.b << 8) | (color.a << 0));
|
||||
}
|
||||
|
||||
/* 8030D76C-8030D938 3080AC 01CC+00 0/0 1/1 0/0 .text J3DGDSetLightPos__F10_GXLightIDfff
|
||||
*/
|
||||
void J3DGDSetLightPos(GXLightID id, f32 x, f32 y, f32 z) {
|
||||
J3DGDWriteXFCmdHdr(0x060A + __GDLightID2Offset(id), 3);
|
||||
void J3DGDSetLightPos(GXLightID light, f32 x, f32 y, f32 z) {
|
||||
J3DGDWriteXFCmdHdr(XF_LIGHT_POS_ID + __GDLightID2Offset(light), 3);
|
||||
J3DGDWrite_f32(x);
|
||||
J3DGDWrite_f32(y);
|
||||
J3DGDWrite_f32(z);
|
||||
@@ -52,223 +51,241 @@ void J3DGDSetLightPos(GXLightID id, f32 x, f32 y, f32 z) {
|
||||
|
||||
/* 8030D938-8030DB04 308278 01CC+00 0/0 1/1 0/0 .text J3DGDSetLightDir__F10_GXLightIDfff
|
||||
*/
|
||||
void J3DGDSetLightDir(GXLightID id, f32 x, f32 y, f32 z) {
|
||||
J3DGDWriteXFCmdHdr(0x060D + __GDLightID2Offset(id), 3);
|
||||
J3DGDWrite_f32(x);
|
||||
J3DGDWrite_f32(y);
|
||||
J3DGDWrite_f32(z);
|
||||
void J3DGDSetLightDir(GXLightID light, f32 nx, f32 ny, f32 nz) {
|
||||
J3DGDWriteXFCmdHdr(XF_LIGHT_DIR_ID + __GDLightID2Offset(light), 3);
|
||||
J3DGDWrite_f32(nx);
|
||||
J3DGDWrite_f32(ny);
|
||||
J3DGDWrite_f32(nz);
|
||||
}
|
||||
|
||||
/* 8030DB04-8030E064 308444 0560+00 1/0 1/1 0/0 .text
|
||||
* J3DGDSetVtxAttrFmtv__F9_GXVtxFmtPC17_GXVtxAttrFmtListb */
|
||||
void J3DGDSetVtxAttrFmtv(GXVtxFmt fmt, GXVtxAttrFmtList const* fmtList, bool param_2) {
|
||||
u32 pos_cnt = GX_POS_XYZ;
|
||||
u32 pos_type = GX_F32;
|
||||
u32 pos_shift = 0;
|
||||
u32 nrm_cnt = GX_NRM_XYZ;
|
||||
u32 nrm_type = GX_F32;
|
||||
u32 local_34 = 0;
|
||||
u32 clr0_cnt = GX_CLR_RGBA;
|
||||
u32 clr0_type = GX_RGBA8;
|
||||
u32 clr1_cnt = GX_CLR_RGBA;
|
||||
u32 clr1_type = GX_RGBA8;
|
||||
u32 tex0_cnt = GX_TEX_ST;
|
||||
u32 tex0_type = GX_F32;
|
||||
u32 tex0_shift = 0;
|
||||
u32 tex1_cnt = GX_TEX_ST;
|
||||
u32 tex1_type = GX_F32;
|
||||
u32 tex1_shift = 0;
|
||||
u32 tex2_cnt = GX_TEX_ST;
|
||||
u32 tex2_type = GX_F32;
|
||||
u32 tex2_shift = 0;
|
||||
u32 tex3_cnt = GX_TEX_ST;
|
||||
u32 tex3_type = GX_F32;
|
||||
u32 tex3_shift = 0;
|
||||
u32 tex4_cnt = GX_TEX_ST;
|
||||
u32 tex4_type = GX_F32;
|
||||
u32 tex4_shift = 0;
|
||||
u32 tex5_cnt = GX_TEX_ST;
|
||||
u32 tex5_type = GX_F32;
|
||||
u32 tex5_shift = 0;
|
||||
u32 tex6_cnt = GX_TEX_ST;
|
||||
u32 tex6_type = GX_F32;
|
||||
u32 tex6_shift = 0;
|
||||
u32 tex7_cnt = GX_TEX_ST;
|
||||
u32 tex7_type = GX_F32;
|
||||
u32 tex7_shift = 0;
|
||||
for (; fmtList->attr != GX_VA_NULL; fmtList++) {
|
||||
switch (fmtList->attr) {
|
||||
void J3DGDSetVtxAttrFmtv(GXVtxFmt vtxfmt, const GXVtxAttrFmtList* list, bool param_2) {
|
||||
u32 posCnt = GX_POS_XYZ;
|
||||
u32 posType = GX_F32;
|
||||
u32 posFrac = 0;
|
||||
|
||||
u32 nrmCnt = GX_NRM_XYZ;
|
||||
u32 nrmType = GX_F32;
|
||||
u32 nrmIdx3 = 0;
|
||||
|
||||
u32 c0Cnt = GX_CLR_RGBA;
|
||||
u32 c0Type = GX_RGBA8;
|
||||
|
||||
u32 c1Cnt = GX_CLR_RGBA;
|
||||
u32 c1Type = GX_RGBA8;
|
||||
|
||||
u32 tx0Cnt = GX_TEX_ST;
|
||||
u32 tx0Type = GX_F32;
|
||||
u32 tx0Frac = 0;
|
||||
|
||||
u32 tx1Cnt = GX_TEX_ST;
|
||||
u32 tx1Type = GX_F32;
|
||||
u32 tx1Frac = 0;
|
||||
|
||||
u32 tx2Cnt = GX_TEX_ST;
|
||||
u32 tx2Type = GX_F32;
|
||||
u32 tx2Frac = 0;
|
||||
|
||||
u32 tx3Cnt = GX_TEX_ST;
|
||||
u32 tx3Type = GX_F32;
|
||||
u32 tx3Frac = 0;
|
||||
|
||||
u32 tx4Cnt = GX_TEX_ST;
|
||||
u32 tx4Type = GX_F32;
|
||||
u32 tx4Frac = 0;
|
||||
|
||||
u32 tx5Cnt = GX_TEX_ST;
|
||||
u32 tx5Type = GX_F32;
|
||||
u32 tx5Frac = 0;
|
||||
|
||||
u32 tx6Cnt = GX_TEX_ST;
|
||||
u32 tx6Type = GX_F32;
|
||||
u32 tx6Frac = 0;
|
||||
|
||||
u32 tx7Cnt = GX_TEX_ST;
|
||||
u32 tx7Type = GX_F32;
|
||||
u32 tx7Frac = 0;
|
||||
|
||||
ASSERTMSGLINE(240, vtxfmt < GX_MAX_VTXFMT, "GDSetVtxAttrFmtv: invalid vtx fmt");
|
||||
|
||||
for (; list->attr != GX_VA_NULL; ++list) {
|
||||
ASSERTMSGLINE(245, list->attr >= GX_VA_POS && list->attr <= GX_VA_TEX7, "GDSetVtxAttrFmtv: invalid attribute");
|
||||
ASSERTMSGLINE(246, list->frac < 32, "GDSetVtxAttrFmtv: invalid frac value");
|
||||
|
||||
switch (list->attr) {
|
||||
case GX_VA_POS:
|
||||
pos_cnt = fmtList->cnt;
|
||||
pos_type = fmtList->type;
|
||||
pos_shift = fmtList->frac;
|
||||
posCnt = list->cnt;
|
||||
posType = list->type;
|
||||
posFrac = list->frac;
|
||||
break;
|
||||
case GX_VA_NRM:
|
||||
case GX_VA_NBT:
|
||||
nrm_type = fmtList->type;
|
||||
if (fmtList->cnt == GX_NRM_NBT3) {
|
||||
nrm_cnt = GX_NRM_NBT;
|
||||
local_34 = 1;
|
||||
nrmType = list->type;
|
||||
if (list->cnt == GX_NRM_NBT3) {
|
||||
nrmCnt = GX_NRM_NBT;
|
||||
nrmIdx3 = 1;
|
||||
} else {
|
||||
if (param_2) {
|
||||
nrm_cnt = GX_NRM_NBT;
|
||||
nrmCnt = GX_NRM_NBT;
|
||||
} else {
|
||||
nrm_cnt = fmtList->cnt;
|
||||
nrmCnt = list->cnt;
|
||||
}
|
||||
local_34 = 0;
|
||||
nrmIdx3 = 0;
|
||||
}
|
||||
break;
|
||||
case GX_VA_CLR0:
|
||||
clr0_cnt = fmtList->cnt;
|
||||
clr0_type = fmtList->type;
|
||||
c0Cnt = list->cnt;
|
||||
c0Type = list->type;
|
||||
break;
|
||||
case GX_VA_CLR1:
|
||||
clr1_cnt = fmtList->cnt;
|
||||
clr1_type = fmtList->type;
|
||||
c1Cnt = list->cnt;
|
||||
c1Type = list->type;
|
||||
break;
|
||||
case GX_VA_TEX0:
|
||||
tex0_cnt = fmtList->cnt;
|
||||
tex0_type = fmtList->type;
|
||||
tex0_shift = fmtList->frac;
|
||||
tx0Cnt = list->cnt;
|
||||
tx0Type = list->type;
|
||||
tx0Frac = list->frac;
|
||||
break;
|
||||
case GX_VA_TEX1:
|
||||
tex1_cnt = fmtList->cnt;
|
||||
tex1_type = fmtList->type;
|
||||
tex1_shift = fmtList->frac;
|
||||
tx1Cnt = list->cnt;
|
||||
tx1Type = list->type;
|
||||
tx1Frac = list->frac;
|
||||
break;
|
||||
case GX_VA_TEX2:
|
||||
tex2_cnt = fmtList->cnt;
|
||||
tex2_type = fmtList->type;
|
||||
tex2_shift = fmtList->frac;
|
||||
tx2Cnt = list->cnt;
|
||||
tx2Type = list->type;
|
||||
tx2Frac = list->frac;
|
||||
break;
|
||||
case GX_VA_TEX3:
|
||||
tex3_cnt = fmtList->cnt;
|
||||
tex3_type = fmtList->type;
|
||||
tex3_shift = fmtList->frac;
|
||||
tx3Cnt = list->cnt;
|
||||
tx3Type = list->type;
|
||||
tx3Frac = list->frac;
|
||||
break;
|
||||
case GX_VA_TEX4:
|
||||
tex4_cnt = fmtList->cnt;
|
||||
tex4_type = fmtList->type;
|
||||
tex4_shift = fmtList->frac;
|
||||
tx4Cnt = list->cnt;
|
||||
tx4Type = list->type;
|
||||
tx4Frac = list->frac;
|
||||
break;
|
||||
case GX_VA_TEX5:
|
||||
tex5_cnt = fmtList->cnt;
|
||||
tex5_type = fmtList->type;
|
||||
tex5_shift = fmtList->frac;
|
||||
tx5Cnt = list->cnt;
|
||||
tx5Type = list->type;
|
||||
tx5Frac = list->frac;
|
||||
break;
|
||||
case GX_VA_TEX6:
|
||||
tex6_cnt = fmtList->cnt;
|
||||
tex6_type = fmtList->type;
|
||||
tex6_shift = fmtList->frac;
|
||||
tx6Cnt = list->cnt;
|
||||
tx6Type = list->type;
|
||||
tx6Frac = list->frac;
|
||||
break;
|
||||
case GX_VA_TEX7:
|
||||
tex7_cnt = fmtList->cnt;
|
||||
tex7_type = fmtList->type;
|
||||
tex7_shift = fmtList->frac;
|
||||
break;
|
||||
tx7Cnt = list->cnt;
|
||||
tx7Type = list->type;
|
||||
tx7Frac = list->frac;
|
||||
}
|
||||
}
|
||||
GDOverflowCheck(0x12);
|
||||
J3DGDWriteCPCmd(CP_REG_VAT_GRP0_ID + fmt,
|
||||
pos_cnt | pos_type << 1 | pos_shift << 4 | nrm_cnt << 9 | nrm_type << 0xa |
|
||||
clr0_cnt << 0xd | clr0_type << 0xe | clr1_cnt << 0x11 | clr1_type << 0x12 |
|
||||
tex0_cnt << 0x15 | tex0_type << 0x16 | tex0_shift << 0x19 | 0x40000000 |
|
||||
local_34 << 0x1f);
|
||||
J3DGDWriteCPCmd(CP_REG_VAT_GRP1_ID + fmt,
|
||||
tex1_cnt | tex1_type << 1 | tex1_shift << 4 | tex2_cnt << 9 | tex2_type << 0xa |
|
||||
tex2_shift << 0xd | tex3_cnt << 0x12 | tex3_type << 0x13 |
|
||||
tex3_shift << 0x16 | tex4_cnt << 0x1b | tex4_type << 0x1c | 0x80000000);
|
||||
J3DGDWriteCPCmd(CP_REG_VAT_GRP2_ID + fmt,
|
||||
tex4_shift | tex5_cnt << 5 | tex5_type << 6 | tex5_shift << 9 |
|
||||
tex6_cnt << 0xe | tex6_type << 0xf | tex6_shift << 0x12 | tex7_cnt << 0x17 |
|
||||
tex7_type << 0x18 | tex7_shift << 0x1b);
|
||||
|
||||
GDOverflowCheck(18);
|
||||
J3DGDWriteCPCmd(vtxfmt + CP_REG_VAT_GRP0_ID, CP_REG_VAT_GRP0(posCnt, posType, posFrac, nrmCnt, nrmType, c0Cnt, c0Type, c1Cnt, c1Type, tx0Cnt, tx0Type, tx0Frac, 1, nrmIdx3));
|
||||
J3DGDWriteCPCmd(vtxfmt + CP_REG_VAT_GRP1_ID, CP_REG_VAT_GRP1(tx1Cnt, tx1Type, tx1Frac, tx2Cnt, tx2Type, tx2Frac, tx3Cnt, tx3Type, tx3Frac, tx4Cnt, tx4Type, 1));
|
||||
J3DGDWriteCPCmd(vtxfmt + CP_REG_VAT_GRP2_ID, CP_REG_VAT_GRP2(tx4Frac, tx5Cnt, tx5Type, tx5Frac, tx6Cnt, tx6Type, tx6Frac, tx7Cnt, tx7Type, tx7Frac));
|
||||
}
|
||||
|
||||
/* 8030E064-8030E234 3089A4 01D0+00 1/0 1/1 0/0 .text
|
||||
* J3DGDSetTexCoordGen__F13_GXTexGenType12_GXTexGenSrc */
|
||||
void J3DGDSetTexCoordGen(GXTexGenType texGenType, GXTexGenSrc texGenSrc) {
|
||||
u32 input_form = 0;
|
||||
u32 proj_type = 0;
|
||||
u32 src_row = 5;
|
||||
u32 bump_src_tex = 5;
|
||||
u32 bump_src_light = 0;
|
||||
u32 texgen_type;
|
||||
switch (texGenSrc) {
|
||||
void J3DGDSetTexCoordGen(GXTexGenType func, GXTexGenSrc src_param) {
|
||||
u32 tgType;
|
||||
u32 form;
|
||||
u32 proj;
|
||||
u32 row;
|
||||
u32 embossRow;
|
||||
u32 embossLit;
|
||||
|
||||
form = 0;
|
||||
proj = 0;
|
||||
row = 5;
|
||||
embossRow = 5;
|
||||
embossLit = 0;
|
||||
|
||||
switch(src_param) {
|
||||
case GX_TG_POS:
|
||||
src_row = 0;
|
||||
input_form = 1;
|
||||
row = 0;
|
||||
form = 1;
|
||||
break;
|
||||
case GX_TG_NRM:
|
||||
src_row = 1;
|
||||
input_form = 1;
|
||||
row = 1;
|
||||
form = 1;
|
||||
break;
|
||||
case GX_TG_BINRM:
|
||||
src_row = 3;
|
||||
input_form = 1;
|
||||
row = 3;
|
||||
form = 1;
|
||||
break;
|
||||
case GX_TG_TANGENT:
|
||||
src_row = 4;
|
||||
input_form = 1;
|
||||
row = 4;
|
||||
form = 1;
|
||||
break;
|
||||
case GX_TG_COLOR0:
|
||||
src_row = 2;
|
||||
row = 2;
|
||||
break;
|
||||
case GX_TG_COLOR1:
|
||||
src_row = 2;
|
||||
row = 2;
|
||||
break;
|
||||
case GX_TG_TEX0:
|
||||
src_row = 5;
|
||||
row = 5;
|
||||
break;
|
||||
case GX_TG_TEX1:
|
||||
src_row = 6;
|
||||
row = 6;
|
||||
break;
|
||||
case GX_TG_TEX2:
|
||||
src_row = 7;
|
||||
row = 7;
|
||||
break;
|
||||
case GX_TG_TEX3:
|
||||
src_row = 8;
|
||||
row = 8;
|
||||
break;
|
||||
case GX_TG_TEX4:
|
||||
src_row = 9;
|
||||
row = 9;
|
||||
break;
|
||||
case GX_TG_TEX5:
|
||||
src_row = 10;
|
||||
row = 10;
|
||||
break;
|
||||
case GX_TG_TEX6:
|
||||
src_row = 11;
|
||||
row = 11;
|
||||
break;
|
||||
case GX_TG_TEX7:
|
||||
src_row = 12;
|
||||
row = 12;
|
||||
break;
|
||||
case GX_TG_TEXCOORD0:
|
||||
bump_src_tex = 0;
|
||||
embossRow = 0;
|
||||
break;
|
||||
case GX_TG_TEXCOORD1:
|
||||
bump_src_tex = 1;
|
||||
embossRow = 1;
|
||||
break;
|
||||
case GX_TG_TEXCOORD2:
|
||||
bump_src_tex = 2;
|
||||
embossRow = 2;
|
||||
break;
|
||||
case GX_TG_TEXCOORD3:
|
||||
bump_src_tex = 3;
|
||||
embossRow = 3;
|
||||
break;
|
||||
case GX_TG_TEXCOORD4:
|
||||
bump_src_tex = 4;
|
||||
embossRow = 4;
|
||||
break;
|
||||
case GX_TG_TEXCOORD5:
|
||||
bump_src_tex = 5;
|
||||
embossRow = 5;
|
||||
break;
|
||||
case GX_TG_TEXCOORD6:
|
||||
bump_src_tex = 6;
|
||||
embossRow = 6;
|
||||
break;
|
||||
default:
|
||||
ASSERTMSGLINE(433, 0, "GDSetTexCoordGen: invalid texgen source");
|
||||
break;
|
||||
}
|
||||
switch (texGenType) {
|
||||
|
||||
switch (func) {
|
||||
case GX_TG_MTX2x4:
|
||||
texgen_type = 0;
|
||||
tgType = 0;
|
||||
break;
|
||||
case GX_TG_MTX3x4:
|
||||
texgen_type = 0;
|
||||
proj_type = 1;
|
||||
tgType = 0;
|
||||
proj = 1;
|
||||
break;
|
||||
case GX_TG_BUMP0:
|
||||
case GX_TG_BUMP1:
|
||||
@@ -278,34 +295,33 @@ void J3DGDSetTexCoordGen(GXTexGenType texGenType, GXTexGenSrc texGenSrc) {
|
||||
case GX_TG_BUMP5:
|
||||
case GX_TG_BUMP6:
|
||||
case GX_TG_BUMP7:
|
||||
texgen_type = 1;
|
||||
bump_src_light = texGenType - 2;
|
||||
ASSERTMSGLINE(457, src_param >= GX_TG_TEXCOORD0 && src_param <= GX_TG_TEXCOORD6, "GDSetTexCoordGen: invalid emboss source");
|
||||
tgType = 1;
|
||||
embossLit = func - GX_TG_BUMP0;
|
||||
break;
|
||||
case GX_TG_SRTG:
|
||||
if (texGenSrc == GX_TG_COLOR0) {
|
||||
texgen_type = 2;
|
||||
if (src_param == GX_TG_COLOR0) {
|
||||
tgType = 2;
|
||||
} else {
|
||||
texgen_type = 3;
|
||||
tgType = 3;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ASSERTMSGLINE(473, 0, "GDSetTexCoordGen: invalid texgen function");
|
||||
break;
|
||||
}
|
||||
J3DGDWrite_u32(
|
||||
proj_type << (31 - GX_XF_TEX_PROJTYPE_END) | input_form << (31 - GX_XF_TEX_INPUTFORM_END) |
|
||||
texgen_type << (31 - GX_XF_TEX_TEXGENTYPE_END) | src_row << (31 - GX_XF_TEX_SRCROW_END) |
|
||||
bump_src_tex << (31 - GX_XF_TEX_BUMPSRCTEX_END) |
|
||||
bump_src_light << (31 - GX_XF_TEX_BUMPSRCLIGHT_END));
|
||||
|
||||
J3DGDWrite_u32(XF_REG_TEX(proj, form, tgType, row, embossRow, embossLit));
|
||||
}
|
||||
|
||||
/* 8030E234-8030E438 308B74 0204+00 0/0 16/16 0/0 .text
|
||||
* J3DGDSetTexCoordScale2__F13_GXTexCoordIDUsUcUcUsUcUc */
|
||||
void J3DGDSetTexCoordScale2(GXTexCoordID param_0, u16 param_1, u8 param_2, u8 param_3, u16 param_4,
|
||||
u8 param_5, u8 param_6) {
|
||||
GDOverflowCheck(0xf);
|
||||
J3DGDWriteBPCmd(0xfe03ffff);
|
||||
J3DGDWriteBPCmd((param_1 - 1) | param_2 << 0x10 | param_3 << 0x11 |
|
||||
(param_0 * 2 + 0x30) << 0x18);
|
||||
J3DGDWriteBPCmd((param_4 - 1) | param_5 << 0x10 | param_6 << 0x11 |
|
||||
(param_0 * 2 + 0x31) << 0x18);
|
||||
void J3DGDSetTexCoordScale2(GXTexCoordID coord, u16 s_scale, u8 s_bias,
|
||||
u8 s_wrap, u16 t_scale, u8 t_bias, u8 t_wrap) {
|
||||
GDOverflowCheck(15);
|
||||
J3DGDWriteBPCmd(0xFE03FFFF);
|
||||
J3DGDWriteBPCmd(BP_TEXCOORD_S_SCALE(s_scale - 1, s_bias, s_wrap, 0, 0, coord * 2 + 0x30));
|
||||
J3DGDWriteBPCmd(BP_TEXCOORD_T_SCALE(t_scale - 1, t_bias, t_wrap, coord * 2 + 0x31));
|
||||
}
|
||||
|
||||
/* 8045090C-80450914 00038C 0008+00 1/1 0/0 0/0 .sdata J3DGDTexMode0Ids */
|
||||
@@ -341,228 +357,308 @@ static u8 GX2HWFiltConv[6] = {
|
||||
/* 8030E438-8030E5D4 308D78 019C+00 0/0 1/1 0/0 .text
|
||||
* J3DGDSetTexLookupMode__F11_GXTexMapID14_GXTexWrapMode14_GXTexWrapMode12_GXTexFilter12_GXTexFilterfffUcUc13_GXAnisotropy
|
||||
*/
|
||||
void J3DGDSetTexLookupMode(GXTexMapID param_0, GXTexWrapMode param_1, GXTexWrapMode param_2,
|
||||
GXTexFilter param_3, GXTexFilter param_4, f32 param_5, f32 param_6,
|
||||
f32 param_7, u8 param_8, u8 param_9, GXAnisotropy param_10) {
|
||||
J3DGDWriteBPCmd(param_1 | param_2 << 2 | (param_4 == GX_LINEAR) << 4 |
|
||||
GX2HWFiltConv[param_3] << 5 | (param_9 == 0) << 8 |
|
||||
((int)(param_7 * 32.0f) & 0xff) << 9 | param_10 << 0x13 | param_8 << 0x15 |
|
||||
J3DGDTexMode0Ids[param_0] << 0x18);
|
||||
J3DGDWriteBPCmd(((int)(param_5 * 16.0f) & 0xff) | ((int)(param_6 * 16.0f) & 0xff) << 8 |
|
||||
J3DGDTexMode1Ids[param_0] << 0x18);
|
||||
void J3DGDSetTexLookupMode(GXTexMapID id, GXTexWrapMode wrap_s,
|
||||
GXTexWrapMode wrap_t, GXTexFilter min_filt,
|
||||
GXTexFilter mag_filt, f32 min_lod, f32 max_lod,
|
||||
f32 lod_bias, u8 bias_clamp, u8 do_edge_lod,
|
||||
GXAnisotropy max_aniso) {
|
||||
J3DGDWriteBPCmd(BP_TEX_MODE0(wrap_s, wrap_t, mag_filt == TRUE, GX2HWFiltConv[min_filt], !do_edge_lod, (u8)(32.0f * lod_bias), max_aniso, bias_clamp, J3DGDTexMode0Ids[id]));
|
||||
J3DGDWriteBPCmd(BP_TEX_MODE1((u8)(16.0f * min_lod), (u8)(16.0f * max_lod), J3DGDTexMode1Ids[id]));
|
||||
}
|
||||
|
||||
/* 8030E5D4-8030E67C 308F14 00A8+00 0/0 1/1 0/0 .text
|
||||
* J3DGDSetTexImgAttr__F11_GXTexMapIDUsUs9_GXTexFmt */
|
||||
void J3DGDSetTexImgAttr(GXTexMapID param_0, u16 param_1, u16 param_2, GXTexFmt param_3) {
|
||||
J3DGDWriteBPCmd((param_1 - 1) | (param_2 - 1) << 0xa | param_3 << 0x14 |
|
||||
J3DGDTexImage0Ids[param_0] << 0x18);
|
||||
void J3DGDSetTexImgAttr(GXTexMapID id, u16 width, u16 height, GXTexFmt format) {
|
||||
J3DGDWriteBPCmd(BP_IMAGE_ATTR(width - 1, height - 1, format, J3DGDTexImage0Ids[id]));
|
||||
}
|
||||
|
||||
/* 8030E67C-8030E70C 308FBC 0090+00 0/0 1/1 0/0 .text J3DGDSetTexImgPtr__F11_GXTexMapIDPv
|
||||
*/
|
||||
void J3DGDSetTexImgPtr(GXTexMapID param_0, void* param_1) {
|
||||
J3DGDWriteBPCmd(OSCachedToPhysical(param_1) >> 5 | J3DGDTexImage3Ids[param_0] << 0x18);
|
||||
void J3DGDSetTexImgPtr(GXTexMapID id, void* image_ptr) {
|
||||
J3DGDWriteBPCmd(BP_IMAGE_PTR(OSCachedToPhysical(image_ptr) >> 5, J3DGDTexImage3Ids[id]));
|
||||
}
|
||||
|
||||
/* 8030E70C-8030E7E0 30904C 00D4+00 0/0 1/1 0/0 .text J3DGDSetTexImgPtrRaw__F11_GXTexMapIDUl */
|
||||
void J3DGDSetTexImgPtrRaw(GXTexMapID param_0, u32 param_1) {
|
||||
void J3DGDSetTexImgPtrRaw(GXTexMapID id, u32 image_ptr_raw) {
|
||||
GDOverflowCheck(5);
|
||||
J3DGDWriteBPCmd(param_1 | J3DGDTexImage3Ids[param_0] << 0x18);
|
||||
J3DGDWriteBPCmd(BP_IMAGE_PTR(image_ptr_raw, J3DGDTexImage3Ids[id]));
|
||||
}
|
||||
|
||||
/* 8030E7E0-8030E878 309120 0098+00 0/0 1/1 0/0 .text
|
||||
* J3DGDSetTexTlut__F11_GXTexMapIDUl10_GXTlutFmt */
|
||||
void J3DGDSetTexTlut(GXTexMapID param_0, u32 param_1, GXTlutFmt param_2) {
|
||||
J3DGDWriteBPCmd((param_1 - 0x80000) >> 9 | param_2 << 0xa | J3DGDTexTlutIds[param_0] << 0x18);
|
||||
void J3DGDSetTexTlut(GXTexMapID id, u32 tmem_addr, GXTlutFmt format) {
|
||||
J3DGDWriteBPCmd(BP_TEX_TLUT((tmem_addr - 0x80000) >> 9, format, J3DGDTexTlutIds[id]));
|
||||
}
|
||||
|
||||
/* 8030E878-8030EB30 3091B8 02B8+00 0/0 1/1 0/0 .text J3DGDLoadTlut__FPvUl11_GXTlutSize
|
||||
*/
|
||||
void J3DGDLoadTlut(void* param_0, u32 param_1, GXTlutSize param_2) {
|
||||
J3DGDWriteBPCmd(0xfeffff00);
|
||||
J3DGDWriteBPCmd(0x0f000000);
|
||||
J3DGDWriteBPCmd(OSCachedToPhysical(param_0) >> 5 | 0x64000000);
|
||||
J3DGDWriteBPCmd((param_1 - 0x80000) >> 9 | param_2 << 0xa | 0x65000000);
|
||||
J3DGDWriteBPCmd(0xfeffff00);
|
||||
J3DGDWriteBPCmd(0x0f000000);
|
||||
void J3DGDLoadTlut(void* tlut_ptr, u32 tmem_addr, GXTlutSize size) {
|
||||
ASSERTMSGLINE(735, !(tmem_addr & 0x1ff), "GDLoadTlut: invalid TMEM pointer");
|
||||
ASSERTMSGLINE(736, size <= 0x400, "GDLoadTlut: invalid TLUT size");
|
||||
|
||||
J3DGDWriteBPCmd(0xFEFFFF00);
|
||||
J3DGDWriteBPCmd(0xF000000);
|
||||
J3DGDWriteBPCmd(BP_LOAD_TLUT0(OSCachedToPhysical(tlut_ptr) >> 5, 0x64));
|
||||
J3DGDWriteBPCmd(BP_LOAD_TLUT1((tmem_addr - 0x80000) >> 9, size, 0x65));
|
||||
J3DGDWriteBPCmd(0xFEFFFF00);
|
||||
J3DGDWriteBPCmd(0xF000000);
|
||||
}
|
||||
|
||||
/* 8030EB30-8030EE10 309470 02E0+00 0/0 2/2 0/0 .text J3DGDSetIndTexMtx__F14_GXIndTexMtxIDPA3_fSc
|
||||
*/
|
||||
void J3DGDSetIndTexMtx(GXIndTexMtxID id, Mtx3P mtx, s8 exp) {
|
||||
s32 mtx32[6];
|
||||
u32 idx;
|
||||
void J3DGDSetIndTexMtx(GXIndTexMtxID mtx_id, f32 offset[2][3], s8 scale_exp) {
|
||||
s32 offsetS32[6];
|
||||
u32 id_offset;
|
||||
|
||||
switch (id) {
|
||||
switch (mtx_id) {
|
||||
case GX_ITM_0:
|
||||
case GX_ITM_1:
|
||||
case GX_ITM_2:
|
||||
idx = (u32)(id - GX_ITM_0);
|
||||
id_offset = (u32)(mtx_id - GX_ITM_0);
|
||||
break;
|
||||
case GX_ITM_S0:
|
||||
case GX_ITM_S1:
|
||||
case GX_ITM_S2:
|
||||
idx = (u32)(id - GX_ITM_S0);
|
||||
id_offset = (u32)(mtx_id - GX_ITM_S0);
|
||||
break;
|
||||
case GX_ITM_T0:
|
||||
case GX_ITM_T1:
|
||||
case GX_ITM_T2:
|
||||
idx = (u32)(id - GX_ITM_T0);
|
||||
id_offset = (u32)(mtx_id - GX_ITM_T0);
|
||||
break;
|
||||
default:
|
||||
idx = 0;
|
||||
id_offset = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
exp += 17;
|
||||
offsetS32[0] = (s32)(offset[0][0] * 0x400) & 0x7FF;
|
||||
offsetS32[1] = (s32)(offset[1][0] * 0x400) & 0x7FF;
|
||||
|
||||
mtx32[0] = (s32)(mtx[0][0] * 1024.0f) & 0x7FF;
|
||||
mtx32[1] = (s32)(mtx[1][0] * 1024.0f) & 0x7FF;
|
||||
offsetS32[2] = (s32)(offset[0][1] * 0x400) & 0x7FF;
|
||||
offsetS32[3] = (s32)(offset[1][1] * 0x400) & 0x7FF;
|
||||
|
||||
mtx32[2] = (s32)(mtx[0][1] * 1024.0f) & 0x7FF;
|
||||
mtx32[3] = (s32)(mtx[1][1] * 1024.0f) & 0x7FF;
|
||||
|
||||
mtx32[4] = (s32)(mtx[0][2] * 1024.0f) & 0x7FF;
|
||||
mtx32[5] = (s32)(mtx[1][2] * 1024.0f) & 0x7FF;
|
||||
offsetS32[4] = (s32)(offset[0][2] * 0x400) & 0x7FF;
|
||||
offsetS32[5] = (s32)(offset[1][2] * 0x400) & 0x7FF;
|
||||
|
||||
scale_exp += (s8)17;
|
||||
GDOverflowCheck(15);
|
||||
|
||||
J3DGDWriteBPCmd((mtx32[0] << 0) | (mtx32[1] << 11) | (((exp >> 0) & 0x03) << 22) |
|
||||
(0x06 + idx * 3) << 24);
|
||||
J3DGDWriteBPCmd((mtx32[2] << 0) | (mtx32[3] << 11) | (((exp >> 2) & 0x03) << 22) |
|
||||
(0x07 + idx * 3) << 24);
|
||||
J3DGDWriteBPCmd((mtx32[4] << 0) | (mtx32[5] << 11) | (((exp >> 4) & 0x03) << 22) |
|
||||
(0x08 + idx * 3) << 24);
|
||||
J3DGDWriteBPCmd(BP_IND_MTX(
|
||||
offsetS32[0],
|
||||
offsetS32[1],
|
||||
scale_exp & 3,
|
||||
6 + id_offset * 3
|
||||
));
|
||||
|
||||
J3DGDWriteBPCmd(BP_IND_MTX(
|
||||
offsetS32[2],
|
||||
offsetS32[3],
|
||||
(scale_exp >> 2) & 3,
|
||||
7 + id_offset * 3
|
||||
));
|
||||
|
||||
J3DGDWriteBPCmd(BP_IND_MTX(
|
||||
offsetS32[4],
|
||||
offsetS32[5],
|
||||
(scale_exp >> 4) & 3,
|
||||
8 + id_offset * 3
|
||||
));
|
||||
}
|
||||
|
||||
/* 8030EE10-8030EF08 309750 00F8+00 0/0 2/2 0/0 .text
|
||||
* J3DGDSetIndTexCoordScale__F16_GXIndTexStageID14_GXIndTexScale14_GXIndTexScale14_GXIndTexScale14_GXIndTexScale
|
||||
*/
|
||||
void J3DGDSetIndTexCoordScale(GXIndTexStageID stage, GXIndTexScale scale0, GXIndTexScale scale1,
|
||||
GXIndTexScale scale2, GXIndTexScale scale3) {
|
||||
void J3DGDSetIndTexCoordScale(GXIndTexStageID indStageEven, GXIndTexScale scaleS0,
|
||||
GXIndTexScale scaleT0, GXIndTexScale scaleS1,
|
||||
GXIndTexScale scaleT1) {
|
||||
GDOverflowCheck(5);
|
||||
J3DGDWriteBPCmd(scale0 | scale1 << 4 | scale2 << 8 | scale3 << 0xc |
|
||||
((stage >> 1) + GX_BP_REG_RAS1_SS0) << 0x18);
|
||||
J3DGDWriteBPCmd(BP_IND_TEXCOORD_SCALE(
|
||||
scaleS0,
|
||||
scaleT0,
|
||||
scaleS1,
|
||||
scaleT1,
|
||||
0x25 + (indStageEven >> 1)
|
||||
));
|
||||
}
|
||||
|
||||
/* 8030EF08-8030F108 309848 0200+00 0/0 2/2 0/0 .text
|
||||
* J3DGDSetIndTexOrder__FUl13_GXTexCoordID11_GXTexMapID13_GXTexCoordID11_GXTexMapID13_GXTexCoordID11_GXTexMapID13_GXTexCoordID11_GXTexMapID
|
||||
*/
|
||||
void J3DGDSetIndTexOrder(u32 count, GXTexCoordID coord0, GXTexMapID map0, GXTexCoordID coord1,
|
||||
GXTexMapID map1, GXTexCoordID coord2, GXTexMapID map2, GXTexCoordID coord3,
|
||||
GXTexMapID map3) {
|
||||
GDOverflowCheck(0xa);
|
||||
J3DGDWriteBPCmd(map0 & 7 | (coord0 & 7) << 3 | (map1 & 7) << 6 | (coord1 & 7) << 9 |
|
||||
(map2 & 7) << 0xc | (coord2 & 7) << 0xf | (map3 & 7) << 0x12 |
|
||||
(coord3 & 7) << 0x15 | GX_BP_REG_RAS1_IREF << 0x18);
|
||||
u32 imask = 0;
|
||||
void J3DGDSetIndTexOrder(u32 count, GXTexCoordID texCoord0, GXTexMapID texMap0,
|
||||
GXTexCoordID texCoord1, GXTexMapID texMap1,
|
||||
GXTexCoordID texCoord2, GXTexMapID texMap2,
|
||||
GXTexCoordID texCoord3, GXTexMapID texMap3) {
|
||||
GDOverflowCheck(10);
|
||||
J3DGDWriteBPCmd(BP_IND_TEX_ORDER(
|
||||
texMap0 & 7,
|
||||
texCoord0 & 7,
|
||||
texMap1 & 7,
|
||||
texCoord1 & 7,
|
||||
texMap2 & 7,
|
||||
texCoord2 & 7,
|
||||
texMap3 & 7,
|
||||
texCoord3 & 7,
|
||||
0x27
|
||||
));
|
||||
|
||||
u32 mask = 0;
|
||||
for (u32 i = 0; i < count; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
imask |= 1 << (map0 & 7);
|
||||
mask |= 1 << (texMap0 & 7);
|
||||
break;
|
||||
case 1:
|
||||
imask |= 1 << (map1 & 7);
|
||||
mask |= 1 << (texMap1 & 7);
|
||||
break;
|
||||
case 2:
|
||||
imask |= 1 << (map2 & 7);
|
||||
mask |= 1 << (texMap2 & 7);
|
||||
break;
|
||||
case 3:
|
||||
imask |= 1 << (map3 & 7);
|
||||
mask |= 1 << (texMap3 & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
J3DGDWriteBPCmd(imask | GX_BP_REG_INDIMASK << 0x18);
|
||||
|
||||
J3DGDWriteBPCmd(BP_IND_MASK(mask, 0xF));
|
||||
}
|
||||
|
||||
/* 8030F108-8030F294 309A48 018C+00 0/0 9/9 0/0 .text
|
||||
* J3DGDSetTevOrder__F13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID13_GXTexCoordID11_GXTexMapID12_GXChannelID
|
||||
*/
|
||||
void J3DGDSetTevOrder(GXTevStageID stage, GXTexCoordID coord0, GXTexMapID map0,
|
||||
GXChannelID channel0, GXTexCoordID coord1, GXTexMapID map1,
|
||||
GXChannelID channel1) {
|
||||
coord0 = coord0 >= GX_MAX_TEXCOORD ? GX_TEXCOORD0 : coord0;
|
||||
coord1 = coord1 >= GX_MAX_TEXCOORD ? GX_TEXCOORD0 : coord1;
|
||||
GDOverflowCheck(5);
|
||||
void J3DGDSetTevOrder(GXTevStageID evenStage, GXTexCoordID coord0, GXTexMapID map0,
|
||||
GXChannelID color0, GXTexCoordID coord1, GXTexMapID map1,
|
||||
GXChannelID color1) {
|
||||
static u8 c2r[] = {0, 1, 0, 1, 0, 1, 7, 5, 6, 0, 0, 0, 0, 0, 0, 7};
|
||||
J3DGDWriteBPCmd((map0 & 7) | coord0 << 3 |
|
||||
(map0 != GX_TEXMAP_NULL && !(map0 & GX_TEX_DISABLE)) << 6 |
|
||||
c2r[channel0 & 0xf] << 7 | (map1 & 7) << 0xc | coord1 << 0xf |
|
||||
(map1 != GX_TEXMAP_NULL && !(map1 & GX_TEX_DISABLE)) << 0x12 |
|
||||
c2r[channel1 & 0xf] << 0x13 | (stage / 2 + GX_BP_REG_RAS1_TREF0) << 0x18);
|
||||
|
||||
GXTexCoordID coord0_ = coord0 >= GX_MAX_TEXCOORD ? GX_TEXCOORD0 : coord0;
|
||||
GXTexCoordID coord1_ = coord1 >= GX_MAX_TEXCOORD ? GX_TEXCOORD0 : coord1;
|
||||
GDOverflowCheck(5);
|
||||
J3DGDWriteBPCmd(BP_TEV_ORDER(
|
||||
map0 & 7,
|
||||
coord0_,
|
||||
map0 != GX_TEXMAP_NULL && !(map0 & GX_TEX_DISABLE),
|
||||
c2r[color0 & 0xF],
|
||||
map1 & 7,
|
||||
coord1_,
|
||||
map1 != GX_TEXMAP_NULL && !(map1 & GX_TEX_DISABLE),
|
||||
c2r[color1 & 0xF],
|
||||
evenStage / 2 + 0x28
|
||||
));
|
||||
}
|
||||
|
||||
/* 8030F294-8030F3FC 309BD4 0168+00 0/0 11/11 0/0 .text
|
||||
* J3DGDSetTevKColor__F14_GXTevKColorID8_GXColor */
|
||||
void J3DGDSetTevKColor(GXTevKColorID id, GXColor color) {
|
||||
u32 cmd0 = color.r | color.a << 0xc | 0x800000 | (id * 2 + GX_BP_REG_TEVREG0LO) << 0x18;
|
||||
u32 cmd1 = color.b | color.g << 0xc | 0x800000 | (id * 2 + GX_BP_REG_TEVREG0HI) << 0x18;
|
||||
void J3DGDSetTevKColor(GXTevKColorID reg, GXColor color) {
|
||||
u32 regRA;
|
||||
u32 regBG;
|
||||
|
||||
regRA = BP_TEV_COLOR_REG_RA(color.r, color.a, 1, 0xE0 + reg * 2);
|
||||
regBG = BP_TEV_COLOR_REG_BG(color.b, color.g, 1, 0xE1 + reg * 2);
|
||||
|
||||
GDOverflowCheck(0xa);
|
||||
J3DGDWriteBPCmd(cmd0);
|
||||
J3DGDWriteBPCmd(cmd1);
|
||||
J3DGDWriteBPCmd(regRA);
|
||||
J3DGDWriteBPCmd(regBG);
|
||||
}
|
||||
|
||||
/* 8030F3FC-8030F630 309D3C 0234+00 0/0 11/11 0/0 .text
|
||||
* J3DGDSetTevColorS10__F11_GXTevRegID11_GXColorS10 */
|
||||
void J3DGDSetTevColorS10(GXTevRegID id, GXColorS10 color) {
|
||||
u32 cmd0 =
|
||||
(color.r & 0x7ff) | (color.a & 0x7ff) << 0xc | (id * 2 + GX_BP_REG_TEVREG0LO) << 0x18;
|
||||
u32 cmd1 =
|
||||
(color.b & 0x7ff) | (color.g & 0x7ff) << 0xc | (id * 2 + GX_BP_REG_TEVREG0HI) << 0x18;
|
||||
void J3DGDSetTevColorS10(GXTevRegID reg, GXColorS10 color) {
|
||||
u32 regRA;
|
||||
u32 regBG;
|
||||
|
||||
regRA = BP_TEV_COLOR_REG_RA(color.r & 0x7FF, color.a & 0x7FF, 0, 0xE0 + reg * 2);
|
||||
regBG = BP_TEV_COLOR_REG_BG(color.b & 0x7FF, color.g & 0x7FF, 0, 0xE1 + reg * 2);
|
||||
|
||||
GDOverflowCheck(0x14);
|
||||
J3DGDWriteBPCmd(cmd0);
|
||||
J3DGDWriteBPCmd(cmd1);
|
||||
J3DGDWriteBPCmd(cmd1);
|
||||
J3DGDWriteBPCmd(cmd1);
|
||||
J3DGDWriteBPCmd(regRA);
|
||||
J3DGDWriteBPCmd(regBG);
|
||||
J3DGDWriteBPCmd(regBG);
|
||||
J3DGDWriteBPCmd(regBG);
|
||||
}
|
||||
|
||||
/* 8030F630-8030F994 309F70 0364+00 0/0 3/3 0/0 .text J3DGDSetFog__F10_GXFogTypeffff8_GXColor */
|
||||
void J3DGDSetFog(GXFogType fogType, f32 param_1, f32 param_2, f32 nearZ, f32 farZ, GXColor color) {
|
||||
f32 fvar1, fvar2, fvar3;
|
||||
if (farZ == nearZ || param_2 == param_1) {
|
||||
fvar1 = 0.0f;
|
||||
fvar2 = 0.5f;
|
||||
fvar3 = 0.0f;
|
||||
void J3DGDSetFog(GXFogType type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor color) {
|
||||
f32 A;
|
||||
f32 B;
|
||||
f32 B_mant;
|
||||
f32 C;
|
||||
f32 A_f;
|
||||
u32 b_expn;
|
||||
u32 b_m;
|
||||
u32 a_hex;
|
||||
u32 c_hex;
|
||||
|
||||
ASSERTMSGLINE(1036, farz >= 0.0f, "GDSetFog: The farz should be positive value");
|
||||
ASSERTMSGLINE(1037, farz >= nearz, "GDSetFog: The farz should be larger than nearz");
|
||||
|
||||
|
||||
if (farz == nearz || endz == startz) {
|
||||
A = 0.0f;
|
||||
B = 0.5f;
|
||||
C = 0.0f;
|
||||
} else {
|
||||
fvar1 = (farZ * nearZ) / ((farZ - nearZ) * (param_2 - param_1));
|
||||
fvar2 = farZ / (farZ - nearZ);
|
||||
fvar3 = param_1 / (param_2 - param_1);
|
||||
A = (farz * nearz) / ((farz - nearz) * (endz - startz));
|
||||
B = farz / (farz - nearz);
|
||||
C = startz / (endz - startz);
|
||||
}
|
||||
u32 shift = 1;
|
||||
for (; fvar2 > 1.0; fvar2 *= 0.5f) {
|
||||
shift++;
|
||||
|
||||
B_mant = B;
|
||||
b_expn = 1;
|
||||
|
||||
while (B_mant > 1.0) {
|
||||
B_mant *= 0.5f;
|
||||
b_expn++;
|
||||
}
|
||||
for (; fvar2 > 0.0f && fvar2 < 0.5; fvar2 *= 2.0f) {
|
||||
shift--;
|
||||
|
||||
while (B_mant > 0.0f && B_mant < 0.5) {
|
||||
B_mant *= 2.0f;
|
||||
b_expn--;
|
||||
}
|
||||
f32 fvar4 = (fvar1 / (1 << shift));
|
||||
u32 param1 = fvar2 * 8388638.0f;
|
||||
u32 param0 = *(u32*)&fvar4;
|
||||
u32 param3 = *(u32*)&fvar3;
|
||||
J3DGDWriteBPCmd(param0 >> 0xc | GX_BP_REG_FOGPARAM0 << 0x18);
|
||||
J3DGDWriteBPCmd(param1 | GX_BP_REG_FOGPARAM1 << 0x18);
|
||||
J3DGDWriteBPCmd(shift | GX_BP_REG_FOGPARAM2 << 0x18);
|
||||
J3DGDWriteBPCmd(param3 >> 0xc | fogType << 0x15 | GX_BP_REG_FOGPARAM3 << 0x18);
|
||||
J3DGDWriteBPCmd(color.b | color.g << 8 | color.r << 0x10 | GX_BP_REG_FOGCOLOR << 0x18);
|
||||
|
||||
A_f = A / (1 << b_expn);
|
||||
b_m = (u32) (8388638.0f * B_mant);
|
||||
|
||||
a_hex = *(u32*)&A_f;
|
||||
c_hex = *(u32*)&C;
|
||||
|
||||
J3DGDWriteBPCmd(BP_FOG_UNK0(a_hex >> 12, 0xEE));
|
||||
J3DGDWriteBPCmd(BP_FOG_UNK1(b_m, 0xEF));
|
||||
J3DGDWriteBPCmd(BP_FOG_UNK2(b_expn, 0xF0));
|
||||
J3DGDWriteBPCmd(BP_FOG_UNK3(c_hex >> 12, 0, type, 0xF1));
|
||||
J3DGDWriteBPCmd(BP_FOG_COLOR(color.r, color.g, color.b, 0xF2));
|
||||
}
|
||||
|
||||
#define BP_FOG_RANGE_ADJ_K0(arg0, arg1, arg2) \
|
||||
( \
|
||||
(u32)(arg2) << 24 | \
|
||||
(u32)(arg1) << 12 | \
|
||||
(u32)(arg0) << 0 \
|
||||
)
|
||||
|
||||
#define BP_FOG_RANGE_ADJ(arg0, arg1, arg2) \
|
||||
( \
|
||||
(u32)(arg2) << 24 | \
|
||||
(u32)(arg0) << 0 | \
|
||||
(u32)(arg1) << 10 \
|
||||
)
|
||||
|
||||
/* 8030F994-8030FAE0 30A2D4 014C+00 0/0 3/3 0/0 .text J3DGDSetFogRangeAdj__FUcUsP14_GXFogAdjTable
|
||||
*/
|
||||
void J3DGDSetFogRangeAdj(u8 param_0, u16 param_1, GXFogAdjTable* table) {
|
||||
if (param_0 != 0) {
|
||||
for (int i = 0; i < 0xa; i += 2) {
|
||||
J3DGDWriteBPCmd((i / 2 + GX_BP_REG_FOGRANGEK0) << 0x18 | table->r[i + 1] << 0xc |
|
||||
table->r[i]);
|
||||
void J3DGDSetFogRangeAdj(GXBool enable, u16 center, GXFogAdjTable* table) {
|
||||
if (enable) {
|
||||
for (int i = 0; i < 10; i += 2) {
|
||||
u32 range_adj = BP_FOG_RANGE_ADJ_K0(table->r[i], table->r[i + 1], i / 2 + 0xE9);
|
||||
J3DGDWriteBPCmd(range_adj);
|
||||
}
|
||||
}
|
||||
u32 cmd = GX_BP_REG_FOGRANGE << 0x18 | (param_1 + 0x156) | param_0 << 0xa;
|
||||
J3DGDWriteBPCmd(cmd);
|
||||
|
||||
u32 range_c = BP_FOG_RANGE_ADJ(center + 342, enable, GX_BP_REG_FOGRANGE);
|
||||
J3DGDWriteBPCmd(range_c);
|
||||
}
|
||||
|
||||
/* 8030FAE0-8030FB60 30A420 0080+00 0/0 10/10 0/0 .text J3DFifoLoadPosMtxImm__FPA4_fUl */
|
||||
void J3DFifoLoadPosMtxImm(MtxP mtx, u32 addr) {
|
||||
J3DFifoWriteXFCmdHdr((addr & 0x3fff) << 2, 0xc);
|
||||
void J3DFifoLoadPosMtxImm(MtxP mtx, u32 id) {
|
||||
J3DFifoWriteXFCmdHdr(4 * id, 12);
|
||||
J3DGXCmd1f32ptr(&mtx[0][0]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][1]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][2]);
|
||||
@@ -578,8 +674,8 @@ void J3DFifoLoadPosMtxImm(MtxP mtx, u32 addr) {
|
||||
}
|
||||
|
||||
/* 8030FB60-8030FBCC 30A4A0 006C+00 0/0 9/9 0/0 .text J3DFifoLoadNrmMtxImm__FPA4_fUl */
|
||||
void J3DFifoLoadNrmMtxImm(MtxP mtx, u32 addr) {
|
||||
J3DFifoWriteXFCmdHdr(addr * 3 + 0x400, 9);
|
||||
void J3DFifoLoadNrmMtxImm(MtxP mtx, u32 id) {
|
||||
J3DFifoWriteXFCmdHdr(id * 3 + 0x400, 9);
|
||||
J3DGXCmd1f32ptr(&mtx[0][0]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][1]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][2]);
|
||||
@@ -593,8 +689,8 @@ void J3DFifoLoadNrmMtxImm(MtxP mtx, u32 addr) {
|
||||
|
||||
/* 8030FBCC-8030FC38 30A50C 006C+00 0/0 3/3 0/0 .text J3DFifoLoadNrmMtxImm3x3__FPA3_fUl
|
||||
*/
|
||||
void J3DFifoLoadNrmMtxImm3x3(Mtx3P mtx, u32 addr) {
|
||||
J3DFifoWriteXFCmdHdr(addr * 3 + 0x400, 9);
|
||||
void J3DFifoLoadNrmMtxImm3x3(Mtx3P mtx, u32 id) {
|
||||
J3DFifoWriteXFCmdHdr(id * 3 + 0x400, 9);
|
||||
J3DGXCmd1f32ptr(&mtx[0][0]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][1]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][2]);
|
||||
@@ -608,8 +704,8 @@ void J3DFifoLoadNrmMtxImm3x3(Mtx3P mtx, u32 addr) {
|
||||
|
||||
/* 8030FC38-8030FCD0 30A578 0098+00 0/0 4/4 0/0 .text J3DFifoLoadNrmMtxToTexMtx__FPA4_fUl
|
||||
*/
|
||||
void J3DFifoLoadNrmMtxToTexMtx(MtxP mtx, u32 addr) {
|
||||
J3DFifoWriteXFCmdHdr((addr & 0x3fff) << 2, 0xc);
|
||||
void J3DFifoLoadNrmMtxToTexMtx(MtxP mtx, u32 id) {
|
||||
J3DFifoWriteXFCmdHdr(4 * id, 12);
|
||||
J3DGXCmd1f32ptr(&mtx[0][0]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][1]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][2]);
|
||||
@@ -625,8 +721,8 @@ void J3DFifoLoadNrmMtxToTexMtx(MtxP mtx, u32 addr) {
|
||||
}
|
||||
|
||||
/* 8030FCD0-8030FD68 30A610 0098+00 0/0 2/2 0/0 .text J3DFifoLoadNrmMtxToTexMtx3x3__FPA3_fUl */
|
||||
void J3DFifoLoadNrmMtxToTexMtx3x3(Mtx3P mtx, u32 addr) {
|
||||
J3DFifoWriteXFCmdHdr((addr & 0x3fff) << 2, 0xc);
|
||||
void J3DFifoLoadNrmMtxToTexMtx3x3(Mtx3P mtx, u32 id) {
|
||||
J3DFifoWriteXFCmdHdr(4 * id, 0xc);
|
||||
J3DGXCmd1f32ptr(&mtx[0][0]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][1]);
|
||||
J3DGXCmd1f32ptr(&mtx[0][2]);
|
||||
@@ -653,12 +749,11 @@ static u8 J3DTexImage2Ids[8] = {
|
||||
|
||||
/* 8030FD68-8030FDE8 30A6A8 0080+00 0/0 1/1 0/0 .text
|
||||
* J3DFifoLoadTexCached__F11_GXTexMapIDUl15_GXTexCacheSizeUl15_GXTexCacheSize */
|
||||
void J3DFifoLoadTexCached(GXTexMapID id, u32 param_1, GXTexCacheSize param_2, u32 param_3,
|
||||
GXTexCacheSize param_4) {
|
||||
J3DFifoLoadBPCmd(param_1 >> 5 | (param_2 + 3) << 0xf | (param_2 + 3) << 0x12 |
|
||||
J3DTexImage1Ids[id] << 0x18);
|
||||
if (param_4 != GX_TEXCACHE_NONE && param_3 < 0x100000) {
|
||||
J3DFifoLoadBPCmd(param_3 >> 5 | (param_4 + 3) << 0xf | (param_4 + 3) << 0x12 |
|
||||
J3DTexImage2Ids[id] << 0x18);
|
||||
void J3DFifoLoadTexCached(GXTexMapID id, u32 tmem_even, GXTexCacheSize size_even,
|
||||
u32 tmem_odd, GXTexCacheSize size_odd) {
|
||||
J3DFifoLoadBPCmd(BP_TEX_CACHE_EVEN(tmem_even >> 5, size_even + 3, size_even + 3, 0, J3DTexImage1Ids[id]));
|
||||
|
||||
if (size_odd != 3 && tmem_odd < 0x100000) {
|
||||
J3DFifoLoadBPCmd(BP_TEX_CACHE_ODD(tmem_odd >> 5, size_odd + 3, size_odd + 3, J3DTexImage2Ids[id]));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,166 +1,184 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DMaterial
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphBase/J3DGD.h"
|
||||
|
||||
/* 803157A0-803159A0 3100E0 0200+00 0/0 3/3 0/0 .text createColorBlock__11J3DMaterialFUl
|
||||
*/
|
||||
J3DColorBlock* J3DMaterial::createColorBlock(u32 param_0) {
|
||||
J3DColorBlock* J3DMaterial::createColorBlock(u32 flags) {
|
||||
J3DColorBlock* rv = NULL;
|
||||
switch (param_0) {
|
||||
case 0:
|
||||
rv = new J3DColorBlockLightOff();
|
||||
break;
|
||||
case 0x40000000:
|
||||
rv = new J3DColorBlockLightOn();
|
||||
break;
|
||||
case 0x80000000:
|
||||
rv = new J3DColorBlockAmbientOn();
|
||||
break;
|
||||
switch (flags) {
|
||||
case 0:
|
||||
rv = new J3DColorBlockLightOff();
|
||||
break;
|
||||
case 0x40000000:
|
||||
rv = new J3DColorBlockLightOn();
|
||||
break;
|
||||
case 0x80000000:
|
||||
rv = new J3DColorBlockAmbientOn();
|
||||
break;
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(55, rv != NULL);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 803159A0-80315B04 3102E0 0164+00 0/0 2/2 0/0 .text createTexGenBlock__11J3DMaterialFUl
|
||||
*/
|
||||
J3DTexGenBlock* J3DMaterial::createTexGenBlock(u32 param_0) {
|
||||
switch (param_0) {
|
||||
case 0x8000000:
|
||||
return new J3DTexGenBlock4();
|
||||
case 0:
|
||||
default:
|
||||
return new J3DTexGenBlockBasic();
|
||||
J3DTexGenBlock* J3DMaterial::createTexGenBlock(u32 flags) {
|
||||
J3DTexGenBlock* rv = NULL;
|
||||
switch (flags) {
|
||||
case 0x8000000:
|
||||
rv = new J3DTexGenBlock4();
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
rv = new J3DTexGenBlockBasic();
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(83, rv != NULL);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 80315B04-80315E78 310444 0374+00 0/0 2/2 0/0 .text createTevBlock__11J3DMaterialFi */
|
||||
J3DTevBlock* J3DMaterial::createTevBlock(int param_0) {
|
||||
J3DTevBlock* J3DMaterial::createTevBlock(int tevStageNum) {
|
||||
J3DTevBlock* rv = NULL;
|
||||
if (param_0 <= 1) {
|
||||
if (tevStageNum <= 1) {
|
||||
rv = new J3DTevBlock1();
|
||||
} else if (param_0 == 2) {
|
||||
} else if (tevStageNum == 2) {
|
||||
rv = new J3DTevBlock2();
|
||||
} else if (param_0 <= 4) {
|
||||
} else if (tevStageNum <= 4) {
|
||||
rv = new J3DTevBlock4();
|
||||
} else if (param_0 <= 16) {
|
||||
} else if (tevStageNum <= 16) {
|
||||
rv = new J3DTevBlock16();
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(116, rv != NULL);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 80315E78-80315F60 3107B8 00E8+00 0/0 3/3 0/0 .text createIndBlock__11J3DMaterialFi */
|
||||
J3DIndBlock* J3DMaterial::createIndBlock(int param_0) {
|
||||
if (param_0 != 0) {
|
||||
return new J3DIndBlockFull();
|
||||
J3DIndBlock* J3DMaterial::createIndBlock(int flags) {
|
||||
J3DIndBlock* rv = NULL;
|
||||
if (flags != 0) {
|
||||
rv = new J3DIndBlockFull();
|
||||
} else {
|
||||
rv = new J3DIndBlockNull();
|
||||
}
|
||||
|
||||
return new J3DIndBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(139, rv != NULL);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 80315F60-80316100 3108A0 01A0+00 0/0 3/3 0/0 .text createPEBlock__11J3DMaterialFUlUl
|
||||
*/
|
||||
J3DPEBlock* J3DMaterial::createPEBlock(u32 createFlag, u32 materialMode) {
|
||||
J3DPEBlock* J3DMaterial::createPEBlock(u32 flags, u32 materialMode) {
|
||||
J3DPEBlock* rv = NULL;
|
||||
|
||||
if (createFlag == 0) {
|
||||
if (flags == 0) {
|
||||
if (materialMode & 1) {
|
||||
rv = new J3DPEBlockOpa();
|
||||
J3D_ASSERT_ALLOCMEM(166, rv != NULL);
|
||||
return rv;
|
||||
} else if (materialMode & 2) {
|
||||
rv = new J3DPEBlockTexEdge();
|
||||
J3D_ASSERT_ALLOCMEM(172, rv != NULL);
|
||||
return rv;
|
||||
} else if (materialMode & 4) {
|
||||
rv = new J3DPEBlockXlu();
|
||||
J3D_ASSERT_ALLOCMEM(178, rv != NULL);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (createFlag == 0x10000000) {
|
||||
if (flags == 0x10000000) {
|
||||
rv = new J3DPEBlockFull();
|
||||
} else if (createFlag == 0x20000000) {
|
||||
} else if (flags == 0x20000000) {
|
||||
rv = new J3DPEBlockFogOff();
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(188, rv != NULL);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 80316100-80316150 310A40 0050+00 0/0 2/2 0/0 .text calcSizeColorBlock__11J3DMaterialFUl */
|
||||
u32 J3DMaterial::calcSizeColorBlock(u32 param_0) {
|
||||
u32 J3DMaterial::calcSizeColorBlock(u32 flags) {
|
||||
u32 rv = 0;
|
||||
switch (param_0) {
|
||||
case 0:
|
||||
rv = sizeof(J3DColorBlockLightOff);
|
||||
break;
|
||||
case 0x40000000:
|
||||
rv = sizeof(J3DColorBlockLightOn);
|
||||
break;
|
||||
case 0x80000000:
|
||||
rv = sizeof(J3DColorBlockAmbientOn);
|
||||
break;
|
||||
switch (flags) {
|
||||
case 0:
|
||||
rv += sizeof(J3DColorBlockLightOff);
|
||||
break;
|
||||
case 0x40000000:
|
||||
rv += sizeof(J3DColorBlockLightOn);
|
||||
break;
|
||||
case 0x80000000:
|
||||
rv += sizeof(J3DColorBlockAmbientOn);
|
||||
break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 80316150-8031617C 310A90 002C+00 0/0 1/1 0/0 .text calcSizeTexGenBlock__11J3DMaterialFUl */
|
||||
u32 J3DMaterial::calcSizeTexGenBlock(u32 param_0) {
|
||||
switch (param_0) {
|
||||
case 0x8000000:
|
||||
return sizeof(J3DTexGenBlock4);
|
||||
case 0:
|
||||
default:
|
||||
return sizeof(J3DTexGenBlockBasic);
|
||||
u32 J3DMaterial::calcSizeTexGenBlock(u32 flags) {
|
||||
u32 rv = 0;
|
||||
switch (flags) {
|
||||
case 0x8000000:
|
||||
rv += sizeof(J3DTexGenBlock4);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
rv += sizeof(J3DTexGenBlockBasic);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8031617C-803161C4 310ABC 0048+00 0/0 1/1 0/0 .text calcSizeTevBlock__11J3DMaterialFi
|
||||
*/
|
||||
u32 J3DMaterial::calcSizeTevBlock(int param_0) {
|
||||
u32 J3DMaterial::calcSizeTevBlock(int tevStageNum) {
|
||||
u32 rv = 0;
|
||||
if (param_0 <= 1) {
|
||||
rv = sizeof(J3DTevBlock1);
|
||||
} else if (param_0 == 2) {
|
||||
rv = sizeof(J3DTevBlock2);
|
||||
} else if (param_0 <= 4) {
|
||||
rv = sizeof(J3DTevBlock4);
|
||||
} else if (param_0 <= 16) {
|
||||
rv = sizeof(J3DTevBlock16);
|
||||
if (tevStageNum <= 1) {
|
||||
rv += sizeof(J3DTevBlock1);
|
||||
} else if (tevStageNum == 2) {
|
||||
rv += sizeof(J3DTevBlock2);
|
||||
} else if (tevStageNum <= 4) {
|
||||
rv += sizeof(J3DTevBlock4);
|
||||
} else if (tevStageNum <= 16) {
|
||||
rv += sizeof(J3DTevBlock16);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 803161C4-803161D8 310B04 0014+00 0/0 2/2 0/0 .text calcSizeIndBlock__11J3DMaterialFi
|
||||
*/
|
||||
u32 J3DMaterial::calcSizeIndBlock(int param_0) {
|
||||
if (param_0 != 0) {
|
||||
return sizeof(J3DIndBlockFull);
|
||||
u32 J3DMaterial::calcSizeIndBlock(int flags) {
|
||||
u32 rv = 0;
|
||||
if (flags != 0) {
|
||||
rv += sizeof(J3DIndBlockFull);
|
||||
} else {
|
||||
rv += sizeof(J3DIndBlockNull);
|
||||
}
|
||||
|
||||
return sizeof(J3DIndBlockNull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 803161D8-80316240 310B18 0068+00 0/0 2/2 0/0 .text calcSizePEBlock__11J3DMaterialFUlUl
|
||||
*/
|
||||
u32 J3DMaterial::calcSizePEBlock(u32 param_0, u32 param_1) {
|
||||
u32 J3DMaterial::calcSizePEBlock(u32 flags, u32 materialMode) {
|
||||
u32 rv = 0;
|
||||
if (param_0 == 0) {
|
||||
if (param_1 & 1) {
|
||||
rv = sizeof(J3DPEBlockOpa);
|
||||
} else if (param_1 & 2) {
|
||||
rv = sizeof(J3DPEBlockTexEdge);
|
||||
} else if (param_1 & 4) {
|
||||
rv = sizeof(J3DPEBlockXlu);
|
||||
if (flags == 0) {
|
||||
if (materialMode & 1) {
|
||||
rv += sizeof(J3DPEBlockOpa);
|
||||
} else if (materialMode & 2) {
|
||||
rv += sizeof(J3DPEBlockTexEdge);
|
||||
} else if (materialMode & 4) {
|
||||
rv += sizeof(J3DPEBlockXlu);
|
||||
}
|
||||
} else if (flags == 0x10000000) {
|
||||
rv += sizeof(J3DPEBlockFull);
|
||||
} else if (flags == 0x20000000) {
|
||||
rv += sizeof(J3DPEBlockFogOff);
|
||||
}
|
||||
else if (param_0 == 0x10000000) {
|
||||
rv = sizeof(J3DPEBlockFull);
|
||||
} else if (param_0 == 0x20000000) {
|
||||
rv = sizeof(J3DPEBlockFogOff);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -191,8 +209,8 @@ u32 J3DMaterial::countDLSize() {
|
||||
|
||||
/* 80316344-80316620 310C84 02DC+00 2/2 0/0 0/0 .text
|
||||
* makeDisplayList_private__11J3DMaterialFP17J3DDisplayListObj */
|
||||
void J3DMaterial::makeDisplayList_private(J3DDisplayListObj* param_0) {
|
||||
param_0->beginDL();
|
||||
void J3DMaterial::makeDisplayList_private(J3DDisplayListObj* pDLObj) {
|
||||
pDLObj->beginDL();
|
||||
mTevBlock->load();
|
||||
mIndBlock->load();
|
||||
mPEBlock->load();
|
||||
@@ -201,7 +219,7 @@ void J3DMaterial::makeDisplayList_private(J3DDisplayListObj* param_0) {
|
||||
mColorBlock->load();
|
||||
J3DGDSetNumChans(mColorBlock->getColorChanNum());
|
||||
J3DGDSetNumTexGens(mTexGenBlock->getTexGenNum());
|
||||
param_0->endDL();
|
||||
pDLObj->endDL();
|
||||
}
|
||||
|
||||
/* 80316620-80316668 310F60 0048+00 1/0 0/0 0/0 .text makeDisplayList__11J3DMaterialFv */
|
||||
@@ -245,18 +263,20 @@ void J3DMaterial::patch() {
|
||||
}
|
||||
|
||||
/* 803167D8-803169DC 311118 0204+00 2/0 0/0 0/0 .text diff__11J3DMaterialFUl */
|
||||
void J3DMaterial::diff(u32 param_0) {
|
||||
void J3DMaterial::diff(u32 diffFlags) {
|
||||
if (j3dSys.getMatPacket()->isEnabled_Diff()) {
|
||||
j3dSys.getMatPacket()->beginDiff();
|
||||
mTevBlock->diff(param_0);
|
||||
mIndBlock->diff(param_0);
|
||||
mPEBlock->diff(param_0);
|
||||
if (param_0 & 0x2000000) {
|
||||
|
||||
mTevBlock->diff(diffFlags);
|
||||
mIndBlock->diff(diffFlags);
|
||||
mPEBlock->diff(diffFlags);
|
||||
if (diffFlags & J3DDiffFlag_KonstColor) {
|
||||
J3DGDSetGenMode_3Param(mTexGenBlock->getTexGenNum(), mTevBlock->getTevStageNum(), mIndBlock->getIndTexStageNum());
|
||||
J3DGDSetNumTexGens(mTexGenBlock->getTexGenNum());
|
||||
}
|
||||
mTexGenBlock->diff(param_0);
|
||||
mColorBlock->diff(param_0);
|
||||
mTexGenBlock->diff(diffFlags);
|
||||
mColorBlock->diff(diffFlags);
|
||||
|
||||
j3dSys.getMatPacket()->endDiff();
|
||||
}
|
||||
}
|
||||
@@ -291,43 +311,44 @@ void J3DMaterial::setCurrentMtx() {
|
||||
void J3DMaterial::calcCurrentMtx() {
|
||||
if (!j3dSys.checkFlag(0x40000000)) {
|
||||
mCurrentMtx.setCurrentTexMtx(
|
||||
mTexGenBlock->getTexCoord(0)->getTexGenMtx(),
|
||||
mTexGenBlock->getTexCoord(1)->getTexGenMtx(),
|
||||
mTexGenBlock->getTexCoord(2)->getTexGenMtx(),
|
||||
mTexGenBlock->getTexCoord(3)->getTexGenMtx(),
|
||||
mTexGenBlock->getTexCoord(4)->getTexGenMtx(),
|
||||
mTexGenBlock->getTexCoord(5)->getTexGenMtx(),
|
||||
mTexGenBlock->getTexCoord(6)->getTexGenMtx(),
|
||||
mTexGenBlock->getTexCoord(7)->getTexGenMtx()
|
||||
getTexCoord(0)->getTexGenMtx(),
|
||||
getTexCoord(1)->getTexGenMtx(),
|
||||
getTexCoord(2)->getTexGenMtx(),
|
||||
getTexCoord(3)->getTexGenMtx(),
|
||||
getTexCoord(4)->getTexGenMtx(),
|
||||
getTexCoord(5)->getTexGenMtx(),
|
||||
getTexCoord(6)->getTexGenMtx(),
|
||||
getTexCoord(7)->getTexGenMtx()
|
||||
);
|
||||
} else {
|
||||
mCurrentMtx.setCurrentTexMtx(
|
||||
mTexGenBlock->getTexCoord(0)->getTexMtxReg(),
|
||||
mTexGenBlock->getTexCoord(1)->getTexMtxReg(),
|
||||
mTexGenBlock->getTexCoord(2)->getTexMtxReg(),
|
||||
mTexGenBlock->getTexCoord(3)->getTexMtxReg(),
|
||||
mTexGenBlock->getTexCoord(4)->getTexMtxReg(),
|
||||
mTexGenBlock->getTexCoord(5)->getTexMtxReg(),
|
||||
mTexGenBlock->getTexCoord(6)->getTexMtxReg(),
|
||||
mTexGenBlock->getTexCoord(7)->getTexMtxReg()
|
||||
getTexCoord(0)->getTexMtxReg(),
|
||||
getTexCoord(1)->getTexMtxReg(),
|
||||
getTexCoord(2)->getTexMtxReg(),
|
||||
getTexCoord(3)->getTexMtxReg(),
|
||||
getTexCoord(4)->getTexMtxReg(),
|
||||
getTexCoord(5)->getTexMtxReg(),
|
||||
getTexCoord(6)->getTexMtxReg(),
|
||||
getTexCoord(7)->getTexMtxReg()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* 80316D68-80316E14 3116A8 00AC+00 1/1 0/0 0/0 .text copy__11J3DMaterialFP11J3DMaterial
|
||||
*/
|
||||
void J3DMaterial::copy(J3DMaterial* param_0) {
|
||||
mColorBlock->reset(param_0->mColorBlock);
|
||||
mTexGenBlock->reset(param_0->mTexGenBlock);
|
||||
mTevBlock->reset(param_0->mTevBlock);
|
||||
mIndBlock->reset(param_0->mIndBlock);
|
||||
mPEBlock->reset(param_0->mPEBlock);
|
||||
void J3DMaterial::copy(J3DMaterial* pOther) {
|
||||
J3D_ASSERT_NULLPTR(620, pOther != NULL);
|
||||
mColorBlock->reset(pOther->mColorBlock);
|
||||
mTexGenBlock->reset(pOther->mTexGenBlock);
|
||||
mTevBlock->reset(pOther->mTevBlock);
|
||||
mIndBlock->reset(pOther->mIndBlock);
|
||||
mPEBlock->reset(pOther->mPEBlock);
|
||||
}
|
||||
|
||||
/* 80316E14-80316E70 311754 005C+00 1/0 0/0 0/0 .text reset__11J3DMaterialFv */
|
||||
void J3DMaterial::reset() {
|
||||
if ((~mDiffFlag & 0x80000000) == 0) {
|
||||
mDiffFlag &= ~0x80000000;
|
||||
if ((~mDiffFlag & J3DDiffFlag_Changed) == 0) {
|
||||
mDiffFlag &= ~J3DDiffFlag_Changed;
|
||||
mMaterialMode = mpOrigMaterial->mMaterialMode;
|
||||
mInvalid = mpOrigMaterial->mInvalid;
|
||||
mMaterialAnm = NULL;
|
||||
@@ -337,47 +358,45 @@ void J3DMaterial::reset() {
|
||||
|
||||
/* 80316E70-80316E90 3117B0 0020+00 1/0 0/0 0/0 .text change__11J3DMaterialFv */
|
||||
void J3DMaterial::change() {
|
||||
if ((mDiffFlag & 0xc0000000) == 0) {
|
||||
mDiffFlag |= 0x80000000;
|
||||
if ((mDiffFlag & (J3DDiffFlag_Changed | J3DDiffFlag_Unk40000000)) == 0) {
|
||||
mDiffFlag |= J3DDiffFlag_Changed;
|
||||
mMaterialAnm = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* 80316E90-80316F24 3117D0 0094+00 0/0 2/2 0/0 .text newSharedDisplayList__11J3DMaterialFUl */
|
||||
s32 J3DMaterial::newSharedDisplayList(u32 param_0) {
|
||||
s32 J3DMaterial::newSharedDisplayList(u32 dlSize) {
|
||||
if (mSharedDLObj == NULL) {
|
||||
mSharedDLObj = new J3DDisplayListObj();
|
||||
if (mSharedDLObj == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
s32 res = mSharedDLObj->newDisplayList(param_0);
|
||||
switch (res) {
|
||||
case kJ3DError_Success:
|
||||
break;
|
||||
default:
|
||||
return res;
|
||||
|
||||
s32 ret = mSharedDLObj->newDisplayList(dlSize);
|
||||
if (ret != kJ3DError_Success) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 80316F24-80316FB8 311864 0094+00 0/0 2/2 0/0 .text newSingleSharedDisplayList__11J3DMaterialFUl
|
||||
*/
|
||||
s32 J3DMaterial::newSingleSharedDisplayList(u32 param_0) {
|
||||
s32 J3DMaterial::newSingleSharedDisplayList(u32 dlSize) {
|
||||
if (mSharedDLObj == NULL) {
|
||||
mSharedDLObj = new J3DDisplayListObj();
|
||||
if (mSharedDLObj == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
s32 res = mSharedDLObj->newSingleDisplayList(param_0);
|
||||
switch (res) {
|
||||
case kJ3DError_Success:
|
||||
break;
|
||||
default:
|
||||
return res;
|
||||
|
||||
s32 ret = mSharedDLObj->newSingleDisplayList(dlSize);
|
||||
if (ret != kJ3DError_Success) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 80316FB8-80316FD8 3118F8 0020+00 0/0 1/1 0/0 .text initialize__18J3DPatchedMaterialFv
|
||||
@@ -387,15 +406,11 @@ void J3DPatchedMaterial::initialize() {
|
||||
}
|
||||
|
||||
/* 80316FD8-80316FDC 311918 0004+00 1/0 0/0 0/0 .text makeDisplayList__18J3DPatchedMaterialFv */
|
||||
void J3DPatchedMaterial::makeDisplayList() {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DPatchedMaterial::makeDisplayList() {}
|
||||
|
||||
/* 80316FDC-80316FE0 31191C 0004+00 1/0 0/0 0/0 .text
|
||||
* makeSharedDisplayList__18J3DPatchedMaterialFv */
|
||||
void J3DPatchedMaterial::makeSharedDisplayList() {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DPatchedMaterial::makeSharedDisplayList() {}
|
||||
|
||||
/* 80316FE0-80316FFC 311920 001C+00 1/0 0/0 0/0 .text load__18J3DPatchedMaterialFv */
|
||||
void J3DPatchedMaterial::load() {
|
||||
@@ -413,14 +428,10 @@ void J3DPatchedMaterial::loadSharedDL() {
|
||||
}
|
||||
|
||||
/* 8031703C-80317040 31197C 0004+00 1/0 0/0 0/0 .text reset__18J3DPatchedMaterialFv */
|
||||
void J3DPatchedMaterial::reset() {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DPatchedMaterial::reset() {}
|
||||
|
||||
/* 80317040-80317044 311980 0004+00 1/0 0/0 0/0 .text change__18J3DPatchedMaterialFv */
|
||||
void J3DPatchedMaterial::change() {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DPatchedMaterial::change() {}
|
||||
|
||||
/* 80317044-80317064 311984 0020+00 0/0 1/1 0/0 .text initialize__17J3DLockedMaterialFv
|
||||
*/
|
||||
@@ -429,15 +440,11 @@ void J3DLockedMaterial::initialize() {
|
||||
}
|
||||
|
||||
/* 80317064-80317068 3119A4 0004+00 1/0 0/0 0/0 .text makeDisplayList__17J3DLockedMaterialFv */
|
||||
void J3DLockedMaterial::makeDisplayList() {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DLockedMaterial::makeDisplayList() {}
|
||||
|
||||
/* 80317068-8031706C 3119A8 0004+00 1/0 0/0 0/0 .text makeSharedDisplayList__17J3DLockedMaterialFv
|
||||
*/
|
||||
void J3DLockedMaterial::makeSharedDisplayList() {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DLockedMaterial::makeSharedDisplayList() {}
|
||||
|
||||
/* 8031706C-80317088 3119AC 001C+00 1/0 0/0 0/0 .text load__17J3DLockedMaterialFv */
|
||||
void J3DLockedMaterial::load() {
|
||||
@@ -456,26 +463,16 @@ void J3DLockedMaterial::loadSharedDL() {
|
||||
}
|
||||
|
||||
/* 803170C8-803170CC 311A08 0004+00 1/0 0/0 0/0 .text patch__17J3DLockedMaterialFv */
|
||||
void J3DLockedMaterial::patch() {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DLockedMaterial::patch() {}
|
||||
|
||||
/* 803170CC-803170D0 311A0C 0004+00 1/0 0/0 0/0 .text diff__17J3DLockedMaterialFUl */
|
||||
void J3DLockedMaterial::diff(u32 param_0) {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DLockedMaterial::diff(u32 diffFlags) {}
|
||||
|
||||
/* 803170D0-803170D4 311A10 0004+00 1/0 0/0 0/0 .text calc__17J3DLockedMaterialFPA4_Cf */
|
||||
void J3DLockedMaterial::calc(const Mtx param_0) {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DLockedMaterial::calc(const Mtx param_0) {}
|
||||
|
||||
/* 803170D4-803170D8 311A14 0004+00 1/0 0/0 0/0 .text reset__17J3DLockedMaterialFv */
|
||||
void J3DLockedMaterial::reset() {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DLockedMaterial::reset() {}
|
||||
|
||||
/* 803170D8-803170DC 311A18 0004+00 1/0 0/0 0/0 .text change__17J3DLockedMaterialFv */
|
||||
void J3DLockedMaterial::change() {
|
||||
/* empty function */
|
||||
}
|
||||
void J3DLockedMaterial::change() {}
|
||||
|
||||
@@ -9,63 +9,64 @@
|
||||
#include "string.h"
|
||||
#include "global.h"
|
||||
|
||||
J3DError J3DDisplayListObj::newDisplayList(u32 capacity) {
|
||||
mCapacity = ALIGN_NEXT(capacity, 0x20);
|
||||
mpData[0] = new (0x20) char[mCapacity];
|
||||
mpData[1] = new (0x20) char[mCapacity];
|
||||
J3DError J3DDisplayListObj::newDisplayList(u32 maxSize) {
|
||||
mMaxSize = ALIGN_NEXT(maxSize, 0x20);
|
||||
mpDisplayList[0] = new (0x20) char[mMaxSize];
|
||||
mpDisplayList[1] = new (0x20) char[mMaxSize];
|
||||
mSize = 0;
|
||||
|
||||
if (mpData[0] == NULL || mpData[1] == NULL)
|
||||
if (mpDisplayList[0] == NULL || mpDisplayList[1] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
J3DError J3DDisplayListObj::newSingleDisplayList(u32 capacity) {
|
||||
mCapacity = ALIGN_NEXT(capacity, 0x20);
|
||||
mpData[0] = new (0x20) char[mCapacity];
|
||||
mpData[1] = mpData[0];
|
||||
J3DError J3DDisplayListObj::newSingleDisplayList(u32 maxSize) {
|
||||
mMaxSize = ALIGN_NEXT(maxSize, 0x20);
|
||||
mpDisplayList[0] = new (0x20) char[mMaxSize];
|
||||
mpDisplayList[1] = mpDisplayList[0];
|
||||
mSize = 0;
|
||||
|
||||
if (mpData[0] == NULL)
|
||||
if (mpDisplayList[0] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 8031256C-803125E4 30CEAC 0078+00 0/0 1/1 0/0 .text single_To_Double__17J3DDisplayListObjFv */
|
||||
J3DError J3DDisplayListObj::single_To_Double() {
|
||||
if (mpData[0] == mpData[1]) {
|
||||
mpData[1] = new (0x20) char[mCapacity];
|
||||
int J3DDisplayListObj::single_To_Double() {
|
||||
if (mpDisplayList[0] == mpDisplayList[1]) {
|
||||
mpDisplayList[1] = new (0x20) char[mMaxSize];
|
||||
|
||||
if (mpData[1] == NULL)
|
||||
if (mpDisplayList[1] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
|
||||
memcpy(mpData[1], mpData[0], mCapacity);
|
||||
DCStoreRange(mpData[1], mCapacity);
|
||||
memcpy(mpDisplayList[1], mpDisplayList[0], mMaxSize);
|
||||
DCStoreRange(mpDisplayList[1], mMaxSize);
|
||||
}
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
void J3DDisplayListObj::setSingleDisplayList(void* pDLData, u32 size) {
|
||||
mCapacity = ALIGN_NEXT(size, 0x20);
|
||||
mpData[0] = pDLData;
|
||||
mpData[1] = mpData[0];
|
||||
J3D_ASSERT_NULLPTR(148, pDLData != NULL);
|
||||
|
||||
mMaxSize = ALIGN_NEXT(size, 0x20);
|
||||
mpDisplayList[0] = pDLData;
|
||||
mpDisplayList[1] = mpDisplayList[0];
|
||||
mSize = size;
|
||||
}
|
||||
|
||||
void J3DDisplayListObj::swapBuffer() {
|
||||
void* pTmp = mpData[0];
|
||||
mpData[0] = mpData[1];
|
||||
mpData[1] = pTmp;
|
||||
void* pTmp = mpDisplayList[0];
|
||||
mpDisplayList[0] = mpDisplayList[1];
|
||||
mpDisplayList[1] = pTmp;
|
||||
}
|
||||
|
||||
void J3DDisplayListObj::callDL() const {
|
||||
GXCallDisplayList(mpData[0], mSize);
|
||||
GXCallDisplayList(mpDisplayList[0], mSize);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80434C70-80434C80 061990 0010+00 2/2 3/3 0/0 .bss sGDLObj__17J3DDisplayListObj */
|
||||
GDLObj J3DDisplayListObj::sGDLObj;
|
||||
|
||||
@@ -77,7 +78,7 @@ s32 J3DDisplayListObj::sInterruptFlag;
|
||||
void J3DDisplayListObj::beginDL() {
|
||||
swapBuffer();
|
||||
sInterruptFlag = OSDisableInterrupts();
|
||||
GDInitGDLObj(&sGDLObj, (u8*)mpData[0], mCapacity);
|
||||
GDInitGDLObj(&sGDLObj, (u8*)mpDisplayList[0], mMaxSize);
|
||||
GDSetCurrent(&sGDLObj);
|
||||
}
|
||||
|
||||
@@ -105,28 +106,44 @@ u32 J3DDisplayListObj::endPatch() {
|
||||
}
|
||||
|
||||
/* 80312750-80312758 30D090 0008+00 3/0 16/0 10/0 .text entry__9J3DPacketFP13J3DDrawBuffer */
|
||||
int J3DPacket::entry(J3DDrawBuffer*) {
|
||||
int J3DPacket::entry(J3DDrawBuffer* pBuffer) {
|
||||
J3D_ASSERT_NULLPTR(290, pBuffer != NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void J3DPacket::addChildPacket(J3DPacket* pPacket) {
|
||||
J3D_ASSERT_NULLPTR(304, pPacket != NULL);
|
||||
|
||||
if (mpFirstChild == NULL) {
|
||||
mpFirstChild = pPacket;
|
||||
} else {
|
||||
pPacket->mpNextPacket = mpFirstChild;
|
||||
pPacket->setNextPacket(mpFirstChild);
|
||||
mpFirstChild = pPacket;
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803CD900-803CD920 02AA20 0020+00 1/1 0/0 0/0 .data sDifferedRegister */
|
||||
static u32 sDifferedRegister[8] = {
|
||||
0x00000004, 0x00000001, 0x00000002, 0x01000000, 0x10000000, 0x20000000, 0x02000000, 0x08000000,
|
||||
J3DDiffFlag_AmbColor,
|
||||
J3DDiffFlag_MatColor,
|
||||
J3DDiffFlag_ColorChan,
|
||||
J3DDiffFlag_TevReg,
|
||||
J3DDiffFlag_Fog,
|
||||
J3DDiffFlag_Blend,
|
||||
J3DDiffFlag_KonstColor,
|
||||
J3DDiffFlag_TevStageIndirect,
|
||||
};
|
||||
|
||||
/* 803CD920-803CD940 02AA40 0020+00 1/1 0/0 0/0 .data sSizeOfDiffered */
|
||||
static s32 sSizeOfDiffered[8] = {
|
||||
13, 13, 21, 120, 55, 15, 19, 45,
|
||||
13,
|
||||
13,
|
||||
21,
|
||||
120,
|
||||
55,
|
||||
15,
|
||||
19,
|
||||
45,
|
||||
};
|
||||
|
||||
/* 80312778-803127B0 30D0B8 0038+00 2/2 0/0 0/0 .text __ct__13J3DDrawPacketFv */
|
||||
@@ -169,7 +186,7 @@ J3DError J3DDrawPacket::newSingleDisplayList(u32 size) {
|
||||
}
|
||||
|
||||
void J3DDrawPacket::draw() {
|
||||
mpDisplayListObj->callDL();
|
||||
callDL();
|
||||
}
|
||||
|
||||
/* 80312948-803129A4 30D288 005C+00 0/0 1/1 0/0 .text __ct__12J3DMatPacketFv */
|
||||
@@ -177,7 +194,7 @@ J3DMatPacket::J3DMatPacket() {
|
||||
mpInitShapePacket = NULL;
|
||||
mpShapePacket = NULL;
|
||||
mpMaterial = NULL;
|
||||
mDiffFlag = -1;
|
||||
mDiffFlag = 0xFFFFFFFF;
|
||||
mpTexture = NULL;
|
||||
mpMaterialAnm = NULL;
|
||||
}
|
||||
@@ -189,37 +206,32 @@ void J3DMatPacket::addShapePacket(J3DShapePacket* pShape) {
|
||||
if (mpShapePacket == NULL) {
|
||||
mpShapePacket = pShape;
|
||||
} else {
|
||||
pShape->mpNextPacket = mpShapePacket;
|
||||
pShape->setNextPacket(mpShapePacket);
|
||||
mpShapePacket = pShape;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMatPacket::beginDiff() {
|
||||
mpInitShapePacket->mpDisplayListObj->beginDL();
|
||||
mpInitShapePacket->beginDL();
|
||||
}
|
||||
|
||||
void J3DMatPacket::endDiff() {
|
||||
mpInitShapePacket->mpDisplayListObj->endDL();
|
||||
mpInitShapePacket->endDL();
|
||||
}
|
||||
|
||||
/* 80312A74-80312A9C 30D3B4 0028+00 0/0 1/1 0/0 .text isSame__12J3DMatPacketCFP12J3DMatPacket */
|
||||
bool J3DMatPacket::isSame(J3DMatPacket* pOther) const {
|
||||
bool isSame = false;
|
||||
|
||||
if (mDiffFlag == pOther->mDiffFlag && !(mDiffFlag >> 0x1F)) {
|
||||
isSame = true;
|
||||
}
|
||||
return isSame;
|
||||
J3D_ASSERT_NULLPTR(521, pOther != NULL);
|
||||
return mDiffFlag == pOther->mDiffFlag && (mDiffFlag >> 31) == 0;
|
||||
}
|
||||
|
||||
/* 80312A9C-80312B20 30D3DC 0084+00 1/0 0/0 0/0 .text draw__12J3DMatPacketFv */
|
||||
void J3DMatPacket::draw() {
|
||||
mpMaterial->load();
|
||||
callDL();
|
||||
J3DShapePacket* packet = getShapePacket();
|
||||
|
||||
J3DShape* shape = packet->getShape();
|
||||
shape->loadPreDrawSetting();
|
||||
J3DShapePacket* packet = getShapePacket();
|
||||
packet->getShape()->loadPreDrawSetting();
|
||||
|
||||
while (packet != NULL) {
|
||||
if (packet->getDisplayListObj() != NULL) {
|
||||
@@ -230,7 +242,7 @@ void J3DMatPacket::draw() {
|
||||
packet = (J3DShapePacket*)packet->getNextPacket();
|
||||
}
|
||||
|
||||
shape->resetVcdVatCache();
|
||||
J3DShape::resetVcdVatCache();
|
||||
}
|
||||
|
||||
/* 80312B20-80312B74 30D460 0054+00 0/0 1/1 0/0 .text __ct__14J3DShapePacketFv */
|
||||
@@ -247,76 +259,83 @@ J3DShapePacket::~J3DShapePacket() {}
|
||||
|
||||
/* 80312BD4-80312DBC 30D514 01E8+00 1/1 0/0 0/0 .text calcDifferedBufferSize__14J3DShapePacketFUl
|
||||
*/
|
||||
u32 J3DShapePacket::calcDifferedBufferSize(u32 flag) {
|
||||
int iVar5 = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if ((flag & sDifferedRegister[i]) != 0) {
|
||||
iVar5 += sSizeOfDiffered[i];
|
||||
u32 J3DShapePacket::calcDifferedBufferSize(u32 diffFlags) {
|
||||
u32 bufferSize = 0;
|
||||
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if ((diffFlags & sDifferedRegister[i]) != 0) {
|
||||
bufferSize += sSizeOfDiffered[i];
|
||||
}
|
||||
}
|
||||
|
||||
iVar5 += getDiffFlag_LightObjNum(flag) * 0x48;
|
||||
u32 uVar2 = getDiffFlag_TexGenNum(flag);
|
||||
if (uVar2 != 0) {
|
||||
u32 local_4c = mpShape->getMaterial()->getTexGenNum();
|
||||
if (uVar2 > local_4c) {
|
||||
local_4c = uVar2;
|
||||
}
|
||||
if ((flag & 0x1000)) {
|
||||
iVar5 += calcDifferedBufferSize_TexGenSize(local_4c);
|
||||
u32 lightObjNum = getDiffFlag_LightObjNum(diffFlags);
|
||||
bufferSize += lightObjNum * 0x48;
|
||||
|
||||
u32 texGenNum = getDiffFlag_TexGenNum(diffFlags);
|
||||
if (texGenNum != 0) {
|
||||
u32 mat_texGenNum = mpShape->getMaterial()->getTexGenNum();
|
||||
u32 sp30 = texGenNum > mat_texGenNum ? texGenNum : mat_texGenNum;
|
||||
|
||||
if (diffFlags & J3DDiffFlag_TexGen) {
|
||||
bufferSize += calcDifferedBufferSize_TexGenSize(sp30);
|
||||
} else {
|
||||
iVar5 += calcDifferedBufferSize_TexMtxSize(local_4c);
|
||||
bufferSize += calcDifferedBufferSize_TexMtxSize(sp30);
|
||||
}
|
||||
}
|
||||
|
||||
uVar2 = getDiffFlag_TexNoNum(flag);
|
||||
if (uVar2 != 0) {
|
||||
u8 local_58;
|
||||
u32 texNoNum = getDiffFlag_TexNoNum(diffFlags);
|
||||
if (texNoNum != 0) {
|
||||
u8 sp9;
|
||||
if (mpShape->getMaterial()->getTevStageNum() > 8) {
|
||||
local_58 = 8;
|
||||
sp9 = 8;
|
||||
} else {
|
||||
local_58 = mpShape->getMaterial()->getTevStageNum();
|
||||
sp9 = mpShape->getMaterial()->getTevStageNum();
|
||||
}
|
||||
u32 local_50 = local_58;
|
||||
local_50 = uVar2 > local_50 ? uVar2 : local_50;
|
||||
if ((flag & 0x4000000)) {
|
||||
iVar5 += calcDifferedBufferSize_TexNoAndTexCoordScaleSize(local_50);
|
||||
|
||||
u32 mat_texNoNum = sp9;
|
||||
u32 sp24 = texNoNum > mat_texNoNum ? texNoNum : mat_texNoNum;
|
||||
|
||||
if (diffFlags & J3DDiffFlag_TexCoordScale) {
|
||||
bufferSize += calcDifferedBufferSize_TexNoAndTexCoordScaleSize(sp24);
|
||||
} else {
|
||||
iVar5 += calcDifferedBufferSize_TexNoSize(local_50);
|
||||
bufferSize += calcDifferedBufferSize_TexNoSize(sp24);
|
||||
}
|
||||
}
|
||||
|
||||
uVar2 = getDiffFlag_TevStageNum(flag);
|
||||
if (uVar2 != 0) {
|
||||
u8 local_58;
|
||||
u32 tevStageNum = getDiffFlag_TevStageNum(diffFlags);
|
||||
if (tevStageNum != 0) {
|
||||
u8 sp8;
|
||||
if (mpShape->getMaterial()->getTevStageNum() > 8) {
|
||||
local_58 = 8;
|
||||
sp8 = 8;
|
||||
} else {
|
||||
local_58 = mpShape->getMaterial()->getTevStageNum();
|
||||
sp8 = mpShape->getMaterial()->getTevStageNum();
|
||||
}
|
||||
u32 local_50 = local_58;
|
||||
local_50 = uVar2 > local_50 ? uVar2 : local_50;
|
||||
iVar5 += calcDifferedBufferSize_TevStageSize(local_50);
|
||||
if (flag & 0x8000000) {
|
||||
iVar5 += calcDifferedBufferSize_TevStageDirectSize(local_50);
|
||||
|
||||
u32 mat_tevStageNum = sp8;
|
||||
u32 sp18 = tevStageNum > mat_tevStageNum ? tevStageNum : mat_tevStageNum;
|
||||
|
||||
bufferSize += calcDifferedBufferSize_TevStageSize(sp18);
|
||||
if (diffFlags & J3DDiffFlag_TevStageIndirect) {
|
||||
bufferSize += calcDifferedBufferSize_TevStageDirectSize(sp18);
|
||||
}
|
||||
}
|
||||
|
||||
return (iVar5 + 0x1f) & ~0x1f;
|
||||
return OSRoundUp32B(bufferSize);
|
||||
}
|
||||
|
||||
/* 80312DBC-80312E08 30D6FC 004C+00 0/0 1/1 0/0 .text newDifferedDisplayList__14J3DShapePacketFUl
|
||||
*/
|
||||
J3DError J3DShapePacket::newDifferedDisplayList(u32 flag) {
|
||||
mDiffFlag = flag;
|
||||
u32 bufSize = calcDifferedBufferSize(flag);
|
||||
J3DError error = newDisplayList(bufSize);
|
||||
int J3DShapePacket::newDifferedDisplayList(u32 diffFlags) {
|
||||
mDiffFlag = diffFlags;
|
||||
|
||||
if (error != kJ3DError_Success) {
|
||||
return error;
|
||||
u32 bufSize = calcDifferedBufferSize(diffFlags);
|
||||
int ret = newDisplayList(bufSize);
|
||||
if (ret != kJ3DError_Success) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
setDisplayListObj(getDisplayListObj());
|
||||
J3DDisplayListObj* dlobj = getDisplayListObj();
|
||||
setDisplayListObj(dlobj);
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
@@ -326,8 +345,7 @@ void J3DShapePacket::prepareDraw() const {
|
||||
j3dSys.setModel(mpModel);
|
||||
j3dSys.setShapePacket((J3DShapePacket*)this);
|
||||
|
||||
// the way that the LOD flag is set seems to be wrong...
|
||||
J3DShapeMtx::setLODFlag(mpModel->checkFlag(0x10));
|
||||
J3DShapeMtx::setLODFlag(mpModel->checkFlag(J3DMdlFlag_EnableLOD) != 0);
|
||||
|
||||
if (mpModel->checkFlag(J3DMdlFlag_SkinPosCpu)) {
|
||||
mpShape->onFlag(J3DShpFlag_SkinPosCpu);
|
||||
@@ -343,15 +361,14 @@ void J3DShapePacket::prepareDraw() const {
|
||||
mpShape->offFlag(J3DShpFlag_SkinNrmCpu);
|
||||
}
|
||||
|
||||
J3DMtxBuffer* buffer = mpMtxBuffer;
|
||||
mpShape->setCurrentViewNoPtr(buffer->getCurrentViewNoPtr());
|
||||
mpShape->setScaleFlagArray(buffer->getScaleFlagArray());
|
||||
mpShape->setDrawMtx(buffer->getDrawMtxPtrPtr());
|
||||
mpShape->setCurrentViewNoPtr(mpMtxBuffer->getCurrentViewNoPtr());
|
||||
mpShape->setScaleFlagArray(mpMtxBuffer->getScaleFlagArray());
|
||||
mpShape->setDrawMtx(mpMtxBuffer->getDrawMtxPtrPtr());
|
||||
|
||||
if (!mpShape->getNBTFlag()) {
|
||||
mpShape->setNrmMtx(buffer->getNrmMtxPtrPtr());
|
||||
mpShape->setNrmMtx(mpMtxBuffer->getNrmMtxPtrPtr());
|
||||
} else {
|
||||
mpShape->setNrmMtx(buffer->getBumpMtxPtrPtr()[mpShape->getBumpMtxOffset()]);
|
||||
mpShape->setNrmMtx(mpMtxBuffer->mpBumpMtxArr[1][mpShape->getBumpMtxOffset()]);
|
||||
}
|
||||
|
||||
mpModel->getModelData()->syncJ3DSysFlags();
|
||||
@@ -363,8 +380,7 @@ void J3DShapePacket::draw() {
|
||||
prepareDraw();
|
||||
|
||||
if (mpTexMtxObj != NULL) {
|
||||
J3DMaterial* material = mpShape->getMaterial();
|
||||
J3DDifferedTexMtx::sTexGenBlock = material->getTexGenBlock();
|
||||
J3DDifferedTexMtx::sTexGenBlock = mpShape->getMaterial()->getTexGenBlock();
|
||||
J3DDifferedTexMtx::sTexMtxObj = getTexMtxObj();
|
||||
} else {
|
||||
J3DDifferedTexMtx::sTexGenBlock = NULL;
|
||||
@@ -384,8 +400,7 @@ void J3DShapePacket::drawFast() {
|
||||
prepareDraw();
|
||||
|
||||
if (mpTexMtxObj != NULL) {
|
||||
J3DMaterial* material = mpShape->getMaterial();
|
||||
J3DDifferedTexMtx::sTexGenBlock = material->getTexGenBlock();
|
||||
J3DDifferedTexMtx::sTexGenBlock = mpShape->getMaterial()->getTexGenBlock();
|
||||
J3DDifferedTexMtx::sTexMtxObj = getTexMtxObj();
|
||||
} else {
|
||||
J3DDifferedTexMtx::sTexGenBlock = NULL;
|
||||
@@ -399,7 +414,7 @@ void J3DShapePacket::drawFast() {
|
||||
void J3DPacket::draw() {}
|
||||
|
||||
/* 80313048-803130A8 30D988 0060+00 1/0 0/0 0/0 .text entry__12J3DMatPacketFP13J3DDrawBuffer */
|
||||
int J3DMatPacket::entry(J3DDrawBuffer* i_buffer) {
|
||||
sortFunc func = J3DDrawBuffer::sortFuncTable[i_buffer->mSortType];
|
||||
return (i_buffer->*func)(this);
|
||||
int J3DMatPacket::entry(J3DDrawBuffer* pBuffer) {
|
||||
J3DDrawBuffer::sortFunc func = J3DDrawBuffer::sortFuncTable[pBuffer->getSortMode()];
|
||||
return (pBuffer->*func)(this);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
#include "JSystem/J3DGraphBase/J3DShape.h"
|
||||
#include "JSystem/J3DGraphBase/J3DPacket.h"
|
||||
#include "JSystem/J3DGraphBase/J3DVertex.h"
|
||||
#include "dolphin/gd.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "JSystem/J3DGraphBase/J3DFifo.h"
|
||||
#include <dolphin/gd.h>
|
||||
|
||||
void J3DGDSetVtxAttrFmtv(_GXVtxFmt, GXVtxAttrFmtList const*, bool);
|
||||
void J3DFifoLoadPosMtxImm(Mtx, u32);
|
||||
void J3DFifoLoadNrmMtxImm(Mtx, u32);
|
||||
|
||||
|
||||
enum {
|
||||
kVcdVatDLSize = 0xC0,
|
||||
};
|
||||
|
||||
void J3DShape::initialize() {
|
||||
mMaterial = NULL;
|
||||
mIndex = -1;
|
||||
@@ -62,19 +57,24 @@ void J3DShape::addTexMtxIndexInDL(GXAttr attr, u32 valueBase) {
|
||||
if (pnmtxidxOffs == -1)
|
||||
return;
|
||||
|
||||
for (u16 i = 0; i < getMtxGroupNum(); i++)
|
||||
for (u16 i = 0; i < (u16)getMtxGroupNum(); i++)
|
||||
getShapeDraw(i)->addTexMtxIndexInDL(stride, attrOffs, (s32)valueBase);
|
||||
}
|
||||
|
||||
/* 80314CBC-80314DA8 30F5FC 00EC+00 0/0 1/1 0/0 .text addTexMtxIndexInVcd__8J3DShapeF7_GXAttr */
|
||||
void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
||||
u32 kSize[] = {0, 1, 1, 2}; // stripped data
|
||||
|
||||
s32 attrIdx = -1;
|
||||
GXVtxDescList* vtxDesc = mVtxDesc;
|
||||
s32 attrOffs = -1;
|
||||
s32 stride = 0;
|
||||
|
||||
GXVtxDescList* vtxDesc = getVtxDesc();
|
||||
s32 attrCount = 0;
|
||||
|
||||
for (; vtxDesc->attr != GX_VA_NULL; attrCount++, vtxDesc++) {
|
||||
if (vtxDesc->attr == GX_VA_PNMTXIDX)
|
||||
attrIdx = 0;
|
||||
attrIdx = stride;
|
||||
}
|
||||
|
||||
if (attrIdx == -1)
|
||||
@@ -83,17 +83,21 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
||||
GXVtxDescList* newVtxDesc = new GXVtxDescList[attrCount + 2];
|
||||
bool inserted = false;
|
||||
|
||||
vtxDesc = mVtxDesc;
|
||||
vtxDesc = getVtxDesc();
|
||||
GXVtxDescList* dst = newVtxDesc;
|
||||
for (; vtxDesc->attr != GX_VA_NULL; dst++, vtxDesc++) {
|
||||
if ((attr < vtxDesc->attr) && !inserted) {
|
||||
dst->attr = attr;
|
||||
dst->type = GX_DIRECT;
|
||||
inserted = true;
|
||||
attrOffs = stride;
|
||||
dst++;
|
||||
|
||||
inserted = true;
|
||||
}
|
||||
|
||||
*dst = *vtxDesc;
|
||||
dst->attr = vtxDesc->attr;
|
||||
dst->type = vtxDesc->type;
|
||||
stride = stride + kSize[vtxDesc->type];
|
||||
}
|
||||
|
||||
dst->attr = GX_VA_NULL;
|
||||
@@ -104,7 +108,7 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
||||
|
||||
/* 80314DA8-80314E28 30F6E8 0080+00 0/0 1/1 0/0 .text
|
||||
* calcNBTScale__8J3DShapeFRC3VecPA3_A3_fPA3_A3_f */
|
||||
void J3DShape::calcNBTScale(Vec const& param_0, f32 (*param_1)[3][3], f32 (*param_2)[3][3]) {
|
||||
void J3DShape::calcNBTScale(const Vec& param_0, f32 (*param_1)[3][3], f32 (*param_2)[3][3]) {
|
||||
for (u16 i = 0; i < mMtxGroupNum; i++)
|
||||
mShapeMtx[i]->calcNBTScale(param_0, param_1, param_2);
|
||||
}
|
||||
@@ -114,28 +118,31 @@ u16 J3DShape::countBumpMtxNum() const {
|
||||
u16 num = 0;
|
||||
for (u16 i = 0; i < mMtxGroupNum; i++)
|
||||
num += mShapeMtx[i]->getUseMtxNum();
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
/* 80314E98-80314EB0 30F7D8 0018+00 1/1 0/0 0/0 .text J3DLoadCPCmd__FUcUl */
|
||||
void J3DLoadCPCmd(u8 cmd, u32 param) {
|
||||
GXWGFifo.u8 = GX_LOAD_CP_REG;
|
||||
GXWGFifo.u8 = cmd;
|
||||
GXWGFifo.u32 = param;
|
||||
void J3DLoadCPCmd(u8 addr, u32 val) {
|
||||
GXCmd1u8(GX_LOAD_CP_REG);
|
||||
GXCmd1u8(addr);
|
||||
GXCmd1u32(val);
|
||||
}
|
||||
|
||||
/* 80314EB0-80314EEC 30F7F0 003C+00 1/1 0/0 0/0 .text J3DLoadArrayBasePtr__F7_GXAttrPv */
|
||||
static void J3DLoadArrayBasePtr(_GXAttr attr, void* data) {
|
||||
static void J3DLoadArrayBasePtr(GXAttr attr, void* data) {
|
||||
u32 idx = (attr == GX_VA_NBT) ? 1 : (attr - GX_VA_POS);
|
||||
J3DLoadCPCmd(0xA0 + idx, ((u32)data & 0x7FFFFFFF));
|
||||
J3DLoadCPCmd(0xA0 + idx, ((uintptr_t)data & 0x7FFFFFFF));
|
||||
}
|
||||
|
||||
/* 80314EEC-80314F5C 30F82C 0070+00 3/3 0/0 0/0 .text loadVtxArray__8J3DShapeCFv */
|
||||
void J3DShape::loadVtxArray() const {
|
||||
J3DLoadArrayBasePtr(GX_VA_POS, j3dSys.getVtxPos());
|
||||
|
||||
if (!mHasNBT) {
|
||||
J3DLoadArrayBasePtr(GX_VA_NRM, j3dSys.getVtxNrm());
|
||||
}
|
||||
|
||||
J3DLoadArrayBasePtr(GX_VA_CLR0, j3dSys.getVtxCol());
|
||||
}
|
||||
|
||||
@@ -146,6 +153,7 @@ bool J3DShape::isSameVcdVatCmd(J3DShape* other) {
|
||||
for (u32 i = 0; i < kVcdVatDLSize; i++)
|
||||
if (a[i] != b[i])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -153,9 +161,9 @@ bool J3DShape::isSameVcdVatCmd(J3DShape* other) {
|
||||
void J3DShape::makeVtxArrayCmd() {
|
||||
GXVtxAttrFmtList* vtxAttr = mVertexData->getVtxAttrFmtList();
|
||||
|
||||
u8 stride[0x0C];
|
||||
void* array[0x0C];
|
||||
for (u32 i = 0; i < 0x0C; i++) {
|
||||
u8 stride[12];
|
||||
void* array[12];
|
||||
for (u32 i = 0; i < 12; i++) {
|
||||
stride[i] = 0;
|
||||
array[i] = 0;
|
||||
}
|
||||
@@ -164,27 +172,28 @@ void J3DShape::makeVtxArrayCmd() {
|
||||
switch (vtxAttr->attr) {
|
||||
case GX_VA_POS: {
|
||||
if (vtxAttr->type == GX_F32)
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 0x0C;
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 12;
|
||||
else
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 0x06;
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 6;
|
||||
|
||||
array[vtxAttr->attr - GX_VA_POS] = mVertexData->getVtxPosArray();
|
||||
mVertexData->setVtxPosFrac(vtxAttr->frac);
|
||||
mVertexData->setVtxPosFrac((u8)vtxAttr->frac);
|
||||
mVertexData->setVtxPosType((GXCompType)vtxAttr->type);
|
||||
} break;
|
||||
case GX_VA_NRM: {
|
||||
if (vtxAttr->type == GX_F32)
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 0x0C;
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 12;
|
||||
else
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 0x06;
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 6;
|
||||
|
||||
array[vtxAttr->attr - GX_VA_POS] = mVertexData->getVtxNrmArray();
|
||||
mVertexData->setVtxNrmFrac(vtxAttr->frac);
|
||||
mVertexData->setVtxNrmFrac((u8)vtxAttr->frac);
|
||||
mVertexData->setVtxNrmType((GXCompType)vtxAttr->type);
|
||||
} break;
|
||||
case GX_VA_CLR0:
|
||||
case GX_VA_CLR1: {
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 0x04;
|
||||
array[vtxAttr->attr - GX_VA_POS] =
|
||||
mVertexData->getVtxColorArray(vtxAttr->attr - GX_VA_CLR0);
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 4;
|
||||
array[vtxAttr->attr - GX_VA_POS] = mVertexData->getVtxColorArray(vtxAttr->attr - GX_VA_CLR0);
|
||||
} break;
|
||||
case GX_VA_TEX0:
|
||||
case GX_VA_TEX1:
|
||||
@@ -195,11 +204,11 @@ void J3DShape::makeVtxArrayCmd() {
|
||||
case GX_VA_TEX6:
|
||||
case GX_VA_TEX7: {
|
||||
if (vtxAttr->type == GX_F32)
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 0x08;
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 8;
|
||||
else
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 0x04;
|
||||
array[vtxAttr->attr - GX_VA_POS] =
|
||||
mVertexData->getVtxTexCoordArray(vtxAttr->attr - GX_VA_TEX0);
|
||||
stride[vtxAttr->attr - GX_VA_POS] = 4;
|
||||
|
||||
array[vtxAttr->attr - GX_VA_POS] = mVertexData->getVtxTexCoordArray(vtxAttr->attr - GX_VA_TEX0);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
@@ -218,7 +227,7 @@ void J3DShape::makeVtxArrayCmd() {
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < 0x0C; i++) {
|
||||
for (u32 i = 0; i < 12; i++) {
|
||||
if (array[i] != 0)
|
||||
GDSetArray((GXAttr)(i + GX_VA_POS), array[i], stride[i]);
|
||||
else
|
||||
@@ -226,19 +235,9 @@ void J3DShape::makeVtxArrayCmd() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515C8-804515CC 000AC8 0004+00 1/1 0/0 0/0 .sbss sInterruptFlag$903 */
|
||||
static s32 sInterruptFlag;
|
||||
|
||||
/* 804515CC-804515D0 000ACC 0004+00 1/1 0/0 0/0 .sbss None */
|
||||
static s8 sInitInterruptFlag;
|
||||
|
||||
/* 80315260-80315300 30FBA0 00A0+00 1/1 2/2 0/0 .text makeVcdVatCmd__8J3DShapeFv */
|
||||
void J3DShape::makeVcdVatCmd() {
|
||||
if (!sInitInterruptFlag) {
|
||||
sInterruptFlag = OSDisableInterrupts();
|
||||
sInitInterruptFlag = true;
|
||||
}
|
||||
static BOOL sInterruptFlag = OSDisableInterrupts();
|
||||
OSDisableScheduler();
|
||||
|
||||
GDLObj gdl_obj;
|
||||
@@ -254,10 +253,13 @@ void J3DShape::makeVcdVatCmd() {
|
||||
OSRestoreInterrupts(sInterruptFlag);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515D0-804515D4 000AD0 0004+00 5/5 25/25 9/9 .sbss sOldVcdVatCmd__8J3DShape */
|
||||
void* J3DShape::sOldVcdVatCmd;
|
||||
|
||||
void J3DShape::loadCurrentMtx() const {
|
||||
mCurrentMtx.load();
|
||||
}
|
||||
|
||||
/* 80315300-80315398 30FC40 0098+00 2/2 6/6 3/3 .text loadPreDrawSetting__8J3DShapeCFv */
|
||||
void J3DShape::loadPreDrawSetting() const {
|
||||
if (sOldVcdVatCmd != mVcdVatCmd) {
|
||||
@@ -268,9 +270,8 @@ void J3DShape::loadPreDrawSetting() const {
|
||||
mCurrentMtx.load();
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515D4-804515D8 000AD4 0004+00 3/3 0/0 0/0 .sbss None */
|
||||
static u8 data_804515D4[4];
|
||||
bool J3DShape::sEnvelopeFlag;
|
||||
|
||||
/* 80315398-8031544C 30FCD8 00B4+00 1/1 0/0 0/0 .text setArrayAndBindPipeline__8J3DShapeCFv */
|
||||
void J3DShape::setArrayAndBindPipeline() const {
|
||||
@@ -279,10 +280,8 @@ void J3DShape::setArrayAndBindPipeline() const {
|
||||
j3dSys.setModelDrawMtx(mDrawMtx[*mCurrentViewNo]);
|
||||
j3dSys.setModelNrmMtx(mNrmMtx[*mCurrentViewNo]);
|
||||
J3DShapeMtx::sCurrentScaleFlag = mScaleFlagArray;
|
||||
// The below struct_804515B0 is actually a continuation of sCurrentScaleFlag, I believe?
|
||||
// Also, there seems to be an extra entry in the array that's only there in DEBUG builds.
|
||||
J3DShapeMtx::sNBTFlag = mHasNBT;
|
||||
data_804515D4[0] = mHasPNMTXIdx;
|
||||
sEnvelopeFlag = mHasPNMTXIdx;
|
||||
J3DShapeMtx::sTexMtxLoadType = getTexMtxLoadType();
|
||||
}
|
||||
|
||||
@@ -293,13 +292,12 @@ void J3DShape::drawFast() const {
|
||||
sOldVcdVatCmd = mVcdVatCmd;
|
||||
}
|
||||
|
||||
if (data_804515D4[0] != 0 && !mHasPNMTXIdx)
|
||||
if (sEnvelopeFlag != 0 && !mHasPNMTXIdx)
|
||||
mCurrentMtx.load();
|
||||
|
||||
setArrayAndBindPipeline();
|
||||
if (!checkFlag(J3DShpFlag_NoMtx)) {
|
||||
// LOD flag shenanigans
|
||||
if (J3DShapeMtx::getLODFlag() != 0)
|
||||
if (J3DShapeMtx::getLODFlag())
|
||||
J3DShapeMtx::resetMtxLoadCache();
|
||||
|
||||
for (u16 n = mMtxGroupNum, i = 0; i < n; i++) {
|
||||
@@ -344,7 +342,7 @@ void J3DShape::simpleDrawCache() const {
|
||||
sOldVcdVatCmd = mVcdVatCmd;
|
||||
}
|
||||
|
||||
if (data_804515D4[0] != 0 && !mHasPNMTXIdx)
|
||||
if (sEnvelopeFlag && !mHasPNMTXIdx)
|
||||
mCurrentMtx.load();
|
||||
|
||||
loadVtxArray();
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DShapeDraw
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "string.h"
|
||||
#include "dolphin/gx.h"
|
||||
#include <dolphin/os.h>
|
||||
#include "global.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
/* 80314924-80314974 30F264 0050+00 1/1 0/0 0/0 .text countVertex__12J3DShapeDrawFUl */
|
||||
u32 J3DShapeDraw::countVertex(u32 stride) {
|
||||
u32 count = 0;
|
||||
u32 dlStart = (u32)getDisplayList();
|
||||
for (u8* dl = (u8*)dlStart; ((u32)dl - dlStart) < getDisplayListSize();) {
|
||||
uintptr_t dlStart = (uintptr_t)getDisplayList();
|
||||
|
||||
for (u8* dl = (u8*)dlStart; ((uintptr_t)dl - dlStart) < getDisplayListSize();) {
|
||||
if (*dl != GX_TRIANGLEFAN && *dl != GX_TRIANGLESTRIP)
|
||||
break;
|
||||
u16 vtxNum = *((u16*)(dl + 1));
|
||||
@@ -22,6 +17,7 @@ u32 J3DShapeDraw::countVertex(u32 stride) {
|
||||
dl += stride * vtxNum;
|
||||
dl += 3;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -34,6 +30,7 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
|
||||
u8* oldDLStart = getDisplayList();
|
||||
u8* oldDL = oldDLStart;
|
||||
u8* newDL = newDLStart;
|
||||
|
||||
for (; (oldDL - oldDLStart) < mDisplayListSize;) {
|
||||
// Copy command
|
||||
u8 h = *oldDL;
|
||||
@@ -62,16 +59,17 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
|
||||
oldDL += 3;
|
||||
}
|
||||
|
||||
u32 realSize = ALIGN_NEXT((u32)newDL - (u32)newDLStart, 0x20);
|
||||
u32 realSize = ALIGN_NEXT((uintptr_t)newDL - (uintptr_t)newDLStart, 0x20);
|
||||
for (; (newDL - newDLStart) < newSize; newDL++)
|
||||
*newDL = 0;
|
||||
|
||||
mDisplayListSize = realSize;
|
||||
mDisplayList = newDLStart;
|
||||
DCStoreRange(newDLStart, mDisplayListSize);
|
||||
}
|
||||
|
||||
/* 80314ABC-80314AD4 30F3FC 0018+00 0/0 1/1 0/0 .text __ct__12J3DShapeDrawFPCUcUl */
|
||||
J3DShapeDraw::J3DShapeDraw(u8 const* displayList, u32 displayListSize) {
|
||||
J3DShapeDraw::J3DShapeDraw(const u8* displayList, u32 displayListSize) {
|
||||
mDisplayList = (void*)displayList;
|
||||
mDisplayListSize = displayListSize;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DShapeMtx
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphBase/J3DGD.h"
|
||||
#include "JSystem/J3DGraphBase/J3DFifo.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
/* 80434C80-80434C98 0619A0 0014+04 2/2 0/0 0/0 .bss sMtxLoadCache__11J3DShapeMtx */
|
||||
u16 J3DShapeMtx::sMtxLoadCache[10];
|
||||
@@ -16,24 +10,23 @@ u16 J3DShapeMtx::sMtxLoadCache[10];
|
||||
/* 803130A8-803130E4 30D9E8 003C+00 0/0 1/1 0/0 .text resetMtxLoadCache__11J3DShapeMtxFv
|
||||
*/
|
||||
void J3DShapeMtx::resetMtxLoadCache() {
|
||||
sMtxLoadCache[0] =
|
||||
sMtxLoadCache[1] =
|
||||
sMtxLoadCache[2] =
|
||||
sMtxLoadCache[3] =
|
||||
sMtxLoadCache[4] =
|
||||
sMtxLoadCache[5] =
|
||||
sMtxLoadCache[6] =
|
||||
sMtxLoadCache[7] =
|
||||
sMtxLoadCache[8] =
|
||||
sMtxLoadCache[9] = 0xFFFF;
|
||||
sMtxLoadCache[8] = 0xFFFF;
|
||||
sMtxLoadCache[7] = 0xFFFF;
|
||||
sMtxLoadCache[6] = 0xFFFF;
|
||||
sMtxLoadCache[5] = 0xFFFF;
|
||||
sMtxLoadCache[4] = 0xFFFF;
|
||||
sMtxLoadCache[3] = 0xFFFF;
|
||||
sMtxLoadCache[2] = 0xFFFF;
|
||||
sMtxLoadCache[1] = 0xFFFF;
|
||||
sMtxLoadCache[0] = 0xFFFF;
|
||||
}
|
||||
|
||||
/* 803130E4-80313128 30DA24 0044+00 1/0 0/0 0/0 .text loadMtxIndx_PNGP__11J3DShapeMtxCFiUs */
|
||||
void J3DShapeMtx::loadMtxIndx_PNGP(int slot, u16 indx) const {
|
||||
// inlined J3DFifoLoadPosMtxIndx
|
||||
// J3DFifoLoadPosMtxIndx(indx, slot * 3); // matches debug, but not retail
|
||||
J3DFifoLoadIndx(GX_LOAD_INDX_A, indx, 0xB000 | ((u16)(slot * 0x0C)));
|
||||
// inlined J3DFifoLoadNrmMtxIndx3x3
|
||||
J3DFifoLoadIndx(GX_LOAD_INDX_B, indx, 0x8000 | ((u16)((slot * 0x09) + 0x400)));
|
||||
J3DFifoLoadNrmMtxIndx3x3(indx, slot * 3);
|
||||
}
|
||||
|
||||
/* 80313128-80313188 30DA68 0060+00 1/0 0/0 0/0 .text loadMtxIndx_PCPU__11J3DShapeMtxCFiUs */
|
||||
@@ -56,27 +49,27 @@ void J3DShapeMtx::loadMtxIndx_PNCPU(int slot, u16 indx) const {
|
||||
|
||||
/* 803CD9C0-803CD9F0 02AAE0 0030+00 2/3 0/0 0/0 .data sMtxLoadPipeline__11J3DShapeMtx */
|
||||
J3DShapeMtx_LoadFunc J3DShapeMtx::sMtxLoadPipeline[4] = {
|
||||
&loadMtxIndx_PNGP,
|
||||
&loadMtxIndx_PCPU,
|
||||
&loadMtxIndx_NCPU,
|
||||
&loadMtxIndx_PNCPU,
|
||||
&J3DShapeMtx::loadMtxIndx_PNGP,
|
||||
&J3DShapeMtx::loadMtxIndx_PCPU,
|
||||
&J3DShapeMtx::loadMtxIndx_NCPU,
|
||||
&J3DShapeMtx::loadMtxIndx_PNCPU,
|
||||
};
|
||||
|
||||
/* 803CDA20-803CDA50 02AB40 0030+00 2/3 0/0 0/0 .data sMtxLoadPipeline__21J3DShapeMtxConcatView */
|
||||
J3DShapeMtxConcatView_LoadFunc J3DShapeMtxConcatView::sMtxLoadPipeline[4] = {
|
||||
&loadMtxConcatView_PNGP,
|
||||
&loadMtxConcatView_PCPU,
|
||||
&loadMtxConcatView_NCPU,
|
||||
&loadMtxConcatView_PNCPU,
|
||||
&J3DShapeMtxConcatView::loadMtxConcatView_PNGP,
|
||||
&J3DShapeMtxConcatView::loadMtxConcatView_PCPU,
|
||||
&J3DShapeMtxConcatView::loadMtxConcatView_NCPU,
|
||||
&J3DShapeMtxConcatView::loadMtxConcatView_PNCPU,
|
||||
};
|
||||
|
||||
/* 803CDA80-803CDAB0 02ABA0 0030+00 1/2 0/0 0/0 .data sMtxLoadLODPipeline__21J3DShapeMtxConcatView
|
||||
*/
|
||||
J3DShapeMtxConcatView_LoadFunc J3DShapeMtxConcatView::sMtxLoadLODPipeline[4] = {
|
||||
&loadMtxConcatView_PNGP_LOD,
|
||||
&loadMtxConcatView_PCPU,
|
||||
&loadMtxConcatView_NCPU,
|
||||
&loadMtxConcatView_PNCPU,
|
||||
&J3DShapeMtxConcatView::loadMtxConcatView_PNGP_LOD,
|
||||
&J3DShapeMtxConcatView::loadMtxConcatView_PCPU,
|
||||
&J3DShapeMtxConcatView::loadMtxConcatView_NCPU,
|
||||
&J3DShapeMtxConcatView::loadMtxConcatView_PNCPU,
|
||||
};
|
||||
|
||||
/* 804515A8-804515AC 000AA8 0004+00 4/4 2/2 0/0 .sbss sCurrentPipeline__11J3DShapeMtx */
|
||||
@@ -86,13 +79,11 @@ u32 J3DShapeMtx::sCurrentPipeline;
|
||||
u8* J3DShapeMtx::sCurrentScaleFlag;
|
||||
|
||||
// This below is technically part of J3DScaleFlag.
|
||||
|
||||
/* 804515B0-804515B4 -00001 0004+00 5/5 3/3 0/0 .sbss None */
|
||||
/* 804515B0 0001+00 data_804515B0 None */
|
||||
bool J3DShapeMtx::sNBTFlag;
|
||||
|
||||
/* 804515B1 0003+00 data_804515B1 None */
|
||||
extern u8 struct_804515B0; // temporary
|
||||
u8 J3DShapeMtx::sNBTFlag;
|
||||
u8 J3DShapeMtx::sLODFlag;
|
||||
bool J3DShapeMtx::sLODFlag;
|
||||
|
||||
/* 804515B4-804515B8 000AB4 0004+00 4/4 1/1 0/0 .sbss sTexMtxLoadType__11J3DShapeMtx */
|
||||
u32 J3DShapeMtx::sTexMtxLoadType;
|
||||
@@ -115,6 +106,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
{0.0f, -0.5f, 0.5f, 0.0f},
|
||||
{0.0f, 0.0f, 1.0f, 0.0f},
|
||||
};
|
||||
|
||||
static Mtx qMtx2 = {
|
||||
{0.5f, 0.0f, 0.0f, 0.5f},
|
||||
{0.0f, -0.5f, 0.0f, 0.5f},
|
||||
@@ -126,10 +118,10 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
Mtx44 sp_a8, sp_68;
|
||||
|
||||
J3DTexGenBlock* tex_gen_block = sTexGenBlock; // sp_60
|
||||
JUT_ASSERT_MSG(0xc3, tex_gen_block != NULL, "Error : null pointer");
|
||||
J3D_ASSERT_NULLPTR(195, tex_gen_block != NULL);
|
||||
|
||||
J3DTexMtxObj* tex_mtx_obj = sTexMtxObj; // sp_5c
|
||||
JUT_ASSERT_MSG(0xc6, tex_mtx_obj != NULL, "Error : null pointer");
|
||||
J3D_ASSERT_NULLPTR(198, tex_mtx_obj != NULL);
|
||||
|
||||
J3DTexMtxInfo* tex_mtx_info_1; // sp_58
|
||||
int tex_gen_type; // sp_54
|
||||
@@ -142,8 +134,9 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
tex_gen_type = tex_gen_block->getTexCoord(i)->getTexGenType();
|
||||
if (tex_gen_type == 1 || tex_gen_type == 0) {
|
||||
tex_mtx_2 = tex_gen_block->getTexMtx(i);
|
||||
JUT_ASSERT_MSG(0xd7, tex_mtx_2 != NULL, "Error : null pointer");
|
||||
J3D_ASSERT_NULLPTR(215, tex_mtx_2 != NULL);
|
||||
tex_mtx_info_1 = &tex_mtx_2->getTexMtxInfo();
|
||||
|
||||
u32 sp_4c = tex_mtx_info_1->mInfo & 0x3f;
|
||||
switch (sp_4c) {
|
||||
case 3:
|
||||
@@ -187,6 +180,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
} else if (sp_3c == 1) {
|
||||
J3DGetTextureMtxMaya(tex_mtx_info_2->mSRT, sp_68);
|
||||
}
|
||||
|
||||
MTXConcat(sp_68, qMtx, sp_68);
|
||||
J3DMtxProjConcat(sp_68, tex_mtx_obj->getEffectMtx(i), sp_e8);
|
||||
MTXInverse(j3dSys.getViewMtx(), sp_a8);
|
||||
@@ -203,6 +197,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
} else if (sp_34 == 1) {
|
||||
J3DGetTextureMtxMaya(tex_mtx_info_2->mSRT, sp_68);
|
||||
}
|
||||
|
||||
MTXConcat(sp_68, qMtx2, sp_68);
|
||||
J3DMtxProjConcat(sp_68, tex_mtx_obj->getEffectMtx(i), sp_e8);
|
||||
MTXInverse(j3dSys.getViewMtx(), sp_a8);
|
||||
@@ -225,8 +220,9 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
int tex_gen_type = tex_gen_block->getTexCoord(i)->getTexGenType();
|
||||
if (tex_gen_type == 1 || tex_gen_type == 0) {
|
||||
J3DTexMtx* tex_mtx = tex_gen_block->getTexMtx(i); // sp_2c
|
||||
JUT_ASSERT_MSG(0x145, tex_mtx != NULL, "Error : null pointer");
|
||||
J3D_ASSERT_NULLPTR(325, tex_mtx != NULL);
|
||||
tex_mtx_info_1 = &tex_mtx->getTexMtxInfo();
|
||||
|
||||
u32 tex_gen_src = tex_mtx_info_1->mInfo & 0x3f; // sp_28
|
||||
switch (tex_gen_src) {
|
||||
case 3:
|
||||
@@ -254,6 +250,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
} else if (sp_24 == 1) {
|
||||
J3DGetTextureMtxMayaOld(tex_mtx_info_2->mSRT, sp_68);
|
||||
}
|
||||
|
||||
J3DMtxProjConcat(sp_68, tex_mtx_obj->getEffectMtx(i), sp_e8);
|
||||
MTXInverse(j3dSys.getViewMtx(), sp_a8);
|
||||
MTXConcat(sp_e8, sp_a8, sp_e8);
|
||||
@@ -270,6 +267,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
} else if (sp_18 == 1) {
|
||||
J3DGetTextureMtxMaya(tex_mtx_info_2->mSRT, sp_68);
|
||||
}
|
||||
|
||||
MTXConcat(sp_68, qMtx, sp_68);
|
||||
J3DMtxProjConcat(sp_68, tex_mtx_obj->getEffectMtx(i), sp_e8);
|
||||
MTXInverse(j3dSys.getViewMtx(), sp_a8);
|
||||
@@ -287,6 +285,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
} else if (sp_10 == 1) {
|
||||
J3DGetTextureMtxMaya(tex_mtx_info_2->mSRT, sp_68);
|
||||
}
|
||||
|
||||
MTXConcat(sp_68, qMtx2, sp_68);
|
||||
J3DMtxProjConcat(sp_68, tex_mtx_obj->getEffectMtx(i), sp_e8);
|
||||
MTXInverse(j3dSys.getViewMtx(), sp_a8);
|
||||
@@ -305,8 +304,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
GXLoadTexMtxImm(*mtx, i * 3 + 30,
|
||||
(GXTexMtxType)tex_mtx_info_1->mProjection);
|
||||
GXLoadTexMtxImm(*mtx, i * 3 + 30, (GXTexMtxType)tex_mtx_info_1->mProjection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -340,6 +338,7 @@ void J3DShapeMtxConcatView::loadMtxConcatView_NCPU(int slot, u16 drw) const {
|
||||
J3DDifferedTexMtx::load(m);
|
||||
J3DFifoLoadPosMtxImm(m, slot * 3);
|
||||
J3DFifoLoadNrmMtxImm(*j3dSys.getShapePacket()->getBaseMtxPtr(), slot * 3);
|
||||
|
||||
if (J3DShapeMtx::sTexMtxLoadType == 0x2000)
|
||||
J3DFifoLoadNrmMtxToTexMtx(*j3dSys.getShapePacket()->getBaseMtxPtr(), slot * 3 + GX_TEXMTX0);
|
||||
}
|
||||
@@ -347,13 +346,15 @@ void J3DShapeMtxConcatView::loadMtxConcatView_NCPU(int slot, u16 drw) const {
|
||||
/* 80313A14-80313AC8 30E354 00B4+00 2/0 0/0 0/0 .text
|
||||
* loadMtxConcatView_PNCPU__21J3DShapeMtxConcatViewCFiUs */
|
||||
void J3DShapeMtxConcatView::loadMtxConcatView_PNCPU(int slot, u16 drw) const {
|
||||
Mtx m;
|
||||
if (J3DDifferedTexMtx::sTexGenBlock != NULL) {
|
||||
Mtx m;
|
||||
MTXConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DDifferedTexMtx::loadExecute(m);
|
||||
}
|
||||
|
||||
J3DFifoLoadPosMtxImm(*j3dSys.getShapePacket()->getBaseMtxPtr(), slot * 3);
|
||||
J3DFifoLoadNrmMtxImm(*j3dSys.getShapePacket()->getBaseMtxPtr(), slot * 3);
|
||||
|
||||
if (J3DShapeMtx::sTexMtxLoadType == 0x2000)
|
||||
J3DFifoLoadNrmMtxToTexMtx(*j3dSys.getShapePacket()->getBaseMtxPtr(), slot * 3 + GX_TEXMTX0);
|
||||
}
|
||||
@@ -363,7 +364,7 @@ void J3DShapeMtxConcatView::loadMtxConcatView_PNCPU(int slot, u16 drw) const {
|
||||
void J3DShapeMtxConcatView::loadMtxConcatView_PNGP_LOD(int slot, u16 drw) const {
|
||||
Mtx m;
|
||||
MTXConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
MTXConcat(m, j3dSys.mModel->getModelData()->getInvJointMtx(drw), m);
|
||||
MTXConcat(m, j3dSys.getModel()->getModelData()->getInvJointMtx(drw), m);
|
||||
J3DDifferedTexMtx::load(m);
|
||||
J3DFifoLoadPosMtxImm(m, slot * 3);
|
||||
loadNrmMtx(slot, drw, m);
|
||||
@@ -385,10 +386,11 @@ void J3DShapeMtx::calcNBTScale(Vec const& param_0, Mtx33* param_1, Mtx33* param_
|
||||
/* 80313C54-80313D28 30E594 00D4+00 1/0 0/0 0/0 .text load__21J3DShapeMtxConcatViewCFv */
|
||||
void J3DShapeMtxConcatView::load() const {
|
||||
sMtxPtrTbl[0] = j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(0);
|
||||
sMtxPtrTbl[1] = j3dSys.getModel()->getMtxBuffer()->getWeightAnmMtx(0);
|
||||
sMtxPtrTbl[1] = j3dSys.getModel()->getWeightAnmMtx(0);
|
||||
J3DShapeMtxConcatView_LoadFunc func = sMtxLoadPipeline[sCurrentPipeline];
|
||||
u32 draw_mtx_flag = j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndex);
|
||||
j3dSys.setModelDrawMtx((Mtx*)sMtxPtrTbl[draw_mtx_flag]);
|
||||
|
||||
j3dSys.setModelDrawMtx((Mtx*)sMtxPtrTbl[j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndex)]);
|
||||
|
||||
u16 draw_mtx_index = j3dSys.getModel()->getModelData()->getDrawMtxIndex(mUseMtxIndex);
|
||||
(this->*func)(0, draw_mtx_index);
|
||||
}
|
||||
@@ -400,6 +402,7 @@ void J3DShapeMtxConcatView::loadNrmMtx(int param_0, u16 param_1, MtxP param_2) c
|
||||
if (sTexMtxLoadType == 0x2000) {
|
||||
J3DFifoLoadNrmMtxToTexMtx(param_2, 0x1e);
|
||||
}
|
||||
|
||||
if (!sNBTFlag) {
|
||||
J3DFifoLoadNrmMtxImm(param_2, 0);
|
||||
} else {
|
||||
@@ -415,6 +418,7 @@ void J3DShapeMtxConcatView::loadNrmMtx(int param_0, u16 param_1, MtxP param_2) c
|
||||
if (sTexMtxLoadType == 0x2000) {
|
||||
J3DFifoLoadNrmMtxToTexMtx3x3(mtx, 0x1e);
|
||||
}
|
||||
|
||||
if (!sNBTFlag) {
|
||||
J3DFifoLoadNrmMtxImm3x3(mtx, 0);
|
||||
} else {
|
||||
@@ -428,11 +432,11 @@ void J3DShapeMtxConcatView::loadNrmMtx(int param_0, u16 param_1, MtxP param_2) c
|
||||
/* 80313E4C-80313EEC 30E78C 00A0+00 1/0 0/0 0/0 .text load__16J3DShapeMtxMultiCFv */
|
||||
void J3DShapeMtxMulti::load() const {
|
||||
J3DShapeMtx_LoadFunc func = sMtxLoadPipeline[sCurrentPipeline];
|
||||
|
||||
int use_mtx_num = mUseMtxNum;
|
||||
for (int i = 0; i < use_mtx_num; i++) {
|
||||
u16 use_mtx_index = mUseMtxIndexTable[i];
|
||||
if (use_mtx_index != 0xffff) {
|
||||
(this->*func)(i, use_mtx_index);
|
||||
if (mUseMtxIndexTable[i] != 0xffff) {
|
||||
(this->*func)(i, mUseMtxIndexTable[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -442,9 +446,8 @@ void J3DShapeMtxMulti::load() const {
|
||||
void J3DShapeMtxMulti::calcNBTScale(Vec const& param_0, Mtx33* param_1, Mtx33* param_2) {
|
||||
int use_mtx_num = mUseMtxNum;
|
||||
for (int i = 0; i < use_mtx_num; i++) {
|
||||
u16 use_mtx_index = mUseMtxIndexTable[i];
|
||||
if (use_mtx_index != 0xffff) {
|
||||
J3DPSMtx33Copy(param_1[use_mtx_index], param_2[use_mtx_index]);
|
||||
if (mUseMtxIndexTable[i] != 0xffff) {
|
||||
J3DPSMtx33Copy(param_1[mUseMtxIndexTable[i]], param_2[mUseMtxIndexTable[i]]);
|
||||
J3DScaleNrmMtx33(param_2[mUseMtxIndexTable[i]], param_0);
|
||||
}
|
||||
}
|
||||
@@ -453,36 +456,34 @@ void J3DShapeMtxMulti::calcNBTScale(Vec const& param_0, Mtx33* param_1, Mtx33* p
|
||||
/* 80313FA4-8031419C 30E8E4 01F8+00 1/0 0/0 0/0 .text load__26J3DShapeMtxMultiConcatViewCFv */
|
||||
void J3DShapeMtxMultiConcatView::load() const {
|
||||
sMtxPtrTbl[0] = j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(0);
|
||||
sMtxPtrTbl[1] = j3dSys.getModel()->getMtxBuffer()->getWeightAnmMtx(0);
|
||||
sMtxPtrTbl[1] = j3dSys.getModel()->getWeightAnmMtx(0);
|
||||
|
||||
if (!sLODFlag) {
|
||||
J3DShapeMtxConcatView_LoadFunc func = sMtxLoadPipeline[sCurrentPipeline];
|
||||
int use_mtx_num = mUseMtxNum;
|
||||
for (int i = 0; i < use_mtx_num; i++) {
|
||||
u16 use_mtx_index = mUseMtxIndexTable[i];
|
||||
if (use_mtx_index != 0xffff) {
|
||||
u16 draw_mtx_index =
|
||||
j3dSys.getModel()->getModelData()->getDrawMtxIndex(use_mtx_index);
|
||||
u8 draw_mtx_flag = j3dSys.getModel()->getModelData()->getDrawMtxFlag(use_mtx_index);
|
||||
j3dSys.setModelDrawMtx((Mtx*)sMtxPtrTbl[draw_mtx_flag]);
|
||||
if (mUseMtxIndexTable[i] != 0xffff) {
|
||||
u16 draw_mtx_index = j3dSys.getModel()->getModelData()->getDrawMtxIndex(mUseMtxIndexTable[i]);
|
||||
j3dSys.setModelDrawMtx((Mtx*)sMtxPtrTbl[j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndexTable[i])]);
|
||||
(this->*func)(i, draw_mtx_index);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
u16* important_mtx_indices = j3dSys.getModel()->getModelData()->getWEvlpImportantMtxIndex();
|
||||
j3dSys.setModelDrawMtx((Mtx*)sMtxPtrTbl[0]);
|
||||
|
||||
int use_mtx_num = mUseMtxNum;
|
||||
for (int i = 0; i < use_mtx_num; i++) {
|
||||
u32 current_pipeline = sCurrentPipeline;
|
||||
J3DShapeMtxConcatView_LoadFunc func = sMtxLoadLODPipeline[current_pipeline];
|
||||
u16 use_mtx_index = mUseMtxIndexTable[i];
|
||||
if (use_mtx_index != 0xffff) {
|
||||
u16 important_mtx_index = important_mtx_indices[use_mtx_index];
|
||||
|
||||
if (mUseMtxIndexTable[i] != 0xffff) {
|
||||
u16 important_mtx_index = important_mtx_indices[mUseMtxIndexTable[i]];
|
||||
if (important_mtx_index != sMtxLoadCache[i]) {
|
||||
u8 draw_mtx_flag =
|
||||
j3dSys.getModel()->getModelData()->getDrawMtxFlag(use_mtx_index);
|
||||
if (draw_mtx_flag == 0) {
|
||||
func = sMtxLoadPipeline[current_pipeline];
|
||||
if (j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndexTable[i]) == 0) {
|
||||
func = sMtxLoadPipeline[sCurrentPipeline];
|
||||
}
|
||||
|
||||
(this->*func)(i, important_mtx_index);
|
||||
sMtxLoadCache[i] = important_mtx_index;
|
||||
}
|
||||
@@ -526,22 +527,24 @@ void J3DShapeMtxMultiConcatView::loadNrmMtx(int param_0, u16 param_1, MtxP param
|
||||
void J3DShapeMtxBBoardConcatView::load() const {
|
||||
Mtx mtx;
|
||||
u16 draw_mtx_index = j3dSys.getModel()->getModelData()->getDrawMtxIndex(mUseMtxIndex);
|
||||
u8 draw_mtx_flag = j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndex);
|
||||
if (draw_mtx_flag == 0) {
|
||||
MtxP user_anm_mtx = j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(draw_mtx_index);
|
||||
PSMTXConcat(j3dSys.getViewMtx(), user_anm_mtx, mtx);
|
||||
|
||||
if (j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndex) == 0) {
|
||||
MTXConcat(j3dSys.getViewMtx(), j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(draw_mtx_index), mtx);
|
||||
} else {
|
||||
MtxP weight_anm_mtx = j3dSys.getModel()->getMtxBuffer()->getWeightAnmMtx(draw_mtx_index);
|
||||
PSMTXConcat(j3dSys.getViewMtx(), weight_anm_mtx, mtx);
|
||||
MTXConcat(j3dSys.getViewMtx(), j3dSys.getModel()->getWeightAnmMtx(draw_mtx_index), mtx);
|
||||
}
|
||||
|
||||
J3DCalcBBoardMtx(mtx);
|
||||
J3DFifoLoadPosMtxImm(mtx, 0);
|
||||
|
||||
mtx[0][0] = 1.0f / mtx[0][0];
|
||||
mtx[1][1] = 1.0f / mtx[1][1];
|
||||
mtx[2][2] = 1.0f / mtx[2][2];
|
||||
mtx[0][3] = 0.0f;
|
||||
mtx[1][3] = 0.0f;
|
||||
mtx[2][3] = 0.0f;
|
||||
|
||||
|
||||
if (!sNBTFlag) {
|
||||
J3DFifoLoadNrmMtxImm(mtx, 0);
|
||||
} else {
|
||||
@@ -556,16 +559,16 @@ void J3DShapeMtxYBBoardConcatView::load() const {
|
||||
Mtx mtx1;
|
||||
Mtx33 mtx2;
|
||||
u16 draw_mtx_index = j3dSys.getModel()->getModelData()->getDrawMtxIndex(mUseMtxIndex);
|
||||
u8 draw_mtx_flag = j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndex);
|
||||
if (draw_mtx_flag == 0) {
|
||||
MtxP user_anm_mtx = j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(draw_mtx_index);
|
||||
PSMTXConcat(j3dSys.getViewMtx(), user_anm_mtx, mtx1);
|
||||
|
||||
if (j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndex) == 0) {
|
||||
MTXConcat(j3dSys.getViewMtx(), j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(draw_mtx_index), mtx1);
|
||||
} else {
|
||||
MtxP weight_anm_mtx = j3dSys.getModel()->getMtxBuffer()->getWeightAnmMtx(draw_mtx_index);
|
||||
PSMTXConcat(j3dSys.getViewMtx(), weight_anm_mtx, mtx1);
|
||||
MTXConcat(j3dSys.getViewMtx(), j3dSys.getModel()->getWeightAnmMtx(draw_mtx_index), mtx1);
|
||||
}
|
||||
|
||||
J3DCalcYBBoardMtx(mtx1);
|
||||
J3DFifoLoadPosMtxImm(mtx1, 0);
|
||||
|
||||
if (sCurrentScaleFlag[mUseMtxIndex] == 1) {
|
||||
if (!sNBTFlag) {
|
||||
J3DFifoLoadNrmMtxImm(mtx1, 0);
|
||||
|
||||
@@ -1,40 +1,9 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DSys
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
|
||||
#include "dol2asm.h"
|
||||
#include <dolphin/gx.h>
|
||||
#include "dolphin/os.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTevs.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "JSystem/J3DGraphBase/J3DFifo.h"
|
||||
#include "global.h"
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DTevs.h"
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "JSystem/J3DGraphBase/J3DGD.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern void J3DFifoLoadTexCached(GXTexMapID, u32, GXTexCacheSize, u32, GXTexCacheSize);
|
||||
extern void makeTexCoordTable();
|
||||
extern void makeAlphaCmpTable();
|
||||
extern void makeZModeTable();
|
||||
extern void makeTevSwapTable();
|
||||
extern "C" void GXInvalidateVtxCache();
|
||||
|
||||
extern "C" extern const GXColor j3dDefaultColInfo;
|
||||
extern "C" extern u8 data_804563C8;
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80434AC8-80434BE4 0617E8 011C+00 1/1 151/151 486/486 .bss j3dSys */
|
||||
J3DSys j3dSys;
|
||||
|
||||
@@ -50,6 +19,31 @@ Vec J3DSys::mParentS;
|
||||
/* 80434C2C-80434C70 06194C 0040+04 1/1 17/17 0/0 .bss sTexCoordScaleTable__6J3DSys */
|
||||
J3DTexCoordScaleInfo J3DSys::sTexCoordScaleTable[8];
|
||||
|
||||
/* 803CD8A0-803CD8B0 02A9C0 0010+00 1/1 0/0 0/0 .data NullTexData */
|
||||
static u8 NullTexData[0x10] ALIGN_DECL(32) = {0};
|
||||
|
||||
/* 803CD8B0-803CD8E0 02A9D0 0030+00 1/1 0/0 0/0 .data j3dIdentityMtx */
|
||||
static Mtx j3dIdentityMtx = {
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
};
|
||||
|
||||
/* 803CD8E0-803CD8F8 02AA00 0018+00 1/1 0/0 0/0 .data IndMtx */
|
||||
static Mtx23 IndMtx = {
|
||||
0.5f, 0.0f, 0.0f,
|
||||
0.0f, 0.5f, 0.0f,
|
||||
};
|
||||
|
||||
/* 80451598-804515A0 000A98 0004+04 0/0 1/1 0/0 .sbss j3dDefaultViewNo */
|
||||
u32 j3dDefaultViewNo;
|
||||
|
||||
/* 80450950-80450954 0003D0 0004+00 2/2 0/0 0/0 .sdata ColorBlack */
|
||||
static GXColor ColorBlack = {0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
/* 80450954-80450958 0003D4 0004+00 2/2 0/0 0/0 .sdata ColorWhite */
|
||||
static GXColor ColorWhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
|
||||
/* 8030FDE8-8030FEC0 30A728 00D8+00 1/1 0/0 0/0 .text __ct__6J3DSysFv */
|
||||
J3DSys::J3DSys() {
|
||||
makeTexCoordTable();
|
||||
@@ -63,8 +57,10 @@ J3DSys::J3DSys() {
|
||||
mMaterialMode = 0;
|
||||
mModel = NULL;
|
||||
mShape = NULL;
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mDrawBuffer); i++)
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
mDrawBuffer[i] = NULL;
|
||||
|
||||
mTexture = NULL;
|
||||
mMatPacket = NULL;
|
||||
mShapePacket = NULL;
|
||||
@@ -74,7 +70,7 @@ J3DSys::J3DSys() {
|
||||
mVtxNrm = NULL;
|
||||
mVtxCol = NULL;
|
||||
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
sTexCoordScaleTable[i].field_0x00 = 1;
|
||||
sTexCoordScaleTable[i].field_0x02 = 1;
|
||||
sTexCoordScaleTable[i].field_0x04 = 0;
|
||||
@@ -84,31 +80,34 @@ J3DSys::J3DSys() {
|
||||
|
||||
/* 8030FEC0-8030FEE4 30A800 0024+00 0/0 1/1 0/0 .text loadPosMtxIndx__6J3DSysCFiUs */
|
||||
void J3DSys::loadPosMtxIndx(int addr, u16 indx) const {
|
||||
// J3DFifoLoadPosMtxIndx(indx, addr * 3); // matches debug, not retail
|
||||
J3DFifoLoadIndx(GX_LOAD_INDX_A, indx, 0xB000 | ((u16)(addr * 0x0C)));
|
||||
}
|
||||
|
||||
/* 8030FEE4-8030FF0C 30A824 0028+00 0/0 1/1 0/0 .text loadNrmMtxIndx__6J3DSysCFiUs */
|
||||
void J3DSys::loadNrmMtxIndx(int addr, u16 indx) const {
|
||||
J3DFifoLoadIndx(GX_LOAD_INDX_B, indx, 0x8000 | ((u16)((addr * 0x09) + 0x400)));
|
||||
J3DFifoLoadNrmMtxIndx3x3(indx, addr * 3);
|
||||
}
|
||||
|
||||
/* 8030FF0C-803100BC 30A84C 01B0+00 1/1 0/0 0/0 .text setTexCacheRegion__6J3DSysF15_GXTexCacheSize
|
||||
*/
|
||||
void J3DSys::setTexCacheRegion(GXTexCacheSize size) {
|
||||
J3D_ASSERT_RANGE(173, size >= 0 && size < 3);
|
||||
|
||||
const u32 kSize[] = {
|
||||
0x00008000,
|
||||
0x00020000,
|
||||
0x00080000,
|
||||
0x00000000,
|
||||
};
|
||||
|
||||
const u32 kRegionNum[] = {8, 4, 1, 0};
|
||||
|
||||
u32 regionNum = kRegionNum[size];
|
||||
mTexCacheRegionNum = regionNum;
|
||||
mTexCacheRegionNum = kRegionNum[size];
|
||||
|
||||
if (!!(mFlags & 0x80000000)) {
|
||||
for (u32 i = 0; i < regionNum; i++) {
|
||||
if (!!(i & 1)) {
|
||||
if (checkFlag(0x80000000)) {
|
||||
for (u32 i = 0; i < kRegionNum[size]; i++) {
|
||||
if (i & 1) {
|
||||
GXInitTexCacheRegion(&mTexCacheRegion[i], GX_FALSE, i * kSize[size] + 0x80000, size,
|
||||
i * kSize[size], size);
|
||||
J3DFifoLoadTexCached((GXTexMapID)i, i * kSize[size] + 0x80000, size,
|
||||
@@ -121,7 +120,7 @@ void J3DSys::setTexCacheRegion(GXTexCacheSize size) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (u32 i = 0; i < regionNum; i++) {
|
||||
for (u32 i = 0; i < kRegionNum[size]; i++) {
|
||||
GXInitTexCacheRegion(&mTexCacheRegion[i], GX_FALSE, i * kSize[size], size,
|
||||
i * kSize[size] + 0x80000, size);
|
||||
J3DFifoLoadTexCached((GXTexMapID)i, i * kSize[size], size, i * kSize[size] + 0x80000,
|
||||
@@ -130,16 +129,6 @@ void J3DSys::setTexCacheRegion(GXTexCacheSize size) {
|
||||
}
|
||||
}
|
||||
|
||||
/* 803CD8A0-803CD8B0 02A9C0 0010+00 1/1 0/0 0/0 .data NullTexData */
|
||||
SECTION_DATA static u8 NullTexData[16] ALIGN_DECL(32) = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
/* 803CD8B0-803CD8E0 02A9D0 0030+00 1/1 0/0 0/0 .data j3dIdentityMtx */
|
||||
SECTION_DATA static Mtx j3dIdentityMtx = {
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
|
||||
};
|
||||
|
||||
/* 803100BC-8031073C 30A9FC 0680+00 0/0 3/3 0/0 .text drawInit__6J3DSysFv */
|
||||
void J3DSys::drawInit() {
|
||||
GXInvalidateVtxCache();
|
||||
@@ -201,16 +190,16 @@ void J3DSys::drawInit() {
|
||||
GXSetChanMatColor(GX_COLOR0A0, j3dDefaultColInfo);
|
||||
GXSetChanMatColor(GX_COLOR1A1, j3dDefaultColInfo);
|
||||
|
||||
GXSetNumChans(data_804563C8);
|
||||
GXSetNumChans(j3dDefaultNumChans);
|
||||
GXSetNumTexGens(1);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_REG, 0, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetChanCtrl(GX_COLOR1A1, GX_FALSE, GX_SRC_REG, GX_SRC_REG, 0, GX_DF_CLAMP, GX_AF_NONE);
|
||||
|
||||
for (i = 0; i < GX_MAX_TEXMAP; i++)
|
||||
GXSetTexCoordGen2((GXTexCoordID)i, (GXTexGenType)j3dDefaultTexCoordInfo[i].mTexGenType,
|
||||
GXSetTexCoordGen((GXTexCoordID)i, (GXTexGenType)j3dDefaultTexCoordInfo[i].mTexGenType,
|
||||
(GXTexGenSrc)j3dDefaultTexCoordInfo[i].mTexGenSrc,
|
||||
j3dDefaultTexCoordInfo[i].mTexGenMtx, GX_FALSE, GX_PTIDENTITY);
|
||||
j3dDefaultTexCoordInfo[i].mTexGenMtx);
|
||||
|
||||
for (i = 0; i < GX_MAX_INDTEXSTAGE; i++)
|
||||
GXSetIndTexCoordScale((GXIndTexStageID)i, GX_ITS_1, GX_ITS_1);
|
||||
@@ -268,13 +257,6 @@ void J3DSys::reinitGenMode() {
|
||||
GXSetCoPlanar(GX_FALSE);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80450950-80450954 0003D0 0004+00 2/2 0/0 0/0 .sdata ColorBlack */
|
||||
SECTION_SDATA static GXColor ColorBlack = {0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
/* 80450954-80450958 0003D4 0004+00 2/2 0/0 0/0 .sdata ColorWhite */
|
||||
SECTION_SDATA static GXColor ColorWhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
|
||||
/* 803107E8-80310894 30B128 00AC+00 1/1 0/0 0/0 .text reinitLighting__6J3DSysFv */
|
||||
void J3DSys::reinitLighting() {
|
||||
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
@@ -290,14 +272,14 @@ void J3DSys::reinitLighting() {
|
||||
/* 80310894-80310998 30B1D4 0104+00 1/1 0/0 0/0 .text reinitTransform__6J3DSysFv */
|
||||
void J3DSys::reinitTransform() {
|
||||
GXSetCurrentMtx(GX_PNMTX0);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX1, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD2, GX_TG_MTX2x4, GX_TG_TEX2, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD3, GX_TG_MTX2x4, GX_TG_TEX3, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD4, GX_TG_MTX2x4, GX_TG_TEX4, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD5, GX_TG_MTX2x4, GX_TG_TEX5, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD6, GX_TG_MTX2x4, GX_TG_TEX6, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD7, GX_TG_MTX2x4, GX_TG_TEX7, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX1, GX_IDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD2, GX_TG_MTX2x4, GX_TG_TEX2, GX_IDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD3, GX_TG_MTX2x4, GX_TG_TEX3, GX_IDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD4, GX_TG_MTX2x4, GX_TG_TEX4, GX_IDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD5, GX_TG_MTX2x4, GX_TG_TEX5, GX_IDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD6, GX_TG_MTX2x4, GX_TG_TEX6, GX_IDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD7, GX_TG_MTX2x4, GX_TG_TEX7, GX_IDENTITY);
|
||||
}
|
||||
|
||||
/* 80310998-80310A3C 30B2D8 00A4+00 2/2 0/0 0/0 .text reinitTexture__6J3DSysFv */
|
||||
@@ -341,7 +323,9 @@ void J3DSys::reinitTevStages() {
|
||||
GXSetTevKColor(GX_KCOLOR2, ColorWhite);
|
||||
GXSetTevKColor(GX_KCOLOR3, ColorWhite);
|
||||
|
||||
for (u32 i = 0; i < GX_MAX_TEVSTAGE; i++) {
|
||||
u32 i;
|
||||
u32 numStages = GX_MAX_TEVSTAGE;
|
||||
for (i = 0; i < numStages; i++) {
|
||||
GXSetTevColorIn((GXTevStageID)i, GX_CC_RASC, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO);
|
||||
GXSetTevColorOp((GXTevStageID)i, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE,
|
||||
GX_TEVPREV);
|
||||
@@ -360,13 +344,10 @@ void J3DSys::reinitTevStages() {
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803CD8E0-803CD8F8 02AA00 0018+00 1/1 0/0 0/0 .data IndMtx */
|
||||
SECTION_DATA static Mtx23 IndMtx = {0.5f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f};
|
||||
|
||||
/* 80310D44-80310E3C 30B684 00F8+00 1/1 0/0 0/0 .text reinitIndStages__6J3DSysFv */
|
||||
void J3DSys::reinitIndStages() {
|
||||
for (u32 i = 0; i < GX_MAX_TEVSTAGE; i++) {
|
||||
u32 i;
|
||||
for (i = 0; i < GX_MAX_TEVSTAGE; i++) {
|
||||
GXSetTevDirect((GXTevStageID)i);
|
||||
}
|
||||
|
||||
@@ -394,7 +375,3 @@ void J3DSys::reinitPixelProc() {
|
||||
GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
GXSetZCompLoc(GX_TRUE);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80451598-804515A0 000A98 0004+04 0/0 1/1 0/0 .sbss j3dDefaultViewNo */
|
||||
u32 j3dDefaultViewNo;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "JSystem/J3DGraphBase/J3DTransform.h"
|
||||
#include "global.h"
|
||||
|
||||
static void J3DGDLoadTexMtxImm(f32 (*)[4], u32, _GXTexMtxType);
|
||||
static void J3DGDLoadTexMtxImm(f32 (*)[4], u32, GXTexMtxType);
|
||||
static void J3DGDLoadPostTexMtxImm(f32 (*)[4], u32);
|
||||
|
||||
/* 80323590-80323644 31DED0 00B4+00 0/0 3/3 0/0 .text load__11J3DLightObjCFUl */
|
||||
@@ -23,23 +23,33 @@ void J3DLightObj::load(u32 lightIdx) const {
|
||||
|
||||
/* 80323644-803238C4 31DF84 0280+00 0/0 3/3 0/0 .text loadTexCoordGens__FUlP11J3DTexCoord
|
||||
*/
|
||||
void loadTexCoordGens(u32 param_0, J3DTexCoord* param_1) {
|
||||
GDOverflowCheck(param_0 * 8 + 10);
|
||||
J3DGDWriteXFCmdHdr(0x1040, param_0);
|
||||
for (int i = 0; i < param_0; i++) {
|
||||
void loadTexCoordGens(u32 texGenNum, J3DTexCoord* texCoords) {
|
||||
u32 var_r28;
|
||||
GDOverflowCheck(texGenNum * 4 * 2 + 10);
|
||||
J3DGDWriteXFCmdHdr(GX_XF_REG_TEX0, texGenNum);
|
||||
|
||||
for (int i = 0; i < texGenNum; i++) {
|
||||
J3DGDSetTexCoordGen(
|
||||
GXTexGenType(param_1[i].getTexGenType()),
|
||||
GXTexGenSrc(param_1[i].getTexGenSrc())
|
||||
GXTexGenType(texCoords[i].getTexGenType()),
|
||||
GXTexGenSrc(texCoords[i].getTexGenSrc())
|
||||
);
|
||||
}
|
||||
J3DGDWriteXFCmdHdr(0x1050, param_0);
|
||||
|
||||
var_r28 = 61;
|
||||
J3DGDWriteXFCmdHdr(GX_XF_REG_DUALTEX0, texGenNum);
|
||||
|
||||
if (j3dSys.checkFlag(0x40000000)) {
|
||||
for (int i = 0; i < param_0; i++) {
|
||||
J3DGDWrite_u32(param_1[i].getTexGenMtx() == 60 ? 61 : i * 3);
|
||||
for (int i = 0; i < texGenNum; i++) {
|
||||
if (texCoords[i].getTexGenMtx() != 60) {
|
||||
var_r28 = i * 3;
|
||||
} else {
|
||||
var_r28 = 61;
|
||||
}
|
||||
J3DGDWrite_u32(var_r28);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < param_0; i++) {
|
||||
J3DGDWrite_u32(61);
|
||||
for (int i = 0; i < texGenNum; i++) {
|
||||
J3DGDWrite_u32(var_r28);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +84,7 @@ void J3DTexMtx::calcTexMtx(const Mtx param_0) {
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
};
|
||||
|
||||
u8 r28 = mTexMtxInfo.mInfo & 0x3f;
|
||||
u32 r28 = mTexMtxInfo.mInfo & 0x3f;
|
||||
u32 r30 = (mTexMtxInfo.mInfo >> 7) & 1;
|
||||
switch (r28) {
|
||||
case 8:
|
||||
@@ -171,7 +181,7 @@ void J3DTexMtx::calcPostTexMtx(const Mtx param_0) {
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
};
|
||||
|
||||
u8 r29 = mTexMtxInfo.mInfo & 0x3f;
|
||||
u32 r29 = mTexMtxInfo.mInfo & 0x3f;
|
||||
u32 r30 = (mTexMtxInfo.mInfo >> 7) & 1;
|
||||
switch (r29) {
|
||||
case 8:
|
||||
@@ -264,8 +274,8 @@ void J3DTexMtx::calcPostTexMtx(const Mtx param_0) {
|
||||
}
|
||||
|
||||
/* 80323F64-80323F88 31E8A4 0024+00 0/0 1/1 0/0 .text isTexNoReg__FPv */
|
||||
bool isTexNoReg(void* param_0) {
|
||||
u8 r31 = ((u8*)param_0)[1];
|
||||
bool isTexNoReg(void* pDL) {
|
||||
u8 r31 = ((u8*)pDL)[1];
|
||||
if (r31 >= 0x80 && r31 <= 0xbb) {
|
||||
return true;
|
||||
}
|
||||
@@ -273,19 +283,24 @@ bool isTexNoReg(void* param_0) {
|
||||
}
|
||||
|
||||
/* 80323F88-80323F94 31E8C8 000C+00 0/0 1/1 0/0 .text getTexNoReg__FPv */
|
||||
u16 getTexNoReg(void* param_0) {
|
||||
return *(u32*)((u8*)param_0 + 1);
|
||||
u16 getTexNoReg(void* pDL) {
|
||||
u32 var_r31 = *(u32*)((u8*)pDL + 1);
|
||||
return var_r31 & 0xFFFFFF;
|
||||
}
|
||||
|
||||
/* 80323F94-8032413C 31E8D4 01A8+00 0/0 20/20 0/0 .text loadTexNo__FUlRCUs */
|
||||
void loadTexNo(u32 param_0, u16 const& param_1) {
|
||||
ResTIMG* resTIMG = j3dSys.getTexture()->getResTIMG(param_1);
|
||||
J3DSys::sTexCoordScaleTable[param_0].field_0x00 = resTIMG->width;
|
||||
J3DSys::sTexCoordScaleTable[param_0].field_0x02 = resTIMG->height;
|
||||
void loadTexNo(u32 param_0, const u16& texNo) {
|
||||
ResTIMG* resTIMG = j3dSys.getTexture()->getResTIMG(texNo);
|
||||
J3D_ASSERT_NULLPTR(462, resTIMG != NULL);
|
||||
|
||||
J3DSys::sTexCoordScaleTable[param_0].field_0x00 = (u16)resTIMG->width;
|
||||
J3DSys::sTexCoordScaleTable[param_0].field_0x02 = (u16)resTIMG->height;
|
||||
|
||||
GDOverflowCheck(0x14);
|
||||
J3DGDSetTexImgPtr(GXTexMapID(param_0), (u8*)resTIMG + resTIMG->imageOffset);
|
||||
J3DGDSetTexImgAttr(GXTexMapID(param_0), resTIMG->width, resTIMG->height, GXTexFmt(resTIMG->format & 0x0f));
|
||||
J3DGDSetTexLookupMode(GXTexMapID(param_0), GXTexWrapMode(resTIMG->wrapS), GXTexWrapMode(resTIMG->wrapT), GXTexFilter(resTIMG->minFilter), GXTexFilter(resTIMG->magFilter), resTIMG->minLOD * 0.125f, resTIMG->maxLOD * 0.125f, resTIMG->LODBias * 0.01f, resTIMG->biasClamp, resTIMG->doEdgeLOD, GXAnisotropy(resTIMG->maxAnisotropy));
|
||||
|
||||
if (resTIMG->indexTexture == true) {
|
||||
GXTlutSize tlutSize = resTIMG->numColors > 16 ? GX_TLUT_256 : GX_TLUT_16;
|
||||
GDOverflowCheck(0x14);
|
||||
@@ -295,20 +310,22 @@ void loadTexNo(u32 param_0, u16 const& param_1) {
|
||||
}
|
||||
|
||||
/* 8032413C-80324160 31EA7C 0024+00 0/0 2/2 0/0 .text patchTexNo_PtrToIdx__FUlRCUs */
|
||||
void patchTexNo_PtrToIdx(u32 texID, u16 const& idx) {
|
||||
void patchTexNo_PtrToIdx(u32 texID, const u16& idx) {
|
||||
ResTIMG* timg = j3dSys.getTexture()->getResTIMG(idx);
|
||||
J3D_ASSERT_NULLPTR(523, timg != NULL);
|
||||
|
||||
J3DGDSetTexImgPtrRaw(GXTexMapID(texID), idx);
|
||||
}
|
||||
|
||||
/* 80324160-80324194 31EAA0 0034+00 0/0 2/2 0/0 .text loadNBTScale__FR11J3DNBTScale */
|
||||
void loadNBTScale(J3DNBTScale& param_0) {
|
||||
if (param_0.mbHasScale == true) {
|
||||
j3dSys.setNBTScale(¶m_0.mScale);
|
||||
void loadNBTScale(J3DNBTScale& NBTScale) {
|
||||
if (NBTScale.mbHasScale == true) {
|
||||
j3dSys.setNBTScale(&NBTScale.mScale);
|
||||
} else {
|
||||
j3dSys.setNBTScale(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803A1EC8-803A1EFC 02E528 0034+00 0/0 9/9 24/24 .rodata j3dDefaultLightInfo */
|
||||
extern const J3DLightInfo j3dDefaultLightInfo = {
|
||||
0.0f, 0.0f, 0.0f,
|
||||
@@ -399,7 +416,6 @@ void makeTexCoordTable() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80436A60-80436E60 063780 0400+00 1/1 3/3 0/0 .bss j3dTevSwapTableTable */
|
||||
u8 j3dTevSwapTableTable[1024];
|
||||
|
||||
@@ -421,7 +437,6 @@ void makeAlphaCmpTable() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80437160-804371C0 063E80 0060+00 1/1 4/4 5/5 .bss j3dZModeTable */
|
||||
extern u8 j3dZModeTable[96];
|
||||
u8 j3dZModeTable[96];
|
||||
@@ -472,7 +487,7 @@ void J3DTexMtx::loadPostTexMtx(u32 param_0) const {
|
||||
static void J3DGDLoadTexMtxImm(f32 (*param_1)[4], u32 param_2, _GXTexMtxType param_3) {
|
||||
u16 addr = param_2 << 2;
|
||||
u8 len = param_3 == GX_MTX2x4 ? 8 : 12;
|
||||
J3DGDWriteXFCmdHdr(addr & 0xffff, len);
|
||||
J3DGDWriteXFCmdHdr(addr, len);
|
||||
J3DGDWrite_f32(param_1[0][0]);
|
||||
J3DGDWrite_f32(param_1[0][1]);
|
||||
J3DGDWrite_f32(param_1[0][2]);
|
||||
@@ -492,7 +507,9 @@ static void J3DGDLoadTexMtxImm(f32 (*param_1)[4], u32 param_2, _GXTexMtxType par
|
||||
/* 8032499C-80324F08 31F2DC 056C+00 1/1 0/0 0/0 .text J3DGDLoadPostTexMtxImm__FPA4_fUl */
|
||||
static void J3DGDLoadPostTexMtxImm(f32 (*param_1)[4], u32 param_2) {
|
||||
u16 addr = (param_2 - 0x40) * 4 + 0x500;
|
||||
J3DGDWriteXFCmdHdr(addr, 12);
|
||||
int stride = 12;
|
||||
|
||||
J3DGDWriteXFCmdHdr(addr, stride);
|
||||
J3DGDWrite_f32(param_1[0][0]);
|
||||
J3DGDWrite_f32(param_1[0][1]);
|
||||
J3DGDWrite_f32(param_1[0][2]);
|
||||
@@ -507,7 +524,6 @@ static void J3DGDLoadPostTexMtxImm(f32 (*param_1)[4], u32 param_2) {
|
||||
J3DGDWrite_f32(param_1[2][3]);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804563C0-804563C4 0049C0 0004+00 0/0 4/4 0/0 .sdata2 j3dDefaultColInfo */
|
||||
extern const GXColor j3dDefaultColInfo = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
|
||||
@@ -515,7 +531,7 @@ extern const GXColor j3dDefaultColInfo = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
extern const GXColor j3dDefaultAmbInfo = {0x32, 0x32, 0x32, 0x32};
|
||||
|
||||
/* 804563C8-804563CC 0049C8 0004+00 0/0 1/1 0/0 .sdata2 None */
|
||||
extern const u8 data_804563C8 = 0x01;
|
||||
extern const u8 j3dDefaultNumChans = 1;
|
||||
|
||||
/* 804563CC-804563D0 0049CC 0004+00 0/0 3/3 0/0 .sdata2 j3dDefaultTevOrderInfoNull */
|
||||
extern const J3DTevOrderInfo j3dDefaultTevOrderInfoNull = {0xFF, 0xFF, 0xFF, 0x00};
|
||||
|
||||
@@ -1,30 +1,22 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DTexture
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
|
||||
#include "dolphin/gx.h"
|
||||
#include "global.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
|
||||
/* 8031204C-803121A4 30C98C 0158+00 0/0 1/1 0/0 .text loadGX__10J3DTextureCFUs11_GXTexMapID */
|
||||
void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const {
|
||||
J3D_ASSERT(0, idx < mNum, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(29, idx < mNum);
|
||||
|
||||
ResTIMG* timg = getResTIMG(idx);
|
||||
GXTexObj texObj;
|
||||
GXTlutObj tlutObj;
|
||||
|
||||
if (!timg->indexTexture) {
|
||||
GXInitTexObj(&texObj, ((u8*)timg) + timg->imageOffset, timg->width, timg->height,
|
||||
(GXTexFmt)timg->format, (GXTexWrapMode)timg->wrapS, (GXTexWrapMode)timg->wrapT,
|
||||
(GXBool)timg->mipmapEnabled);
|
||||
timg->mipmapEnabled);
|
||||
} else {
|
||||
GXTlutObj tlutObj;
|
||||
|
||||
GXInitTexObjCI(&texObj, ((u8*)timg) + timg->imageOffset, timg->width, timg->height,
|
||||
(GXCITexFmt)timg->format, (GXTexWrapMode)timg->wrapS,
|
||||
(GXTexWrapMode)timg->wrapT, (GXBool)timg->mipmapEnabled, (u32)texMapID);
|
||||
(GXTexWrapMode)timg->wrapT, timg->mipmapEnabled, (u32)texMapID);
|
||||
GXInitTlutObj(&tlutObj, ((u8*)timg) + timg->paletteOffset, (GXTlutFmt)timg->colorFormat,
|
||||
timg->numColors);
|
||||
GXLoadTlut(&tlutObj, texMapID);
|
||||
@@ -34,31 +26,31 @@ void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const {
|
||||
const f32 kLODBiasScale = 1.0f / 100.0f;
|
||||
GXInitTexObjLOD(&texObj, (GXTexFilter)timg->minFilter, (GXTexFilter)timg->magFilter,
|
||||
timg->minLOD * kLODClampScale, timg->maxLOD * kLODClampScale,
|
||||
timg->LODBias * kLODBiasScale, (GXBool)timg->biasClamp, (GXBool)timg->doEdgeLOD,
|
||||
timg->LODBias * kLODBiasScale, timg->biasClamp, timg->doEdgeLOD,
|
||||
(GXAnisotropy)timg->maxAnisotropy);
|
||||
GXLoadTexObj(&texObj, texMapID);
|
||||
}
|
||||
|
||||
/* 803121A4-8031221C 30CAE4 0078+00 1/1 0/0 0/0 .text entryNum__10J3DTextureFUs */
|
||||
void J3DTexture::entryNum(u16 num) {
|
||||
J3D_ASSERT(79, num != 0, "Error : non-zero argument is specified 0.");
|
||||
J3D_ASSERT_NONZEROARG(79, num != 0);
|
||||
|
||||
mNum = num;
|
||||
mpRes = new ResTIMG[num]();
|
||||
J3D_ASSERT(83, mpRes != 0, "Error : allocate memory.");
|
||||
mpRes = new ResTIMG[num];
|
||||
J3D_ASSERT_ALLOCMEM(83, mpRes != NULL);
|
||||
|
||||
for (s32 i = 0; i < mNum; i++) {
|
||||
for (int i = 0; i < mNum; i++) {
|
||||
mpRes[i].paletteOffset = 0;
|
||||
mpRes[i].imageOffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 8031221C-80312488 30CB5C 026C+00 0/0 1/1 0/0 .text addResTIMG__10J3DTextureFUsPC7ResTIMG */
|
||||
void J3DTexture::addResTIMG(u16 newNum, ResTIMG const* newRes) {
|
||||
void J3DTexture::addResTIMG(u16 newNum, const ResTIMG* newRes) {
|
||||
if (newNum == 0)
|
||||
return;
|
||||
|
||||
J3D_ASSERT(105, newRes != 0, "Error : null pointer.");
|
||||
J3D_ASSERT_NULLPTR(105, newRes != 0);
|
||||
|
||||
u16 oldNum = mNum;
|
||||
ResTIMG* oldRes = mpRes;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DTransform
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DTransform.h"
|
||||
#include "JSystem/JMath/JMATrigonometric.h"
|
||||
#include "JSystem/J3DGraphBase/J3DStruct.h"
|
||||
#include "dolphin/base/PPCArch.h"
|
||||
#include "JSystem/JMath/JMATrigonometric.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
|
||||
/* 80311630-80311638 -00001 0008+00 0/0 0/0 0/0 .text __MTGQR7__FUl */
|
||||
void __MTGQR7(register u32 v) {
|
||||
@@ -19,12 +14,14 @@ void __MTGQR7(register u32 v) {
|
||||
|
||||
/* 80311638-80311670 30BF78 0038+00 0/0 2/2 0/0 .text J3DGQRSetup7__FUlUlUlUl */
|
||||
void J3DGQRSetup7(u32 r0, u32 r1, u32 r2, u32 r3) {
|
||||
u32 v = (((r0 << 8) + r1) << 16) | ((r2 << 8) + r3);
|
||||
u32 v = ((r0 << 8) + r1) << 16;
|
||||
v |= (r2 << 8) + r3;
|
||||
__MTGQR7(v);
|
||||
}
|
||||
|
||||
/* 80311670-80311760 30BFB0 00F0+00 0/0 2/2 0/0 .text J3DCalcBBoardMtx__FPA4_f */
|
||||
// this uses a non-standard sqrtf, not sure why or how its supposed to be setup
|
||||
#if !PLATFORM_SHIELD
|
||||
inline f32 J3D_sqrtf(register f32 x) {
|
||||
register f32 recip;
|
||||
|
||||
@@ -36,6 +33,9 @@ inline f32 J3D_sqrtf(register f32 x) {
|
||||
}
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
#define J3D_sqrtf sqrtf
|
||||
#endif
|
||||
|
||||
void J3DCalcBBoardMtx(register Mtx mtx) {
|
||||
f32 x = (mtx[0][0] * mtx[0][0]) + (mtx[1][0] * mtx[1][0]) + (mtx[2][0] * mtx[2][0]);
|
||||
@@ -86,10 +86,10 @@ void J3DCalcYBBoardMtx(Mtx mtx) {
|
||||
f32 z = (mtx[0][2] * mtx[0][2]) + (mtx[1][2] * mtx[1][2]) + (mtx[2][2] * mtx[2][2]);
|
||||
|
||||
if (x > 0.0f) {
|
||||
x = J3D_sqrtf(x);
|
||||
x = JMath::fastSqrt(x);
|
||||
}
|
||||
if (z > 0.0f) {
|
||||
z = J3D_sqrtf(z);
|
||||
z = JMath::fastSqrt(z);
|
||||
}
|
||||
|
||||
Vec vec = { 0.0f, -mtx[2][1], mtx[1][1] };
|
||||
@@ -165,6 +165,9 @@ lbl_8005F118:
|
||||
/* 80311964-80311A24 30C2A4 00C0+00 0/0 2/2 2/2 .text
|
||||
* J3DGetTranslateRotateMtx__FRC16J3DTransformInfoPA4_f */
|
||||
void J3DGetTranslateRotateMtx(const J3DTransformInfo& tx, Mtx dst) {
|
||||
f32 cxsz;
|
||||
f32 sxcz;
|
||||
|
||||
f32 sx = JMASSin(tx.mRotation.x), cx = JMASCos(tx.mRotation.x);
|
||||
f32 sy = JMASSin(tx.mRotation.y), cy = JMASCos(tx.mRotation.y);
|
||||
f32 sz = JMASSin(tx.mRotation.z), cz = JMASCos(tx.mRotation.z);
|
||||
@@ -175,15 +178,15 @@ void J3DGetTranslateRotateMtx(const J3DTransformInfo& tx, Mtx dst) {
|
||||
dst[2][1] = cy * sx;
|
||||
dst[2][2] = cy * cx;
|
||||
|
||||
f32 cxsz = cx * sz;
|
||||
f32 sxcz = sx * cz;
|
||||
cxsz = cx * sz;
|
||||
sxcz = sx * cz;
|
||||
dst[0][1] = sxcz * sy - cxsz;
|
||||
dst[1][2] = cxsz * sy - sxcz;
|
||||
|
||||
f32 sxsz = sx * sz;
|
||||
f32 cxcz = cx * cz;
|
||||
dst[0][2] = cxcz * sy + sxsz;
|
||||
dst[1][1] = sxsz * sy + cxcz;
|
||||
cxsz = sx * sz;
|
||||
sxcz = cx * cz;
|
||||
dst[0][2] = sxcz * sy + cxsz;
|
||||
dst[1][1] = cxsz * sy + sxcz;
|
||||
|
||||
dst[0][3] = tx.mTranslate.x;
|
||||
dst[1][3] = tx.mTranslate.y;
|
||||
@@ -192,6 +195,9 @@ void J3DGetTranslateRotateMtx(const J3DTransformInfo& tx, Mtx dst) {
|
||||
|
||||
/* 80311A24-80311ACC 30C364 00A8+00 0/0 1/1 0/0 .text J3DGetTranslateRotateMtx__FsssfffPA4_f */
|
||||
void J3DGetTranslateRotateMtx(s16 rx, s16 ry, s16 rz, f32 tx, f32 ty, f32 tz, Mtx dst) {
|
||||
f32 cxsz;
|
||||
f32 sxcz;
|
||||
|
||||
f32 sx = JMASSin(rx), cx = JMASCos(rx);
|
||||
f32 sy = JMASSin(ry), cy = JMASCos(ry);
|
||||
f32 sz = JMASSin(rz), cz = JMASCos(rz);
|
||||
@@ -202,15 +208,15 @@ void J3DGetTranslateRotateMtx(s16 rx, s16 ry, s16 rz, f32 tx, f32 ty, f32 tz, Mt
|
||||
dst[2][1] = cy * sx;
|
||||
dst[2][2] = cy * cx;
|
||||
|
||||
f32 cxsz = cx * sz;
|
||||
f32 sxcz = sx * cz;
|
||||
cxsz = cx * sz;
|
||||
sxcz = sx * cz;
|
||||
dst[0][1] = sxcz * sy - cxsz;
|
||||
dst[1][2] = cxsz * sy - sxcz;
|
||||
|
||||
f32 sxsz = sx * sz;
|
||||
f32 cxcz = cx * cz;
|
||||
dst[0][2] = cxcz * sy + sxsz;
|
||||
dst[1][1] = sxsz * sy + cxcz;
|
||||
cxsz = sx * sz;
|
||||
sxcz = cx * cz;
|
||||
dst[0][2] = sxcz * sy + cxsz;
|
||||
dst[1][1] = cxsz * sy + sxcz;
|
||||
|
||||
dst[0][3] = tx;
|
||||
dst[1][3] = ty;
|
||||
@@ -235,15 +241,10 @@ void J3DGetTextureMtx(const J3DTextureSRTInfo& srt, const Vec& center, Mtx dst)
|
||||
dst[1][1] = cy;
|
||||
dst[1][2] = (-sy * center.x - cy * center.y) + center.y + srt.mTranslationY;
|
||||
|
||||
dst[2][3] = 0.0f;
|
||||
dst[2][1] = 0.0f;
|
||||
dst[2][0] = 0.0f;
|
||||
dst[1][3] = 0.0f;
|
||||
dst[0][3] = 0.0f;
|
||||
dst[2][2] = 1.0f;
|
||||
dst[0][3] = dst[1][3] = dst[2][0] = dst[2][1] = dst[2][3] = 0.0f;
|
||||
dst[2][2] = 1.0f;
|
||||
}
|
||||
|
||||
|
||||
/* 80311B80-80311C34 30C4C0 00B4+00 0/0 3/3 0/0 .text
|
||||
* J3DGetTextureMtxOld__FRC17J3DTextureSRTInfoRC3VecPA4_f */
|
||||
void J3DGetTextureMtxOld(const J3DTextureSRTInfo& srt, const Vec& center, Mtx dst) {
|
||||
@@ -262,12 +263,8 @@ void J3DGetTextureMtxOld(const J3DTextureSRTInfo& srt, const Vec& center, Mtx ds
|
||||
dst[1][1] = cy;
|
||||
dst[1][3] = (-sy * center.x - cy * center.y) + center.y + srt.mTranslationY;
|
||||
|
||||
dst[2][3] = 0.0f;
|
||||
dst[2][1] = 0.0f;
|
||||
dst[2][0] = 0.0f;
|
||||
dst[1][2] = 0.0f;
|
||||
dst[0][2] = 0.0f;
|
||||
dst[2][2] = 1.0f;
|
||||
dst[0][2] = dst[1][2] = dst[2][0] = dst[2][1] = dst[2][3] = 0.0f;
|
||||
dst[2][2] = 1.0f;
|
||||
}
|
||||
|
||||
/* 80311C34-80311CE4 30C574 00B0+00 0/0 3/3 0/0 .text
|
||||
@@ -285,15 +282,10 @@ void J3DGetTextureMtxMaya(const J3DTextureSRTInfo& srt, Mtx dst) {
|
||||
dst[1][1] = srt.mScaleY * cr;
|
||||
dst[1][2] = -tx * sr - cr * (ty + srt.mScaleY) + 0.5f;
|
||||
|
||||
dst[2][3] = 0.0f;
|
||||
dst[2][1] = 0.0f;
|
||||
dst[2][0] = 0.0f;
|
||||
dst[1][3] = 0.0f;
|
||||
dst[0][3] = 0.0f;
|
||||
dst[2][2] = 1.0f;
|
||||
dst[0][3] = dst[1][3] = dst[2][0] = dst[2][1] = dst[2][3] = 0.0f;
|
||||
dst[2][2] = 1.0f;
|
||||
}
|
||||
|
||||
|
||||
/* 80311CE4-80311D94 30C624 00B0+00 0/0 3/3 0/0 .text
|
||||
* J3DGetTextureMtxMayaOld__FRC17J3DTextureSRTInfoPA4_f */
|
||||
void J3DGetTextureMtxMayaOld(const J3DTextureSRTInfo& srt, Mtx dst) {
|
||||
@@ -309,15 +301,10 @@ void J3DGetTextureMtxMayaOld(const J3DTextureSRTInfo& srt, Mtx dst) {
|
||||
dst[1][1] = srt.mScaleY * cr;
|
||||
dst[1][3] = -tx * sr - cr * (ty + srt.mScaleY) + 0.5f;
|
||||
|
||||
dst[2][3] = 0.0f;
|
||||
dst[2][1] = 0.0f;
|
||||
dst[2][0] = 0.0f;
|
||||
dst[1][2] = 0.0f;
|
||||
dst[0][2] = 0.0f;
|
||||
dst[2][2] = 1.0f;
|
||||
dst[0][2] = dst[1][2] = dst[2][0] = dst[2][1] = dst[2][3] = 0.0f;
|
||||
dst[2][2] = 1.0f;
|
||||
}
|
||||
|
||||
|
||||
/* 80311D94-80311DF8 30C6D4 0064+00 0/0 2/2 0/0 .text J3DScaleNrmMtx__FPA4_fRC3Vec */
|
||||
asm void J3DScaleNrmMtx(register Mtx mtx, const register Vec& scl) {
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DVertex
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DVertex.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJointTree.h"
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "string.h"
|
||||
#include <dolphin/os.h>
|
||||
#include <string.h>
|
||||
#include "global.h"
|
||||
|
||||
/* 80310EF8-80310F78 30B838 0080+00 0/0 1/1 0/0 .text __ct__13J3DVertexDataFv */
|
||||
@@ -24,10 +18,10 @@ J3DVertexData::J3DVertexData() {
|
||||
mVtxNrmArray = NULL;
|
||||
mVtxNBTArray = NULL;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mVtxColorArray); i++)
|
||||
for (int i = 0; i < 2; i++)
|
||||
mVtxColorArray[i] = NULL;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mVtxTexCoordArray); i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
mVtxTexCoordArray[i] = NULL;
|
||||
|
||||
mVtxPosFrac = 0;
|
||||
@@ -39,6 +33,8 @@ J3DVertexData::J3DVertexData() {
|
||||
/* 80310F78-80310FD8 30B8B8 0060+00 0/0 1/1 0/0 .text
|
||||
* setVertexData__15J3DVertexBufferFP13J3DVertexData */
|
||||
void J3DVertexBuffer::setVertexData(J3DVertexData* pVtxData) {
|
||||
J3D_ASSERT_NULLPTR(175, pVtxData != NULL);
|
||||
|
||||
mVtxData = pVtxData;
|
||||
mVtxPosArray[0] = pVtxData->getVtxPosArray();
|
||||
mVtxNrmArray[0] = pVtxData->getVtxNrmArray();
|
||||
@@ -59,20 +55,11 @@ void J3DVertexBuffer::setVertexData(J3DVertexData* pVtxData) {
|
||||
void J3DVertexBuffer::init() {
|
||||
mVtxData = NULL;
|
||||
|
||||
mVtxPosArray[1] = NULL;
|
||||
mVtxPosArray[0] = NULL;
|
||||
|
||||
mVtxNrmArray[1] = NULL;
|
||||
mVtxNrmArray[0] = NULL;
|
||||
|
||||
mVtxColArray[1] = NULL;
|
||||
mVtxColArray[0] = NULL;
|
||||
|
||||
mTransformedVtxPosArray[1] = NULL;
|
||||
mTransformedVtxPosArray[0] = NULL;
|
||||
|
||||
mTransformedVtxNrmArray[1] = NULL;
|
||||
mTransformedVtxNrmArray[0] = NULL;
|
||||
mVtxPosArray[0] = mVtxPosArray[1] = NULL;
|
||||
mVtxNrmArray[0] = mVtxNrmArray[1] = NULL;
|
||||
mVtxColArray[0] = mVtxColArray[1] = NULL;
|
||||
mTransformedVtxPosArray[0] = mTransformedVtxPosArray[1] = NULL;
|
||||
mTransformedVtxNrmArray[0] = mTransformedVtxNrmArray[1] = NULL;
|
||||
|
||||
mCurrentVtxPos = NULL;
|
||||
mCurrentVtxNrm = NULL;
|
||||
@@ -96,25 +83,26 @@ void J3DVertexBuffer::setArray() const {
|
||||
s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
|
||||
if (flag & 1) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mVtxPosArray[i] = new (0x20) Vec[mVtxData->getVtxNum()];
|
||||
|
||||
mVtxPosArray[i] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
if (mVtxPosArray[i] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
memcpy(mVtxPosArray[i], mVtxData->getVtxPosArray(), mVtxData->getVtxNum() * 12);
|
||||
DCStoreRange(mVtxPosArray[i], mVtxData->getVtxNum() * 12);
|
||||
|
||||
memcpy(mVtxPosArray[i], mVtxData->getVtxPosArray(), mVtxData->getVtxNum() * 3 * 4);
|
||||
DCStoreRange(mVtxPosArray[i], mVtxData->getVtxNum() * 3 * 4);
|
||||
}
|
||||
} else {
|
||||
mVtxPosArray[0] = mVtxData->getVtxPosArray();
|
||||
|
||||
if (mVtxPosArray[1] == NULL) {
|
||||
mVtxPosArray[1] = new (0x20) Vec[mVtxData->getVtxNum()];
|
||||
mVtxPosArray[1] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
if (mVtxPosArray[1] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
}
|
||||
memcpy(mVtxPosArray[1], mVtxData->getVtxPosArray(), mVtxData->getVtxNum() * 12);
|
||||
DCStoreRange(mVtxPosArray[1], mVtxData->getVtxNum() * 12);
|
||||
|
||||
memcpy(mVtxPosArray[1], mVtxData->getVtxPosArray(), mVtxData->getVtxNum() * 3 * 4);
|
||||
DCStoreRange(mVtxPosArray[1], mVtxData->getVtxNum() * 3 * 4);
|
||||
}
|
||||
|
||||
return kJ3DError_Success;
|
||||
@@ -125,25 +113,26 @@ s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
|
||||
s32 J3DVertexBuffer::copyLocalVtxNrmArray(u32 flag) {
|
||||
if (flag & 1) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mVtxNrmArray[i] = new (0x20) VertexNormal[mVtxData->getNrmNum()];
|
||||
|
||||
mVtxNrmArray[i] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
if (mVtxNrmArray[i] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
memcpy(mVtxNrmArray[i], mVtxData->getVtxNrmArray(), mVtxData->getNrmNum() * 12);
|
||||
DCStoreRange(mVtxNrmArray[i], mVtxData->getNrmNum() * 12);
|
||||
|
||||
memcpy(mVtxNrmArray[i], mVtxData->getVtxNrmArray(), mVtxData->getNrmNum() * 3 * 4);
|
||||
DCStoreRange(mVtxNrmArray[i], mVtxData->getNrmNum() * 3 * 4);
|
||||
}
|
||||
} else {
|
||||
mVtxNrmArray[0] = mVtxData->getVtxNrmArray();
|
||||
|
||||
if (mVtxNrmArray[1] == NULL) {
|
||||
mVtxNrmArray[1] = new (0x20) VertexNormal[mVtxData->getNrmNum()];
|
||||
mVtxNrmArray[1] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
if (mVtxNrmArray[1] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
}
|
||||
memcpy(mVtxNrmArray[1], mVtxData->getVtxNrmArray(), mVtxData->getNrmNum() * 12);
|
||||
DCStoreRange(mVtxNrmArray[1], mVtxData->getNrmNum() * 12);
|
||||
|
||||
memcpy(mVtxNrmArray[1], mVtxData->getVtxNrmArray(), mVtxData->getNrmNum() * 3 * 4);
|
||||
DCStoreRange(mVtxNrmArray[1], mVtxData->getNrmNum() * 3 * 4);
|
||||
}
|
||||
|
||||
return kJ3DError_Success;
|
||||
@@ -185,6 +174,7 @@ s32 J3DVertexBuffer::copyLocalVtxArray(u32 flag) {
|
||||
delete mVtxPosArray[i];
|
||||
mVtxPosArray[i] = oldPosArray[i];
|
||||
}
|
||||
|
||||
if (oldNrmArray[i] != mVtxNrmArray[i]) {
|
||||
if (mVtxNrmArray[i] != mVtxData->getVtxNrmArray())
|
||||
delete mVtxNrmArray[i];
|
||||
@@ -208,7 +198,7 @@ s32 J3DVertexBuffer::allocTransformedVtxPosArray() {
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0 || mTransformedVtxPosArray[i] == NULL) {
|
||||
mTransformedVtxPosArray[i] = new (0x20) Vec[mVtxData->getVtxNum()];
|
||||
mTransformedVtxPosArray[i] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
if (mTransformedVtxPosArray[i] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -225,7 +215,7 @@ s32 J3DVertexBuffer::allocTransformedVtxNrmArray() {
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0 || mTransformedVtxNrmArray[i] == NULL) {
|
||||
mTransformedVtxNrmArray[i] = new (0x20) VertexNormal[mVtxData->getNrmNum()];
|
||||
mTransformedVtxNrmArray[i] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
if (mTransformedVtxNrmArray[i] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
/* 80337178-803371D0 331AB8 0058+00 0/0 1/1 0/0 .text __ct__15J3DJointFactoryFRC13J3DJointBlock */
|
||||
J3DJointFactory::J3DJointFactory(J3DJointBlock const& block) {
|
||||
mJointInitData = JSUConvertOffsetToPtr<J3DJointInitData>(&block, (u32)block.mpJointInitData);
|
||||
mIndexTable = JSUConvertOffsetToPtr<u16>(&block, (u32)block.mpIndexTable);
|
||||
mJointInitData = JSUConvertOffsetToPtr<J3DJointInitData>(&block, (uintptr_t)block.mpJointInitData);
|
||||
mIndexTable = JSUConvertOffsetToPtr<u16>(&block, (uintptr_t)block.mpIndexTable);
|
||||
}
|
||||
|
||||
/* 803371D0-80337338 331B10 0168+00 0/0 1/1 0/0 .text create__15J3DJointFactoryFi */
|
||||
|
||||
@@ -16,7 +16,7 @@ J3DMaterialFactory::J3DMaterialFactory(J3DMaterialBlock const& i_block) {
|
||||
mMaterialNum = i_block.mMaterialNum;
|
||||
mpMaterialInitData = JSUConvertOffsetToPtr<J3DMaterialInitData>(&i_block, i_block.mpMaterialInitData);
|
||||
mpMaterialID = JSUConvertOffsetToPtr<u16>(&i_block, i_block.mpMaterialID);
|
||||
if (i_block.mpIndInitData != NULL && (u32)i_block.mpIndInitData - (u32)i_block.mpNameTable > 4) {
|
||||
if (i_block.mpIndInitData != NULL && (uintptr_t)i_block.mpIndInitData - (uintptr_t)i_block.mpNameTable > 4) {
|
||||
mpIndInitData = JSUConvertOffsetToPtr<J3DIndInitData>(&i_block, i_block.mpIndInitData);
|
||||
} else {
|
||||
mpIndInitData = NULL;
|
||||
@@ -384,7 +384,7 @@ J3DMaterial* J3DMaterialFactory::createLockedMaterial(J3DMaterial* i_material, i
|
||||
if (i_material->mSharedDLObj == NULL) {
|
||||
i_material->mSharedDLObj = new J3DDisplayListObj();
|
||||
i_material->mSharedDLObj->setSingleDisplayList((void*)(
|
||||
mpDisplayListInit[i_idx].mOffset + (u32)&mpDisplayListInit[i_idx]),
|
||||
mpDisplayListInit[i_idx].mOffset + (uintptr_t)&mpDisplayListInit[i_idx]),
|
||||
mpDisplayListInit[i_idx].field_0x4
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ J3DModelData* J3DModelLoaderDataBase::load(void const* i_data, u32 i_flags) {
|
||||
if (i_data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (*(u32*)i_data == 'J3D1' && *(u32*)((u32)i_data + 4) == 'bmd1') {
|
||||
if (*(u32*)i_data == 'J3D1' && *(u32*)((uintptr_t)i_data + 4) == 'bmd1') {
|
||||
return NULL;
|
||||
}
|
||||
if (*(u32*)i_data == 'J3D2' && *(u32*)((u32)i_data + 4) == 'bmd2') {
|
||||
if (*(u32*)i_data == 'J3D2' && *(u32*)((uintptr_t)i_data + 4) == 'bmd2') {
|
||||
J3DModelLoader_v21 loader;
|
||||
return loader.load(i_data, i_flags);
|
||||
}
|
||||
if (*(u32*)i_data == 'J3D2' && *(u32*)((u32)i_data + 4) == 'bmd3') {
|
||||
if (*(u32*)i_data == 'J3D2' && *(u32*)((uintptr_t)i_data + 4) == 'bmd3') {
|
||||
J3DModelLoader_v26 loader;
|
||||
return loader.load(i_data, i_flags);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = (J3DModelBlock*)((u32)block + block->mBlockSize);
|
||||
block = (J3DModelBlock*)((uintptr_t)block + block->mBlockSize);
|
||||
}
|
||||
J3DModelHierarchy const* hierarchy = mpModelData->getHierarchy();
|
||||
mpModelData->makeHierarchy(NULL, &hierarchy);
|
||||
@@ -126,7 +126,7 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = (J3DModelBlock*)((u32)block + block->mBlockSize);
|
||||
block = (J3DModelBlock*)((uintptr_t)block + block->mBlockSize);
|
||||
}
|
||||
if (mpMaterialTable->mTexture == NULL) {
|
||||
mpMaterialTable->mTexture = new J3DTexture(0, NULL);
|
||||
@@ -187,7 +187,7 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = (J3DModelBlock*)((u32)block + block->mBlockSize);
|
||||
block = (J3DModelBlock*)((uintptr_t)block + block->mBlockSize);
|
||||
}
|
||||
J3DModelHierarchy const* hierarchy = mpModelData->getHierarchy();
|
||||
mpModelData->makeHierarchy(NULL, &hierarchy);
|
||||
@@ -206,10 +206,10 @@ void J3DModelLoader::setupBBoardInfo() {
|
||||
if (mesh != NULL) {
|
||||
u16 shape_index = mesh->getShape()->getIndex();
|
||||
u16* index_table = JSUConvertOffsetToPtr<u16>(mpShapeBlock,
|
||||
(u32)mpShapeBlock->mpIndexTable);
|
||||
(uintptr_t)mpShapeBlock->mpIndexTable);
|
||||
J3DShapeInitData* shape_init_data =
|
||||
JSUConvertOffsetToPtr<J3DShapeInitData>(mpShapeBlock,
|
||||
(u32)mpShapeBlock->mpShapeInitData);
|
||||
(uintptr_t)mpShapeBlock->mpShapeInitData);
|
||||
J3DJoint* joint;
|
||||
switch (shape_init_data[index_table[shape_index]].mShapeMtxType) {
|
||||
case 0:
|
||||
@@ -304,9 +304,9 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
||||
if (vertex_data.mVtxNrmArray == NULL) {
|
||||
vertex_data.mNrmNum = 0;
|
||||
} else if (nrm_end != NULL) {
|
||||
vertex_data.mNrmNum = ((u32)nrm_end - (u32)vertex_data.mVtxNrmArray) / nrm_size + 1;
|
||||
vertex_data.mNrmNum = ((uintptr_t)nrm_end - (uintptr_t)vertex_data.mVtxNrmArray) / nrm_size + 1;
|
||||
} else {
|
||||
vertex_data.mNrmNum = (i_block->mBlockSize - (u32)i_block->mpVtxNrmArray) / nrm_size + 1;
|
||||
vertex_data.mNrmNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxNrmArray) / nrm_size + 1;
|
||||
}
|
||||
|
||||
void* color0_end = NULL;
|
||||
@@ -319,15 +319,15 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
||||
if (vertex_data.mVtxColorArray[0] == NULL) {
|
||||
vertex_data.mColNum = 0;
|
||||
} else if (color0_end != NULL) {
|
||||
vertex_data.mColNum = ((u32)color0_end - (u32)vertex_data.mVtxColorArray[0]) / 4 + 1;
|
||||
vertex_data.mColNum = ((uintptr_t)color0_end - (uintptr_t)vertex_data.mVtxColorArray[0]) / 4 + 1;
|
||||
} else {
|
||||
vertex_data.mColNum = (i_block->mBlockSize - (u32)i_block->mpVtxColorArray[0]) / 4 + 1;
|
||||
vertex_data.mColNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxColorArray[0]) / 4 + 1;
|
||||
}
|
||||
|
||||
if (vertex_data.mVtxTexCoordArray[0] == NULL) {
|
||||
vertex_data.mTexCoordNum = 0;
|
||||
} else {
|
||||
vertex_data.mTexCoordNum = (i_block->mBlockSize - (u32)i_block->mpVtxTexCoordArray[0]) / 8 + 1;
|
||||
vertex_data.mTexCoordNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxTexCoordArray[0]) / 8 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_fla
|
||||
for (u16 i = 0; i < mpMaterialTable->mUniqueMatNum; i++) {
|
||||
factory.create(&mpMaterialTable->field_0x10[i],
|
||||
J3DMaterialFactory::MATERIAL_TYPE_NORMAL, i, i_flags);
|
||||
mpMaterialTable->field_0x10[i].mDiffFlag = (u32)&mpMaterialTable->field_0x10[i] >> 4;
|
||||
mpMaterialTable->field_0x10[i].mDiffFlag = (uintptr_t)&mpMaterialTable->field_0x10[i] >> 4;
|
||||
}
|
||||
}
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
@@ -413,14 +413,14 @@ void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_fla
|
||||
if (i_flags & 0x200000) {
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i]->mDiffFlag =
|
||||
(u32)&mpMaterialTable->field_0x10[factory.getMaterialID(i)] >> 4;
|
||||
(uintptr_t)&mpMaterialTable->field_0x10[factory.getMaterialID(i)] >> 4;
|
||||
mpMaterialTable->mMaterialNodePointer[i]->mpOrigMaterial =
|
||||
&mpMaterialTable->field_0x10[factory.getMaterialID(i)];
|
||||
}
|
||||
} else {
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i]->mDiffFlag =
|
||||
((u32)mpMaterialTable->mMaterialNodePointer >> 4) + factory.getMaterialID(i);
|
||||
((uintptr_t)mpMaterialTable->mMaterialNodePointer >> 4) + factory.getMaterialID(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -446,7 +446,7 @@ void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u
|
||||
if (i_flags & 0x200000) {
|
||||
for (u16 i = 0; i < mpMaterialTable->mUniqueMatNum; i++) {
|
||||
factory.create(&mpMaterialTable->field_0x10[i], i, i_flags);
|
||||
mpMaterialTable->field_0x10[i].mDiffFlag = (u32)&mpMaterialTable->field_0x10[i] >> 4;
|
||||
mpMaterialTable->field_0x10[i].mDiffFlag = (uintptr_t)&mpMaterialTable->field_0x10[i] >> 4;
|
||||
}
|
||||
}
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
@@ -455,7 +455,7 @@ void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u
|
||||
if (i_flags & 0x200000) {
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i]->mDiffFlag =
|
||||
(u32)&mpMaterialTable->field_0x10[factory.getMaterialID(i)] >> 4;
|
||||
(uintptr_t)&mpMaterialTable->field_0x10[factory.getMaterialID(i)] >> 4;
|
||||
mpMaterialTable->mMaterialNodePointer[i]->mpOrigMaterial =
|
||||
&mpMaterialTable->field_0x10[factory.getMaterialID(i)];
|
||||
}
|
||||
@@ -524,7 +524,7 @@ void J3DModelLoader_v26::readMaterialTable(J3DMaterialBlock const* i_block, u32
|
||||
}
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i]->mDiffFlag =
|
||||
(u32)mpMaterialTable->mMaterialNodePointer + factory.getMaterialID(i);
|
||||
(uintptr_t)mpMaterialTable->mMaterialNodePointer + factory.getMaterialID(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,7 +546,7 @@ void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_blo
|
||||
}
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i]->mDiffFlag =
|
||||
((u32)mpMaterialTable->mMaterialNodePointer >> 4) + factory.getMaterialID(i);
|
||||
((uintptr_t)mpMaterialTable->mMaterialNodePointer >> 4) + factory.getMaterialID(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ void J3DModelLoader::readPatchedMaterial(J3DMaterialBlock const* i_block, u32 i_
|
||||
mpMaterialTable->mMaterialNodePointer[i] =
|
||||
factory.create(NULL, J3DMaterialFactory::MATERIAL_TYPE_PATCHED, i, i_flags);
|
||||
mpMaterialTable->mMaterialNodePointer[i]->mDiffFlag =
|
||||
((u32)mpMaterialTable->mMaterialNodePointer >> 4) + factory.getMaterialID(i);
|
||||
((uintptr_t)mpMaterialTable->mMaterialNodePointer >> 4) + factory.getMaterialID(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
|
||||
/* 80337350-80337400 331C90 00B0+00 0/0 2/2 0/0 .text __ct__15J3DShapeFactoryFRC13J3DShapeBlock */
|
||||
J3DShapeFactory::J3DShapeFactory(J3DShapeBlock const& block) {
|
||||
mShapeInitData = JSUConvertOffsetToPtr<J3DShapeInitData>(&block, (u32)block.mpShapeInitData);
|
||||
mIndexTable = JSUConvertOffsetToPtr<u16>(&block, (u32)block.mpIndexTable);
|
||||
mVtxDescList = JSUConvertOffsetToPtr<GXVtxDescList>(&block, (u32)block.mpVtxDescList),
|
||||
mMtxTable = JSUConvertOffsetToPtr<u16>(&block, (u32)block.mpMtxTable);
|
||||
mDisplayListData = JSUConvertOffsetToPtr<u8>(&block, (u32)block.mpDisplayListData),
|
||||
mMtxInitData = JSUConvertOffsetToPtr<J3DShapeMtxInitData>(&block, (u32)block.mpMtxInitData),
|
||||
mDrawInitData = JSUConvertOffsetToPtr<J3DShapeDrawInitData>(&block, (u32)block.mpDrawInitData),
|
||||
mShapeInitData = JSUConvertOffsetToPtr<J3DShapeInitData>(&block, (uintptr_t)block.mpShapeInitData);
|
||||
mIndexTable = JSUConvertOffsetToPtr<u16>(&block, (uintptr_t)block.mpIndexTable);
|
||||
mVtxDescList = JSUConvertOffsetToPtr<GXVtxDescList>(&block, (uintptr_t)block.mpVtxDescList),
|
||||
mMtxTable = JSUConvertOffsetToPtr<u16>(&block, (uintptr_t)block.mpMtxTable);
|
||||
mDisplayListData = JSUConvertOffsetToPtr<u8>(&block, (uintptr_t)block.mpDisplayListData),
|
||||
mMtxInitData = JSUConvertOffsetToPtr<J3DShapeMtxInitData>(&block, (uintptr_t)block.mpMtxInitData),
|
||||
mDrawInitData = JSUConvertOffsetToPtr<J3DShapeDrawInitData>(&block, (uintptr_t)block.mpDrawInitData),
|
||||
mVcdVatCmdBuffer = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/ai.h"
|
||||
#include <dolphin/os.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* 80431C58-80431C68 05E978 000C+04 2/2 0/0 0/0 .bss sDmaDacBuffer__9JASDriver */
|
||||
s16* JASDriver::sDmaDacBuffer[3];
|
||||
@@ -87,7 +88,7 @@ void JASDriver::initAI(void (*param_0)(void)) {
|
||||
sDspStatus = 0;
|
||||
JASChannel::initBankDisposeMsgQueue();
|
||||
AIInit(NULL);
|
||||
AIInitDMA((u32)sDmaDacBuffer[2], size);
|
||||
AIInitDMA((uintptr_t)sDmaDacBuffer[2], size);
|
||||
BOOL isOutputRate;
|
||||
if (sOutputRate == 0) {
|
||||
isOutputRate = FALSE;
|
||||
@@ -139,7 +140,7 @@ void JASDriver::updateDac() {
|
||||
s16* r30 = lastRspMadep;
|
||||
lastRspMadep = NULL;
|
||||
if (r30) {
|
||||
AIInitDMA((u32)r30, getDacSize() * 2);
|
||||
AIInitDMA((uintptr_t)r30, getDacSize() * 2);
|
||||
}
|
||||
s32 frameSamples = getFrameSamples();
|
||||
readDspBuffer(sDmaDacBuffer[dacp], frameSamples);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "JSystem/JKernel/JKRDvdAramRipper.h"
|
||||
#include "cstring.h"
|
||||
#include "dolphin/os.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* 80451290-80451298 000790 0004+04 1/1 0/0 0/0 .sbss sAramHeap__16JASWaveArcLoader */
|
||||
JASHeap* JASWaveArcLoader::sAramHeap;
|
||||
@@ -113,7 +114,7 @@ bool JASWaveArc::sendLoadCmd() {
|
||||
loadToAramCallbackParams commandInfo;
|
||||
commandInfo.mWavArc = this;
|
||||
commandInfo.mEntryNum = mEntryNum;
|
||||
commandInfo.mBase = (u32)mHeap.mBase;
|
||||
commandInfo.mBase = (uintptr_t)mHeap.mBase;
|
||||
commandInfo._c = ++_58;
|
||||
|
||||
_5a++;
|
||||
|
||||
@@ -539,7 +539,7 @@ void JORMContext::genControl(u32 type, u32 kind, const char* label, u32 style, u
|
||||
mOutputStream << type << kind << label << style << id;
|
||||
|
||||
if (kind & JORPropertyEvent::EKind_HasListener) {
|
||||
mOutputStream << (u32)pListener;
|
||||
mOutputStream << (uintptr_t)pListener;
|
||||
}
|
||||
|
||||
if ((kind & JORPropertyEvent::EKind_ValueID) && type != 'EDBX') {
|
||||
@@ -741,7 +741,7 @@ void JORMContext::openFile(JORFile* pFile, u32 flags, const char* path, const ch
|
||||
flags |= JORFile::EFlags_HAS_SUFFIX;
|
||||
}
|
||||
|
||||
mOutputStream << (u32)JORFile::ECommand_OPEN << (u32)pFile << flags << path;
|
||||
mOutputStream << (u32)JORFile::ECommand_OPEN << (uintptr_t)pFile << flags << path;
|
||||
mOutputStream << (u16)maskSize;
|
||||
mOutputStream.write(extMask, maskSize);
|
||||
|
||||
@@ -759,13 +759,13 @@ void JORMContext::openFile(JORFile* pFile, u32 flags, const char* path, const ch
|
||||
}
|
||||
|
||||
void JORMContext::closeFile(JORFile* pFile) {
|
||||
mOutputStream << (u32)JORFile::ECommand_CLOSE << (u32)pFile << pFile->getHandle();
|
||||
mOutputStream << (u32)JORFile::ECommand_CLOSE << (uintptr_t)pFile << pFile->getHandle();
|
||||
}
|
||||
|
||||
void JORMContext::readBegin(JORFile* pFile, s32 size) {
|
||||
mOutputStream << (u32)JORFile::ECommand_READ
|
||||
<< (u32)JORFile::EStatus_READ_BEGIN
|
||||
<< (u32)pFile
|
||||
<< (uintptr_t)pFile
|
||||
<< pFile->getHandle()
|
||||
<< (u32)size;
|
||||
}
|
||||
@@ -773,14 +773,14 @@ void JORMContext::readBegin(JORFile* pFile, s32 size) {
|
||||
void JORMContext::readData(JORFile* pFile) {
|
||||
mOutputStream << (u32)JORFile::ECommand_READ
|
||||
<< (u32)JORFile::EStatus_READ_DATA
|
||||
<< (u32)pFile
|
||||
<< (uintptr_t)pFile
|
||||
<< pFile->getHandle();
|
||||
}
|
||||
|
||||
void JORMContext::writeBegin(JORFile* pFile, u16 flags, u32 size) {
|
||||
mOutputStream << (u32)JORFile::ECommand_WRITE
|
||||
<< (u32)JORFile::EStatus_WRITE_BEGIN
|
||||
<< (u32)pFile
|
||||
<< (uintptr_t)pFile
|
||||
<< pFile->getHandle()
|
||||
<< (u32)size
|
||||
<< (u32)flags;
|
||||
@@ -789,7 +789,7 @@ void JORMContext::writeBegin(JORFile* pFile, u16 flags, u32 size) {
|
||||
void JORMContext::writeData(JORFile* pFile, const void* pBuffer, s32 size, u32 position) {
|
||||
mOutputStream << (u32)JORFile::ECommand_WRITE
|
||||
<< (u32)JORFile::EStatus_WRITE_DATA
|
||||
<< (u32)pFile
|
||||
<< (uintptr_t)pFile
|
||||
<< pFile->getHandle()
|
||||
<< (u32)position;
|
||||
|
||||
@@ -800,21 +800,21 @@ void JORMContext::writeData(JORFile* pFile, const void* pBuffer, s32 size, u32 p
|
||||
void JORMContext::writeDone(JORFile* pFile, u32 size) {
|
||||
mOutputStream << (u32)JORFile::ECommand_WRITE
|
||||
<< (u32)JORFile::EStatus_WRITE_END
|
||||
<< (u32)pFile
|
||||
<< (uintptr_t)pFile
|
||||
<< pFile->getHandle()
|
||||
<< (u32)size;
|
||||
}
|
||||
|
||||
void JORMContext::openMessageBox(void* param_0, u32 style, const char* message, const char* title) {
|
||||
mOutputStream << (u32)param_0 << (u32)style << message << title;
|
||||
mOutputStream << (uintptr_t)param_0 << (u32)style << message << title;
|
||||
}
|
||||
|
||||
void JORMContext::sendHostInfoRequest(u32 requestType, JORHostInfo* pHostInfo) {
|
||||
mOutputStream << requestType << (u32)pHostInfo;
|
||||
mOutputStream << requestType << (uintptr_t)pHostInfo;
|
||||
}
|
||||
|
||||
void JORMContext::sendShellExecuteRequest(void* param_0, const char* param_1, const char* param_2,
|
||||
const char* param_3, const char* param_4, int param_5)
|
||||
{
|
||||
mOutputStream << (u32)param_0 << param_1 << param_2 << param_3 << param_4 << (u32)param_5;
|
||||
mOutputStream << (uintptr_t)param_0 << param_1 << param_2 << param_3 << param_4 << (u32)param_5;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ OSMessageQueue JKRAram::sMessageQueue = {0};
|
||||
/* 802D2040-802D214C 2CC980 010C+00 1/1 0/0 0/0 .text __ct__7JKRAramFUlUll */
|
||||
JKRAram::JKRAram(u32 audio_buffer_size, u32 audio_graph_size, s32 priority)
|
||||
: JKRThread(0xC00, 0x10, priority) {
|
||||
u32 aramBase = ARInit(mStackArray, ARRAY_SIZE(mStackArray));
|
||||
u32 aramBase = ARInit(mStackArray, ARRAY_SIZEU(mStackArray));
|
||||
ARQInit();
|
||||
|
||||
u32 aramSize = ARGetSize();
|
||||
@@ -103,11 +103,11 @@ void* JKRAram::run(void) {
|
||||
/* 802D2248-802D22DC 2CCB88 0094+00 2/2 0/0 0/0 .text
|
||||
* checkOkAddress__7JKRAramFPUcUlP12JKRAramBlockUl */
|
||||
void JKRAram::checkOkAddress(u8* addr, u32 size, JKRAramBlock* block, u32 param_4) {
|
||||
if (!IS_ALIGNED((u32)addr, 0x20) && !IS_ALIGNED(size, 0x20)) {
|
||||
if (!IS_ALIGNED((uintptr_t)addr, 0x20) && !IS_ALIGNED(size, 0x20)) {
|
||||
JUTException::panic(__FILE__, 219, ":::address not 32Byte aligned.");
|
||||
}
|
||||
|
||||
if (block && !IS_ALIGNED((u32)block->getAddress() + param_4, 0x20)) {
|
||||
if (block && !IS_ALIGNED((uintptr_t)block->getAddress() + param_4, 0x20)) {
|
||||
JUTException::panic(__FILE__, 227, ":::address not 32Byte aligned.");
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ JKRAramBlock* JKRAram::mainRamToAram(u8* buf, u32 bufSize, u32 alignedSize,
|
||||
block = NULL;
|
||||
} else {
|
||||
JKRDecompress(buf, (u8*)allocatedMem, fileSize, 0);
|
||||
JKRAramPcs(0, (u32)allocatedMem, bufSize, alignedSize, block);
|
||||
JKRAramPcs(0, (uintptr_t)allocatedMem, bufSize, alignedSize, block);
|
||||
JKRFreeToHeap(heap, allocatedMem);
|
||||
block = block == NULL ? (JKRAramBlock*)-1 : block;
|
||||
if (pSize != NULL) {
|
||||
@@ -184,7 +184,7 @@ JKRAramBlock* JKRAram::mainRamToAram(u8* buf, u32 bufSize, u32 alignedSize,
|
||||
bufSize = allocatedBlock->getAddress();
|
||||
}
|
||||
|
||||
JKRAramPcs(0, (u32)buf, bufSize, alignedSize, block);
|
||||
JKRAramPcs(0, (uintptr_t)buf, bufSize, alignedSize, block);
|
||||
block = block == NULL ? (JKRAramBlock*)-1 : block;
|
||||
if (pSize != NULL)
|
||||
*pSize = alignedSize;
|
||||
@@ -205,8 +205,8 @@ u8* JKRAram::aramToMainRam(u32 address, u8* buf, u32 p3, JKRExpandSwitch expandS
|
||||
u32 expandSize;
|
||||
if (expandSwitch == EXPAND_SWITCH_UNKNOWN1) {
|
||||
u8 buffer[64];
|
||||
u8* bufPtr = (u8*)ALIGN_NEXT((u32)buffer, 32);
|
||||
JKRAramPcs(1, address, (u32)bufPtr, sizeof(buffer) / 2,
|
||||
u8* bufPtr = (u8*)ALIGN_NEXT((uintptr_t)buffer, 32);
|
||||
JKRAramPcs(1, address, (uintptr_t)bufPtr, sizeof(buffer) / 2,
|
||||
NULL); // probably change sizeof(buffer) / 2 to 32
|
||||
compression = JKRCheckCompressed_noASR(bufPtr);
|
||||
expandSize = JKRDecompExpandSize(bufPtr);
|
||||
@@ -230,7 +230,7 @@ u8* JKRAram::aramToMainRam(u32 address, u8* buf, u32 p3, JKRExpandSwitch expandS
|
||||
if (szpSpace == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
JKRAramPcs(1, address, (u32)szpSpace, p3, NULL);
|
||||
JKRAramPcs(1, address, (uintptr_t)szpSpace, p3, NULL);
|
||||
if (p5 != 0 && p5 < expandSize)
|
||||
expandSize = p5;
|
||||
|
||||
@@ -261,7 +261,7 @@ u8* JKRAram::aramToMainRam(u32 address, u8* buf, u32 p3, JKRExpandSwitch expandS
|
||||
return NULL;
|
||||
} else {
|
||||
changeGroupIdIfNeed(buf, id);
|
||||
JKRAramPcs(1, address, (u32)buf, p3, NULL);
|
||||
JKRAramPcs(1, address, (uintptr_t)buf, p3, NULL);
|
||||
if (pSize != NULL) {
|
||||
*pSize = p3;
|
||||
}
|
||||
@@ -494,8 +494,8 @@ static u8* firstSrcData() {
|
||||
length = size;
|
||||
}
|
||||
|
||||
u32 src = (u32)(srcAddress + srcOffset);
|
||||
u32 dst = (u32)buffer;
|
||||
u32 src = (uintptr_t)(srcAddress + srcOffset);
|
||||
u32 dst = (uintptr_t)buffer;
|
||||
u32 alignedLength = ALIGN_NEXT(length, 0x20);
|
||||
JKRAramPcs(1, src, dst, alignedLength, NULL);
|
||||
|
||||
@@ -511,18 +511,18 @@ static u8* firstSrcData() {
|
||||
/* 802D2CE4-802D2DAC 2CD624 00C8+00 1/1 0/0 0/0 .text nextSrcData__FPUc */
|
||||
static u8* nextSrcData(u8* current) {
|
||||
u8* dest;
|
||||
u32 left = (u32)(szpEnd - current);
|
||||
u32 left = (uintptr_t)(szpEnd - current);
|
||||
if (IS_NOT_ALIGNED(left, 0x20))
|
||||
dest = szpBuf + 0x20 - (left & (0x20 - 1));
|
||||
else
|
||||
dest = szpBuf;
|
||||
|
||||
memcpy(dest, current, left);
|
||||
u32 transSize = (u32)(szpEnd - (dest + left));
|
||||
u32 transSize = (uintptr_t)(szpEnd - (dest + left));
|
||||
if (transSize > transLeft)
|
||||
transSize = transLeft;
|
||||
|
||||
JKRAramPcs(1, (u32)(srcAddress + srcOffset), ((u32)dest + left), ALIGN_NEXT(transSize, 0x20),
|
||||
JKRAramPcs(1, (uintptr_t)(srcAddress + srcOffset), ((uintptr_t)dest + left), ALIGN_NEXT(transSize, 0x20),
|
||||
NULL);
|
||||
srcOffset += transSize;
|
||||
transLeft -= transSize;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "JSystem/JKernel/JKRAramPiece.h"
|
||||
#include "JSystem/JSupport/JSUFileStream.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80451408-8045140C 000908 0004+00 1/1 0/0 0/0 .sbss sAramStreamObject__13JKRAramStream
|
||||
@@ -40,7 +41,7 @@ JKRAramStream::~JKRAramStream() {}
|
||||
|
||||
/* 802D3C68-802D3CD8 2CE5A8 0070+00 1/0 0/0 0/0 .text run__13JKRAramStreamFv */
|
||||
void* JKRAramStream::run() {
|
||||
OSInitMessageQueue(&sMessageQueue, sMessageBuffer, ARRAY_SIZE(sMessageBuffer));
|
||||
OSInitMessageQueue(&sMessageQueue, sMessageBuffer, ARRAY_SIZEU(sMessageBuffer));
|
||||
|
||||
for (;;) {
|
||||
OSMessage message;
|
||||
@@ -115,7 +116,7 @@ s32 JKRAramStream::writeToAram(JKRAramStreamCommand* command) {
|
||||
break;
|
||||
}
|
||||
|
||||
JKRAramPcs(0, (u32)buffer, destination, length, NULL);
|
||||
JKRAramPcs(0, (uintptr_t)buffer, destination, length, NULL);
|
||||
dstSize -= length;
|
||||
writtenLength += length;
|
||||
destination += length;
|
||||
@@ -205,7 +206,7 @@ void JKRAramStream::setTransBuffer(u8* buffer, u32 bufferSize, JKRHeap* heap) {
|
||||
transHeap = NULL;
|
||||
|
||||
if (buffer) {
|
||||
transBuffer = (u8*)ALIGN_NEXT((u32)buffer, 0x20);
|
||||
transBuffer = (u8*)ALIGN_NEXT((uintptr_t)buffer, 0x20);
|
||||
}
|
||||
|
||||
if (bufferSize) {
|
||||
@@ -227,4 +228,4 @@ JKRAramStreamCommand::JKRAramStreamCommand() {
|
||||
// should be an inline function
|
||||
extern "C" s32 getAvailable__20JSURandomInputStreamCFv(JSURandomInputStream* self) {
|
||||
return self->getLength() - self->getPosition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ void JKRArchive::CArcName::store(const char* name) {
|
||||
while (*name) {
|
||||
s32 ch = tolower(*name);
|
||||
mHash = ch + mHash * 3;
|
||||
if (length < (s32)ARRAY_SIZE(mData)) {
|
||||
if (length < ARRAY_SIZE(mData)) {
|
||||
mData[length++] = ch;
|
||||
}
|
||||
name++;
|
||||
@@ -208,7 +208,7 @@ const char* JKRArchive::CArcName::store(const char* name, char endChar) {
|
||||
while (*name && *name != endChar) {
|
||||
s32 lch = tolower((int)*name);
|
||||
mHash = lch + mHash * 3;
|
||||
if (length < (s32)ARRAY_SIZE(mData)) {
|
||||
if (length < ARRAY_SIZE(mData)) {
|
||||
mData[length++] = lch;
|
||||
}
|
||||
name++;
|
||||
@@ -240,4 +240,4 @@ u32 JKRArchive::getExpandSize(SDIFileEntry* fileEntry) const {
|
||||
return 0;
|
||||
|
||||
return mExpandedSize[index];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include "math.h"
|
||||
#include "string.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* 802D87D4-802D887C 2D3114 00A8+00 0/0 1/1 0/0 .text
|
||||
* __ct__14JKRCompArchiveFlQ210JKRArchive15EMountDirection */
|
||||
@@ -104,10 +105,10 @@ bool JKRCompArchive::open(s32 entryNum) {
|
||||
}
|
||||
else
|
||||
{
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mArcInfoBlock, EXPAND_SWITCH_UNKNOWN1, (u32)arcHeader->file_data_offset + mSizeOfMemPart,
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mArcInfoBlock, EXPAND_SWITCH_UNKNOWN1, (uintptr_t)arcHeader->file_data_offset + mSizeOfMemPart,
|
||||
NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, 0x20, NULL, NULL);
|
||||
DCInvalidateRange(mArcInfoBlock, (u32)arcHeader->file_data_offset + mSizeOfMemPart);
|
||||
field_0x64 = (u32)mArcInfoBlock + arcHeader->file_data_offset;
|
||||
DCInvalidateRange(mArcInfoBlock, (uintptr_t)arcHeader->file_data_offset + mSizeOfMemPart);
|
||||
field_0x64 = (uintptr_t)mArcInfoBlock + arcHeader->file_data_offset;
|
||||
|
||||
if (mSizeOfAramPart != 0) {
|
||||
mAramPart = (JKRAramBlock*)JKRAllocFromAram(mSizeOfAramPart, JKRAramHeap::HEAD);
|
||||
@@ -119,9 +120,9 @@ bool JKRCompArchive::open(s32 entryNum) {
|
||||
JKRDvdToAram(entryNum, mAramPart->getAddress(), EXPAND_SWITCH_UNKNOWN1, arcHeader->header_length + arcHeader->file_data_offset + mSizeOfMemPart, 0, NULL);
|
||||
}
|
||||
|
||||
mNodes = (SDIDirEntry*)((u32)mArcInfoBlock + mArcInfoBlock->node_offset);
|
||||
mFiles = (SDIFileEntry *)((u32)mArcInfoBlock + mArcInfoBlock->file_entry_offset);
|
||||
mStringTable = (char*)((u32)mArcInfoBlock + mArcInfoBlock->string_table_offset);
|
||||
mNodes = (SDIDirEntry*)((uintptr_t)mArcInfoBlock + mArcInfoBlock->node_offset);
|
||||
mFiles = (SDIFileEntry *)((uintptr_t)mArcInfoBlock + mArcInfoBlock->file_entry_offset);
|
||||
mStringTable = (char*)((uintptr_t)mArcInfoBlock + mArcInfoBlock->string_table_offset);
|
||||
field_0x6c = arcHeader->header_length + arcHeader->file_data_offset;
|
||||
}
|
||||
break;
|
||||
@@ -155,7 +156,7 @@ bool JKRCompArchive::open(s32 entryNum) {
|
||||
else {
|
||||
// arcHeader + 1 should lead to 0x20, which is the data after the header
|
||||
JKRHeap::copyMemory((u8 *)mArcInfoBlock, arcHeader + 1, (arcHeader->file_data_offset + mSizeOfMemPart));
|
||||
field_0x64 = (u32)mArcInfoBlock + arcHeader->file_data_offset;
|
||||
field_0x64 = (uintptr_t)mArcInfoBlock + arcHeader->file_data_offset;
|
||||
if (mSizeOfAramPart != 0) {
|
||||
mAramPart = (JKRAramBlock*)JKRAllocFromAram(mSizeOfAramPart, JKRAramHeap::HEAD);
|
||||
if(mAramPart == NULL) {
|
||||
@@ -169,9 +170,9 @@ bool JKRCompArchive::open(s32 entryNum) {
|
||||
}
|
||||
}
|
||||
}
|
||||
mNodes = (SDIDirEntry *)((u32)mArcInfoBlock + mArcInfoBlock->node_offset);
|
||||
mFiles = (SDIFileEntry *)((u32)mArcInfoBlock + mArcInfoBlock->file_entry_offset);
|
||||
mStringTable = (char *)((u32)mArcInfoBlock + mArcInfoBlock->string_table_offset);
|
||||
mNodes = (SDIDirEntry *)((uintptr_t)mArcInfoBlock + mArcInfoBlock->node_offset);
|
||||
mFiles = (SDIFileEntry *)((uintptr_t)mArcInfoBlock + mArcInfoBlock->file_entry_offset);
|
||||
mStringTable = (char *)((uintptr_t)mArcInfoBlock + mArcInfoBlock->string_table_offset);
|
||||
field_0x6c = arcHeader->header_length + arcHeader->file_data_offset;
|
||||
break;
|
||||
}
|
||||
@@ -374,7 +375,7 @@ u32 JKRCompArchive::getExpandedResSize(const void *resource) const
|
||||
}
|
||||
|
||||
u8 buf[64];
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buf, 32);
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((uintptr_t)buf, 32);
|
||||
if ((flags & 0x20) != 0) {
|
||||
u32 addr = mAramPart->mAddress;
|
||||
addr = fileEntry->data_offset + addr;
|
||||
@@ -391,4 +392,4 @@ u32 JKRCompArchive::getExpandedResSize(const void *resource) const
|
||||
u32 expandSize = JKRDecompExpandSize(bufPtr);
|
||||
const_cast<JKRCompArchive *>(this)->setExpandSize(fileEntry, expandSize);
|
||||
return expandSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "math.h"
|
||||
#include "string.h"
|
||||
#include "global.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* 802D7BF0-802D7C98 2D2530 00A8+00 0/0 1/1 0/0 .text
|
||||
* __ct__13JKRDvdArchiveFlQ210JKRArchive15EMountDirection */
|
||||
@@ -233,7 +234,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(s32 entryNum, u32 offset, u32 size,
|
||||
// The dst pointer to JKRDvdToMainRam should be aligned to 32 bytes. This will align
|
||||
// arcHeader to 32 bytes on the stack.
|
||||
char arcHeaderBuffer[64];
|
||||
u8* arcHeader = (u8*)ALIGN_NEXT((u32)arcHeaderBuffer, 0x20);
|
||||
u8* arcHeader = (u8*)ALIGN_NEXT((uintptr_t)arcHeaderBuffer, 0x20);
|
||||
JKRDvdToMainRam(entryNum, arcHeader, EXPAND_SWITCH_UNKNOWN2, sizeof(SArcHeader),
|
||||
NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, offset, NULL, NULL);
|
||||
DCInvalidateRange(arcHeader, sizeof(SArcHeader));
|
||||
@@ -300,7 +301,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(s32 entryNum, u32 offset, u32 size,
|
||||
// The dst pointer to JKRDvdToMainRam should be aligned to 32 bytes. This will align
|
||||
// arcHeader to 32 bytes on the stack.
|
||||
char arcHeaderBuffer[64];
|
||||
u8* arcHeader = (u8*)ALIGN_NEXT((u32)arcHeaderBuffer, 0x20);
|
||||
u8* arcHeader = (u8*)ALIGN_NEXT((uintptr_t)arcHeaderBuffer, 0x20);
|
||||
JKRDvdToMainRam(entryNum, arcHeader, EXPAND_SWITCH_UNKNOWN2, sizeof(SArcHeader),
|
||||
NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, offset, NULL, NULL);
|
||||
DCInvalidateRange(arcHeader, sizeof(SArcHeader));
|
||||
@@ -364,7 +365,7 @@ u32 JKRDvdArchive::getExpandedResSize(const void* resource) const {
|
||||
// The dst pointer to JKRDvdToMainRam should be aligned to 32 bytes. This will align arcHeader
|
||||
// to 32 bytes on the stack.
|
||||
char buffer[64];
|
||||
u8* arcHeader = (u8*)ALIGN_NEXT((u32)buffer, 0x20);
|
||||
u8* arcHeader = (u8*)ALIGN_NEXT((uintptr_t)buffer, 0x20);
|
||||
JKRDvdToMainRam(mEntryNum, arcHeader, EXPAND_SWITCH_UNKNOWN2, sizeof(SArcHeader), NULL,
|
||||
JKRDvdRipper::ALLOC_DIRECTION_FORWARD,
|
||||
mDataOffset + fileEntry->data_offset, NULL, NULL);
|
||||
@@ -375,4 +376,4 @@ u32 JKRDvdArchive::getExpandedResSize(const void* resource) const {
|
||||
((JKRDvdArchive*)this)->setExpandSize(fileEntry, resourceSize);
|
||||
|
||||
return resourceSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <dolphin/os.h>
|
||||
#include <dolphin/os.h>
|
||||
#include "dolphin/vi.h"
|
||||
#include <stdint.h>
|
||||
|
||||
static int JKRDecompressFromDVD(JKRDvdFile*, void*, u32, u32, u32, u32, u32*);
|
||||
static int decompSZS_subroutine(u8*, u8*);
|
||||
@@ -66,7 +67,7 @@ void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* dvdFile, u8* dst, JKRExpandSwitch
|
||||
if (expandSwitch == EXPAND_SWITCH_UNKNOWN1)
|
||||
{
|
||||
u8 buffer[0x40];
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buffer, 32);
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((uintptr_t)buffer, 32);
|
||||
while (true)
|
||||
{
|
||||
int readBytes = DVDReadPrio(dvdFile->getFileInfo(), bufPtr, 0x20, 0, 2);
|
||||
@@ -134,7 +135,7 @@ void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* dvdFile, u8* dst, JKRExpandSwitch
|
||||
if (offset != 0)
|
||||
{
|
||||
u8 buffer[0x40];
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buffer, 32);
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((uintptr_t)buffer, 32);
|
||||
while (true)
|
||||
{
|
||||
int readBytes = DVDReadPrio(dvdFile->getFileInfo(), bufPtr, 32, (s32)offset, 2);
|
||||
@@ -534,7 +535,7 @@ static u8* nextSrcData(u8* src) {
|
||||
buf = szpBuf;
|
||||
|
||||
memcpy(buf, src, limit);
|
||||
u32 transSize = (u32)(szpEnd - (buf + limit));
|
||||
u32 transSize = (uintptr_t)(szpEnd - (buf + limit));
|
||||
if (transSize > transLeft)
|
||||
transSize = transLeft;
|
||||
while (true)
|
||||
|
||||
@@ -75,7 +75,7 @@ JKRExpHeap* JKRExpHeap::create(void* ptr, u32 size, JKRHeap* parent, bool errorF
|
||||
return NULL;
|
||||
|
||||
void* dataPtr = (u8*)ptr + expHeapSize;
|
||||
u32 alignedSize = ALIGN_PREV((u32)ptr + size - (u32)dataPtr, 0x10);
|
||||
u32 alignedSize = ALIGN_PREV((uintptr_t)ptr + size - (uintptr_t)dataPtr, 0x10);
|
||||
if (ptr) {
|
||||
newHeap = new (ptr) JKRExpHeap(dataPtr, alignedSize, parent2, errorFlag);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ void* JKRExpHeap::allocFromHead(u32 size, int align) {
|
||||
|
||||
for (CMemBlock* block = mHeadFreeList; block; block = block->mNext) {
|
||||
u32 offset =
|
||||
ALIGN_PREV(align - 1 + (u32)block->getContent(), align) - (u32)block->getContent();
|
||||
ALIGN_PREV(align - 1 + (uintptr_t)block->getContent(), align) - (uintptr_t)block->getContent();
|
||||
if (block->size < size + offset) {
|
||||
continue;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ void* JKRExpHeap::allocFromHead(u32 size, int align) {
|
||||
CMemBlock* prev = foundBlock->mPrev;
|
||||
CMemBlock* next = foundBlock->mNext;
|
||||
removeFreeBlock(foundBlock);
|
||||
newUsedBlock = (CMemBlock*)((u32)foundBlock + foundOffset);
|
||||
newUsedBlock = (CMemBlock*)((uintptr_t)foundBlock + foundOffset);
|
||||
newUsedBlock->size = foundBlock->size - foundOffset;
|
||||
newFreeBlock =
|
||||
newUsedBlock->allocFore(size, mCurrentGroupId, (u8)foundOffset, 0, 0);
|
||||
@@ -252,7 +252,7 @@ void* JKRExpHeap::allocFromHead(u32 size, int align) {
|
||||
CMemBlock* prev = foundBlock->mPrev;
|
||||
CMemBlock* next = foundBlock->mNext;
|
||||
// Works but very fake match
|
||||
size = (u32)foundBlock->allocFore(size, mCurrentGroupId, 0, 0, 0);
|
||||
size = (uintptr_t)foundBlock->allocFore(size, mCurrentGroupId, 0, 0, 0);
|
||||
removeFreeBlock(foundBlock);
|
||||
if (size) {
|
||||
setFreeBlock((CMemBlock*)size, prev, next);
|
||||
@@ -318,8 +318,8 @@ void* JKRExpHeap::allocFromTail(u32 size, int align) {
|
||||
u32 start;
|
||||
|
||||
for (CMemBlock* block = mTailFreeList; block; block = block->mPrev) {
|
||||
start = ALIGN_PREV((u32)block->getContent() + block->size - size, align);
|
||||
usedSize = (u32)block->getContent() + block->size - start;
|
||||
start = ALIGN_PREV((uintptr_t)block->getContent() + block->size - size, align);
|
||||
usedSize = (uintptr_t)block->getContent() + block->size - start;
|
||||
if (block->size >= usedSize) {
|
||||
foundBlock = block;
|
||||
offset = block->size - usedSize;
|
||||
@@ -454,7 +454,7 @@ s32 JKRExpHeap::do_resize(void* ptr, u32 size) {
|
||||
if (size > block->size) {
|
||||
CMemBlock* foundBlock = NULL;
|
||||
for (CMemBlock* freeBlock = mHeadFreeList; freeBlock; freeBlock = freeBlock->mNext) {
|
||||
if (freeBlock == (CMemBlock*)((u32)(block + 1) + block->size)) {
|
||||
if (freeBlock == (CMemBlock*)((uintptr_t)(block + 1) + block->size)) {
|
||||
foundBlock = freeBlock;
|
||||
break;
|
||||
}
|
||||
@@ -718,9 +718,9 @@ void JKRExpHeap::recycleFreeBlock(JKRExpHeap::CMemBlock* block) {
|
||||
/* 802D00B4-802D0190 2CA9F4 00DC+00 1/1 0/0 0/0 .text
|
||||
* joinTwoBlocks__10JKRExpHeapFPQ210JKRExpHeap9CMemBlock */
|
||||
void JKRExpHeap::joinTwoBlocks(CMemBlock* block) {
|
||||
u32 endAddr = (u32)(block + 1) + block->size;
|
||||
u32 endAddr = (uintptr_t)(block + 1) + block->size;
|
||||
CMemBlock* next = block->mNext;
|
||||
u32 nextAddr = (u32)next - (next->mFlags & 0x7f);
|
||||
u32 nextAddr = (uintptr_t)next - (next->mFlags & 0x7f);
|
||||
if (endAddr > nextAddr) {
|
||||
JUTWarningConsole_f(":::Heap may be broken. (block = %x)", block);
|
||||
JKRGetCurrentHeap()->dump();
|
||||
@@ -776,7 +776,7 @@ bool JKRExpHeap::check() {
|
||||
block->mNext->mPrev);
|
||||
}
|
||||
|
||||
if ((u32)block + block->size + sizeof(CMemBlock) > (u32)block->mNext) {
|
||||
if ((uintptr_t)block + block->size + sizeof(CMemBlock) > (uintptr_t)block->mNext) {
|
||||
ok = false;
|
||||
JUTWarningConsole_f(":::addr %08x: bad block size (%08x)\n", block, block->size);
|
||||
}
|
||||
@@ -932,7 +932,7 @@ JKRExpHeap::CMemBlock* JKRExpHeap::CMemBlock::allocFore(u32 size, u8 groupId1, u
|
||||
mGroupId = groupId1;
|
||||
mFlags = alignment1;
|
||||
if (getSize() >= size + sizeof(CMemBlock)) {
|
||||
block = (CMemBlock*)(size + (u32)this);
|
||||
block = (CMemBlock*)(size + (uintptr_t)this);
|
||||
block[1].mGroupId = groupId2;
|
||||
block[1].mFlags = alignment2;
|
||||
block[1].size = this->size - (size + sizeof(CMemBlock));
|
||||
@@ -948,7 +948,7 @@ JKRExpHeap::CMemBlock* JKRExpHeap::CMemBlock::allocBack(u32 size, u8 groupId1, u
|
||||
u8 groupId2, u8 alignment2) {
|
||||
CMemBlock* newblock = NULL;
|
||||
if (getSize() >= size + sizeof(CMemBlock)) {
|
||||
newblock = (CMemBlock*)((u32)this + getSize() - size);
|
||||
newblock = (CMemBlock*)((uintptr_t)this + getSize() - size);
|
||||
newblock->mGroupId = groupId2;
|
||||
newblock->mFlags = alignment2 | 0x80;
|
||||
newblock->size = size;
|
||||
@@ -997,10 +997,10 @@ void JKRExpHeap::state_register(JKRHeap::TState* p, u32 param_1) const {
|
||||
if (param_1 <= 0xff) {
|
||||
u8 groupId = block->getGroupId();
|
||||
if (groupId == param_1) {
|
||||
checkCode += (u32)block * 3;
|
||||
checkCode += (uintptr_t)block * 3;
|
||||
}
|
||||
} else {
|
||||
checkCode += (u32)block * 3;
|
||||
checkCode += (uintptr_t)block * 3;
|
||||
}
|
||||
}
|
||||
p->mCheckCode = checkCode;
|
||||
|
||||
@@ -110,7 +110,7 @@ JKRFileLoader* JKRFileLoader::findVolume(const char** volumeName) {
|
||||
}
|
||||
|
||||
char volumeNameBuffer[0x101];
|
||||
*volumeName = fetchVolumeName(volumeNameBuffer, ARRAY_SIZE(volumeNameBuffer), *volumeName);
|
||||
*volumeName = fetchVolumeName(volumeNameBuffer, ARRAY_SIZEU(volumeNameBuffer), *volumeName);
|
||||
|
||||
JSUList<JKRFileLoader>& volumeList = getVolumeList();
|
||||
JSUListIterator<JKRFileLoader> iterator;
|
||||
@@ -159,4 +159,4 @@ const char* JKRFileLoader::fetchVolumeName(char* buffer, s32 bufferSize, const c
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <stdint.h>
|
||||
|
||||
bool data_804508B0 = 1;
|
||||
|
||||
@@ -109,8 +110,8 @@ bool JKRHeap::initArena(char** memory, u32* size, int maxHeaps) {
|
||||
return false;
|
||||
|
||||
arenaStart = OSInitAlloc(arenaLo, arenaHi, maxHeaps);
|
||||
ram_start = (void*)ALIGN_NEXT((u32)arenaStart, 0x20);
|
||||
ram_end = (void*)ALIGN_PREV((u32)arenaHi, 0x20);
|
||||
ram_start = (void*)ALIGN_NEXT((uintptr_t)arenaStart, 0x20);
|
||||
ram_end = (void*)ALIGN_PREV((uintptr_t)arenaHi, 0x20);
|
||||
|
||||
OSBootInfo* codeStart = (OSBootInfo*)OSPhysicalToCached(0);
|
||||
mCodeStart = codeStart;
|
||||
@@ -124,7 +125,7 @@ bool JKRHeap::initArena(char** memory, u32* size, int maxHeaps) {
|
||||
OSSetArenaHi(ram_end);
|
||||
|
||||
*memory = (char*)ram_start;
|
||||
*size = (u32)ram_end - (u32)ram_start;
|
||||
*size = (uintptr_t)ram_end - (uintptr_t)ram_start;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -273,7 +274,7 @@ s32 JKRHeap::changeGroupID(u8 groupID) {
|
||||
/* 802CE7DC-802CE83C 2C911C 0060+00 0/0 2/2 0/0 .text getMaxAllocatableSize__7JKRHeapFi
|
||||
*/
|
||||
u32 JKRHeap::getMaxAllocatableSize(int alignment) {
|
||||
u32 maxFreeBlock = (u32)getMaxFreeBlock();
|
||||
u32 maxFreeBlock = (uintptr_t)getMaxFreeBlock();
|
||||
u32 ptrOffset = (alignment - 1) & alignment - (maxFreeBlock & 0xf);
|
||||
return ~(alignment - 1) & (getFreeSize() - ptrOffset);
|
||||
}
|
||||
@@ -363,13 +364,13 @@ void JKRHeap::dispose_subroutine(u32 begin, u32 end) {
|
||||
|
||||
/* 802CEA78-802CEAA0 2C93B8 0028+00 0/0 1/1 0/0 .text dispose__7JKRHeapFPvUl */
|
||||
bool JKRHeap::dispose(void* ptr, u32 size) {
|
||||
dispose_subroutine((u32)ptr, (u32)ptr + size);
|
||||
dispose_subroutine((uintptr_t)ptr, (uintptr_t)ptr + size);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 802CEAA0-802CEAC0 2C93E0 0020+00 0/0 1/1 0/0 .text dispose__7JKRHeapFPvPv */
|
||||
void JKRHeap::dispose(void* begin, void* end) {
|
||||
dispose_subroutine((u32)begin, (u32)end);
|
||||
dispose_subroutine((uintptr_t)begin, (uintptr_t)end);
|
||||
}
|
||||
|
||||
/* 802CEAC0-802CEB18 2C9400 0058+00 0/0 3/3 0/0 .text dispose__7JKRHeapFv */
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include "string.h"
|
||||
#include "global.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* 802D69B8-802D6A6C 2D12F8 00B4+00 0/0 2/2 0/0 .text
|
||||
* __ct__13JKRMemArchiveFlQ210JKRArchive15EMountDirection */
|
||||
@@ -94,7 +95,7 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
|
||||
mStringTable = (char *)((u8 *)&mArcInfoBlock->num_nodes + mArcInfoBlock->string_table_offset);
|
||||
|
||||
mArchiveData =
|
||||
(u8 *)((u32)mArcHeader + mArcHeader->header_length + mArcHeader->file_data_offset);
|
||||
(u8 *)((uintptr_t)mArcHeader + mArcHeader->header_length + mArcHeader->file_data_offset);
|
||||
mIsOpen = true;
|
||||
}
|
||||
|
||||
@@ -116,7 +117,7 @@ bool JKRMemArchive::open(void* buffer, u32 bufferSize, JKRMemBreakFlag flag) {
|
||||
mNodes = (SDIDirEntry *)((u8 *)&mArcInfoBlock->num_nodes + mArcInfoBlock->node_offset);
|
||||
mFiles = (SDIFileEntry *)((u8 *)&mArcInfoBlock->num_nodes + mArcInfoBlock->file_entry_offset);
|
||||
mStringTable = (char *)((u8 *)&mArcInfoBlock->num_nodes + mArcInfoBlock->string_table_offset);
|
||||
mArchiveData = (u8 *)(((u32)mArcHeader + mArcHeader->header_length) + mArcHeader->file_data_offset);
|
||||
mArchiveData = (u8 *)(((uintptr_t)mArcHeader + mArcHeader->header_length) + mArcHeader->file_data_offset);
|
||||
mIsOpen = (flag == JKRMEMBREAK_FLAG_UNKNOWN1) ? true : false; // mIsOpen might be u8
|
||||
mHeap = JKRHeap::findFromRoot(buffer);
|
||||
mCompression = COMPRESSION_NONE;
|
||||
@@ -239,4 +240,4 @@ u32 JKRMemArchive::getExpandedResSize(const void* resource) const {
|
||||
} else {
|
||||
return JKRDecompExpandSize((u8*)resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "global.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* 802D0A24-802D0AD0 2CB364 00AC+00 0/0 4/4 1/1 .text create__12JKRSolidHeapFUlP7JKRHeapb
|
||||
*/
|
||||
@@ -58,7 +59,7 @@ s32 JKRSolidHeap::adjustSize(void) {
|
||||
JKRHeap* parent = getParent();
|
||||
if (parent) {
|
||||
lock();
|
||||
u32 thisSize = (u32)mStart - (u32)this;
|
||||
u32 thisSize = (uintptr_t)mStart - (uintptr_t)this;
|
||||
u32 newSize = ALIGN_NEXT(mSolidHead - mStart, 0x20);
|
||||
if (parent->resize(this, thisSize + newSize) != -1) {
|
||||
mFreeSize = 0;
|
||||
@@ -115,8 +116,8 @@ void* JKRSolidHeap::do_alloc(u32 size, int alignment) {
|
||||
void* JKRSolidHeap::allocFromHead(u32 size, int alignment) {
|
||||
size = ALIGN_NEXT(size, 0x4);
|
||||
void* ptr = NULL;
|
||||
u32 alignedStart = (alignment - 1 + (u32)mSolidHead) & ~(alignment - 1);
|
||||
u32 offset = alignedStart - (u32)mSolidHead;
|
||||
u32 alignedStart = (alignment - 1 + (uintptr_t)mSolidHead) & ~(alignment - 1);
|
||||
u32 offset = alignedStart - (uintptr_t)mSolidHead;
|
||||
u32 totalSize = size + offset;
|
||||
if (totalSize <= mFreeSize) {
|
||||
ptr = (void*)alignedStart;
|
||||
@@ -137,8 +138,8 @@ void* JKRSolidHeap::allocFromHead(u32 size, int alignment) {
|
||||
void* JKRSolidHeap::allocFromTail(u32 size, int alignment) {
|
||||
size = ALIGN_NEXT(size, 4);
|
||||
void* ptr = NULL;
|
||||
u32 alignedStart = ALIGN_PREV((u32)mSolidTail - size, alignment);
|
||||
u32 totalSize = (u32)mSolidTail - (u32)alignedStart;
|
||||
u32 alignedStart = ALIGN_PREV((uintptr_t)mSolidTail - size, alignment);
|
||||
u32 totalSize = (uintptr_t)mSolidTail - (uintptr_t)alignedStart;
|
||||
if (totalSize <= mFreeSize) {
|
||||
ptr = (void*)alignedStart;
|
||||
mSolidTail -= totalSize;
|
||||
@@ -178,7 +179,7 @@ void JKRSolidHeap::do_freeTail(void) {
|
||||
dispose(mSolidTail, mEnd);
|
||||
}
|
||||
|
||||
this->mFreeSize = ((u32)mEnd - (u32)mSolidTail + mFreeSize);
|
||||
this->mFreeSize = ((uintptr_t)mEnd - (uintptr_t)mSolidTail + mFreeSize);
|
||||
this->mSolidTail = mEnd;
|
||||
|
||||
JKRSolidHeap::Unknown* unknown = field_0x78;
|
||||
@@ -216,7 +217,7 @@ bool JKRSolidHeap::check(void) {
|
||||
|
||||
bool result = true;
|
||||
u32 calculatedSize =
|
||||
((u32)mSolidHead - (u32)mStart) + mFreeSize + ((u32)mEnd - (u32)mSolidTail);
|
||||
((uintptr_t)mSolidHead - (uintptr_t)mStart) + mFreeSize + ((uintptr_t)mEnd - (uintptr_t)mSolidTail);
|
||||
u32 availableSize = mSize;
|
||||
if (calculatedSize != availableSize) {
|
||||
result = false;
|
||||
@@ -233,11 +234,11 @@ bool JKRSolidHeap::dump(void) {
|
||||
bool result = check();
|
||||
|
||||
lock();
|
||||
u32 headSize = ((u32)mSolidHead - (u32)mStart);
|
||||
u32 tailSize = ((u32)mEnd - (u32)mSolidTail);
|
||||
u32 headSize = ((uintptr_t)mSolidHead - (uintptr_t)mStart);
|
||||
u32 tailSize = ((uintptr_t)mEnd - (uintptr_t)mSolidTail);
|
||||
s32 htSize = headSize + tailSize;
|
||||
JUTReportConsole_f("head %08x: %08x\n", mStart, headSize);
|
||||
JUTReportConsole_f("tail %08x: %08x\n", mSolidTail, ((u32)mEnd - (u32)mSolidTail));
|
||||
JUTReportConsole_f("tail %08x: %08x\n", mSolidTail, ((uintptr_t)mEnd - (uintptr_t)mSolidTail));
|
||||
|
||||
u32 totalSize = mSize;
|
||||
float percentage = (float)htSize / (float)totalSize * 100.0f;
|
||||
@@ -255,8 +256,8 @@ void JKRSolidHeap::state_register(JKRHeap::TState* p, u32 id) const {
|
||||
getState_(p);
|
||||
setState_u32ID_(p, id);
|
||||
setState_uUsedSize_(p, getUsedSize((JKRSolidHeap*)this));
|
||||
u32 r29 = (u32)mSolidHead;
|
||||
r29 += (u32)mSolidTail * 3;
|
||||
u32 r29 = (uintptr_t)mSolidHead;
|
||||
r29 += (uintptr_t)mSolidTail * 3;
|
||||
setState_u32CheckCode_(p, r29);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "stdio.h"
|
||||
#include "dol2asm.h"
|
||||
#include "global.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* 8043428C-80434298 060FAC 000C+00 5/6 0/0 0/0 .bss sThreadList__9JKRThread */
|
||||
JSUList<JKRThread> JKRThread::sThreadList(0);
|
||||
@@ -53,7 +54,7 @@ JKRThread::JKRThread(JKRHeap* heap, u32 stack_size, int message_count, int param
|
||||
JKRThread::JKRThread(OSThread* thread, int message_count) : mThreadListLink(this) {
|
||||
mHeap = NULL;
|
||||
mThreadRecord = thread;
|
||||
mStackSize = (u32)thread->stackEnd - (u32)thread->stackBase;
|
||||
mStackSize = (uintptr_t)thread->stackEnd - (uintptr_t)thread->stackBase;
|
||||
mStackMemory = thread->stackBase;
|
||||
|
||||
setCommon_mesgQueue(JKRHeap::getSystemHeap(), message_count);
|
||||
|
||||
@@ -268,7 +268,7 @@ void TObject::process_paragraph_reserved_(u32 arg1, const void* pContent, u32 uS
|
||||
data::TParse_TParagraph_dataID dataID(pContent);
|
||||
const void* temp = dataID.getContent();
|
||||
on_data(dataID.get_ID(), dataID.get_IDSize(), temp,
|
||||
uSize - ((u32)temp - (u32)dataID.getRaw()));
|
||||
uSize - ((uintptr_t)temp - (uintptr_t)dataID.getRaw()));
|
||||
break;
|
||||
case 0x82:
|
||||
ASSERT(pContent != 0);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JUtility/JUTDirectFile.h"
|
||||
#include <dolphin/os.h>
|
||||
#include "global.h"
|
||||
#include <stdint.h>
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
@@ -47,7 +48,7 @@ JUTDirectFile::JUTDirectFile() {
|
||||
mLength = 0;
|
||||
mPos = 0;
|
||||
mToRead = 0;
|
||||
mSectorStart = (u8*)ALIGN_NEXT((u32)mBuffer, DVD_MIN_TRANSFER_SIZE);
|
||||
mSectorStart = (u8*)ALIGN_NEXT((uintptr_t)mBuffer, DVD_MIN_TRANSFER_SIZE);
|
||||
mIsOpen = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ void JUTDirectPrint::printSub(u16 position_x, u16 position_y, char const* format
|
||||
return;
|
||||
}
|
||||
|
||||
int buffer_length = vsnprintf(buffer, ARRAY_SIZE(buffer), format, args);
|
||||
int buffer_length = vsnprintf(buffer, ARRAY_SIZEU(buffer), format, args);
|
||||
u16 x = position_x;
|
||||
if (buffer_length > 0) {
|
||||
if (clear) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dolphin.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* 803CC620-803CC640 029740 0020+00 3/3 0/0 0/0 .data sMessageQueue__12JUTException */
|
||||
OSMessageQueue JUTException::sMessageQueue = {0};
|
||||
@@ -191,7 +192,7 @@ void JUTException::panic_f_va(char const* file, int line, char const* format, va
|
||||
|
||||
OSContext* current_context = OSGetCurrentContext();
|
||||
memcpy(&context, current_context, sizeof(OSContext));
|
||||
sErrorManager->mStackPointer = (u32)OSGetStackPointer();
|
||||
sErrorManager->mStackPointer = (uintptr_t)OSGetStackPointer();
|
||||
|
||||
exCallbackObject.callback = sPreUserCallback;
|
||||
exCallbackObject.error = 0xFF;
|
||||
@@ -468,10 +469,10 @@ bool JUTException::showMapInfo_subroutine(u32 address, bool begin_with_newline)
|
||||
if (result == true) {
|
||||
result =
|
||||
queryMapAddress((char*)name_part, section_offset, section_id, &out_addr, &out_size,
|
||||
out_line, ARRAY_SIZE(out_line), true, begin_with_newline);
|
||||
out_line, ARRAY_SIZEU(out_line), true, begin_with_newline);
|
||||
} else {
|
||||
result = queryMapAddress(NULL, address, -1, &out_addr, &out_size, out_line,
|
||||
ARRAY_SIZE(out_line), true, begin_with_newline);
|
||||
ARRAY_SIZEU(out_line), true, begin_with_newline);
|
||||
}
|
||||
|
||||
if (result == true) {
|
||||
@@ -826,7 +827,7 @@ void JUTException::createFB() {
|
||||
u32 pixel_count = width * height;
|
||||
u32 size = pixel_count * 2;
|
||||
|
||||
void* begin = (void*)ALIGN_PREV((u32)end - size, 32);
|
||||
void* begin = (void*)ALIGN_PREV((uintptr_t)end - size, 32);
|
||||
void* object = (void*)ALIGN_PREV((s32)begin - sizeof(JUTExternalFB), 32);
|
||||
new (object) JUTExternalFB(renderMode, GX_GM_1_7, begin, size);
|
||||
|
||||
@@ -934,7 +935,7 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
|
||||
char* src;
|
||||
char* dst;
|
||||
|
||||
if (file.fgets(buffer, ARRAY_SIZE(buffer)) < 0)
|
||||
if (file.fgets(buffer, ARRAY_SIZEU(buffer)) < 0)
|
||||
break;
|
||||
if (buffer[0] != '.')
|
||||
continue;
|
||||
@@ -968,7 +969,7 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
|
||||
int length;
|
||||
|
||||
while (true) {
|
||||
if ((length = file.fgets(buffer, ARRAY_SIZE(buffer))) <= 4)
|
||||
if ((length = file.fgets(buffer, ARRAY_SIZEU(buffer))) <= 4)
|
||||
break;
|
||||
if ((length < 28))
|
||||
continue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* 802E5888-802E599C 2E01C8 0114+00 1/1 0/0 0/0 .text __ct__10JUTProcBarFv */
|
||||
JUTProcBar::JUTProcBar() {
|
||||
@@ -263,7 +264,7 @@ void JUTProcBar::drawProcessBar() {
|
||||
|
||||
/* 802E6D3C-802E6DA4 2E167C 0068+00 2/2 0/0 0/0 .text addrToXPos__FPvi */
|
||||
static int addrToXPos(void* param_0, int param_1) {
|
||||
return param_1 * (((u32)param_0 - 0x80000000) / (float)JKRHeap::mMemorySize);
|
||||
return param_1 * (((uintptr_t)param_0 - 0x80000000) / (float)JKRHeap::mMemorySize);
|
||||
}
|
||||
|
||||
/* 802E6DA4-802E6E0C 2E16E4 0068+00 2/2 0/0 0/0 .text byteToXLen__Fii */
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef MSL_STDINT_H_
|
||||
#define MSL_STDINT_H_
|
||||
|
||||
#include <cstdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
using std::uint8_t;
|
||||
using std::uint16_t;
|
||||
using std::uint32_t;
|
||||
|
||||
using std::int8_t;
|
||||
using std::int16_t;
|
||||
using std::int32_t;
|
||||
|
||||
using std::uint64_t;
|
||||
using std::int64_t;
|
||||
|
||||
using std::uintptr_t;
|
||||
using std::intptr_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "__va_arg.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#undef __va_arg
|
||||
|
||||
@@ -38,7 +39,7 @@ void* __va_arg(_va_list_struct* list, int type) {
|
||||
} else {
|
||||
*reg = 8;
|
||||
addr = list->input_arg_area;
|
||||
addr = (char*)(((u32)(addr) + ((size)-1)) & ~((size)-1));
|
||||
addr = (char*)(((uintptr_t)(addr) + ((size)-1)) & ~((size)-1));
|
||||
list->input_arg_area = addr + size;
|
||||
}
|
||||
|
||||
@@ -47,4 +48,4 @@ void* __va_arg(_va_list_struct* list, int type) {
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,22 +16,22 @@ cCcS::cCcS() {}
|
||||
|
||||
/* 80264A94-80264B60 25F3D4 00CC+00 1/1 1/1 0/0 .text Ct__4cCcSFv */
|
||||
void cCcS::Ct() {
|
||||
for (cCcD_Obj** obj = mpObjAt; obj < mpObjAt + ARRAY_SIZE(mpObjAt); ++obj) {
|
||||
for (cCcD_Obj** obj = mpObjAt; obj < mpObjAt + ARRAY_SIZEU(mpObjAt); ++obj) {
|
||||
*obj = NULL;
|
||||
}
|
||||
mObjAtCount = 0;
|
||||
|
||||
for (cCcD_Obj** obj = mpObjTg; obj < mpObjTg + ARRAY_SIZE(mpObjTg); ++obj) {
|
||||
for (cCcD_Obj** obj = mpObjTg; obj < mpObjTg + ARRAY_SIZEU(mpObjTg); ++obj) {
|
||||
*obj = NULL;
|
||||
}
|
||||
mObjTgCount = 0;
|
||||
|
||||
for (cCcD_Obj** obj = mpObjCo; obj < mpObjCo + ARRAY_SIZE(mpObjCo); ++obj) {
|
||||
for (cCcD_Obj** obj = mpObjCo; obj < mpObjCo + ARRAY_SIZEU(mpObjCo); ++obj) {
|
||||
*obj = NULL;
|
||||
}
|
||||
mObjCoCount = 0;
|
||||
|
||||
for (cCcD_Obj** obj = mpObj; obj < mpObj + ARRAY_SIZE(mpObj); ++obj) {
|
||||
for (cCcD_Obj** obj = mpObj; obj < mpObj + ARRAY_SIZEU(mpObj); ++obj) {
|
||||
*obj = NULL;
|
||||
}
|
||||
mObjCount = 0;
|
||||
@@ -56,9 +56,9 @@ WeightType cCcS::GetWt(u8 param_0) const {
|
||||
/* 80264BA8-80264C5C 25F4E8 00B4+00 0/0 7/7 454/454 .text Set__4cCcSFP8cCcD_Obj */
|
||||
void cCcS::Set(cCcD_Obj* obj) {
|
||||
if (obj->ChkAtSet()) {
|
||||
if (mObjAtCount >= ARRAY_SIZE(mpObjAt)) {
|
||||
if (mObjAtCount >= ARRAY_SIZEU(mpObjAt)) {
|
||||
OS_REPORT("\x1b[43;30m");
|
||||
OS_REPORT("cCcS::Set AT Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObjAt));
|
||||
OS_REPORT("cCcS::Set AT Overflow.Now Max is %d.\n", ARRAY_SIZEU(mpObjAt));
|
||||
OS_REPORT("\x1b[m");
|
||||
} else {
|
||||
mpObjAt[mObjAtCount] = obj;
|
||||
@@ -67,9 +67,9 @@ void cCcS::Set(cCcD_Obj* obj) {
|
||||
}
|
||||
|
||||
if (obj->ChkTgSet()) {
|
||||
if (mObjTgCount >= ARRAY_SIZE(mpObjTg)) {
|
||||
if (mObjTgCount >= ARRAY_SIZEU(mpObjTg)) {
|
||||
OS_REPORT("\x1b[43;30m");
|
||||
OS_REPORT("cCcS::Set TG Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObjTg));
|
||||
OS_REPORT("cCcS::Set TG Overflow.Now Max is %d.\n", ARRAY_SIZEU(mpObjTg));
|
||||
OS_REPORT("\x1b[m");
|
||||
} else {
|
||||
mpObjTg[mObjTgCount] = obj;
|
||||
@@ -78,9 +78,9 @@ void cCcS::Set(cCcD_Obj* obj) {
|
||||
}
|
||||
|
||||
if (obj->ChkCoSet()) {
|
||||
if (mObjCoCount >= ARRAY_SIZE(mpObjCo)) {
|
||||
if (mObjCoCount >= ARRAY_SIZEU(mpObjCo)) {
|
||||
OS_REPORT("\x1b[43;30m");
|
||||
OS_REPORT("cCcS::Set CO Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObjCo));
|
||||
OS_REPORT("cCcS::Set CO Overflow.Now Max is %d.\n", ARRAY_SIZEU(mpObjCo));
|
||||
OS_REPORT("\x1b[m");
|
||||
} else {
|
||||
mpObjCo[mObjCoCount] = obj;
|
||||
@@ -88,9 +88,9 @@ void cCcS::Set(cCcD_Obj* obj) {
|
||||
}
|
||||
}
|
||||
|
||||
if (mObjCount >= ARRAY_SIZE(mpObj)) {
|
||||
if (mObjCount >= ARRAY_SIZEU(mpObj)) {
|
||||
OS_REPORT("\x1b[43;30m");
|
||||
OS_REPORT("cCcS::Set SET Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObj));
|
||||
OS_REPORT("cCcS::Set SET Overflow.Now Max is %d.\n", ARRAY_SIZEU(mpObj));
|
||||
OS_REPORT("\x1b[m");
|
||||
} else {
|
||||
mpObj[mObjCount] = obj;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/mem_TRK.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma dont_inline on
|
||||
/* 8036F580-8036F638 369EC0 00B8+00 0/0 1/1 0/0 .text TRK_fill_mem */
|
||||
@@ -14,7 +15,7 @@ void TRK_fill_mem(void* dst, int val, u32 n) {
|
||||
((u8*)dst) = ((u8*)dst) - 1;
|
||||
|
||||
if (n >= 32) {
|
||||
i = (~(u32)dst) & 3;
|
||||
i = (~(uintptr_t)dst) & 3;
|
||||
|
||||
if (i) {
|
||||
n -= i;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "TRK_MINNOW_DOLPHIN/ppc/Generic/targimpl.h"
|
||||
#include "TRK_MINNOW_DOLPHIN/utils/common/MWTrace.h"
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct memRange {
|
||||
u8* start;
|
||||
@@ -136,7 +137,7 @@ DSError TRKValidMemory32(const void* addr, size_t length, ValidMemoryOptions rea
|
||||
*/
|
||||
|
||||
if (start < (const u8*)gTRKMemMap[i].start)
|
||||
err = TRKValidMemory32(start, (u32)((const u8*)gTRKMemMap[i].start - start),
|
||||
err = TRKValidMemory32(start, (uintptr_t)((const u8*)gTRKMemMap[i].start - start),
|
||||
readWriteable);
|
||||
|
||||
/*
|
||||
@@ -150,7 +151,7 @@ DSError TRKValidMemory32(const void* addr, size_t length, ValidMemoryOptions rea
|
||||
if ((err == DS_NoError) && (end > (const u8*)gTRKMemMap[i].end))
|
||||
err =
|
||||
TRKValidMemory32((const u8*)gTRKMemMap[i].end,
|
||||
(u32)(end - (const u8*)gTRKMemMap[i].end), readWriteable);
|
||||
(uintptr_t)(end - (const u8*)gTRKMemMap[i].end), readWriteable);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -183,7 +184,7 @@ DSError TRKTargetAccessMemory(void* data, u32 start, size_t* length,
|
||||
TRK_ppc_memcpy(data, addr, *length, uVar5, param4);
|
||||
} else {
|
||||
TRK_ppc_memcpy(addr, data, *length, param4, uVar5);
|
||||
TRK_flush_cache((u32)addr, *length);
|
||||
TRK_flush_cache((uintptr_t)addr, *length);
|
||||
if ((void*)start != addr) {
|
||||
TRK_flush_cache(start, *length);
|
||||
}
|
||||
@@ -1169,4 +1170,4 @@ asm void WriteFPSCR(register f64*) {
|
||||
addi r1, r1, 0x40
|
||||
blr
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user