mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-12 19:24:55 -04:00
26 02 27 pjb dev 2 (#41)
* fix kankyo UB
* Fix TEV Stage DL writing
BE issue
* BE Fixes in materials/shapes
* Move to Aurora GD impl
* JUTDataFileHeader
* j3d: load vertex and texture not through GD
* Endian swap vertex data (mostly)
* Just exit(0) when closing the game
Fix crashes :godo:
* fix fopAcM_ct_placement and remove memcpy
* J3D: track vertex arrays correctly, swap work
* fix visibility, turn off overridden new/delete when we call into aurora
* event: cut name be
* Default window improvements
Double size, allow OS to decide position
* survive TParse::parseHeader_next
* color swap fix
* swap endian/fixes oob function pointer
* Remove GXGetViewportv stub
Aurora has it now
* Set array pointers via GD again
Relies on https://github.com/encounter/aurora/pull/35
* Let Aurora decide graphics backend
* disable procbar drawing
* Fix TColor endianness conversion issues
Fixes the wrong color for the flashing logo
* cam param swap
* simplify vtx loading, mat/amb color fix
* endian swap stb/fvb data
* aurora stat changes
* fix storage buffer crash
dont unnecessarily reassign vertex buffers in a way that forces aurora to recache things
* set bgobj spec fix
* add camera debug, endian swap more stb data, d_a_bg_obj::spec_data_c swapped
* JKRExpHeap: fix bad allocator slowdown
* solid tex
* texture caching
* log level
* fix window aspect ratio, disable bloom, endian swap camera type data
camera is now actually playing opening cutscene!!!!
* add GXDestroyTexObj to a couple stack init'd GXTexObjs, remove some diag printfs
* endian swap joint weight envelope data
* move to dusk config
* verbose arg errors
* better stub logging (for now)
* less logging, more BE
* more stubbing, move logging stuff around
* move all logging to aurora logging
* fix STUB_LOG, __FUNCTION__ isn't a string literal, wasn't building as it
was.
* update aurora
* fix heap alignment mismatch and always head align for now
* prevent them from fucking up my shit
* forward jut warning to DuskLog
* remove report logging
* maybe and i must emphasize maybe fix JMessage parsing
* this was a dumb idea
* preserve negative alignment for JKRHeap
* use normal free on macos and linux
* ^
* fix JMAHermiteInterpolation c impl
* endian swap J2DScreen mColor (oops)
* swap more J3D anim data, remove weird pointer addr check in J3DMaterial getMaterialAnm
* typo fix
* Fix aligned_alloc() size issues on POSIX
aligned_alloc() requires its input size to be a multiple of alignment. This wasn't being upheld so there were allocation failures in init code that made the game fail to start outside Windows.
Also just cleaned up some of this code a bit and removed fallback cases that *shouldn't* get hit.
* _Exit instead of exit()
Seriously I don't want destructors to run. Let the OS reclaim that shit.
* Reapply "Isolate JKRHeap operator overloads" (#39)
This reverts commit 3623b27f37.
* Fix some oopsies
* Fix hardcoded pointer size in JUTCacheFont::allocArray
* More operator overload fixes
Add void template specialization for jkrDelete
Add new[] placement overload. Apparently.
* Fix delete macros on nullptr
TIL C++ allows that.
* fix delete[]
* fix new(std::nothrow) overload
* fix avoid ub
* swap remaining anim data needed for title logo
* get rid of op 7
* move aurora_end_frame to correct spot
* juttexture destroy tex
* j2d animation be
* shutdown crash
* link warp material fix
* mDoExt_3DlineMat1_c fix
* hacky keyboard controls
* endian swap J2DResReference, add kb_pad to files.cmake
* fix some missing endian swaps in J2D, remove addr alignment check
* Remove heap unsetting in aurora calls
Never worked properly and not the right solution even if it did
* Don't print in DC stubs
They're fine to never implement
* Fix alignment stuff again
* Compile GF from dolphin lib
Doesn't seem to break anything and shuts up some stub warnings
* j3dtexture tlut obj fix
* addTexMtxIndexInDL fix
* don't recreate null tex data every frame
* the actual fix i wanted to push
* its kinda fakematch city over here
* insert hte efb copy
* limited window size / viewport support
* IsDelete FIX
---------
Co-authored-by: madeline <qwertytrogi@gmail.com>
Co-authored-by: Jasper St. Pierre <jstpierre@mecheye.net>
Co-authored-by: Jeffrey Crowell <jeff@crowell.biz>
Co-authored-by: TakaRikka <takarikka@outlook.com>
Co-authored-by: CraftyBoss <talibabdulmaalik@gmail.com>
Co-authored-by: Lurs <2795933+Lurs@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
820e2e3df6
commit
b289dece80
@@ -152,7 +152,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mScale.x = mScaleValues[xInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mScale.x = J2DGetKeyFrameInterpolation<f32>(
|
||||
transformInfo->mScale.x = J2DGetKeyFrameInterpolation<BE(f32)>(
|
||||
param_0, &xInf->mScaleInfo, &mScaleValues[xInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (yInf->mScaleInfo.mMaxFrame) {
|
||||
@@ -163,7 +163,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mScale.y = mScaleValues[yInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mScale.y = J2DGetKeyFrameInterpolation<f32>(
|
||||
transformInfo->mScale.y = J2DGetKeyFrameInterpolation<BE(f32)>(
|
||||
param_0, &yInf->mScaleInfo, &mScaleValues[yInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (zInf->mScaleInfo.mMaxFrame) {
|
||||
@@ -174,7 +174,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mScale.z = mScaleValues[zInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mScale.z = J2DGetKeyFrameInterpolation<f32>(
|
||||
transformInfo->mScale.z = J2DGetKeyFrameInterpolation<BE(f32)>(
|
||||
param_0, &zInf->mScaleInfo, &mScaleValues[zInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (xInf->mRotationInfo.mMaxFrame) {
|
||||
@@ -186,7 +186,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
break;
|
||||
default:
|
||||
transformInfo->mRotation.x =
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<s16>(
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<BE(s16)>(
|
||||
param_0, &xInf->mRotationInfo, &mRotationValues[xInf->mRotationInfo.mOffset]))
|
||||
<< field_0x24;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
break;
|
||||
default:
|
||||
transformInfo->mRotation.y =
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<s16>(
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<BE(s16)>(
|
||||
param_0, &yInf->mRotationInfo, &mRotationValues[yInf->mRotationInfo.mOffset]))
|
||||
<< field_0x24;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
break;
|
||||
default:
|
||||
transformInfo->mRotation.z =
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<s16>(
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<BE(s16)>(
|
||||
param_0, &zInf->mRotationInfo, &mRotationValues[zInf->mRotationInfo.mOffset]))
|
||||
<< field_0x24;
|
||||
}
|
||||
@@ -224,7 +224,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mTranslate.x = mTranslateValues[xInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mTranslate.x = J2DGetKeyFrameInterpolation<f32>(
|
||||
transformInfo->mTranslate.x = J2DGetKeyFrameInterpolation<BE(f32)>(
|
||||
param_0, &xInf->mTranslateInfo, &mTranslateValues[xInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
switch (yInf->mTranslateInfo.mMaxFrame) {
|
||||
@@ -235,7 +235,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mTranslate.y = mTranslateValues[yInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mTranslate.y = J2DGetKeyFrameInterpolation<f32>(
|
||||
transformInfo->mTranslate.y = J2DGetKeyFrameInterpolation<BE(f32)>(
|
||||
param_0, &yInf->mTranslateInfo, &mTranslateValues[yInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
switch (zInf->mTranslateInfo.mMaxFrame) {
|
||||
@@ -246,7 +246,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mTranslate.z = mTranslateValues[zInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mTranslate.z = J2DGetKeyFrameInterpolation<f32>(
|
||||
transformInfo->mTranslate.z = J2DGetKeyFrameInterpolation<BE(f32)>(
|
||||
param_0, &zInf->mTranslateInfo, &mTranslateValues[zInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
}
|
||||
@@ -315,7 +315,7 @@ void J2DAnmColorKey::getColor(u16 param_0, GXColor* pColor) const {
|
||||
pColor->r = mRValues[info->mRInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mRInfo,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mRInfo,
|
||||
&mRValues[info->mRInfo.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->r = 0;
|
||||
@@ -333,7 +333,7 @@ void J2DAnmColorKey::getColor(u16 param_0, GXColor* pColor) const {
|
||||
pColor->g = mGValues[info->mGInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mGInfo,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mGInfo,
|
||||
&mGValues[info->mGInfo.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->g = 0;
|
||||
@@ -351,7 +351,7 @@ void J2DAnmColorKey::getColor(u16 param_0, GXColor* pColor) const {
|
||||
pColor->b = mBValues[info->mBInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mBInfo,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mBInfo,
|
||||
&mBValues[info->mBInfo.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->b = 0;
|
||||
@@ -369,7 +369,7 @@ void J2DAnmColorKey::getColor(u16 param_0, GXColor* pColor) const {
|
||||
pColor->a = mAValues[info->mAInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mAInfo,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mAInfo,
|
||||
&mAValues[info->mAInfo.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->a = 0;
|
||||
@@ -430,7 +430,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, GXColor* pColor) const
|
||||
pColor->r = mRValues[info->mRInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mRInfo,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mRInfo,
|
||||
&mRValues[info->mRInfo.mOffset]);
|
||||
if ((val <= 0)) {
|
||||
pColor->r = 0;
|
||||
@@ -448,7 +448,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, GXColor* pColor) const
|
||||
pColor->g = mGValues[info->mGInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mGInfo,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mGInfo,
|
||||
&mGValues[info->mGInfo.mOffset]);
|
||||
if (val <= 0) {
|
||||
pColor->g = 0;
|
||||
@@ -466,7 +466,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, GXColor* pColor) const
|
||||
pColor->b = mBValues[info->mBInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mBInfo,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mBInfo,
|
||||
&mBValues[info->mBInfo.mOffset]);
|
||||
if (val <= 0) {
|
||||
pColor->b = 0;
|
||||
@@ -484,7 +484,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, GXColor* pColor) const
|
||||
pColor->a = mAValues[info->mAInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mAInfo,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mAInfo,
|
||||
&mAValues[info->mAInfo.mOffset]);
|
||||
if (val <= 0) {
|
||||
pColor->a = 0;
|
||||
@@ -511,7 +511,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
pInfo->mScaleX = mScaleValues[xInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
pInfo->mScaleX = J2DGetKeyFrameInterpolation<f32>(param_0, &xInf->mScaleInfo,
|
||||
pInfo->mScaleX = J2DGetKeyFrameInterpolation<BE(f32)>(param_0, &xInf->mScaleInfo,
|
||||
&mScaleValues[xInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (yInf->mScaleInfo.mMaxFrame) {
|
||||
@@ -522,7 +522,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
pInfo->mScaleY = mScaleValues[yInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
pInfo->mScaleY = J2DGetKeyFrameInterpolation<f32>(param_0, &yInf->mScaleInfo,
|
||||
pInfo->mScaleY = J2DGetKeyFrameInterpolation<BE(f32)>(param_0, &yInf->mScaleInfo,
|
||||
&mScaleValues[yInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (zInf->mRotationInfo.mMaxFrame) {
|
||||
@@ -534,7 +534,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
break;
|
||||
default:
|
||||
pInfo->mRotation =
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<s16>(
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<BE(s16)>(
|
||||
param_0, &zInf->mRotationInfo, &mRotationValues[zInf->mRotationInfo.mOffset]))
|
||||
<< field_0x10;
|
||||
}
|
||||
@@ -546,7 +546,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
pInfo->mTranslationX = mTranslationValues[xInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
pInfo->mTranslationX = J2DGetKeyFrameInterpolation<f32>(
|
||||
pInfo->mTranslationX = J2DGetKeyFrameInterpolation<BE(f32)>(
|
||||
param_0, &xInf->mTranslateInfo, &mTranslationValues[xInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
switch (yInf->mTranslateInfo.mMaxFrame) {
|
||||
@@ -557,7 +557,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
pInfo->mTranslationY = mTranslationValues[yInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
pInfo->mTranslationY = J2DGetKeyFrameInterpolation<f32>(
|
||||
pInfo->mTranslationY = J2DGetKeyFrameInterpolation<BE(f32)>(
|
||||
param_0, &yInf->mTranslateInfo, &mTranslationValues[yInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
}
|
||||
@@ -585,8 +585,8 @@ void J2DAnmTexPattern::searchUpdateMaterialID(J2DScreen* pScreen) {
|
||||
mUpdateMaterialID[entry] = 0xFFFF;
|
||||
}
|
||||
}
|
||||
delete[] mTIMGPtrArray;
|
||||
mTIMGPtrArray = new J2DAnmTexPatternTIMGPointer[pScreen->mTexRes->mCount];
|
||||
JKR_DELETE_ARRAY(mTIMGPtrArray);
|
||||
mTIMGPtrArray = JKR_NEW J2DAnmTexPatternTIMGPointer[pScreen->mTexRes->mCount];
|
||||
if (mTIMGPtrArray != NULL) {
|
||||
JUTResReference resRef;
|
||||
for (u16 i = 0; i < pScreen->mTexRes->mCount; i++) {
|
||||
@@ -601,7 +601,7 @@ void J2DAnmTexPattern::searchUpdateMaterialID(J2DScreen* pScreen) {
|
||||
}
|
||||
mTIMGPtrArray[i].mRes = var2;
|
||||
if (var2 != NULL && var2->indexTexture) {
|
||||
mTIMGPtrArray[i].mPalette = new JUTPalette(
|
||||
mTIMGPtrArray[i].mPalette = JKR_NEW JUTPalette(
|
||||
GX_TLUT0,
|
||||
GXTlutFmt(var2->colorFormat),
|
||||
JUTTransparency(var2->alphaEnabled),
|
||||
@@ -676,7 +676,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, GXColorS10* pColor) const {
|
||||
pColor->r = mCRValues[info->mRTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mRTable,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mRTable,
|
||||
&mCRValues[info->mRTable.mOffset]);
|
||||
if (val < -0x400) {
|
||||
pColor->r = -0x400;
|
||||
@@ -694,7 +694,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, GXColorS10* pColor) const {
|
||||
pColor->g = mCGValues[info->mGTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mGTable,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mGTable,
|
||||
&mCGValues[info->mGTable.mOffset]);
|
||||
if (val < -0x400) {
|
||||
pColor->g = -0x400;
|
||||
@@ -712,7 +712,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, GXColorS10* pColor) const {
|
||||
pColor->b = mCBValues[info->mBTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mBTable,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mBTable,
|
||||
&mCBValues[info->mBTable.mOffset]);
|
||||
if (val < -0x400) {
|
||||
pColor->b = -0x400;
|
||||
@@ -730,7 +730,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, GXColorS10* pColor) const {
|
||||
pColor->a = mCAValues[info->mATable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mATable,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mATable,
|
||||
&mCAValues[info->mATable.mOffset]);
|
||||
if (val < -0x400) {
|
||||
pColor->a = -0x400;
|
||||
@@ -755,7 +755,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, GXColor* pColor) const {
|
||||
pColor->r = mKRValues[info->mRTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mRTable,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mRTable,
|
||||
&mKRValues[info->mRTable.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->r = 0;
|
||||
@@ -773,7 +773,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, GXColor* pColor) const {
|
||||
pColor->g = mKGValues[info->mGTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mGTable,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mGTable,
|
||||
&mKGValues[info->mGTable.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->g = 0;
|
||||
@@ -791,7 +791,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, GXColor* pColor) const {
|
||||
pColor->b = mKBValues[info->mBTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mBTable,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mBTable,
|
||||
&mKBValues[info->mBTable.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->b = 0;
|
||||
@@ -809,7 +809,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, GXColor* pColor) const {
|
||||
pColor->a = mKAValues[info->mATable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mATable,
|
||||
val = J2DGetKeyFrameInterpolation<BE(s16)>(mFrame, &info->mATable,
|
||||
&mKAValues[info->mATable.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->a = 0;
|
||||
|
||||
@@ -18,13 +18,13 @@ J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) {
|
||||
switch (hdr->mType) {
|
||||
case 'bck1': {
|
||||
J2DAnmKeyLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmTransformKey();
|
||||
loader.mpResource = JKR_NEW J2DAnmTransformKey();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
break;
|
||||
}
|
||||
case 'bpk1': {
|
||||
J2DAnmKeyLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmColorKey();
|
||||
loader.mpResource = JKR_NEW J2DAnmColorKey();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
break;
|
||||
}
|
||||
@@ -33,42 +33,42 @@ J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) {
|
||||
return NULL;
|
||||
case 'btk1': {
|
||||
J2DAnmKeyLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmTextureSRTKey();
|
||||
loader.mpResource = JKR_NEW J2DAnmTextureSRTKey();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
break;
|
||||
}
|
||||
case 'brk1': {
|
||||
J2DAnmKeyLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmTevRegKey();
|
||||
loader.mpResource = JKR_NEW J2DAnmTevRegKey();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
break;
|
||||
}
|
||||
case 'bxk1': {
|
||||
J2DAnmKeyLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmVtxColorKey();
|
||||
loader.mpResource = JKR_NEW J2DAnmVtxColorKey();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
break;
|
||||
}
|
||||
case 'bca1': {
|
||||
J2DAnmFullLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmTransformFull();
|
||||
loader.mpResource = JKR_NEW J2DAnmTransformFull();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
break;
|
||||
}
|
||||
case 'bpa1': {
|
||||
J2DAnmFullLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmColorFull();
|
||||
loader.mpResource = JKR_NEW J2DAnmColorFull();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
break;
|
||||
}
|
||||
case 'btp1': {
|
||||
J2DAnmFullLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmTexPattern();
|
||||
loader.mpResource = JKR_NEW J2DAnmTexPattern();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
}
|
||||
case 'bva1': {
|
||||
J2DAnmFullLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmVisibilityFull();
|
||||
loader.mpResource = JKR_NEW J2DAnmVisibilityFull();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
break;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) {
|
||||
return NULL;
|
||||
case 'bxa1': {
|
||||
J2DAnmFullLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmVtxColorFull();
|
||||
loader.mpResource = JKR_NEW J2DAnmVtxColorFull();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
}
|
||||
default:
|
||||
@@ -175,25 +175,6 @@ void J2DAnmKeyLoader_v15::readAnmTransform(J3DAnmTransformKeyData const* p_data)
|
||||
setAnmTransform(p_anm, p_data);
|
||||
}
|
||||
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
static void ByteSwapTransformKeyData(
|
||||
J2DAnmTransformKey& target,
|
||||
const J3DAnmTransformKeyData& source) {
|
||||
|
||||
for (int i = 0; i < source.mSCount; i += 1) {
|
||||
be_swap(target.mScaleValues[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < source.mRCount; i += 1) {
|
||||
be_swap(target.mRotationValues[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < source.mTCount; i += 1) {
|
||||
be_swap(target.mTranslateValues[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void J2DAnmKeyLoader_v15::setAnmTransform(J2DAnmTransformKey* p_anm,
|
||||
J3DAnmTransformKeyData const* p_data) {
|
||||
J3D_PANIC(439, p_anm, "Error : null pointer.");
|
||||
@@ -205,14 +186,10 @@ void J2DAnmKeyLoader_v15::setAnmTransform(J2DAnmTransformKey* p_anm,
|
||||
p_anm->mFrame = 0;
|
||||
p_anm->mInfoTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmTransformKeyTable>(p_data, p_data->mJointAnimationTableOffs);
|
||||
p_anm->mScaleValues = JSUConvertOffsetToPtr<f32>(p_data, p_data->mSTableOffs);
|
||||
p_anm->mRotationValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mRTableOffs);
|
||||
p_anm->mScaleValues = JSUConvertOffsetToPtr<BE(f32)>(p_data, p_data->mSTableOffs);
|
||||
p_anm->mRotationValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mRTableOffs);
|
||||
p_anm->mTranslateValues =
|
||||
JSUConvertOffsetToPtr<f32>(p_data, p_data->mTTableOffs);
|
||||
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
ByteSwapTransformKeyData(*p_anm, *p_data);
|
||||
#endif
|
||||
JSUConvertOffsetToPtr<BE(f32)>(p_data, p_data->mTTableOffs);
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::readAnmTextureSRT(J3DAnmTextureSRTKeyData const* p_data) {
|
||||
@@ -235,14 +212,14 @@ void J2DAnmKeyLoader_v15::setAnmTextureSRT(J2DAnmTextureSRTKey* p_anm,
|
||||
p_anm->field_0x1e = p_data->field_0x12;
|
||||
p_anm->mInfoTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmTransformKeyTable>(p_data, p_data->mTableOffset);
|
||||
p_anm->mUpdateMaterialID = JSUConvertOffsetToPtr<u16>(p_data, p_data->mUpdateMatIDOffset);
|
||||
p_anm->mUpdateMaterialID = JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mUpdateMatIDOffset);
|
||||
p_anm->field_0x34.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(p_data, p_data->mNameTab1Offset));
|
||||
p_anm->mUpdateTexMtxID = JSUConvertOffsetToPtr<u8>(p_data, p_data->mUpdateTexMtxIDOffset);
|
||||
p_anm->field_0x44 = JSUConvertOffsetToPtr<Vec>(p_data, p_data->unkOffset);
|
||||
p_anm->mScaleValues = JSUConvertOffsetToPtr<f32>(p_data, p_data->mScaleValOffset);
|
||||
p_anm->mRotationValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mRotValOffset);
|
||||
p_anm->mTranslationValues = JSUConvertOffsetToPtr<f32>(p_data, p_data->mTransValOffset);
|
||||
p_anm->field_0x44 = JSUConvertOffsetToPtr<BE(Vec)>(p_data, p_data->unkOffset);
|
||||
p_anm->mScaleValues = JSUConvertOffsetToPtr<BE(f32)>(p_data, p_data->mScaleValOffset);
|
||||
p_anm->mRotationValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mRotValOffset);
|
||||
p_anm->mTranslationValues = JSUConvertOffsetToPtr<BE(f32)>(p_data, p_data->mTransValOffset);
|
||||
if (p_data->mNameTab2Offset != 0) {
|
||||
p_anm->field_0x68.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(p_data, p_data->mNameTab2Offset));
|
||||
@@ -253,12 +230,12 @@ void J2DAnmKeyLoader_v15::setAnmTextureSRT(J2DAnmTextureSRTKey* p_anm,
|
||||
p_anm->field_0x4c = p_data->field_0x3a;
|
||||
p_anm->field_0x5c =
|
||||
JSUConvertOffsetToPtr<J3DAnmTransformKeyTable>(p_data, p_data->mInfoTable2Offset);
|
||||
p_anm->field_0x64 = JSUConvertOffsetToPtr<u16>(p_data, p_data->field_0x40);
|
||||
p_anm->field_0x64 = JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->field_0x40);
|
||||
p_anm->field_0x60 = JSUConvertOffsetToPtr<u8>(p_data, p_data->field_0x48);
|
||||
p_anm->field_0x78 = JSUConvertOffsetToPtr<Vec>(p_data, p_data->field_0x4c);
|
||||
p_anm->field_0x50 = JSUConvertOffsetToPtr<f32>(p_data, p_data->field_0x50);
|
||||
p_anm->field_0x54 = JSUConvertOffsetToPtr<s16>(p_data, p_data->field_0x54);
|
||||
p_anm->field_0x58 = JSUConvertOffsetToPtr<f32>(p_data, p_data->field_0x58);
|
||||
p_anm->field_0x78 = JSUConvertOffsetToPtr<BE(Vec)>(p_data, p_data->field_0x4c);
|
||||
p_anm->field_0x50 = JSUConvertOffsetToPtr<BE(f32)>(p_data, p_data->field_0x50);
|
||||
p_anm->field_0x54 = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->field_0x54);
|
||||
p_anm->field_0x58 = JSUConvertOffsetToPtr<BE(f32)>(p_data, p_data->field_0x58);
|
||||
switch (p_data->field_0x5c) {
|
||||
case 0:
|
||||
p_anm->field_0x7c = 0;
|
||||
@@ -290,12 +267,12 @@ void J2DAnmKeyLoader_v15::setAnmColor(J2DAnmColorKey* p_anm, J3DAnmColorKeyData
|
||||
p_anm->field_0x16 = p_data->field_0x16;
|
||||
p_anm->mInfoTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmColorKeyTable>(p_data, p_data->mTableOffset);
|
||||
p_anm->mRValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mRValOffset);
|
||||
p_anm->mGValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mGValOffset);
|
||||
p_anm->mBValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mBValOffset);
|
||||
p_anm->mAValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mAValOffset);
|
||||
p_anm->mRValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mRValOffset);
|
||||
p_anm->mGValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mGValOffset);
|
||||
p_anm->mBValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mBValOffset);
|
||||
p_anm->mAValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mAValOffset);
|
||||
p_anm->mUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(p_data, p_data->mUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mUpdateMaterialIDOffset);
|
||||
p_anm->field_0x20.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(p_data, p_data->mNameTabOffset));
|
||||
}
|
||||
@@ -323,13 +300,13 @@ void J2DAnmKeyLoader_v15::setAnmVtxColor(J2DAnmVtxColorKey* p_anm,
|
||||
p_anm->mVtxColorIndexData[1] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>(
|
||||
p_data, p_data->mVtxColoIndexDataOffset[1]);
|
||||
p_anm->mVtxColorIndexPointer[0] =
|
||||
JSUConvertOffsetToPtr<u16>(p_data, p_data->mVtxColoIndexPointerOffset[0]);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mVtxColoIndexPointerOffset[0]);
|
||||
p_anm->mVtxColorIndexPointer[1] =
|
||||
JSUConvertOffsetToPtr<u16>(p_data, p_data->mVtxColoIndexPointerOffset[1]);
|
||||
p_anm->mRValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mRValOffset);
|
||||
p_anm->mGValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mGValOffset);
|
||||
p_anm->mBValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mBValOffset);
|
||||
p_anm->mAValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mAValOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mVtxColoIndexPointerOffset[1]);
|
||||
p_anm->mRValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mRValOffset);
|
||||
p_anm->mGValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mGValOffset);
|
||||
p_anm->mBValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mBValOffset);
|
||||
p_anm->mAValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mAValOffset);
|
||||
}
|
||||
|
||||
void* J2DAnmFullLoader_v15::load(void const* p_data) {
|
||||
@@ -419,9 +396,9 @@ void J2DAnmFullLoader_v15::setAnmTransform(J2DAnmTransformFull* p_anm,
|
||||
p_anm->mFrame = 0;
|
||||
p_anm->mTableInfo =
|
||||
JSUConvertOffsetToPtr<J3DAnmTransformFullTable>(p_data, p_data->mTableOffset);
|
||||
p_anm->mScaleValues = JSUConvertOffsetToPtr<f32>(p_data, p_data->mScaleValOffset);
|
||||
p_anm->mRotationValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mRotValOffset);
|
||||
p_anm->mTranslateValues = JSUConvertOffsetToPtr<f32>(p_data, p_data->mTransValOffset);
|
||||
p_anm->mScaleValues = JSUConvertOffsetToPtr<BE(f32)>(p_data, p_data->mScaleValOffset);
|
||||
p_anm->mRotationValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mRotValOffset);
|
||||
p_anm->mTranslateValues = JSUConvertOffsetToPtr<BE(f32)>(p_data, p_data->mTransValOffset);
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::readAnmColor(J3DAnmColorFullData const* p_data) {
|
||||
@@ -443,7 +420,7 @@ void J2DAnmFullLoader_v15::setAnmColor(J2DAnmColorFull* p_anm, J3DAnmColorFullDa
|
||||
p_anm->mBValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mBValuesOffset);
|
||||
p_anm->mAValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mAValuesOffset);
|
||||
p_anm->mUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(p_data, p_data->mUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mUpdateMaterialIDOffset);
|
||||
p_anm->field_0x20.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(p_data, p_data->mNameTabOffset));
|
||||
}
|
||||
@@ -464,9 +441,9 @@ void J2DAnmFullLoader_v15::setAnmTexPattern(J2DAnmTexPattern* p_anm,
|
||||
p_anm->field_0x18 = p_data->field_0xe;
|
||||
p_anm->mAnmTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmTexPatternFullTable>(p_data, p_data->mTableOffset);
|
||||
p_anm->mValues = JSUConvertOffsetToPtr<u16>(p_data, p_data->mValuesOffset);
|
||||
p_anm->mValues = JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mValuesOffset);
|
||||
p_anm->mUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(p_data, p_data->mUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mUpdateMaterialIDOffset);
|
||||
p_anm->field_0x20.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(p_data, p_data->mNameTabOffset));
|
||||
}
|
||||
@@ -486,32 +463,32 @@ void J2DAnmKeyLoader_v15::setAnmTevReg(J2DAnmTevRegKey* p_anm, J3DAnmTevRegKeyDa
|
||||
p_anm->mAnmCRegKeyTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmCRegKeyTable>(p_data, p_data->mCRegTableOffset);
|
||||
p_anm->mCRegUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(p_data, p_data->mCRegUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mCRegUpdateMaterialIDOffset);
|
||||
p_anm->mCRegNameTab.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(p_data, p_data->mCRegNameTabOffset));
|
||||
p_anm->mKRegUpdateMaterialNum = p_data->mKRegUpdateMaterialNum;
|
||||
p_anm->mAnmKRegKeyTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmKRegKeyTable>(p_data, p_data->mKRegTableOffset);
|
||||
p_anm->mKRegUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(p_data, p_data->mKRegUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mKRegUpdateMaterialIDOffset);
|
||||
p_anm->mKRegNameTab.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(p_data, p_data->mKRegNameTabOffset));
|
||||
p_anm->field_0x14 = p_data->field_0x10;
|
||||
p_anm->field_0x16 = p_data->field_0x12;
|
||||
p_anm->field_0x18 = p_data->field_0x14;
|
||||
p_anm->field_0x1a = p_data->field_0x16;
|
||||
p_anm->mCRValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mCRValuesOffset);
|
||||
p_anm->mCGValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mCGValuesOffset);
|
||||
p_anm->mCBValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mCBValuesOffset);
|
||||
p_anm->mCAValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mCAValuesOffset);
|
||||
p_anm->mCRValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mCRValuesOffset);
|
||||
p_anm->mCGValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mCGValuesOffset);
|
||||
p_anm->mCBValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mCBValuesOffset);
|
||||
p_anm->mCAValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mCAValuesOffset);
|
||||
p_anm->field_0x1c = p_data->field_0x18;
|
||||
p_anm->field_0x1e = p_data->field_0x1a;
|
||||
p_anm->field_0x20 = p_data->field_0x1c;
|
||||
p_anm->field_0x22 = p_data->field_0x1e;
|
||||
p_anm->mKRValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mKRValuesOffset);
|
||||
p_anm->mKGValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mKGValuesOffset);
|
||||
p_anm->mKBValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mKBValuesOffset);
|
||||
p_anm->mKAValues = JSUConvertOffsetToPtr<s16>(p_data, p_data->mKAValuesOffset);
|
||||
p_anm->mKRValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mKRValuesOffset);
|
||||
p_anm->mKGValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mKGValuesOffset);
|
||||
p_anm->mKBValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mKBValuesOffset);
|
||||
p_anm->mKAValues = JSUConvertOffsetToPtr<BE(s16)>(p_data, p_data->mKAValuesOffset);
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::readAnmVisibility(J3DAnmVisibilityFullData const* p_data) {
|
||||
@@ -556,9 +533,9 @@ void J2DAnmFullLoader_v15::setAnmVtxColor(J2DAnmVtxColorFull* p_anm,
|
||||
p_anm->mVtxColorIndexData[1] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>(
|
||||
p_data, p_data->mVtxColorIndexDataOffsets[1]);
|
||||
p_anm->mVtxColorIndexPointer[0] =
|
||||
JSUConvertOffsetToPtr<u16>(p_data, p_data->mVtxColorIndexPointerOffsets[0]);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mVtxColorIndexPointerOffsets[0]);
|
||||
p_anm->mVtxColorIndexPointer[1] =
|
||||
JSUConvertOffsetToPtr<u16>(p_data, p_data->mVtxColorIndexPointerOffsets[1]);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(p_data, p_data->mVtxColorIndexPointerOffsets[1]);
|
||||
p_anm->mRValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mRValuesOffset);
|
||||
p_anm->mGValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mGValuesOffset);
|
||||
p_anm->mBValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mBValuesOffset);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "JSystem/JUtility/JUTTexture.h"
|
||||
#include <gx.h>
|
||||
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
void J2DColorBlock::initialize() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mMatColor[i] = JUtility::TColor(j2dDefaultColInfo);
|
||||
@@ -56,7 +58,7 @@ void J2DTexGenBlock::setGX() {
|
||||
|
||||
J2DTexGenBlock::~J2DTexGenBlock() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
delete mTexMtx[i];
|
||||
JKR_DELETE(mTexMtx[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +66,7 @@ void J2DTexGenBlock::setTexMtx(u32 param_0, J2DTexMtx& param_1) {
|
||||
J3D_PANIC(103, param_0 < 8, "Error : range over.");
|
||||
|
||||
if (!mTexMtx[param_0]) {
|
||||
mTexMtx[param_0] = new J2DTexMtx(param_1.getTexMtxInfo());
|
||||
mTexMtx[param_0] = JKR_NEW J2DTexMtx(param_1.getTexMtxInfo());
|
||||
if (!mTexMtx[param_0]) {
|
||||
return;
|
||||
}
|
||||
@@ -101,13 +103,13 @@ J2DTevBlock1::J2DTevBlock1() {
|
||||
|
||||
J2DTevBlock1::~J2DTevBlock1() {
|
||||
if (mUndeleteFlag & 1) {
|
||||
delete mTexture[0];
|
||||
JKR_DELETE(mTexture[0]);
|
||||
}
|
||||
|
||||
delete mPalette[0];
|
||||
JKR_DELETE(mPalette[0]);
|
||||
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +141,7 @@ bool J2DTevBlock1::prepareTexture(u8 param_0) {
|
||||
}
|
||||
|
||||
if (mTexture[0] == NULL) {
|
||||
mTexture[0] = new JUTTexture();
|
||||
mTexture[0] = JKR_NEW JUTTexture();
|
||||
|
||||
if (mTexture[0] == NULL) {
|
||||
return false;
|
||||
@@ -166,7 +168,7 @@ bool J2DTevBlock1::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
}
|
||||
|
||||
if (mTexture[0] == NULL) {
|
||||
mTexture[0] = new JUTTexture(p_timg, 0);
|
||||
mTexture[0] = JKR_NEW JUTTexture(p_timg, 0);
|
||||
|
||||
if (mTexture[0] == NULL) {
|
||||
return false;
|
||||
@@ -197,7 +199,7 @@ bool J2DTevBlock1::insertTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 1) {
|
||||
delete mTexture[0];
|
||||
JKR_DELETE(mTexture[0]);
|
||||
}
|
||||
|
||||
mTexture[0] = p_tex;
|
||||
@@ -214,7 +216,7 @@ bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
|
||||
if (mTexture[0] == NULL) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[0] = new JUTTexture(p_timg, 0);
|
||||
mTexture[0] = JKR_NEW JUTTexture(p_timg, 0);
|
||||
|
||||
if (mTexture[0] == NULL) {
|
||||
return false;
|
||||
@@ -228,7 +230,7 @@ bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[0]->storeTIMG(p_timg, (u8)0);
|
||||
} else {
|
||||
delete mTexture[0];
|
||||
JKR_DELETE(mTexture[0]);
|
||||
mTexture[0] = NULL;
|
||||
mUndeleteFlag &= 0x80;
|
||||
}
|
||||
@@ -236,7 +238,7 @@ bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
mTexture[0] = NULL;
|
||||
|
||||
if (p_timg != NULL) {
|
||||
mTexture[0] = new JUTTexture(p_timg, 0);
|
||||
mTexture[0] = JKR_NEW JUTTexture(p_timg, 0);
|
||||
|
||||
if (mTexture[0] == NULL) {
|
||||
return false;
|
||||
@@ -246,7 +248,7 @@ bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
}
|
||||
}
|
||||
|
||||
delete mPalette[0];
|
||||
JKR_DELETE(mPalette[0]);
|
||||
mPalette[0] = NULL;
|
||||
mTexNo[0] = -1;
|
||||
return true;
|
||||
@@ -258,12 +260,12 @@ bool J2DTevBlock1::setTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 1) {
|
||||
delete mTexture[0];
|
||||
JKR_DELETE(mTexture[0]);
|
||||
}
|
||||
|
||||
mTexture[0] = p_tex;
|
||||
mUndeleteFlag &= 0x80;
|
||||
delete mPalette[0];
|
||||
JKR_DELETE(mPalette[0]);
|
||||
mPalette[0] = NULL;
|
||||
mTexNo[0] = -1;
|
||||
return true;
|
||||
@@ -275,12 +277,12 @@ bool J2DTevBlock1::removeTexture(u32 param_0) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 1) {
|
||||
delete mTexture[0];
|
||||
JKR_DELETE(mTexture[0]);
|
||||
}
|
||||
|
||||
mTexture[0] = NULL;
|
||||
mUndeleteFlag &= 0x80;
|
||||
delete mPalette[0];
|
||||
JKR_DELETE(mPalette[0]);
|
||||
mTexNo[0] = -1;
|
||||
return true;
|
||||
}
|
||||
@@ -290,13 +292,13 @@ bool J2DTevBlock1::setFont(ResFONT* p_font) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JUTResFont* resFont = new JUTResFont(p_font, NULL);
|
||||
JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL);
|
||||
if (resFont == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = resFont;
|
||||
@@ -310,7 +312,7 @@ bool J2DTevBlock1::setFont(JUTFont* p_font) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = (JUTResFont*)p_font;
|
||||
@@ -325,7 +327,7 @@ bool J2DTevBlock1::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
|
||||
if (p_tlut != NULL) {
|
||||
if (mPalette[0] == NULL) {
|
||||
mPalette[0] = new JUTPalette(GX_TLUT0, (ResTLUT*)p_tlut);
|
||||
mPalette[0] = JKR_NEW JUTPalette(GX_TLUT0, (ResTLUT*)p_tlut);
|
||||
|
||||
if (mPalette[0] == NULL) {
|
||||
return false;
|
||||
@@ -338,7 +340,7 @@ bool J2DTevBlock1::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
mTexture[0]->attachPalette(mPalette[0]);
|
||||
}
|
||||
} else {
|
||||
delete mPalette[0];
|
||||
JKR_DELETE(mPalette[0]);
|
||||
mPalette[0] = NULL;
|
||||
}
|
||||
|
||||
@@ -403,18 +405,18 @@ J2DTevBlock2::J2DTevBlock2() {
|
||||
|
||||
J2DTevBlock2::~J2DTevBlock2() {
|
||||
if (mUndeleteFlag & 1) {
|
||||
delete mTexture[0];
|
||||
JKR_DELETE(mTexture[0]);
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 2) {
|
||||
delete mTexture[1];
|
||||
JKR_DELETE(mTexture[1]);
|
||||
}
|
||||
|
||||
delete mPalette[0];
|
||||
delete mPalette[1];
|
||||
JKR_DELETE(mPalette[0]);
|
||||
JKR_DELETE(mPalette[1]);
|
||||
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,7 +456,7 @@ bool J2DTevBlock2::prepareTexture(u8 param_0) {
|
||||
}
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
mTexture[i] = new JUTTexture();
|
||||
mTexture[i] = JKR_NEW JUTTexture();
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
return false;
|
||||
@@ -499,7 +501,7 @@ bool J2DTevBlock2::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
|
||||
JUTTexture* tex;
|
||||
if (mTexture[texNo] == NULL) {
|
||||
tex = new JUTTexture(p_timg, tlutid);
|
||||
tex = JKR_NEW JUTTexture(p_timg, tlutid);
|
||||
|
||||
if (tex == NULL) {
|
||||
return false;
|
||||
@@ -575,7 +577,7 @@ bool J2DTevBlock2::insertTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
|
||||
if (mTexture[1] != NULL && mTexture[1]->getTexInfo() == NULL) {
|
||||
if (mUndeleteFlag & 2) {
|
||||
delete mTexture[1];
|
||||
JKR_DELETE(mTexture[1]);
|
||||
}
|
||||
|
||||
mUndeleteFlag &= ~2;
|
||||
@@ -617,7 +619,7 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0] = new JUTTexture(p_timg, tlutid);
|
||||
mTexture[param_0] = JKR_NEW JUTTexture(p_timg, tlutid);
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -631,7 +633,7 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0]->storeTIMG(p_timg, tlutid);
|
||||
} else {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
mTexture[param_0] = NULL;
|
||||
mUndeleteFlag &= ~(1 << param_0);
|
||||
}
|
||||
@@ -639,7 +641,7 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
mTexture[param_0] = NULL;
|
||||
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0] = new JUTTexture(p_timg, 0);
|
||||
mTexture[param_0] = JKR_NEW JUTTexture(p_timg, 0);
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -649,7 +651,7 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
}
|
||||
}
|
||||
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
mTexNo[param_0] = -1;
|
||||
return true;
|
||||
@@ -661,12 +663,12 @@ bool J2DTevBlock2::setTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & (1 << param_0)) {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
}
|
||||
|
||||
mTexture[param_0] = p_tex;
|
||||
mUndeleteFlag &= ~(1 << param_0);
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
mTexNo[param_0] = -1;
|
||||
return true;
|
||||
@@ -678,9 +680,9 @@ bool J2DTevBlock2::removeTexture(u32 param_0) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & (1 << param_0)) {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
}
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
|
||||
if (param_0 == 0) {
|
||||
mTexture[0] = mTexture[1];
|
||||
@@ -700,13 +702,13 @@ bool J2DTevBlock2::setFont(ResFONT* p_font) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JUTResFont* resFont = new JUTResFont(p_font, NULL);
|
||||
JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL);
|
||||
if (resFont == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = resFont;
|
||||
@@ -720,7 +722,7 @@ bool J2DTevBlock2::setFont(JUTFont* p_font) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = (JUTResFont*)p_font;
|
||||
@@ -735,7 +737,7 @@ bool J2DTevBlock2::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
|
||||
if (p_tlut != NULL) {
|
||||
if (mPalette[param_0] == NULL) {
|
||||
mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut);
|
||||
mPalette[param_0] = JKR_NEW JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut);
|
||||
|
||||
if (mPalette[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -748,7 +750,7 @@ bool J2DTevBlock2::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
mTexture[param_0]->attachPalette(mPalette[param_0]);
|
||||
}
|
||||
} else {
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
}
|
||||
|
||||
@@ -841,13 +843,13 @@ J2DTevBlock4::J2DTevBlock4() {
|
||||
J2DTevBlock4::~J2DTevBlock4() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (mUndeleteFlag & (1 << i)) {
|
||||
delete mTexture[i];
|
||||
JKR_DELETE(mTexture[i]);
|
||||
}
|
||||
delete mPalette[i];
|
||||
JKR_DELETE(mPalette[i]);
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -892,7 +894,7 @@ bool J2DTevBlock4::prepareTexture(u8 param_0) {
|
||||
}
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
mTexture[i] = new JUTTexture();
|
||||
mTexture[i] = JKR_NEW JUTTexture();
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
return false;
|
||||
@@ -949,7 +951,7 @@ bool J2DTevBlock4::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
}
|
||||
JUTTexture* texture;
|
||||
if (!mTexture[idx]) {
|
||||
texture = new JUTTexture(p_timg, local_43);
|
||||
texture = JKR_NEW JUTTexture(p_timg, local_43);
|
||||
if (!texture) {
|
||||
return false;
|
||||
}
|
||||
@@ -1017,7 +1019,7 @@ bool J2DTevBlock4::insertTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
|
||||
if (mTexture[3] != NULL && mTexture[3]->getTexInfo() == NULL) {
|
||||
if (mUndeleteFlag & 8) {
|
||||
delete mTexture[3];
|
||||
JKR_DELETE(mTexture[3]);
|
||||
}
|
||||
|
||||
mUndeleteFlag &= ~8;
|
||||
@@ -1069,7 +1071,7 @@ bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0] = new JUTTexture(p_timg, tlutid);
|
||||
mTexture[param_0] = JKR_NEW JUTTexture(p_timg, tlutid);
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -1083,7 +1085,7 @@ bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0]->storeTIMG(p_timg, tlutid);
|
||||
} else {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
mTexture[param_0] = NULL;
|
||||
mUndeleteFlag &= ~(1 << param_0);
|
||||
}
|
||||
@@ -1091,7 +1093,7 @@ bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
mTexture[param_0] = NULL;
|
||||
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0] = new JUTTexture(p_timg, 0);
|
||||
mTexture[param_0] = JKR_NEW JUTTexture(p_timg, 0);
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -1101,7 +1103,7 @@ bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
}
|
||||
}
|
||||
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
mTexNo[param_0] = -1;
|
||||
return true;
|
||||
@@ -1113,12 +1115,12 @@ bool J2DTevBlock4::setTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & (1 << param_0)) {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
}
|
||||
|
||||
mTexture[param_0] = p_tex;
|
||||
mUndeleteFlag &= ~(1 << param_0);
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
mTexNo[param_0] = -1;
|
||||
return true;
|
||||
@@ -1130,9 +1132,9 @@ bool J2DTevBlock4::removeTexture(u32 param_0) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & (1 << param_0)) {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
}
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
|
||||
for (u32 i = param_0; i < 3; i++) {
|
||||
mTexture[i] = mTexture[i + 1];
|
||||
@@ -1152,13 +1154,13 @@ bool J2DTevBlock4::setFont(ResFONT* p_font) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JUTResFont* resFont = new JUTResFont(p_font, NULL);
|
||||
JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL);
|
||||
if (resFont == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = resFont;
|
||||
@@ -1172,7 +1174,7 @@ bool J2DTevBlock4::setFont(JUTFont* p_font) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = (JUTResFont*)p_font;
|
||||
@@ -1187,7 +1189,7 @@ bool J2DTevBlock4::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
|
||||
if (p_tlut != NULL) {
|
||||
if (mPalette[param_0] == NULL) {
|
||||
mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut);
|
||||
mPalette[param_0] = JKR_NEW JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut);
|
||||
|
||||
if (mPalette[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -1200,7 +1202,7 @@ bool J2DTevBlock4::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
mTexture[param_0]->attachPalette(mPalette[param_0]);
|
||||
}
|
||||
} else {
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
}
|
||||
|
||||
@@ -1285,13 +1287,13 @@ J2DTevBlock8::J2DTevBlock8() {
|
||||
J2DTevBlock8::~J2DTevBlock8() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (mUndeleteFlag & (1 << i)) {
|
||||
delete mTexture[i];
|
||||
JKR_DELETE(mTexture[i]);
|
||||
}
|
||||
delete mPalette[i];
|
||||
JKR_DELETE(mPalette[i]);
|
||||
}
|
||||
|
||||
if (mFontUndeleteFlag) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1337,7 +1339,7 @@ bool J2DTevBlock8::prepareTexture(u8 param_0) {
|
||||
}
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
mTexture[i] = new JUTTexture();
|
||||
mTexture[i] = JKR_NEW JUTTexture();
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
return false;
|
||||
@@ -1394,7 +1396,7 @@ bool J2DTevBlock8::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
}
|
||||
JUTTexture* texture;
|
||||
if (!mTexture[idx]) {
|
||||
texture = new JUTTexture(p_timg, local_43);
|
||||
texture = JKR_NEW JUTTexture(p_timg, local_43);
|
||||
if (!texture) {
|
||||
return false;
|
||||
}
|
||||
@@ -1462,7 +1464,7 @@ bool J2DTevBlock8::insertTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
|
||||
if (mTexture[7] != NULL && mTexture[7]->getTexInfo() == NULL) {
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mTexture[7];
|
||||
JKR_DELETE(mTexture[7]);
|
||||
}
|
||||
|
||||
mUndeleteFlag &= ~0x80;
|
||||
@@ -1514,7 +1516,7 @@ bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0] = new JUTTexture(p_timg, tlutid);
|
||||
mTexture[param_0] = JKR_NEW JUTTexture(p_timg, tlutid);
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -1528,7 +1530,7 @@ bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0]->storeTIMG(p_timg, tlutid);
|
||||
} else {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
mTexture[param_0] = NULL;
|
||||
mUndeleteFlag &= ~(1 << param_0);
|
||||
}
|
||||
@@ -1536,7 +1538,7 @@ bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
mTexture[param_0] = NULL;
|
||||
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0] = new JUTTexture(p_timg, 0);
|
||||
mTexture[param_0] = JKR_NEW JUTTexture(p_timg, 0);
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -1546,7 +1548,7 @@ bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
}
|
||||
}
|
||||
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
mTexNo[param_0] = -1;
|
||||
return true;
|
||||
@@ -1558,12 +1560,12 @@ bool J2DTevBlock8::setTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & (1 << param_0)) {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
}
|
||||
|
||||
mTexture[param_0] = p_tex;
|
||||
mUndeleteFlag &= ~(1 << param_0);
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
mTexNo[param_0] = -1;
|
||||
return true;
|
||||
@@ -1575,9 +1577,9 @@ bool J2DTevBlock8::removeTexture(u32 param_0) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & (1 << param_0)) {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
}
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
|
||||
for (u32 i = param_0; i < 7; i++) {
|
||||
mTexture[i] = mTexture[i + 1];
|
||||
@@ -1597,13 +1599,13 @@ bool J2DTevBlock8::setFont(ResFONT* p_font) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JUTResFont* resFont = new JUTResFont(p_font, NULL);
|
||||
JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL);
|
||||
if (resFont == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mFontUndeleteFlag) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = resFont;
|
||||
@@ -1617,7 +1619,7 @@ bool J2DTevBlock8::setFont(JUTFont* p_font) {
|
||||
}
|
||||
|
||||
if (mFontUndeleteFlag) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = (JUTResFont*)p_font;
|
||||
@@ -1632,7 +1634,7 @@ bool J2DTevBlock8::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
|
||||
if (p_tlut != NULL) {
|
||||
if (mPalette[param_0] == NULL) {
|
||||
mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut);
|
||||
mPalette[param_0] = JKR_NEW JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut);
|
||||
|
||||
if (mPalette[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -1645,7 +1647,7 @@ bool J2DTevBlock8::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
mTexture[param_0]->attachPalette(mPalette[param_0]);
|
||||
}
|
||||
} else {
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
}
|
||||
|
||||
@@ -1725,13 +1727,13 @@ J2DTevBlock16::J2DTevBlock16() {
|
||||
J2DTevBlock16::~J2DTevBlock16() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (mUndeleteFlag & (1 << i)) {
|
||||
delete mTexture[i];
|
||||
JKR_DELETE(mTexture[i]);
|
||||
}
|
||||
delete mPalette[i];
|
||||
JKR_DELETE(mPalette[i]);
|
||||
}
|
||||
|
||||
if (mFontUndeleteFlag) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1777,7 +1779,7 @@ bool J2DTevBlock16::prepareTexture(u8 param_0) {
|
||||
}
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
mTexture[i] = new JUTTexture();
|
||||
mTexture[i] = JKR_NEW JUTTexture();
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
return false;
|
||||
@@ -1834,7 +1836,7 @@ bool J2DTevBlock16::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette
|
||||
}
|
||||
JUTTexture* texture;
|
||||
if (!mTexture[idx]) {
|
||||
texture = new JUTTexture(p_timg, local_43);
|
||||
texture = JKR_NEW JUTTexture(p_timg, local_43);
|
||||
if (!texture) {
|
||||
return false;
|
||||
}
|
||||
@@ -1902,7 +1904,7 @@ bool J2DTevBlock16::insertTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
|
||||
if (mTexture[7] != NULL && mTexture[7]->getTexInfo() == NULL) {
|
||||
if (mUndeleteFlag & 0x80) {
|
||||
delete mTexture[7];
|
||||
JKR_DELETE(mTexture[7]);
|
||||
}
|
||||
|
||||
mUndeleteFlag &= ~0x80;
|
||||
@@ -1954,7 +1956,7 @@ bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0] = new JUTTexture(p_timg, tlutid);
|
||||
mTexture[param_0] = JKR_NEW JUTTexture(p_timg, tlutid);
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -1968,7 +1970,7 @@ bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0]->storeTIMG(p_timg, tlutid);
|
||||
} else {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
mTexture[param_0] = NULL;
|
||||
mUndeleteFlag &= ~(1 << param_0);
|
||||
}
|
||||
@@ -1976,7 +1978,7 @@ bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
mTexture[param_0] = NULL;
|
||||
|
||||
if (p_timg != NULL) {
|
||||
mTexture[param_0] = new JUTTexture(p_timg, 0);
|
||||
mTexture[param_0] = JKR_NEW JUTTexture(p_timg, 0);
|
||||
|
||||
if (mTexture[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -1986,7 +1988,7 @@ bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
}
|
||||
}
|
||||
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
mTexNo[param_0] = -1;
|
||||
return true;
|
||||
@@ -1998,12 +2000,12 @@ bool J2DTevBlock16::setTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & (1 << param_0)) {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
}
|
||||
|
||||
mTexture[param_0] = p_tex;
|
||||
mUndeleteFlag &= ~(1 << param_0);
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
mTexNo[param_0] = -1;
|
||||
return true;
|
||||
@@ -2015,9 +2017,9 @@ bool J2DTevBlock16::removeTexture(u32 param_0) {
|
||||
}
|
||||
|
||||
if (mUndeleteFlag & (1 << param_0)) {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
}
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
|
||||
for (u32 i = param_0; i < 7; i++) {
|
||||
mTexture[i] = mTexture[i + 1];
|
||||
@@ -2037,13 +2039,13 @@ bool J2DTevBlock16::setFont(ResFONT* p_font) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JUTResFont* resFont = new JUTResFont(p_font, NULL);
|
||||
JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL);
|
||||
if (resFont == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mFontUndeleteFlag) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = resFont;
|
||||
@@ -2057,7 +2059,7 @@ bool J2DTevBlock16::setFont(JUTFont* p_font) {
|
||||
}
|
||||
|
||||
if (mFontUndeleteFlag) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
mFont = (JUTResFont*)p_font;
|
||||
@@ -2072,7 +2074,7 @@ bool J2DTevBlock16::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
|
||||
if (p_tlut != NULL) {
|
||||
if (mPalette[param_0] == NULL) {
|
||||
mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut);
|
||||
mPalette[param_0] = JKR_NEW JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut);
|
||||
|
||||
if (mPalette[param_0] == NULL) {
|
||||
return false;
|
||||
@@ -2085,7 +2087,7 @@ bool J2DTevBlock16::setPalette(u32 param_0, ResTLUT const* p_tlut) {
|
||||
mTexture[param_0]->attachPalette(mPalette[param_0]);
|
||||
}
|
||||
} else {
|
||||
delete mPalette[param_0];
|
||||
JKR_DELETE(mPalette[param_0]);
|
||||
mPalette[param_0] = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ J2DMaterial::J2DMaterial() {
|
||||
}
|
||||
|
||||
J2DMaterial::~J2DMaterial() {
|
||||
delete mTevBlock;
|
||||
delete mIndBlock;
|
||||
delete mAnmPointer;
|
||||
JKR_DELETE(mTevBlock);
|
||||
JKR_DELETE(mIndBlock);
|
||||
JKR_DELETE(mAnmPointer);
|
||||
}
|
||||
|
||||
void J2DMaterial::setGX() {
|
||||
@@ -45,27 +45,27 @@ J2DTevBlock* J2DMaterial::createTevBlock(int block_type, bool noAlign) {
|
||||
|
||||
if (noAlign) {
|
||||
if (block_type <= 1) {
|
||||
block = new J2DTevBlock1();
|
||||
block = JKR_NEW J2DTevBlock1();
|
||||
} else if (block_type == 2) {
|
||||
block = new J2DTevBlock2();
|
||||
block = JKR_NEW J2DTevBlock2();
|
||||
} else if (block_type <= 4) {
|
||||
block = new J2DTevBlock4();
|
||||
block = JKR_NEW J2DTevBlock4();
|
||||
} else if (block_type <= 8) {
|
||||
block = new J2DTevBlock8();
|
||||
block = JKR_NEW J2DTevBlock8();
|
||||
} else {
|
||||
block = new J2DTevBlock16();
|
||||
block = JKR_NEW J2DTevBlock16();
|
||||
}
|
||||
} else {
|
||||
if (block_type <= 1) {
|
||||
block = new (-4) J2DTevBlock1();
|
||||
block = JKR_NEW_ARGS (-4) J2DTevBlock1();
|
||||
} else if (block_type == 2) {
|
||||
block = new (-4) J2DTevBlock2();
|
||||
block = JKR_NEW_ARGS (-4) J2DTevBlock2();
|
||||
} else if (block_type <= 4) {
|
||||
block = new (-4) J2DTevBlock4();
|
||||
block = JKR_NEW_ARGS (-4) J2DTevBlock4();
|
||||
} else if (block_type <= 8) {
|
||||
block = new (-4) J2DTevBlock8();
|
||||
block = JKR_NEW_ARGS (-4) J2DTevBlock8();
|
||||
} else {
|
||||
block = new (-4) J2DTevBlock16();
|
||||
block = JKR_NEW_ARGS (-4) J2DTevBlock16();
|
||||
}
|
||||
}
|
||||
ASSERTMSGLINE(101, block, "Error : allocate memory.");
|
||||
@@ -78,15 +78,15 @@ J2DIndBlock* J2DMaterial::createIndBlock(int block_type, bool noAlign) {
|
||||
|
||||
if (noAlign) {
|
||||
if (block_type != 0) {
|
||||
block = new J2DIndBlockFull();
|
||||
block = JKR_NEW J2DIndBlockFull();
|
||||
} else {
|
||||
block = new J2DIndBlockNull();
|
||||
block = JKR_NEW J2DIndBlockNull();
|
||||
}
|
||||
} else {
|
||||
if (block_type != 0) {
|
||||
block = new (-4) J2DIndBlockFull();
|
||||
block = JKR_NEW_ARGS (-4) J2DIndBlockFull();
|
||||
} else {
|
||||
block = new (-4) J2DIndBlockNull();
|
||||
block = JKR_NEW_ARGS (-4) J2DIndBlockNull();
|
||||
}
|
||||
}
|
||||
ASSERTMSGLINE(133, block, "Error : allocate memory.");
|
||||
@@ -122,7 +122,7 @@ void J2DMaterial::makeAnmPointer() {
|
||||
int r29;
|
||||
int r28;
|
||||
if (mAnmPointer == NULL) {
|
||||
mAnmPointer = new J2DMaterialAnmPointer();
|
||||
mAnmPointer = JKR_NEW J2DMaterialAnmPointer();
|
||||
r29 = 1;
|
||||
if (mAnmPointer == NULL) {
|
||||
OS_PANIC(171, "Error : allocate memory.");
|
||||
|
||||
@@ -228,7 +228,7 @@ J2DTexMtx* J2DMaterialFactory::newTexMtx(int param_0, int param_1) const {
|
||||
J2DTexMtx* rv = NULL;
|
||||
J2DMaterialInitData* iVar2 = &mpMaterialInitData[mpMaterialID[param_0]];
|
||||
if (iVar2->field_0x24[param_1] != 0xffff) {
|
||||
rv = new J2DTexMtx(mpTexMtxInfo[iVar2->field_0x24[param_1]]);
|
||||
rv = JKR_NEW J2DTexMtx(mpTexMtxInfo[iVar2->field_0x24[param_1]]);
|
||||
rv->calc();
|
||||
}
|
||||
return rv;
|
||||
|
||||
@@ -210,7 +210,7 @@ void J2DPane::changeUseTrans(J2DPane* p_pane) {
|
||||
J2DPane::~J2DPane() {
|
||||
JSUTreeIterator<J2DPane> iterator = mPaneTree.getFirstChild();
|
||||
for (; iterator != mPaneTree.getEndChild();) {
|
||||
delete (iterator++).getObject();
|
||||
JKR_DELETE((iterator++).getObject());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,12 +208,12 @@ void J2DPicture::private_readStream(J2DPane* parent, JSURandomInputStream* strea
|
||||
field_0x109 = 1;
|
||||
|
||||
if (img != NULL) {
|
||||
mTexture[0] = new JUTTexture(img, 0);
|
||||
mTexture[0] = JKR_NEW JUTTexture(img, 0);
|
||||
mTextureNum++;
|
||||
}
|
||||
|
||||
if (lut != NULL) {
|
||||
mPalette = new JUTPalette(GX_TLUT0, lut);
|
||||
mPalette = JKR_NEW JUTPalette(GX_TLUT0, lut);
|
||||
mTexture[0]->attachPalette(mPalette);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ void J2DPicture::private_initiate(const ResTIMG* timg, const ResTLUT* tlut) {
|
||||
|
||||
if (timg != NULL) {
|
||||
if (mTexture[0] == NULL) {
|
||||
mTexture[0] = new JUTTexture(timg, 0);
|
||||
mTexture[0] = JKR_NEW JUTTexture(timg, 0);
|
||||
if (mTexture[0] != NULL) {
|
||||
mTextureNum++;
|
||||
field_0x109 = (field_0x109 & 2) | 1;
|
||||
@@ -251,7 +251,7 @@ void J2DPicture::private_initiate(const ResTIMG* timg, const ResTLUT* tlut) {
|
||||
|
||||
mPalette = NULL;
|
||||
if (tlut && mPalette == NULL) {
|
||||
mPalette = new JUTPalette(GX_TLUT0, const_cast<ResTLUT*>(tlut));
|
||||
mPalette = JKR_NEW JUTPalette(GX_TLUT0, const_cast<ResTLUT*>(tlut));
|
||||
if (mTexture[0] != NULL) {
|
||||
mTexture[0]->attachPalette(mPalette);
|
||||
}
|
||||
@@ -272,11 +272,11 @@ void J2DPicture::initinfo() {
|
||||
J2DPicture::~J2DPicture() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if ((int)(field_0x109 & 1 << i) != 0) {
|
||||
delete mTexture[i];
|
||||
JKR_DELETE(mTexture[i]);
|
||||
}
|
||||
}
|
||||
|
||||
delete mPalette;
|
||||
JKR_DELETE(mPalette);
|
||||
}
|
||||
|
||||
bool J2DPicture::prepareTexture(u8 param_0) {
|
||||
@@ -286,7 +286,7 @@ bool J2DPicture::prepareTexture(u8 param_0) {
|
||||
}
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
mTexture[i] = new JUTTexture();
|
||||
mTexture[i] = JKR_NEW JUTTexture();
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
return 0;
|
||||
@@ -309,7 +309,7 @@ bool J2DPicture::insert(ResTIMG const* img, JUTPalette* palette, u8 param_2, f32
|
||||
|
||||
JUTTexture* var_r31;
|
||||
if (mTexture[mTextureNum] == NULL) {
|
||||
var_r31 = new JUTTexture(img, var_r26);
|
||||
var_r31 = JKR_NEW JUTTexture(img, var_r26);
|
||||
|
||||
if (palette != NULL) {
|
||||
var_r31->storeTIMG(img, palette);
|
||||
@@ -381,7 +381,7 @@ bool J2DPicture::insert(JUTTexture* texture, u8 param_1, f32 param_2) {
|
||||
}
|
||||
|
||||
if (mTexture[1] != NULL && field_0x109 & 2) {
|
||||
delete mTexture[1];
|
||||
JKR_DELETE(mTexture[1]);
|
||||
field_0x109 &= 1;
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ bool J2DPicture::remove(u8 param_0) {
|
||||
}
|
||||
|
||||
if (field_0x109 & (1 << param_0)) {
|
||||
delete mTexture[param_0];
|
||||
JKR_DELETE(mTexture[param_0]);
|
||||
}
|
||||
|
||||
for (u8 i = param_0; i < mTextureNum - 1; i++) {
|
||||
|
||||
@@ -62,7 +62,7 @@ J2DPictureEx::J2DPictureEx(J2DPane* param_0, JSURandomInputStream* param_1, u32
|
||||
|
||||
J2DPictureEx::~J2DPictureEx() {
|
||||
if (field_0x190) {
|
||||
delete mMaterial;
|
||||
JKR_DELETE(mMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1136,11 +1136,11 @@ void J2DPictureEx::setAnimation(J2DAnmVtxColor* anm) {
|
||||
for (u16 j = 0; j < anm_table_num; j++) {
|
||||
#if DEBUG
|
||||
J3DAnmVtxColorIndexData* data = anm->getAnmVtxColorIndexData(0, j);
|
||||
u16* index2 = anm->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData;
|
||||
BE(u16)* index2 = anm->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData;
|
||||
#else
|
||||
J3DAnmVtxColorIndexData* data = anm->getAnmVtxColorIndexData(0, j);
|
||||
u16* index = anm->getVtxColorIndexPointer(0);
|
||||
u16* index2 = index + (uintptr_t)data->mpData;
|
||||
BE(u16)* index = anm->getVtxColorIndexPointer(0);
|
||||
BE(u16)* index2 = index + (uintptr_t)data->mpData;
|
||||
#endif
|
||||
for (u16 k = 0; k < data->mNum; k++) {
|
||||
if (index2[k] == field_0x158[i]) {
|
||||
@@ -1177,7 +1177,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) + (uintptr_t)data->mpData;
|
||||
BE(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]);
|
||||
|
||||
@@ -90,10 +90,10 @@ u8* J2DPrint::setBuffer(size_t size) {
|
||||
|
||||
u8* u8Buff = (u8*)mStrBuff;
|
||||
if (sStrBufInitialized) {
|
||||
delete mStrBuff;
|
||||
JKR_DELETE(mStrBuff);
|
||||
}
|
||||
|
||||
mStrBuff = new (JKRGetSystemHeap(), 0) char[size];
|
||||
mStrBuff = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) char[size];
|
||||
mStrBuffSize = size;
|
||||
sStrBufInitialized = true;
|
||||
return u8Buff;
|
||||
|
||||
@@ -27,19 +27,19 @@ J2DScreen::~J2DScreen() {
|
||||
}
|
||||
|
||||
void J2DScreen::clean() {
|
||||
delete[] mMaterials;
|
||||
JKR_DELETE_ARRAY(mMaterials);
|
||||
mMaterialNum = 0;
|
||||
mMaterials = NULL;
|
||||
|
||||
delete[] mTexRes;
|
||||
JKR_DELETE_ARRAY(mTexRes);
|
||||
mTexRes = NULL;
|
||||
|
||||
delete[] mFontRes;
|
||||
JKR_DELETE_ARRAY(mFontRes);
|
||||
mFontRes = NULL;
|
||||
|
||||
if (mNameTable != NULL) {
|
||||
delete[] mNameTable->getResNameTable();
|
||||
delete mNameTable;
|
||||
JKR_DELETE_ARRAY(mNameTable->getResNameTable());
|
||||
JKR_DELETE(mNameTable);
|
||||
mNameTable = NULL;
|
||||
}
|
||||
}
|
||||
@@ -176,40 +176,40 @@ J2DPane* J2DScreen::createPane(J2DScrnBlockHeader const& header, JSURandomInputS
|
||||
|
||||
switch (header.mTag) {
|
||||
case 'PAN1':
|
||||
newPane = new J2DPane(p_basePane, p_stream, 0);
|
||||
newPane = JKR_NEW J2DPane(p_basePane, p_stream, 0);
|
||||
break;
|
||||
case 'WIN1':
|
||||
newPane = new J2DWindow(p_basePane, p_stream, p_archive);
|
||||
newPane = JKR_NEW J2DWindow(p_basePane, p_stream, p_archive);
|
||||
break;
|
||||
case 'PIC1':
|
||||
newPane = new J2DPicture(p_basePane, p_stream, p_archive);
|
||||
newPane = JKR_NEW J2DPicture(p_basePane, p_stream, p_archive);
|
||||
break;
|
||||
case 'TBX1':
|
||||
newPane = new J2DTextBox(p_basePane, p_stream, p_archive);
|
||||
newPane = JKR_NEW J2DTextBox(p_basePane, p_stream, p_archive);
|
||||
break;
|
||||
case 'PAN2':
|
||||
newPane = new J2DPane(p_basePane, p_stream, 1);
|
||||
newPane = JKR_NEW J2DPane(p_basePane, p_stream, 1);
|
||||
break;
|
||||
case 'WIN2':
|
||||
if (param_3 & 0x1F0000) {
|
||||
newPane = new J2DWindowEx(p_basePane, p_stream, param_3, mMaterials);
|
||||
newPane = JKR_NEW J2DWindowEx(p_basePane, p_stream, param_3, mMaterials);
|
||||
break;
|
||||
}
|
||||
newPane = new J2DWindow(p_basePane, p_stream, mMaterials);
|
||||
newPane = JKR_NEW J2DWindow(p_basePane, p_stream, mMaterials);
|
||||
break;
|
||||
case 'PIC2':
|
||||
if (param_3 & 0x1F0000) {
|
||||
newPane = new J2DPictureEx(p_basePane, p_stream, param_3, mMaterials);
|
||||
newPane = JKR_NEW J2DPictureEx(p_basePane, p_stream, param_3, mMaterials);
|
||||
break;
|
||||
}
|
||||
newPane = new J2DPicture(p_basePane, p_stream, mMaterials);
|
||||
newPane = JKR_NEW J2DPicture(p_basePane, p_stream, mMaterials);
|
||||
break;
|
||||
case 'TBX2':
|
||||
if (param_3 & 0x1F0000) {
|
||||
newPane = new J2DTextBoxEx(p_basePane, p_stream, param_3, mMaterials);
|
||||
newPane = JKR_NEW J2DTextBoxEx(p_basePane, p_stream, param_3, mMaterials);
|
||||
break;
|
||||
}
|
||||
newPane = new J2DTextBox(p_basePane, p_stream, param_3, mMaterials);
|
||||
newPane = JKR_NEW J2DTextBox(p_basePane, p_stream, param_3, mMaterials);
|
||||
break;
|
||||
default:
|
||||
JUT_WARN(446, "%s", "unknown pane");
|
||||
@@ -217,7 +217,7 @@ J2DPane* J2DScreen::createPane(J2DScrnBlockHeader const& header, JSURandomInputS
|
||||
s32 size = header.mSize;
|
||||
s32 start = size + position;
|
||||
|
||||
newPane = new J2DPane(p_basePane, p_stream, 0);
|
||||
newPane = JKR_NEW J2DPane(p_basePane, p_stream, 0);
|
||||
p_stream->seek(start, JSUStreamSeekFrom_SET);
|
||||
break;
|
||||
}
|
||||
@@ -321,9 +321,9 @@ J2DResReference* J2DScreen::getResReference(JSURandomInputStream* p_stream, u32
|
||||
|
||||
char* buffer;
|
||||
if (param_1 & 0x1F0000) {
|
||||
buffer = new char[size1];
|
||||
buffer = JKR_NEW char[size1];
|
||||
} else {
|
||||
buffer = new (-4) char[size1];
|
||||
buffer = JKR_NEW_ARGS (-4) char[size1];
|
||||
}
|
||||
|
||||
if (buffer != NULL) {
|
||||
@@ -343,12 +343,12 @@ bool J2DScreen::createMaterial(JSURandomInputStream* p_stream, u32 param_1, JKRA
|
||||
p_stream->skip(2);
|
||||
|
||||
if (param_1 & 0x1F0000) {
|
||||
mMaterials = new J2DMaterial[mMaterialNum];
|
||||
mMaterials = JKR_NEW J2DMaterial[mMaterialNum];
|
||||
} else {
|
||||
mMaterials = new (-4) J2DMaterial[mMaterialNum];
|
||||
mMaterials = JKR_NEW_ARGS (-4) J2DMaterial[mMaterialNum];
|
||||
}
|
||||
|
||||
u8* buffer = new (-4) u8[header.mSize];
|
||||
u8* buffer = JKR_NEW_ARGS (-4) u8[header.mSize];
|
||||
if (mMaterials != NULL && buffer != NULL) {
|
||||
J2DMaterialBlock* pBlock = (J2DMaterialBlock*)buffer;
|
||||
p_stream->seek(position, JSUStreamSeekFrom_SET);
|
||||
@@ -372,7 +372,7 @@ bool J2DScreen::createMaterial(JSURandomInputStream* p_stream, u32 param_1, JKRA
|
||||
}
|
||||
size++;
|
||||
|
||||
u8* nametab = new u8[size];
|
||||
u8* nametab = JKR_NEW u8[size];
|
||||
if (nametab == NULL) {
|
||||
goto failure;
|
||||
}
|
||||
@@ -380,20 +380,20 @@ bool J2DScreen::createMaterial(JSURandomInputStream* p_stream, u32 param_1, JKRA
|
||||
nametab[i] = (buffer + offset)[i];
|
||||
}
|
||||
|
||||
mNameTable = new JUTNameTab((ResNTAB*)nametab);
|
||||
mNameTable = JKR_NEW JUTNameTab((ResNTAB*)nametab);
|
||||
if (mNameTable == NULL) {
|
||||
delete[] nametab;
|
||||
JKR_DELETE_ARRAY(nametab);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
||||
success:
|
||||
delete[] buffer;
|
||||
JKR_DELETE_ARRAY(buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
failure:
|
||||
delete[] buffer;
|
||||
JKR_DELETE_ARRAY(buffer);
|
||||
clean();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,13 +74,13 @@ J2DTextBox::J2DTextBox(J2DPane* p_pane, JSURandomInputStream* p_stream, u32 para
|
||||
mStringPtr = NULL;
|
||||
|
||||
if (strLength != 0) {
|
||||
mStringPtr = new char[strLength];
|
||||
mStringPtr = JKR_NEW char[strLength];
|
||||
}
|
||||
|
||||
if (mStringPtr != NULL) {
|
||||
mStringLength = strLength;
|
||||
|
||||
u16 var_r26_2 = strLength - 1 < info.field_0x1e ? u16(strLength - 1) : info.field_0x1e;
|
||||
u16 var_r26_2 = strLength - 1 < info.field_0x1e ? u16(strLength - 1) : (u16)info.field_0x1e;
|
||||
|
||||
p_stream->peek(mStringPtr, var_r26_2);
|
||||
mStringPtr[var_r26_2] = 0;
|
||||
@@ -121,7 +121,7 @@ J2DTextBox::J2DTextBox(u64 tag, JGeometry::TBox2<f32> const& bounds, ResFONT con
|
||||
void J2DTextBox::initiate(ResFONT const* p_font, char const* string, s16 length,
|
||||
J2DTextBoxHBinding hBind, J2DTextBoxVBinding vBind) {
|
||||
if (p_font != NULL) {
|
||||
mFont = new JUTResFont(p_font, NULL);
|
||||
mFont = JKR_NEW JUTResFont(p_font, NULL);
|
||||
}
|
||||
|
||||
mCharColor.set(0xFFFFFFFF);
|
||||
@@ -144,7 +144,7 @@ void J2DTextBox::initiate(ResFONT const* p_font, char const* string, s16 length,
|
||||
stringLen = len + 1;
|
||||
}
|
||||
|
||||
mStringPtr = new char[stringLen];
|
||||
mStringPtr = JKR_NEW char[stringLen];
|
||||
|
||||
if (stringLen != 0 && mStringPtr != NULL) {
|
||||
strncpy(mStringPtr, string, stringLen - 1);
|
||||
@@ -185,7 +185,7 @@ void J2DTextBox::private_readStream(J2DPane* p_pane, JSURandomInputStream* p_str
|
||||
|
||||
ResFONT* fontPtr = (ResFONT*)getPointer(p_stream, 'FONT', p_archive);
|
||||
if (fontPtr != NULL) {
|
||||
mFont = new JUTResFont(fontPtr, NULL);
|
||||
mFont = JKR_NEW JUTResFont(fontPtr, NULL);
|
||||
}
|
||||
|
||||
mCharColor.set(p_stream->read32b());
|
||||
@@ -198,7 +198,7 @@ void J2DTextBox::private_readStream(J2DPane* p_pane, JSURandomInputStream* p_str
|
||||
mFontSizeY = p_stream->read16b();
|
||||
|
||||
s16 stringLen = p_stream->read16b();
|
||||
mStringPtr = new char[stringLen + 1];
|
||||
mStringPtr = JKR_NEW char[stringLen + 1];
|
||||
|
||||
if (mStringPtr != NULL) {
|
||||
p_stream->read(mStringPtr, stringLen);
|
||||
@@ -240,16 +240,16 @@ void J2DTextBox::private_readStream(J2DPane* p_pane, JSURandomInputStream* p_str
|
||||
|
||||
J2DTextBox::~J2DTextBox() {
|
||||
if (mTextFontOwned) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
|
||||
delete[] mStringPtr;
|
||||
JKR_DELETE_ARRAY(mStringPtr);
|
||||
}
|
||||
|
||||
void J2DTextBox::setFont(JUTFont* p_font) {
|
||||
if (p_font) {
|
||||
if (mTextFontOwned) {
|
||||
delete mFont;
|
||||
JKR_DELETE(mFont);
|
||||
}
|
||||
mFont = p_font;
|
||||
mTextFontOwned = false;
|
||||
@@ -317,7 +317,7 @@ s32 J2DTextBox::setString(char const* string, ...) {
|
||||
va_list args;
|
||||
va_start(args, string);
|
||||
|
||||
delete[] mStringPtr;
|
||||
JKR_DELETE_ARRAY(mStringPtr);
|
||||
|
||||
u32 len = strlen(string);
|
||||
|
||||
@@ -326,7 +326,7 @@ s32 J2DTextBox::setString(char const* string, ...) {
|
||||
}
|
||||
|
||||
mStringLength = 0;
|
||||
mStringPtr = new char[len + 1];
|
||||
mStringPtr = JKR_NEW char[len + 1];
|
||||
|
||||
if (mStringPtr) {
|
||||
mStringLength = len + 1;
|
||||
@@ -341,7 +341,7 @@ s32 J2DTextBox::setString(s16 length, char const* string, ...) {
|
||||
va_list args;
|
||||
va_start(args, string);
|
||||
|
||||
delete[] mStringPtr;
|
||||
JKR_DELETE_ARRAY(mStringPtr);
|
||||
mStringPtr = NULL;
|
||||
|
||||
u32 len = strlen(string);
|
||||
@@ -357,7 +357,7 @@ s32 J2DTextBox::setString(s16 length, char const* string, ...) {
|
||||
mStringLength = 0;
|
||||
|
||||
if (stringLen != 0) {
|
||||
mStringPtr = new char[stringLen];
|
||||
mStringPtr = JKR_NEW char[stringLen];
|
||||
}
|
||||
|
||||
if (mStringPtr != NULL) {
|
||||
|
||||
@@ -65,13 +65,13 @@ J2DTextBoxEx::J2DTextBoxEx(J2DPane* p_pane, JSURandomInputStream* p_stream, u32
|
||||
mStringPtr = NULL;
|
||||
|
||||
if (strLength != 0) {
|
||||
mStringPtr = new char[strLength];
|
||||
mStringPtr = JKR_NEW char[strLength];
|
||||
}
|
||||
|
||||
if (mStringPtr != NULL) {
|
||||
mStringLength = strLength;
|
||||
|
||||
u16 var_r26_2 = strLength - 1 < info.field_0x1e ? u16(strLength - 1) : info.field_0x1e;
|
||||
u16 var_r26_2 = strLength - 1 < info.field_0x1e ? u16(strLength - 1) : (u16)info.field_0x1e;
|
||||
|
||||
p_stream->peek(mStringPtr, var_r26_2);
|
||||
mStringPtr[var_r26_2] = 0;
|
||||
@@ -88,7 +88,7 @@ J2DTextBoxEx::J2DTextBoxEx(J2DPane* p_pane, JSURandomInputStream* p_stream, u32
|
||||
|
||||
J2DTextBoxEx::~J2DTextBoxEx() {
|
||||
if (field_0x140 != 0) {
|
||||
delete mMaterial;
|
||||
JKR_DELETE(mMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,19 +150,19 @@ J2DWindow::J2DWindow(u64 param_0, const JGeometry::TBox2<f32>& param_1, const ch
|
||||
|
||||
void J2DWindow::initiate(const ResTIMG* param_0, const ResTIMG* param_1, const ResTIMG* param_2, const ResTIMG* param_3, const ResTLUT* param_4, J2DWindowMirror param_5, const JGeometry::TBox2<f32>& param_6) {
|
||||
if (param_0) {
|
||||
field_0x100 = new JUTTexture(param_0, 0);
|
||||
field_0x100 = JKR_NEW JUTTexture(param_0, 0);
|
||||
}
|
||||
if (param_1) {
|
||||
field_0x104 = new JUTTexture(param_1, 0);
|
||||
field_0x104 = JKR_NEW JUTTexture(param_1, 0);
|
||||
}
|
||||
if (param_2) {
|
||||
field_0x108 = new JUTTexture(param_2, 0);
|
||||
field_0x108 = JKR_NEW JUTTexture(param_2, 0);
|
||||
}
|
||||
if (param_3) {
|
||||
field_0x10c = new JUTTexture(param_3, 0);
|
||||
field_0x10c = JKR_NEW JUTTexture(param_3, 0);
|
||||
}
|
||||
if (param_4) {
|
||||
mPalette = new JUTPalette(GX_TLUT0, const_cast<ResTLUT*>(param_4));
|
||||
mPalette = JKR_NEW JUTPalette(GX_TLUT0, const_cast<ResTLUT*>(param_4));
|
||||
}
|
||||
field_0x144 = param_5;
|
||||
if (field_0x100 && field_0x104 && field_0x108 && field_0x10c) {
|
||||
@@ -189,23 +189,23 @@ void J2DWindow::private_readStream(J2DPane* param_0, JSURandomInputStream* param
|
||||
field_0x114.set(f31, f30, f29, f28);
|
||||
ResTIMG* timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2);
|
||||
if (timg) {
|
||||
field_0x100 = new JUTTexture(timg, 0);
|
||||
field_0x100 = JKR_NEW JUTTexture(timg, 0);
|
||||
}
|
||||
timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2);
|
||||
if (timg) {
|
||||
field_0x104 = new JUTTexture(timg, 0);
|
||||
field_0x104 = JKR_NEW JUTTexture(timg, 0);
|
||||
}
|
||||
timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2);
|
||||
if (timg) {
|
||||
field_0x108 = new JUTTexture(timg, 0);
|
||||
field_0x108 = JKR_NEW JUTTexture(timg, 0);
|
||||
}
|
||||
timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2);
|
||||
if (timg) {
|
||||
field_0x10c = new JUTTexture(timg, 0);
|
||||
field_0x10c = JKR_NEW JUTTexture(timg, 0);
|
||||
}
|
||||
ResTLUT* tlut = (ResTLUT*)getPointer(param_1, 'TLUT', param_2);
|
||||
if (tlut) {
|
||||
mPalette = new JUTPalette(GX_TLUT0, tlut);
|
||||
mPalette = JKR_NEW JUTPalette(GX_TLUT0, tlut);
|
||||
}
|
||||
field_0x144 = param_1->read8b();
|
||||
field_0x128.set(param_1->read32b());
|
||||
@@ -218,7 +218,7 @@ void J2DWindow::private_readStream(J2DPane* param_0, JSURandomInputStream* param
|
||||
int unused;
|
||||
timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2);
|
||||
if (timg) {
|
||||
field_0x110 = new JUTTexture(timg, 0);
|
||||
field_0x110 = JKR_NEW JUTTexture(timg, 0);
|
||||
}
|
||||
r27--;
|
||||
}
|
||||
@@ -288,12 +288,12 @@ J2DWindowMirror J2DWindow::convertMirror(J2DTextureBase texBase) {
|
||||
}
|
||||
|
||||
J2DWindow::~J2DWindow() {
|
||||
delete field_0x100;
|
||||
delete field_0x104;
|
||||
delete field_0x108;
|
||||
delete field_0x10c;
|
||||
delete mPalette;
|
||||
delete field_0x110;
|
||||
JKR_DELETE(field_0x100);
|
||||
JKR_DELETE(field_0x104);
|
||||
JKR_DELETE(field_0x108);
|
||||
JKR_DELETE(field_0x10c);
|
||||
JKR_DELETE(mPalette);
|
||||
JKR_DELETE(field_0x110);
|
||||
}
|
||||
|
||||
void J2DWindow::draw(JGeometry::TBox2<f32> const& param_0) {
|
||||
|
||||
@@ -112,12 +112,12 @@ void J2DWindowEx::setMinSize() {
|
||||
J2DWindowEx::~J2DWindowEx() {
|
||||
for (u8 i = 0; i < 4; i++) {
|
||||
if (field_0x170 & (1 << i)) {
|
||||
delete mFrameMaterial[i];
|
||||
JKR_DELETE(mFrameMaterial[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x170 & 0x10) {
|
||||
delete mContentsMaterial;
|
||||
JKR_DELETE(mContentsMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -759,7 +759,7 @@ void J2DWindowEx::setAnimation(J2DAnmVtxColor* param_0) {
|
||||
if (field_0x168[i] != 0xffff) {
|
||||
for (u16 j = 0; j < uVar3; j++) {
|
||||
J3DAnmVtxColorIndexData* puVar1 = param_0->getAnmVtxColorIndexData(0, j);
|
||||
u16* indexPointer2 =
|
||||
BE(u16)* indexPointer2 =
|
||||
param_0->getVtxColorIndexPointer(0) + (uintptr_t)puVar1->mpData;
|
||||
for (u16 k = 0; k < puVar1->mNum; k++) {
|
||||
if (indexPointer2[k] == field_0x168[i]) {
|
||||
@@ -803,7 +803,7 @@ const J2DAnmTransform* J2DWindowEx::animationPane(J2DAnmTransform const* param_0
|
||||
if ((field_0x17c & (1 << i))) {
|
||||
for (u16 j = 0; j < uVar3; j++) {
|
||||
J3DAnmVtxColorIndexData* puVar1 = mAnmVtxColor->getAnmVtxColorIndexData(0, j);
|
||||
u16* indexPointer2 =
|
||||
BE(u16)* indexPointer2 =
|
||||
mAnmVtxColor->getVtxColorIndexPointer(0) + (uintptr_t)puVar1->mpData;
|
||||
for (u16 k = 0; k < puVar1->mNum; k++) {
|
||||
if (indexPointer2[k] == field_0x168[i]) {
|
||||
|
||||
@@ -554,7 +554,7 @@ inline f32 J3DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER s16 const* pp2
|
||||
}
|
||||
// clang-format on
|
||||
return fout;
|
||||
#else
|
||||
#else
|
||||
f32 time1 = (f32)*pp2;
|
||||
f32 value1 = (f32)*pp3;
|
||||
f32 tangent1 = (f32)*pp4;
|
||||
@@ -583,6 +583,18 @@ inline f32 J3DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER s16 const* pp2
|
||||
#endif
|
||||
}
|
||||
|
||||
inline f32 J3DHermiteInterpolation(f32 p1, BE(f32) const* p2, BE(f32) const* p3, BE(f32) const* p4,
|
||||
BE(f32) const* p5, BE(f32) const* p6, BE(f32) const* p7) {
|
||||
return JMAHermiteInterpolation(p1, *p2, *p3, *p4, *p5, *p6, *p7);
|
||||
}
|
||||
|
||||
inline f32 J3DHermiteInterpolation(f32 pp1, BE(s16) const* pp2,
|
||||
BE(s16) const* pp3, BE(s16) const* pp4,
|
||||
BE(s16) const* pp5, BE(s16) const* pp6,
|
||||
BE(s16) const* pp7) {
|
||||
return JMAHermiteInterpolation(pp1, *pp2, *pp3, *pp4, *pp5, *pp6, *pp7);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
f32 J3DGetKeyFrameInterpolation(f32 frame, J3DAnmKeyTableBase* pKeyTable, T* pData) {
|
||||
J3D_ASSERT_NULLPTR(740, pData != NULL);
|
||||
|
||||
@@ -73,8 +73,8 @@ void J3DJointTree::findImportantMtxIndex() {
|
||||
s32 wEvlpMtxNum = getWEvlpMtxNum();
|
||||
u32 tableIdx = 0;
|
||||
u16 drawFullWgtMtxNum = getDrawFullWgtMtxNum();
|
||||
u16* wEvlpMixIndex = getWEvlpMixMtxIndex();
|
||||
f32* wEvlpMixWeight = getWEvlpMixWeight();
|
||||
BE(u16)* wEvlpMixIndex = getWEvlpMixMtxIndex();
|
||||
BE(f32)* wEvlpMixWeight = getWEvlpMixWeight();
|
||||
u16* wEvlpImportantMtxIdx = getWEvlpImportantMtxIndex();
|
||||
|
||||
// Rigid matrices are easy.
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
void J3DMaterialTable::clear() {
|
||||
@@ -153,7 +154,7 @@ int J3DMaterialTable::createTexMtxForAnimator(J3DAnmTextureSRTKey* pTexSRTKey) {
|
||||
rv = 1;
|
||||
} else {
|
||||
if (texMtx != 0xff && material->getTexMtx(texMtx) == NULL) {
|
||||
J3DTexMtx* mtx = new J3DTexMtx();
|
||||
J3DTexMtx* mtx = JKR_NEW J3DTexMtx();
|
||||
rv = 4;
|
||||
material->setTexMtx(texMtx, mtx);
|
||||
JUT_WARN(420, "matNo<%d> : texMtx%d nothing !\n", matNo, texMtx);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "JSystem/JKernel/JKRHeap.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)
|
||||
@@ -41,7 +42,7 @@ s32 J3DModel::entryModelData(J3DModelData* pModelData, u32 mdlFlags, u32 mtxNum)
|
||||
int ret = kJ3DError_Success;
|
||||
|
||||
mModelData = pModelData;
|
||||
mMtxBuffer = new J3DMtxBuffer();
|
||||
mMtxBuffer = JKR_NEW J3DMtxBuffer();
|
||||
|
||||
if (mMtxBuffer == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
@@ -99,7 +100,7 @@ s32 J3DModel::createShapePacket(J3DModelData* pModelData) {
|
||||
J3D_ASSERTMSG(173, pModelData != NULL, "Error : null pointer.");
|
||||
|
||||
if (pModelData->getShapeNum() != 0) {
|
||||
mShapePacket = new J3DShapePacket[pModelData->getShapeNum()];
|
||||
mShapePacket = JKR_NEW J3DShapePacket[pModelData->getShapeNum()];
|
||||
|
||||
if (mShapePacket == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
@@ -119,7 +120,7 @@ s32 J3DModel::createMatPacket(J3DModelData* pModelData, u32 mdlFlags) {
|
||||
s32 ret = 0;
|
||||
|
||||
if (pModelData->getMaterialNum() != 0) {
|
||||
mMatPacket = new J3DMatPacket[pModelData->getMaterialNum()];
|
||||
mMatPacket = JKR_NEW J3DMatPacket[pModelData->getMaterialNum()];
|
||||
|
||||
if (mMatPacket == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
|
||||
@@ -86,9 +86,9 @@ void J3DModelData::simpleCalcMaterial(u16 idx, Mtx param_1) {
|
||||
|
||||
void J3DModelData::syncJ3DSysPointers() const {
|
||||
j3dSys.setTexture(getTexture());
|
||||
j3dSys.setVtxPos(getVtxPosArray());
|
||||
j3dSys.setVtxNrm(getVtxNrmArray());
|
||||
j3dSys.setVtxCol(getVtxColorArray(0));
|
||||
j3dSys.setVtxPos(getVtxPosArray(), getVtxNum());
|
||||
j3dSys.setVtxNrm(getVtxNrmArray(), getNrmNum());
|
||||
j3dSys.setVtxCol(getVtxColorArray(0), getColNum());
|
||||
}
|
||||
|
||||
void J3DModelData::syncJ3DSysFlags() const {
|
||||
|
||||
@@ -93,8 +93,8 @@ s32 J3DMtxBuffer::create(J3DModelData* pModelData, u32 mtxNum) {
|
||||
|
||||
J3DError J3DMtxBuffer::createAnmMtx(J3DModelData* pModelData) {
|
||||
if (pModelData->getJointNum() != 0) {
|
||||
mpScaleFlagArr = new u8[pModelData->getJointNum()];
|
||||
mpAnmMtx = new Mtx[pModelData->getJointNum()];
|
||||
mpScaleFlagArr = JKR_NEW u8[pModelData->getJointNum()];
|
||||
mpAnmMtx = JKR_NEW Mtx[pModelData->getJointNum()];
|
||||
mpUserAnmMtx = mpAnmMtx;
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ J3DError J3DMtxBuffer::createAnmMtx(J3DModelData* pModelData) {
|
||||
|
||||
s32 J3DMtxBuffer::createWeightEnvelopeMtx(J3DModelData* pModelData) {
|
||||
if (pModelData->getWEvlpMtxNum() != 0) {
|
||||
mpEvlpScaleFlagArr = new u8[pModelData->getWEvlpMtxNum()];
|
||||
mpWeightEvlpMtx = new Mtx[pModelData->getWEvlpMtxNum()];
|
||||
mpEvlpScaleFlagArr = JKR_NEW u8[pModelData->getWEvlpMtxNum()];
|
||||
mpWeightEvlpMtx = JKR_NEW Mtx[pModelData->getWEvlpMtxNum()];
|
||||
}
|
||||
|
||||
if (pModelData->getWEvlpMtxNum() != 0 && mpEvlpScaleFlagArr == NULL)
|
||||
@@ -132,8 +132,8 @@ s32 J3DMtxBuffer::setNoUseDrawMtx() {
|
||||
s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* pModelData, u32 mtxNum) {
|
||||
if (mtxNum != 0) {
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
mpDrawMtxArr[i] = new Mtx*[mtxNum];
|
||||
mpNrmMtxArr[i] = new Mtx33*[mtxNum];
|
||||
mpDrawMtxArr[i] = JKR_NEW Mtx*[mtxNum];
|
||||
mpNrmMtxArr[i] = JKR_NEW Mtx33*[mtxNum];
|
||||
mpBumpMtxArr[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -150,8 +150,8 @@ s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* pModelData, u32 mtxNum) {
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
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()];
|
||||
mpDrawMtxArr[i][j] = JKR_NEW_ARGS (0x20) Mtx[pModelData->getDrawMtxNum()];
|
||||
mpNrmMtxArr[i][j] = JKR_NEW_ARGS (0x20) Mtx33[pModelData->getDrawMtxNum()];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) {
|
||||
|
||||
if (bumpMtxNum != 0 && mtxNum != 0) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpBumpMtxArr[i] = new Mtx33**[(u16)materialCount];
|
||||
mpBumpMtxArr[i] = JKR_NEW Mtx33**[(u16)materialCount];
|
||||
if (mpBumpMtxArr[i] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) {
|
||||
for (u16 j = 0; j < materialNum; j++) {
|
||||
J3DMaterial* material = i_modelData->getMaterialNodePointer(j);
|
||||
if (material->getNBTScale()->mbHasScale == true) {
|
||||
mpBumpMtxArr[i][offset] = new Mtx33*[mtxNum];
|
||||
mpBumpMtxArr[i][offset] = JKR_NEW Mtx33*[mtxNum];
|
||||
if (mpBumpMtxArr[i][offset] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) {
|
||||
J3DMaterial* material = i_modelData->getMaterialNodePointer((u16)j);
|
||||
if (material->getNBTScale()->mbHasScale == true) {
|
||||
for (int k = 0; k < mtxNum; k++) {
|
||||
mpBumpMtxArr[i][offset][k] = new (0x20) Mtx33[i_modelData->getDrawMtxNum()];
|
||||
mpBumpMtxArr[i][offset][k] = JKR_NEW_ARGS (0x20) Mtx33[i_modelData->getDrawMtxNum()];
|
||||
if (mpBumpMtxArr[i][offset][k] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -240,15 +240,15 @@ static f32 J3DUnit01[] = { 0.0f, 1.0f };
|
||||
void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
__REGISTER MtxP weightAnmMtx;
|
||||
__REGISTER Mtx* worldMtx;
|
||||
__REGISTER Mtx* invMtx;
|
||||
__REGISTER Mtx invMtx;
|
||||
__REGISTER f32 weight;
|
||||
int idx;
|
||||
int j;
|
||||
int mixNum;
|
||||
int i;
|
||||
int max;
|
||||
u16* indices;
|
||||
f32* weights;
|
||||
BE(u16)* indices;
|
||||
BE(f32)* weights;
|
||||
u8* pScale;
|
||||
|
||||
#if DEBUG || !__MWERKS__
|
||||
@@ -311,11 +311,13 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
do {
|
||||
idx = *++indices;
|
||||
worldMtx = &mpAnmMtx[idx];
|
||||
invMtx = &mJointTree->getInvJointMtx((u16)idx);
|
||||
|
||||
|
||||
#if DEBUG || !__MWERKS__
|
||||
MTXConcat(*worldMtx, *invMtx, mtx);
|
||||
mJointTree->getInvJointMtx((u16)idx).to_host(invMtx);
|
||||
MTXConcat(*worldMtx, invMtx, mtx);
|
||||
#else
|
||||
invMtx = &mJointTree->getInvJointMtx((u16)idx);
|
||||
// Fakematch? Doesn't match if worldMtx and invMtx are used directly.
|
||||
__REGISTER void* var_r5 = worldMtx;
|
||||
__REGISTER void* var_r6 = invMtx;
|
||||
|
||||
@@ -79,17 +79,17 @@ J3DSkinDeform::J3DSkinDeform() {
|
||||
mSkinNList = NULL;
|
||||
}
|
||||
|
||||
u16* J3DSkinDeform::sWorkArea_WEvlpMixMtx[1024];
|
||||
BE(u16)* J3DSkinDeform::sWorkArea_WEvlpMixMtx[1024];
|
||||
|
||||
f32* J3DSkinDeform::sWorkArea_WEvlpMixWeight[1024];
|
||||
BE(f32)* J3DSkinDeform::sWorkArea_WEvlpMixWeight[1024];
|
||||
|
||||
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();
|
||||
BE(u16)* wevlpMtxIndex = pModelData->getWEvlpMixMtxIndex();
|
||||
BE(f32)* wevlpMixWeights = pModelData->getWEvlpMixWeight();
|
||||
int currentOffset = 0;
|
||||
|
||||
for (int i = 0; i < wevlpMtxNum; i++) {
|
||||
@@ -99,7 +99,7 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) {
|
||||
}
|
||||
|
||||
if (pModelData->getJointNum() != 0) {
|
||||
mSkinNList = new J3DSkinNList[pModelData->getJointNum()];
|
||||
mSkinNList = JKR_NEW J3DSkinNList[pModelData->getJointNum()];
|
||||
}
|
||||
|
||||
for (int i = 0; i < pModelData->getVtxNum(); i++) {
|
||||
@@ -111,7 +111,7 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) {
|
||||
} else {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
BE(u16)* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
mSkinNList[indices[j]].field_0x10++;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) {
|
||||
} else {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
BE(u16)* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
mSkinNList[indices[j]].field_0x12++;
|
||||
}
|
||||
@@ -138,13 +138,13 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) {
|
||||
|
||||
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];
|
||||
mSkinNList[i].field_0x0 = JKR_NEW u16[mSkinNList[i].field_0x10];
|
||||
mSkinNList[i].field_0x8 = JKR_NEW f32[mSkinNList[i].field_0x10];
|
||||
mSkinNList[i].field_0x10 = 0;
|
||||
}
|
||||
if (mSkinNList[i].field_0x12) {
|
||||
mSkinNList[i].field_0x4 = new u16[mSkinNList[i].field_0x12];
|
||||
mSkinNList[i].field_0xc = new f32[mSkinNList[i].field_0x12];
|
||||
mSkinNList[i].field_0x4 = JKR_NEW u16[mSkinNList[i].field_0x12];
|
||||
mSkinNList[i].field_0xc = JKR_NEW f32[mSkinNList[i].field_0x12];
|
||||
mSkinNList[i].field_0x12 = 0;
|
||||
}
|
||||
}
|
||||
@@ -160,8 +160,8 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) {
|
||||
} else {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
f32* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex];
|
||||
BE(u16)* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
BE(f32)* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
int uVar9 = mSkinNList[indices[j]].field_0x10++;
|
||||
mSkinNList[indices[j]].field_0x0[uVar9] = i;
|
||||
@@ -182,8 +182,8 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) {
|
||||
} else {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
f32* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex];
|
||||
BE(u16)* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
BE(f32)* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
int uVar9 = mSkinNList[indices[j]].field_0x12++;
|
||||
mSkinNList[indices[j]].field_0x4[uVar9] = i;
|
||||
@@ -202,7 +202,7 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) {
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
mPosData = new u16[pModelData->getVtxNum()];
|
||||
mPosData = JKR_NEW u16[pModelData->getVtxNum()];
|
||||
if (mPosData == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) {
|
||||
}
|
||||
|
||||
if (pModelData->getNrmNum()) {
|
||||
mNrmData = new u16[pModelData->getNrmNum()];
|
||||
mNrmData = JKR_NEW u16[pModelData->getNrmNum()];
|
||||
if (mNrmData == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -223,8 +223,8 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) {
|
||||
mNrmData = NULL;
|
||||
}
|
||||
|
||||
mPosMtx = new Mtx[pModelData->getJointNum()];
|
||||
mNrmMtx = new (32) Mtx33[pModelData->getDrawMtxNum()];
|
||||
mPosMtx = JKR_NEW Mtx[pModelData->getJointNum()];
|
||||
mNrmMtx = JKR_NEW_ARGS (32) Mtx33[pModelData->getDrawMtxNum()];
|
||||
if (mPosMtx == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -298,7 +298,7 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) {
|
||||
#if PLATFORM_GCN
|
||||
uVar13 = *(u16*)(pDListPos + 1);
|
||||
#else
|
||||
uVar13 = *(u16*)pDListPos;
|
||||
uVar13 = be16(*(u16*)pDListPos);
|
||||
pDListPos += 2;
|
||||
#endif
|
||||
for (int local_60 = 0; local_60 < uVar13; local_60++) {
|
||||
@@ -308,9 +308,9 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) {
|
||||
u8* iVar5 = ((u8*)pDListPos + r23 * local_60);
|
||||
#endif
|
||||
u8 bVar3 = *(u8*)(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 vtx_idx = be16(*(u16*)(iVar5 + vtx_num));
|
||||
u16 nrm_idx = be16(*(u16*)(iVar5 + nrm_num));
|
||||
u16 uVar3 = be16(*(u16*)(iVar5 + tex_num));
|
||||
u16 local_76 = pShapeMtx->getUseMtxIndex(bVar3);
|
||||
if (local_76 == 0xffff) {
|
||||
local_76 = sWorkArea_MtxReg[bVar3];
|
||||
@@ -376,9 +376,10 @@ void J3DSkinDeform::changeFastSkinDL(J3DModelData* pModelData) {
|
||||
if (cmd != GX_TRIANGLEFAN && cmd != GX_TRIANGLESTRIP)
|
||||
break;
|
||||
|
||||
int vtxCount = *(u16*)dl;
|
||||
u16 vtxCountBE = *(u16*)dl;
|
||||
int vtxCount = be16(vtxCountBE);
|
||||
dl += 2;
|
||||
*(u16*)dst = vtxCount;
|
||||
*(u16*)dst = vtxCountBE;
|
||||
dst += 2;
|
||||
|
||||
for (int k = 0; k < vtxCount; k++) {
|
||||
@@ -448,7 +449,9 @@ void J3DSkinDeform::transformVtxPosNrm(J3DModelData* pModelData) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(posIndex);
|
||||
Vec* pos = ((Vec*)pModelData->getVtxPosArray()) + i;
|
||||
Mtx invMtx;
|
||||
MTXInverse(pModelData->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
Mtx copy;
|
||||
pModelData->getInvJointMtx(drawMtxIndex).to_host(copy);
|
||||
MTXInverse(copy, invMtx);
|
||||
MTXMultVec(invMtx, pos, pos);
|
||||
}
|
||||
}
|
||||
@@ -459,7 +462,9 @@ void J3DSkinDeform::transformVtxPosNrm(J3DModelData* pModelData) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(nrmIndex);
|
||||
Vec* nrm = ((Vec*)pModelData->getVtxNrmArray()) + i;
|
||||
Mtx invMtx;
|
||||
MTXInverse(pModelData->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
Mtx copy;
|
||||
pModelData->getInvJointMtx(drawMtxIndex).to_host(copy);
|
||||
MTXInverse(copy, invMtx);
|
||||
MTXMultVecSR(invMtx, nrm, nrm);
|
||||
}
|
||||
}
|
||||
@@ -474,10 +479,12 @@ void J3DSkinDeform::calcAnmInvJointMtx(J3DMtxBuffer* pMtxBuffer) {
|
||||
if (pMtxBuffer->getJointTree()->getWEvlpMtxNum() != 0) {
|
||||
int jointNum = pMtxBuffer->getJointTree()->getJointNum();
|
||||
Mtx* anmMtx = (Mtx*)pMtxBuffer->getAnmMtx(0);
|
||||
Mtx* invJointMtx = &pMtxBuffer->getJointTree()->getInvJointMtx(0);
|
||||
BE(Mtx)* invJointMtx = &pMtxBuffer->getJointTree()->getInvJointMtx(0);
|
||||
Mtx* posMtx = mPosMtx;
|
||||
for (int i = 0; i < jointNum; i++) {
|
||||
MTXConcat(anmMtx[i], invJointMtx[i], posMtx[i]);
|
||||
Mtx copy;
|
||||
invJointMtx[i].to_host(copy);
|
||||
MTXConcat(anmMtx[i], copy, posMtx[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ void J3DDrawBuffer::initialize() {
|
||||
}
|
||||
|
||||
int J3DDrawBuffer::allocBuffer(u32 size) {
|
||||
mpBuffer = new (0x20) J3DPacket*[size];
|
||||
mpBuffer = JKR_NEW_ARGS (0x20) J3DPacket*[size];
|
||||
if (mpBuffer == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
|
||||
@@ -39,7 +39,7 @@ int J3DDrawBuffer::allocBuffer(u32 size) {
|
||||
J3DDrawBuffer::~J3DDrawBuffer() {
|
||||
frameInit();
|
||||
|
||||
delete[] mpBuffer;
|
||||
JKR_DELETE_ARRAY(mpBuffer);
|
||||
mpBuffer = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DGD.h"
|
||||
#include "JSystem/J3DGraphBase/J3DFifo.h"
|
||||
#include <dusk/logging.h>
|
||||
|
||||
void J3DGDSetGenMode(u8 nTexGens, u8 nChans, u8 nTevs, u8 nInds,
|
||||
GXCullMode cm) {
|
||||
@@ -350,7 +351,7 @@ void J3DGDSetTexImgAttr(GXTexMapID id, u16 width, u16 height, GXTexFmt format) {
|
||||
|
||||
void J3DGDSetTexImgPtr(GXTexMapID id, void* image_ptr) {
|
||||
#if TARGET_PC
|
||||
puts("J3DGDSetTexImgPtr is a stub");
|
||||
STUB_LOG();
|
||||
#else
|
||||
J3DGDWriteBPCmd(BP_IMAGE_PTR(OSCachedToPhysical(image_ptr) >> 5, J3DGDTexImage3Ids[id]));
|
||||
#endif
|
||||
@@ -372,7 +373,7 @@ void J3DGDLoadTlut(void* tlut_ptr, u32 tmem_addr, GXTlutSize size) {
|
||||
J3DGDWriteBPCmd(0xFEFFFF00);
|
||||
J3DGDWriteBPCmd(0xF000000);
|
||||
#if TARGET_PC
|
||||
puts("J3DGDLoadTlut is a stub");
|
||||
STUB_LOG();
|
||||
return;
|
||||
#endif
|
||||
J3DGDWriteBPCmd(BP_LOAD_TLUT0(OSCachedToPhysical(tlut_ptr) >> 5, 0x64));
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
inline void loadMatColors(const J3DGXColor* color) {
|
||||
J3DGDWriteXFCmdHdr(0x100C, 2);
|
||||
J3DGDWrite_u32(*(u32*)color);
|
||||
J3DGDWrite_u32(*(u32*)(color + 1));
|
||||
J3DGDWrite_u32(*(BE(u32)*)color);
|
||||
J3DGDWrite_u32(*(BE(u32)*)(color + 1));
|
||||
}
|
||||
|
||||
inline void loadAmbColors(const J3DGXColor* color) {
|
||||
J3DGDWriteXFCmdHdr(0x100A, 2);
|
||||
J3DGDWrite_u32(*(u32*)color);
|
||||
J3DGDWrite_u32(*(u32*)(color + 1));
|
||||
J3DGDWrite_u32(*(BE(u32)*)color);
|
||||
J3DGDWrite_u32(*(BE(u32)*)(color + 1));
|
||||
}
|
||||
|
||||
inline void loadTexCoordScale(GXTexCoordID coord, const J3DTexCoordScaleInfo& info) {
|
||||
@@ -1366,6 +1366,14 @@ void J3DTevBlock16::ptrToIndex() {
|
||||
DCStoreRange(start, (uintptr_t)end - (uintptr_t)start);
|
||||
}
|
||||
|
||||
void J3DTevBlock16::loadTexture() {
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (mTexNo[i] != 0xFFFF) {
|
||||
j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void J3DTevBlockPatched::ptrToIndex() {
|
||||
GDSetCurrOffset(mTexNoOffset);
|
||||
void* start = GDGetCurrPointer();
|
||||
@@ -1390,6 +1398,14 @@ void J3DTevBlockPatched::ptrToIndex() {
|
||||
DCStoreRange(start, (uintptr_t)end - (uintptr_t)start);
|
||||
}
|
||||
|
||||
void J3DTevBlockPatched::loadTexture() {
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (mTexNo[i] != 0xFFFF) {
|
||||
j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void J3DTevBlock::indexToPtr_private(u32 offs) {
|
||||
GDSetCurrOffset(offs);
|
||||
void* start = GDGetCurrPointer();
|
||||
@@ -1682,6 +1698,30 @@ void J3DTevBlockPatched::reset(J3DTevBlock* pBlock) {
|
||||
}
|
||||
}
|
||||
|
||||
void J3DTevBlock1::loadTexture() {
|
||||
for (u32 i = 0; i < 1; i++) {
|
||||
if (mTexNo[i] != 0xFFFF) {
|
||||
j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void J3DTevBlock2::loadTexture() {
|
||||
for (u32 i = 0; i < 2; i++) {
|
||||
if (mTexNo[i] != 0xFFFF) {
|
||||
j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void J3DTevBlock4::loadTexture() {
|
||||
for (u32 i = 0; i < 4; i++) {
|
||||
if (mTexNo[i] != 0xFFFF) {
|
||||
j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void J3DTevBlock1::reset(J3DTevBlock* pBlock) {
|
||||
J3D_ASSERT_NULLPTR(2633, pBlock != NULL);
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphBase/J3DGD.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
J3DColorBlock* J3DMaterial::createColorBlock(u32 flags) {
|
||||
J3DColorBlock* rv = NULL;
|
||||
switch (flags) {
|
||||
case 0:
|
||||
rv = new J3DColorBlockLightOff();
|
||||
rv = JKR_NEW J3DColorBlockLightOff();
|
||||
break;
|
||||
case 0x40000000:
|
||||
rv = new J3DColorBlockLightOn();
|
||||
rv = JKR_NEW J3DColorBlockLightOn();
|
||||
break;
|
||||
case 0x80000000:
|
||||
rv = new J3DColorBlockAmbientOn();
|
||||
rv = JKR_NEW J3DColorBlockAmbientOn();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -25,11 +26,11 @@ J3DTexGenBlock* J3DMaterial::createTexGenBlock(u32 flags) {
|
||||
J3DTexGenBlock* rv = NULL;
|
||||
switch (flags) {
|
||||
case 0x8000000:
|
||||
rv = new J3DTexGenBlock4();
|
||||
rv = JKR_NEW J3DTexGenBlock4();
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
rv = new J3DTexGenBlockBasic();
|
||||
rv = JKR_NEW J3DTexGenBlockBasic();
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(83, rv != NULL);
|
||||
@@ -39,13 +40,13 @@ J3DTexGenBlock* J3DMaterial::createTexGenBlock(u32 flags) {
|
||||
J3DTevBlock* J3DMaterial::createTevBlock(int tevStageNum) {
|
||||
J3DTevBlock* rv = NULL;
|
||||
if (tevStageNum <= 1) {
|
||||
rv = new J3DTevBlock1();
|
||||
rv = JKR_NEW J3DTevBlock1();
|
||||
} else if (tevStageNum == 2) {
|
||||
rv = new J3DTevBlock2();
|
||||
rv = JKR_NEW J3DTevBlock2();
|
||||
} else if (tevStageNum <= 4) {
|
||||
rv = new J3DTevBlock4();
|
||||
rv = JKR_NEW J3DTevBlock4();
|
||||
} else if (tevStageNum <= 16) {
|
||||
rv = new J3DTevBlock16();
|
||||
rv = JKR_NEW J3DTevBlock16();
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(116, rv != NULL);
|
||||
@@ -55,9 +56,9 @@ J3DTevBlock* J3DMaterial::createTevBlock(int tevStageNum) {
|
||||
J3DIndBlock* J3DMaterial::createIndBlock(int flags) {
|
||||
J3DIndBlock* rv = NULL;
|
||||
if (flags != 0) {
|
||||
rv = new J3DIndBlockFull();
|
||||
rv = JKR_NEW J3DIndBlockFull();
|
||||
} else {
|
||||
rv = new J3DIndBlockNull();
|
||||
rv = JKR_NEW J3DIndBlockNull();
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(139, rv != NULL);
|
||||
@@ -68,24 +69,24 @@ J3DPEBlock* J3DMaterial::createPEBlock(u32 flags, u32 materialMode) {
|
||||
J3DPEBlock* rv = NULL;
|
||||
if (flags == 0) {
|
||||
if (materialMode & 1) {
|
||||
rv = new J3DPEBlockOpa();
|
||||
rv = JKR_NEW J3DPEBlockOpa();
|
||||
J3D_ASSERT_ALLOCMEM(166, rv != NULL);
|
||||
return rv;
|
||||
} else if (materialMode & 2) {
|
||||
rv = new J3DPEBlockTexEdge();
|
||||
rv = JKR_NEW J3DPEBlockTexEdge();
|
||||
J3D_ASSERT_ALLOCMEM(172, rv != NULL);
|
||||
return rv;
|
||||
} else if (materialMode & 4) {
|
||||
rv = new J3DPEBlockXlu();
|
||||
rv = JKR_NEW J3DPEBlockXlu();
|
||||
J3D_ASSERT_ALLOCMEM(178, rv != NULL);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags == 0x10000000) {
|
||||
rv = new J3DPEBlockFull();
|
||||
rv = JKR_NEW J3DPEBlockFull();
|
||||
} else if (flags == 0x20000000) {
|
||||
rv = new J3DPEBlockFogOff();
|
||||
rv = JKR_NEW J3DPEBlockFogOff();
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(188, rv != NULL);
|
||||
@@ -217,6 +218,9 @@ void J3DMaterial::makeSharedDisplayList() {
|
||||
|
||||
void J3DMaterial::load() {
|
||||
j3dSys.setMaterialMode(mMaterialMode);
|
||||
#if TARGET_PC
|
||||
mTevBlock->loadTexture();
|
||||
#endif
|
||||
if (!j3dSys.checkFlag(2)) {
|
||||
loadNBTScale(*mTexGenBlock->getNBTScale());
|
||||
}
|
||||
@@ -224,6 +228,9 @@ void J3DMaterial::load() {
|
||||
|
||||
void J3DMaterial::loadSharedDL() {
|
||||
j3dSys.setMaterialMode(mMaterialMode);
|
||||
#if TARGET_PC
|
||||
mTevBlock->loadTexture();
|
||||
#endif
|
||||
if (!j3dSys.checkFlag(2)) {
|
||||
mSharedDLObj->callDL();
|
||||
loadNBTScale(*mTexGenBlock->getNBTScale());
|
||||
@@ -334,7 +341,7 @@ void J3DMaterial::change() {
|
||||
|
||||
s32 J3DMaterial::newSharedDisplayList(u32 dlSize) {
|
||||
if (mSharedDLObj == NULL) {
|
||||
mSharedDLObj = new J3DDisplayListObj();
|
||||
mSharedDLObj = JKR_NEW J3DDisplayListObj();
|
||||
if (mSharedDLObj == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -350,7 +357,7 @@ s32 J3DMaterial::newSharedDisplayList(u32 dlSize) {
|
||||
|
||||
s32 J3DMaterial::newSingleSharedDisplayList(u32 dlSize) {
|
||||
if (mSharedDLObj == NULL) {
|
||||
mSharedDLObj = new J3DDisplayListObj();
|
||||
mSharedDLObj = JKR_NEW J3DDisplayListObj();
|
||||
if (mSharedDLObj == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -374,6 +381,9 @@ void J3DPatchedMaterial::makeSharedDisplayList() {}
|
||||
|
||||
void J3DPatchedMaterial::load() {
|
||||
j3dSys.setMaterialMode(mMaterialMode);
|
||||
#if TARGET_PC
|
||||
mTevBlock->loadTexture();
|
||||
#endif
|
||||
if (j3dSys.checkFlag(2)) {
|
||||
return;
|
||||
}
|
||||
@@ -381,6 +391,9 @@ void J3DPatchedMaterial::load() {
|
||||
|
||||
void J3DPatchedMaterial::loadSharedDL() {
|
||||
j3dSys.setMaterialMode(mMaterialMode);
|
||||
#if TARGET_PC
|
||||
mTevBlock->loadTexture();
|
||||
#endif
|
||||
if (!j3dSys.checkFlag(0x02))
|
||||
mSharedDLObj->callDL();
|
||||
}
|
||||
@@ -399,6 +412,9 @@ void J3DLockedMaterial::makeSharedDisplayList() {}
|
||||
|
||||
void J3DLockedMaterial::load() {
|
||||
j3dSys.setMaterialMode(mMaterialMode);
|
||||
#if TARGET_PC
|
||||
mTevBlock->loadTexture();
|
||||
#endif
|
||||
if (j3dSys.checkFlag(2)) {
|
||||
return;
|
||||
}
|
||||
@@ -406,6 +422,9 @@ void J3DLockedMaterial::load() {
|
||||
|
||||
void J3DLockedMaterial::loadSharedDL() {
|
||||
j3dSys.setMaterialMode(mMaterialMode);
|
||||
#if TARGET_PC
|
||||
mTevBlock->loadTexture();
|
||||
#endif
|
||||
if (!j3dSys.checkFlag(0x02))
|
||||
mSharedDLObj->callDL();
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
J3DError J3DDisplayListObj::newDisplayList(u32 maxSize) {
|
||||
mMaxSize = ALIGN_NEXT(maxSize, 0x20);
|
||||
mpDisplayList[0] = new (0x20) char[mMaxSize];
|
||||
mpDisplayList[1] = new (0x20) char[mMaxSize];
|
||||
mpDisplayList[0] = JKR_NEW_ARGS (0x20) char[mMaxSize];
|
||||
mpDisplayList[1] = JKR_NEW_ARGS (0x20) char[mMaxSize];
|
||||
mSize = 0;
|
||||
|
||||
if (mpDisplayList[0] == NULL || mpDisplayList[1] == NULL)
|
||||
@@ -24,7 +24,7 @@ J3DError J3DDisplayListObj::newDisplayList(u32 maxSize) {
|
||||
|
||||
J3DError J3DDisplayListObj::newSingleDisplayList(u32 maxSize) {
|
||||
mMaxSize = ALIGN_NEXT(maxSize, 0x20);
|
||||
mpDisplayList[0] = new (0x20) char[mMaxSize];
|
||||
mpDisplayList[0] = JKR_NEW_ARGS (0x20) char[mMaxSize];
|
||||
mpDisplayList[1] = mpDisplayList[0];
|
||||
mSize = 0;
|
||||
|
||||
@@ -36,7 +36,7 @@ J3DError J3DDisplayListObj::newSingleDisplayList(u32 maxSize) {
|
||||
|
||||
int J3DDisplayListObj::single_To_Double() {
|
||||
if (mpDisplayList[0] == mpDisplayList[1]) {
|
||||
mpDisplayList[1] = new (0x20) char[mMaxSize];
|
||||
mpDisplayList[1] = JKR_NEW_ARGS (0x20) char[mMaxSize];
|
||||
|
||||
if (mpDisplayList[1] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
@@ -144,7 +144,7 @@ J3DDrawPacket::J3DDrawPacket() {
|
||||
J3DDrawPacket::~J3DDrawPacket() {}
|
||||
|
||||
J3DError J3DDrawPacket::newDisplayList(u32 size) {
|
||||
mpDisplayListObj = new J3DDisplayListObj();
|
||||
mpDisplayListObj = JKR_NEW J3DDisplayListObj();
|
||||
|
||||
if (mpDisplayListObj == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
@@ -157,7 +157,7 @@ J3DError J3DDrawPacket::newDisplayList(u32 size) {
|
||||
}
|
||||
|
||||
J3DError J3DDrawPacket::newSingleDisplayList(u32 size) {
|
||||
mpDisplayListObj = new J3DDisplayListObj();
|
||||
mpDisplayListObj = JKR_NEW J3DDisplayListObj();
|
||||
|
||||
if (mpDisplayListObj == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
@@ -207,10 +207,16 @@ bool J3DMatPacket::isSame(J3DMatPacket* pOther) const {
|
||||
}
|
||||
|
||||
void J3DMatPacket::draw() {
|
||||
#if TARGET_PC
|
||||
j3dSys.setTexture(mpTexture);
|
||||
#endif
|
||||
mpMaterial->load();
|
||||
callDL();
|
||||
|
||||
J3DShapePacket* packet = getShapePacket();
|
||||
#if TARGET_PC
|
||||
packet->mpModel->getVertexBuffer()->setArray();
|
||||
#endif
|
||||
packet->getShape()->loadPreDrawSetting();
|
||||
|
||||
while (packet != NULL) {
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
#include "JSystem/J3DGraphBase/J3DPacket.h"
|
||||
#include "JSystem/J3DGraphBase/J3DVertex.h"
|
||||
#include "JSystem/J3DGraphBase/J3DFifo.h"
|
||||
#include <gx.h>
|
||||
#include <gd.h>
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
void J3DGDSetVtxAttrFmtv(GXVtxFmt, GXVtxAttrFmtList const*, bool);
|
||||
void J3DFifoLoadPosMtxImm(Mtx, u32);
|
||||
@@ -85,7 +87,7 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
||||
if (attrIdx == -1)
|
||||
return;
|
||||
|
||||
GXVtxDescList* newVtxDesc = new GXVtxDescList[attrCount + 2];
|
||||
GXVtxDescList* newVtxDesc = JKR_NEW GXVtxDescList[attrCount + 2];
|
||||
bool inserted = false;
|
||||
|
||||
vtxDesc = getVtxDesc();
|
||||
@@ -131,12 +133,36 @@ void J3DLoadCPCmd(u8 addr, u32 val) {
|
||||
GXCmd1u32(val);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
static void J3DLoadArrayBasePtr(GXAttr attr, void* data, u32 size) {
|
||||
u32 idx = (attr == GX_VA_NBT) ? 1 : (attr - GX_VA_POS);
|
||||
GXCmd1u8(GX_LOAD_AURORA);
|
||||
GXCmd1u16(GX_LOAD_AURORA_ARRAYBASE | idx);
|
||||
GXCmd1u64((u64)data);
|
||||
GXCmd1u64((u64)size);
|
||||
}
|
||||
#else
|
||||
static void J3DLoadArrayBasePtr(GXAttr attr, void* data) {
|
||||
u32 idx = (attr == GX_VA_NBT) ? 1 : (attr - GX_VA_POS);
|
||||
J3DLoadCPCmd(0xA0 + idx, ((uintptr_t)data & 0x7FFFFFFF));
|
||||
}
|
||||
#endif
|
||||
|
||||
void J3DShape::loadVtxArray() const {
|
||||
#if TARGET_PC
|
||||
// TODO: these can very easily overcount if the data isn't in F32 format
|
||||
if (j3dSys.getVtxPos() != mVertexData->getVtxPosArray()) {
|
||||
J3DLoadArrayBasePtr(GX_VA_POS, j3dSys.getVtxPos(), j3dSys.mVtxPosNum * sizeof(Vec));
|
||||
}
|
||||
|
||||
if (!mHasNBT && j3dSys.getVtxNrm() != mVertexData->getVtxNrmArray()) {
|
||||
J3DLoadArrayBasePtr(GX_VA_NRM, j3dSys.getVtxNrm(), j3dSys.mVtxNrmNum * sizeof(Vec));
|
||||
}
|
||||
|
||||
if (j3dSys.getVtxCol() != mVertexData->getVtxColorArray(0)) {
|
||||
J3DLoadArrayBasePtr(GX_VA_CLR0, j3dSys.getVtxCol(), j3dSys.mVtxColNum * sizeof(GXColor));
|
||||
}
|
||||
#else
|
||||
J3DLoadArrayBasePtr(GX_VA_POS, j3dSys.getVtxPos());
|
||||
|
||||
if (!mHasNBT) {
|
||||
@@ -144,6 +170,7 @@ void J3DShape::loadVtxArray() const {
|
||||
}
|
||||
|
||||
J3DLoadArrayBasePtr(GX_VA_CLR0, j3dSys.getVtxCol());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool J3DShape::isSameVcdVatCmd(J3DShape* other) {
|
||||
@@ -220,17 +247,28 @@ void J3DShape::makeVtxArrayCmd() {
|
||||
mHasNBT = true;
|
||||
stride[GX_VA_NRM - GX_VA_POS] *= 3;
|
||||
array[GX_VA_NRM - GX_VA_POS] = mVertexData->getVtxNBTArray();
|
||||
// TODO: How set array size here?
|
||||
} else if (vtxDesc->attr == GX_VA_PNMTXIDX && vtxDesc->type != GX_NONE) {
|
||||
mHasPNMTXIdx = true;
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
for (u32 i = 0; i < 12; i++) {
|
||||
GXAttr attr = GXAttr(i + GX_VA_POS);
|
||||
if (array[i] != nullptr)
|
||||
GDSetArraySized(attr, array[i], mVertexData->getVtxArrByteSize(attr), mVertexData->getVtxArrStride(attr));
|
||||
else
|
||||
GDSetArraySized(attr, nullptr, 0, mVertexData->getVtxArrStride(attr));
|
||||
}
|
||||
#else
|
||||
for (u32 i = 0; i < 12; i++) {
|
||||
if (array[i] != 0)
|
||||
GDSetArray((GXAttr)(i + GX_VA_POS), array[i], stride[i]);
|
||||
else
|
||||
GDSetArrayRaw((GXAttr)(i + GX_VA_POS), 0, stride[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void J3DShape::makeVcdVatCmd() {
|
||||
|
||||
@@ -28,7 +28,7 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
|
||||
u32 byteNum = countVertex(stride);
|
||||
u32 oldSize = mDisplayListSize;
|
||||
u32 newSize = ALIGN_NEXT(oldSize + byteNum, 0x20);
|
||||
u8* newDLStart = new (0x20) u8[newSize];
|
||||
u8* newDLStart = JKR_NEW_ARGS (0x20) u8[newSize];
|
||||
u8* oldDLStart = (u8*)mDisplayList;
|
||||
u8* oldDL = oldDLStart;
|
||||
u8* newDL = newDLStart;
|
||||
@@ -58,7 +58,7 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
|
||||
newDL += (stride - attrOffs);
|
||||
}
|
||||
|
||||
oldDL = (u8*)oldDL + stride * vtxNum;
|
||||
oldDL = (u8*)oldDL + stride * be16(vtxNum);
|
||||
}
|
||||
|
||||
u32 realSize = ALIGN_NEXT((uintptr_t)newDL - (uintptr_t)newDLStart, 0x20);
|
||||
|
||||
@@ -332,7 +332,9 @@ 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.getModel()->getModelData()->getInvJointMtx(drw), m);
|
||||
Mtx copy;
|
||||
j3dSys.getModel()->getModelData()->getInvJointMtx(drw).to_host(copy);
|
||||
MTXConcat(m, copy, m);
|
||||
J3DDifferedTexMtx::load(m);
|
||||
J3DFifoLoadPosMtxImm(m, slot * 3);
|
||||
loadNrmMtx(slot, drw, m);
|
||||
|
||||
@@ -264,8 +264,17 @@ void J3DSys::reinitTransform() {
|
||||
}
|
||||
|
||||
void J3DSys::reinitTexture() {
|
||||
#if TARGET_PC
|
||||
static GXTexObj texObj;
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
GXInitTexObj(&texObj, NullTexData, 4, 4, GX_TF_IA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
initialized = true;
|
||||
}
|
||||
#else
|
||||
GXTexObj texObj;
|
||||
GXInitTexObj(&texObj, NullTexData, 4, 4, GX_TF_IA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
#endif
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP0);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP1);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP2);
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const {
|
||||
J3D_ASSERT_RANGE(29, idx < mNum);
|
||||
|
||||
ResTIMG* timg = getResTIMG(idx);
|
||||
|
||||
#if TARGET_PC
|
||||
if (timg->width == 0 || timg->height == 0)
|
||||
return;
|
||||
if (idx >= mNum) {
|
||||
OSReport("J3DTexture::loadGX: idx %d out of bounds (mNum=%d)!\n", idx, mNum);
|
||||
return;
|
||||
}
|
||||
if (timg->indexTexture) {
|
||||
GXLoadTlut(&mpTlutObj[idx], (GXTlut)texMapID);
|
||||
GXInitTexObjTlut(&mpTexObj[idx], (GXTlut)texMapID);
|
||||
}
|
||||
GXLoadTexObj(&mpTexObj[idx], texMapID);
|
||||
#else
|
||||
GXTexObj texObj;
|
||||
GXTlutObj tlutObj;
|
||||
|
||||
@@ -30,14 +45,53 @@ void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const {
|
||||
timg->LODBias * kLODBiasScale, timg->biasClamp, timg->doEdgeLOD,
|
||||
(GXAnisotropy)timg->maxAnisotropy);
|
||||
GXLoadTexObj(&texObj, texMapID);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
void J3DTexture::loadGXTexObj(u16 idx) {
|
||||
J3D_ASSERT_RANGE(29, idx < mNum);
|
||||
ResTIMG* timg = getResTIMG(idx);
|
||||
|
||||
GXTlutObj& tlutObj = mpTlutObj[idx];
|
||||
GXTexObj& texObj = mpTexObj[idx];
|
||||
|
||||
if (!timg->indexTexture) {
|
||||
GXInitTexObj(&texObj, mpImgDataPtr[idx], timg->width, timg->height,
|
||||
(GXTexFmt)timg->format, (GXTexWrapMode)timg->wrapS, (GXTexWrapMode)timg->wrapT,
|
||||
timg->mipmapEnabled);
|
||||
} else {
|
||||
GXInitTexObjCI(&texObj, mpImgDataPtr[idx], timg->width, timg->height,
|
||||
(GXCITexFmt)timg->format, (GXTexWrapMode)timg->wrapS,
|
||||
(GXTexWrapMode)timg->wrapT, timg->mipmapEnabled, GX_TLUT0);
|
||||
GXInitTlutObj(&tlutObj, mpTlutDataPtr[idx], (GXTlutFmt)timg->colorFormat,
|
||||
timg->numColors);
|
||||
}
|
||||
|
||||
const f32 kLODClampScale = 1.0f / 8.0f;
|
||||
const f32 kLODBiasScale = 1.0f / 100.0f;
|
||||
GXInitTexObjLOD(&texObj, (GXTexFilter)timg->minFilter, (GXTexFilter)timg->magFilter,
|
||||
timg->minLOD * kLODClampScale, timg->maxLOD * kLODClampScale,
|
||||
timg->LODBias * kLODBiasScale, timg->biasClamp, timg->doEdgeLOD,
|
||||
(GXAnisotropy)timg->maxAnisotropy);
|
||||
}
|
||||
#endif
|
||||
|
||||
void J3DTexture::entryNum(u16 num) {
|
||||
J3D_ASSERT_NONZEROARG(79, num != 0);
|
||||
|
||||
mNum = num;
|
||||
mpRes = new ResTIMG[num];
|
||||
mpRes = JKR_NEW ResTIMG[num];
|
||||
J3D_ASSERT_ALLOCMEM(83, mpRes != NULL);
|
||||
|
||||
delete[] mpTexObj;
|
||||
delete[] mpTlutObj;
|
||||
delete[] mpImgDataPtr;
|
||||
delete[] mpTlutDataPtr;
|
||||
mpTexObj = new GXTexObj[num]();
|
||||
mpTlutObj = new GXTlutObj[num]();
|
||||
mpImgDataPtr = new u8*[num]();
|
||||
mpTlutDataPtr = new u8*[num]();
|
||||
|
||||
for (int i = 0; i < mNum; i++) {
|
||||
mpRes[i].paletteOffset = 0;
|
||||
|
||||
@@ -68,15 +68,15 @@ void J3DVertexBuffer::init() {
|
||||
J3DVertexBuffer::~J3DVertexBuffer() {}
|
||||
|
||||
void J3DVertexBuffer::setArray() const {
|
||||
j3dSys.setVtxPos(mCurrentVtxPos);
|
||||
j3dSys.setVtxNrm(mCurrentVtxNrm);
|
||||
j3dSys.setVtxCol(mCurrentVtxCol);
|
||||
j3dSys.setVtxPos(mCurrentVtxPos, mVtxData->getVtxNum());
|
||||
j3dSys.setVtxNrm(mCurrentVtxNrm, mVtxData->getNrmNum());
|
||||
j3dSys.setVtxCol(mCurrentVtxCol, mVtxData->getColNum());
|
||||
}
|
||||
|
||||
s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
|
||||
if (flag & 1) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mVtxPosArray[i] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
mVtxPosArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
if (mVtxPosArray[i] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
|
||||
mVtxPosArray[0] = mVtxData->getVtxPosArray();
|
||||
|
||||
if (mVtxPosArray[1] == NULL) {
|
||||
mVtxPosArray[1] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
mVtxPosArray[1] = JKR_NEW_ARGS (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
if (mVtxPosArray[1] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -104,7 +104,7 @@ s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
|
||||
s32 J3DVertexBuffer::copyLocalVtxNrmArray(u32 flag) {
|
||||
if (flag & 1) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mVtxNrmArray[i] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
mVtxNrmArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
if (mVtxNrmArray[i] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ s32 J3DVertexBuffer::copyLocalVtxNrmArray(u32 flag) {
|
||||
mVtxNrmArray[0] = mVtxData->getVtxNrmArray();
|
||||
|
||||
if (mVtxNrmArray[1] == NULL) {
|
||||
mVtxNrmArray[1] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
mVtxNrmArray[1] = JKR_NEW_ARGS (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
if (mVtxNrmArray[1] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ s32 J3DVertexBuffer::copyLocalVtxArray(u32 flag) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (oldPosArray[i] != mVtxPosArray[i]) {
|
||||
if (mVtxPosArray[i] != mVtxData->getVtxPosArray())
|
||||
delete mVtxPosArray[i];
|
||||
JKR_DELETE(mVtxPosArray[i]);
|
||||
mVtxPosArray[i] = oldPosArray[i];
|
||||
}
|
||||
}
|
||||
@@ -161,13 +161,13 @@ s32 J3DVertexBuffer::copyLocalVtxArray(u32 flag) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (oldPosArray[i] != mVtxPosArray[i]) {
|
||||
if (mVtxPosArray[i] != mVtxData->getVtxPosArray())
|
||||
delete mVtxPosArray[i];
|
||||
JKR_DELETE(mVtxPosArray[i]);
|
||||
mVtxPosArray[i] = oldPosArray[i];
|
||||
}
|
||||
|
||||
if (oldNrmArray[i] != mVtxNrmArray[i]) {
|
||||
if (mVtxNrmArray[i] != mVtxData->getVtxNrmArray())
|
||||
delete mVtxNrmArray[i];
|
||||
JKR_DELETE(mVtxNrmArray[i]);
|
||||
mVtxNrmArray[i] = oldNrmArray[i];
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ s32 J3DVertexBuffer::allocTransformedVtxPosArray() {
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0 || mTransformedVtxPosArray[i] == NULL) {
|
||||
mTransformedVtxPosArray[i] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
mTransformedVtxPosArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
if (mTransformedVtxPosArray[i] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -201,7 +201,7 @@ s32 J3DVertexBuffer::allocTransformedVtxNrmArray() {
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0 || mTransformedVtxNrmArray[i] == NULL) {
|
||||
mTransformedVtxNrmArray[i] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
mTransformedVtxNrmArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
if (mTransformedVtxNrmArray[i] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#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);
|
||||
@@ -19,68 +21,68 @@ J3DAnmBase* J3DAnmLoaderDataBase::load(const void* i_data, J3DAnmLoaderDataBaseF
|
||||
switch (header->mType) {
|
||||
case 'bck1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmTransformKey();
|
||||
loader.mAnm = JKR_NEW J3DAnmTransformKey();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'bpk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmColorKey();
|
||||
loader.mAnm = JKR_NEW J3DAnmColorKey();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'blk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmClusterKey();
|
||||
loader.mAnm = JKR_NEW J3DAnmClusterKey();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'btk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmTextureSRTKey();
|
||||
loader.mAnm = JKR_NEW J3DAnmTextureSRTKey();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'brk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmTevRegKey();
|
||||
loader.mAnm = JKR_NEW J3DAnmTevRegKey();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'bxk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmVtxColorKey();
|
||||
loader.mAnm = JKR_NEW J3DAnmVtxColorKey();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'bca1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
|
||||
if (flag & J3DLOADER_UNK_FLAG1) {
|
||||
loader.mAnm = new J3DAnmTransformFullWithLerp();
|
||||
loader.mAnm = JKR_NEW J3DAnmTransformFullWithLerp();
|
||||
} else {
|
||||
loader.mAnm = new J3DAnmTransformFull();
|
||||
loader.mAnm = JKR_NEW J3DAnmTransformFull();
|
||||
}
|
||||
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'bpa1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmColorFull();
|
||||
loader.mAnm = JKR_NEW J3DAnmColorFull();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'btp1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmTexPattern();
|
||||
loader.mAnm = JKR_NEW J3DAnmTexPattern();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'bva1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmVisibilityFull();
|
||||
loader.mAnm = JKR_NEW J3DAnmVisibilityFull();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'bla1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmClusterFull();
|
||||
loader.mAnm = JKR_NEW J3DAnmClusterFull();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
case 'bxa1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.mAnm = new J3DAnmVtxColorFull();
|
||||
loader.mAnm = JKR_NEW J3DAnmVtxColorFull();
|
||||
return loader.load(i_data);
|
||||
}
|
||||
default:
|
||||
@@ -291,7 +293,7 @@ void J3DAnmFullLoader_v15::setAnmColor(J3DAnmColorFull* param_1,
|
||||
param_1->mColorB = JSUConvertOffsetToPtr<u8>(param_2, param_2->mBValuesOffset);
|
||||
param_1->mColorA = JSUConvertOffsetToPtr<u8>(param_2, param_2->mAValuesOffset);
|
||||
param_1->mUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(param_2, param_2->mUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(param_2, param_2->mUpdateMaterialIDOffset);
|
||||
param_1->mUpdateMaterialName.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(param_2, param_2->mNameTabOffset));
|
||||
}
|
||||
@@ -312,9 +314,9 @@ void J3DAnmFullLoader_v15::setAnmTexPattern(J3DAnmTexPattern* param_1,
|
||||
param_1->field_0x14 = param_2->field_0xe;
|
||||
param_1->mAnmTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmTexPatternFullTable>(param_2, param_2->mTableOffset);
|
||||
param_1->mTextureIndex = JSUConvertOffsetToPtr<u16>(param_2, param_2->mValuesOffset);
|
||||
param_1->mTextureIndex = JSUConvertOffsetToPtr<BE(u16)>(param_2, param_2->mValuesOffset);
|
||||
param_1->mUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(param_2, param_2->mUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(param_2, param_2->mUpdateMaterialIDOffset);
|
||||
param_1->mUpdateMaterialName.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(param_2, param_2->mNameTabOffset));
|
||||
}
|
||||
@@ -536,15 +538,15 @@ void J3DAnmKeyLoader_v15::setAnmTextureSRT(J3DAnmTextureSRTKey* param_1,
|
||||
param_1->mAnmTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmTransformKeyTable>(param_2, param_2->mTableOffset);
|
||||
param_1->mUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(param_2, param_2->mUpdateMatIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(param_2, param_2->mUpdateMatIDOffset);
|
||||
param_1->mUpdateMaterialName.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(param_2, param_2->mNameTab1Offset));
|
||||
param_1->mUpdateTexMtxID =
|
||||
JSUConvertOffsetToPtr<u8>(param_2, param_2->mUpdateTexMtxIDOffset);
|
||||
param_1->mSRTCenter = JSUConvertOffsetToPtr<Vec>(param_2, param_2->unkOffset);
|
||||
param_1->mScaleData = JSUConvertOffsetToPtr<f32>(param_2, param_2->mScaleValOffset);
|
||||
param_1->mRotData = JSUConvertOffsetToPtr<s16>(param_2, param_2->mRotValOffset);
|
||||
param_1->mTransData = JSUConvertOffsetToPtr<f32>(param_2, param_2->mTransValOffset);
|
||||
param_1->mSRTCenter = JSUConvertOffsetToPtr<BE(Vec)>(param_2, param_2->unkOffset);
|
||||
param_1->mScaleData = JSUConvertOffsetToPtr<BE(f32)>(param_2, param_2->mScaleValOffset);
|
||||
param_1->mRotData = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mRotValOffset);
|
||||
param_1->mTransData = JSUConvertOffsetToPtr<BE(f32)>(param_2, param_2->mTransValOffset);
|
||||
if (param_2->mNameTab2Offset) {
|
||||
param_1->mPostUpdateMaterialName.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(param_2, param_2->mNameTab2Offset));
|
||||
@@ -555,12 +557,12 @@ void J3DAnmKeyLoader_v15::setAnmTextureSRT(J3DAnmTextureSRTKey* param_1,
|
||||
param_1->field_0x48 = param_2->field_0x3a;
|
||||
param_1->field_0x58 =
|
||||
JSUConvertOffsetToPtr<J3DAnmTransformKeyTable>(param_2, param_2->mInfoTable2Offset);
|
||||
param_1->mPostUpdateMaterialID = JSUConvertOffsetToPtr<u16>(param_2, param_2->field_0x40);
|
||||
param_1->mPostUpdateMaterialID = JSUConvertOffsetToPtr<BE(u16)>(param_2, param_2->field_0x40);
|
||||
param_1->mPostUpdateTexMtxID = JSUConvertOffsetToPtr<u8>(param_2, param_2->field_0x48);
|
||||
param_1->mPostSRTCenter = JSUConvertOffsetToPtr<Vec>(param_2, param_2->field_0x4c);
|
||||
param_1->field_0x4c = JSUConvertOffsetToPtr<f32>(param_2, param_2->field_0x50);
|
||||
param_1->field_0x50 = JSUConvertOffsetToPtr<s16>(param_2, param_2->field_0x54);
|
||||
param_1->field_0x54 = JSUConvertOffsetToPtr<f32>(param_2, param_2->field_0x58);
|
||||
param_1->mPostSRTCenter = JSUConvertOffsetToPtr<BE(Vec)>(param_2, param_2->field_0x4c);
|
||||
param_1->field_0x4c = JSUConvertOffsetToPtr<BE(f32)>(param_2, param_2->field_0x50);
|
||||
param_1->field_0x50 = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->field_0x54);
|
||||
param_1->field_0x54 = JSUConvertOffsetToPtr<BE(f32)>(param_2, param_2->field_0x58);
|
||||
switch (param_2->field_0x5c) {
|
||||
case 0:
|
||||
case 1:
|
||||
@@ -591,12 +593,12 @@ void J3DAnmKeyLoader_v15::setAnmColor(J3DAnmColorKey* param_1, const J3DAnmColor
|
||||
param_1->field_0x12 = param_2->field_0x16;
|
||||
param_1->mAnmTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmColorKeyTable>(param_2, param_2->mTableOffset);
|
||||
param_1->mColorR = JSUConvertOffsetToPtr<s16>(param_2, param_2->mRValOffset);
|
||||
param_1->mColorG = JSUConvertOffsetToPtr<s16>(param_2, param_2->mGValOffset);
|
||||
param_1->mColorB = JSUConvertOffsetToPtr<s16>(param_2, param_2->mBValOffset);
|
||||
param_1->mColorA = JSUConvertOffsetToPtr<s16>(param_2, param_2->mAValOffset);
|
||||
param_1->mColorR = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mRValOffset);
|
||||
param_1->mColorG = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mGValOffset);
|
||||
param_1->mColorB = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mBValOffset);
|
||||
param_1->mColorA = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mAValOffset);
|
||||
param_1->mUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(param_2, param_2->mUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(param_2, param_2->mUpdateMaterialIDOffset);
|
||||
param_1->mUpdateMaterialName.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(param_2, param_2->mNameTabOffset));
|
||||
}
|
||||
@@ -636,32 +638,32 @@ void J3DAnmKeyLoader_v15::setAnmTevReg(J3DAnmTevRegKey* param_1,
|
||||
param_1->mAnmCRegKeyTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmCRegKeyTable>(param_2, param_2->mCRegTableOffset);
|
||||
param_1->mCRegUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(param_2, param_2->mCRegUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(param_2, param_2->mCRegUpdateMaterialIDOffset);
|
||||
param_1->mCRegUpdateMaterialName.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(param_2, param_2->mCRegNameTabOffset));
|
||||
param_1->mKRegUpdateMaterialNum = param_2->mKRegUpdateMaterialNum;
|
||||
param_1->mAnmKRegKeyTable =
|
||||
JSUConvertOffsetToPtr<J3DAnmKRegKeyTable>(param_2, param_2->mKRegTableOffset);
|
||||
param_1->mKRegUpdateMaterialID =
|
||||
JSUConvertOffsetToPtr<u16>(param_2, param_2->mKRegUpdateMaterialIDOffset);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(param_2, param_2->mKRegUpdateMaterialIDOffset);
|
||||
param_1->mKRegUpdateMaterialName.setResource(
|
||||
JSUConvertOffsetToPtr<ResNTAB>(param_2, param_2->mKRegNameTabOffset));
|
||||
param_1->mCRegDataCountR = param_2->field_0x10;
|
||||
param_1->mCRegDataCountG = param_2->field_0x12;
|
||||
param_1->mCRegDataCountB = param_2->field_0x14;
|
||||
param_1->mCRegDataCountA = param_2->field_0x16;
|
||||
param_1->mAnmCRegDataR = JSUConvertOffsetToPtr<s16>(param_2, param_2->mCRValuesOffset);
|
||||
param_1->mAnmCRegDataG = JSUConvertOffsetToPtr<s16>(param_2, param_2->mCGValuesOffset);
|
||||
param_1->mAnmCRegDataB = JSUConvertOffsetToPtr<s16>(param_2, param_2->mCBValuesOffset);
|
||||
param_1->mAnmCRegDataA = JSUConvertOffsetToPtr<s16>(param_2, param_2->mCAValuesOffset);
|
||||
param_1->mAnmCRegDataR = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mCRValuesOffset);
|
||||
param_1->mAnmCRegDataG = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mCGValuesOffset);
|
||||
param_1->mAnmCRegDataB = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mCBValuesOffset);
|
||||
param_1->mAnmCRegDataA = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mCAValuesOffset);
|
||||
param_1->mKRegDataCountR = param_2->field_0x18;
|
||||
param_1->mKRegDataCountG = param_2->field_0x1a;
|
||||
param_1->mKRegDataCountB = param_2->field_0x1c;
|
||||
param_1->mKRegDataCountA = param_2->field_0x1e;
|
||||
param_1->mAnmKRegDataR = JSUConvertOffsetToPtr<s16>(param_2, param_2->mKRValuesOffset);
|
||||
param_1->mAnmKRegDataG = JSUConvertOffsetToPtr<s16>(param_2, param_2->mKGValuesOffset);
|
||||
param_1->mAnmKRegDataB = JSUConvertOffsetToPtr<s16>(param_2, param_2->mKBValuesOffset);
|
||||
param_1->mAnmKRegDataA = JSUConvertOffsetToPtr<s16>(param_2, param_2->mKAValuesOffset);
|
||||
param_1->mAnmKRegDataR = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mKRValuesOffset);
|
||||
param_1->mAnmKRegDataG = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mKGValuesOffset);
|
||||
param_1->mAnmKRegDataB = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mKBValuesOffset);
|
||||
param_1->mAnmKRegDataA = JSUConvertOffsetToPtr<BE(s16)>(param_2, param_2->mKAValuesOffset);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ J3DClusterLoader_v15::~J3DClusterLoader_v15() {}
|
||||
|
||||
void* J3DClusterLoader_v15::load(const void* i_data) {
|
||||
J3D_ASSERT_NULLPTR(98, i_data);
|
||||
mpDeformData = new J3DDeformData();
|
||||
mpDeformData = JKR_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 =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(block, block->mClusterName));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(block, block->mClusterName));
|
||||
} else {
|
||||
mpDeformData->mClusterName = NULL;
|
||||
}
|
||||
if (block->mClusterKeyName != NULL) {
|
||||
mpDeformData->mClusterKeyName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(block, block->mClusterKeyName));
|
||||
JKR_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 = new (0x20) u8[vtxPosSize];
|
||||
u8* arr = JKR_NEW_ARGS (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 = new J3DDeformer*[mpDeformData->getClusterNum()];
|
||||
mpDeformData->mDeformers = JKR_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 = new J3DDeformer(mpDeformData);
|
||||
J3DDeformer* deformer = JKR_NEW J3DDeformer(mpDeformData);
|
||||
if (cluster->field_0x14 != 0) {
|
||||
deformer->field_0xc = new f32[cluster->field_0x14 * 3];
|
||||
deformer->field_0xc = JKR_NEW f32[cluster->field_0x14 * 3];
|
||||
} else {
|
||||
deformer->field_0xc = NULL;
|
||||
}
|
||||
deformer->mFlags = cluster->mFlags;
|
||||
deformer->field_0x8 = new f32[cluster->mKeyNum];
|
||||
deformer->field_0x8 = JKR_NEW f32[cluster->mKeyNum];
|
||||
#if TARGET_PC
|
||||
deformer->mArrayBase = arr - clusterPointer;
|
||||
deformer->mBlockBase = block;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DJointFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
J3DJointFactory::J3DJointFactory(J3DJointBlock const& block) {
|
||||
@@ -27,7 +28,7 @@ J3DJointFactory::J3DJointFactory(J3DJointBlock const& block) {
|
||||
}
|
||||
|
||||
J3DJoint* J3DJointFactory::create(int no) {
|
||||
J3DJoint* joint = new J3DJoint();
|
||||
J3DJoint* joint = JKR_NEW J3DJoint();
|
||||
J3D_ASSERT_ALLOCMEM(50, joint);
|
||||
joint->mJntNo = no;
|
||||
joint->mKind = getKind(no);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#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"
|
||||
@@ -135,7 +136,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 = new J3DMaterial();
|
||||
i_material = JKR_NEW J3DMaterial();
|
||||
J3D_ASSERT_ALLOCMEM(269, i_material);
|
||||
}
|
||||
i_material->mColorBlock = J3DMaterial::createColorBlock(color_flag);
|
||||
@@ -235,14 +236,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 = new J3DPatchedMaterial();
|
||||
i_material = JKR_NEW J3DPatchedMaterial();
|
||||
J3D_ASSERT_ALLOCMEM(430, i_material);
|
||||
}
|
||||
bool bVar1 = i_flags & 0x3000000 ? true : false;
|
||||
i_material->mColorBlock = J3DMaterial::createColorBlock(0x40000000);
|
||||
i_material->mTexGenBlock = new J3DTexGenBlockPatched();
|
||||
i_material->mTexGenBlock = JKR_NEW J3DTexGenBlockPatched();
|
||||
J3D_ASSERT_ALLOCMEM(440, i_material->mTexGenBlock);
|
||||
i_material->mTevBlock = new J3DTevBlockPatched();
|
||||
i_material->mTevBlock = JKR_NEW J3DTevBlockPatched();
|
||||
J3D_ASSERT_ALLOCMEM(442, i_material->mTevBlock);
|
||||
i_material->mIndBlock = J3DMaterial::createIndBlock(bVar1);
|
||||
i_material->mPEBlock = J3DMaterial::createPEBlock(0x10000000, getMaterialMode(i_idx));
|
||||
@@ -346,17 +347,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 = new J3DLockedMaterial();
|
||||
i_material = JKR_NEW J3DLockedMaterial();
|
||||
J3D_ASSERT_ALLOCMEM(629, i_material);
|
||||
i_material->mColorBlock = new J3DColorBlockNull();
|
||||
i_material->mColorBlock = JKR_NEW J3DColorBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(634, i_material->mColorBlock);
|
||||
i_material->mTexGenBlock = new J3DTexGenBlockNull();
|
||||
i_material->mTexGenBlock = JKR_NEW J3DTexGenBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(636, i_material->mTexGenBlock);
|
||||
i_material->mTevBlock = new J3DTevBlockNull();
|
||||
i_material->mTevBlock = JKR_NEW J3DTevBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(638, i_material->mTevBlock);
|
||||
i_material->mIndBlock = new J3DIndBlockNull();
|
||||
i_material->mIndBlock = JKR_NEW J3DIndBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(640, i_material->mIndBlock);
|
||||
i_material->mPEBlock = new J3DPEBlockNull();
|
||||
i_material->mPEBlock = JKR_NEW J3DPEBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(642, i_material->mPEBlock);
|
||||
i_material->mIndex = i_idx;
|
||||
i_material->mMaterialMode = mpMaterialMode[i_idx];
|
||||
@@ -370,7 +371,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 = new J3DDisplayListObj();
|
||||
i_material->mSharedDLObj = JKR_NEW J3DDisplayListObj();
|
||||
J3D_ASSERT_ALLOCMEM(673, i_material->mSharedDLObj);
|
||||
i_material->mSharedDLObj->setSingleDisplayList((void*)(
|
||||
mpDisplayListInit[i_idx].mOffset + (uintptr_t)&mpDisplayListInit[i_idx]),
|
||||
@@ -544,9 +545,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 = new J3DTexMtx(tex_mtx_info);
|
||||
tex_mtx = JKR_NEW J3DTexMtx(tex_mtx_info);
|
||||
#else
|
||||
tex_mtx = new J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]);
|
||||
tex_mtx = JKR_NEW J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]);
|
||||
#endif
|
||||
}
|
||||
return tex_mtx;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
@@ -89,7 +90,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 = new J3DMaterial();
|
||||
i_material = JKR_NEW J3DMaterial();
|
||||
}
|
||||
i_material->mColorBlock = J3DMaterial::createColorBlock(color_flag);
|
||||
i_material->mTexGenBlock = J3DMaterial::createTexGenBlock(texgen_flag);
|
||||
@@ -221,7 +222,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 = new J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]);
|
||||
tex_mtx = JKR_NEW J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]);
|
||||
}
|
||||
return tex_mtx;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJointTree.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJointTree.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DJointFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DShapeFactory.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/JUtility/JUTNameTab.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
#include "JSystem/JUtility/JUTNameTab.h"
|
||||
#include "SSystem/SComponent/c_xyz.h"
|
||||
#include <utility>
|
||||
|
||||
J3DModelLoader::J3DModelLoader() :
|
||||
mpModelData(NULL),
|
||||
@@ -64,7 +66,7 @@ J3DModelData* J3DModelLoaderDataBase::loadBinaryDisplayList(const void* i_data,
|
||||
|
||||
J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
|
||||
s32 freeSize = JKRGetCurrentHeap()->getTotalFreeSize();
|
||||
mpModelData = new J3DModelData();
|
||||
mpModelData = JKR_NEW J3DModelData();
|
||||
J3D_ASSERT_ALLOCMEM(177, mpModelData);
|
||||
mpModelData->clear();
|
||||
mpModelData->mpRawData = i_data;
|
||||
@@ -123,7 +125,7 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
|
||||
|
||||
J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
|
||||
int flags = 0x51100000;
|
||||
mpMaterialTable = new J3DMaterialTable();
|
||||
mpMaterialTable = JKR_NEW J3DMaterialTable();
|
||||
J3D_ASSERT_ALLOCMEM(279, mpMaterialTable);
|
||||
mpMaterialTable->clear();
|
||||
J3DModelFileData const* data = (J3DModelFileData*)i_data;
|
||||
@@ -146,7 +148,7 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
|
||||
block = (J3DModelBlock*)((uintptr_t)block + block->mBlockSize);
|
||||
}
|
||||
if (mpMaterialTable->mTexture == NULL) {
|
||||
mpMaterialTable->mTexture = new J3DTexture(0, NULL);
|
||||
mpMaterialTable->mTexture = JKR_NEW J3DTexture(0, NULL);
|
||||
J3D_ASSERT_ALLOCMEM(319, mpMaterialTable->mTexture);
|
||||
}
|
||||
return mpMaterialTable;
|
||||
@@ -157,7 +159,7 @@ inline u32 getBdlFlag_MaterialType(u32 flags) {
|
||||
}
|
||||
|
||||
J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_flags) {
|
||||
mpModelData = new J3DModelData();
|
||||
mpModelData = JKR_NEW J3DModelData();
|
||||
J3D_ASSERT_ALLOCMEM(338, mpModelData);
|
||||
mpModelData->clear();
|
||||
mpModelData->mpRawData = i_data;
|
||||
@@ -262,13 +264,13 @@ void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_fla
|
||||
J3DMtxCalc* mtx_calc = NULL;
|
||||
switch (mpModelData->mFlags & 0xf) {
|
||||
case 0:
|
||||
mtx_calc = new J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformBasic,J3DMtxCalcJ3DSysInitBasic>();
|
||||
mtx_calc = JKR_NEW J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformBasic,J3DMtxCalcJ3DSysInitBasic>();
|
||||
break;
|
||||
case 1:
|
||||
mtx_calc = new J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformSoftimage,J3DMtxCalcJ3DSysInitSoftimage>();
|
||||
mtx_calc = JKR_NEW J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformSoftimage,J3DMtxCalcJ3DSysInitSoftimage>();
|
||||
break;
|
||||
case 2:
|
||||
mtx_calc = new J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformMaya,J3DMtxCalcJ3DSysInitMaya>();
|
||||
mtx_calc = JKR_NEW J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformMaya,J3DMtxCalcJ3DSysInitMaya>();
|
||||
break;
|
||||
default:
|
||||
JUT_PANIC(529, "Error : Invalid MtxCalcType.");
|
||||
@@ -279,8 +281,24 @@ void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_fla
|
||||
mpModelData->getVertexData().mPacketNum = i_block->mPacketNum;
|
||||
mpModelData->getVertexData().mVtxNum = i_block->mVtxNum;
|
||||
mpModelData->setHierarchy(JSUConvertOffsetToPtr<J3DModelHierarchy>(i_block, i_block->mpHierarchy));
|
||||
|
||||
#if TARGET_PC
|
||||
mpModelData->getVertexData().mHasReadInformation = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
static GXVtxAttrFmtList getFmt(GXVtxAttrFmtList* i_fmtList, GXAttr i_attr) {
|
||||
for (; i_fmtList->attr != GX_VA_NULL; i_fmtList++) {
|
||||
if (i_fmtList->attr == i_attr) {
|
||||
return *i_fmtList;
|
||||
}
|
||||
}
|
||||
|
||||
OSPanic(__FILE__, __LINE__, "Unable to find vertex attribute format!");
|
||||
}
|
||||
#endif
|
||||
|
||||
static GXCompType getFmtType(GXVtxAttrFmtList* i_fmtList, GXAttr i_attr) {
|
||||
for (; i_fmtList->attr != GX_VA_NULL; i_fmtList++) {
|
||||
if (i_fmtList->attr == i_attr) {
|
||||
@@ -336,9 +354,11 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
||||
if (vertex_data.mVtxNrmArray == NULL) {
|
||||
vertex_data.mNrmNum = 0;
|
||||
} else if (nrm_end != NULL) {
|
||||
vertex_data.mNrmNum = ((uintptr_t)nrm_end - (uintptr_t)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 - (uintptr_t)i_block->mpVtxNrmArray) / nrm_size + 1;
|
||||
vertex_data.mNrmNum =
|
||||
(i_block->mBlockSize - (uintptr_t)i_block->mpVtxNrmArray) / nrm_size + 1;
|
||||
}
|
||||
|
||||
void* color0_end = NULL;
|
||||
@@ -351,9 +371,11 @@ 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 = ((uintptr_t)color0_end - (uintptr_t)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 - (uintptr_t)i_block->mpVtxColorArray[0]) / 4 + 1;
|
||||
vertex_data.mColNum =
|
||||
(i_block->mBlockSize - (uintptr_t)i_block->mpVtxColorArray[0]) / 4 + 1;
|
||||
}
|
||||
|
||||
int local_28 = 0;
|
||||
@@ -368,21 +390,182 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
||||
if (local_28) {
|
||||
vertex_data.mTexCoordNum = (local_28 - (uintptr_t)vertex_data.mVtxTexCoordArray[0]) / 8 + 1;
|
||||
} else {
|
||||
vertex_data.mTexCoordNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxTexCoordArray[0]) / 8 + 1;
|
||||
vertex_data.mTexCoordNum =
|
||||
(i_block->mBlockSize - (uintptr_t)i_block->mpVtxTexCoordArray[0]) / 8 + 1;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
readVertexData(*i_block, vertex_data);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
|
||||
// Approach taken from here:
|
||||
// https://github.com/zeldaret/tp/blob/6c72b91f8e477ee94ccdc56b94605140e9f2abd6/libs/JSystem/src/J3DGraphBase/J3DShape.cpp#L156-L211
|
||||
|
||||
template <typename T>
|
||||
static void FixArrayEndian(void* arrayStart, void* arrayEnd) {
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
u32 itemCount = ((u8*)arrayEnd - (u8*)arrayStart) / sizeof(T);
|
||||
be_swap((T*)arrayStart, itemCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void FixArrayEndian_24(void* arrayStart, void* arrayEnd) {
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
for (u8* work = (u8*)arrayStart; work != (u8*)arrayEnd; work += 3)
|
||||
std::swap(work[0], work[2]);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void FixArrayEndian(void* arrayStart, void* arrayEnd, u32 stride) {
|
||||
switch (stride) {
|
||||
case 1:
|
||||
// Nothing needs to happen here!
|
||||
break;
|
||||
case 2:
|
||||
FixArrayEndian<u16>(arrayStart, arrayEnd);
|
||||
break;
|
||||
case 3:
|
||||
FixArrayEndian_24(arrayStart, arrayEnd);
|
||||
break;
|
||||
case 4:
|
||||
FixArrayEndian<u32>(arrayStart, arrayEnd);
|
||||
break;
|
||||
default:
|
||||
OSPanic(__FILE__, __LINE__, "Unknown component type?");
|
||||
}
|
||||
}
|
||||
|
||||
static GXAttr VertexBlockAttrOrder[13] = {
|
||||
GX_VA_POS,
|
||||
GX_VA_NRM,
|
||||
GX_VA_NBT,
|
||||
GX_VA_CLR0,
|
||||
GX_VA_CLR1,
|
||||
GX_VA_TEX0,
|
||||
GX_VA_TEX1,
|
||||
GX_VA_TEX2,
|
||||
GX_VA_TEX3,
|
||||
GX_VA_TEX4,
|
||||
GX_VA_TEX5,
|
||||
GX_VA_TEX6,
|
||||
GX_VA_TEX7,
|
||||
};
|
||||
|
||||
static void* GetDataEnd(const J3DVertexBlock& block, int start) {
|
||||
const BE(u32)* attrPtrBase = &block.mpVtxPosArray;
|
||||
|
||||
for (int i = start + 1; i < ARRAY_SIZEU(VertexBlockAttrOrder); i++) {
|
||||
if (attrPtrBase[i] != 0) {
|
||||
return JSUConvertOffsetToPtr<void>(&block, attrPtrBase[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return JSUConvertOffsetToPtr<void>(&block, block.mBlockSize);
|
||||
}
|
||||
|
||||
auto StrideForData(GXAttr attr, GXCompType type, GXCompCnt cnt) -> std::pair<u32, u32> {
|
||||
auto CompTypeStrideRaw = [&] {
|
||||
if (type == GX_F32)
|
||||
return 4;
|
||||
else if (type == GX_U16 || type == GX_S16)
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
};
|
||||
|
||||
auto HandleColor = [&]() -> std::pair<u32, u32> {
|
||||
if (type == GX_RGB565)
|
||||
return {1, 2}; // u16[1]
|
||||
else if (type == GX_RGB8)
|
||||
return {3, 1}; // u8[3]
|
||||
else if (type == GX_RGBX8)
|
||||
return {4, 1}; // u8[4]
|
||||
else if (type == GX_RGBA4)
|
||||
return {1, 2}; // u16[1]
|
||||
else if (type == GX_RGBA6)
|
||||
return {3, 1}; // u8[3]
|
||||
else if (type == GX_RGBA8)
|
||||
return {4, 1}; // u8[4]
|
||||
};
|
||||
|
||||
auto CompCnt = [&] {
|
||||
if (attr == GX_VA_POS) {
|
||||
return cnt == GX_POS_XY ? 2 : 3;
|
||||
} else if (attr == GX_VA_NRM) {
|
||||
return cnt == GX_NRM_XYZ ? 3 : 9; // NBT3 is lies
|
||||
} else if (attr >= GX_VA_CLR0 && attr <= GX_VA_CLR1) {
|
||||
return cnt == GX_CLR_RGB ? 3 : 4; // clr is special anyway
|
||||
} else if (attr >= GX_VA_TEX0 && attr <= GX_VA_TEX7) {
|
||||
return cnt == GX_TEX_S ? 1 : 2;
|
||||
} else {
|
||||
JUT_ASSERT(1234, false);
|
||||
}
|
||||
};
|
||||
|
||||
if (attr >= GX_VA_CLR0 && attr <= GX_VA_CLR1) {
|
||||
return HandleColor();
|
||||
} else {
|
||||
int compCnt = CompCnt();
|
||||
int compStride = CompTypeStrideRaw();
|
||||
return {compCnt, compStride};
|
||||
}
|
||||
}
|
||||
|
||||
void J3DModelLoader::readVertexData(const J3DVertexBlock& block, J3DVertexData& data) {
|
||||
if (!data.mHasReadInformation) {
|
||||
OSPanic(__FILE__, __LINE__, "Model has VTX1 before INF1?");
|
||||
}
|
||||
|
||||
const BE(u32)* attrPtrBase = &block.mpVtxPosArray;
|
||||
for (int i = 0; i < ARRAY_SIZEU(VertexBlockAttrOrder); i++) {
|
||||
GXAttr attr = VertexBlockAttrOrder[i];
|
||||
|
||||
if (attrPtrBase[i] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
GXVtxAttrFmtList fmt = getFmt(data.mVtxAttrFmtList, attr);
|
||||
|
||||
void* startAddr = JSUConvertOffsetToPtr<void>(&block, attrPtrBase[i]);
|
||||
void* endAddr = GetDataEnd(block, i);
|
||||
auto [compCnt, compStride] = StrideForData(attr, fmt.type, fmt.cnt);
|
||||
u32 vertStride = compStride * compCnt;
|
||||
data.mVtxArrStride[attr - GX_VA_POS] = vertStride;
|
||||
|
||||
u32 addrDiff = u32((u8*)endAddr - (u8*)startAddr);
|
||||
u32 num = addrDiff / vertStride;
|
||||
data.mVtxArrNum[attr - GX_VA_POS] = num;
|
||||
FixArrayEndian(startAddr, endAddr, compStride);
|
||||
|
||||
if (attr == GX_VA_POS) {
|
||||
// can be a little off due to 0x20 alignment, account for that
|
||||
u32 expect = ((data.mVtxNum * vertStride) + 0x1F) & ~0x1F;
|
||||
JUT_ASSERT(1234, expect == addrDiff);
|
||||
} else if (attr == GX_VA_NRM) {
|
||||
data.mNrmNum = num;
|
||||
} else if (attr == GX_VA_CLR0) {
|
||||
data.mColNum = num;
|
||||
} else if (attr == GX_VA_TEX0) {
|
||||
data.mTexCoordNum = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void J3DModelLoader::readEnvelop(J3DEnvelopeBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(724, i_block);
|
||||
mpModelData->getJointTree().mWEvlpMtxNum = i_block->mWEvlpMtxNum;
|
||||
mpModelData->getJointTree().mWEvlpMixMtxNum =
|
||||
JSUConvertOffsetToPtr<u8>(i_block, i_block->mpWEvlpMixMtxNum);
|
||||
mpModelData->getJointTree().mWEvlpMixMtxIndex =
|
||||
JSUConvertOffsetToPtr<u16>(i_block, i_block->mpWEvlpMixIndex);
|
||||
JSUConvertOffsetToPtr<BE(u16)>(i_block, i_block->mpWEvlpMixIndex);
|
||||
mpModelData->getJointTree().mWEvlpMixWeight =
|
||||
JSUConvertOffsetToPtr<f32>(i_block, i_block->mpWEvlpMixWeight);
|
||||
JSUConvertOffsetToPtr<BE(f32)>(i_block, i_block->mpWEvlpMixWeight);
|
||||
mpModelData->getJointTree().mInvJointMtx =
|
||||
JSUConvertOffsetToPtr<Mtx>(i_block, i_block->mpInvJointMtx);
|
||||
JSUConvertOffsetToPtr<BE(Mtx)>(i_block, i_block->mpInvJointMtx);
|
||||
}
|
||||
|
||||
void J3DModelLoader::readDraw(J3DDrawBlock const* i_block) {
|
||||
@@ -390,7 +573,7 @@ void J3DModelLoader::readDraw(J3DDrawBlock const* i_block) {
|
||||
J3DDrawMtxData* drawMtxData = mpModelData->getDrawMtxData();
|
||||
drawMtxData->mEntryNum = i_block->mMtxNum - mpModelData->getWEvlpMtxNum();
|
||||
drawMtxData->mDrawMtxFlag = JSUConvertOffsetToPtr<u8>(i_block, i_block->mpDrawMtxFlag);
|
||||
drawMtxData->mDrawMtxIndex = JSUConvertOffsetToPtr<u16>(i_block, i_block->mpDrawMtxIndex);
|
||||
drawMtxData->mDrawMtxIndex = JSUConvertOffsetToPtr<BE(u16)>(i_block, i_block->mpDrawMtxIndex);
|
||||
u16 i;
|
||||
for (i = 0; i < drawMtxData->mEntryNum; i++) {
|
||||
if (drawMtxData->mDrawMtxFlag[i] == 1) {
|
||||
@@ -398,7 +581,7 @@ void J3DModelLoader::readDraw(J3DDrawBlock const* i_block) {
|
||||
}
|
||||
}
|
||||
drawMtxData->mDrawFullWgtMtxNum = i;
|
||||
mpModelData->getJointTree().mWEvlpImportantMtxIdx = new u16[drawMtxData->mEntryNum];
|
||||
mpModelData->getJointTree().mWEvlpImportantMtxIdx = JKR_NEW u16[drawMtxData->mEntryNum];
|
||||
J3D_ASSERT_ALLOCMEM(767, mpModelData->getJointTree().mWEvlpImportantMtxIdx);
|
||||
}
|
||||
|
||||
@@ -408,13 +591,13 @@ void J3DModelLoader::readJoint(J3DJointBlock const* i_block) {
|
||||
mpModelData->getJointTree().mJointNum = i_block->mJointNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpModelData->getJointTree().mJointName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(791, mpModelData->getJointTree().mJointName);
|
||||
} else {
|
||||
mpModelData->getJointTree().mJointName = NULL;
|
||||
}
|
||||
mpModelData->getJointTree().mJointNodePointer =
|
||||
new J3DJoint*[mpModelData->getJointTree().mJointNum];
|
||||
JKR_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 +611,15 @@ void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_fla
|
||||
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(832, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(841, mpMaterialTable->mMaterialNodePointer);
|
||||
if (i_flags & 0x200000) {
|
||||
mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
|
||||
mpMaterialTable->field_0x10 = JKR_NEW_ARGS (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
|
||||
J3D_ASSERT_ALLOCMEM(846, mpMaterialTable->field_0x10);
|
||||
} else {
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
@@ -474,15 +657,15 @@ void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u
|
||||
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(930, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(940, mpMaterialTable->mMaterialNodePointer);
|
||||
if (i_flags & 0x200000) {
|
||||
mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
|
||||
mpMaterialTable->field_0x10 = JKR_NEW_ARGS (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
|
||||
J3D_ASSERT_ALLOCMEM(945, mpMaterialTable->field_0x10);
|
||||
} else {
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
@@ -518,12 +701,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 =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1026, shape_table->mShapeName);
|
||||
} else {
|
||||
shape_table->mShapeName = NULL;
|
||||
}
|
||||
shape_table->mShapeNodePointer = new J3DShape*[shape_table->mShapeNum];
|
||||
shape_table->mShapeNodePointer = JKR_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 +726,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 =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1077, mpMaterialTable->mTextureName);
|
||||
} else {
|
||||
mpMaterialTable->mTextureName = NULL;
|
||||
}
|
||||
mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res);
|
||||
mpMaterialTable->mTexture = JKR_NEW J3DTexture(texture_num, texture_res);
|
||||
J3D_ASSERT_ALLOCMEM(1084, mpMaterialTable->mTexture);
|
||||
}
|
||||
|
||||
@@ -558,12 +741,12 @@ void J3DModelLoader_v26::readMaterialTable(J3DMaterialBlock const* i_block, u32
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1114, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1121, mpMaterialTable->mMaterialNodePointer);
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i] =
|
||||
@@ -581,12 +764,12 @@ void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_blo
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1165, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1172, mpMaterialTable->mMaterialNodePointer);
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i] =
|
||||
@@ -604,12 +787,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 =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1211, mpMaterialTable->mTextureName);
|
||||
} else {
|
||||
mpMaterialTable->mTextureName = NULL;
|
||||
}
|
||||
mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res);
|
||||
mpMaterialTable->mTexture = JKR_NEW J3DTexture(texture_num, texture_res);
|
||||
J3D_ASSERT_ALLOCMEM(1218, mpMaterialTable->mTexture);
|
||||
}
|
||||
|
||||
@@ -620,12 +803,12 @@ void J3DModelLoader::readPatchedMaterial(J3DMaterialBlock const* i_block, u32 i_
|
||||
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1251, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1260, mpMaterialTable->mMaterialNodePointer);
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
@@ -646,12 +829,12 @@ void J3DModelLoader::readMaterialDL(J3DMaterialDLBlock const* i_block, u32 i_fla
|
||||
mpMaterialTable->mUniqueMatNum = i_block->mMaterialNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
JKR_NEW JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1312, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
mpMaterialTable->mMaterialNodePointer = JKR_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 = new J3DShape;
|
||||
J3DShape* shape = JKR_NEW J3DShape;
|
||||
J3D_ASSERT_ALLOCMEM(67, shape);
|
||||
shape->mMtxGroupNum = getMtxGroupNum(no);
|
||||
shape->mRadius = getRadius(no);
|
||||
shape->mVtxDesc = getVtxDescList(no);
|
||||
shape->mShapeMtx = new J3DShapeMtx*[shape->mMtxGroupNum];
|
||||
shape->mShapeMtx = JKR_NEW J3DShapeMtx*[shape->mMtxGroupNum];
|
||||
J3D_ASSERT_ALLOCMEM(74, shape->mShapeMtx);
|
||||
shape->mShapeDraw = new J3DShapeDraw*[shape->mMtxGroupNum];
|
||||
shape->mShapeDraw = JKR_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 = new J3DShapeMtxConcatView(mtxInitData.mUseMtxIndex);
|
||||
ret = JKR_NEW J3DShapeMtxConcatView(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_BBoard:
|
||||
ret = new J3DShapeMtxBBoardConcatView(mtxInitData.mUseMtxIndex);
|
||||
ret = JKR_NEW J3DShapeMtxBBoardConcatView(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = new J3DShapeMtxYBBoardConcatView(mtxInitData.mUseMtxIndex);
|
||||
ret = JKR_NEW J3DShapeMtxYBBoardConcatView(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = new J3DShapeMtxMultiConcatView(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount,
|
||||
ret = JKR_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 = new J3DShapeMtx(mtxInitData.mUseMtxIndex);
|
||||
ret = JKR_NEW J3DShapeMtx(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = new J3DShapeMtxMulti(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount,
|
||||
ret = JKR_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 = new J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize);
|
||||
shapeDraw = JKR_NEW J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize);
|
||||
J3D_ASSERT_ALLOCMEM(193, shapeDraw);
|
||||
return shapeDraw;
|
||||
}
|
||||
|
||||
void J3DShapeFactory::allocVcdVatCmdBuffer(u32 count) {
|
||||
mVcdVatCmdBuffer = new (0x20) u8[J3DShape::kVcdVatDLSize * count];
|
||||
mVcdVatCmdBuffer = JKR_NEW_ARGS (0x20) u8[J3DShape::kVcdVatDLSize * count];
|
||||
J3D_ASSERT_ALLOCMEM(211, mVcdVatCmdBuffer);
|
||||
for (u32 i = 0; i < (J3DShape::kVcdVatDLSize * count) / 4; i++)
|
||||
((u32*)mVcdVatCmdBuffer)[i] = 0;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DU/J3DUClipper.h"
|
||||
#include "global.h"
|
||||
#include <cmath>
|
||||
#include "global.h"
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ JAWGraphContext::JAWGraphContext() :
|
||||
field_0x16 = 6;
|
||||
field_0x18 = 0;
|
||||
if (!sFont) {
|
||||
sFont = new JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL);
|
||||
sFont = JKR_NEW JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL);
|
||||
}
|
||||
field_0x0 = new J2DPrint(sFont, JUtility::TColor(255, 255, 255, 255), JUtility::TColor(255, 255, 255, 255));
|
||||
field_0x0 = JKR_NEW J2DPrint(sFont, JUtility::TColor(255, 255, 255, 255), JUtility::TColor(255, 255, 255, 255));
|
||||
field_0x0->initiate();
|
||||
locate(0, 0);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ void JAISeCategoryMgr::JAISeMgr_freeDeadSe_() {
|
||||
if (i->getObject()->status_.isDead()) {
|
||||
JUT_ASSERT(71, ! i->getObject() ->isHandleAttached());
|
||||
mSeList.remove(i);
|
||||
delete i->getObject();
|
||||
JKR_DELETE(i->getObject());
|
||||
}
|
||||
i = link_next;
|
||||
}
|
||||
@@ -258,7 +258,7 @@ JAISe* JAISeMgr::newSe_(int category, u32 priority) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JAISe* se = new JAISe(this, mStrategyMgr, priority);
|
||||
JAISe* se = JKR_NEW JAISe(this, mStrategyMgr, priority);
|
||||
if (se == NULL) {
|
||||
JUT_WARN(410, "%s", "JASPoolAllocObject::<JAISe>::operator new failed .\n")
|
||||
return NULL;
|
||||
|
||||
@@ -56,7 +56,7 @@ void JAISeq::reserveChildTracks_(int param_0) {
|
||||
JUT_ASSERT(92, inner_.outputTrack.getStatus() == JASTrack::STATUS_FREE);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
JASTrack* track = new JASTrack();
|
||||
JASTrack* track = JKR_NEW JASTrack();
|
||||
if (track) {
|
||||
track->setAutoDelete(true);
|
||||
inner_.outputTrack.connectChild(i, track);
|
||||
@@ -67,7 +67,7 @@ void JAISeq::reserveChildTracks_(int param_0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
JASTrack* track2 = new JASTrack();
|
||||
JASTrack* track2 = JKR_NEW JASTrack();
|
||||
if (track2) {
|
||||
track2->setAutoDelete(true);
|
||||
track->connectChild(j, track2);
|
||||
@@ -90,10 +90,10 @@ void JAISeq::releaseChildTracks_() {
|
||||
for (u32 j = 0; j < 16; j++) {
|
||||
JASTrack* track2 = track->getChild(j);
|
||||
if (track2) {
|
||||
delete track2;
|
||||
JKR_DELETE(track2);
|
||||
}
|
||||
}
|
||||
delete track;
|
||||
JKR_DELETE(track);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ void JAISeq::die_() {
|
||||
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if (inner_.mSoundChild[i]) {
|
||||
delete inner_.mSoundChild[i];
|
||||
JKR_DELETE(inner_.mSoundChild[i]);
|
||||
inner_.mSoundChild[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ JAISoundChild* JAISeq::getChild(int index) {
|
||||
return inner_.mSoundChild[index];
|
||||
}
|
||||
|
||||
inner_.mSoundChild[index] = new JAISoundChild();
|
||||
inner_.mSoundChild[index] = JKR_NEW JAISoundChild();
|
||||
if (!inner_.mSoundChild[index]) {
|
||||
JUT_WARN(379, "%s", "JASPoolAllocObject::<JAISoundChild>::operator new failed .\n");
|
||||
return NULL;
|
||||
@@ -273,7 +273,7 @@ void JAISeq::releaseChild(int index) {
|
||||
if (track) {
|
||||
track->assignExtBuffer(0, NULL);
|
||||
}
|
||||
delete inner_.mSoundChild[index];
|
||||
JKR_DELETE(inner_.mSoundChild[index]);
|
||||
inner_.mSoundChild[index] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ void JAISeqMgr::freeDeadSeq_() {
|
||||
JSULink<JAISeq>* next = i->getNext();
|
||||
if (seq->status_.isDead()) {
|
||||
mSeqList.remove(i);
|
||||
delete seq;
|
||||
JKR_DELETE(seq);
|
||||
}
|
||||
i = next;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ void JAISeqMgr::mixOut() {
|
||||
}
|
||||
|
||||
JAISeq* JAISeqMgr::beginStartSeq_() {
|
||||
JAISeq* seq = new JAISeq(this, field_0x10);
|
||||
JAISeq* seq = JKR_NEW JAISeq(this, field_0x10);
|
||||
if (seq == NULL) {
|
||||
JUT_WARN(273, "%s", "JASPoolAllocObject::<JAISeq>::operator new failed .\n");
|
||||
}
|
||||
@@ -137,7 +137,7 @@ bool JAISeqMgr::endStartSeq_(JAISeq* seq, JAISoundHandle* handle) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
delete sound;
|
||||
JKR_DELETE(sound);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,5 +5,7 @@
|
||||
JAISoundInfo::JAISoundInfo(bool setInstance) : JASGlobalInstance<JAISoundInfo>(setInstance) {}
|
||||
|
||||
JAISoundInfo::~JAISoundInfo() {
|
||||
#if !TARGET_PC
|
||||
JUT_ASSERT(14, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ void JAIStream::die_JAIStream_() {
|
||||
|
||||
for (int i = 0; i < NUM_CHILDREN; i++) {
|
||||
if (children_[i] != NULL) {
|
||||
delete children_[i];
|
||||
JKR_DELETE(children_[i]);
|
||||
children_[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ s32 JAIStream::getNumChild() const {
|
||||
|
||||
JAISoundChild* JAIStream::getChild(int index) {
|
||||
if (children_[index] == NULL) {
|
||||
children_[index] = new JAISoundChild();
|
||||
children_[index] = JKR_NEW JAISoundChild();
|
||||
if (children_[index] == NULL) {
|
||||
JUT_WARN(370, "%s", "JASPoolAllocObject::<JAISoundChild>::operator new failed .\n")
|
||||
}
|
||||
@@ -259,7 +259,7 @@ JAISoundChild* JAIStream::getChild(int index) {
|
||||
|
||||
void JAIStream::releaseChild(int index) {
|
||||
if (children_[index] != NULL) {
|
||||
delete children_[index];
|
||||
JKR_DELETE(children_[index]);
|
||||
children_[index] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
#include "JSystem/JAudio2/JAIStreamDataMgr.h"
|
||||
|
||||
JAIStreamDataMgr::~JAIStreamDataMgr() {
|
||||
#if !TARGET_PC
|
||||
JUT_ASSERT(11, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
JAIStreamAramMgr::~JAIStreamAramMgr() {
|
||||
#if !TARGET_PC
|
||||
JUT_ASSERT(16, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ void JAIStreamMgr::freeDeadStream_() {
|
||||
JUT_ASSERT(105, result);
|
||||
}
|
||||
|
||||
delete stream;
|
||||
JKR_DELETE(stream);
|
||||
}
|
||||
i = next;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ JAIStream* JAIStreamMgr::newStream_() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JAIStream* stream = new JAIStream(this, field_0x6c);
|
||||
JAIStream* stream = JKR_NEW JAIStream(this, field_0x6c);
|
||||
if (stream == NULL) {
|
||||
JUT_WARN(235, "%s", "JASPoolAllocObject::<JAIStream>::operator new failed .\n");
|
||||
return NULL;
|
||||
|
||||
@@ -51,15 +51,15 @@ void JASDriver::initAI(void (*param_0)(void)) {
|
||||
u32 dacSize = getDacSize();
|
||||
const u32 size = dacSize * 2;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
sDmaDacBuffer[i] = new(JASDram, 0x20) s16[dacSize];
|
||||
sDmaDacBuffer[i] = JKR_NEW_ARGS(JASDram, 0x20) s16[dacSize];
|
||||
JUT_ASSERT(102, sDmaDacBuffer[i])
|
||||
JASCalc::bzero(sDmaDacBuffer[i], size);
|
||||
DCStoreRange(sDmaDacBuffer[i], size);
|
||||
}
|
||||
sDspDacBuffer = new(JASDram, 0) s16*[data_804507A8];
|
||||
sDspDacBuffer = JKR_NEW_ARGS(JASDram, 0) s16*[data_804507A8];
|
||||
JUT_ASSERT(113, sDspDacBuffer);
|
||||
for (int i = 0; i < data_804507A8; i++) {
|
||||
sDspDacBuffer[i] = new(JASDram, 0x20) s16[getDacSize()];
|
||||
sDspDacBuffer[i] = JKR_NEW_ARGS(JASDram, 0x20) s16[getDacSize()];
|
||||
JUT_ASSERT(119, sDspDacBuffer[i]);
|
||||
JASCalc::bzero(sDspDacBuffer[i], size);
|
||||
DCStoreRange(sDspDacBuffer[i], size);
|
||||
|
||||
@@ -33,7 +33,7 @@ void JASAramStream::initSystem(u32 block_size, u32 channel_max) {
|
||||
if (sLoadThread == NULL) {
|
||||
sLoadThread = JASDvd::getThreadPointer();
|
||||
}
|
||||
sReadBuffer = new (JASDram, 0x20) u8[(block_size + 0x20) * channel_max];
|
||||
sReadBuffer = JKR_NEW_ARGS (JASDram, 0x20) u8[(block_size + 0x20) * channel_max];
|
||||
JUT_ASSERT(79, sReadBuffer);
|
||||
sBlockSize = block_size;
|
||||
sChannelMax = channel_max;
|
||||
@@ -667,7 +667,7 @@ void JASAramStream::channelStart() {
|
||||
// probably a fake match, this should be set in the JASWaveInfo constructor
|
||||
static u32 const one = 1;
|
||||
wave_info.field_0x20 = &one;
|
||||
JASChannel* jc = new JASChannel(channelCallback, this);
|
||||
JASChannel* jc = JKR_NEW JASChannel(channelCallback, this);
|
||||
JUT_ASSERT(963, jc);
|
||||
jc->setPriority(0x7f7f);
|
||||
for (u32 j = 0; j < 6; j++) {
|
||||
|
||||
@@ -38,7 +38,7 @@ void JASAudioThread::create(s32 threadPriority) {
|
||||
#else
|
||||
const int size = 0x2800;
|
||||
#endif
|
||||
JASAudioThread* pAudioThread = new (JASDram, 0) JASAudioThread(threadPriority, 0x10, size);
|
||||
JASAudioThread* pAudioThread = JKR_NEW_ARGS (JASDram, 0) JASAudioThread(threadPriority, 0x10, size);
|
||||
JUT_ASSERT(46, pAudioThread);
|
||||
JKRHeap* pCurrentHeap = JKRGetSystemHeap();
|
||||
JUT_ASSERT(48, pCurrentHeap);
|
||||
|
||||
@@ -56,7 +56,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
|
||||
heap = JASDram;
|
||||
}
|
||||
|
||||
JASBasicBank* bank = new (heap, 0) JASBasicBank();
|
||||
JASBasicBank* bank = JKR_NEW_ARGS (heap, 0) JASBasicBank();
|
||||
if (bank == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -68,12 +68,12 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
|
||||
TListChunk* list_chunk = (TListChunk*)findChunk(stream, 'LIST');
|
||||
JUT_ASSERT(145, list_chunk);
|
||||
|
||||
u8* envt = new (heap, 2) u8[envt_chunk->mSize];
|
||||
u8* envt = JKR_NEW_ARGS (heap, 2) u8[envt_chunk->mSize];
|
||||
JASCalc::bcopy(envt_chunk->mData, envt, envt_chunk->mSize);
|
||||
|
||||
BE(u32)* ptr = &osc_chunk->mCount;
|
||||
u32 count = *ptr++;
|
||||
JASOscillator::Data* osc_data = new (heap, 0) JASOscillator::Data[count];
|
||||
JASOscillator::Data* osc_data = JKR_NEW_ARGS (heap, 0) JASOscillator::Data[count];
|
||||
for (int i = 0; i < count; i++, ptr += sizeof(TOsc) >> 2) {
|
||||
TOsc* op = (TOsc*)ptr;
|
||||
JUT_ASSERT(155, op->id == 'Osci');
|
||||
@@ -94,7 +94,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
|
||||
BE(u32)* data = (BE(u32)*)((intptr_t)stream + list_chunk->mOffsets[i]);
|
||||
switch (*data++) {
|
||||
case 'Inst': {
|
||||
JASBasicInst* instp = new (heap, 0) JASBasicInst();
|
||||
JASBasicInst* instp = JKR_NEW_ARGS (heap, 0) JASBasicInst();
|
||||
JUT_ASSERT(187, instp != NULL);
|
||||
u32 count = *data++;
|
||||
for (int j = 0; j < count; j++) {
|
||||
@@ -126,7 +126,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
|
||||
}
|
||||
|
||||
case 'Perc': {
|
||||
JASDrumSet* drump = new (heap, 0) JASDrumSet();
|
||||
JASDrumSet* drump = JKR_NEW_ARGS (heap, 0) JASDrumSet();
|
||||
JUT_ASSERT(264, drump != NULL);
|
||||
u32 pmap_count = data[1];
|
||||
JUT_ASSERT(268, pmap_count <= 128);
|
||||
@@ -135,7 +135,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
|
||||
for (int j = 0; j < count; j++) {
|
||||
u32 offset = *data++;
|
||||
if (offset != 0) {
|
||||
JASDrumSet::TPerc* percp = new (heap, 0) JASDrumSet::TPerc();
|
||||
JASDrumSet::TPerc* percp = JKR_NEW_ARGS (heap, 0) JASDrumSet::TPerc();
|
||||
JUT_ASSERT(277, percp);
|
||||
u32 type = data[0];
|
||||
JUT_ASSERT(282, type == 'Pmap');
|
||||
@@ -177,7 +177,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
}
|
||||
|
||||
THeader const* header = (THeader*)stream;
|
||||
JASBasicBank* bank = new (heap, 0) JASBasicBank();
|
||||
JASBasicBank* bank = JKR_NEW_ARGS (heap, 0) JASBasicBank();
|
||||
if (bank == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
for (int i = 0; i < 0x80; i++) {
|
||||
TInst* tinst = header->mOffsets.mInstOffset[i].ptr(header);
|
||||
if (tinst != NULL) {
|
||||
JASBasicInst* instp = new (heap, 0) JASBasicInst();
|
||||
JASBasicInst* instp = JKR_NEW_ARGS (heap, 0) JASBasicInst();
|
||||
JUT_ASSERT(368, instp != NULL);
|
||||
instp->setVolume(tinst->mVolume);
|
||||
instp->setPitch(tinst->mPitch);
|
||||
@@ -200,7 +200,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
if (osc != NULL) {
|
||||
instp->setOsc(osc_idx, osc);
|
||||
} else {
|
||||
osc = new (heap, 0) JASOscillator::Data();
|
||||
osc = JKR_NEW_ARGS (heap, 0) JASOscillator::Data();
|
||||
JUT_ASSERT(386, osc != NULL);
|
||||
osc->mTarget = tosc->mTarget;
|
||||
osc->_04 = tosc->field_0x4;
|
||||
@@ -209,7 +209,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
if (points != NULL) {
|
||||
const JASOscillator::Point* endPtr = getOscTableEndPtr(points);
|
||||
int size = endPtr - points;
|
||||
JASOscillator::Point* table = new (heap, 0) JASOscillator::Point[size];
|
||||
JASOscillator::Point* table = JKR_NEW_ARGS (heap, 0) JASOscillator::Point[size];
|
||||
JUT_ASSERT(396, table != NULL);
|
||||
JASCalc::bcopy(points, table, size * sizeof(JASOscillator::Point));
|
||||
osc->mTable = table;
|
||||
@@ -221,7 +221,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
if (points != NULL) {
|
||||
const JASOscillator::Point* endPtr = getOscTableEndPtr(points);
|
||||
int size = endPtr - points;
|
||||
JASOscillator::Point* table = new (heap, 0) JASOscillator::Point[size];
|
||||
JASOscillator::Point* table = JKR_NEW_ARGS (heap, 0) JASOscillator::Point[size];
|
||||
JUT_ASSERT(409, table != NULL);
|
||||
JASCalc::bcopy(points, table, size * sizeof(JASOscillator::Point));
|
||||
osc->rel_table = table;
|
||||
@@ -256,14 +256,14 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
for (int i = 0; i < 12; i++) {
|
||||
TPerc* tperc = header->mOffsets.mPercOffset[i].ptr(header);
|
||||
if (tperc != NULL) {
|
||||
JASDrumSet* setp = new (heap, 0) JASDrumSet();
|
||||
JASDrumSet* setp = JKR_NEW_ARGS (heap, 0) JASDrumSet();
|
||||
JUT_ASSERT(509, setp != NULL);
|
||||
setp->newPercArray(0x80, heap);
|
||||
|
||||
for (int j = 0; j < 0x80; j++) {
|
||||
TPmap* tpmap = tperc->mPmapOffset[j].ptr(header);
|
||||
if (tpmap != NULL) {
|
||||
JASDrumSet::TPerc* percp = new (heap, 0) JASDrumSet::TPerc();
|
||||
JASDrumSet::TPerc* percp = JKR_NEW_ARGS (heap, 0) JASDrumSet::TPerc();
|
||||
JUT_ASSERT(519, percp);
|
||||
percp->setVolume(tpmap->mVolume);
|
||||
percp->setPitch(tpmap->mPitch);
|
||||
|
||||
@@ -37,7 +37,7 @@ JASChannel* JASBank::noteOn(JASBank const* param_0, int param_1, u8 param_2, u8
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JASChannel* channel = new JASChannel(param_5, param_6);
|
||||
JASChannel* channel = JKR_NEW JASChannel(param_5, param_6);
|
||||
if (!channel) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ JASChannel* JASBank::noteOnOsc(int param_0, u8 param_1, u8 param_2, u16 param_3,
|
||||
{0x000F, 0x0000, 0x0000},
|
||||
};
|
||||
static const JASOscillator::Data OSC_ENV = {0, 1.0f, NULL, OSC_RELEASE_TABLE, 1.0f, 0.0f};
|
||||
JASChannel* channel = new JASChannel(param_4, param_5);
|
||||
JASChannel* channel = JKR_NEW JASChannel(param_4, param_5);
|
||||
if (!channel) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ void JASBasicBank::newInstTable(u8 num, JKRHeap* heap) {
|
||||
if (num != 0) {
|
||||
JUT_ASSERT(31, num <= JASBank::PRG_OSC);
|
||||
mInstNumMax = num;
|
||||
mInstTable = new (heap, 0) JASInst*[mInstNumMax];
|
||||
mInstTable = JKR_NEW_ARGS (heap, 0) JASInst*[mInstNumMax];
|
||||
JASCalc::bzero(mInstTable, mInstNumMax * 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ JASBasicInst::JASBasicInst() {
|
||||
}
|
||||
|
||||
JASBasicInst::~JASBasicInst() {
|
||||
delete[] mKeymap;
|
||||
JKR_DELETE_ARRAY(mKeymap);
|
||||
}
|
||||
|
||||
bool JASBasicInst::getParam(int param_0, int param_1, JASInstParam* param_2) const {
|
||||
@@ -48,8 +48,8 @@ bool JASBasicInst::getParam(int param_0, int param_1, JASInstParam* param_2) con
|
||||
}
|
||||
|
||||
void JASBasicInst::setKeyRegionCount(u32 count, JKRHeap* param_1) {
|
||||
delete [] mKeymap;
|
||||
mKeymap = new (param_1, 0) TKeymap[count];
|
||||
JKR_DELETE_ARRAY(mKeymap);
|
||||
mKeymap = JKR_NEW_ARGS (param_1, 0) TKeymap[count];
|
||||
JUT_ASSERT(114, mKeymap != NULL);
|
||||
mKeymapCount = count;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ JASBasicWaveBank::JASBasicWaveBank() {
|
||||
}
|
||||
|
||||
JASBasicWaveBank::~JASBasicWaveBank() {
|
||||
delete[] mWaveTable;
|
||||
delete[] mWaveGroupArray;
|
||||
JKR_DELETE_ARRAY(mWaveTable);
|
||||
JKR_DELETE_ARRAY(mWaveGroupArray);
|
||||
}
|
||||
|
||||
JASBasicWaveBank::TWaveGroup* JASBasicWaveBank::getWaveGroup(u32 param_0) {
|
||||
@@ -27,9 +27,9 @@ JASBasicWaveBank::TWaveGroup* JASBasicWaveBank::getWaveGroup(u32 param_0) {
|
||||
}
|
||||
|
||||
void JASBasicWaveBank::setGroupCount(u32 param_0, JKRHeap* param_1) {
|
||||
delete[] mWaveGroupArray;
|
||||
JKR_DELETE_ARRAY(mWaveGroupArray);
|
||||
mGroupCount = param_0;
|
||||
mWaveGroupArray = new(param_1, 0) TWaveGroup[param_0];
|
||||
mWaveGroupArray = JKR_NEW_ARGS(param_1, 0) TWaveGroup[param_0];
|
||||
JUT_ASSERT(62, mWaveGroupArray != NULL);
|
||||
for (int i = 0; i < mGroupCount; i++) {
|
||||
mWaveGroupArray[i].mBank = this;
|
||||
@@ -37,8 +37,8 @@ void JASBasicWaveBank::setGroupCount(u32 param_0, JKRHeap* param_1) {
|
||||
}
|
||||
|
||||
void JASBasicWaveBank::setWaveTableSize(u32 param_0, JKRHeap* param_1) {
|
||||
delete[] mWaveTable;
|
||||
mWaveTable = new(param_1, 0) TWaveHandle[param_0];
|
||||
JKR_DELETE_ARRAY(mWaveTable);
|
||||
mWaveTable = JKR_NEW_ARGS(param_1, 0) TWaveHandle[param_0];
|
||||
JUT_ASSERT(92, mWaveTable != NULL);
|
||||
mHandleCount = param_0;
|
||||
}
|
||||
@@ -98,13 +98,13 @@ JASBasicWaveBank::TWaveGroup::TWaveGroup() {
|
||||
}
|
||||
|
||||
JASBasicWaveBank::TWaveGroup::~TWaveGroup() {
|
||||
delete[] mCtrlWaveArray;
|
||||
JKR_DELETE_ARRAY(mCtrlWaveArray);
|
||||
}
|
||||
|
||||
void JASBasicWaveBank::TWaveGroup::setWaveCount(u32 param_0, JKRHeap* param_1) {
|
||||
delete[] mCtrlWaveArray;
|
||||
JKR_DELETE_ARRAY(mCtrlWaveArray);
|
||||
mWaveCount = param_0;
|
||||
mCtrlWaveArray = new(param_1, 0) TGroupWaveInfo[param_0];
|
||||
mCtrlWaveArray = JKR_NEW_ARGS(param_1, 0) TGroupWaveInfo[param_0];
|
||||
JUT_ASSERT(255, mCtrlWaveArray != NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ JASChannel::~JASChannel() {
|
||||
int JASChannel::play() {
|
||||
JASDSPChannel* channel = JASDSPChannel::alloc(JSULoByte(mPriority), dspUpdateCallback, this);
|
||||
if (channel == NULL) {
|
||||
delete this;
|
||||
JKR_DELETE(this);
|
||||
return 0;
|
||||
}
|
||||
mDspCh = channel;
|
||||
@@ -70,7 +70,7 @@ int JASChannel::playForce() {
|
||||
JASDSPChannel* channel = JASDSPChannel::allocForce(JSULoByte(mPriority),
|
||||
dspUpdateCallback, this);
|
||||
if (channel == NULL) {
|
||||
delete this;
|
||||
JKR_DELETE(this);
|
||||
return 0;
|
||||
}
|
||||
mDspCh = channel;
|
||||
@@ -212,7 +212,7 @@ s32 JASChannel::dspUpdateCallback(u32 i_type, JASDsp::TChannel* i_channel, void*
|
||||
case JASDSPChannel::CB_DROP:
|
||||
_this->mDspCh->free();
|
||||
_this->mDspCh = NULL;
|
||||
delete _this;
|
||||
JKR_DELETE(_this);
|
||||
return -1;
|
||||
default:
|
||||
JUT_WARN(323, "Unexpected JASDSPChannel::UpdateStatus %d", i_type);
|
||||
@@ -233,7 +233,7 @@ s32 JASChannel::initialUpdateDSPChannel(JASDsp::TChannel* i_channel) {
|
||||
JUT_WARN_DEVICE(346, 2, "%s", "Lost wave data while playing");
|
||||
mDspCh->free();
|
||||
mDspCh = NULL;
|
||||
delete this;
|
||||
JKR_DELETE(this);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ s32 JASChannel::initialUpdateDSPChannel(JASDsp::TChannel* i_channel) {
|
||||
JUT_WARN_DEVICE(357, 2, "%s","Lost bank data while playing");
|
||||
mDspCh->free();
|
||||
mDspCh = NULL;
|
||||
delete this;
|
||||
JKR_DELETE(this);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) {
|
||||
JUT_WARN_DEVICE(456, 2, "%s","Lost wave data while playing");
|
||||
mDspCh->free();
|
||||
mDspCh = NULL;
|
||||
delete this;
|
||||
JKR_DELETE(this);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) {
|
||||
JUT_WARN_DEVICE(467, 2, "%s", "Lost bank data while playing");
|
||||
mDspCh->free();
|
||||
mDspCh = NULL;
|
||||
delete this;
|
||||
JKR_DELETE(this);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) {
|
||||
if (mOscillators[0].isRelease()) {
|
||||
mDspCh->free();
|
||||
mDspCh = NULL;
|
||||
delete this;
|
||||
JKR_DELETE(this);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@@ -350,7 +350,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) {
|
||||
if (i == 0 && mOscillators[i].isStop()) {
|
||||
mDspCh->free();
|
||||
mDspCh = NULL;
|
||||
delete this;
|
||||
JKR_DELETE(this);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void JASDSPChannel::drop() {
|
||||
}
|
||||
|
||||
void JASDSPChannel::initAll() {
|
||||
sDspChannels = new (JASDram, 0x20) JASDSPChannel[0x40];
|
||||
sDspChannels = JKR_NEW_ARGS (JASDram, 0x20) JASDSPChannel[0x40];
|
||||
JUT_ASSERT(102, sDspChannels);
|
||||
for (int i = 0; i < 0x40; i++) {
|
||||
sDspChannels[i].mChannel = JASDsp::getDSPHandle(i);
|
||||
|
||||
@@ -426,9 +426,9 @@ u32 const ATTRIBUTE_ALIGN(32) JASDsp::DSPRES_FILTER[320] = {
|
||||
};
|
||||
|
||||
void JASDsp::initBuffer() {
|
||||
CH_BUF = new(JASDram, 0x20) TChannel[64];
|
||||
CH_BUF = JKR_NEW_ARGS(JASDram, 0x20) TChannel[64];
|
||||
JUT_ASSERT(354, CH_BUF);
|
||||
FX_BUF = new(JASDram, 0x20) FxBuf[4];
|
||||
FX_BUF = JKR_NEW_ARGS(JASDram, 0x20) FxBuf[4];
|
||||
JUT_ASSERT(356, FX_BUF);
|
||||
JASCalc::bzero(CH_BUF, 0x6000);
|
||||
JASCalc::bzero(FX_BUF, sizeof(FxBuf) * 4);
|
||||
|
||||
@@ -17,7 +17,7 @@ void JASDrumSet::newPercArray(u8 num, JKRHeap* heap) {
|
||||
if (num) {
|
||||
JUT_ASSERT(39, num <= 128);
|
||||
mPercNumMax = num;
|
||||
mPercArray = new (heap, 0) TPerc*[mPercNumMax];
|
||||
mPercArray = JKR_NEW_ARGS (heap, 0) TPerc*[mPercNumMax];
|
||||
JASCalc::bzero(mPercArray, mPercNumMax * sizeof(TPerc*));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ bool JASDvd::createThread(s32 priority, int msgCount, u32 stackSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sThread = new (JASDram, 0) JASTaskThread(priority, msgCount, stackSize);
|
||||
sThread = JKR_NEW_ARGS (JASDram, 0) JASTaskThread(priority, msgCount, stackSize);
|
||||
JUT_ASSERT(36, sThread);
|
||||
|
||||
JKRHeap* pCurrentHeap = JKRGetSystemHeap();
|
||||
|
||||
@@ -242,7 +242,7 @@ JASGenericMemPool::~JASGenericMemPool() {
|
||||
void* chunk = field_0x0;
|
||||
while (chunk != NULL) {
|
||||
void* next_chunk = *(void**)chunk;
|
||||
delete[] chunk;
|
||||
JKR_DELETE_ARRAY(chunk);
|
||||
chunk = next_chunk;
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@ void JASGenericMemPool::newMemPool(u32 n, int param_1) {
|
||||
JUT_ASSERT(734, n >= sizeof(TNextOnFreeList));
|
||||
void* runner;
|
||||
for (int i = 0; i < param_1; i++) {
|
||||
runner = new (JASDram, 0) u8[n];
|
||||
runner = JKR_NEW_ARGS (JASDram, 0) u8[n];
|
||||
JUT_ASSERT(739, runner);
|
||||
*(void**)runner = field_0x0;
|
||||
field_0x0 = runner;
|
||||
@@ -301,7 +301,7 @@ void JASKernel::setupRootHeap(JKRSolidHeap* heap, u32 size) {
|
||||
sSystemHeap = JKRExpHeap::create(size, heap, false);
|
||||
JKRHEAP_NAME(sSystemHeap, "JASKernel::sSystemHeap");
|
||||
JUT_ASSERT(787, sSystemHeap);
|
||||
sCommandHeap = new (heap, 0) JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable>();
|
||||
sCommandHeap = JKR_NEW_ARGS (heap, 0) JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable>();
|
||||
JKRHEAP_NAME(sSystemHeap, "JASKernel::sCommandHeap");
|
||||
JUT_ASSERT(790, sCommandHeap);
|
||||
JASDram = heap;
|
||||
|
||||
@@ -28,7 +28,7 @@ void JASReportInit(JKRHeap* heap, int lineMax) {
|
||||
JUT_ASSERT(35, heap != NULL);
|
||||
OSInitMutex(&sMutex);
|
||||
sLineMax = lineMax;
|
||||
sBuffer = new (heap, 0) char[sLineMax * 64];
|
||||
sBuffer = JKR_NEW_ARGS (heap, 0) char[sLineMax * 64];
|
||||
JUT_ASSERT(41, sBuffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ JASSimpleWaveBank::JASSimpleWaveBank() {
|
||||
}
|
||||
|
||||
JASSimpleWaveBank::~JASSimpleWaveBank() {
|
||||
delete[] mWaveTable;
|
||||
JKR_DELETE_ARRAY(mWaveTable);
|
||||
}
|
||||
|
||||
void JASSimpleWaveBank::setWaveTableSize(u32 size, JKRHeap* heap) {
|
||||
delete[] mWaveTable;
|
||||
mWaveTable = new (heap, 0) TWaveHandle[size];
|
||||
JKR_DELETE_ARRAY(mWaveTable);
|
||||
mWaveTable = JKR_NEW_ARGS (heap, 0) TWaveHandle[size];
|
||||
JUT_ASSERT(29, mWaveTable != NULL);
|
||||
mWaveTableSize = size;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ JASTrack::TList JASTrack::sTrackList;
|
||||
JASTrack::~JASTrack() {
|
||||
JUT_ASSERT(70, mStatus != STATUS_RUN);
|
||||
for (int i = 1; i < 4; i++) {
|
||||
delete mChannelMgrs[i];
|
||||
JKR_DELETE(mChannelMgrs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void JASTrack::setChannelMgrCount(u32 count) {
|
||||
mChannelMgrCount = 1;
|
||||
for (int i = 1; i < count; i++) {
|
||||
if (mChannelMgrs[i] == NULL) {
|
||||
mChannelMgrs[i] = new TChannelMgr(this);
|
||||
mChannelMgrs[i] = JKR_NEW TChannelMgr(this);
|
||||
if (mChannelMgrs[i] == NULL) {
|
||||
JUT_WARN(87, "%s", "Not enough JASTrackChannelMgr\n");
|
||||
return;
|
||||
@@ -44,7 +44,7 @@ void JASTrack::setChannelMgrCount(u32 count) {
|
||||
}
|
||||
for (u32 i = mChannelMgrCount; i < 4; i++) {
|
||||
if (mChannelMgrs[i] != NULL) {
|
||||
delete mChannelMgrs[i];
|
||||
JKR_DELETE(mChannelMgrs[i]);
|
||||
mChannelMgrs[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ void JASTrack::init() {
|
||||
mChannelMgrCount = 1;
|
||||
for (int i = 1; i < 4; i++) {
|
||||
if (mChannelMgrs[i] != NULL) {
|
||||
delete mChannelMgrs[i];
|
||||
JKR_DELETE(mChannelMgrs[i]);
|
||||
mChannelMgrs[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ void JASTrack::close() {
|
||||
if (child != NULL) {
|
||||
child->close();
|
||||
if (child->mFlags.autoDelete) {
|
||||
delete child;
|
||||
JKR_DELETE(child);
|
||||
mChildren[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ void JASTrack::closeChild(u32 track_no) {
|
||||
getRootTrack()->updateSeq(false, 1.0f);
|
||||
child->close();
|
||||
if (child->mFlags.autoDelete) {
|
||||
delete child;
|
||||
JKR_DELETE(child);
|
||||
mChildren[track_no] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ JASTrack* JASTrack::openChild(u32 trk_no) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
child = new JASTrack();
|
||||
child = JKR_NEW JASTrack();
|
||||
if (child == NULL) {
|
||||
JUT_WARN(388, "%s", "Not enough JASTrack\n");
|
||||
return NULL;
|
||||
@@ -736,7 +736,7 @@ int JASTrack::tickProc() {
|
||||
getRootTrack()->updateSeq(false, 1.0f);
|
||||
child->close();
|
||||
if (child->mFlags.autoDelete) {
|
||||
delete child;
|
||||
JKR_DELETE(child);
|
||||
mChildren[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -794,7 +794,7 @@ void JASTrack::TList::seqMain() {
|
||||
if (seqMainRes < 0) {
|
||||
Remove(&*it);
|
||||
if (it->mFlags.autoDelete) {
|
||||
delete &*it;
|
||||
JKR_DELETE(&*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -811,7 +811,7 @@ void JASTrack::TList::seqMain() {
|
||||
if (seqMainRes < 0) {
|
||||
Remove(&*it);
|
||||
if (it->mFlags.autoDelete) {
|
||||
delete &*it;
|
||||
JKR_DELETE(&*it);
|
||||
}
|
||||
}
|
||||
it = it2;
|
||||
|
||||
@@ -30,7 +30,7 @@ JASBasicWaveBank* JASWSParser::createBasicWaveBank(void const* stream, JKRHeap*
|
||||
u32 free_size = heap->getFreeSize();
|
||||
|
||||
THeader* header = (THeader*)stream;
|
||||
JASBasicWaveBank* wave_bank = new (heap, 0) JASBasicWaveBank();
|
||||
JASBasicWaveBank* wave_bank = JKR_NEW_ARGS (heap, 0) JASBasicWaveBank();
|
||||
if (wave_bank == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ JASSimpleWaveBank* JASWSParser::createSimpleWaveBank(void const* stream, JKRHeap
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JASSimpleWaveBank* wave_bank = new (heap, 0) JASSimpleWaveBank();
|
||||
JASSimpleWaveBank* wave_bank = JKR_NEW_ARGS (heap, 0) JASSimpleWaveBank();
|
||||
if (wave_bank == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -168,13 +168,13 @@ void JASWaveArc::setFileName(char const* fileName) {
|
||||
char* currentDir = JASWaveArcLoader::getCurrentDir();
|
||||
size_t length = strlen(currentDir);
|
||||
length = length + strlen(fileName);
|
||||
char* path = new (JASKernel::getSystemHeap(), -4) char[length + 1];
|
||||
char* path = JKR_NEW_ARGS (JASKernel::getSystemHeap(), -4) char[length + 1];
|
||||
JUT_ASSERT(322, path);
|
||||
strcpy(path, currentDir);
|
||||
strcat(path, fileName);
|
||||
path[length] = '\0';
|
||||
int entryNum = DVDConvertPathToEntrynum(path);
|
||||
delete[] path;
|
||||
JKR_DELETE_ARRAY(path);
|
||||
if (entryNum < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ void dummyDefCtor() {
|
||||
//TODO: ShieldD needs the weak functions this pulls in, but in retail it breaks weak function
|
||||
// placement
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
JAUStreamStaticAramMgr_<1>* streamStaticAramMgr = new(NULL, 0) JAUStreamStaticAramMgr_<1>();
|
||||
JAUStreamStaticAramMgr_<1>* streamStaticAramMgr = JKR_NEW_ARGS(NULL, 0) JAUStreamStaticAramMgr_<1>();
|
||||
streamStaticAramMgr->reserveAram(NULL, 0, 0x14);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace {
|
||||
return;
|
||||
}
|
||||
mNumStreamFiles = stack_14.getNumFiles();
|
||||
mStreamFileDVDEntryNums = new s32[mNumStreamFiles];
|
||||
mStreamFileDVDEntryNums = JKR_NEW s32[mNumStreamFiles];
|
||||
if (!mStreamFileDVDEntryNums) {
|
||||
mNumStreamFiles = 0;
|
||||
return;
|
||||
@@ -139,7 +139,7 @@ JAUSoundTable* JAUSection::newSoundTable(void const* bst, u32 param_1, bool para
|
||||
bstDst = newCopy(bst, param_1, 4);
|
||||
JUT_ASSERT(296, bstDst);
|
||||
}
|
||||
JAUSoundTable* soundTable = new JAUSoundTable(param_2);
|
||||
JAUSoundTable* soundTable = JKR_NEW JAUSoundTable(param_2);
|
||||
JUT_ASSERT(299, soundTable);
|
||||
soundTable->init(bstDst);
|
||||
sectionHeap_->sectionHeapData_.soundTable = soundTable;
|
||||
@@ -161,7 +161,7 @@ JAUSoundNameTable* JAUSection::newSoundNameTable(void const* bstn, u32 param_1,
|
||||
bstnDst = newCopy(bstn, param_1, 4);
|
||||
JUT_ASSERT(326, bstnDst);
|
||||
}
|
||||
JAUSoundNameTable* soundNameTable = new JAUSoundNameTable(param_2);
|
||||
JAUSoundNameTable* soundNameTable = JKR_NEW JAUSoundNameTable(param_2);
|
||||
JUT_ASSERT(329, soundNameTable);
|
||||
soundNameTable->init(bstnDst);
|
||||
sectionHeap_->sectionHeapData_.soundNameTable = soundNameTable;
|
||||
@@ -179,12 +179,12 @@ JAIStreamDataMgr* JAUSection::newStreamFileTable(void const* param_0, bool param
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
JAIStreamDataMgr* r28 = NULL;
|
||||
if (param_1) {
|
||||
TStreamDataMgr* r26 = new TStreamDataMgr(param_0);
|
||||
TStreamDataMgr* r26 = JKR_NEW TStreamDataMgr(param_0);
|
||||
if (r26->isValid()) {
|
||||
r28 = r26;
|
||||
}
|
||||
} else {
|
||||
JAUStreamDataMgr_StreamFileTable* r25 = new JAUStreamDataMgr_StreamFileTable();
|
||||
JAUStreamDataMgr_StreamFileTable* r25 = JKR_NEW JAUStreamDataMgr_StreamFileTable();
|
||||
r25->init(param_0);
|
||||
if (r25->isValid()) {
|
||||
r28 = r25;
|
||||
@@ -204,7 +204,7 @@ JAISeqDataMgr* JAUSection::newSeSeqCollection(void const* bsc, u32 param_1) {
|
||||
JUT_ASSERT(405, bsc);
|
||||
{
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
JAUSeqDataMgr_SeqCollection* seSeqDataMgr = new JAUSeqDataMgr_SeqCollection();
|
||||
JAUSeqDataMgr_SeqCollection* seSeqDataMgr = JKR_NEW JAUSeqDataMgr_SeqCollection();
|
||||
JUT_ASSERT(409, seSeqDataMgr);
|
||||
seSeqDataMgr->init(bsc);
|
||||
sectionHeap_->sectionHeapData_.seSeqDataMgr_ = seSeqDataMgr;
|
||||
@@ -219,16 +219,16 @@ u8* JAUSection::newStaticSeqDataBlock_(JAISoundID param_0, u32 size) {
|
||||
JUT_ASSERT(421, size);
|
||||
{
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
JAUSeqDataBlock* seqDataBlock = new JAUSeqDataBlock();
|
||||
JAUSeqDataBlock* seqDataBlock = JKR_NEW JAUSeqDataBlock();
|
||||
if (!seqDataBlock) {
|
||||
return NULL;
|
||||
}
|
||||
JSULink<JAUSeqDataBlock>* link = new JSULink<JAUSeqDataBlock>(seqDataBlock);
|
||||
JSULink<JAUSeqDataBlock>* link = JKR_NEW JSULink<JAUSeqDataBlock>(seqDataBlock);
|
||||
if (!link) {
|
||||
JUT_WARN(432, "%s", "created UNUSED object in Heap\n");
|
||||
return NULL;
|
||||
}
|
||||
u8* r28 = new(0x20) u8[size];
|
||||
u8* r28 = JKR_NEW_ARGS(0x20) u8[size];
|
||||
if (!r28) {
|
||||
JUT_WARN(438, "%s", "created UNUSED object in Heap\n");
|
||||
return NULL;
|
||||
@@ -277,7 +277,7 @@ bool JAUSection::newStaticSeqData(JAISoundID param_0) {
|
||||
void* JAUSection::newCopy(void const* param_0, u32 param_1, s32 param_2) {
|
||||
JUT_ASSERT(516, isOpen());
|
||||
JUT_ASSERT(517, isBuilding());
|
||||
u8* r31 = new(getHeap_(), param_2) u8[param_1];
|
||||
u8* r31 = JKR_NEW_ARGS(getHeap_(), param_2) u8[param_1];
|
||||
if (r31) {
|
||||
memcpy(r31, param_0, param_1);
|
||||
}
|
||||
@@ -358,7 +358,7 @@ JASVoiceBank* JAUSection::newVoiceBank(u32 bank_no, u32 param_1) {
|
||||
JASWaveBank* waveBank = sectionHeap_->getWaveBankTable().getWaveBank(param_1);
|
||||
JUT_ASSERT(688, waveBank != NULL);
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
JASBank* voiceBank = new JASVoiceBank();
|
||||
JASBank* voiceBank = JKR_NEW JASVoiceBank();
|
||||
if (voiceBank) {
|
||||
if (buildingBankTable_) {
|
||||
JUT_ASSERT(696, buildingBankTable_->getBank( bank_no ) == NULL);
|
||||
@@ -382,9 +382,9 @@ bool JAUSection::beginNewBankTable(u32 param_0, u32 param_1) {
|
||||
JAUBankTableLink* bankTableLink = NULL;
|
||||
{
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
JASBank** r26 = new JASBank*[param_1];
|
||||
JASBank** r26 = JKR_NEW JASBank*[param_1];
|
||||
if (r26) {
|
||||
bankTableLink = new JAUBankTableLink(param_0, r26, param_1);
|
||||
bankTableLink = JKR_NEW JAUBankTableLink(param_0, r26, param_1);
|
||||
if (bankTableLink) {
|
||||
buildingBankTable_ = bankTableLink;
|
||||
} else {
|
||||
@@ -435,7 +435,7 @@ static JAUSectionHeap* JAUNewSectionHeap(JKRSolidHeap* heap, bool param_1) {
|
||||
JUT_ASSERT(809, JKRSolidHeap_isEmpty( heap ));
|
||||
TPushCurrentHeap push(heap);
|
||||
s32 r29 = heap->getFreeSize();
|
||||
JAUSectionHeap* sectionHeap = new JAUSectionHeap(heap, param_1, r29);
|
||||
JAUSectionHeap* sectionHeap = JKR_NEW JAUSectionHeap(heap, param_1, r29);
|
||||
return sectionHeap;
|
||||
}
|
||||
|
||||
@@ -480,16 +480,16 @@ bool JAUSectionHeap::newDynamicSeqBlock(u32 size) {
|
||||
JUT_ASSERT(939, sectionHeap_ == this);
|
||||
{
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
JAUSeqDataBlock * seqDataBlock = new JAUSeqDataBlock();
|
||||
JAUSeqDataBlock * seqDataBlock = JKR_NEW JAUSeqDataBlock();
|
||||
if (!seqDataBlock) {
|
||||
return false;
|
||||
}
|
||||
JSULink<JAUSeqDataBlock> * link = new JSULink<JAUSeqDataBlock>(seqDataBlock);
|
||||
JSULink<JAUSeqDataBlock> * link = JKR_NEW JSULink<JAUSeqDataBlock>(seqDataBlock);
|
||||
if (!link) {
|
||||
JUT_WARN(950, "%s", "created UNUSED object in Heap\n");
|
||||
return false;
|
||||
}
|
||||
u8* r25 = new(0x20) u8[size];
|
||||
u8* r25 = JKR_NEW_ARGS(0x20) u8[size];
|
||||
if (!r25) {
|
||||
JUT_WARN(956, "%s", "created UNUSED object in Heap\n");
|
||||
return false;
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
#include <vi.h>
|
||||
#include "global.h"
|
||||
#include "aurora/aurora.h"
|
||||
#include "global.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "dusk/logging.h"
|
||||
|
||||
void JFWDisplay::ctor_subroutine(bool enableAlpha) {
|
||||
mEnableAlpha = enableAlpha;
|
||||
@@ -64,7 +67,7 @@ JFWDisplay* JFWDisplay::createManager(GXRenderModeObj const* p_rObj, JKRHeap* p_
|
||||
}
|
||||
|
||||
if (sManager == NULL) {
|
||||
sManager = new JFWDisplay(p_heap, xfb_num, enableAlpha);
|
||||
sManager = JKR_NEW JFWDisplay(p_heap, xfb_num, enableAlpha);
|
||||
}
|
||||
|
||||
return sManager;
|
||||
@@ -226,16 +229,9 @@ void JFWDisplay::endGX() {
|
||||
|
||||
void JFWDisplay::beginRender() {
|
||||
#if TARGET_PC
|
||||
// Temporarily clear the current JKRHeap so that Aurora/Dawn/ImGui allocations
|
||||
// use malloc instead of JKRHeap. Without this, Dawn's internal std::string
|
||||
// allocations would go through JKRHeap and then crash when freed via standard delete.
|
||||
JKRHeap* savedHeap = JKRHeap::getCurrentHeap();
|
||||
JKRHeap::setCurrentHeap(nullptr);
|
||||
#endif
|
||||
aurora_begin_frame();
|
||||
#if TARGET_PC
|
||||
JKRHeap::setCurrentHeap(savedHeap);
|
||||
#endif
|
||||
|
||||
if (field_0x40) {
|
||||
JUTProcBar::getManager()->wholeLoopEnd();
|
||||
}
|
||||
@@ -313,16 +309,6 @@ void JFWDisplay::endRender() {
|
||||
|
||||
JUTProcBar::getManager()->cpuStart();
|
||||
calcCombinationRatio();
|
||||
#if TARGET_PC
|
||||
{
|
||||
JKRHeap* savedHeap = JKRHeap::getCurrentHeap();
|
||||
JKRHeap::setCurrentHeap(nullptr);
|
||||
aurora_end_frame();
|
||||
JKRHeap::setCurrentHeap(savedHeap);
|
||||
}
|
||||
#else
|
||||
aurora_end_frame();
|
||||
#endif
|
||||
}
|
||||
|
||||
void JFWDisplay::endFrame() {
|
||||
@@ -357,6 +343,10 @@ void JFWDisplay::endFrame() {
|
||||
JUTProcBar::getManager()->setCostFrame(retrace_cnt - prevFrame);
|
||||
prevFrame = retrace_cnt;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
aurora_end_frame();
|
||||
#endif
|
||||
}
|
||||
|
||||
void JFWDisplay::waitBlanking(int param_0) {
|
||||
@@ -450,7 +440,7 @@ void JFWDisplay::clearEfb(GXColor color) {
|
||||
|
||||
void JFWDisplay::clearEfb(int param_0, int param_1, int param_2, int param_3, GXColor color) {
|
||||
#if TARGET_PC
|
||||
puts("clearEfb not implemented");
|
||||
STUB_LOG();
|
||||
return;
|
||||
#endif
|
||||
u16 width;
|
||||
|
||||
@@ -73,7 +73,7 @@ void JFWSystem::init() {
|
||||
JKRAram::create(CSetUpParam::aramAudioBufSize, CSetUpParam::aramGraphBufSize,
|
||||
CSetUpParam::streamPriority, CSetUpParam::decompPriority,
|
||||
CSetUpParam::aPiecePriority);
|
||||
mainThread = new JKRThread(OSGetCurrentThread(), 4);
|
||||
mainThread = JKR_NEW JKRThread(OSGetCurrentThread(), 4);
|
||||
|
||||
JUTVideo::createManager(CSetUpParam::renderMode);
|
||||
JUTCreateFifo(CSetUpParam::fifoBufSize);
|
||||
@@ -86,7 +86,7 @@ void JFWSystem::init() {
|
||||
|
||||
JUTException::create(dbPrint);
|
||||
|
||||
systemFont = new JUTResFont(CSetUpParam::systemFontRes, NULL);
|
||||
systemFont = JKR_NEW JUTResFont(CSetUpParam::systemFontRes, NULL);
|
||||
|
||||
debugPrint = JUTDbPrint::start(NULL, NULL);
|
||||
debugPrint->changeFont(systemFont);
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "global.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if DEBUG
|
||||
static void dummyString() {
|
||||
// probably some stripped function that called JUT_ASSERT here
|
||||
@@ -24,14 +26,21 @@ const void* JGadget::binary::parseVariableUInt_16_32_following(const void* pBuff
|
||||
pTEBit = &spC;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
u32 var_r30 = BSWAP16(*pu16);
|
||||
#elif
|
||||
u32 var_r30 = *pu16;
|
||||
#endif
|
||||
if ((var_r30 & 0x8000) == 0) {
|
||||
pTEBit->value = 0x10;
|
||||
|
||||
*pu32First = var_r30;
|
||||
pu16++;
|
||||
#if TARGET_PC
|
||||
*pu32Second = BSWAP16(*pu16);
|
||||
#elif
|
||||
*pu32Second = *pu16;
|
||||
|
||||
#endif
|
||||
return pu16 + 1;
|
||||
} else {
|
||||
pTEBit->value = 0x20;
|
||||
@@ -39,11 +48,19 @@ const void* JGadget::binary::parseVariableUInt_16_32_following(const void* pBuff
|
||||
var_r30 &= 0x7FFF;
|
||||
var_r30 <<= 16;
|
||||
pu16++;
|
||||
#if TARGET_PC
|
||||
var_r30 |= BSWAP16(*pu16);
|
||||
#else
|
||||
var_r30 |= *pu16;
|
||||
#endif
|
||||
|
||||
*pu32First = var_r30;
|
||||
pu16++;
|
||||
#if TARGET_PC
|
||||
*pu32Second = BSWAP32(*(u32*)pu16);
|
||||
#else
|
||||
*pu32Second = *(u32*)pu16;
|
||||
#endif
|
||||
|
||||
return pu16 + 2;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ JHIMemBuf* JHICommonMem::instance;
|
||||
|
||||
JHIMemBuf* JHICommonMem::Instance() {
|
||||
if (instance == NULL) {
|
||||
instance = new JHIMemBuf();
|
||||
instance = JKR_NEW JHIMemBuf();
|
||||
}
|
||||
|
||||
return instance;
|
||||
|
||||
@@ -40,7 +40,7 @@ void JHIMccBuf::init() {
|
||||
if (mTempBuf != NULL) {
|
||||
initBuf();
|
||||
} else {
|
||||
mTempBuf = new (32) u8[0x18000];
|
||||
mTempBuf = JKR_NEW_ARGS (32) u8[0x18000];
|
||||
if (mTempBuf == NULL) {
|
||||
JHIHalt("ERROR: JHIMccBuf cannot alloc temp buf.\n");
|
||||
} else {
|
||||
@@ -68,7 +68,7 @@ void JHIMccBuf::initBuf() {
|
||||
JHIMccBuf::~JHIMccBuf() {
|
||||
mRefCount--;
|
||||
if (mRefCount == 0) {
|
||||
delete[] mTempBuf;
|
||||
JKR_DELETE_ARRAY(mTempBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
int JHIMemBuf::create() {
|
||||
int rt = 1;
|
||||
if (mp_buffer == NULL) {
|
||||
mp_buffer = new (32) u8[0x20000];
|
||||
mp_buffer = JKR_NEW_ARGS (32) u8[0x20000];
|
||||
|
||||
if (mp_buffer == NULL) {
|
||||
rt = 0;
|
||||
@@ -30,7 +30,7 @@ int JHIMemBuf::open() {
|
||||
|
||||
void JHIMemBuf::close() {
|
||||
if (mp_buffer != NULL) {
|
||||
delete[] mp_buffer;
|
||||
JKR_DELETE_ARRAY(mp_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,11 +65,11 @@ bool JHINegotiateInterface(u32) {
|
||||
|
||||
JHIMccContext JHIGetHiSpeedContext() {
|
||||
if (tContext_new.mp_reader == NULL) {
|
||||
tContext_new.mp_reader = new JHIMccBufReader(1, 0x18, 0x6000);
|
||||
tContext_new.mp_reader = JKR_NEW JHIMccBufReader(1, 0x18, 0x6000);
|
||||
}
|
||||
|
||||
if (tContext_new.mp_writer == NULL) {
|
||||
tContext_new.mp_writer = new JHIMccBufWriter(1, 0x18, 0x6000);
|
||||
tContext_new.mp_writer = JKR_NEW JHIMccBufWriter(1, 0x18, 0x6000);
|
||||
}
|
||||
|
||||
return tContext_new;
|
||||
@@ -77,11 +77,11 @@ JHIMccContext JHIGetHiSpeedContext() {
|
||||
|
||||
JHIMccContext JHIGetLowSpeedContext() {
|
||||
if (tContext_old.mp_reader == NULL) {
|
||||
tContext_old.mp_reader = new JHIMccBufReader(1, 2, 0);
|
||||
tContext_old.mp_reader = JKR_NEW JHIMccBufReader(1, 2, 0);
|
||||
}
|
||||
|
||||
if (tContext_old.mp_writer == NULL) {
|
||||
tContext_old.mp_writer = new JHIMccBufWriter(1, 2, 0);
|
||||
tContext_old.mp_writer = JKR_NEW JHIMccBufWriter(1, 2, 0);
|
||||
}
|
||||
|
||||
return tContext_old;
|
||||
|
||||
@@ -35,8 +35,8 @@ BOOL JHIInit(u32 enabled) {
|
||||
OS_REPORT("INFO: *** Disable JHostIO ***\n");
|
||||
}
|
||||
|
||||
gsReadBuf = new (32) u8[0xC000];
|
||||
gsWriteBuf = new (32) u8[0xC000];
|
||||
gsReadBuf = JKR_NEW_ARGS (32) u8[0xC000];
|
||||
gsWriteBuf = JKR_NEW_ARGS (32) u8[0xC000];
|
||||
|
||||
if (gsReadBuf == NULL || gsWriteBuf == NULL) {
|
||||
gsEnableInterface = FALSE;
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
void JORInit() {
|
||||
JHIInit(TRUE);
|
||||
|
||||
JHICommBufWriter* pComWriter = new JHICommBufWriter(0x10000, 0x10000, 4);
|
||||
JHICommBufReader* pComReader = new JHICommBufReader(0, 0x10000, 4);
|
||||
JHICommBufWriter* pComWriter = JKR_NEW JHICommBufWriter(0x10000, 0x10000, 4);
|
||||
JHICommBufReader* pComReader = JKR_NEW JHICommBufReader(0, 0x10000, 4);
|
||||
|
||||
JHIContext ctx;
|
||||
ctx.mp_reader = new JHICommBufReader(0x10000, 0x10000, 4);
|
||||
ctx.mp_writer = new JHICommBufWriter(0, 0x10000, 4);
|
||||
ctx.mp_reader = JKR_NEW JHICommBufReader(0x10000, 0x10000, 4);
|
||||
ctx.mp_writer = JKR_NEW JHICommBufWriter(0, 0x10000, 4);
|
||||
|
||||
JHIComPortManager<JHICmnMem>* pPortMng = JHIComPortManager<JHICmnMem>::create();
|
||||
pPortMng->getRefPort().setBuf(pComReader, pComWriter);
|
||||
|
||||
@@ -117,7 +117,7 @@ JORServer* JORServer::instance;
|
||||
|
||||
JORServer* JORServer::create() {
|
||||
if (instance == NULL) {
|
||||
instance = new JORServer();
|
||||
instance = JKR_NEW JORServer();
|
||||
}
|
||||
|
||||
return instance;
|
||||
|
||||
@@ -32,7 +32,7 @@ JKRAram* JKRAram::sAramObject;
|
||||
JKRAram* JKRAram::create(u32 aram_audio_buffer_size, u32 aram_audio_graph_size, s32 stream_priority,
|
||||
s32 decomp_priority, s32 piece_priority) {
|
||||
if (!sAramObject) {
|
||||
sAramObject = new (JKRGetSystemHeap(), 0)
|
||||
sAramObject = JKR_NEW_ARGS (JKRGetSystemHeap(), 0)
|
||||
JKRAram(aram_audio_buffer_size, aram_audio_graph_size, piece_priority);
|
||||
}
|
||||
|
||||
@@ -81,13 +81,13 @@ JKRAram::JKRAram(u32 audio_buffer_size, u32 audio_graph_size, s32 priority)
|
||||
OS_REPORT("ARAM graph area %08x: %08x\n", mGraphMemoryPtr, mGraphMemorySize);
|
||||
OS_REPORT("ARAM user area %08x: %08x\n", mAramMemoryPtr, mAramMemorySize);
|
||||
|
||||
mAramHeap = new (JKRGetSystemHeap(), 0) JKRAramHeap(mGraphMemoryPtr, mGraphMemorySize);
|
||||
mAramHeap = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRAramHeap(mGraphMemoryPtr, mGraphMemorySize);
|
||||
}
|
||||
|
||||
JKRAram::~JKRAram() {
|
||||
sAramObject = NULL;
|
||||
if (mAramHeap)
|
||||
delete mAramHeap;
|
||||
JKR_DELETE(mAramHeap);
|
||||
}
|
||||
|
||||
void* JKRAram::run(void) {
|
||||
@@ -98,7 +98,7 @@ void* JKRAram::run(void) {
|
||||
JKRAramCommand* message = (JKRAramCommand*)msg;
|
||||
int result = message->field_0x00;
|
||||
JKRAMCommand* command = (JKRAMCommand*)message->command;
|
||||
delete message;
|
||||
JKR_DELETE(message);
|
||||
|
||||
switch (result) {
|
||||
case 1:
|
||||
|
||||
@@ -48,11 +48,11 @@ JKRAramArchive::~JKRAramArchive() {
|
||||
}
|
||||
|
||||
if (mDvdFile != NULL) {
|
||||
delete mDvdFile;
|
||||
JKR_DELETE(mDvdFile);
|
||||
}
|
||||
|
||||
if (mBlock != NULL) {
|
||||
delete mBlock;
|
||||
JKR_DELETE(mBlock);
|
||||
}
|
||||
|
||||
JKRFileLoader::sVolumeList.remove(&mFileLoaderLink);
|
||||
@@ -105,7 +105,7 @@ bool JKRAramArchive::open(s32 entryNum) {
|
||||
mStringTable = NULL;
|
||||
mBlock = NULL;
|
||||
|
||||
mDvdFile = new (JKRGetSystemHeap(), mMountDirection == MOUNT_DIRECTION_HEAD ? 4 : -4)
|
||||
mDvdFile = JKR_NEW_ARGS (JKRGetSystemHeap(), mMountDirection == MOUNT_DIRECTION_HEAD ? 4 : -4)
|
||||
JKRDvdFile(entryNum);
|
||||
if (mDvdFile == NULL) {
|
||||
mMountMode = 0;
|
||||
@@ -187,7 +187,7 @@ cleanup:
|
||||
if (mMountMode == 0) {
|
||||
OS_REPORT(":::[%s: %d] Cannot alloc memory\n", __FILE__, 415);
|
||||
if (mDvdFile != NULL) {
|
||||
delete mDvdFile;
|
||||
JKR_DELETE(mDvdFile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ JKRAramBlock* JKRAramBlock::allocHead(u32 size, u8 groupId, JKRAramHeap* aramHea
|
||||
u32 nextAddress = mAddress + mSize;
|
||||
u32 nextFreeSize = mFreeSize - size;
|
||||
|
||||
JKRAramBlock* block = new (aramHeap->getMgrHeap(), 0)
|
||||
JKRAramBlock* block = JKR_NEW_ARGS (aramHeap->getMgrHeap(), 0)
|
||||
JKRAramBlock(nextAddress, size, nextFreeSize, groupId, false);
|
||||
|
||||
mFreeSize = 0;
|
||||
@@ -42,7 +42,7 @@ JKRAramBlock* JKRAramBlock::allocTail(u32 size, u8 groupId, JKRAramHeap* aramHea
|
||||
u32 tailAddress = mAddress + mSize + mFreeSize - size;
|
||||
|
||||
JKRAramBlock* block =
|
||||
new (aramHeap->getMgrHeap(), 0) JKRAramBlock(tailAddress, size, 0, groupId, true);
|
||||
JKR_NEW_ARGS (aramHeap->getMgrHeap(), 0) JKRAramBlock(tailAddress, size, 0, groupId, true);
|
||||
|
||||
mFreeSize -= size;
|
||||
mBlockLink.getSupervisor()->insert(mBlockLink.getNext(), &block->mBlockLink);
|
||||
|
||||
@@ -17,12 +17,12 @@ JKRAramHeap::JKRAramHeap(u32 startAddress, u32 size) {
|
||||
mTailAddress = mHeadAddress + mSize;
|
||||
mGroupId = -1;
|
||||
|
||||
JKRAramBlock* block = new (mHeap, 0) JKRAramBlock(mHeadAddress, 0, mSize, -1, false);
|
||||
JKRAramBlock* block = JKR_NEW_ARGS (mHeap, 0) JKRAramBlock(mHeadAddress, 0, mSize, -1, false);
|
||||
sAramList.append(&block->mBlockLink);
|
||||
}
|
||||
|
||||
JKRAramHeap::~JKRAramHeap() {
|
||||
for (JSUListIterator<JKRAramBlock> iterator = sAramList.getFirst(); iterator != sAramList.getEnd(); delete (iterator++).getObject()) {}
|
||||
for (JSUListIterator<JKRAramBlock> iterator = sAramList.getFirst(); iterator != sAramList.getEnd(); JKR_DELETE((iterator++).getObject())) {}
|
||||
}
|
||||
|
||||
JKRAramBlock* JKRAramHeap::alloc(u32 size, JKRAramHeap::EAllocMode allocationMode) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
JKRAMCommand* JKRAramPiece::prepareCommand(int direction, uintptr_t src, uintptr_t dst, u32 length,
|
||||
JKRAramBlock* block,
|
||||
JKRAMCommand::AsyncCallback callback) {
|
||||
JKRAMCommand* command = new (JKRGetSystemHeap(), -4) JKRAMCommand();
|
||||
JKRAMCommand* command = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRAMCommand();
|
||||
command->mTransferDirection = direction;
|
||||
command->mSrc = src;
|
||||
command->mDst = dst;
|
||||
@@ -30,6 +30,7 @@ OSMutex JKRAramPiece::mMutex;
|
||||
JKRAMCommand* JKRAramPiece::orderAsync(int direction, uintptr_t source, uintptr_t destination, u32 length,
|
||||
JKRAramBlock* block, JKRAMCommand::AsyncCallback callback) {
|
||||
lock();
|
||||
#if !TARGET_PC
|
||||
if ((source & 0x1f) != 0 || (destination & 0x1f) != 0) {
|
||||
OSReport("direction = %x\n", direction);
|
||||
OSReport("source = %x\n", source);
|
||||
@@ -37,8 +38,9 @@ JKRAMCommand* JKRAramPiece::orderAsync(int direction, uintptr_t source, uintptr_
|
||||
OSReport("length = %x\n", length);
|
||||
JUTException::panic(__FILE__, 108, "illegal address. abort.");
|
||||
}
|
||||
#endif
|
||||
|
||||
JKRAramCommand* message = new (JKRGetSystemHeap(), -4) JKRAramCommand();
|
||||
JKRAramCommand* message = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRAramCommand();
|
||||
JKRAMCommand* command =
|
||||
JKRAramPiece::prepareCommand(direction, source, destination, length, block, callback);
|
||||
message->setting(1, command);
|
||||
@@ -80,7 +82,7 @@ BOOL JKRAramPiece::orderSync(int direction, uintptr_t source, uintptr_t destinat
|
||||
JKRAMCommand* command =
|
||||
JKRAramPiece::orderAsync(direction, source, destination, length, block, NULL);
|
||||
BOOL result = JKRAramPiece::sync(command, 0);
|
||||
delete command;
|
||||
JKR_DELETE(command);
|
||||
|
||||
unlock();
|
||||
return result;
|
||||
@@ -132,9 +134,9 @@ JKRAMCommand::JKRAMCommand() : mPieceLink(this), field_0x30(this) {
|
||||
|
||||
JKRAMCommand::~JKRAMCommand() {
|
||||
if (field_0x8C)
|
||||
delete field_0x8C;
|
||||
JKR_DELETE(field_0x8C);
|
||||
if (field_0x90)
|
||||
delete field_0x90;
|
||||
JKR_DELETE(field_0x90);
|
||||
|
||||
if (field_0x94)
|
||||
JKRFree(field_0x94);
|
||||
|
||||
@@ -16,7 +16,7 @@ JKRAramStream* JKRAramStream::sAramStreamObject;
|
||||
|
||||
JKRAramStream* JKRAramStream::create(s32 priority) {
|
||||
if (!sAramStreamObject) {
|
||||
sAramStreamObject = new (JKRGetSystemHeap(), 0) JKRAramStream(priority);
|
||||
sAramStreamObject = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRAramStream(priority);
|
||||
JKRResetAramTransferBuffer();
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ JKRHeap* JKRAramStream::transHeap;
|
||||
JKRAramStreamCommand* JKRAramStream::write_StreamToAram_Async(JSUFileInputStream* stream, u32 addr,
|
||||
u32 size, u32 offset,
|
||||
u32* returnSize) {
|
||||
JKRAramStreamCommand* command = new (JKRGetSystemHeap(), -4) JKRAramStreamCommand();
|
||||
JKRAramStreamCommand* command = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRAramStreamCommand();
|
||||
command->mType = JKRAramStreamCommand::WRITE;
|
||||
command->mAddress = addr;
|
||||
command->mSize = size;
|
||||
|
||||
@@ -45,7 +45,7 @@ JKRArchive* JKRArchive::mount(void* ptr, JKRHeap* heap,
|
||||
|
||||
int alignment = mountDirection == MOUNT_DIRECTION_HEAD ? 4 : -4;
|
||||
|
||||
JKRArchive* newArchive = new (heap, alignment) JKRMemArchive(ptr, 0xFFFF, JKRMEMBREAK_FLAG_UNKNOWN0);
|
||||
JKRArchive* newArchive = JKR_NEW_ARGS (heap, alignment) JKRMemArchive(ptr, 0xFFFF, JKRMEMBREAK_FLAG_UNKNOWN0);
|
||||
return newArchive;
|
||||
}
|
||||
|
||||
@@ -60,21 +60,21 @@ JKRArchive* JKRArchive::mount(s32 entryNum, JKRArchive::EMountMode mountMode, JK
|
||||
JKRArchive* newArchive;
|
||||
switch (mountMode) {
|
||||
case JKRArchive::MOUNT_MEM:
|
||||
newArchive = new (heap, alignment) JKRMemArchive(entryNum, mountDirection);
|
||||
newArchive = JKR_NEW_ARGS (heap, alignment) JKRMemArchive(entryNum, mountDirection);
|
||||
break;
|
||||
case JKRArchive::MOUNT_ARAM:
|
||||
newArchive = new (heap, alignment) JKRAramArchive(entryNum, mountDirection);
|
||||
newArchive = JKR_NEW_ARGS (heap, alignment) JKRAramArchive(entryNum, mountDirection);
|
||||
break;
|
||||
case JKRArchive::MOUNT_DVD:
|
||||
newArchive = new (heap, alignment) JKRDvdArchive(entryNum, mountDirection);
|
||||
newArchive = JKR_NEW_ARGS (heap, alignment) JKRDvdArchive(entryNum, mountDirection);
|
||||
break;
|
||||
case JKRArchive::MOUNT_COMP:
|
||||
newArchive = new (heap, alignment) JKRCompArchive(entryNum, mountDirection);
|
||||
newArchive = JKR_NEW_ARGS (heap, alignment) JKRCompArchive(entryNum, mountDirection);
|
||||
break;
|
||||
}
|
||||
|
||||
if (newArchive && newArchive->mMountMode == JKRArchive::UNKNOWN_MOUNT_MODE) {
|
||||
delete newArchive;
|
||||
JKR_DELETE(newArchive);
|
||||
newArchive = NULL;
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ JKRFileFinder* JKRArchive::getFirstFile(const char* path) const {
|
||||
|
||||
if (dirEntry) {
|
||||
// don't know what is correct here... for now we're casting away const
|
||||
return new (JKRGetSystemHeap(), 0)
|
||||
return JKR_NEW_ARGS (JKRGetSystemHeap(), 0)
|
||||
JKRArcFinder((JKRArchive*)this, dirEntry->first_file_index, (u32)dirEntry->num_entries);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ JKRAssertHeap* JKRAssertHeap::create(JKRHeap* parent) {
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
||||
JKRAssertHeap* heap = new (ptr) JKRAssertHeap(NULL, 0, parent, false);
|
||||
JKRAssertHeap* heap = JKR_NEW_ARGS (ptr) JKRAssertHeap(NULL, 0, parent, false);
|
||||
return heap;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ JKRCompArchive::~JKRCompArchive() {
|
||||
}
|
||||
|
||||
if (mDvdFile != NULL) {
|
||||
delete mDvdFile;
|
||||
JKR_DELETE(mDvdFile);
|
||||
}
|
||||
|
||||
sVolumeList.remove(&mFileLoaderLink);
|
||||
@@ -73,7 +73,7 @@ bool JKRCompArchive::open(s32 entryNum) {
|
||||
mFiles = NULL;
|
||||
mStringTable = NULL;
|
||||
|
||||
mDvdFile = new (JKRGetSystemHeap(), 0) JKRDvdFile(entryNum);
|
||||
mDvdFile = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRDvdFile(entryNum);
|
||||
if(mDvdFile == NULL) {
|
||||
mMountMode = 0;
|
||||
return 0;
|
||||
@@ -216,7 +216,7 @@ bool JKRCompArchive::open(s32 entryNum) {
|
||||
if (mMountMode == 0) {
|
||||
OS_REPORT(":::[%s: %d] Cannot alloc memory in mounting CompArchive\n", __FILE__, 567);
|
||||
if(mDvdFile != NULL) {
|
||||
delete mDvdFile;
|
||||
JKR_DELETE(mDvdFile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ JKRDecomp* JKRDecomp::sDecompObject;
|
||||
|
||||
JKRDecomp* JKRDecomp::create(s32 priority) {
|
||||
if (!sDecompObject) {
|
||||
sDecompObject = new (JKRGetSystemHeap(), 0) JKRDecomp(priority);
|
||||
sDecompObject = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRDecomp(priority);
|
||||
}
|
||||
|
||||
return sDecompObject;
|
||||
@@ -62,7 +62,7 @@ void* JKRDecomp::run() {
|
||||
JKRDecompCommand* JKRDecomp::prepareCommand(u8* srcBuffer, u8* dstBuffer, u32 srcLength,
|
||||
u32 dstLength,
|
||||
JKRDecompCommand::AsyncCallback callback) {
|
||||
JKRDecompCommand* command = new (JKRGetSystemHeap(), -4) JKRDecompCommand();
|
||||
JKRDecompCommand* command = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRDecompCommand();
|
||||
command->mSrcBuffer = srcBuffer;
|
||||
command->mDstBuffer = dstBuffer;
|
||||
command->mSrcLength = srcLength;
|
||||
@@ -102,7 +102,7 @@ bool JKRDecomp::sync(JKRDecompCommand* command, int isNonBlocking) {
|
||||
bool JKRDecomp::orderSync(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 dstLength) {
|
||||
JKRDecompCommand* command = orderAsync(srcBuffer, dstBuffer, srcLength, dstLength, NULL);
|
||||
bool result = sync(command, JKRDECOMP_SYNC_BLOCKING);
|
||||
delete command;
|
||||
JKR_DELETE(command);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,17 +38,17 @@ JKRAramBlock* JKRDvdAramRipper::loadToAram(JKRDvdFile* dvdFile, u32 address,
|
||||
syncAram(command, 0);
|
||||
|
||||
if (command->field_0x48 < 0) {
|
||||
delete command;
|
||||
JKR_DELETE(command);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (address) {
|
||||
delete command;
|
||||
JKR_DELETE(command);
|
||||
return (JKRAramBlock*)-1;
|
||||
}
|
||||
|
||||
JKRAramBlock* result = command->mBlock;
|
||||
delete command;
|
||||
JKR_DELETE(command);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ JKRADCommand* JKRDvdAramRipper::loadToAram_Async(JKRDvdFile* dvdFile, u32 addres
|
||||
JKRExpandSwitch expandSwitch,
|
||||
void (*callback)(u32), u32 param_4, u32 param_5,
|
||||
u32* param_6) {
|
||||
JKRADCommand* command = new (JKRGetSystemHeap(), -4) JKRADCommand();
|
||||
JKRADCommand* command = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRADCommand();
|
||||
command->mDvdFile = dvdFile;
|
||||
command->mAddress = address;
|
||||
command->mBlock = NULL;
|
||||
@@ -68,7 +68,7 @@ JKRADCommand* JKRDvdAramRipper::loadToAram_Async(JKRDvdFile* dvdFile, u32 addres
|
||||
|
||||
JKRADCommand* cmd2 = callCommand_Async(command);
|
||||
if (!cmd2) {
|
||||
delete command;
|
||||
JKR_DELETE(command);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ JKRADCommand* JKRDvdAramRipper::callCommand_Async(JKRADCommand* command) {
|
||||
bVar1 = false;
|
||||
} else {
|
||||
dvdFile->field_0x50 = OSGetCurrentThread();
|
||||
JSUFileInputStream* stream = new (JKRGetSystemHeap(), -4) JSUFileInputStream(dvdFile);
|
||||
JSUFileInputStream* stream = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JSUFileInputStream(dvdFile);
|
||||
dvdFile->mFileStream = stream;
|
||||
u32 fileSize = dvdFile->getFileSize();
|
||||
if (command->field_0x40 && fileSize > command->field_0x40) {
|
||||
@@ -111,7 +111,7 @@ JKRADCommand* JKRDvdAramRipper::callCommand_Async(JKRADCommand* command) {
|
||||
}
|
||||
|
||||
if (JKRDvdAramRipper::errorRetry == 0) {
|
||||
delete stream;
|
||||
JKR_DELETE(stream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -206,10 +206,10 @@ bool JKRDvdAramRipper::syncAram(JKRADCommand* command, int param_1) {
|
||||
|
||||
(*((JSUList<JKRADCommand>*)&sDvdAramAsyncList)).remove(&command->mLink);
|
||||
if (command->mStreamCommand) {
|
||||
delete command->mStreamCommand;
|
||||
JKR_DELETE(command->mStreamCommand);
|
||||
}
|
||||
|
||||
delete dvdFile->mFileStream;
|
||||
JKR_DELETE(dvdFile->mFileStream);
|
||||
dvdFile->field_0x50 = NULL;
|
||||
OSUnlockMutex(&dvdFile->mMutex2);
|
||||
return true;
|
||||
@@ -222,7 +222,7 @@ JKRADCommand::JKRADCommand() : mLink(this) {
|
||||
|
||||
JKRADCommand::~JKRADCommand() {
|
||||
if (field_0x4c == 1) {
|
||||
delete mDvdFile;
|
||||
JKR_DELETE(mDvdFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ JKRDvdArchive::~JKRDvdArchive() {
|
||||
}
|
||||
|
||||
if (mDvdFile) {
|
||||
delete mDvdFile;
|
||||
JKR_DELETE(mDvdFile);
|
||||
}
|
||||
|
||||
sVolumeList.remove(&mFileLoaderLink);
|
||||
@@ -61,7 +61,7 @@ bool JKRDvdArchive::open(s32 entryNum) {
|
||||
mFiles = NULL;
|
||||
mStringTable = NULL;
|
||||
|
||||
mDvdFile = new (JKRGetSystemHeap(), 0) JKRDvdFile(entryNum);
|
||||
mDvdFile = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRDvdFile(entryNum);
|
||||
if (!mDvdFile) {
|
||||
mMountMode = UNKNOWN_MOUNT_MODE;
|
||||
return false;
|
||||
@@ -137,7 +137,7 @@ cleanup:
|
||||
if (mMountMode == UNKNOWN_MOUNT_MODE) {
|
||||
OS_REPORT(":::Cannot alloc memory [%s][%d]\n", __FILE__, 397);
|
||||
if (mDvdFile) {
|
||||
delete mDvdFile;
|
||||
JKR_DELETE(mDvdFile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ JKRExpHeap* JKRExpHeap::createRoot(int maxHeaps, bool errorFlag) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
JKRExpHeap* heap2 = new (mem2) JKRExpHeap(local_20, local_24, NULL, errorFlag);
|
||||
JKRExpHeap* heap2 = JKR_NEW_ARGS (mem2) JKRExpHeap(local_20, local_24, NULL, errorFlag);
|
||||
sRootHeap2 = heap2;
|
||||
heap2->field_0x6e = true;
|
||||
#endif
|
||||
@@ -49,7 +49,7 @@ JKRExpHeap* JKRExpHeap::createRoot(int maxHeaps, bool errorFlag) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
heap = new (mem1) JKRExpHeap(start1, alignedSize, NULL, errorFlag);
|
||||
heap = JKR_NEW_ARGS (mem1) JKRExpHeap(start1, alignedSize, NULL, errorFlag);
|
||||
sRootHeap = heap;
|
||||
}
|
||||
heap->field_0x6e = true;
|
||||
@@ -79,7 +79,7 @@ JKRExpHeap* JKRExpHeap::create(u32 size, JKRHeap* parent, bool errorFlag) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newHeap = new (memory) JKRExpHeap(dataPtr, alignedSize - expHeapSize, parent, errorFlag);
|
||||
newHeap = JKR_NEW_ARGS (memory) JKRExpHeap(dataPtr, alignedSize - expHeapSize, parent, errorFlag);
|
||||
|
||||
if (newHeap == NULL) {
|
||||
JKRFree(memory);
|
||||
@@ -117,7 +117,7 @@ JKRExpHeap* JKRExpHeap::create(void* ptr, u32 size, JKRHeap* parent, bool errorF
|
||||
u8* dataPtr = r28 + expHeapSize;
|
||||
u32 alignedSize = ALIGN_PREV((uintptr_t)ptr + size - (uintptr_t)dataPtr, 0x10);
|
||||
if (r28) {
|
||||
newHeap = new (r28) JKRExpHeap(dataPtr, alignedSize, parent2, errorFlag);
|
||||
newHeap = JKR_NEW_ARGS (r28) JKRExpHeap(dataPtr, alignedSize, parent2, errorFlag);
|
||||
}
|
||||
#if DEBUG
|
||||
if (newHeap) {
|
||||
@@ -212,12 +212,17 @@ void* JKRExpHeap::do_alloc(u32 size, int alignment) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
JUT_ASSERT_MSG_F(__LINE__, ptr != nullptr, "failed to alloc memory! (0x%x byte).\n", size);
|
||||
#else
|
||||
if (ptr == NULL) {
|
||||
JUTWarningConsole_f(":::cannot alloc memory (0x%x byte).\n", size);
|
||||
if (getErrorFlag() == true) {
|
||||
callErrorHandler(this, size, alignment);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
unlock();
|
||||
|
||||
return ptr;
|
||||
@@ -783,9 +788,9 @@ void JKRExpHeap::recycleFreeBlock(JKRExpHeap::CMemBlock* block) {
|
||||
}
|
||||
|
||||
void JKRExpHeap::joinTwoBlocks(CMemBlock* block) {
|
||||
u32 endAddr = (uintptr_t)(block + 1) + block->size;
|
||||
uintptr_t endAddr = (uintptr_t)(block + 1) + block->size;
|
||||
CMemBlock* next = block->mNext;
|
||||
u32 nextAddr = (uintptr_t)next - (next->mFlags & 0x7f);
|
||||
uintptr_t nextAddr = (uintptr_t)next - (next->mFlags & 0x7f);
|
||||
if (endAddr > nextAddr) {
|
||||
JUTWarningConsole_f(":::Heap may be broken. (block = %x)", block);
|
||||
OS_REPORT(":::block = %x\n", block);
|
||||
@@ -1005,6 +1010,10 @@ JKRExpHeap::CMemBlock* JKRExpHeap::CMemBlock::allocFore(u32 size1, u8 groupId1,
|
||||
mGroupId = groupId1;
|
||||
mFlags = alignment1;
|
||||
if (size >= size1 + sizeof(CMemBlock)) {
|
||||
#if TARGET_PC
|
||||
if ((size - size1) <= sizeof(CMemBlock))
|
||||
return NULL;
|
||||
#endif
|
||||
block = (CMemBlock*)(size1 + (uintptr_t)this);
|
||||
block[1].mGroupId = groupId2;
|
||||
block[1].mFlags = alignment2;
|
||||
|
||||
@@ -33,7 +33,7 @@ JKRFileCache* JKRFileCache::mount(const char* path, JKRHeap* heap, const char* p
|
||||
}
|
||||
|
||||
|
||||
JKRFileCache* fileCache = new (heap, 0) JKRFileCache(path, param_3);
|
||||
JKRFileCache* fileCache = JKR_NEW_ARGS (heap, 0) JKRFileCache(path, param_3);
|
||||
return fileCache;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ void* JKRFileCache::getResource(const char* path) {
|
||||
if (buffer) {
|
||||
dvdFile.read(buffer, alignedSize, 0);
|
||||
|
||||
cacheBlock = new (JKRGetSystemHeap(), 0)
|
||||
cacheBlock = JKR_NEW_ARGS (JKRGetSystemHeap(), 0)
|
||||
CCacheBlock(dvdFile.getFileID(), dvdFile.getFileInfo()->length, buffer);
|
||||
mCacheBlockList.append(&cacheBlock->mCacheBlockLink);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ void JKRFileCache::removeResourceAll(void) {
|
||||
while (iterator != mCacheBlockList.getEnd()) {
|
||||
JKRFreeToHeap(mParentHeap, iterator->mMemoryPtr);
|
||||
mCacheBlockList.remove(&iterator.getObject()->mCacheBlockLink);
|
||||
delete (iterator++).getObject();
|
||||
JKR_DELETE((iterator++).getObject());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ bool JKRFileCache::removeResource(void* resource) {
|
||||
if (--cacheBlock->mReferenceCount == 0) {
|
||||
JKRFreeToHeap(mParentHeap, resource);
|
||||
mCacheBlockList.remove(&cacheBlock->mCacheBlockLink);
|
||||
delete cacheBlock;
|
||||
JKR_DELETE(cacheBlock);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -230,7 +230,7 @@ bool JKRFileCache::detachResource(void* resource) {
|
||||
return false;
|
||||
|
||||
mCacheBlockList.remove(&cacheBlock->mCacheBlockLink);
|
||||
delete cacheBlock;
|
||||
JKR_DELETE(cacheBlock);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -262,11 +262,11 @@ u32 JKRFileCache::countFile(const char* path) const {
|
||||
|
||||
JKRFileFinder* JKRFileCache::getFirstFile(const char* path) const {
|
||||
char* name = getDvdPathName(path);
|
||||
JKRDvdFinder* finder = new (JKRGetSystemHeap(), 0) JKRDvdFinder(name);
|
||||
JKRDvdFinder* finder = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRDvdFinder(name);
|
||||
JKRFreeToSysHeap(name);
|
||||
|
||||
if (finder->isAvailable() != true) {
|
||||
delete finder;
|
||||
JKR_DELETE(finder);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "global.h"
|
||||
|
||||
JKRFileLoader* JKRFileLoader::sCurrentVolume;
|
||||
@@ -23,7 +25,7 @@ JKRFileLoader::~JKRFileLoader() {
|
||||
void JKRFileLoader::unmount(void) {
|
||||
if (mMountCount != 0) {
|
||||
if (--mMountCount == 0) {
|
||||
delete this;
|
||||
JKR_DELETE(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <algorithm>
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#ifdef __MWERKS__
|
||||
@@ -515,19 +517,54 @@ bool JKRHeap::isSubHeap(JKRHeap* heap) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
[[nodiscard]]
|
||||
static void* fallback_alloc(size_t size, size_t align, bool log=true) {
|
||||
if (log) {
|
||||
auto curHeap = JKRHeap::getCurrentHeap();
|
||||
const char* name = "<null>";
|
||||
if (curHeap != nullptr) {
|
||||
name = curHeap->getName();
|
||||
}
|
||||
|
||||
OSReport(
|
||||
"[NEW] JKRHeap (%s) FULL! Fallback to malloc for size %u\n",
|
||||
name, (unsigned)size);
|
||||
}
|
||||
|
||||
if (align == 0) {
|
||||
align = alignof(max_align_t);
|
||||
}
|
||||
|
||||
assert((align & (align - 1)) == 0 && "Alignment must be a power of two");
|
||||
|
||||
#if _WIN32
|
||||
// aligned_alloc() is not available on Windows.
|
||||
// NOTE: We always use _aligned_malloc(), even for allocs <= max_align_t,
|
||||
// because otherwise we can't tell in operator delete() whether a pointer needs to be freed with
|
||||
// _aligned_free() or regular free().
|
||||
return _aligned_malloc(size, align);
|
||||
#else
|
||||
// aligned_alloc() requires size be a multiple of align. So ensure it is.
|
||||
size = ALIGN_NEXT(size, align);
|
||||
return aligned_alloc(align, size);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !TARGET_PC
|
||||
void* operator new(size_t size) {
|
||||
return JKRHeap::alloc(size, 4, NULL);
|
||||
}
|
||||
#else
|
||||
void* operator new(size_t size) {
|
||||
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM) {
|
||||
if (sCurrentHeap == NULL) {
|
||||
return malloc(size);
|
||||
return fallback_alloc(size, 0, false);
|
||||
}
|
||||
void* mem = JKRHeap::alloc(size, alignof(max_align_t), NULL);
|
||||
if (mem == NULL) {
|
||||
OSReport("[NEW] JKRHeap FULL! Fallback to malloc for size %u\n", (unsigned)size);
|
||||
mem = malloc(size);
|
||||
if (mem == nullptr) {
|
||||
return fallback_alloc(size, 0, true);
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
@@ -538,27 +575,16 @@ void* operator new(size_t size, int alignment) {
|
||||
return JKRHeap::alloc(size, alignment, NULL);
|
||||
}
|
||||
#else
|
||||
void* operator new(size_t size, int alignment) {
|
||||
if (sCurrentHeap == nullptr)
|
||||
#if !_WIN32
|
||||
return aligned_alloc(alignment, size);
|
||||
#else
|
||||
return _aligned_malloc(size, alignment);
|
||||
#endif
|
||||
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment) {
|
||||
void* mem = JKRHeap::alloc(size, alignment, nullptr);
|
||||
if (mem == nullptr) {
|
||||
OSReport("[NEW] JKRHeap FULL! Fallback to aligned_malloc size %u\n", (unsigned)size);
|
||||
#if !_WIN32
|
||||
return aligned_alloc(alignment, size);
|
||||
#else
|
||||
return _aligned_malloc(size, alignment);
|
||||
#endif
|
||||
return fallback_alloc(size, abs(alignment), true);
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* operator new(size_t size, JKRHeap* heap, int alignment) {
|
||||
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) {
|
||||
return JKRHeap::alloc(size, alignment, heap);
|
||||
}
|
||||
|
||||
@@ -568,11 +594,17 @@ void* operator new[](size_t size) {
|
||||
}
|
||||
#else
|
||||
void* operator new[](size_t size) {
|
||||
if (sCurrentHeap == NULL)
|
||||
return malloc(size);
|
||||
return fallback_alloc(size, 0, false);
|
||||
}
|
||||
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept {
|
||||
return fallback_alloc(size, 0, false);
|
||||
}
|
||||
|
||||
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM) {
|
||||
void* mem = JKRHeap::alloc(size, alignof(max_align_t), NULL);
|
||||
if (mem == NULL) {
|
||||
mem = malloc(size);
|
||||
return fallback_alloc(size, 0, true);
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
@@ -583,25 +615,16 @@ void* operator new[](size_t size, int alignment) {
|
||||
return JKRHeap::alloc(size, alignment, NULL);
|
||||
}
|
||||
#else
|
||||
void* operator new[](size_t size, int alignment) {
|
||||
if (sCurrentHeap == nullptr)
|
||||
#if !_WIN32
|
||||
return aligned_alloc(alignment, size);
|
||||
#else
|
||||
return _aligned_malloc(size, alignment);
|
||||
#endif
|
||||
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, int alignment) {
|
||||
void* mem = JKRHeap::alloc(size, alignment, nullptr);
|
||||
if (mem == nullptr)
|
||||
#if !_WIN32
|
||||
return aligned_alloc(alignment, size);
|
||||
#else
|
||||
return _aligned_malloc(size, alignment);
|
||||
#endif
|
||||
if (mem == nullptr) {
|
||||
return fallback_alloc(size, 0, true);
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* operator new[](size_t size, JKRHeap* heap, int alignment) {
|
||||
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) {
|
||||
return JKRHeap::alloc(size, alignment, heap);
|
||||
}
|
||||
|
||||
@@ -610,15 +633,19 @@ void operator delete(void* ptr) {
|
||||
JKRHeap::free(ptr, NULL);
|
||||
}
|
||||
#else
|
||||
void operator delete(void* ptr) {
|
||||
void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM) {
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
JKRHeap* heap = JKRHeap::findFromRoot(ptr);
|
||||
if (heap == NULL) {
|
||||
#if !_WIN32
|
||||
free(ptr);
|
||||
#else
|
||||
_aligned_free(ptr);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
JKRHeap::free(ptr, NULL);
|
||||
JKRHeap::free(ptr, heap);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -632,10 +659,14 @@ void operator delete[](void* ptr) {
|
||||
return;
|
||||
JKRHeap* heap = JKRHeap::findFromRoot(ptr);
|
||||
if (heap == NULL) {
|
||||
#if !_WIN32
|
||||
free(ptr);
|
||||
#else
|
||||
_aligned_free(ptr);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
JKRHeap::free(ptr, NULL);
|
||||
JKRHeap::free(ptr, heap);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -681,7 +712,8 @@ JKRHeap* JKRHeap::getCurrentHeap() {
|
||||
|
||||
void JKRHeap::setName(const char* name) {
|
||||
size_t len = strlen(name);
|
||||
memcpy(mName, name, std::max(len, sizeof(mName)-1));
|
||||
strncpy(mName, name, sizeof(mName) - 1);
|
||||
mName[sizeof(mName) - 1] = '\0';
|
||||
}
|
||||
const char* JKRHeap::getName() const {
|
||||
return mName;
|
||||
|
||||
@@ -27,7 +27,7 @@ JKRSolidHeap* JKRSolidHeap::create(u32 size, JKRHeap* heap, bool useErrorHandler
|
||||
if (!mem)
|
||||
return NULL;
|
||||
|
||||
return new (mem) JKRSolidHeap(dataPtr, alignedSize - solidHeapSize, heap, useErrorHandler);
|
||||
return JKR_NEW_ARGS (mem) JKRSolidHeap(dataPtr, alignedSize - solidHeapSize, heap, useErrorHandler);
|
||||
}
|
||||
|
||||
void JKRSolidHeap::do_destroy(void) {
|
||||
|
||||
@@ -127,7 +127,7 @@ JKRThreadSwitch* JKRThreadSwitch::createManager(JKRHeap* heap) {
|
||||
heap = JKRGetCurrentHeap();
|
||||
}
|
||||
|
||||
sManager = new (heap, 0) JKRThreadSwitch(heap);
|
||||
sManager = JKR_NEW_ARGS (heap, 0) JKRThreadSwitch(heap);
|
||||
return sManager;
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console
|
||||
|
||||
static void dummy4(JKRTask* thread, JSULink<JKRTask>* link) {
|
||||
thread->getStack();
|
||||
delete link;
|
||||
JKR_DELETE(link);
|
||||
}
|
||||
|
||||
JKRTask::~JKRTask() {
|
||||
@@ -322,7 +322,7 @@ int JKRTask::check() {
|
||||
#if !PLATFORM_GCN
|
||||
static void dummy(JKRIdleThread* thread) {
|
||||
thread->run();
|
||||
delete thread;
|
||||
JKR_DELETE(thread);
|
||||
thread->destroy();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
#include "JSystem/JMessage/data.h"
|
||||
|
||||
const u32 JMessage::data::ga4cSignature = 'MESG';
|
||||
const BE(u32) JMessage::data::ga4cSignature = 'MESG';
|
||||
|
||||
const u32 JMessage::data::ga4cSignature_color = 'MGCL';
|
||||
const BE(u32) JMessage::data::ga4cSignature_color = 'MGCL';
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
u16 JMessage::TResource::toMessageIndex_messageID(u32 uMsgID, u32 upperHalf, bool* pbValid) const {
|
||||
if (!oParse_TBlock_messageID_.getRaw()) {
|
||||
return 0xFFFF;
|
||||
@@ -63,7 +65,7 @@ u16 JMessage::TResource::toMessageIndex_messageID(u32 uMsgID, u32 upperHalf, boo
|
||||
|
||||
int nMsgNumber = oParse_TBlock_messageID_.get_number();
|
||||
|
||||
const u32* pContent = oParse_TBlock_messageID_.getContent();
|
||||
const u32* pContent = (u32*)oParse_TBlock_messageID_.getContent();
|
||||
JUT_ASSERT(131, pContent!=NULL);
|
||||
|
||||
const u32* pFirst = pContent;
|
||||
@@ -112,12 +114,12 @@ JMessage::TResource* JMessage::TResourceContainer::TCResource::Get_groupID(u16 u
|
||||
}
|
||||
|
||||
JMessage::TResource* JMessage::TResourceContainer::TCResource::Do_create() {
|
||||
return new TResource();
|
||||
return JKR_NEW TResource();
|
||||
}
|
||||
|
||||
void JMessage::TResourceContainer::TCResource::Do_destroy(JMessage::TResource* pResource) {
|
||||
#if DEBUG
|
||||
delete pResource;
|
||||
JKR_DELETE(pResource);
|
||||
#else
|
||||
operator delete(pResource);
|
||||
#endif
|
||||
@@ -166,7 +168,7 @@ bool JMessage::TParse::parseHeader_next(const void** ppData_inout, u32* puBlock_
|
||||
|
||||
JUT_ASSERT(350, pContainer_!=NULL);
|
||||
|
||||
if (memcmp(oHeader.get_signature(), &data::ga4cSignature, sizeof(data::ga4cSignature)) != 0) {
|
||||
if (memcmp((u32*)oHeader.get_signature(), &data::ga4cSignature, sizeof(data::ga4cSignature)) != 0) {
|
||||
JGADGET_WARNMSG(355, "unknown signature");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,25 +17,25 @@ JPAEmitterManager::JPAEmitterManager(u32 i_ptclNum, u32 i_emtrNum, JKRHeap* pHea
|
||||
|
||||
JUT_ASSERT(40, emtrNum && ptclNum && gidMax && ridMax);
|
||||
|
||||
JPABaseEmitter* p_emtr_link = new (pHeap, 0) JPABaseEmitter[emtrNum];
|
||||
JPABaseEmitter* p_emtr_link = JKR_NEW_ARGS (pHeap, 0) JPABaseEmitter[emtrNum];
|
||||
JUT_ASSERT(44, p_emtr_link);
|
||||
for (u32 i = 0; i < emtrNum; i++)
|
||||
mFreeEmtrList.prepend(&p_emtr_link[i].mLink);
|
||||
|
||||
JPANode<JPABaseParticle>* p_ptcl_node = new (pHeap, 0) JPANode<JPABaseParticle>[ptclNum];
|
||||
JPANode<JPABaseParticle>* p_ptcl_node = JKR_NEW_ARGS (pHeap, 0) JPANode<JPABaseParticle>[ptclNum];
|
||||
JUT_ASSERT(51, p_ptcl_node);
|
||||
for (u32 i = 0; i < ptclNum; i++)
|
||||
mPtclPool.push_back(&p_ptcl_node[i]);
|
||||
|
||||
pEmtrUseList = new (pHeap, 0) JSUList<JPABaseEmitter>[gidMax];
|
||||
pEmtrUseList = JKR_NEW_ARGS (pHeap, 0) JSUList<JPABaseEmitter>[gidMax];
|
||||
JUT_ASSERT(58, pEmtrUseList);
|
||||
pResMgrAry = new (pHeap, 0) JPAResourceManager*[ridMax];
|
||||
pResMgrAry = JKR_NEW_ARGS (pHeap, 0) JPAResourceManager*[ridMax];
|
||||
JUT_ASSERT(62, pResMgrAry)
|
||||
for (int i = 0; i < ridMax; i++) {
|
||||
pResMgrAry[i] = NULL;
|
||||
}
|
||||
|
||||
pWd = new (pHeap, 0) JPAEmitterWorkData();
|
||||
pWd = JKR_NEW_ARGS (pHeap, 0) JPAEmitterWorkData();
|
||||
JUT_ASSERT(67, pWd);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user