diff --git a/NorthstarDLL/NorthstarDLL.vcxproj b/NorthstarDLL/NorthstarDLL.vcxproj
index 782f6161a..6aa584bc9 100644
--- a/NorthstarDLL/NorthstarDLL.vcxproj
+++ b/NorthstarDLL/NorthstarDLL.vcxproj
@@ -249,6 +249,7 @@ IF EXIST "$(SolutionDir)..\NorthstarCN_Binaries\Northstar.dll" del "$(SolutionDi
+
@@ -365,7 +366,7 @@ IF EXIST "$(SolutionDir)..\NorthstarCN_Binaries\Northstar.dll" del "$(SolutionDi
-
+
diff --git a/NorthstarDLL/NorthstarDLL.vcxproj.filters b/NorthstarDLL/NorthstarDLL.vcxproj.filters
index d081c4c46..bb8b8b5e3 100644
--- a/NorthstarDLL/NorthstarDLL.vcxproj.filters
+++ b/NorthstarDLL/NorthstarDLL.vcxproj.filters
@@ -381,6 +381,9 @@
Header Files\client\igig
+
+ Header Files\shared
+
@@ -695,7 +698,7 @@
Source Files\client\igig
-
+
Source Files\shared
diff --git a/NorthstarDLL/core/tier0.cpp b/NorthstarDLL/core/tier0.cpp
index cbad3ec0d..31c877753 100644
--- a/NorthstarDLL/core/tier0.cpp
+++ b/NorthstarDLL/core/tier0.cpp
@@ -1,4 +1,5 @@
#include "tier0.h"
+#include "shared/cmimalloc.h"
// use the Tier0 namespace for tier0 funcs
namespace Tier0
@@ -14,6 +15,8 @@ namespace Tier0
typedef Tier0::IMemAlloc* (*CreateGlobalMemAllocType)();
CreateGlobalMemAllocType CreateGlobalMemAlloc;
+std::mutex mmMutex;
+
// needs to be a seperate function, since memalloc.cpp calls it
void TryCreateGlobalMemAlloc()
{
@@ -23,8 +26,17 @@ void TryCreateGlobalMemAlloc()
Tier0::g_pMemAllocSingleton = CreateGlobalMemAlloc(); // if it already exists, this returns the preexisting IMemAlloc instance
}
+AUTOHOOK_INIT()
+
+AUTOHOOK(CGMA, tier0.dll + 0x17B60, void*, __fastcall, ())
+{
+ return new CMiMalloc();
+}
+
ON_DLL_LOAD("tier0.dll", Tier0GameFuncs, (CModule module))
{
+ AUTOHOOK_DISPATCH();
+
// shouldn't be necessary, but do this just in case
TryCreateGlobalMemAlloc();
diff --git a/NorthstarDLL/pch.h b/NorthstarDLL/pch.h
index b3fc15f5c..b4672892a 100644
--- a/NorthstarDLL/pch.h
+++ b/NorthstarDLL/pch.h
@@ -8,18 +8,19 @@
#define _WINSOCK_DEPRECATED_NO_WARNINGS // temp because i'm very lazy and want to use inet_addr, remove later
#define RAPIDJSON_HAS_STDSTRING 1
-// add headers that you want to pre-compile here
-#include "core/memalloc.h"
-
#include
#include
#include
#include