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
+6 -6
View File
@@ -1131,7 +1131,7 @@ dMap_c::dMap_c(int param_0, int param_1, int param_2, int param_3) {
m_mySelfPointer = this;
#endif
m_res = new (0x20) dMap_prm_res_s;
m_res = JKR_NEW_ARGS (0x20) dMap_prm_res_s;
JUT_ASSERT(2559, m_res != NULL);
dMap_HIO_prm_res_dst_s::m_res = m_res;
@@ -1176,12 +1176,12 @@ dMap_c::dMap_c(int param_0, int param_1, int param_2, int param_3) {
}
int buffer_size = GXGetTexBufferSize(param_2, param_3, 9, GX_FALSE, 0);
mImage_p = new (0x20) u8[buffer_size];
mImage_p = JKR_NEW_ARGS (0x20) u8[buffer_size];
JUT_ASSERT(2638, mImage_p != NULL);
renderingDAmap_c::init(mImage_p, mTexSizeX, mTexSizeY, mTexSizeX, mTexSizeY);
mResTIMG = new (0x20) ResTIMG;
mResTIMG = JKR_NEW_ARGS (0x20) ResTIMG;
JUT_ASSERT(2647, mResTIMG != NULL);
makeResTIMG(mResTIMG, mTexSizeX, mTexSizeY, mImage_p, (u8*)m_res, 0x33);
@@ -1207,17 +1207,17 @@ void dMap_c::changeTextureSize(int param_1, int param_2, int param_3) {
void dMap_c::_remove() {
if (mImage_p != NULL) {
delete[] mImage_p;
JKR_DELETE_ARRAY(mImage_p);
mImage_p = NULL;
}
if (mResTIMG != NULL) {
delete mResTIMG;
JKR_DELETE(mResTIMG);
mResTIMG = NULL;
}
if (m_res != NULL) {
delete m_res;
JKR_DELETE(m_res);
m_res = NULL;
}
}