metaforce/Runtime/CGameAllocator.cpp

47 lines
1.3 KiB
C++
Raw Normal View History

#include "Runtime/CGameAllocator.hpp"
2020-09-08 17:58:55 +00:00
#include <new>
2021-04-10 08:42:06 +00:00
namespace metaforce {
logvisor::Module AllocLog("metaforce::CGameAllocator");
#pragma GCC diagnostic ignored "-Wclass-memaccess"
2020-09-08 17:58:55 +00:00
u32 CGameAllocator::GetFreeBinEntryForSize(size_t len) {
size_t bin = 0;
size_t binSize = 32;
while (true) {
if (binSize > 0x200000) {
return 15;
}
if (len < binSize) {
break;
}
2020-09-08 17:58:55 +00:00
binSize <<= 1;
++bin;
2018-12-08 05:30:43 +00:00
}
2020-09-08 17:58:55 +00:00
return bin;
}
2020-09-08 17:58:55 +00:00
bool CGameAllocator::Initialize() { return true; }
2020-12-03 03:01:57 +00:00
void* CGameAllocator::Alloc() { return nullptr; }
s32 CGameAllocator::Free(void* ptr) { return 0; }
void CGameAllocator::ReleaseAll() {}
void CGameAllocator::AllocSecondary() {}
void CGameAllocator::FreeSecondary() {}
void CGameAllocator::ReleaseAllSecondary() {}
void CGameAllocator::SetOutOfMemoryCallback() {}
void CGameAllocator::EnumAllocations() {}
2021-06-05 05:25:46 +00:00
IAllocator::SAllocInfo CGameAllocator::GetAllocInfo(void* ptr) {
SGameMemInfo* info = GetMemInfoFromBlockPtr(ptr);
return {.x0_infoPtr = info,
.x4_len = info->x4_len,
.x8_hasPrevious = info->x10_prev != nullptr,
.x9_ = false,
.xc_fileAndLne = info->x8_line,
.x10_type = info->xc_type};
}
void CGameAllocator::OffsetFakeStatics(s32 offset) { xb8_fakeStatics += offset; }
2020-12-03 03:01:57 +00:00
void CGameAllocator::GetMetrics() {}
2021-04-10 08:42:06 +00:00
} // namespace metaforce