aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/memalloc.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-09 18:28:27 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-09 18:28:27 +0100
commit7a2f17c9d13371e1beb62014f2ec0169124c9862 (patch)
tree3f12d8c25392fb461f0a3b03dc9cd510631c7400 /NorthstarDedicatedTest/memalloc.cpp
parent5a58dd1c05e943d6b440bea5b4a6ae80ce16841e (diff)
downloadNorthstarLauncher-7a2f17c9d13371e1beb62014f2ec0169124c9862.tar.gz
NorthstarLauncher-7a2f17c9d13371e1beb62014f2ec0169124c9862.zip
move tier0 and playlist funcs to namespaces
Diffstat (limited to 'NorthstarDedicatedTest/memalloc.cpp')
-rw-r--r--NorthstarDedicatedTest/memalloc.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/NorthstarDedicatedTest/memalloc.cpp b/NorthstarDedicatedTest/memalloc.cpp
index 4ba54c73..e00d3fc7 100644
--- a/NorthstarDedicatedTest/memalloc.cpp
+++ b/NorthstarDedicatedTest/memalloc.cpp
@@ -1,6 +1,8 @@
#include "pch.h"
#include "memalloc.h"
-#include "gameutils.h"
+#include "tier0.h"
+
+using namespace Tier0;
// TODO: rename to malloc and free after removing statically compiled .libs
@@ -8,9 +10,8 @@ extern "C" void* _malloc_base(size_t n)
{
// allocate into static buffer if g_pMemAllocSingleton isn't initialised
if (!g_pMemAllocSingleton)
- {
- InitialiseTier0GameUtilFunctions(GetModuleHandleA("tier0.dll"));
- }
+ TryCreateGlobalMemAlloc();
+
return g_pMemAllocSingleton->m_vtable->Alloc(g_pMemAllocSingleton, n);
}
@@ -22,19 +23,16 @@ extern "C" void* _malloc_base(size_t n)
extern "C" void _free_base(void* p)
{
if (!g_pMemAllocSingleton)
- {
- spdlog::warn("Trying to free something before g_pMemAllocSingleton was ready, this should never happen");
- InitialiseTier0GameUtilFunctions(GetModuleHandleA("tier0.dll"));
- }
+ TryCreateGlobalMemAlloc();
+
g_pMemAllocSingleton->m_vtable->Free(g_pMemAllocSingleton, p);
}
extern "C" void* _realloc_base(void* oldPtr, size_t size)
{
if (!g_pMemAllocSingleton)
- {
- InitialiseTier0GameUtilFunctions(GetModuleHandleA("tier0.dll"));
- }
+ TryCreateGlobalMemAlloc();
+
return g_pMemAllocSingleton->m_vtable->Realloc(g_pMemAllocSingleton, oldPtr, size);
}