baseaddr [skip ci]

This commit is contained in:
Skull Merlin 2022-03-05 02:44:16 +02:00
parent fc59b7e7a6
commit fca5964740
2 changed files with 20 additions and 2 deletions

View File

@ -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;
}

View File

@ -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<T*>((uint64_t)sp_object_ + base_address);
}
return mp_object_;
return reinterpret_cast<T*>((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"