Recover some dead-stripped code

This commit is contained in:
Charlotte Delenk 2021-10-21 16:56:44 +02:00
parent 3e58f7b005
commit b000c1e18b
Signed by: darkkirb
GPG key ID: 015E3768A70AFBC5
4 changed files with 32 additions and 0 deletions

View file

@ -57,6 +57,12 @@ Memory::Memory()
Memory::~Memory() { object_ = 0; } Memory::~Memory() { object_ = 0; }
void Memory::sendArenaInfoToTerminal() {
// There is probably debug mode code in here, but in the retail game, this
// function would have been 4 bytes in size before being dead-stripped, likely
// a single blr instruction.
}
HeapExp &Memory::mem1FixHeap() { return mem1Fix_; } HeapExp &Memory::mem1FixHeap() { return mem1Fix_; }
USED HeapExp &Memory::sceneHeap() { return scene_; } USED HeapExp &Memory::sceneHeap() { return scene_; }
HeapExp &Memory::mem2FixHeap() { return mem2Fix_; } HeapExp &Memory::mem2FixHeap() { return mem2Fix_; }

View file

@ -50,22 +50,45 @@ USED void *operator new(u32 size, IAllocator &alloc) {
return t_operatorNew(size, alloc); return t_operatorNew(size, alloc);
} }
void *operator new(u32 size, const std::nothrow_t &, IAllocator &alloc) {
return t_operatorNew(size, alloc);
}
void *operator new[](u32 size, IAllocator &alloc) { void *operator new[](u32 size, IAllocator &alloc) {
return t_operatorNew(size, alloc); return t_operatorNew(size, alloc);
} }
void *operator new(u32 size) { return t_operatorNew(size); } void *operator new(u32 size) { return t_operatorNew(size); }
void *operator new(u32 size, const std::nothrow_t &) {
return t_operatorNew(size);
}
void *operator new[](u32 size) { return t_operatorNew(size); } void *operator new[](u32 size) { return t_operatorNew(size); }
void *operator new[](u32 size, const std::nothrow_t &) {
return t_operatorNew(size);
}
void operator delete(void *ptr) { t_operatorDelete(ptr); } void operator delete(void *ptr) { t_operatorDelete(ptr); }
void operator delete(void *ptr, const std::nothrow_t &) {
t_operatorDelete(ptr);
}
void operator delete[](void *ptr) { t_operatorDelete(ptr); } void operator delete[](void *ptr) { t_operatorDelete(ptr); }
void operator delete[](void *ptr, const std::nothrow_t &) {
t_operatorDelete(ptr);
}
namespace mem { namespace mem {
USED void OperatorNewDelete::SetDefaultAllocator(IAllocator &alloc) { USED void OperatorNewDelete::SetDefaultAllocator(IAllocator &alloc) {
t_allocator.ptr_ = &alloc; t_allocator.ptr_ = &alloc;
} }
IAllocator &OperatorNewDelete::GetDefaultAllocator() {
return *t_allocator.ptr_;
}
USED void OperatorNewDelete::SetGlobalNewDeleteAllocator(IAllocator &alloc) { USED void OperatorNewDelete::SetGlobalNewDeleteAllocator(IAllocator &alloc) {
t_globalNewDeleteAllocator.ptr_ = &alloc; t_globalNewDeleteAllocator.ptr_ = &alloc;
} }

View file

@ -20,6 +20,8 @@ struct Memory : hel::common::ExplicitSingleton<Memory> {
Memory(); Memory();
~Memory(); ~Memory();
void sendArenaInfoToTerminal();
HeapExp &mem1FixHeap(); HeapExp &mem1FixHeap();
HeapExp &sceneHeap(); HeapExp &sceneHeap();
HeapExp &mem2FixHeap(); HeapExp &mem2FixHeap();

View file

@ -5,6 +5,7 @@
namespace mem { namespace mem {
struct OperatorNewDelete { struct OperatorNewDelete {
static void SetDefaultAllocator(IAllocator &alloc); static void SetDefaultAllocator(IAllocator &alloc);
static IAllocator &GetDefaultAllocator(void);
static void SetGlobalNewDeleteAllocator(IAllocator &alloc); static void SetGlobalNewDeleteAllocator(IAllocator &alloc);
static void UnsetGlobalNewDeleteAllocator(IAllocator &alloc); static void UnsetGlobalNewDeleteAllocator(IAllocator &alloc);
}; };