Merge pull request #28 from TakaRikka/26-02-27-allocator-isolation

Isolate JKRHeap operator overloads
This commit is contained in:
TakaRikka
2026-03-06 19:03:41 -08:00
committed by GitHub
630 changed files with 3453 additions and 3350 deletions
+2 -2
View File
@@ -146,8 +146,8 @@ struct daFmtMng_c : public fopAc_ac_c {
for (int i = 0; i < mFormationLine * mFormationRow; i++, member++) {
fopAcM_delete(member->mNpcId);
}
delete [] mPos;
delete [] mMember;
JKR_DELETE_ARRAY(mPos);
JKR_DELETE_ARRAY(mMember);
}
int getTimeHour() {
+1 -1
View File
@@ -815,7 +815,7 @@ STATIC_ASSERT(sizeof(daNpcT_c) == 0xE40);
#define daNpcT_ct(ptr, ClassName, faceMotionAnmData, motionAnmData, faceMotionSequenceData, faceMotionStepNum, motionSequenceData, motionStepNum, evtData, arcNames) \
if (!fopAcM_CheckCondition(ptr, fopAcCnd_INIT_e)) { \
new (ptr) ClassName(faceMotionAnmData, motionAnmData, faceMotionSequenceData, faceMotionStepNum, motionSequenceData, motionStepNum, evtData, arcNames); \
JKR_NEW_ARGS (ptr) ClassName(faceMotionAnmData, motionAnmData, faceMotionSequenceData, faceMotionStepNum, motionSequenceData, motionStepNum, evtData, arcNames); \
fopAcM_OnCondition(ptr, fopAcCnd_INIT_e); \
}
+1 -1
View File
@@ -51,7 +51,7 @@ public:
}
~_Fairy_Feather_c() {
if (mpMorf != NULL) {
delete mpMorf;
JKR_DELETE(mpMorf);
mpMorf = NULL;
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ public:
int getLuggageParamHigh(u32);
int create();
void create_init();
~daPasserMng_c() { delete [] childProcIds; }
~daPasserMng_c() { JKR_DELETE_ARRAY(childProcIds); }
u8 getDetailLevel() { return argument; }
u8 getPathID() { return fopAcM_GetParam(this); }
+1 -1
View File
@@ -59,7 +59,7 @@ class dCsr_mng_c {
};
bloObj_c() {
m_panes = new paneObj_c[1];
m_panes = JKR_NEW paneObj_c[1];
m_screen = 0;
}
+7 -7
View File
@@ -15,8 +15,8 @@ class dDlst_FileSel_c : public dDlst_base_c {
public:
void draw();
virtual ~dDlst_FileSel_c() {
delete Scr;
delete mMessageString;
JKR_DELETE(Scr);
JKR_DELETE(mMessageString);
}
dDlst_FileSel_c() {
@@ -26,7 +26,7 @@ public:
font[1] = mDoExt_getSubFont();
JUT_ASSERT(107, font[1] != NULL);
mMessageString = new dMsgString_c();
mMessageString = JKR_NEW dMsgString_c();
JUT_ASSERT(110, mMessageString != NULL);
}
@@ -78,7 +78,7 @@ public:
class dDlst_FileSelYn_c : public dDlst_base_c {
public:
void draw();
virtual ~dDlst_FileSelYn_c() { delete ScrYn; }
virtual ~dDlst_FileSelYn_c() { JKR_DELETE(ScrYn); }
/* 0x04 */ J2DScreen* ScrYn;
/* 0x08 */ u8 field_0x08[4];
@@ -87,7 +87,7 @@ public:
class dDlst_FileSelDt_c : public dDlst_base_c {
public:
void draw();
virtual ~dDlst_FileSelDt_c() { delete ScrDt; }
virtual ~dDlst_FileSelDt_c() { JKR_DELETE(ScrDt); }
/* 0x04 */ J2DScreen* ScrDt;
/* 0x08 */ J2DPane* mpPane;
@@ -97,7 +97,7 @@ public:
class dDlst_FileSelCp_c : public dDlst_base_c {
public:
void draw();
virtual ~dDlst_FileSelCp_c() { delete Scr; }
virtual ~dDlst_FileSelCp_c() { JKR_DELETE(Scr); }
/* 0x04 */ J2DScreen* Scr;
/* 0x08 */ bool isShow;
@@ -108,7 +108,7 @@ public:
class dDlst_FileSel3m_c : public dDlst_base_c {
public:
void draw();
virtual ~dDlst_FileSel3m_c() { delete Scr3m; }
virtual ~dDlst_FileSel3m_c() { JKR_DELETE(Scr3m); }
/* 0x04 */ J2DScreen* Scr3m;
};
+3 -3
View File
@@ -14,7 +14,7 @@ public:
~fmpTresTypeGroupData_c() {
if (mpNext != NULL) {
delete mpNext;
JKR_DELETE(mpNext);
}
}
@@ -34,7 +34,7 @@ public:
void addTypeGroupData(u8, dTres_c::data_s const*);
~fmpTresTypeGroupDataList_c() {
if (mpTypeGroupDataHead != NULL) {
delete mpTypeGroupDataHead;
JKR_DELETE(mpTypeGroupDataHead);
}
}
fmpTresTypeGroupDataList_c() {
@@ -106,7 +106,7 @@ public:
~dMenu_Fmap_room_data_c() {
if (mp_fmpTresTypeGroupDataListAll != NULL) {
delete mp_fmpTresTypeGroupDataListAll;
JKR_DELETE(mp_fmpTresTypeGroupDataListAll);
}
}
+3 -1
View File
@@ -8,6 +8,8 @@
#include "CaptureScreen.h"
#include <cstring>
#include "JSystem/JKernel/JKRHeap.h"
void fapGm_After();
void fapGm_Create();
void fapGm_Execute();
@@ -28,7 +30,7 @@ public:
static void executeCaptureScreen() {}
static void createCaptureScreen() {
mCaptureScreen = new CaptureScreen(JFWDisplay::getManager());
mCaptureScreen = JKR_NEW CaptureScreen(JFWDisplay::getManager());
JUT_ASSERT(46, mCaptureScreen != NULL);
}
+1 -1
View File
@@ -23,7 +23,7 @@
#define fopAcM_ct_placement(ptr, ClassName) \
fopAc_ac_c copy; \
memcpy(&copy.type, &(ptr)->type, fopAcM_ct_placement_copy_length); \
new (ptr) ClassName() ; \
JKR_NEW_ARGS (ptr) ClassName() ; \
memcpy(&(ptr)->type, &copy.type, fopAcM_ct_placement_copy_length);
#else
#define fopAcM_ct_placement(ptr, ClassName) new (ptr) ClassName()
+2 -1
View File
@@ -4,6 +4,7 @@
#include "JSystem/JKernel/JKRArchive.h"
#include <os.h>
#include <os.h>
#include "JSystem/JKernel/JKRHeap.h"
#include "f_pc/f_pc_node.h"
#define mDoDvd_MOUNT_DIRECTION_HEAD 0
@@ -23,7 +24,7 @@ public:
virtual ~mDoDvdThd_command_c();
mDoDvdThd_command_c();
inline s32 sync() { return mIsDone; }
inline void destroy() { delete this; }
inline void destroy() { JKR_DELETE(this); }
virtual s32 execute() = 0;
}; // Size = 0x14
@@ -1,9 +1,10 @@
#ifndef J2DANIMATION_H
#define J2DANIMATION_H
#include "JSystem/JMath/JMath.h"
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
#include "JSystem/JUtility/JUTPalette.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JMath/JMath.h"
class J2DScreen;
struct ResTIMG;
@@ -284,7 +285,7 @@ public:
mPalette = NULL;
}
~J2DAnmTexPatternTIMGPointer() {
delete mPalette;
JKR_DELETE(mPalette);
}
/* 0x0 */ ResTIMG* mRes;
@@ -304,7 +305,7 @@ public:
ResTIMG* getResTIMG(u16) const;
JUTPalette* getPalette(u16) const;
virtual ~J2DAnmTexPattern() { delete[] mTIMGPtrArray; }
virtual ~J2DAnmTexPattern() { JKR_DELETE_ARRAY(mTIMGPtrArray); }
virtual void searchUpdateMaterialID(J2DScreen*);
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
u16 getUpdateMaterialID(u16 i) const {
@@ -1,6 +1,7 @@
#ifndef JAHPUBDEFINE_H
#define JAHPUBDEFINE_H
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTAssert.h"
template<class T>
@@ -12,7 +13,7 @@ public:
static T* newInstance() {
JUT_ASSERT(82, sInstance==NULL);
if (!sInstance) {
sInstance = new T();
sInstance = JKR_NEW T();
}
JUT_ASSERT(85, sInstance!=NULL);
return sInstance;
@@ -209,12 +209,12 @@ public:
return true;
}
MemoryChunk* pMVar4 = field_0x18;
field_0x18 = new (JASKernel::getSystemHeap(), 0) MemoryChunk(pMVar4);
field_0x18 = JKR_NEW_ARGS (JASKernel::getSystemHeap(), 0) MemoryChunk(pMVar4);
if (field_0x18 != NULL) {
return true;
}
JUT_WARN(428, "%s", "Not enough JASSystemHeap");
field_0x18 = new (JKRHeap::getSystemHeap(), 0) MemoryChunk(pMVar4);
field_0x18 = JKR_NEW_ARGS (JKRHeap::getSystemHeap(), 0) MemoryChunk(pMVar4);
if (field_0x18 != NULL) {
return true;
}
@@ -246,7 +246,7 @@ public:
bool r26 = false;
if (chunk != field_0x18 && chunk->isEmpty()) {
MemoryChunk* nextChunk = chunk->getNextChunk();
delete chunk;
JKR_DELETE(chunk);
prevChunk->setNextChunk(nextChunk);
}
return;
@@ -283,6 +283,12 @@ namespace JASKernel {
template <typename T>
class JASPoolAllocObject {
public:
#if TARGET_PC
static void* operator new(size_t n, JKRHeapToken) {
return operator new(n);
}
#endif
static void* operator new(size_t n) {
#if PLATFORM_GCN
JASMemPool<T>& memPool_ = getMemPool_();
@@ -292,6 +298,13 @@ public:
static void* operator new(size_t n, void* ptr) {
return ptr;
}
#if TARGET_PC
static void operator delete(void* ptr, size_t n, JKRHeapToken) {
operator delete(ptr, n);
}
#endif
static void operator delete(void* ptr, size_t n) {
#if PLATFORM_GCN
JASMemPool<T>& memPool_ = getMemPool_();
@@ -362,6 +375,12 @@ public:
template <typename T>
class JASPoolAllocObject_MultiThreaded {
public:
#if TARGET_PC
static void* operator new(size_t n, JKRHeapToken) {
return operator new(n);
}
#endif
static void* operator new(size_t n) {
#if PLATFORM_GCN
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
@@ -371,6 +390,13 @@ public:
static void* operator new(size_t n, void* ptr) {
return ptr;
}
#if TARGET_PC
static void operator delete(void* ptr, size_t n, JKRHeapToken) {
return operator delete(ptr, n);
}
#endif
static void operator delete(void* ptr, size_t n) {
#if PLATFORM_GCN
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
@@ -1,6 +1,8 @@
#ifndef POINTER_H
#define POINTER_H
#include "JSystem/JKernel/JKRHeap.h"
namespace JGadget {
template<class T>
@@ -18,12 +20,12 @@ public:
#ifdef __MWERKS__
TPointer_delete(T* ptr) : TPointer(ptr) {}
~TPointer_delete() {
delete mPtr;
JKR_DELETE(mPtr);
}
#else
TPointer_delete(T* ptr) : TPointer<T>(ptr) {}
~TPointer_delete() {
delete this->mPtr;
JKR_DELETE(this->mPtr);
}
#endif
};
@@ -2,6 +2,7 @@
#define STD_MEMORY_H
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JKernel/JKRHeap.h"
namespace JGadget {
template <typename T>
@@ -19,12 +20,12 @@ struct TAllocator {
}
void DeallocateRaw(void* mem) {
delete mem;
JKR_DELETE(mem);
}
void construct(T* p, const T& other) {
JUT_ASSERT(67, p!=NULL);
new(p) T(other);
JKR_NEW_ARGS(p) T(other);
}
void destroy(T* p) {
@@ -4,7 +4,9 @@
#include "JSystem/JHostIO/JHIComm.h"
#include <os.h>
template<typename T, int I>
#include "JSystem/JKernel/JKRHeap.h"
template <typename T, int I>
class JHIpvector {
public:
JHIpvector() { m_size = 0; }
@@ -89,7 +91,7 @@ public:
static JHIComPortManager<T>* create() {
if (instance == NULL) {
instance = new JHIComPortManager<T>();
instance = JKR_NEW JHIComPortManager<T>();
}
return instance;
@@ -5,9 +5,11 @@
#include "JSystem/JKernel/JKRDisposer.h"
#include <os.h>
#include "JKRHeap.h"
/**
* @ingroup jsystem-jkernel
*
*
*/
class JKRAramHeap : public JKRDisposer {
public:
@@ -30,7 +32,7 @@ public:
u32 getUsedSize(u8);
void dump();
void free(JKRAramBlock *block) {
delete block;
JKR_DELETE(block);
}
u8 getCurrentGroupID() const { return mGroupId; }
+37 -13
View File
@@ -224,22 +224,46 @@ public:
#endif
};
#ifndef TARGET_PC
void* operator new(size_t size);
#endif
void* operator new(size_t size, int alignment);
void* operator new(size_t size, JKRHeap* heap, int alignment);
#if TARGET_PC
enum class JKRHeapToken {
Dummy
};
#ifndef TARGET_PC
void* operator new[](size_t size);
#endif
void* operator new[](size_t size, int alignment);
void* operator new[](size_t size, JKRHeap* heap, int alignment);
inline void* operator new(size_t, JKRHeapToken, void* where) {
return where;
}
#ifndef TARGET_PC
void operator delete(void* ptr);
template<typename T>
void jkrDelete(T* ptr) {
ptr->~T();
operator delete(ptr, JKRHeapToken::Dummy);
}
#define JKR_NEW new (JKRHeapToken::Dummy)
#define JKR_NEW_ARGS(...) new (JKRHeapToken::Dummy, __VA_ARGS__ )
#define JKR_DELETE(expr) jkrDelete(expr)
#define JKR_DELETE_ARRAY(expr) delete[] (expr)
#define JKR_HEAP_TOKEN , JKRHeapToken::Dummy
#define JKR_HEAP_TOKEN_PARAM , JKRHeapToken
#else
#define JKR_NEW new
#define JKR_NEW_ARGS(...) new (__VA_ARGS__ )
#define JKR_DELETE(expr) delete (expr)
#define JKR_DELETE_ARRAY(expr) delete[] (expr)
#define JKR_HEAP_TOKEN
#define JKR_HEAP_TOKEN_PARAM
#endif
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM);
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment);
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment);
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM);
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, int alignment);
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment);
void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM);
void operator delete[](void* ptr);
#endif
void JKRDefaultMemoryErrorRoutine(void* heap, u32 size, int alignment);
@@ -16,7 +16,7 @@ struct TCreateObject {
template<class AdaptorT>
static typename AdaptorT::ObjectType* createFromAdaptor(JStudio::stb::data::TParse_TBlock_object const& param_1, AdaptorT* param_2) {
typename AdaptorT::ObjectType* rv = new typename AdaptorT::ObjectType(param_1, param_2);
typename AdaptorT::ObjectType* rv = JKR_NEW typename AdaptorT::ObjectType(param_1, param_2);
if (rv == NULL) {
return NULL;
}
@@ -131,7 +131,7 @@ public:
template<class T>
T* createFromAdaptor(const stb::data::TParse_TBlock_object& param_0, T* param_1) {
T* n = new T(param_0, param_1);
T* n = JKR_NEW T(param_0, param_1);
if (n == NULL) {
return NULL;
@@ -321,7 +321,7 @@ template <class AdaptorT, class ObjectT>
JStudio::TObject* createObject_JSG_(const JStudio::stb::data::TParse_TBlock_object& param_1,
JStage::TObject* param_2, const JStage::TSystem* param_3) {
ObjectT* objt = (ObjectT*)param_2;
AdaptorT* pAdaptor = new AdaptorT(param_3, objt);
AdaptorT* pAdaptor = JKR_NEW AdaptorT(param_3, objt);
if (pAdaptor == NULL) {
return NULL;
}
@@ -3,10 +3,12 @@
#include <gx.h>
#include "JSystem/JKernel/JKRHeap.h"
/**
* @ingroup jsystem-jutility
*
*/
* @ingroup jsystem-jutility
*
*/
class JUTGraphFifo {
public:
JUTGraphFifo(u32);
@@ -40,6 +42,6 @@ private:
/* 0x10 */ u8 field_0x10[0xC];
};
inline JUTGraphFifo* JUTCreateFifo(u32 bufSize) { return new JUTGraphFifo(bufSize); }
inline JUTGraphFifo* JUTCreateFifo(u32 bufSize) { return JKR_NEW JUTGraphFifo(bufSize); }
#endif /* JUTGRAPHFIFO_H */
+3 -3
View File
@@ -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),
+10 -10
View File
@@ -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:
+101 -99
View File
@@ -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 -18
View File
@@ -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;
+1 -1
View File
@@ -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());
}
}
+10 -10
View File
@@ -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++) {
+1 -1
View File
@@ -62,7 +62,7 @@ J2DPictureEx::J2DPictureEx(J2DPane* param_0, JSURandomInputStream* param_1, u32
J2DPictureEx::~J2DPictureEx() {
if (field_0x190) {
delete mMaterial;
JKR_DELETE(mMaterial);
}
}
+2 -2
View File
@@ -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 -27
View File
@@ -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;
}
+12 -12
View File
@@ -74,7 +74,7 @@ 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) {
@@ -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) {
+2 -2
View File
@@ -65,7 +65,7 @@ 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) {
@@ -88,7 +88,7 @@ J2DTextBoxEx::J2DTextBoxEx(J2DPane* p_pane, JSURandomInputStream* p_stream, u32
J2DTextBoxEx::~J2DTextBoxEx() {
if (field_0x140 != 0) {
delete mMaterial;
JKR_DELETE(mMaterial);
}
}
+17 -17
View File
@@ -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) {
+2 -2
View File
@@ -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);
}
}
@@ -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;
@@ -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;
}
@@ -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++) {
@@ -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;
}
}
@@ -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;
}
@@ -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;
}
+20 -19
View File
@@ -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);
@@ -334,7 +335,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 +351,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;
}
+6 -6
View File
@@ -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;
+2 -1
View File
@@ -8,6 +8,7 @@
#include "JSystem/J3DGraphBase/J3DVertex.h"
#include "JSystem/J3DGraphBase/J3DFifo.h"
#include <gd.h>
#include "JSystem/JKernel/JKRHeap.h"
void J3DGDSetVtxAttrFmtv(GXVtxFmt, GXVtxAttrFmtList const*, bool);
void J3DFifoLoadPosMtxImm(Mtx, u32);
@@ -85,7 +86,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();
@@ -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;
+3 -2
View File
@@ -1,7 +1,8 @@
#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);
@@ -36,7 +37,7 @@ 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);
for (int i = 0; i < mNum; i++) {
+9 -9
View File
@@ -76,7 +76,7 @@ void J3DVertexBuffer::setArray() const {
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:
@@ -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;
}
@@ -64,7 +64,7 @@ J3DModelData* J3DModelLoaderDataBase::loadBinaryDisplayList(const void* i_data,
J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
s32 freeSize = JKRGetCurrentHeap()->getTotalFreeSize();
mpModelData = new J3DModelData();
mpModelData = JKR_NEW J3DModelData();
J3D_ASSERT_ALLOCMEM(177, mpModelData);
mpModelData->clear();
mpModelData->mpRawData = i_data;
@@ -123,7 +123,7 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
int flags = 0x51100000;
mpMaterialTable = new J3DMaterialTable();
mpMaterialTable = JKR_NEW J3DMaterialTable();
J3D_ASSERT_ALLOCMEM(279, mpMaterialTable);
mpMaterialTable->clear();
J3DModelFileData const* data = (J3DModelFileData*)i_data;
@@ -146,7 +146,7 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
block = (J3DModelBlock*)((uintptr_t)block + block->mBlockSize);
}
if (mpMaterialTable->mTexture == NULL) {
mpMaterialTable->mTexture = new J3DTexture(0, NULL);
mpMaterialTable->mTexture = JKR_NEW J3DTexture(0, NULL);
J3D_ASSERT_ALLOCMEM(319, mpMaterialTable->mTexture);
}
return mpMaterialTable;
@@ -157,7 +157,7 @@ inline u32 getBdlFlag_MaterialType(u32 flags) {
}
J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_flags) {
mpModelData = new J3DModelData();
mpModelData = JKR_NEW J3DModelData();
J3D_ASSERT_ALLOCMEM(338, mpModelData);
mpModelData->clear();
mpModelData->mpRawData = i_data;
@@ -262,13 +262,13 @@ void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_fla
J3DMtxCalc* mtx_calc = NULL;
switch (mpModelData->mFlags & 0xf) {
case 0:
mtx_calc = 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.");
@@ -398,7 +398,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 +408,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 +428,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 +474,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 +518,12 @@ void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) {
shape_table->mShapeNum = i_block->mShapeNum;
if (i_block->mpNameTable != NULL) {
shape_table->mShapeName =
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 +543,12 @@ void J3DModelLoader::readTexture(J3DTextureBlock const* i_block) {
ResTIMG* texture_res = JSUConvertOffsetToPtr<ResTIMG>(i_block, i_block->mpTextureRes);
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mTextureName =
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 +558,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 +581,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 +604,12 @@ void J3DModelLoader::readTextureTable(J3DTextureBlock const* i_block) {
ResTIMG* texture_res = JSUConvertOffsetToPtr<ResTIMG>(i_block, i_block->mpTextureRes);
if (i_block->mpNameTable != NULL) {
mpMaterialTable->mTextureName =
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 +620,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 +646,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;
@@ -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);
}
+2 -2
View File
@@ -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;
+7 -7
View File
@@ -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;
}
}
+3 -3
View File
@@ -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;
}
+3 -3
View File
@@ -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;
}
}
+2 -2
View File
@@ -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;
+3 -3
View File
@@ -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);
+2 -2
View File
@@ -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++) {
+1 -1
View File
@@ -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);
+13 -13
View File
@@ -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);
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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);
}
}
+3 -3
View File
@@ -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);
}
+9 -9
View File
@@ -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;
}
}
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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*));
}
}
+1 -1
View File
@@ -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();
+3 -3
View File
@@ -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;
+1 -1
View File
@@ -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;
}
+10 -10
View File
@@ -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;
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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
}
+17 -17
View File
@@ -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;
+3 -1
View File
@@ -5,6 +5,7 @@
#include <stdint.h>
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "JSystem/JFramework/JFWDisplay.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JUtility/JUTDbPrint.h"
@@ -13,6 +14,7 @@
#include <vi.h>
#include "global.h"
#include "aurora/aurora.h"
#include "global.h"
void JFWDisplay::ctor_subroutine(bool enableAlpha) {
mEnableAlpha = enableAlpha;
@@ -63,7 +65,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;
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -6,7 +6,7 @@ JHIMemBuf* JHICommonMem::instance;
JHIMemBuf* JHICommonMem::Instance() {
if (instance == NULL) {
instance = new JHIMemBuf();
instance = JKR_NEW JHIMemBuf();
}
return instance;
+2 -2
View File
@@ -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);
}
}
+2 -2
View File
@@ -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);
}
}
+4 -4
View File
@@ -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;
+2 -2
View File
@@ -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;
+4 -4
View File
@@ -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);
+1 -1
View File
@@ -117,7 +117,7 @@ JORServer* JORServer::instance;
JORServer* JORServer::create() {
if (instance == NULL) {
instance = new JORServer();
instance = JKR_NEW JORServer();
}
return instance;
+4 -4
View File
@@ -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:
+4 -4
View File
@@ -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;
}
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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) {
+5 -5
View File
@@ -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;
@@ -38,7 +38,7 @@ JKRAMCommand* JKRAramPiece::orderAsync(int direction, uintptr_t source, uintptr_
JUTException::panic(__FILE__, 108, "illegal address. abort.");
}
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 +80,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 +132,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);
+2 -2
View File
@@ -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;
+7 -7
View File
@@ -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);
}
+1 -1
View File
@@ -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;
}
+3 -3
View File
@@ -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;
}
+3 -3
View File
@@ -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;
}

Some files were not shown because too many files have changed in this diff Show More