Revert "Isolate JKRHeap operator overloads" (#39)

This commit is contained in:
TakaRikka
2026-03-06 19:49:35 -08:00
committed by GitHub
parent b7c482fb87
commit 78d4169929
630 changed files with 3349 additions and 3452 deletions
@@ -9,8 +9,6 @@
#include "JSystem/JSupport/JSupport.h"
#include <os.h>
#include "JSystem/JKernel/JKRHeap.h"
J3DAnmBase* J3DAnmLoaderDataBase::load(const void* i_data, J3DAnmLoaderDataBaseFlag flag) {
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
J3D_ASSERT_NULLPTR(48, i_data);
@@ -21,68 +19,68 @@ J3DAnmBase* J3DAnmLoaderDataBase::load(const void* i_data, J3DAnmLoaderDataBaseF
switch (header->mType) {
case 'bck1': {
J3DAnmKeyLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmTransformKey();
loader.mAnm = new J3DAnmTransformKey();
return loader.load(i_data);
}
case 'bpk1': {
J3DAnmKeyLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmColorKey();
loader.mAnm = new J3DAnmColorKey();
return loader.load(i_data);
}
case 'blk1': {
J3DAnmKeyLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmClusterKey();
loader.mAnm = new J3DAnmClusterKey();
return loader.load(i_data);
}
case 'btk1': {
J3DAnmKeyLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmTextureSRTKey();
loader.mAnm = new J3DAnmTextureSRTKey();
return loader.load(i_data);
}
case 'brk1': {
J3DAnmKeyLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmTevRegKey();
loader.mAnm = new J3DAnmTevRegKey();
return loader.load(i_data);
}
case 'bxk1': {
J3DAnmKeyLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmVtxColorKey();
loader.mAnm = new J3DAnmVtxColorKey();
return loader.load(i_data);
}
case 'bca1': {
J3DAnmFullLoader_v15 loader;
if (flag & J3DLOADER_UNK_FLAG1) {
loader.mAnm = JKR_NEW J3DAnmTransformFullWithLerp();
loader.mAnm = new J3DAnmTransformFullWithLerp();
} else {
loader.mAnm = JKR_NEW J3DAnmTransformFull();
loader.mAnm = new J3DAnmTransformFull();
}
return loader.load(i_data);
}
case 'bpa1': {
J3DAnmFullLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmColorFull();
loader.mAnm = new J3DAnmColorFull();
return loader.load(i_data);
}
case 'btp1': {
J3DAnmFullLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmTexPattern();
loader.mAnm = new J3DAnmTexPattern();
return loader.load(i_data);
}
case 'bva1': {
J3DAnmFullLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmVisibilityFull();
loader.mAnm = new J3DAnmVisibilityFull();
return loader.load(i_data);
}
case 'bla1': {
J3DAnmFullLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmClusterFull();
loader.mAnm = new J3DAnmClusterFull();
return loader.load(i_data);
}
case 'bxa1': {
J3DAnmFullLoader_v15 loader;
loader.mAnm = JKR_NEW J3DAnmVtxColorFull();
loader.mAnm = new J3DAnmVtxColorFull();
return loader.load(i_data);
}
default:
@@ -29,7 +29,7 @@ J3DClusterLoader_v15::~J3DClusterLoader_v15() {}
void* J3DClusterLoader_v15::load(const void* i_data) {
J3D_ASSERT_NULLPTR(98, i_data);
mpDeformData = JKR_NEW J3DDeformData();
mpDeformData = new J3DDeformData();
const JUTDataFileHeader* fileHeader = (JUTDataFileHeader*)i_data;
const JUTDataBlockHeader* block = &fileHeader->mFirstBlock;
@@ -58,13 +58,13 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) {
if (block->mClusterName != NULL) {
mpDeformData->mClusterName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(block, block->mClusterName));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(block, block->mClusterName));
} else {
mpDeformData->mClusterName = NULL;
}
if (block->mClusterKeyName != NULL) {
mpDeformData->mClusterKeyName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(block, block->mClusterKeyName));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(block, block->mClusterKeyName));
} else {
mpDeformData->mClusterKeyName = NULL;
}
@@ -76,14 +76,14 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) {
int clusterKeyPointerSize = (intptr_t)block->mClusterKeyPointer - (intptr_t)block->mClusterPointer;
int clusterVertexPointerSize = (intptr_t)block->mClusterVertex - (intptr_t)block->mClusterPointer;
int vtxPosSize = (intptr_t)block->mVtxPos - (intptr_t)block->mClusterPointer;
u8* arr = JKR_NEW_ARGS (0x20) u8[vtxPosSize];
u8* arr = new (0x20) u8[vtxPosSize];
memcpy(arr, JSUConvertOffsetToPtr<J3DCluster>(block, block->mClusterPointer), vtxPosSize);
mpDeformData->mClusterPointer = (J3DCluster*)arr;
mpDeformData->mClusterKeyPointer = (J3DClusterKey*)&arr[clusterKeyPointerSize];
mpDeformData->mClusterVertex = (J3DClusterVertex*)&arr[clusterVertexPointerSize];
#if TARGET_PC
mpDeformData->mDeformers = JKR_NEW J3DDeformer*[mpDeformData->getClusterNum()];
mpDeformData->mDeformers = new J3DDeformer*[mpDeformData->getClusterNum()];
#endif
for (int i = 0; i < mpDeformData->getClusterNum(); i++) {
@@ -94,14 +94,14 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) {
cluster->mClusterVertex =
JSUConvertOffsetToPtr<J3DClusterVertex>(arr - (intptr_t)clusterPointer, cluster->mClusterVertex);
#endif
J3DDeformer* deformer = JKR_NEW J3DDeformer(mpDeformData);
J3DDeformer* deformer = new J3DDeformer(mpDeformData);
if (cluster->field_0x14 != 0) {
deformer->field_0xc = JKR_NEW f32[cluster->field_0x14 * 3];
deformer->field_0xc = new f32[cluster->field_0x14 * 3];
} else {
deformer->field_0xc = NULL;
}
deformer->mFlags = cluster->mFlags;
deformer->field_0x8 = JKR_NEW f32[cluster->mKeyNum];
deformer->field_0x8 = new f32[cluster->mKeyNum];
#if TARGET_PC
deformer->mArrayBase = arr - clusterPointer;
deformer->mBlockBase = block;
@@ -1,9 +1,8 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
#include "JSystem/J3DGraphLoader/J3DJointFactory.h"
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
#include "JSystem/JSupport/JSupport.h"
J3DJointFactory::J3DJointFactory(J3DJointBlock const& block) {
@@ -28,7 +27,7 @@ J3DJointFactory::J3DJointFactory(J3DJointBlock const& block) {
}
J3DJoint* J3DJointFactory::create(int no) {
J3DJoint* joint = JKR_NEW J3DJoint();
J3DJoint* joint = new J3DJoint();
J3D_ASSERT_ALLOCMEM(50, joint);
joint->mJntNo = no;
joint->mKind = getKind(no);
@@ -5,7 +5,6 @@
#include <algorithm>
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JMath/JMath.h"
#include "JSystem/JSupport/JSupport.h"
#include "JSystem/JUtility/JUTAssert.h"
@@ -136,7 +135,7 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
u32 pe_flag = getMdlDataFlag_PEFlag(i_flags);
BOOL ind_flag = (i_flags & 0x1000000) ? TRUE : FALSE;
if (i_material == NULL) {
i_material = JKR_NEW J3DMaterial();
i_material = new J3DMaterial();
J3D_ASSERT_ALLOCMEM(269, i_material);
}
i_material->mColorBlock = J3DMaterial::createColorBlock(color_flag);
@@ -236,14 +235,14 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
J3DMaterial* J3DMaterialFactory::createPatchedMaterial(J3DMaterial* i_material, int i_idx,
u32 i_flags) const {
if (i_material == NULL) {
i_material = JKR_NEW J3DPatchedMaterial();
i_material = new J3DPatchedMaterial();
J3D_ASSERT_ALLOCMEM(430, i_material);
}
bool bVar1 = i_flags & 0x3000000 ? true : false;
i_material->mColorBlock = J3DMaterial::createColorBlock(0x40000000);
i_material->mTexGenBlock = JKR_NEW J3DTexGenBlockPatched();
i_material->mTexGenBlock = new J3DTexGenBlockPatched();
J3D_ASSERT_ALLOCMEM(440, i_material->mTexGenBlock);
i_material->mTevBlock = JKR_NEW J3DTevBlockPatched();
i_material->mTevBlock = new J3DTevBlockPatched();
J3D_ASSERT_ALLOCMEM(442, i_material->mTevBlock);
i_material->mIndBlock = J3DMaterial::createIndBlock(bVar1);
i_material->mPEBlock = J3DMaterial::createPEBlock(0x10000000, getMaterialMode(i_idx));
@@ -347,17 +346,17 @@ void J3DMaterialFactory::modifyPatchedCurrentMtx(J3DMaterial* i_material, int i_
J3DMaterial* J3DMaterialFactory::createLockedMaterial(J3DMaterial* i_material, int i_idx,
u32 i_flags) const {
if (i_material == NULL) {
i_material = JKR_NEW J3DLockedMaterial();
i_material = new J3DLockedMaterial();
J3D_ASSERT_ALLOCMEM(629, i_material);
i_material->mColorBlock = JKR_NEW J3DColorBlockNull();
i_material->mColorBlock = new J3DColorBlockNull();
J3D_ASSERT_ALLOCMEM(634, i_material->mColorBlock);
i_material->mTexGenBlock = JKR_NEW J3DTexGenBlockNull();
i_material->mTexGenBlock = new J3DTexGenBlockNull();
J3D_ASSERT_ALLOCMEM(636, i_material->mTexGenBlock);
i_material->mTevBlock = JKR_NEW J3DTevBlockNull();
i_material->mTevBlock = new J3DTevBlockNull();
J3D_ASSERT_ALLOCMEM(638, i_material->mTevBlock);
i_material->mIndBlock = JKR_NEW J3DIndBlockNull();
i_material->mIndBlock = new J3DIndBlockNull();
J3D_ASSERT_ALLOCMEM(640, i_material->mIndBlock);
i_material->mPEBlock = JKR_NEW J3DPEBlockNull();
i_material->mPEBlock = new J3DPEBlockNull();
J3D_ASSERT_ALLOCMEM(642, i_material->mPEBlock);
i_material->mIndex = i_idx;
i_material->mMaterialMode = mpMaterialMode[i_idx];
@@ -371,7 +370,7 @@ J3DMaterial* J3DMaterialFactory::createLockedMaterial(J3DMaterial* i_material, i
i_material->getTevBlock()->setTevRegOffset(mpPatchingInfo[i_idx].mTevRegOffset);
i_material->getPEBlock()->setFogOffset(mpPatchingInfo[i_idx].mFogOffset);
if (i_material->mSharedDLObj == NULL) {
i_material->mSharedDLObj = JKR_NEW J3DDisplayListObj();
i_material->mSharedDLObj = new J3DDisplayListObj();
J3D_ASSERT_ALLOCMEM(673, i_material->mSharedDLObj);
i_material->mSharedDLObj->setSingleDisplayList((void*)(
mpDisplayListInit[i_idx].mOffset + (uintptr_t)&mpDisplayListInit[i_idx]),
@@ -545,9 +544,9 @@ J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
be_swap(tex_mtx_info.mSRT.mRotation);
be_swap(tex_mtx_info.mSRT.mTranslationX);
be_swap(tex_mtx_info.mSRT.mTranslationY);
tex_mtx = JKR_NEW J3DTexMtx(tex_mtx_info);
tex_mtx = new J3DTexMtx(tex_mtx_info);
#else
tex_mtx = JKR_NEW J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]);
tex_mtx = new J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]);
#endif
}
return tex_mtx;
@@ -1,9 +1,8 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h"
#include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/JMath/JMath.h"
#include "JSystem/JSupport/JSupport.h"
@@ -90,7 +89,7 @@ J3DMaterial* J3DMaterialFactory_v21::create(J3DMaterial* i_material, int i_idx,
u32 pe_flag = getMdlDataFlag_PEFlag(i_flags);
BOOL ind_flag = (i_flags & 0x1000000) ? TRUE : FALSE;
if (i_material == NULL) {
i_material = JKR_NEW J3DMaterial();
i_material = new J3DMaterial();
}
i_material->mColorBlock = J3DMaterial::createColorBlock(color_flag);
i_material->mTexGenBlock = J3DMaterial::createTexGenBlock(texgen_flag);
@@ -222,7 +221,7 @@ J3DTexMtx* J3DMaterialFactory_v21::newTexMtx(int i_idx, int i_no) const {
J3DTexMtx* tex_mtx = NULL;
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
if (mtl_init_data->mTexMtxIdx[i_no] != 0xffff) {
tex_mtx = JKR_NEW J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]);
tex_mtx = new J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]);
}
return tex_mtx;
}
@@ -64,7 +64,7 @@ J3DModelData* J3DModelLoaderDataBase::loadBinaryDisplayList(const void* i_data,
J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
s32 freeSize = JKRGetCurrentHeap()->getTotalFreeSize();
mpModelData = JKR_NEW J3DModelData();
mpModelData = new J3DModelData();
J3D_ASSERT_ALLOCMEM(177, mpModelData);
mpModelData->clear();
mpModelData->mpRawData = i_data;
@@ -123,7 +123,7 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
int flags = 0x51100000;
mpMaterialTable = JKR_NEW J3DMaterialTable();
mpMaterialTable = new J3DMaterialTable();
J3D_ASSERT_ALLOCMEM(279, mpMaterialTable);
mpMaterialTable->clear();
J3DModelFileData const* data = (J3DModelFileData*)i_data;
@@ -146,7 +146,7 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
block = (J3DModelBlock*)((uintptr_t)block + block->mBlockSize);
}
if (mpMaterialTable->mTexture == NULL) {
mpMaterialTable->mTexture = JKR_NEW J3DTexture(0, NULL);
mpMaterialTable->mTexture = new J3DTexture(0, NULL);
J3D_ASSERT_ALLOCMEM(319, mpMaterialTable->mTexture);
}
return mpMaterialTable;
@@ -157,7 +157,7 @@ inline u32 getBdlFlag_MaterialType(u32 flags) {
}
J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_flags) {
mpModelData = JKR_NEW J3DModelData();
mpModelData = new J3DModelData();
J3D_ASSERT_ALLOCMEM(338, mpModelData);
mpModelData->clear();
mpModelData->mpRawData = i_data;
@@ -262,13 +262,13 @@ void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_fla
J3DMtxCalc* mtx_calc = NULL;
switch (mpModelData->mFlags & 0xf) {
case 0:
mtx_calc = JKR_NEW J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformBasic,J3DMtxCalcJ3DSysInitBasic>();
mtx_calc = new J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformBasic,J3DMtxCalcJ3DSysInitBasic>();
break;
case 1:
mtx_calc = JKR_NEW J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformSoftimage,J3DMtxCalcJ3DSysInitSoftimage>();
mtx_calc = new J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformSoftimage,J3DMtxCalcJ3DSysInitSoftimage>();
break;
case 2:
mtx_calc = JKR_NEW J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformMaya,J3DMtxCalcJ3DSysInitMaya>();
mtx_calc = new J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformMaya,J3DMtxCalcJ3DSysInitMaya>();
break;
default:
JUT_PANIC(529, "Error : Invalid MtxCalcType.");
@@ -398,7 +398,7 @@ void J3DModelLoader::readDraw(J3DDrawBlock const* i_block) {
}
}
drawMtxData->mDrawFullWgtMtxNum = i;
mpModelData->getJointTree().mWEvlpImportantMtxIdx = JKR_NEW u16[drawMtxData->mEntryNum];
mpModelData->getJointTree().mWEvlpImportantMtxIdx = new u16[drawMtxData->mEntryNum];
J3D_ASSERT_ALLOCMEM(767, mpModelData->getJointTree().mWEvlpImportantMtxIdx);
}
@@ -408,13 +408,13 @@ void J3DModelLoader::readJoint(J3DJointBlock const* i_block) {
mpModelData->getJointTree().mJointNum = i_block->mJointNum;
if (i_block->mpNameTable != NULL) {
mpModelData->getJointTree().mJointName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(791, mpModelData->getJointTree().mJointName);
} else {
mpModelData->getJointTree().mJointName = NULL;
}
mpModelData->getJointTree().mJointNodePointer =
JKR_NEW J3DJoint*[mpModelData->getJointTree().mJointNum];
new J3DJoint*[mpModelData->getJointTree().mJointNum];
J3D_ASSERT_ALLOCMEM(797, mpModelData->getJointTree().mJointNodePointer);
for (u16 i = 0; i < mpModelData->getJointNum(); i++) {
mpModelData->getJointTree().mJointNodePointer[i] = factory.create(i);
@@ -428,15 +428,15 @@ void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_fla
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mMaterialName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(832, mpMaterialTable->mMaterialName);
} else {
mpMaterialTable->mMaterialName = NULL;
}
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
J3D_ASSERT_ALLOCMEM(841, mpMaterialTable->mMaterialNodePointer);
if (i_flags & 0x200000) {
mpMaterialTable->field_0x10 = JKR_NEW_ARGS (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
J3D_ASSERT_ALLOCMEM(846, mpMaterialTable->field_0x10);
} else {
mpMaterialTable->field_0x10 = NULL;
@@ -474,15 +474,15 @@ void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mMaterialName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(930, mpMaterialTable->mMaterialName);
} else {
mpMaterialTable->mMaterialName = NULL;
}
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
J3D_ASSERT_ALLOCMEM(940, mpMaterialTable->mMaterialNodePointer);
if (i_flags & 0x200000) {
mpMaterialTable->field_0x10 = JKR_NEW_ARGS (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
J3D_ASSERT_ALLOCMEM(945, mpMaterialTable->field_0x10);
} else {
mpMaterialTable->field_0x10 = NULL;
@@ -518,12 +518,12 @@ void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) {
shape_table->mShapeNum = i_block->mShapeNum;
if (i_block->mpNameTable != NULL) {
shape_table->mShapeName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(1026, shape_table->mShapeName);
} else {
shape_table->mShapeName = NULL;
}
shape_table->mShapeNodePointer = JKR_NEW J3DShape*[shape_table->mShapeNum];
shape_table->mShapeNodePointer = new J3DShape*[shape_table->mShapeNum];
J3D_ASSERT_ALLOCMEM(1034, shape_table->mShapeNodePointer);
factory.allocVcdVatCmdBuffer(shape_table->mShapeNum);
J3DModelHierarchy const* hierarchy_entry = mpModelData->getHierarchy();
@@ -543,12 +543,12 @@ void J3DModelLoader::readTexture(J3DTextureBlock const* i_block) {
ResTIMG* texture_res = JSUConvertOffsetToPtr<ResTIMG>(i_block, i_block->mpTextureRes);
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mTextureName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(1077, mpMaterialTable->mTextureName);
} else {
mpMaterialTable->mTextureName = NULL;
}
mpMaterialTable->mTexture = JKR_NEW J3DTexture(texture_num, texture_res);
mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res);
J3D_ASSERT_ALLOCMEM(1084, mpMaterialTable->mTexture);
}
@@ -558,12 +558,12 @@ void J3DModelLoader_v26::readMaterialTable(J3DMaterialBlock const* i_block, u32
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mMaterialName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(1114, mpMaterialTable->mMaterialName);
} else {
mpMaterialTable->mMaterialName = NULL;
}
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
J3D_ASSERT_ALLOCMEM(1121, mpMaterialTable->mMaterialNodePointer);
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
mpMaterialTable->mMaterialNodePointer[i] =
@@ -581,12 +581,12 @@ void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_blo
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mMaterialName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(1165, mpMaterialTable->mMaterialName);
} else {
mpMaterialTable->mMaterialName = NULL;
}
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
J3D_ASSERT_ALLOCMEM(1172, mpMaterialTable->mMaterialNodePointer);
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
mpMaterialTable->mMaterialNodePointer[i] =
@@ -604,12 +604,12 @@ void J3DModelLoader::readTextureTable(J3DTextureBlock const* i_block) {
ResTIMG* texture_res = JSUConvertOffsetToPtr<ResTIMG>(i_block, i_block->mpTextureRes);
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mTextureName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(1211, mpMaterialTable->mTextureName);
} else {
mpMaterialTable->mTextureName = NULL;
}
mpMaterialTable->mTexture = JKR_NEW J3DTexture(texture_num, texture_res);
mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res);
J3D_ASSERT_ALLOCMEM(1218, mpMaterialTable->mTexture);
}
@@ -620,12 +620,12 @@ void J3DModelLoader::readPatchedMaterial(J3DMaterialBlock const* i_block, u32 i_
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mMaterialName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(1251, mpMaterialTable->mMaterialName);
} else {
mpMaterialTable->mMaterialName = NULL;
}
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
J3D_ASSERT_ALLOCMEM(1260, mpMaterialTable->mMaterialNodePointer);
mpMaterialTable->field_0x10 = NULL;
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
@@ -646,12 +646,12 @@ void J3DModelLoader::readMaterialDL(J3DMaterialDLBlock const* i_block, u32 i_fla
mpMaterialTable->mUniqueMatNum = i_block->mMaterialNum;
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mMaterialName =
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
J3D_ASSERT_ALLOCMEM(1312, mpMaterialTable->mMaterialName);
} else {
mpMaterialTable->mMaterialName = NULL;
}
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
J3D_ASSERT_ALLOCMEM(1320, mpMaterialTable->mMaterialNodePointer);
mpMaterialTable->field_0x10 = NULL;
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
@@ -41,14 +41,14 @@ J3DShapeFactory::J3DShapeFactory(J3DShapeBlock const& block) {
}
J3DShape* J3DShapeFactory::create(int no, u32 flag, GXVtxDescList* vtxDesc) {
J3DShape* shape = JKR_NEW J3DShape;
J3DShape* shape = new J3DShape;
J3D_ASSERT_ALLOCMEM(67, shape);
shape->mMtxGroupNum = getMtxGroupNum(no);
shape->mRadius = getRadius(no);
shape->mVtxDesc = getVtxDescList(no);
shape->mShapeMtx = JKR_NEW J3DShapeMtx*[shape->mMtxGroupNum];
shape->mShapeMtx = new J3DShapeMtx*[shape->mMtxGroupNum];
J3D_ASSERT_ALLOCMEM(74, shape->mShapeMtx);
shape->mShapeDraw = JKR_NEW J3DShapeDraw*[shape->mMtxGroupNum];
shape->mShapeDraw = new J3DShapeDraw*[shape->mMtxGroupNum];
J3D_ASSERT_ALLOCMEM(76, shape->mShapeDraw);
shape->mMin = getMin(no);
shape->mMax = getMax(no);
@@ -85,16 +85,16 @@ J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo)
case J3DMdlDataFlag_ConcatView:
switch (shapeInitData.mShapeMtxType) {
case J3DShapeMtxType_Mtx:
ret = JKR_NEW J3DShapeMtxConcatView(mtxInitData.mUseMtxIndex);
ret = new J3DShapeMtxConcatView(mtxInitData.mUseMtxIndex);
break;
case J3DShapeMtxType_BBoard:
ret = JKR_NEW J3DShapeMtxBBoardConcatView(mtxInitData.mUseMtxIndex);
ret = new J3DShapeMtxBBoardConcatView(mtxInitData.mUseMtxIndex);
break;
case J3DShapeMtxType_YBBoard:
ret = JKR_NEW J3DShapeMtxYBBoardConcatView(mtxInitData.mUseMtxIndex);
ret = new J3DShapeMtxYBBoardConcatView(mtxInitData.mUseMtxIndex);
break;
case J3DShapeMtxType_Multi:
ret = JKR_NEW J3DShapeMtxMultiConcatView(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount,
ret = new J3DShapeMtxMultiConcatView(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount,
&mMtxTable[mtxInitData.mFirstUseMtxIndex]);
break;
default:
@@ -109,10 +109,10 @@ J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo)
case J3DShapeMtxType_Mtx:
case J3DShapeMtxType_BBoard:
case J3DShapeMtxType_YBBoard:
ret = JKR_NEW J3DShapeMtx(mtxInitData.mUseMtxIndex);
ret = new J3DShapeMtx(mtxInitData.mUseMtxIndex);
break;
case J3DShapeMtxType_Multi:
ret = JKR_NEW J3DShapeMtxMulti(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount,
ret = new J3DShapeMtxMulti(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount,
&mMtxTable[mtxInitData.mFirstUseMtxIndex]);
break;
default:
@@ -132,13 +132,13 @@ J3DShapeDraw* J3DShapeFactory::newShapeDraw(int shapeNo, int mtxGroupNo) const {
const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]];
const J3DShapeDrawInitData& drawInitData =
(&mDrawInitData[shapeInitData.mDrawInitDataIndex])[mtxGroupNo];
shapeDraw = JKR_NEW J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize);
shapeDraw = new J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize);
J3D_ASSERT_ALLOCMEM(193, shapeDraw);
return shapeDraw;
}
void J3DShapeFactory::allocVcdVatCmdBuffer(u32 count) {
mVcdVatCmdBuffer = JKR_NEW_ARGS (0x20) u8[J3DShape::kVcdVatDLSize * count];
mVcdVatCmdBuffer = new (0x20) u8[J3DShape::kVcdVatDLSize * count];
J3D_ASSERT_ALLOCMEM(211, mVcdVatCmdBuffer);
for (u32 i = 0; i < (J3DShape::kVcdVatDLSize * count) / 4; i++)
((u32*)mVcdVatCmdBuffer)[i] = 0;