diff --git a/HellIsUs/dllmain.cpp b/HellIsUs/dllmain.cpp index d467374..4b2b4e4 100644 --- a/HellIsUs/dllmain.cpp +++ b/HellIsUs/dllmain.cpp @@ -3,6 +3,7 @@ #include #include #include +#include "GameInformations.h" #include "ObfuscateString.h" #include "Memory.hpp"; #include "Maths.hpp"; @@ -50,6 +51,8 @@ static float g_cameraHeight = -15.f; static float g_FOV_In = 70.f; static float g_Compensated_FOV = 70.f; static float g_FOV_Out = 70.f; +static float g_Camera_In = 550.f; +static float g_Camera_Out = 550.f; static bool g_Console_Enabled = false; // AOB Unreal Engine offsets addresses @@ -190,7 +193,9 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled) } if (Fogaddress == nullptr) { - constexpr auto FogStringObfuscated = make_obfuscated<0x4A>("0F 84 ?? ?? ?? ?? F6 ?? ?? ?? 0F 84 ?? ?? ?? ?? 83 BF"); + // 40 ?? 48 83 ?? ?? 48 8B ?? ?? ?? ?? ?? 48 ?? ?? 48 89 ?? ?? ?? 48 8D ?? ?? 48 8D ?? ?? ?? E8 + //constexpr auto FogStringObfuscated = make_obfuscated<0x4A>("0F 84 ?? ?? ?? ?? F6 ?? ?? ?? 0F 84 ?? ?? ?? ?? 83 BF"); + constexpr auto FogStringObfuscated = make_obfuscated<0x4A>("40 ?? 48 83 ?? ?? 48 8B ?? ?? ?? ?? ?? 48 ?? ?? 48 89 ?? ?? ?? 48 8D ?? ?? 48 8D ?? ?? ?? E8"); Fogaddress = Memory::AOBScan(gameExecutable, FogStringObfuscated.decrypt(), PAGE_EXECUTE_READ); //"HellIsUs-Win64-Shipping.exe" + 22B77C8 - 74 11 - je "HellIsUs-Win64-Shipping.exe" + 22B77DB //"HellIsUs-Win64-Shipping.exe" + 22B77CA - 48 8B 05 8F 23 08 07 - mov rax, ["HellIsUs-Win64-Shipping.exe" + 9339B60] @@ -204,6 +209,7 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled) logger->warn("Fog signature not found. Maybe your game has been updated and is no more compatible with this plugin."); else { logger->info("Fog signature found at address: 0x{:X}.", reinterpret_cast(Fogaddress)); + Fogaddress += 0x31; // 0x57 } } @@ -387,20 +393,15 @@ extern "C" __declspec(dllexport) void SetHUD(int HUDValue) } // Getters for Reshade addon call -extern "C" __declspec(dllexport) float GetFOVIn() { - return g_FOV_In; -} +extern "C" __declspec(dllexport) void GetGameInfos(GameInfos* infos) { + if (!infos) return; -extern "C" __declspec(dllexport) float GetCompensatedFOV() { - return g_Compensated_FOV; -} - -extern "C" __declspec(dllexport) float GetFOVOut() { - return g_FOV_Out; -} - -extern "C" __declspec(dllexport) bool GetConsoleEnabled() { - return g_Console_Enabled; + infos->FOVIn = g_FOV_In; + infos->CompensatedFOV = g_Compensated_FOV; + infos->FOVOut = g_FOV_Out; + infos->cameraIn = g_Camera_In; + infos->cameraOut = g_Camera_Out; + infos->consoleEnabled = g_Console_Enabled; } // Code injection functions @@ -443,7 +444,10 @@ static void CameraFixEnabled(ECharlieCameraMode mode) { if (!CameraHook) { // Hook only once +0x4e or start to test +0x13 CameraHook = safetyhook::create_mid(Cameraaddress + 0x4e, [](SafetyHookContext& ctx) { + g_Camera_In = ctx.xmm0.f32[0]; ctx.xmm0.f32[0] *= (g_Camera_fix_enabled ? g_cameraDistanceMultiplier : 1.f); + g_Camera_Out = ctx.xmm0.f32[0]; + // Retrieve player camera object auto* charlieCameraBaseConfig = reinterpret_cast(ctx.rax); if (charlieCameraBaseConfig && charlieCameraBaseConfig->IsA(UCharlieCameraBaseConfig::StaticClass())) { @@ -553,21 +557,22 @@ static void VignettingFixEnabled() { } } + static void FogFixEnabled() { if (g_fix_enabled && g_Fog_fix_enabled && Fogaddress) { if (!FogHook) { FogHook = safetyhook::create_mid(Fogaddress, [](SafetyHookContext& ctx) { - ctx.rflags |= 0x40; // ZF=1 r.VolumetricFog = 0 + if (!ctx.rax) return; + uintptr_t* rax = reinterpret_cast(ctx.rax); + bool* bFog = reinterpret_cast(reinterpret_cast(rax) + 0x04); + *bFog = g_fix_enabled && g_Fog_fix_enabled ? false : true; }); } - else FogHook.enable(); logger->info("Fog fix enabled"); } - if (!(g_fix_enabled && g_Fog_fix_enabled) && Fogaddress) { - if (FogHook) FogHook.disable(); + if (!(g_fix_enabled && g_Fog_fix_enabled) && Fogaddress) logger->info("Fog fix disabled"); - } } // UE Console creation @@ -604,6 +609,8 @@ static void EnableConsole() logger->info("Successfully spawned console object"); // Set the console viewport so that it will be displayed Engine->GameViewport->ViewportConsole = static_cast(NewObject); + + //Engine->GameViewport->ViewportConsole->ConsoleTargetPlayer->ViewportClient auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed = end - start;