mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-18 04:48:21 -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 */
|
||||
|
||||
Reference in New Issue
Block a user