diff --git a/LittleNightmareIII/dllmain.cpp b/LittleNightmareIII/dllmain.cpp index 48b3bac..6adb668 100644 --- a/LittleNightmareIII/dllmain.cpp +++ b/LittleNightmareIII/dllmain.cpp @@ -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(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(Memory::GetOffsetFromOpcode(GObjectsaddress + 0x3) - - reinterpret_cast(GetModuleHandleA(gameExecutable.c_str()))); + uint32_t gObjectsOffset = static_cast(Memory::GetOffsetFromOpcode(GObjectsaddress + 0x3) - baseModule); logger->info("GObjects offset is: 0x{:X}.", gObjectsOffset); Offsets::GObjects = static_cast(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(Memory::GetOffsetFromOpcode(GNamesaddress + 0x3) - - reinterpret_cast(GetModuleHandleA(gameExecutable.c_str()))); + uint32_t gNamesOffset = static_cast(Memory::GetOffsetFromOpcode(GNamesaddress + 0x3) - baseModule); logger->info("GNames offset is: 0x{:X}.", gNamesOffset); Offsets::GNames = static_cast(gNamesOffset); // Update GNames offset }