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
+5 -5
View File
@@ -327,13 +327,13 @@ static dCcD_SrcCyl cc_cyl_src = {
static int useHeapInit(fopAc_ac_c* i_this) {
obj_tp_class* tp = static_cast<obj_tp_class*>(i_this);
tp->mMorf =
new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Obj_tp", bmd[tp->field_0x594]),
JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Obj_tp", bmd[tp->field_0x594]),
NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Obj_tp", 7), 0, 1.0f,
0, -1, 1, NULL, 0x80000, 0x11000084);
if (tp->mMorf == NULL || tp->mMorf->getModel() == NULL) {
return 0;
}
tp->mBrk = new mDoExt_brkAnm();
tp->mBrk = JKR_NEW mDoExt_brkAnm();
if (tp->mBrk == NULL) {
return 0;
}
@@ -354,7 +354,7 @@ static int useHeapInit(fopAc_ac_c* i_this) {
if (tp->mModels[i] == NULL) {
return 0;
}
tp->mBtks[i] = new mDoExt_btkAnm();
tp->mBtks[i] = JKR_NEW mDoExt_btkAnm();
if (tp->mBtks[i] == NULL) {
return 0;
};
@@ -367,7 +367,7 @@ static int useHeapInit(fopAc_ac_c* i_this) {
{
return 0;
}
tp->mBrks[i] = new mDoExt_brkAnm();
tp->mBrks[i] = JKR_NEW mDoExt_brkAnm();
if (tp->mBrks[i] == NULL) {
return 0;
}
@@ -380,7 +380,7 @@ static int useHeapInit(fopAc_ac_c* i_this) {
return 0;
}
}
tp->mBgw = new dBgW();
tp->mBgw = JKR_NEW dBgW();
if (tp->mBgw == NULL) {
return 0;
}