mirror of
https://github.com/zeldaret/tp
synced 2026-06-01 09:47:52 -04:00
Add more J3D_ASSERTs (#2491)
* Fix debug build * Add more J3D_ASSERTs * Move J3DShapeMtx to correct header for assert * Add VSCode task for ninja changes_all
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DTevs.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
/**
|
||||
@@ -304,7 +305,10 @@ public:
|
||||
/* 80317BB4 */ virtual s32 countDLSize();
|
||||
/* 803229D0 */ virtual void setTexNo(u32 idx, u16 const* texNo) { mTexNo[idx] = *texNo; }
|
||||
/* 803229C0 */ virtual void setTexNo(u32 idx, u16 texNo) { mTexNo[idx] = texNo; }
|
||||
/* 803229E4 */ virtual u16 getTexNo(u32 idx) const { return mTexNo[idx]; }
|
||||
/* 803229E4 */ virtual u16 getTexNo(u32 idx) const {
|
||||
J3D_ASSERT(1353, idx < 8, "Error : range over.");
|
||||
return mTexNo[idx];
|
||||
}
|
||||
/* 80322A08 */ virtual void setTevOrder(u32 idx, J3DTevOrder const* order) { mTevOrder[idx] = *order; }
|
||||
/* 803229F4 */ virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; }
|
||||
/* 80322A1C */ virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; }
|
||||
@@ -370,7 +374,10 @@ public:
|
||||
/* 80317BCC */ virtual s32 countDLSize();
|
||||
/* 8032202C */ virtual void setTexNo(u32 idx, u16 const* texNo) { mTexNo[idx] = *texNo; }
|
||||
/* 8032201C */ virtual void setTexNo(u32 idx, u16 texNo) { mTexNo[idx] = texNo; }
|
||||
/* 80322040 */ virtual u16 getTexNo(u32 idx) const { return mTexNo[idx]; }
|
||||
/* 80322040 */ virtual u16 getTexNo(u32 idx) const {
|
||||
J3D_ASSERT(2019, idx < 4, "Error : range over.");
|
||||
return mTexNo[idx];
|
||||
}
|
||||
/* 80322064 */ virtual void setTevOrder(u32 idx, J3DTevOrder const* order) { mTevOrder[idx] = *order; }
|
||||
/* 80322050 */ virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; }
|
||||
/* 80322078 */ virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; }
|
||||
@@ -446,7 +453,10 @@ public:
|
||||
/* 80317BC4 */ virtual s32 countDLSize();
|
||||
/* 803223F0 */ virtual void setTexNo(u32 idx, u16 const* texNo) { mTexNo[idx] = *texNo; }
|
||||
/* 803223E0 */ virtual void setTexNo(u32 idx, u16 texNo) { mTexNo[idx] = texNo; }
|
||||
/* 80322404 */ virtual u16 getTexNo(u32 idx) const { return mTexNo[idx]; }
|
||||
/* 80322404 */ virtual u16 getTexNo(u32 idx) const {
|
||||
J3D_ASSERT(1730, idx < 2, "Error : range over.");
|
||||
return mTexNo[idx];
|
||||
}
|
||||
/* 80322428 */ virtual void setTevOrder(u32 idx, J3DTevOrder const* order) { mTevOrder[idx] = *order; }
|
||||
/* 80322414 */ virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; }
|
||||
/* 8032243C */ virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; }
|
||||
@@ -522,7 +532,10 @@ public:
|
||||
/* 80317BD4 */ virtual s32 countDLSize();
|
||||
/* 80321C60 */ virtual void setTexNo(u32 idx, u16 const* texNo) { mTexNo[idx] = *texNo; }
|
||||
/* 80321C50 */ virtual void setTexNo(u32 idx, u16 texNo) { mTexNo[idx] = texNo; }
|
||||
/* 80321C74 */ virtual u16 getTexNo(u32 idx) const { return mTexNo[idx]; }
|
||||
/* 80321C74 */ virtual u16 getTexNo(u32 idx) const {
|
||||
J3D_ASSERT(2308, idx < 8, "Error : range over.");
|
||||
return mTexNo[idx];
|
||||
}
|
||||
/* 80321C98 */ virtual void setTevOrder(u32 idx, J3DTevOrder const* order) { mTevOrder[idx] = *order; }
|
||||
/* 80321C84 */ virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; }
|
||||
/* 80321CAC */ virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; }
|
||||
@@ -598,7 +611,10 @@ public:
|
||||
/* 80317BBC */ virtual s32 countDLSize();
|
||||
/* 803227B4 */ virtual void setTexNo(u32 idx, u16 const* no) { mTexNo[idx] = *no; }
|
||||
/* 803227A4 */ virtual void setTexNo(u32 idx, u16 no) { mTexNo[idx] = no; }
|
||||
/* 803227C8 */ virtual u16 getTexNo(u32 idx) const { return mTexNo[idx]; }
|
||||
/* 803227C8 */ virtual u16 getTexNo(u32 idx) const {
|
||||
J3D_ASSERT(1574, idx < 1, "Error : range over.");
|
||||
return mTexNo[idx];
|
||||
}
|
||||
/* 803227EC */ virtual void setTevOrder(u32 idx, J3DTevOrder const* order) { mTevOrder[idx] = *order; }
|
||||
/* 803227D8 */ virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; }
|
||||
/* 80322800 */ virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; }
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
#define J3DSHAPE_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/gx.h"
|
||||
#include "mtx.h"
|
||||
|
||||
class J3DShapeMtx;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
@@ -48,11 +51,11 @@ public:
|
||||
u32 getMtxIdxRegB() const { return mMtxIdxRegB; }
|
||||
|
||||
inline void load() const {
|
||||
J3DFifoWriteCPCmd(0x30, getMtxIdxRegA()); // CP_MATINDEX_A
|
||||
J3DFifoWriteCPCmd(0x40, getMtxIdxRegB()); // CP_MATINDEX_B
|
||||
J3DFifoWriteCPCmd(0x30, mMtxIdxRegA); // CP_MATINDEX_A
|
||||
J3DFifoWriteCPCmd(0x40, mMtxIdxRegB); // CP_MATINDEX_B
|
||||
J3DFifoWriteXFCmd(0x1018, 2);
|
||||
GXWGFifo.u32 = getMtxIdxRegA();
|
||||
GXWGFifo.u32 = getMtxIdxRegB();
|
||||
GXCmd1u32(mMtxIdxRegA);
|
||||
GXCmd1u32(mMtxIdxRegB);
|
||||
}
|
||||
|
||||
void setCurrentTexMtx(u8 param_1, u8 param_2, u8 param_3, u8 param_4,
|
||||
@@ -111,7 +114,7 @@ public:
|
||||
bool checkFlag(u32 flag) const { return !!(mFlags & flag); }
|
||||
void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) { mDrawMtxData = pMtxData; }
|
||||
void setVertexDataPointer(J3DVertexData* pVtxData) { mVertexData = pVtxData; }
|
||||
void* getVcdVatCmd() const { return mVcdVatCmd; }
|
||||
void* getVcdVatCmd() { return mVcdVatCmd; }
|
||||
void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; }
|
||||
void show() { offFlag(J3DShpFlag_Visible); }
|
||||
void hide() { onFlag(J3DShpFlag_Visible); }
|
||||
@@ -124,15 +127,14 @@ public:
|
||||
bool getNBTFlag() const { return mHasNBT; }
|
||||
u32 getBumpMtxOffset() const { return mBumpMtxOffset; }
|
||||
void setBumpMtxOffset(u32 offset) { mBumpMtxOffset = offset; }
|
||||
GXVtxDescList* getVtxDesc() const { return mVtxDesc; }
|
||||
GXVtxDescList* getVtxDesc() { return mVtxDesc; }
|
||||
|
||||
J3DMaterial* getMaterial() const { return mMaterial; }
|
||||
u16 getIndex() const { return mIndex; }
|
||||
u32 getPipeline() const { return (mFlags >> 2) & 0x07; }
|
||||
u32 getTexMtxLoadType() const { return mFlags & 0xF000; }
|
||||
u32 getMtxGroupNum() const { return mMtxGroupNum; }
|
||||
J3DShapeDraw* getShapeDraw(u32 idx) const { return mShapeDraw[idx]; }
|
||||
J3DShapeMtx* getShapeMtx(u32 idx) const { return mShapeMtx[idx]; }
|
||||
J3DShapeDraw* getShapeDraw(u16 idx) { return mShapeDraw[idx]; }
|
||||
J3DShapeMtx* getShapeMtx(u16 idx) { return mShapeMtx[idx]; }
|
||||
Vec* getMin() { return &mMin; }
|
||||
Vec* getMax() { return &mMax; }
|
||||
|
||||
@@ -167,4 +169,48 @@ private:
|
||||
/* 0x64 */ u32 mBumpMtxOffset;
|
||||
};
|
||||
|
||||
typedef void (J3DShapeMtx::*J3DShapeMtx_LoadFunc)(int, u16) const;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DShapeMtx {
|
||||
public:
|
||||
J3DShapeMtx(u16 useMtxIndex)
|
||||
: mUseMtxIndex(useMtxIndex)
|
||||
{}
|
||||
|
||||
/* 803130E4 */ void loadMtxIndx_PNGP(int, u16) const;
|
||||
/* 80313128 */ void loadMtxIndx_PCPU(int, u16) const;
|
||||
/* 80313188 */ void loadMtxIndx_NCPU(int, u16) const;
|
||||
/* 803131D4 */ void loadMtxIndx_PNCPU(int, u16) const;
|
||||
|
||||
/* 80314798 */ virtual ~J3DShapeMtx() {}
|
||||
/* 803147E0 */ virtual u32 getType() const { return 'SMTX'; }
|
||||
/* 80273E08 */ virtual u32 getUseMtxNum() const { return 1; }
|
||||
/* 8031459C */ virtual u32 getUseMtxIndex(u16) const { return mUseMtxIndex; }
|
||||
/* 80313B94 */ virtual void load() const;
|
||||
/* 80313BF0 */ virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
|
||||
|
||||
static J3DShapeMtx_LoadFunc sMtxLoadPipeline[4];
|
||||
static u16 sMtxLoadCache[10];
|
||||
static u32 sCurrentPipeline;
|
||||
static u8* sCurrentScaleFlag;
|
||||
static u8 sNBTFlag;
|
||||
static u8 sLODFlag;
|
||||
static u32 sTexMtxLoadType;
|
||||
|
||||
static void setCurrentPipeline(u32 pipeline) {
|
||||
J3D_ASSERT(91, pipeline < 4, "Error : range over.");
|
||||
sCurrentPipeline = pipeline;
|
||||
}
|
||||
static void setLODFlag(u8 flag) { sLODFlag = flag; }
|
||||
static u32 getLODFlag() { return sLODFlag; }
|
||||
static void resetMtxLoadCache();
|
||||
|
||||
protected:
|
||||
/* 0x04 */ u16 mUseMtxIndex;
|
||||
};
|
||||
|
||||
#endif /* J3DSHAPE_H */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef J3DSHAPEMTX_H
|
||||
#define J3DSHAPEMTX_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DShape.h"
|
||||
#include "dolphin/mtx.h"
|
||||
|
||||
class J3DTexMtx;
|
||||
@@ -39,48 +40,6 @@ public:
|
||||
static J3DTexMtxObj* sTexMtxObj;
|
||||
};
|
||||
|
||||
class J3DShapeMtx;
|
||||
typedef void (J3DShapeMtx::*J3DShapeMtx_LoadFunc)(int, u16) const;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DShapeMtx {
|
||||
public:
|
||||
J3DShapeMtx(u16 useMtxIndex)
|
||||
: mUseMtxIndex(useMtxIndex)
|
||||
{}
|
||||
|
||||
/* 803130E4 */ void loadMtxIndx_PNGP(int, u16) const;
|
||||
/* 80313128 */ void loadMtxIndx_PCPU(int, u16) const;
|
||||
/* 80313188 */ void loadMtxIndx_NCPU(int, u16) const;
|
||||
/* 803131D4 */ void loadMtxIndx_PNCPU(int, u16) const;
|
||||
|
||||
/* 80314798 */ virtual ~J3DShapeMtx() {}
|
||||
/* 803147E0 */ virtual u32 getType() const { return 'SMTX'; }
|
||||
/* 80273E08 */ virtual u32 getUseMtxNum() const { return 1; }
|
||||
/* 8031459C */ virtual u32 getUseMtxIndex(u16) const { return mUseMtxIndex; }
|
||||
/* 80313B94 */ virtual void load() const;
|
||||
/* 80313BF0 */ virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
|
||||
|
||||
static J3DShapeMtx_LoadFunc sMtxLoadPipeline[4];
|
||||
static u16 sMtxLoadCache[10];
|
||||
static u32 sCurrentPipeline;
|
||||
static u8* sCurrentScaleFlag;
|
||||
static u8 sNBTFlag;
|
||||
static u8 sLODFlag;
|
||||
static u32 sTexMtxLoadType;
|
||||
|
||||
static void setCurrentPipeline(u32 pipeline) { sCurrentPipeline = pipeline; }
|
||||
static void setLODFlag(u8 flag) { sLODFlag = flag; }
|
||||
static u8 getLODFlag() { return sLODFlag; }
|
||||
static void resetMtxLoadCache();
|
||||
|
||||
protected:
|
||||
/* 0x04 */ u16 mUseMtxIndex;
|
||||
};
|
||||
|
||||
class J3DShapeMtxConcatView;
|
||||
typedef void (J3DShapeMtxConcatView::*J3DShapeMtxConcatView_LoadFunc)(int, u16) const;
|
||||
|
||||
|
||||
@@ -93,16 +93,19 @@ struct J3DSys {
|
||||
|
||||
void setDrawModeXlu() { mDrawMode = XLU; }
|
||||
|
||||
void* getVtxPos() const { return mVtxPos; }
|
||||
void* getVtxPos() { return mVtxPos; }
|
||||
void setVtxPos(void* pVtxPos) { mVtxPos = pVtxPos; }
|
||||
|
||||
void* getVtxNrm() const { return mVtxNrm; }
|
||||
void* getVtxNrm() { return mVtxNrm; }
|
||||
void setVtxNrm(void* pVtxNrm) { mVtxNrm = pVtxNrm; }
|
||||
|
||||
void* getVtxCol() const { return mVtxCol; }
|
||||
void setVtxCol(_GXColor* pVtxCol) { mVtxCol = pVtxCol; }
|
||||
|
||||
void setModel(J3DModel* pModel) { mModel = pModel; }
|
||||
void setModel(J3DModel* pModel) {
|
||||
J3D_ASSERT(200, pModel, "Error : null pointer.");
|
||||
mModel = pModel;
|
||||
}
|
||||
void setShapePacket(J3DShapePacket* pPacket) { mShapePacket = pPacket; }
|
||||
void setMatPacket(J3DMatPacket* pPacket) { mMatPacket = pPacket; }
|
||||
J3DMatPacket* getMatPacket() { return mMatPacket; }
|
||||
@@ -129,6 +132,7 @@ struct J3DSys {
|
||||
}
|
||||
|
||||
void setModelNrmMtx(Mtx33* pMtxArr) {
|
||||
JUT_ASSERT_MSG(241, pMtxArr, "Error : null pointer.");
|
||||
mModelNrmMtx = pMtxArr;
|
||||
GXSetArray(GX_NRM_MTX_ARRAY, mModelNrmMtx, sizeof(*mModelNrmMtx));
|
||||
}
|
||||
@@ -148,8 +152,8 @@ struct J3DSys {
|
||||
return mDrawBuffer[type];
|
||||
}
|
||||
|
||||
Mtx& getModelDrawMtx(u16 no) const { return mModelDrawMtx[no]; }
|
||||
J3DShapePacket* getShapePacket() const { return mShapePacket; }
|
||||
Mtx& getModelDrawMtx(u16 no) { return mModelDrawMtx[no]; }
|
||||
J3DShapePacket* getShapePacket() { return mShapePacket; }
|
||||
|
||||
void setViewMtx(Mtx m) { MTXCopy(m, mViewMtx); }
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define J3DTEXTURE_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DStruct.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTTexture.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
@@ -23,7 +24,10 @@ public:
|
||||
/* 803366A4 */ virtual ~J3DTexture() {}
|
||||
|
||||
u16 getNum() const { return mNum; }
|
||||
ResTIMG* getResTIMG(u16 entry) const { return &mpRes[entry]; }
|
||||
ResTIMG* getResTIMG(u16 entry) const {
|
||||
J3D_ASSERT(72, entry < mNum, "Error : range over.");
|
||||
return &mpRes[entry];
|
||||
}
|
||||
void setResTIMG(u16 entry, const ResTIMG& timg) {
|
||||
mpRes[entry] = timg;
|
||||
mpRes[entry].imageOffset = ((mpRes[entry].imageOffset + (u32)&timg - (u32)(mpRes + entry)));
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
void* getVtxNBTArray() const { return mVtxNBTArray; }
|
||||
u32 getNrmNum() const { return mNrmNum; }
|
||||
u32 getVtxNum() const { return mVtxNum; }
|
||||
GXVtxAttrFmtList* getVtxAttrFmtList() { return mVtxAttrFmtList; }
|
||||
GXVtxAttrFmtList* getVtxAttrFmtList() const { return mVtxAttrFmtList; }
|
||||
u8 getVtxPosFrac() { return mVtxPosFrac; }
|
||||
u8 getVtxNrmFrac() { return mVtxNrmFrac; }
|
||||
int getVtxPosType() { return mVtxPosType; }
|
||||
|
||||
Reference in New Issue
Block a user