Add a fallback to retrieve game base module
This commit is contained in:
@@ -3,15 +3,20 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
#include "UEngine.hpp"
|
#include "UEngine.hpp"
|
||||||
|
|
||||||
std::optional<uint32_t> UE::CalculateOffset(const std::string& exeName, uint8_t* AOBResult)
|
std::optional<uint32_t> UE::CalculateOffset(const std::string& exeName, uint8_t* AOBResult)
|
||||||
{
|
{
|
||||||
// Récupère la base du module via GetModuleHandleA
|
// Récupère la base du module via GetModuleHandleA
|
||||||
HMODULE hModule = GetModuleHandleA(exeName.c_str());
|
HMODULE hModule = GetModuleHandleA(exeName.c_str());
|
||||||
if (!hModule || !AOBResult)
|
if (!AOBResult)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
|
if (!hModule)
|
||||||
|
hModule = GetModuleHandleA(nullptr);
|
||||||
|
|
||||||
uintptr_t baseModule = reinterpret_cast<uintptr_t>(hModule);
|
uintptr_t baseModule = reinterpret_cast<uintptr_t>(hModule);
|
||||||
uintptr_t AOBAbsoluteAdress = reinterpret_cast<uintptr_t>(AOBResult);
|
uintptr_t AOBAbsoluteAdress = reinterpret_cast<uintptr_t>(AOBResult);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user