diff --git a/HellIsUs/dllmain.cpp b/HellIsUs/dllmain.cpp index b18f462..d467374 100644 --- a/HellIsUs/dllmain.cpp +++ b/HellIsUs/dllmain.cpp @@ -190,7 +190,7 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled) } if (Fogaddress == nullptr) { - constexpr auto FogStringObfuscated = make_obfuscated<0x4A>("F6 ?? ?? ?? ?? 74 ?? 48 8B ?? ?? ?? ?? ?? 83 78 ?? ?? 75 ?? B3"); + constexpr auto FogStringObfuscated = make_obfuscated<0x4A>("0F 84 ?? ?? ?? ?? F6 ?? ?? ?? 0F 84 ?? ?? ?? ?? 83 BF"); 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,8 +204,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 += 0x12; - } + } } if (Cameraaddress == nullptr) { @@ -488,11 +487,8 @@ static void HUDFixEnabled() { auto* canvasSlot = static_cast(widget->Slot); // Filter on class drawing HUD in game - if (canvasSlot && className.contains("CombatHud_SUMG_C")) { + if (canvasSlot && className.contains("CombatHud_SUMG_C")) canvasSlot->SetAnchors(referenceHUDAnchors); - // Taking benefity of ProcessEvent that is called at level init to call fog fix - FogFixEnabled(); - } } } } @@ -558,24 +554,19 @@ static void VignettingFixEnabled() { } static void FogFixEnabled() { - UWorld* World = UWorld::GetWorld(); - if (!World) return; // World not ready ? Do nothing - ULevel* Level = World->PersistentLevel; - if (!Level) return; - TArray& Actors = Level->Actors; - - for (AActor* Actor : Actors) // Loop through Unreal Engine actors - { - if (Actor && Actor->IsA(AExponentialHeightFog::StaticClass())) { - auto* fogActor = static_cast(Actor); - // Get final class that controls Fog - if (auto* component = fogActor->GetComponentByClass(UExponentialHeightFogComponent::StaticClass())) { - if (auto* fogComponent = static_cast(component)) { - fogComponent->SetVisibility(!(g_fix_enabled && g_Fog_fix_enabled), true); - logger->info((g_fix_enabled && g_Fog_fix_enabled) ? "Fog fix enabled." : "Fog fix disabled."); - } - } + 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 + }); } + else FogHook.enable(); + logger->info("Fog fix enabled"); + } + if (!(g_fix_enabled && g_Fog_fix_enabled) && Fogaddress) { + if (FogHook) FogHook.disable(); + logger->info("Fog fix disabled"); } }