Add AOB signatures and Unreal Engine offsets scan by batch
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "Memory.hpp"
|
#include "Memory.hpp"
|
||||||
|
#include "UEngine.hpp"
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
@@ -213,6 +214,64 @@ uint8_t* Memory::AOBScan(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Memory::AOBScanBatch(const std::vector<AOBScanEntry>& entries, std::shared_ptr<spdlog::logger> 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<uintptr_t>(result) + scanEntry->offset;
|
||||||
|
*scanEntry->address = reinterpret_cast<uint8_t*>(finalAddress);
|
||||||
|
|
||||||
|
logger->info("{} signature found at address: 0x{:X}.", scanEntry->featureName, finalAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Memory::OffsetScanBatch(const std::vector<OffsetScanEntry>& entries, uint8_t* baseModule,
|
||||||
|
std::shared_ptr<spdlog::logger> 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<UT::uint32>(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)
|
PVOID Memory::SetupOrClearHardwareBreakPointForAllThreads(uintptr_t targetAddress, PVOID vehHandle, bool enable, PVECTORED_EXCEPTION_HANDLER pVEH, int hwIndex)
|
||||||
{
|
{
|
||||||
DWORD pid = GetCurrentProcessId();
|
DWORD pid = GetCurrentProcessId();
|
||||||
|
|||||||
Reference in New Issue
Block a user