mirror of
https://github.com/zeldaret/tp
synced 2026-07-09 06:53:23 -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:
@@ -1120,6 +1120,7 @@ void J3DAnmTexPattern::getTexNo(u16 i_index, u16* o_texNo) const {
|
||||
/* 8032B004-8032B09C 325944 0098+00 1/1 1/1 0/0 .text
|
||||
* searchUpdateMaterialID__16J3DAnmTexPatternFP16J3DMaterialTable */
|
||||
void J3DAnmTexPattern::searchUpdateMaterialID(J3DMaterialTable* i_materialTable) {
|
||||
J3D_ASSERT(1790, i_materialTable, "Error : null pointer.");
|
||||
for (u16 i = 0; i < mUpdateMaterialNum; i++) {
|
||||
s32 index = i_materialTable->getMaterialName()->getIndex(mUpdateMaterialName.getName(i));
|
||||
if (index != -1) {
|
||||
@@ -1133,13 +1134,15 @@ void J3DAnmTexPattern::searchUpdateMaterialID(J3DMaterialTable* i_materialTable)
|
||||
/* 8032B09C-8032B0C0 3259DC 0024+00 0/0 4/4 1/1 .text
|
||||
* searchUpdateMaterialID__16J3DAnmTexPatternFP12J3DModelData */
|
||||
void J3DAnmTexPattern::searchUpdateMaterialID(J3DModelData* i_modelData) {
|
||||
J3D_ASSERT(1813, i_modelData, "Error : null pointer.");
|
||||
searchUpdateMaterialID(&i_modelData->getMaterialTable());
|
||||
}
|
||||
|
||||
/* 8032B0C0-8032B1D4 325A00 0114+00 1/1 1/1 0/0 .text
|
||||
* searchUpdateMaterialID__19J3DAnmTextureSRTKeyFP16J3DMaterialTable */
|
||||
void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DMaterialTable* i_materialTable) {
|
||||
for (u16 i = 0; i < u16(mTrackNum / 3); i++) {
|
||||
J3D_ASSERT(1832, i_materialTable, "Error : null pointer.");
|
||||
for (u16 i = 0; i < getUpdateMaterialNum(); i++) {
|
||||
s32 index = i_materialTable->getMaterialName()->getIndex(mUpdateMaterialName.getName(i));
|
||||
if (index != -1) {
|
||||
mUpdateMaterialID[i] = index;
|
||||
@@ -1147,7 +1150,7 @@ void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DMaterialTable* i_materialTab
|
||||
mUpdateMaterialID[i] = -1;
|
||||
}
|
||||
}
|
||||
for (u16 i = 0; i < u16(field_0x4a / 3); i++) {
|
||||
for (u16 i = 0; i < getPostUpdateMaterialNum(); i++) {
|
||||
s32 index = i_materialTable->getMaterialName()->getIndex(mPostUpdateMaterialName.getName(i));
|
||||
if (index != -1) {
|
||||
mPostUpdateMaterialID[i] = index;
|
||||
@@ -1160,6 +1163,7 @@ void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DMaterialTable* i_materialTab
|
||||
/* 8032B1D4-8032B1F8 325B14 0024+00 0/0 8/8 6/6 .text
|
||||
* searchUpdateMaterialID__19J3DAnmTextureSRTKeyFP12J3DModelData */
|
||||
void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DModelData* i_modelData) {
|
||||
J3D_ASSERT(1871, i_modelData, "Error : null pointer.");
|
||||
searchUpdateMaterialID(&i_modelData->getMaterialTable());
|
||||
}
|
||||
|
||||
@@ -1324,6 +1328,7 @@ void J3DAnmTevRegKey::getTevKonstReg(u16 i_index, GXColor* o_color) const {
|
||||
/* 8032B780-8032B87C 3260C0 00FC+00 1/1 1/1 0/0 .text
|
||||
* searchUpdateMaterialID__15J3DAnmTevRegKeyFP16J3DMaterialTable */
|
||||
void J3DAnmTevRegKey::searchUpdateMaterialID(J3DMaterialTable* i_materialTable) {
|
||||
J3D_ASSERT(2083, i_materialTable, "Error : null pointer.");
|
||||
for (u16 i = 0; i < mCRegUpdateMaterialNum; i++) {
|
||||
s32 index = i_materialTable->getMaterialName()->getIndex(mCRegUpdateMaterialName.getName(i));
|
||||
if (index != -1) {
|
||||
@@ -1345,5 +1350,6 @@ void J3DAnmTevRegKey::searchUpdateMaterialID(J3DMaterialTable* i_materialTable)
|
||||
/* 8032B87C-8032B8A0 3261BC 0024+00 0/0 9/9 4/4 .text
|
||||
* searchUpdateMaterialID__15J3DAnmTevRegKeyFP12J3DModelData */
|
||||
void J3DAnmTevRegKey::searchUpdateMaterialID(J3DModelData* i_modelData) {
|
||||
J3D_ASSERT(2119, i_modelData, "Error : null pointer.");
|
||||
searchUpdateMaterialID(&i_modelData->getMaterialTable());
|
||||
}
|
||||
|
||||
@@ -37,7 +37,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(110, model, "Error : null pointer");
|
||||
|
||||
deform(model->getVertexBuffer());
|
||||
}
|
||||
@@ -45,7 +45,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(141, buffer, "Error : null pointer");
|
||||
|
||||
buffer->swapVtxPosArrayPointer();
|
||||
buffer->swapVtxNrmArrayPointer();
|
||||
@@ -83,7 +83,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(222, buffer, "Error : null pointer");
|
||||
|
||||
u16 var_r31 = 0;
|
||||
if (mAnmCluster != NULL) {
|
||||
|
||||
@@ -215,26 +215,23 @@ int J3DMaterialTable::entryTexNoAnimator(J3DAnmTexPattern* param_1) {
|
||||
|
||||
/* 8032FCC4-8032FE70 32A604 01AC+00 0/0 14/14 6/6 .text
|
||||
* entryTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
|
||||
// NONMATCHING regalloc
|
||||
int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* param_1) {
|
||||
JUT_ASSERT_MSG(532, param_1 != NULL, "Error : null pointer.")
|
||||
int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* btk) {
|
||||
JUT_ASSERT_MSG(532, btk != NULL, "Error : null pointer.")
|
||||
int rv = 0;
|
||||
u16 materialNum = param_1->getUpdateMaterialNum();
|
||||
rv = createTexMtxForAnimator(param_1);
|
||||
u16 materialNum = btk->getUpdateMaterialNum();
|
||||
rv = createTexMtxForAnimator(btk);
|
||||
if (rv != 0) {
|
||||
return rv;
|
||||
}
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (param_1->isValidUpdateMaterialID(i)) {
|
||||
u16 updateMaterialId = param_1->getUpdateMaterialID(i);
|
||||
// Maybe helps? Makes material r26 instead of r30
|
||||
//J3DMaterial* material = (J3DMaterial*)getMaterialNodePointer((u16)updateMaterialId);
|
||||
for (u16 no = 0; no < materialNum; no++) {
|
||||
if (btk->isValidUpdateMaterialID(no)) {
|
||||
u16 updateMaterialId = btk->getUpdateMaterialID(no);
|
||||
J3DMaterial* material = getMaterialNodePointer((u16)updateMaterialId);
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
u8 texMtxID = param_1->getUpdateTexMtxID(i);
|
||||
u8 texMtxID = btk->getUpdateTexMtxID(no);
|
||||
if (materialAnm == 0) {
|
||||
rv = 1;
|
||||
} else {
|
||||
@@ -242,15 +239,12 @@ int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* param_1) {
|
||||
if (material->getTexCoord(texMtxID) != NULL) {
|
||||
material->getTexCoord(texMtxID)->setTexGenMtx((u8)texMtxID * 3 + 30);
|
||||
}
|
||||
J3DTexMtxInfo& iVar3 = material->getTexMtx(texMtxID)->getTexMtxInfo();
|
||||
iVar3.mInfo = (iVar3.mInfo & 0x3f) | (param_1->getTexMtxCalcType() << 7);
|
||||
Vec* vec = param_1->getSRTCenter(i);
|
||||
iVar3.mCenter.x = vec->x;
|
||||
vec = param_1->getSRTCenter(i);
|
||||
iVar3.mCenter.y = vec->y;
|
||||
vec = param_1->getSRTCenter(i);
|
||||
iVar3.mCenter.z = vec->z;
|
||||
J3DTexMtxAnm texMtxAnm(i, param_1);
|
||||
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);
|
||||
materialAnm->setTexMtxAnm(texMtxID, &texMtxAnm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
/* 80327100-80327184 321A40 0084+00 0/0 3/3 0/0 .text initialize__8J3DModelFv */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <dolphin/os.h>
|
||||
#include <dolphin/os.h>
|
||||
|
||||
@@ -47,7 +47,7 @@ void J3DShape::addTexMtxIndexInDL(GXAttr attr, u32 valueBase) {
|
||||
s32 stride = 0;
|
||||
bool found = false;
|
||||
|
||||
for (GXVtxDescList* vtxDesc = mVtxDesc; vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
|
||||
for (GXVtxDescList* vtxDesc = getVtxDesc(); vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
|
||||
if (vtxDesc->attr == GX_VA_PNMTXIDX)
|
||||
pnmtxidxOffs = stride;
|
||||
|
||||
@@ -105,15 +105,15 @@ 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]) {
|
||||
for (u16 i = 0; i < getMtxGroupNum(); i++)
|
||||
getShapeMtx(i)->calcNBTScale(param_0, param_1, param_2);
|
||||
for (u16 i = 0; i < mMtxGroupNum; i++)
|
||||
mShapeMtx[i]->calcNBTScale(param_0, param_1, param_2);
|
||||
}
|
||||
|
||||
/* 80314E28-80314E98 30F768 0070+00 0/0 1/1 0/0 .text countBumpMtxNum__8J3DShapeCFv */
|
||||
u32 J3DShape::countBumpMtxNum() const {
|
||||
u32 num = 0;
|
||||
for (u16 i = 0; i < getMtxGroupNum(); i++)
|
||||
num += getShapeMtx(i)->getUseMtxNum();
|
||||
for (u16 i = 0; i < mMtxGroupNum; i++)
|
||||
num += mShapeMtx[i]->getUseMtxNum();
|
||||
return num;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ void J3DShape::loadVtxArray() const {
|
||||
|
||||
/* 80314F5C-80314F98 30F89C 003C+00 0/0 1/1 0/0 .text isSameVcdVatCmd__8J3DShapeFP8J3DShape */
|
||||
bool J3DShape::isSameVcdVatCmd(J3DShape* other) {
|
||||
u8* a = other->mVcdVatCmd;
|
||||
u8* a = (u8*)other->getVcdVatCmd();
|
||||
u8* b = mVcdVatCmd;
|
||||
for (u32 i = 0; i < kVcdVatDLSize; i++)
|
||||
if (a[i] != b[i])
|
||||
@@ -274,7 +274,7 @@ static u8 data_804515D4[4];
|
||||
|
||||
/* 80315398-8031544C 30FCD8 00B4+00 1/1 0/0 0/0 .text setArrayAndBindPipeline__8J3DShapeCFv */
|
||||
void J3DShape::setArrayAndBindPipeline() const {
|
||||
J3DShapeMtx::setCurrentPipeline(getPipeline());
|
||||
J3DShapeMtx::setCurrentPipeline((mFlags & 0x1C) >> 2);
|
||||
loadVtxArray();
|
||||
j3dSys.setModelDrawMtx(mDrawMtx[*mCurrentViewNo]);
|
||||
j3dSys.setModelNrmMtx(mNrmMtx[*mCurrentViewNo]);
|
||||
@@ -302,24 +302,24 @@ void J3DShape::drawFast() const {
|
||||
if (J3DShapeMtx::getLODFlag() != 0)
|
||||
J3DShapeMtx::resetMtxLoadCache();
|
||||
|
||||
for (u16 n = getMtxGroupNum(), i = 0; i < n; i++) {
|
||||
if (getShapeMtx(i) != NULL)
|
||||
getShapeMtx(i)->load();
|
||||
if (getShapeDraw(i) != NULL)
|
||||
getShapeDraw(i)->draw();
|
||||
for (u16 n = mMtxGroupNum, i = 0; i < n; i++) {
|
||||
if (mShapeMtx[i] != NULL)
|
||||
mShapeMtx[i]->load();
|
||||
if (mShapeDraw[i] != NULL)
|
||||
mShapeDraw[i]->draw();
|
||||
}
|
||||
} else {
|
||||
J3DFifoLoadPosMtxImm(*j3dSys.getShapePacket()->getBaseMtxPtr(), GX_PNMTX0);
|
||||
J3DFifoLoadNrmMtxImm(*j3dSys.getShapePacket()->getBaseMtxPtr(), GX_PNMTX0);
|
||||
for (u16 n = getMtxGroupNum(), i = 0; i < n; i++)
|
||||
if (getShapeDraw(i) != NULL)
|
||||
getShapeDraw(i)->draw();
|
||||
for (u16 n = mMtxGroupNum, i = 0; i < n; i++)
|
||||
if (mShapeDraw[i] != NULL)
|
||||
mShapeDraw[i]->draw();
|
||||
}
|
||||
}
|
||||
|
||||
/* 803155E0-80315628 30FF20 0048+00 1/0 0/0 0/0 .text draw__8J3DShapeCFv */
|
||||
void J3DShape::draw() const {
|
||||
sOldVcdVatCmd = NULL;
|
||||
resetVcdVatCache();
|
||||
loadPreDrawSetting();
|
||||
drawFast();
|
||||
}
|
||||
@@ -328,11 +328,11 @@ void J3DShape::draw() const {
|
||||
void J3DShape::simpleDraw() const {
|
||||
resetVcdVatCache();
|
||||
loadPreDrawSetting();
|
||||
J3DShapeMtx::setCurrentPipeline(getPipeline());
|
||||
J3DShapeMtx::setCurrentPipeline((mFlags & 0x1C) >> 2);
|
||||
loadVtxArray();
|
||||
for (u16 n = getMtxGroupNum(), i = 0; i < n; i++) {
|
||||
if (getShapeDraw(i) != NULL) {
|
||||
getShapeDraw(i)->draw();
|
||||
for (u16 n = mMtxGroupNum, i = 0; i < n; i++) {
|
||||
if (mShapeDraw[i] != NULL) {
|
||||
mShapeDraw[i]->draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,7 +348,7 @@ void J3DShape::simpleDrawCache() const {
|
||||
mCurrentMtx.load();
|
||||
|
||||
loadVtxArray();
|
||||
for (u16 n = getMtxGroupNum(), i = 0; i < n; i++)
|
||||
if (getShapeDraw(i) != NULL)
|
||||
getShapeDraw(i)->draw();
|
||||
for (u16 n = mMtxGroupNum, i = 0; i < n; i++)
|
||||
if (mShapeDraw[i] != NULL)
|
||||
mShapeDraw[i]->draw();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "JSystem/J3DGraphLoader/J3DShapeFactory.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShape.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
Reference in New Issue
Block a user