Fix a bunch of m symbols

This commit is contained in:
robojumper
2025-07-24 13:55:13 +02:00
parent e8350dc568
commit 39be7ff72c
18 changed files with 98 additions and 69 deletions
+2 -1
View File
@@ -16,6 +16,7 @@
#include "f/f_base.h"
#include "f/f_list_nd.h"
#include "m/m_angle.h"
#include "m/m_heap.h"
#include "m/m_vec.h"
#include "toBeSorted/actor_info.h"
#include "toBeSorted/event.h"
@@ -129,7 +130,7 @@ int dAcBase_c::initAllocatorWork1Heap(int size, char *name, int align) {
}
int dAcBase_c::initAllocator(int size, char *name, EGG::Heap *heap, int align) {
if (!heap_allocator.createNewTempFrmHeap(size, heap, name, 0x20, 0)) {
if (!heap_allocator.createFrmHeapToCurrent(size, heap, name, 0x20, mHeap::OPT_NONE)) {
return 0;
}
sound_source = createSoundSource();
+1 -1
View File
@@ -46,7 +46,7 @@ char relsDir[] = "/rels";
int initDylinkHeap(int maxRelId, const RelNamePtr *dynNameTable, int dynNameTableNum, EGG::Heap *parentHeap) {
cCc_frmHeap = mHeap::createFrmHeap(
maxRelId * 0x10 + dynNameTableNum * 0x48, parentHeap, "ダイナミックリンク制御用ヒープ(dDyl::cCc_frmHeap)", 0x20,
0
mHeap::OPT_NONE
);
mHeap _guard(cCc_frmHeap);
+2 -2
View File
@@ -15,6 +15,7 @@
#include "m/m3d/m_fanm.h"
#include "m/m3d/m_mdl.h"
#include "m/m_allocator.h"
#include "m/m_heap.h"
#include "m/m_mtx.h"
#include "m/m_vec.h"
#include "nw4r/g3d/g3d_anmchr.h"
@@ -702,8 +703,7 @@ void daPlayerModelBase_c::freeFrmHeap(mHeapAllocator_c *allocator) {
}
void daPlayerModelBase_c::allocFrmHeap(mHeapAllocator_c *allocator, u32 size, const char *name) {
// TODO fix char constness
allocator->createNewTempFrmHeap(size, dHeap::work1Heap.heap, (char *)name, 0x20, 0);
allocator->createFrmHeapToCurrent(size, dHeap::work1Heap.heap, name, 0x20, mHeap::OPT_NONE);
new u8[size]();
allocator->adjustFrmHeapRestoreCurrent();
}
+2 -1
View File
@@ -1,4 +1,5 @@
#include "d/d_rawarchive.h"
#include "m/m_heap.h"
#include "rvl/VI.h" // IWYU pragma: export
@@ -186,7 +187,7 @@ int dRawArcEntry_c::ensureLoadedMaybe(void *callbackArg) {
if (mpArc == nullptr) {
return -1;
}
mpFrmHeap = mHeap::makeHeapOnCurrentGameHeap(-1, name(), 0x20, 0);
mpFrmHeap = mHeap::makeHeapOnCurrentGameHeap(-1, name(), 0x20, mHeap::OPT_NONE);
if (mpFrmHeap == nullptr) {
return -1;
}
+3 -2
View File
@@ -22,6 +22,7 @@
#include "m/m3d/m_anmvis.h"
#include "m/m3d/m_fanm.h"
#include "m/m3d/m_smdl.h"
#include "m/m_heap.h"
#include "m/m_mtx.h"
#include "m/m_vec.h"
#include "nw4r/g3d/g3d_scnmdl.h"
@@ -56,8 +57,8 @@ int dRoom_c::create() {
!(dScGame_c::isCurrentStage("D300") && (roomid == 0 || roomid == 1 || roomid == 4)) &&
// LMF crawlspace, spike maze
!(dScGame_c::isCurrentStage("D300_1") && (roomid == 7 || roomid == 9));
if (!mAllocator.createNewTempFrmHeap(
-1, CurrentStageArcManager::GetInstance()->getHeap(roomid), "dRoom_c::m_allocator", 0x20, 0
if (!mAllocator.createFrmHeapToCurrent(
-1, CurrentStageArcManager::GetInstance()->getHeap(roomid), "dRoom_c::m_allocator", 0x20, mHeap::OPT_NONE
)) {
return FAILED;
}
+18 -12
View File
@@ -23,8 +23,11 @@ void (*fBase_c::sUnloadCallback)();
/* 802e12f0 */
fBase_c::fBase_c()
: unique_ID(m_rootUniqueID), params(m_tmpCtData.params), profile_name(m_tmpCtData.prof_name),
group_type(m_tmpCtData.group_type), manager(this) {
: unique_ID(m_rootUniqueID),
params(m_tmpCtData.params),
profile_name(m_tmpCtData.prof_name),
group_type(m_tmpCtData.group_type),
manager(this) {
m_rootUniqueID = (fBaseID_e)(m_rootUniqueID + 1);
if (m_rootUniqueID == INVALID) {
for (;;) {
@@ -59,10 +62,10 @@ fBase_c::~fBase_c() {
// that causes a weak destructor to spawn that actually needs to be in f_manager.
// And it's not like any of fLiMgBa_c's methods are accessed via actor_list,
// so who can tell? Maybe there's yet another type?
fLiNdBa_c *node = static_cast<fLiNdBa_c*>(actor_list.getFirst());
fLiNdBa_c *node = static_cast<fLiNdBa_c *>(actor_list.getFirst());
while (node != nullptr) {
node->unlink();
node = static_cast<fLiNdBa_c*>(actor_list.getFirst());
node = static_cast<fLiNdBa_c *>(actor_list.getFirst());
}
}
@@ -443,8 +446,9 @@ bool fBase_c::entryFrmHeap(size_t size, EGG::Heap *parentHeap) {
EGG::FrmHeap *new_heap = nullptr;
if (size != 0) {
new_heap =
mHeap::makeFrmHeapAndUpdate(size, parentHeap, "各プロセスが個別で持てるヒープ(fBase_c::mHeap)", 0x20, 0);
new_heap = mHeap::createFrmHeapToCurrent(
size, parentHeap, "各プロセスが個別で持てるヒープ(fBase_c::mHeap)", 0x20, mHeap::OPT_NONE
);
if (new_heap != nullptr) {
bool create_sucess = createHeap();
mHeap::restoreCurrentHeap();
@@ -461,8 +465,9 @@ bool fBase_c::entryFrmHeap(size_t size, EGG::Heap *parentHeap) {
}
}
if (new_heap == nullptr) {
new_heap =
mHeap::makeFrmHeapAndUpdate(-1, parentHeap, "各プロセスが個別で持てるヒープ(fBase_c::mHeap)", 0x20, 0);
new_heap = mHeap::createFrmHeapToCurrent(
-1, parentHeap, "各プロセスが個別で持てるヒープ(fBase_c::mHeap)", 0x20, mHeap::OPT_NONE
);
if (new_heap != nullptr) {
bool create_sucess = createHeap();
@@ -477,8 +482,8 @@ bool fBase_c::entryFrmHeap(size_t size, EGG::Heap *parentHeap) {
}
if (new_heap != nullptr) {
EGG::FrmHeap *larger_heap = mHeap::makeFrmHeapAndUpdate(
heap_size, parentHeap, "各プロセスが個別で持てるヒープ(fBase_c::mHeap)", 0x20, 0
EGG::FrmHeap *larger_heap = mHeap::createFrmHeapToCurrent(
heap_size, parentHeap, "各プロセスが個別で持てるヒープ(fBase_c::mHeap)", 0x20, mHeap::OPT_NONE
);
if (larger_heap != nullptr) {
if (larger_heap < new_heap) {
@@ -516,8 +521,9 @@ bool fBase_c::entryFrmHeapNonAdjust(size_t size, EGG::Heap *parentHeap) {
return true;
}
EGG::FrmHeap *new_heap =
mHeap::makeFrmHeapAndUpdate(size, parentHeap, "各プロセスが個別で持てるヒープ(fBase_c::mHeap)", 0x20, 0);
EGG::FrmHeap *new_heap = mHeap::createFrmHeapToCurrent(
size, parentHeap, "各プロセスが個別で持てるヒープ(fBase_c::mHeap)", 0x20, mHeap::OPT_NONE
);
if (new_heap != nullptr) {
bool create_sucess = createHeap();
mHeap::restoreCurrentHeap();
+2 -1
View File
@@ -29,7 +29,8 @@ bool banm_c::createAllocator(mAllocator_c *alloc, u32 *pStart) {
i1 = mHeap::frmHeapCost(i2, 0x20);
*pStart = ROUND_UP(i1, 0x20);
mpFrameHeap = mHeap::createFrmHeap(
i2, (EGG::Heap *)alloc->mHeap, "アニメ切り替え用アロケータ(m3d::banm_c::m_heap)", internal::l_alignment, 0
i2, (EGG::Heap *)alloc->mHeap, "アニメ切り替え用アロケータ(m3d::banm_c::m_heap)", internal::l_alignment,
mHeap::OPT_NONE
);
mAllocator.attach(mpFrameHeap, 0x20);
return true;
+2 -2
View File
@@ -56,7 +56,7 @@ void mShadow_c::create(
// Maybe an Inline?
EGG::FrmHeap **heap = mpFrmHeaps;
for (int i = 0; i < 2; i++) {
heap[0] = mHeap::createFrmHeap(heapSize, mpHeap, "ShadowTmp", 0x4, 0);
heap[0] = mHeap::createFrmHeap(heapSize, mpHeap, "ShadowTmp", 0x4, mHeap::OPT_NONE);
heap[0]->recordState(FRM_HEAP_STATE);
heap++;
}
@@ -519,7 +519,7 @@ void mShadowChild_c::updateMtx() {
mVec3_c a(mQuat.v.x, mQuat.v.y, mQuat.v.z);
a += mPositionMaybe * GetOffset();
mVec3_c b(mQuat.v.x, mQuat.v.y, mQuat.v.z);
b -= mPositionMaybe * field_0x13C;
+4 -4
View File
@@ -35,7 +35,7 @@ mHeapAllocator_c::~mHeapAllocator_c() {
destroyHeap();
}
bool mHeapAllocator_c::replaceWithNewFrmHeap(s32 size, EGG::Heap *newHeap, char *heapName, s32 align, u32 attrs) {
bool mHeapAllocator_c::createFrmHeap(u32 size, EGG::Heap *newHeap, const char *heapName, u32 align, mHeap::AllocOptBit_t attrs) {
destroyHeap();
EGG::Heap *heap = mHeap::createFrmHeap(size, newHeap, heapName, align, attrs);
if (heap == nullptr) {
@@ -45,7 +45,7 @@ bool mHeapAllocator_c::replaceWithNewFrmHeap(s32 size, EGG::Heap *newHeap, char
return true;
}
bool mHeapAllocator_c::replaceWithNewExpHeap(s32 size, EGG::Heap *newHeap, char *heapName, s32 align, u32 attrs) {
bool mHeapAllocator_c::createExpHeap(u32 size, EGG::Heap *newHeap, const char *heapName, u32 align, mHeap::AllocOptBit_t attrs) {
destroyHeap();
EGG::Heap *heap = mHeap::createExpHeap(size, newHeap, heapName, align, attrs);
if (heap == nullptr) {
@@ -79,8 +79,8 @@ s32 mHeapAllocator_c::adjustExpHeap() {
return mHeap::adjustExpHeap(EGG::Heap::toExpHeap(heap));
}
bool mHeapAllocator_c::createNewTempFrmHeap(s32 size, EGG::Heap *newHeap, char *heapName, s32 align, u32 attrs) {
if (!replaceWithNewFrmHeap(size, newHeap, heapName, align, attrs)) {
bool mHeapAllocator_c::createFrmHeapToCurrent(u32 size, EGG::Heap *newHeap, const char *heapName, u32 align, mHeap::AllocOptBit_t attrs) {
if (!createFrmHeap(size, newHeap, heapName, align, attrs)) {
return false;
}
mHeap::saveCurrentHeap();
+15 -8
View File
@@ -165,8 +165,10 @@ static void *loadToMainRAM(
return result;
}
static int ConvertPathToEntrynum(const char *path, u8 *);
int ConvertPathToEntrynum(const char *path) {
return ::ConvertPathToEntrynum(path, nullptr);
return mDvd::ConvertPathToEntrynum(path, nullptr);
}
u32 IsExistPath(const char *path) {
@@ -374,8 +376,10 @@ mDvd_mountMemArchive_c::mDvd_mountMemArchive_c(int mountDirection) {
mAmountRead = 0;
}
namespace mDvd {
/** 802ef7c0 */
int findPathWithCompressedExtension(const char *name, u8 *outType) {
static int ConvertPathToEntrynumASD_(const char *name, u8 *outType) {
u8 type;
char buf[256];
int num;
@@ -434,10 +438,11 @@ void setAutoStreamDecomp(bool arg) {
}
/** 802ef940 */
bool getAutoStreamDecomp() {
bool isAutoStreamDecomp() {
return mDvd::l_IsAutoStreamDecomp;
}
/** 802ef950 */
static int ConvertPathToEntrynum(const char *path, u8 *outType) {
int num = DVDConvertPathToEntrynum(path);
@@ -445,22 +450,24 @@ static int ConvertPathToEntrynum(const char *path, u8 *outType) {
if (outType != nullptr) {
*outType = 0;
}
} else if (getAutoStreamDecomp()) {
num = findPathWithCompressedExtension(path, outType);
} else if (mDvd::isAutoStreamDecomp()) {
num = mDvd::ConvertPathToEntrynumASD_(path, outType);
}
return num;
}
/** 802ef9d0 */
static int ConvertPathToEntrynum_Thunk(const char *path, u8 *outType) {
static int ConvertPathToEntrynumWithWarning(const char *path, u8 *outType) {
return ConvertPathToEntrynum(path, outType);
}
}
/** 802ef9e0 */
mDvd_mountMemArchive_c *mDvd_mountMemArchive_c::create(const char *path, u8 mountDirection, EGG::Heap *heap) {
u8 type;
mDvd_mountMemArchive_c *cmd = nullptr;
int entryNum = ConvertPathToEntrynum_Thunk(path, &type);
int entryNum = mDvd::ConvertPathToEntrynumWithWarning(path, &type);
if (entryNum != -1) {
cmd = new mDvd_mountMemArchive_c(mountDirection);
if (cmd != nullptr) {
@@ -596,7 +603,7 @@ mDvd_toMainRam_normal_c::mDvd_toMainRam_normal_c(int mountDirection) : mDvd_toMa
/** 802eff90 */
mDvd_toMainRam_normal_c *mDvd_toMainRam_normal_c::create(const char *path, int mountDirection, EGG::Heap *heap) {
u8 type;
int entryNum = ConvertPathToEntrynum_Thunk(path, &type);
int entryNum = mDvd::ConvertPathToEntrynumWithWarning(path, &type);
mDvd_toMainRam_normal_c *cmd;
if (entryNum == -1) {
cmd = nullptr;
+9 -9
View File
@@ -22,7 +22,7 @@ const char *const mHeap::s_GameHeapNames[4] = {
0,
};
u16 mHeap::copyAttribute(u32 arg) {
u16 mHeap::GetOptFlag(AllocOptBit_t arg) {
u16 result = 0;
if ((arg & 1) != 0) {
@@ -40,7 +40,7 @@ u16 mHeap::copyAttribute(u32 arg) {
EGG::Heap *mHeap::setCurrentHeap(EGG::Heap *heap) {
return heap->becomeCurrentHeap();
}
EGG::Heap *mHeap::createExpHeap(size_t size, EGG::Heap *parentHeap, const char *name, u32 align, u32 attrs) {
EGG::Heap *mHeap::createExpHeap(size_t size, EGG::Heap *parentHeap, const char *name, u32 align, AllocOptBit_t attrs) {
if (parentHeap == nullptr) {
parentHeap = EGG::Heap::sCurrentHeap;
}
@@ -58,7 +58,7 @@ EGG::Heap *mHeap::createExpHeap(size_t size, EGG::Heap *parentHeap, const char *
void *mem = parentHeap->alloc(size, align);
EGG::ExpHeap *heap = nullptr;
if (mem != nullptr) {
heap = EGG::ExpHeap::create(mem, size, copyAttribute(attrs));
heap = EGG::ExpHeap::create(mem, size, GetOptFlag(attrs));
if (heap == nullptr) {
parentHeap->free(mem);
} else if (name != nullptr) {
@@ -86,7 +86,7 @@ size_t mHeap::expHeapCost(size_t size, u32 align) {
return size + (~(a)&b);
}
EGG::FrmHeap *mHeap::createFrmHeap(size_t size, EGG::Heap *parent, const char *name, size_t align, size_t attrs) {
EGG::FrmHeap *mHeap::createFrmHeap(size_t size, EGG::Heap *parent, const char *name, size_t align, AllocOptBit_t attrs) {
if (parent == nullptr) {
parent = EGG::Heap::sCurrentHeap;
}
@@ -104,7 +104,7 @@ EGG::FrmHeap *mHeap::createFrmHeap(size_t size, EGG::Heap *parent, const char *n
void *mem = parent->alloc(size, align);
EGG::FrmHeap *heap = nullptr;
if (mem != nullptr) {
heap = EGG::FrmHeap::create(mem, size, copyAttribute(attrs));
heap = EGG::FrmHeap::create(mem, size, GetOptFlag(attrs));
if (heap == nullptr) {
parent->free(mem);
} else if (name != nullptr) {
@@ -167,8 +167,8 @@ void mHeap::restoreCurrentHeap() {
s_SavedCurrentHeap = nullptr;
}
EGG::FrmHeap *mHeap::makeFrmHeapAndUpdate(size_t size, EGG::Heap *parentHeap, const char *name, u32 align, u32 unk) {
EGG::FrmHeap *heap = createFrmHeap(size, parentHeap, name, align, unk);
EGG::FrmHeap *mHeap::createFrmHeapToCurrent(size_t size, EGG::Heap *parentHeap, const char *name, u32 align, AllocOptBit_t opt) {
EGG::FrmHeap *heap = createFrmHeap(size, parentHeap, name, align, opt);
if (heap != nullptr) {
s_SavedCurrentHeap = setCurrentHeap(heap);
}
@@ -209,6 +209,6 @@ EGG::AssertHeap *mHeap::createAssertHeap(EGG::Heap *parent) {
return g_assertHeap;
}
EGG::FrmHeap *mHeap::makeHeapOnCurrentGameHeap(size_t size, const char *name, u32 align, u32 flags) {
return makeFrmHeapAndUpdate(size, g_gameHeaps[0], name, align, flags);
EGG::FrmHeap *mHeap::makeHeapOnCurrentGameHeap(size_t size, const char *name, u32 align, AllocOptBit_t flags) {
return createFrmHeapToCurrent(size, g_gameHeaps[0], name, align, flags);
}
+2 -1
View File
@@ -5,6 +5,7 @@
#include "d/d_heap.h"
#include "d/d_pad.h"
#include "m/m_angle.h"
#include "m/m_heap.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "toBeSorted/arc_managers/oarc_manager.h"
#include "toBeSorted/event_manager.h"
@@ -81,7 +82,7 @@ bool AttentionManager::create() {
field_0xBD5 = 0;
field_0xBD4 = 0;
if (!mAllocator.createNewTempFrmHeap(-1, dHeap::work1Heap.heap, "Attention", 0x20, 0)) {
if (!mAllocator.createFrmHeapToCurrent(-1, dHeap::work1Heap.heap, "Attention", 0x20, mHeap::OPT_NONE)) {
return 0;
}
mModels.mMdls[0].field_0x79 = 0;
+2 -1
View File
@@ -2,6 +2,7 @@
// vtable order
#include "JSystem/JParticle/JPAEmitter.h"
#include "JSystem/JParticle/JPAParticle.h"
#include "m/m_heap.h"
#include "rvl/GX/GXTypes.h"
#include "toBeSorted/d_d3d.h"
// clang-format on
@@ -910,7 +911,7 @@ bool dJEffManager_c::createEffManagers() {
}
}
ms_allocator->createNewTempFrmHeap(-1, dHeap::work1Heap.heap, "dJEffManager_c::ms_allocator", 0x20, 0);
ms_allocator->createFrmHeapToCurrent(-1, dHeap::work1Heap.heap, "dJEffManager_c::ms_allocator", 0x20, mHeap::OPT_NONE);
for (s32 idx = 0; idx < 2; idx++) {
sFogProcs[idx].create(idx, sInts[idx], -1, ms_allocator);
}
+1 -1
View File
@@ -26,7 +26,7 @@ static u16 extractResUserIdx(u16 particleResId) {
namespace dParticle {
JPAResourceManager *res_c::init(const void *jpc, const void *jpn, EGG::Heap *heap) {
mpHeap = mHeap::createFrmHeap(-1, heap, "dParticle::res_c", 0x20, 0);
mpHeap = mHeap::createFrmHeap(-1, heap, "dParticle::res_c", 0x20, mHeap::OPT_NONE);
if (mpHeap == nullptr) {
return nullptr;
}
+2 -1
View File
@@ -2,6 +2,7 @@
#include "d/d_heap.h"
#include "d/d_sc_game.h"
#include "m/m_heap.h"
#include "nw4r/g3d/g3d_obj.h"
dTimeAreaMgr_c::dTimeAreaMgr_c() {
@@ -13,7 +14,7 @@ dTimeAreaMgr_c::~dTimeAreaMgr_c() {
}
bool dTimeAreaMgr_c::init() {
mAllocator.replaceWithNewFrmHeap(-1, dHeap::work1Heap.heap, "dTimeAreaMgr_c::m_allocator", 0x20, 0);
mAllocator.createFrmHeap(-1, dHeap::work1Heap.heap, "dTimeAreaMgr_c::m_allocator", 0x20, mHeap::OPT_NONE);
mProcA.create(&mAllocator);
mProcB.create(&mAllocator);
mAllocator.adjustFrmHeap();