From e9e3d8c10e911e1e2b2f7d7a78c9d070c3bc79fd Mon Sep 17 00:00:00 2001 From: Emmanuel AYME Date: Wed, 10 Sep 2025 22:05:24 +0200 Subject: [PATCH] Add tool library for Unreal Engine --- UEngine/UEngine.cpp | 23 +++++++ UEngine/UEngine.hpp | 12 ++++ UEngine/UEngine.vcxproj | 149 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+) create mode 100644 UEngine/UEngine.cpp create mode 100644 UEngine/UEngine.hpp create mode 100644 UEngine/UEngine.vcxproj diff --git a/UEngine/UEngine.cpp b/UEngine/UEngine.cpp new file mode 100644 index 0000000..9db7cb7 --- /dev/null +++ b/UEngine/UEngine.cpp @@ -0,0 +1,23 @@ +// UEngine.cpp : Defines all Unreal Engine static tools functions +// +#include +#include +#include +#include "UEngine.hpp" + +std::optional 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) + return std::nullopt; + + uintptr_t baseModule = reinterpret_cast(hModule); + uintptr_t AOBAbsoluteAdress = reinterpret_cast(AOBResult); + + if (AOBAbsoluteAdress < baseModule) + return std::nullopt; + + uintptr_t relativeOffset = AOBAbsoluteAdress - baseModule; + return static_cast(relativeOffset); +} \ No newline at end of file diff --git a/UEngine/UEngine.hpp b/UEngine/UEngine.hpp new file mode 100644 index 0000000..26192ff --- /dev/null +++ b/UEngine/UEngine.hpp @@ -0,0 +1,12 @@ +class UE +{ +public: + /** + * Get offset calculated from an AOB scan result and an executable base address + * + * @param exeName : A string of the executable name + * @param AOBResult : A valid (uint8_t) pointer to the result of an AOB scan + * @return std::optional The offset calculated + */ + static std::optional CalculateOffset(const std::string& exeName, uint8_t* AOBResult); +}; diff --git a/UEngine/UEngine.vcxproj b/UEngine/UEngine.vcxproj new file mode 100644 index 0000000..814bc3c --- /dev/null +++ b/UEngine/UEngine.vcxproj @@ -0,0 +1,149 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + 17.0 + Win32Proj + {e6ea0264-0c8f-4050-88f0-02cd4f6ef457} + UEngine + 10.0 + UEngine + + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + Use + pch.h + + + + + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + Use + pch.h + + + + + true + + + + + Level3 + true + _DEBUG;_LIB;%(PreprocessorDefinitions) + true + Use + pch.h + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions) + true + NotUsing + + + stdcpp23 + + + + + true + + + + + + \ No newline at end of file