Compare commits

..

2 Commits

2 changed files with 9 additions and 5 deletions

View File

@@ -138,6 +138,7 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
if (!GObjectsaddress || !GNamesaddress || !AppendStringaddress || !ProcessEventaddress) {
logger->info("------------ UEngine offsets search ------------");
uint8_t* baseModule = reinterpret_cast<uint8_t*>(GetModuleHandleA(nullptr)); // Get game base address
constexpr auto GObjetcsStringObfuscated = make_obfuscated<0x4A>("48 8B ?? ?? ?? ?? ?? 48 8B ?? ?? 48 8D ?? ?? EB ?? 33");
GObjectsaddress = Memory::AOBScan(gameExecutable, GObjetcsStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
@@ -149,8 +150,7 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
if (!GObjectsaddress)
logger->warn("GObjects signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
else {
uint32_t gObjectsOffset = static_cast<uint32_t>(Memory::GetOffsetFromOpcode(GObjectsaddress + 0x3) -
reinterpret_cast<uint8_t*>(GetModuleHandleA(gameExecutable.c_str())));
uint32_t gObjectsOffset = static_cast<uint32_t>(Memory::GetOffsetFromOpcode(GObjectsaddress + 0x3) - baseModule);
logger->info("GObjects offset is: 0x{:X}.", gObjectsOffset);
Offsets::GObjects = static_cast<UC::uint32>(gObjectsOffset); // Update GObjects offset
}
@@ -158,8 +158,7 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
if (!GNamesaddress)
logger->warn("GNames signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
else {
uint32_t gNamesOffset = static_cast<uint32_t>(Memory::GetOffsetFromOpcode(GNamesaddress + 0x3) -
reinterpret_cast<uint8_t*>(GetModuleHandleA(gameExecutable.c_str())));
uint32_t gNamesOffset = static_cast<uint32_t>(Memory::GetOffsetFromOpcode(GNamesaddress + 0x3) - baseModule);
logger->info("GNames offset is: 0x{:X}.", gNamesOffset);
Offsets::GNames = static_cast<UC::uint32>(gNamesOffset); // Update GNames offset
}

View File

@@ -3,15 +3,20 @@
#include <Windows.h>
#include <string>
#include <optional>
#include <sstream>
#include <iomanip>
#include "UEngine.hpp"
std::optional<uint32_t> UE::CalculateOffset(const std::string& exeName, uint8_t* AOBResult)
{
// Récupère la base du module via GetModuleHandleA
HMODULE hModule = GetModuleHandleA(exeName.c_str());
if (!hModule || !AOBResult)
if (!AOBResult)
return std::nullopt;
if (!hModule)
hModule = GetModuleHandleA(nullptr);
uintptr_t baseModule = reinterpret_cast<uintptr_t>(hModule);
uintptr_t AOBAbsoluteAdress = reinterpret_cast<uintptr_t>(AOBResult);