aboutsummaryrefslogtreecommitdiff
path: root/primedev/engine/host.cpp
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2023-12-27 00:32:01 +0000
committerGitHub <noreply@github.com>2023-12-27 01:32:01 +0100
commitf5ab6fb5e8be7b73e6003d4145081d5e0c0ce287 (patch)
tree90f2c6a4885dbd181799e2325cf33588697674e1 /primedev/engine/host.cpp
parentbb8ed59f6891b1196c5f5bbe7346cd171c8215fa (diff)
downloadNorthstarLauncher-1.21.2.tar.gz
NorthstarLauncher-1.21.2.zip
Folder restructuring from primedev (#624)v1.21.2-rc3v1.21.2
Copies of over the primedev folder structure for easier cherry-picking of further changes Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Diffstat (limited to 'primedev/engine/host.cpp')
-rw-r--r--primedev/engine/host.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/primedev/engine/host.cpp b/primedev/engine/host.cpp
new file mode 100644
index 00000000..dacb8fc1
--- /dev/null
+++ b/primedev/engine/host.cpp
@@ -0,0 +1,33 @@
+#include "core/convar/convar.h"
+#include "mods/modmanager.h"
+#include "util/printcommands.h"
+#include "util/printmaps.h"
+#include "shared/misccommands.h"
+#include "r2engine.h"
+#include "core/tier0.h"
+
+AUTOHOOK_INIT()
+
+// clang-format off
+AUTOHOOK(Host_Init, engine.dll + 0x155EA0,
+void, __fastcall, (bool bDedicated))
+// clang-format on
+{
+ spdlog::info("Host_Init()");
+ Host_Init(bDedicated);
+ FixupCvarFlags();
+ // need to initialise these after host_init since they do stuff to preexisting concommands/convars without being client/server specific
+ InitialiseCommandPrint();
+ InitialiseMapsPrint();
+ // client/server autoexecs on necessary platforms
+ // dedi needs autoexec_ns_server on boot, while non-dedi will run it on on listen server start
+ if (bDedicated)
+ Cbuf_AddText(Cbuf_GetCurrentPlayer(), "exec autoexec_ns_server", cmd_source_t::kCommandSrcCode);
+ else
+ Cbuf_AddText(Cbuf_GetCurrentPlayer(), "exec autoexec_ns_client", cmd_source_t::kCommandSrcCode);
+}
+
+ON_DLL_LOAD("engine.dll", Host_Init, (CModule module))
+{
+ AUTOHOOK_DISPATCH()
+}