mirror of
https://github.com/R2Northstar/NorthstarLauncher
synced 2026-08-23 20:26:04 -04:00
Copies of over the primedev folder structure for easier cherry-picking of further changes Co-authored-by: F1F7Y <filip.bartos07@proton.me>
30 lines
1.1 KiB
C++
30 lines
1.1 KiB
C++
#include "tier0.h"
|
|
|
|
IMemAlloc* g_pMemAllocSingleton = nullptr;
|
|
|
|
CommandLineType CommandLine;
|
|
Plat_FloatTimeType Plat_FloatTime;
|
|
ThreadInServerFrameThreadType ThreadInServerFrameThread;
|
|
|
|
typedef IMemAlloc* (*CreateGlobalMemAllocType)();
|
|
CreateGlobalMemAllocType CreateGlobalMemAlloc;
|
|
|
|
// needs to be a seperate function, since memalloc.cpp calls it
|
|
void TryCreateGlobalMemAlloc()
|
|
{
|
|
// init memalloc stuff
|
|
CreateGlobalMemAlloc =
|
|
reinterpret_cast<CreateGlobalMemAllocType>(GetProcAddress(GetModuleHandleA("tier0.dll"), "CreateGlobalMemAlloc"));
|
|
g_pMemAllocSingleton = CreateGlobalMemAlloc(); // if it already exists, this returns the preexisting IMemAlloc instance
|
|
}
|
|
|
|
ON_DLL_LOAD("tier0.dll", Tier0GameFuncs, (CModule module))
|
|
{
|
|
// shouldn't be necessary, but do this just in case
|
|
TryCreateGlobalMemAlloc();
|
|
|
|
// setup tier0 funcs
|
|
CommandLine = module.GetExport("CommandLine").RCast<CommandLineType>();
|
|
Plat_FloatTime = module.GetExport("Plat_FloatTime").RCast<Plat_FloatTimeType>();
|
|
ThreadInServerFrameThread = module.GetExport("ThreadInServerFrameThread").RCast<ThreadInServerFrameThreadType>();
|
|
}
|