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
+4 -4
View File
@@ -374,7 +374,7 @@ int daMidna_c::createHeap() {
}
for (int i = 0; i < 2; i++) {
mpEyeMatAnm[i] = new daMidna_matAnm_c();
mpEyeMatAnm[i] = JKR_NEW daMidna_matAnm_c();
if (mpEyeMatAnm[i] == NULL) {
return 0;
}
@@ -463,7 +463,7 @@ int daMidna_c::createHeap() {
J3DAnmTransform* md_anm = (J3DAnmTransform*)J3DAnmLoaderDataBase::load(mBckHeap[0].getBuffer());
modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 14);
JUT_ASSERT(852, modelData != NULL);
mpMorf = new mDoExt_McaMorfSO(modelData, &mMorfCB, NULL, md_anm, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, NULL, 0, 0x11000284);
mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, &mMorfCB, NULL, md_anm, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, NULL, 0, 0x11000284);
if (mpMorf == NULL || mpMorf->getModel() == NULL) {
return 0;
}
@@ -508,13 +508,13 @@ int daMidna_c::createHeap() {
return 0;
}
mpHIO = new NPC_MIDNA_HIO_CLASS();
mpHIO = JKR_NEW NPC_MIDNA_HIO_CLASS();
if (mpHIO == NULL) {
return 0;
}
if (mpDemoFCBlendBmd != NULL) {
mpDemoFCTmpBlk = new mDoExt_blkAnm();
mpDemoFCTmpBlk = JKR_NEW mDoExt_blkAnm();
if (mpDemoFCTmpBlk == NULL) {
return 0;
}