Isolate JKRHeap operator overloads

Fixes #25

This isolates the JKRHeap operator new/delete overloads. Every single new/delete site in the code has been replaced with a macro.

Sadly for new[] and delete[] we have to keep global operators. The global new[] just allocates into malloc() however, and delete[] goes into free() if it's not in a JKRHeap. So that's fine.
This commit is contained in:
PJB3005
2026-02-27 23:11:59 +01:00
parent 2204ad0813
commit 038ef4216f
634 changed files with 3451 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
@@ -814,7 +814,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); }
+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);
}
}