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
+9 -9
View File
@@ -46,7 +46,7 @@ int dMeterString_c::_create() {
mpMapArchive = dComIfGp_getAllMapArchive();
}
mpScreen = new J2DScreen();
mpScreen = JKR_NEW J2DScreen();
JUT_ASSERT(0, mpScreen != NULL);
bool fg = mpScreen->setPriority("zelda_game_image_cow_get_in.blo", 0x20000, mpMapArchive);
@@ -57,13 +57,13 @@ int dMeterString_c::_create() {
mpGetInBck = (J2DAnmTransformKey*)J2DAnmLoaderDataBase::load(
JKRGetNameResource("zelda_game_image_cow_get_in.bck", mpMapArchive));
mpParentPane = new CPaneMgr(mpScreen, MULTI_CHAR('get_in_n'), 2, NULL);
mpParentPane = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('get_in_n'), 2, NULL);
JUT_ASSERT(0, mpParentPane != NULL);
mpRootPane = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 0, NULL);
mpRootPane = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 0, NULL);
JUT_ASSERT(0, mpRootPane != NULL);
mpTextPane = new CPaneMgr(mpScreen, MULTI_CHAR('get_in'), 0, NULL);
mpTextPane = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('get_in'), 0, NULL);
JUT_ASSERT(0, mpTextPane != NULL);
static_cast<J2DTextBox*>(mpScreen->search(MULTI_CHAR('get_in_s')))->setFont(mDoExt_getMesgFont());
@@ -140,19 +140,19 @@ void dMeterString_c::draw() {
}
int dMeterString_c::_delete() {
delete mpScreen;
JKR_DELETE(mpScreen);
mpScreen = NULL;
delete mpGetInBck;
JKR_DELETE(mpGetInBck);
mpGetInBck = NULL;
delete mpParentPane;
JKR_DELETE(mpParentPane);
mpParentPane = NULL;
delete mpRootPane;
JKR_DELETE(mpRootPane);
mpRootPane = NULL;
delete mpTextPane;
JKR_DELETE(mpTextPane);
mpTextPane = NULL;
if (field_0x28 != 0) {