aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL
diff options
context:
space:
mode:
authorEmma Miler <emma.pi@protonmail.com>2022-11-27 21:27:42 +0100
committerGitHub <noreply@github.com>2022-11-27 21:27:42 +0100
commit9ed73b5b989ce079a7349f7bdda88689fd5ac1c4 (patch)
treea60415625e3d3efd6c3c957af6c65aa656be6d49 /NorthstarDLL
parent3d7e310a3253ad41707217e77c62f1d8dcbc3a8b (diff)
downloadNorthstarLauncher-9ed73b5b989ce079a7349f7bdda88689fd5ac1c4.tar.gz
NorthstarLauncher-9ed73b5b989ce079a7349f7bdda88689fd5ac1c4.zip
Pre-init squirrel managers (#348)
* init * Format
Diffstat (limited to 'NorthstarDLL')
-rw-r--r--NorthstarDLL/dllmain.cpp2
-rw-r--r--NorthstarDLL/squirrel.cpp12
-rw-r--r--NorthstarDLL/squirrel.h2
3 files changed, 11 insertions, 5 deletions
diff --git a/NorthstarDLL/dllmain.cpp b/NorthstarDLL/dllmain.cpp
index 2251d41d..44d973f2 100644
--- a/NorthstarDLL/dllmain.cpp
+++ b/NorthstarDLL/dllmain.cpp
@@ -153,6 +153,8 @@ bool InitialiseNorthstar()
InitialiseNorthstarPrefix();
InitialiseVersion();
+ InitialiseSquirrelManagers();
+
// Fix some users' failure to connect to respawn datacenters
SetEnvironmentVariableA("OPENSSL_ia32cap", "~0x200000200000000");
diff --git a/NorthstarDLL/squirrel.cpp b/NorthstarDLL/squirrel.cpp
index 673e2098..cd8b437c 100644
--- a/NorthstarDLL/squirrel.cpp
+++ b/NorthstarDLL/squirrel.cpp
@@ -550,9 +550,6 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module))
{
AUTOHOOK_DISPATCH_MODULE(client.dll)
- g_pSquirrel<ScriptContext::CLIENT> = new SquirrelManager<ScriptContext::CLIENT>;
- g_pSquirrel<ScriptContext::UI> = new SquirrelManager<ScriptContext::UI>;
-
g_pSquirrel<ScriptContext::CLIENT>->__sq_defconst = module.Offset(0x12120).As<sq_defconstType>();
g_pSquirrel<ScriptContext::UI>->__sq_defconst = g_pSquirrel<ScriptContext::CLIENT>->__sq_defconst;
@@ -663,8 +660,6 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module))
{
AUTOHOOK_DISPATCH_MODULE(server.dll)
- g_pSquirrel<ScriptContext::SERVER> = new SquirrelManager<ScriptContext::SERVER>;
-
g_pSquirrel<ScriptContext::SERVER>->__sq_defconst = module.Offset(0x1F550).As<sq_defconstType>();
g_pSquirrel<ScriptContext::SERVER>->__sq_compilebuffer = module.Offset(0x3110).As<sq_compilebufferType>();
@@ -732,3 +727,10 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module))
StubUnsafeSQFuncs<ScriptContext::SERVER>();
}
+
+void InitialiseSquirrelManagers()
+{
+ g_pSquirrel<ScriptContext::CLIENT> = new SquirrelManager<ScriptContext::CLIENT>;
+ g_pSquirrel<ScriptContext::UI> = new SquirrelManager<ScriptContext::UI>;
+ g_pSquirrel<ScriptContext::SERVER> = new SquirrelManager<ScriptContext::SERVER>;
+}
diff --git a/NorthstarDLL/squirrel.h b/NorthstarDLL/squirrel.h
index 626d4f12..65dd66c5 100644
--- a/NorthstarDLL/squirrel.h
+++ b/NorthstarDLL/squirrel.h
@@ -355,6 +355,8 @@ template <ScriptContext context> class SquirrelManager : public virtual Squirrel
template <ScriptContext context> SquirrelManager<context>* g_pSquirrel;
+void InitialiseSquirrelManagers();
+
/*
Beware all ye who enter below.
This place is not a place of honor... no highly esteemed deed is commemorated here... nothing valued is here.