Add even more heap debug names

This commit is contained in:
Max Roncace
2026-03-25 20:51:57 -04:00
parent c5d1ceffff
commit 3b6582f1a2
16 changed files with 63 additions and 17 deletions
+18
View File
@@ -73,6 +73,20 @@ private:
/* 0x8 */ f32 m_offsetXZ;
}; // Size: 0xC
#if TARGET_PC
#define PLAYER_CREATE_ANM_HEAP_F(heap, type, fmt, ...) \
{ \
char pcah_name_buf[32]; \
sprintf(pcah_name_buf, fmt, ##__VA_ARGS__); \
(heap).createHeap(type, pcah_name_buf); \
\
}
#define PLAYER_CREATE_ANM_HEAP(heap, type, name) (heap).createHeap(type, name)
#else
#define PLAYER_CREATE_ANM_HEAP_F(heap, type, name, ...) (heap).createHeap(type)
#define PLAYER_CREATE_ANM_HEAP(heap, type, name) (heap).createHeap(type)
#endif
class daPy_anmHeap_c {
public:
enum daAlinkHEAP_TYPE {
@@ -87,7 +101,11 @@ public:
~daPy_anmHeap_c();
void initData();
void* mallocBuffer();
#if TARGET_PC
void createHeap(daAlinkHEAP_TYPE i_heapType, const char* name);
#else
void createHeap(daAlinkHEAP_TYPE i_heapType);
#endif
void* loadData(u16 i_resId);
void* loadDataIdx(u16 i_resId);
void* loadDataPriIdx(u16 i_resId);
+7
View File
@@ -32,6 +32,10 @@ public:
J3DModel* getModel() { return mpModel; }
#if TARGET_PC
void setIdx(u8 idx) { this->idx = idx; }
#endif
private:
/* 0x00 */ JKRSolidHeap* mpHeap;
/* 0x04 */ J3DModel* mpModel;
@@ -40,6 +44,9 @@ private:
/* 0x10 */ u8 mDrawBG;
/* 0x11 */ s8 mRoomNo;
/* 0x12 */ u8 field_0x12;
#if TARGET_PC
u8 idx;
#endif
}; // Size: 0x14
class dSmplMdl_draw_c {
@@ -222,9 +222,13 @@ public:
#define JKRHEAP_NAME(heap, name) (heap)->setName(name)
#define JKRHEAP_NAMEF(heap, name, ...) (heap)->setNamef(name, __VA_ARGS__)
#define JKRHEAP_CURRENT_NAME(heap, name) JKRHEAP_NAME(mDoExt_getCurrentHeap(), name)
#define JKRHEAP_CURRENT_NAMEF(heap, name, ...) JKRHEAP_NAMEF(mDoExt_getCurrentHeap(), name, __VA_ARGS__)
#else
#define JKRHEAP_NAME(heap, name)
#define JKRHEAP_NAMEF(heap, name)
#define JKRHEAP_NAMEF(heap, name, ...)
#define JKRHEAP_CURRENT_NAME(heap, name)
#define JKRHEAP_CURRENT_NAMEF(heap, name, ...)
#endif
};
+9 -9
View File
@@ -4453,7 +4453,7 @@ void daAlink_c::playerInit() {
mAtSph.StartCAt(current.pos);
mAnmHeap3.setBufferSize(0x20000);
mAnmHeap3.createHeap(daPy_anmHeap_c::HEAP_TYPE_4);
PLAYER_CREATE_ANM_HEAP(mAnmHeap3, daPy_anmHeap_c::HEAP_TYPE_4, "daAlink_c::mAnmHeap3");
if (checkWolf()) {
changeWolf();
@@ -4462,7 +4462,7 @@ void daAlink_c::playerInit() {
}
mAnmHeap4.setBufferSize(0xB00);
mAnmHeap4.createHeap(daPy_anmHeap_c::HEAP_TYPE_4);
PLAYER_CREATE_ANM_HEAP(mAnmHeap4, daPy_anmHeap_c::HEAP_TYPE_4, "daAlink_c::mAnmHeap4");
setShieldModel();
#if DEBUG
@@ -4507,24 +4507,24 @@ void daAlink_c::playerInit() {
for (i = 0; i < 3; i++) {
mUnderAnmHeap[i].setBuffer(mUnderAnmHeap[0].getBuffer() + (i * 0x2C00));
mUnderAnmHeap[i].createHeap(daPy_anmHeap_c::HEAP_TYPE_3);
PLAYER_CREATE_ANM_HEAP_F(mUnderAnmHeap[i], daPy_anmHeap_c::HEAP_TYPE_3, "daAlink_c::mUnderAnmHeap[%d]", i);
}
mUpperAnmHeap[0].setBuffer(mUnderAnmHeap[0].getBuffer() + 0x8400);
for (i = 0; i < 3; i++) {
mUpperAnmHeap[i].setBuffer(mUpperAnmHeap[0].getBuffer() + (i * 0x2C00));
mUpperAnmHeap[i].createHeap(daPy_anmHeap_c::HEAP_TYPE_3);
PLAYER_CREATE_ANM_HEAP_F(mUpperAnmHeap[i], daPy_anmHeap_c::HEAP_TYPE_3, "daAlink_c::mUpperAnmHeap[%d]", i);
}
mFaceBtpHeap.createHeap(daPy_anmHeap_c::HEAP_TYPE_1);
mFaceBtkHeap.createHeap(daPy_anmHeap_c::HEAP_TYPE_2);
mFaceBckHeap.createHeap(daPy_anmHeap_c::HEAP_TYPE_3);
PLAYER_CREATE_ANM_HEAP(mFaceBtpHeap, daPy_anmHeap_c::HEAP_TYPE_1, "daAlink_c::mFaceBtpHeap");
PLAYER_CREATE_ANM_HEAP(mFaceBtkHeap, daPy_anmHeap_c::HEAP_TYPE_2, "daAlink_c::mFaceBtkHeap");
PLAYER_CREATE_ANM_HEAP(mFaceBckHeap, daPy_anmHeap_c::HEAP_TYPE_3, "daAlink_c::mFaceBckHeap");
for (i = 0; i < 2; i++) {
mItemHeap[i].setBufferSize(0x13200);
mItemHeap[i].createHeap(daPy_anmHeap_c::HEAP_TYPE_4);
PLAYER_CREATE_ANM_HEAP_F(mItemHeap[i], daPy_anmHeap_c::HEAP_TYPE_4, "daAlink_c::mItemHeap[%d]", i);
}
mAnmHeap9.createHeap(daPy_anmHeap_c::HEAP_TYPE_3);
PLAYER_CREATE_ANM_HEAP(mAnmHeap9, daPy_anmHeap_c::HEAP_TYPE_3, "daAlink_c::mAnmHeap9");
resetBasAnime();
mZ2Link.init(&current.pos, &eyePos, &field_0x3720);
+1
View File
@@ -532,6 +532,7 @@ int daBg_c::create() {
if (room_heap != NULL) {
this->heap = JKRCreateSolidHeap(-1, room_heap, false);
JUT_ASSERT(471, heap != NULL);
JKRHEAP_NAME(heap, "d_a_bg Anms");
JKRHeap* old = mDoExt_setCurrentHeap(this->heap);
int rt = createHeap();
+4 -4
View File
@@ -565,12 +565,12 @@ cPhs_Step daMidna_c::create() {
mpFunc = &daMidna_c::checkMetamorphoseEnableBase;
for (u16 i = 0; i < 3; i++) {
mBckHeap[i].createHeap(daPy_anmHeap_c::HEAP_TYPE_3);
PLAYER_CREATE_ANM_HEAP_F(mBckHeap[i], daPy_anmHeap_c::HEAP_TYPE_3, "daMidna_c::mBckHeap[%d]", i);
}
mBtpHeap.createHeap(daPy_anmHeap_c::HEAP_TYPE_1);
mBtkHeap.createHeap(daPy_anmHeap_c::HEAP_TYPE_2);
PLAYER_CREATE_ANM_HEAP_F(mBtpHeap, daPy_anmHeap_c::HEAP_TYPE_1, "daMidna_c::mBtpHeap");
PLAYER_CREATE_ANM_HEAP_F(mBtkHeap, daPy_anmHeap_c::HEAP_TYPE_2, "daMidna_c::mBtkHeap");
mSound.init(&current.pos, &eyePos, 3, 1);
mpShadowModel = mpMorf->getModel();
mpShadowModel->setUserArea((uintptr_t)this);
+7 -3
View File
@@ -237,7 +237,11 @@ void* daPy_anmHeap_c::mallocBuffer() {
return mBuffer;
}
void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType) {
#if TARGET_PC
void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType, const char* name) {
#else
void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType, const char* name) {
#endif
u32 size;
if (i_heapType == 4) {
@@ -260,8 +264,8 @@ void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType) {
JKRHeap* tmp;
mAnimeHeap = mDoExt_createSolidHeapFromGameToCurrent(&tmp, size, 0x20);
JKRHEAP_NAMEF(mAnimeHeap, "Alink anime type %d", i_heapType);
JKRHEAP_NAME(mAnimeHeap, name);
if (i_heapType == 4) {
tmpWork = JKR_NEW_ARRAY(char, size);
JUT_ASSERT(669, tmpWork != NULL);
+1
View File
@@ -5195,6 +5195,7 @@ void dFile_select3D_c::_create(u8 i_mirrorIdx, u8 i_maskIdx) {
if (mpSolidHeap == NULL) {
JUT_ASSERT(5189, mpSolidHeap != NULL);
}
JKRHEAP_NAME(mpSolidHeap, "dFile_select3D_c::mpSolidHeap");
field_0x03c4 = 0.0f;
field_0x03c8 = 0.0f;
+1
View File
@@ -35,6 +35,7 @@ int dkWmark_c::create() {
mpHeap = mDoExt_createSolidHeapFromGameToCurrent(0x880, 0x20);
if (mpHeap != NULL) {
JKRHEAP_NAME(mpHeap, "dkWmark_c::mpHeap");
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Alink", 0x23);
JUT_ASSERT(60, modelData != NULL);
+2
View File
@@ -26,6 +26,8 @@ int dThunder_c::createHeap() {
if (mpHeap == NULL) {
return 0;
}
JKRHEAP_NAME(mpHeap, "dThunder_c::mpHeap");
}
return 1;
+1
View File
@@ -2222,6 +2222,7 @@ dMenu_Collect3D_c::~dMenu_Collect3D_c() {
void dMenu_Collect3D_c::_create() {
mpHeap->getTotalFreeSize();
mpSolidHeap = mDoExt_createSolidHeapToCurrent(0x25800, mpHeap, 0x20);
JKRHEAP_NAME(mpSolidHeap, "dMenu_Collect3D_c::mpSolidHeap");
mDoExt_setCurrentHeap((JKRHeap*)mpSolidHeap);
daAlink_c* linkActor = daAlink_getAlinkActorClass();
if (linkActor != NULL) {
+1
View File
@@ -1649,6 +1649,7 @@ void dMenu_Dmap_c::_create() {
mDmapHeap = JKRCreateExpHeap(field_0xe8->getFreeSize() - 0x10, field_0xe8, false);
JUT_ASSERT(3732, mDmapHeap != NULL);
JKRHEAP_NAME(mDmapHeap, "dMenu_Dmap_c::mDmapHeap");
JKRHeap* heap = mDoExt_setCurrentHeap(mDmapHeap);
u32 sp28 = mDmapHeap->getTotalFreeSize();
+2
View File
@@ -18,6 +18,7 @@ static void dSmplMdl_modelUpdateDL(J3DModel* i_model) {
dSmplMdl_draw_c::dSmplMdl_draw_c() {
for (int i = 0; i < 8; i++) {
mModel[i].init();
mModel[i].setIdx(i);
}
for (int i = 0; i < 500; i++) {
@@ -128,6 +129,7 @@ BOOL diff_model_c::create(J3DModelData* i_modelData, int roomNo, u8 drawBG) {
JUT_ASSERT(397, i_modelData != NULL);
if (mpHeap == NULL) {
mpHeap = mDoExt_createSolidHeapFromGameToCurrent(0x2000, 0x20);
JKRHEAP_NAMEF(mpHeap, "Simple model (%d)", idx);
if (mpHeap != NULL) {
mpModel = mDoExt_J3DModel__create(i_modelData, 0x80000, 0x11000084);
+1
View File
@@ -384,6 +384,7 @@ static void dummy1(dStage_roomControl_c* roomControl) {
JKRExpHeap* dStage_roomControl_c::createMemoryBlock(int i_blockIdx, u32 i_heapSize) {
if (mMemoryBlock[i_blockIdx] == NULL) {
mMemoryBlock[i_blockIdx] = JKRCreateExpHeap(i_heapSize, mDoExt_getArchiveHeap(), false);
JKRHEAP_NAMEF(mMemoryBlock[i_blockIdx], "Room control memory block %d", i_blockIdx);
}
return mMemoryBlock[i_blockIdx];
+1
View File
@@ -40,6 +40,7 @@ int dTimer_c::_create() {
dComIfGp_setAllMapArchive(resInfo->getArchive());
mp_heap = fopMsgM_createExpHeap(0x11000, NULL);
JKRHEAP_NAME(mp_heap, "dTimer_c::mp_heap");
JKRHeap* prev_heap = mDoExt_setCurrentHeap(mp_heap);
if (mp_heap != NULL) {
mp_heap->getTotalFreeSize();
+2
View File
@@ -524,6 +524,7 @@ bool fopAcM_entrySolidHeap_(fopAc_ac_c* i_actor, heapCallbackFunc i_heapCallback
OSReport_Error("最大空きヒープサイズで確保失敗。[%s]\n", procNameString);
return false;
}
JKRHEAP_NAMEF(heap, "Actor mng (%s)", procNameString);
#if DEBUG
if (!fopAcM::HeapAdjustQuiet) {
// Attempting registration with max heap size. %08x
@@ -625,6 +626,7 @@ bool fopAcM_entrySolidHeap_(fopAc_ac_c* i_actor, heapCallbackFunc i_heapCallback
if (alignedSize + adjOffset + 0x10 < freeSize) {
newHeap = mDoExt_createSolidHeapFromGame(alignedSize, 0x20);
JKRHEAP_NAMEF(newHeap, "Actor mng (%s)", procNameString);
}
if (fopAcM::HeapAdjustVerbose) {