From d3b1335c286faaf88cad14c74917789e74155414 Mon Sep 17 00:00:00 2001 From: Emmanuel AYME Date: Thu, 1 Jan 2026 18:59:37 +0100 Subject: [PATCH] Add AOB signatures and Unreal Engine offsets scan by batch --- Memory/Memory.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/Memory/Memory.cpp b/Memory/Memory.cpp index e4b10d5..a1c9830 100644 --- a/Memory/Memory.cpp +++ b/Memory/Memory.cpp @@ -2,6 +2,7 @@ // #include "Memory.hpp" +#include "UEngine.hpp" #include #include #include @@ -213,6 +214,64 @@ uint8_t* Memory::AOBScan( return nullptr; } +void Memory::AOBScanBatch(const std::vector& entries, std::shared_ptr logger) { + for (auto scanEntry = entries.begin(); scanEntry != entries.end(); ++scanEntry) { + if (*scanEntry->address) continue; + + std::string decryptedSignature = scanEntry->getSignature(); + uint8_t* result = nullptr; + if (scanEntry == entries.begin()) // Only log module and area scanned once + result = Memory::AOBScan(scanEntry->moduleName, decryptedSignature, scanEntry->protection, logger); + else result = Memory::AOBScan(scanEntry->moduleName, decryptedSignature, scanEntry->protection); + + if (!result) { + logger->warn( + "{} signature not found. Maybe your game has been updated and is no more compatible with this plugin.", + scanEntry->featureName); + continue; + } + // Write final signature address + uintptr_t finalAddress = reinterpret_cast(result) + scanEntry->offset; + *scanEntry->address = reinterpret_cast(finalAddress); + + logger->info("{} signature found at address: 0x{:X}.", scanEntry->featureName, finalAddress); + } +} + +void Memory::OffsetScanBatch(const std::vector& entries, uint8_t* baseModule, + std::shared_ptr logger, const std::string& moduleName) { + for (const auto& scanEntry : entries) { + if (!scanEntry.outAddress) continue; + + // Scan Unreal Engine Objects and functions + *scanEntry.outAddress = Memory::AOBScan(moduleName, scanEntry.getSignature(), scanEntry.protection); + if (!*scanEntry.outAddress) { + logger->warn("{} signature not found. Maybe your game has been updated and is no more compatible with this plugin.", scanEntry.name); + continue; + } + + UT::uint32 calculatedOffset = 0; + // Calculate offset according type + switch (scanEntry.calcType) + { + case OffsetCalcType::GetOffsetFromOpcode: { + calculatedOffset = static_cast(Memory::GetOffsetFromOpcode(*scanEntry.outAddress + scanEntry.opcodeOffset) - baseModule); + break; + } + case OffsetCalcType::UE_CalculateOffset: { + auto opt = UE::CalculateOffset(moduleName, *scanEntry.outAddress); + if (!opt) continue; + calculatedOffset = *opt; + break; + } + } + // Write final Unreal Engine offset + if (scanEntry.outOffset) *scanEntry.outOffset = calculatedOffset; + + logger->info("{} offset is: 0x{:X}", scanEntry.name, calculatedOffset); + } +} + PVOID Memory::SetupOrClearHardwareBreakPointForAllThreads(uintptr_t targetAddress, PVOID vehHandle, bool enable, PVECTORED_EXCEPTION_HANDLER pVEH, int hwIndex) { DWORD pid = GetCurrentProcessId();