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
@@ -291,11 +291,11 @@ void dMenu_DmapMap_c::_create(u16 param_0, u16 param_1, u16 param_2, u16 param_3
void dMenu_DmapMap_c::_delete() {
for (int i = 0; i < 2; i++) {
if (mMapImage_p[i] != NULL) {
delete[] mMapImage_p[i];
JKR_DELETE_ARRAY(mMapImage_p[i]);
}
if (mResTIMG[i] != NULL) {
delete[] mResTIMG[i];
JKR_DELETE_ARRAY(mResTIMG[i]);
}
}
}
@@ -303,11 +303,11 @@ void dMenu_DmapMap_c::_delete() {
void dMenu_DmapMap_c::setTexture(u16 param_0, u16 param_1, u16 param_2, u16 param_3) {
for (int lp1 = 0; lp1 < 2; lp1++) {
u32 var_r27 = GXGetTexBufferSize(param_0, param_1, 9, 0, 0);
mMapImage_p[lp1] = new (0x20) u8[var_r27];
mMapImage_p[lp1] = JKR_NEW_ARGS (0x20) u8[var_r27];
JUT_ASSERT(1672, mMapImage_p[lp1] != NULL);
mRend[lp1].init(mMapImage_p[lp1], param_0, param_1, param_2, param_3);
mResTIMG[lp1] = new (0x20) ResTIMG;
mResTIMG[lp1] = JKR_NEW_ARGS (0x20) ResTIMG;
JUT_ASSERT(1687, mResTIMG[lp1] != NULL);
mRend[lp1].makeResTIMG(mResTIMG[lp1], param_0, param_1, mMapImage_p[lp1], (u8*)dMdm_HIO_prm_res_dst_s::m_res, 30);
}