From 52dc6d143fec8eabb9958bacbdbf6f1b4b4af592 Mon Sep 17 00:00:00 2001 From: BobTheBob9 Date: Sun, 24 Jul 2022 20:55:34 +0100 Subject: add new memory lib --- NorthstarDLL/r2engine.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'NorthstarDLL/r2engine.cpp') diff --git a/NorthstarDLL/r2engine.cpp b/NorthstarDLL/r2engine.cpp index 883178ee..451928af 100644 --- a/NorthstarDLL/r2engine.cpp +++ b/NorthstarDLL/r2engine.cpp @@ -13,23 +13,21 @@ namespace R2 CEngine* g_pEngine; void (*CBaseClient__Disconnect)(void* self, uint32_t unknownButAlways1, const char* reason, ...); - CBaseClient* g_pClientArray; server_state_t* g_pServerState; } // namespace R2 -ON_DLL_LOAD("engine.dll", R2Engine, (HMODULE baseAddress)) +ON_DLL_LOAD("engine.dll", R2Engine, (CModule module)) { - Cbuf_GetCurrentPlayer = (Cbuf_GetCurrentPlayerType)((char*)baseAddress + 0x120630); - Cbuf_AddText = (Cbuf_AddTextType)((char*)baseAddress + 0x1203B0); - Cbuf_Execute = (Cbuf_ExecuteType)((char*)baseAddress + 0x1204B0); - - g_pEngine = *(CEngine**)((char*)baseAddress + 0x7D70C8); + Cbuf_GetCurrentPlayer = module.Offset(0x120630).As(); + Cbuf_AddText = module.Offset(0x1203B0).As(); + Cbuf_Execute = module.Offset(0x1204B0).As(); - CBaseClient__Disconnect = (void (*)(void*, uint32_t, const char*, ...))((char*)baseAddress + 0x1012C0); + g_pEngine = module.Offset(0x7D70C8).Deref().As(); // new - g_pServerState = (server_state_t*)((char*)baseAddress + 0x12A53D48); + CBaseClient__Disconnect = module.Offset(0x1012C0).As(); + g_pClientArray = module.Offset(0x12A53F90).As(); - g_pClientArray = (CBaseClient*)((char*)baseAddress + 0x12A53F90); + g_pServerState = module.Offset(0x12A53D48).As(); } \ No newline at end of file -- cgit v1.2.3