mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:44:56 +00:00
CMemory falls back to malloc if uninitialized
This commit is contained in:
@@ -73,6 +73,8 @@ IAllocator& CMemorySys::GetGameAllocator() {return g_gameAllocator;}
|
|||||||
|
|
||||||
void* operator new(std::size_t sz)
|
void* operator new(std::size_t sz)
|
||||||
{
|
{
|
||||||
|
if (!Retro::g_memoryAllocatorReady)
|
||||||
|
return malloc(sz);
|
||||||
Retro::CCallStack cs("?\?(?\?)", "UnknownType");
|
Retro::CCallStack cs("?\?(?\?)", "UnknownType");
|
||||||
return Retro::CMemory::Alloc(sz,
|
return Retro::CMemory::Alloc(sz,
|
||||||
Retro::IAllocator::EHint::None,
|
Retro::IAllocator::EHint::None,
|
||||||
@@ -84,6 +86,8 @@ void* operator new(std::size_t sz)
|
|||||||
void* operator new(std::size_t sz,
|
void* operator new(std::size_t sz,
|
||||||
const char* funcName, const char* typeName)
|
const char* funcName, const char* typeName)
|
||||||
{
|
{
|
||||||
|
if (!Retro::g_memoryAllocatorReady)
|
||||||
|
return malloc(sz);
|
||||||
Retro::CCallStack cs(funcName, typeName);
|
Retro::CCallStack cs(funcName, typeName);
|
||||||
return Retro::CMemory::Alloc(sz,
|
return Retro::CMemory::Alloc(sz,
|
||||||
Retro::IAllocator::EHint::None,
|
Retro::IAllocator::EHint::None,
|
||||||
@@ -94,11 +98,18 @@ void* operator new(std::size_t sz,
|
|||||||
|
|
||||||
void operator delete(void* ptr) noexcept
|
void operator delete(void* ptr) noexcept
|
||||||
{
|
{
|
||||||
|
if (!Retro::g_memoryAllocatorReady)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Retro::CMemory::Free(ptr);
|
Retro::CMemory::Free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* operator new[](std::size_t sz)
|
void* operator new[](std::size_t sz)
|
||||||
{
|
{
|
||||||
|
if (!Retro::g_memoryAllocatorReady)
|
||||||
|
return malloc(sz);
|
||||||
Retro::CCallStack cs("?\?(?\?)", "UnknownType");
|
Retro::CCallStack cs("?\?(?\?)", "UnknownType");
|
||||||
return Retro::CMemory::Alloc(sz,
|
return Retro::CMemory::Alloc(sz,
|
||||||
Retro::IAllocator::EHint::None,
|
Retro::IAllocator::EHint::None,
|
||||||
@@ -110,6 +121,8 @@ void* operator new[](std::size_t sz)
|
|||||||
void* operator new[](std::size_t sz,
|
void* operator new[](std::size_t sz,
|
||||||
const char* funcName, const char* typeName)
|
const char* funcName, const char* typeName)
|
||||||
{
|
{
|
||||||
|
if (!Retro::g_memoryAllocatorReady)
|
||||||
|
return malloc(sz);
|
||||||
Retro::CCallStack cs(funcName, typeName);
|
Retro::CCallStack cs(funcName, typeName);
|
||||||
return Retro::CMemory::Alloc(sz,
|
return Retro::CMemory::Alloc(sz,
|
||||||
Retro::IAllocator::EHint::None,
|
Retro::IAllocator::EHint::None,
|
||||||
@@ -120,5 +133,10 @@ void* operator new[](std::size_t sz,
|
|||||||
|
|
||||||
void operator delete[](void* ptr) noexcept
|
void operator delete[](void* ptr) noexcept
|
||||||
{
|
{
|
||||||
|
if (!Retro::g_memoryAllocatorReady)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Retro::CMemory::Free(ptr);
|
Retro::CMemory::Free(ptr);
|
||||||
}
|
}
|
||||||
|
|||||||
2
hecl
2
hecl
Submodule hecl updated: e98d0f25d9...1cb02347a5
Reference in New Issue
Block a user