aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/engine/r2engine.cpp
diff options
context:
space:
mode:
authorEmma Miler <emma.pi@protonmail.com>2022-12-19 19:32:16 +0100
committerGitHub <noreply@github.com>2022-12-19 19:32:16 +0100
commite04f3b36accccb590a2d51b4829256b9964ac3fd (patch)
tree20ee30c82e6f53e6e772be2e1b9613eebca12bf3 /NorthstarDLL/engine/r2engine.cpp
parent33f18a735986dcd136bf8ba70ad8331306c28227 (diff)
downloadNorthstarLauncher-e04f3b36accccb590a2d51b4829256b9964ac3fd.tar.gz
NorthstarLauncher-e04f3b36accccb590a2d51b4829256b9964ac3fd.zip
Restructuring (#365)
* Remove launcher proxy * Restructuring * More restructuring * Fix include dirs * Fix merge * Remove clang thing * Filters * Oops
Diffstat (limited to 'NorthstarDLL/engine/r2engine.cpp')
-rw-r--r--NorthstarDLL/engine/r2engine.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/NorthstarDLL/engine/r2engine.cpp b/NorthstarDLL/engine/r2engine.cpp
new file mode 100644
index 00000000..11233a2d
--- /dev/null
+++ b/NorthstarDLL/engine/r2engine.cpp
@@ -0,0 +1,36 @@
+#include "pch.h"
+#include "r2engine.h"
+
+using namespace R2;
+
+// use the R2 namespace for game funcs
+namespace R2
+{
+ Cbuf_GetCurrentPlayerType Cbuf_GetCurrentPlayer;
+ Cbuf_AddTextType Cbuf_AddText;
+ Cbuf_ExecuteType Cbuf_Execute;
+
+ CEngine* g_pEngine;
+
+ void (*CBaseClient__Disconnect)(void* self, uint32_t unknownButAlways1, const char* reason, ...);
+ CBaseClient* g_pClientArray;
+
+ server_state_t* g_pServerState;
+
+ char* g_pModName =
+ nullptr; // we cant set this up here atm since we dont have an offset to it in engine, instead we store it in IsRespawnMod
+} // namespace R2
+
+ON_DLL_LOAD("engine.dll", R2Engine, (CModule module))
+{
+ Cbuf_GetCurrentPlayer = module.Offset(0x120630).As<Cbuf_GetCurrentPlayerType>();
+ Cbuf_AddText = module.Offset(0x1203B0).As<Cbuf_AddTextType>();
+ Cbuf_Execute = module.Offset(0x1204B0).As<Cbuf_ExecuteType>();
+
+ g_pEngine = module.Offset(0x7D70C8).Deref().As<CEngine*>();
+
+ CBaseClient__Disconnect = module.Offset(0x1012C0).As<void (*)(void*, uint32_t, const char*, ...)>();
+ g_pClientArray = module.Offset(0x12A53F90).As<CBaseClient*>();
+
+ g_pServerState = module.Offset(0x12A53D48).As<server_state_t*>();
+}