From fca59647403d4f68461a2da50b6d498b9a082be6 Mon Sep 17 00:00:00 2001 From: Skull Merlin <86374920+skkuull@users.noreply.github.com> Date: Sat, 5 Mar 2022 02:44:16 +0200 Subject: [PATCH] baseaddr [skip ci] --- src/client/game/game.cpp | 13 +++++++++++++ src/client/game/game.hpp | 9 +++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index 9045761b..95fb0793 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -3,6 +3,14 @@ namespace game { + uint64_t base_address; + + void load_base_address() + { + const auto module = GetModuleHandle(NULL); + base_address = uint64_t(module); + } + int Cmd_Argc() { return cmd_args->argc[cmd_args->nesting]; @@ -102,3 +110,8 @@ namespace game } } } + +uintptr_t operator"" _b(const uintptr_t ptr) +{ + return game::base_address + ptr; +} \ No newline at end of file diff --git a/src/client/game/game.hpp b/src/client/game/game.hpp index 47041ca9..0442fece 100644 --- a/src/client/game/game.hpp +++ b/src/client/game/game.hpp @@ -9,6 +9,9 @@ namespace game { + extern uint64_t base_address; + void load_base_address(); + namespace environment { launcher::mode get_mode(); @@ -37,10 +40,10 @@ namespace game { if (environment::is_sp()) { - return sp_object_; + return reinterpret_cast((uint64_t)sp_object_ + base_address); } - return mp_object_; + return reinterpret_cast((uint64_t)mp_object_ + base_address); } operator T* () const @@ -67,4 +70,6 @@ namespace game bool VirtualLobby_Loaded(); } +uintptr_t operator"" _b(const uintptr_t ptr); + #include "symbols.hpp"