Addressed an issue where enabling fog fix would result in textures corruption in Talju area.HUD & fog fixes are now fully controllable in real time.Add Some optimisatons.
This commit is contained in:
@@ -19,7 +19,7 @@ using namespace SDK;
|
||||
const std::string PLUGIN_NAME = "HellIsUs";
|
||||
const std::string PLUGIN_LOG = PLUGIN_NAME + ".log";
|
||||
const std::string gameExecutable = "HellIsUs-Win64-Shipping.exe";
|
||||
const float baseAspect = 1.777777791;
|
||||
const float BASE_ASPECT = 1.777777791;
|
||||
const float DEFAULT_WORLD_FOV = 70.f;
|
||||
const float DEFAULT_CAMERA_HEIGHT = -15.f;
|
||||
|
||||
@@ -47,9 +47,9 @@ static float g_cameraDistanceMultiplier = 1.f;
|
||||
static float g_cameraHeight = -15.f;
|
||||
|
||||
// Shared values
|
||||
static float g_FOV_In = 0;
|
||||
static float g_Compensated_FOV = 0;
|
||||
static float g_FOV_Out = 0;
|
||||
static float g_FOV_In = 70.f;
|
||||
static float g_Compensated_FOV = 70.f;
|
||||
static float g_FOV_Out = 70.f;
|
||||
static bool g_Console_Enabled = false;
|
||||
|
||||
// AOB Unreal Engine offsets addresses
|
||||
@@ -66,7 +66,7 @@ static uint8_t* CAaddress = nullptr;
|
||||
static uint8_t* Vignettingaddress = nullptr;
|
||||
static uint8_t* Fogaddress = nullptr;
|
||||
static uint8_t* Cameraaddress = nullptr;
|
||||
//static uint8_t* UEConstructaddress = nullptr;
|
||||
static uint8_t* HUDaddress = nullptr;
|
||||
static uint8_t* SetAnchorsaddress = nullptr;
|
||||
|
||||
// Hooking
|
||||
@@ -75,10 +75,11 @@ static SafetyHookMid AspectHook{};
|
||||
static SafetyHookMid FogHook{};
|
||||
static SafetyHookMid CameraHook{};
|
||||
static SafetyHookMid HUDHook{};
|
||||
static SafetyHookMid HUDProcessEventHook{};
|
||||
|
||||
// HUD anchors
|
||||
static FAnchors HUDAnchors = {{ 0.f, 0.f }, { 0.f , 1.f }};
|
||||
static FAnchors TradeListAnchors = { { 0.2f, 0.f }, { 0.2f , 1.f } };
|
||||
static FAnchors referenceHUDAnchors = { { 0.25f, 0.f }, { 0.25f , 1.f } };
|
||||
static FAnchors defaultHUDAnchors = {{ 0.f, 0.f }, { 1.f, 1.f }}; // Will be displayed on all screen viewport
|
||||
|
||||
// Camera Mode
|
||||
@@ -89,14 +90,14 @@ enum class ECharlieCameraMode : uint8_t
|
||||
};
|
||||
|
||||
// Prototypes
|
||||
static void FOVFixEnabled(bool fix_enabled);
|
||||
static void AspectFixEnabled(bool fix_enabled);
|
||||
static void DOFFixEnabled(bool fix_enabled);
|
||||
static void CAFixEnabled(bool fix_enabled);
|
||||
static void VignettingFixEnabled(bool fix_enabled);
|
||||
static void FogFixEnabled(bool fix_enabled);
|
||||
static void CameraFixEnabled(bool fix_enabled, ECharlieCameraMode Mode);
|
||||
static void HUDFixEnabled(bool fix_enabled);
|
||||
static void FOVFixEnabled();
|
||||
static void AspectFixEnabled();
|
||||
static void DOFFixEnabled();
|
||||
static void CAFixEnabled();
|
||||
static void VignettingFixEnabled();
|
||||
static void FogFixEnabled();
|
||||
static void CameraFixEnabled(ECharlieCameraMode Mode);
|
||||
static void HUDFixEnabled();
|
||||
static void EnableConsole();
|
||||
|
||||
extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
@@ -223,21 +224,25 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
}
|
||||
}
|
||||
|
||||
//4C ?? ?? 55 57 41 ?? 41 ?? 41 ?? 49 8D ?? ?? ?? ?? ?? 48 81 ?? ?? ?? ?? ?? 48 8B ?? ?? ?? ?? ?? 48 ?? ?? 48 89 ?? ?? ?? ?? ?? 83 B9
|
||||
// 0x20
|
||||
//if (UEConstructaddress == nullptr) {
|
||||
// constexpr auto UEConstructStringObfuscated = make_obfuscated<0x4A>("4C ?? ?? 55 56 57 48 81 ?? ?? ?? ?? ?? 33 ?? 48 C7 ?? ?? ?? ?? ?? 48 ?? ?? 48 ?? ?? 48 C7 ?? ?? ?? ?? ?? ?? 39 B1 ?? ?? ?? ?? 0F 8E ?? ?? ?? ?? 0F B6");
|
||||
// UEConstructaddress = Memory::AOBScan(gameExecutable, UEConstructStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
if (HUDaddress == nullptr) { // Low level function involved in displaying Widgets in real time
|
||||
constexpr auto UEConstructStringObfuscated = make_obfuscated<0x4A>("44 0F ?? ?? ?? 74 ?? 48 8B ?? ?? ?? ?? ?? 48 85 ?? 74 ?? 48 8B");
|
||||
HUDaddress = Memory::AOBScan(gameExecutable, UEConstructStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
//"HellIsUs-Win64-Shipping.exe" + 1817760 - 0F11 4F 58 - movups[rdi + 58], xmm1
|
||||
//"HellIsUs-Win64-Shipping.exe" + 1817764 - 83 BF B8 00 00 00 00 - cmp dword ptr[rdi + HellIsUsCore.dtor_list_head + 88], 00
|
||||
//"HellIsUs-Win64-Shipping.exe" + 181776B - 44 0F 10 4F 48 - movups xmm9, [rdi + 48]
|
||||
//"HellIsUs-Win64-Shipping.exe" + 1817770 - 44 0F 10 57 58 - movups xmm10, [rdi + 58]
|
||||
//"HellIsUs-Win64-Shipping.exe" + 1817775 - 74 36 - je "HellIsUs-Win64-Shipping.exe" + 18177AD
|
||||
//"HellIsUs-Win64-Shipping.exe" + 1817777 - 48 8B 8F B0 00 00 00 - mov rcx, [rdi + HellIsUsCore.dtor_list_head + 80]
|
||||
|
||||
// if (!UEConstructaddress)
|
||||
// logger->warn("UEConstruct signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
// else {
|
||||
// logger->info("UEConstruct signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(UEConstructaddress));
|
||||
// //UEConstructaddress += 0x30;
|
||||
// }
|
||||
//}
|
||||
if (!HUDaddress)
|
||||
logger->warn("HUD signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
logger->info("HUD signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(HUDaddress));
|
||||
HUDaddress += 0x05;
|
||||
}
|
||||
}
|
||||
|
||||
if (FOVaddress && Aspectaddress && DOFaddress && CAaddress && Vignettingaddress && Fogaddress && Cameraaddress) {
|
||||
if (Aspectaddress && DOFaddress && CAaddress && Vignettingaddress && Fogaddress && Cameraaddress) {
|
||||
logger->info("All AOB signatures found. Ready to patch...");
|
||||
AOBScanDone = true;
|
||||
}
|
||||
@@ -293,81 +298,71 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
|
||||
logger->info("-------------- Fixes initialisation -------------");
|
||||
}
|
||||
if (g_fix_enabled) {
|
||||
if (FOVaddress) CameraFixEnabled(g_fov_fix_enabled, ECharlieCameraMode::FOV);
|
||||
if (Aspectaddress) AspectFixEnabled(g_aspect_fix_enabled);
|
||||
if (DOFaddress) DOFFixEnabled(g_DOF_fix_enabled);
|
||||
if (CAaddress) CAFixEnabled(g_CA_fix_enabled);
|
||||
if (Vignettingaddress) VignettingFixEnabled(g_Vignetting_fix_enabled);
|
||||
if (Fogaddress) FogFixEnabled(g_Fog_fix_enabled);
|
||||
if (Cameraaddress) CameraFixEnabled(g_Camera_fix_enabled, ECharlieCameraMode::Camera);
|
||||
if (GObjectsaddress && GNamesaddress && AppendStringaddress && ProcessEventaddress)
|
||||
HUDFixEnabled(g_HUD_fix_enabled);
|
||||
}
|
||||
else {
|
||||
if (FOVaddress) CameraFixEnabled(false, ECharlieCameraMode::FOV);
|
||||
if (Aspectaddress) AspectFixEnabled(false);
|
||||
if (DOFaddress) DOFFixEnabled(false);
|
||||
if (CAaddress) CAFixEnabled(false);
|
||||
if (Vignettingaddress) VignettingFixEnabled(false);
|
||||
if (Fogaddress) FogFixEnabled(false);
|
||||
if (Cameraaddress) CameraFixEnabled(false, ECharlieCameraMode::Camera);
|
||||
if (GObjectsaddress && GNamesaddress && AppendStringaddress && ProcessEventaddress)
|
||||
HUDFixEnabled(false);
|
||||
logger->info("All fixes disabled.");
|
||||
}
|
||||
if (!g_Console_Enabled && GObjectsaddress && GNamesaddress && AppendStringaddress && ProcessEventaddress) {
|
||||
|
||||
if (FOVaddress) FOVFixEnabled();
|
||||
if (Aspectaddress) AspectFixEnabled();
|
||||
if (Cameraaddress) CameraFixEnabled(ECharlieCameraMode::Camera);
|
||||
if (Cameraaddress) CameraFixEnabled(ECharlieCameraMode::FOV);
|
||||
if (DOFaddress) DOFFixEnabled();
|
||||
if (CAaddress) CAFixEnabled();
|
||||
if (Vignettingaddress) VignettingFixEnabled();
|
||||
if (Fogaddress) FogFixEnabled();
|
||||
if (GObjectsaddress && GNamesaddress && AppendStringaddress && ProcessEventaddress && HUDaddress)
|
||||
HUDFixEnabled();
|
||||
if (!g_Console_Enabled && GObjectsaddress && GNamesaddress && AppendStringaddress && ProcessEventaddress)
|
||||
EnableConsole();
|
||||
}
|
||||
}
|
||||
|
||||
// Setters for Reshade addon call
|
||||
extern "C" __declspec(dllexport) void SetFOVFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_fov_fix_enabled = enabled;
|
||||
if (!init) CameraFixEnabled(g_fov_fix_enabled, ECharlieCameraMode::FOV);
|
||||
if (!init) {
|
||||
FOVFixEnabled();
|
||||
CameraFixEnabled(ECharlieCameraMode::FOV);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetAspectRatioFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_aspect_fix_enabled = enabled;
|
||||
if (!init) AspectFixEnabled(g_aspect_fix_enabled);
|
||||
if (!init) AspectFixEnabled();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetDOFFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_DOF_fix_enabled = enabled;
|
||||
if (!init) DOFFixEnabled(g_DOF_fix_enabled);
|
||||
if (!init) DOFFixEnabled();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetCAFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_CA_fix_enabled = enabled;
|
||||
if (!init) CAFixEnabled(g_CA_fix_enabled);
|
||||
if (!init) CAFixEnabled();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetVignettingFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_Vignetting_fix_enabled = enabled;
|
||||
if (!init) VignettingFixEnabled(g_Vignetting_fix_enabled);
|
||||
if (!init) VignettingFixEnabled();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetFogFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_Fog_fix_enabled = enabled;
|
||||
if (!init) FogFixEnabled(g_Fog_fix_enabled);
|
||||
if (!init) FogFixEnabled();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetCameraFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_Camera_fix_enabled = enabled;
|
||||
if (!init) CameraFixEnabled(g_Camera_fix_enabled, ECharlieCameraMode::Camera);
|
||||
if (!init) CameraFixEnabled(ECharlieCameraMode::Camera);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetHUDFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_HUD_fix_enabled = enabled;
|
||||
if (!init) HUDFixEnabled(g_HUD_fix_enabled);
|
||||
if (!init) HUDFixEnabled();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetFOV(int fov)
|
||||
@@ -411,27 +406,23 @@ extern "C" __declspec(dllexport) bool GetConsoleEnabled() {
|
||||
|
||||
// Code injection functions
|
||||
// FOV compensation only
|
||||
static void FOVFixEnabled(bool fix_enabled) {
|
||||
if (g_fix_enabled && fix_enabled && FOVaddress != nullptr) {
|
||||
static void FOVFixEnabled() {
|
||||
if (FOVaddress) {
|
||||
if (!FOVHook) { // Hook only once
|
||||
FOVHook = safetyhook::create_mid(FOVaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
g_FOV_In = ctx.xmm0.f32[0];
|
||||
if (g_aspect_fix_enabled)
|
||||
g_Compensated_FOV = ctx.xmm0.f32[0] = Maths::CompensateHorizontalFOV(g_FOV_In, baseAspect, aspectRatio);
|
||||
else
|
||||
g_Compensated_FOV = ctx.xmm0.f32[0];
|
||||
g_Compensated_FOV = ctx.xmm0.f32[0];
|
||||
if (g_fix_enabled && g_aspect_fix_enabled)
|
||||
g_Compensated_FOV = ctx.xmm0.f32[0] = Maths::CompensateHorizontalFOV(g_FOV_In, BASE_ASPECT, aspectRatio);
|
||||
g_FOV_Out = ctx.xmm0.f32[0];
|
||||
});
|
||||
}
|
||||
else FOVHook.enable();
|
||||
}
|
||||
if (!fix_enabled && FOVHook)
|
||||
if (FOVHook) FOVHook.disable();
|
||||
}
|
||||
|
||||
static void AspectFixEnabled(bool fix_enabled) {
|
||||
if (g_fix_enabled && fix_enabled && Aspectaddress) {
|
||||
static void AspectFixEnabled() {
|
||||
if (g_fix_enabled && g_aspect_fix_enabled && Aspectaddress) {
|
||||
if (!AspectHook) {
|
||||
AspectHook = safetyhook::create_mid(Aspectaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
@@ -439,18 +430,17 @@ static void AspectFixEnabled(bool fix_enabled) {
|
||||
});
|
||||
}
|
||||
else AspectHook.enable();
|
||||
FOVFixEnabled(true);
|
||||
FOVFixEnabled();
|
||||
logger->info("Aspect fix enabled");
|
||||
}
|
||||
if (!fix_enabled) {
|
||||
if (!(g_fix_enabled && g_aspect_fix_enabled)) {
|
||||
if (AspectHook) AspectHook.disable();
|
||||
if (FOVHook && !g_fov_fix_enabled) FOVHook.disable();
|
||||
logger->info("Aspect ratio fix disabled");
|
||||
}
|
||||
}
|
||||
|
||||
static void CameraFixEnabled(bool fix_enabled, ECharlieCameraMode mode) {
|
||||
if (g_fix_enabled && fix_enabled && Cameraaddress) {
|
||||
// Controls FOV & camera height & distance
|
||||
static void CameraFixEnabled(ECharlieCameraMode mode) {
|
||||
if (Cameraaddress) {
|
||||
if (!CameraHook) { // Hook only once +0x4e or start to test +0x13
|
||||
CameraHook = safetyhook::create_mid(Cameraaddress + 0x4e,
|
||||
[](SafetyHookContext& ctx) {
|
||||
@@ -459,9 +449,10 @@ static void CameraFixEnabled(bool fix_enabled, ECharlieCameraMode mode) {
|
||||
auto* charlieCameraBaseConfig = reinterpret_cast<UCharlieCameraBaseConfig*>(ctx.rax);
|
||||
if (charlieCameraBaseConfig && charlieCameraBaseConfig->IsA(UCharlieCameraBaseConfig::StaticClass())) {
|
||||
// Camera height
|
||||
charlieCameraBaseConfig->DefaultHeightFromPlayer = (g_Camera_fix_enabled ? g_cameraHeight : DEFAULT_CAMERA_HEIGHT);
|
||||
charlieCameraBaseConfig->DefaultHeightFromPlayer = (g_fix_enabled && g_Camera_fix_enabled ? g_cameraHeight : DEFAULT_CAMERA_HEIGHT);
|
||||
// World FOV
|
||||
charlieCameraBaseConfig->FieldOfView = (g_fov_fix_enabled ? DEFAULT_WORLD_FOV + g_AdditionalFOVValue : DEFAULT_WORLD_FOV);
|
||||
charlieCameraBaseConfig->FieldOfView = DEFAULT_WORLD_FOV
|
||||
+ (g_fix_enabled && g_fov_fix_enabled ? g_AdditionalFOVValue : 0.f);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -476,12 +467,11 @@ static void CameraFixEnabled(bool fix_enabled, ECharlieCameraMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
static void HUDFixEnabled(bool fix_enabled) {
|
||||
if (g_fix_enabled && fix_enabled && ProcessEventaddress) {
|
||||
if (!HUDHook) {
|
||||
HUDHook = safetyhook::create_mid(ProcessEventaddress + 0xc,
|
||||
static void HUDFixEnabled() {
|
||||
if (ProcessEventaddress && HUDaddress) {
|
||||
if (!HUDProcessEventHook) {
|
||||
HUDProcessEventHook = safetyhook::create_mid(ProcessEventaddress + 0xc,
|
||||
[](SafetyHookContext& ctx) {
|
||||
auto original_rdx = ctx.r8;
|
||||
auto* object = reinterpret_cast<UObject*>(ctx.rcx);
|
||||
auto* function = reinterpret_cast<UFunction*>(ctx.rdx);
|
||||
// Filter object on Unreal User widgets
|
||||
@@ -499,62 +489,93 @@ static void HUDFixEnabled(bool fix_enabled) {
|
||||
|
||||
// Filter on class drawing HUD in game
|
||||
if (canvasSlot && className.contains("CombatHud_SUMG_C")) {
|
||||
if (g_HUD_fix_enabled)
|
||||
canvasSlot->SetAnchors(HUDAnchors);
|
||||
else
|
||||
canvasSlot->SetAnchors(defaultHUDAnchors);
|
||||
canvasSlot->SetAnchors(referenceHUDAnchors);
|
||||
// Taking benefity of ProcessEvent that is called at level init to call fog fix
|
||||
FogFixEnabled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!HUDHook) {
|
||||
HUDHook = safetyhook::create_mid(HUDaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
if (ctx.xmm9.f64[0] == referenceHUDAnchors.Minimum.X && ctx.xmm9.f64[1] == referenceHUDAnchors.Minimum.Y &&
|
||||
ctx.xmm10.f64[0] == referenceHUDAnchors.Maximum.X && ctx.xmm10.f64[1] == referenceHUDAnchors.Maximum.Y) {
|
||||
// Comparison between reference anchors previously set and the one retrieved here
|
||||
// This is to ensure the right Widget is targeted (CombatHud_SUMG_C)
|
||||
if (g_fix_enabled && g_HUD_fix_enabled) {
|
||||
ctx.xmm9.f64[0] = HUDAnchors.Minimum.X; ctx.xmm9.f64[1] = HUDAnchors.Minimum.Y;
|
||||
ctx.xmm10.f64[0] = HUDAnchors.Maximum.X; ctx.xmm10.f64[1] = HUDAnchors.Maximum.Y;
|
||||
}
|
||||
else {
|
||||
ctx.xmm9.f64[0] = defaultHUDAnchors.Minimum.X; ctx.xmm9.f64[1] = defaultHUDAnchors.Minimum.Y;
|
||||
ctx.xmm10.f64[0] = defaultHUDAnchors.Maximum.X; ctx.xmm10.f64[1] = defaultHUDAnchors.Maximum.Y;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (g_fix_enabled && g_HUD_fix_enabled)
|
||||
logger->info("HUD fix enabled");
|
||||
else logger->info("HUD fix disabled");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Memory patch fixes
|
||||
static void DOFFixEnabled(bool fix_enabled) {
|
||||
if (g_fix_enabled && fix_enabled && DOFaddress) {
|
||||
static void DOFFixEnabled() {
|
||||
if (g_fix_enabled && g_DOF_fix_enabled && DOFaddress) {
|
||||
Memory::PatchBytes(DOFaddress, "\x31\xF6\x90", 3); // xor esi,esi r.DepthOfFieldQuality = 0
|
||||
logger->info("Depth of field fix enabled");
|
||||
}
|
||||
if (!fix_enabled && DOFaddress) {
|
||||
if (!(g_fix_enabled && g_DOF_fix_enabled) && DOFaddress) {
|
||||
Memory::RestoreBytes(DOFaddress);
|
||||
logger->info("Depth of field fix disabled");
|
||||
}
|
||||
}
|
||||
|
||||
static void CAFixEnabled(bool fix_enabled) {
|
||||
if (g_CA_fix_enabled && fix_enabled && CAaddress) {
|
||||
static void CAFixEnabled() {
|
||||
if (g_fix_enabled && g_CA_fix_enabled && CAaddress) {
|
||||
Memory::PatchBytes(CAaddress, "\x90\x90", 2); // NOP jg "HellIsUs-Win64-Shipping.exe"+3D73BD5
|
||||
logger->info("Chromatics aberrations fix enabled");
|
||||
}
|
||||
if (!fix_enabled && CAaddress) {
|
||||
if (!(g_fix_enabled && g_CA_fix_enabled) && CAaddress) {
|
||||
Memory::RestoreBytes(CAaddress);
|
||||
logger->info("Chromatics aberrations fix disabled");
|
||||
}
|
||||
}
|
||||
|
||||
static void VignettingFixEnabled(bool fix_enabled) {
|
||||
if (g_fix_enabled && fix_enabled && Vignettingaddress) {
|
||||
static void VignettingFixEnabled() {
|
||||
if (g_fix_enabled && g_Vignetting_fix_enabled && Vignettingaddress) {
|
||||
Memory::PatchBytes(Vignettingaddress, "\x31\xC9", 2); // xor ecx,ecx r.Tonemapper.Quality=0
|
||||
logger->info("Vignetting fix enabled");
|
||||
}
|
||||
if (!fix_enabled && Vignettingaddress) {
|
||||
if (!(g_fix_enabled && g_Vignetting_fix_enabled) && Vignettingaddress) {
|
||||
Memory::RestoreBytes(Vignettingaddress);
|
||||
logger->info("Vignetting fix disabled");
|
||||
}
|
||||
}
|
||||
|
||||
static void FogFixEnabled(bool fix_enabled) {
|
||||
if (g_fix_enabled && fix_enabled && Fogaddress) {
|
||||
if (!FogHook) { // Hook only once
|
||||
FogHook = safetyhook::create_mid(Fogaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
ctx.rflags &= ~0x40; // ZF=0
|
||||
});
|
||||
static void FogFixEnabled() {
|
||||
UWorld* World = UWorld::GetWorld();
|
||||
if (!World) return; // World not ready ? Do nothing
|
||||
ULevel* Level = World->PersistentLevel;
|
||||
if (!Level) return;
|
||||
TArray<AActor*>& Actors = Level->Actors;
|
||||
|
||||
for (AActor* Actor : Actors) // Loop through Unreal Engine actors
|
||||
{
|
||||
if (Actor && Actor->IsA(AExponentialHeightFog::StaticClass())) {
|
||||
auto* fogActor = static_cast<AExponentialHeightFog*>(Actor);
|
||||
// Get final class that controls Fog
|
||||
if (auto* component = fogActor->GetComponentByClass(UExponentialHeightFogComponent::StaticClass())) {
|
||||
if (auto* fogComponent = static_cast<UExponentialHeightFogComponent*>(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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
logger->info("Fog fix enabled");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,7 +596,6 @@ static void EnableConsole()
|
||||
for (int i = 0; i < 100; ++i) { // gives 10 seconds to find UE Engine
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
Engine = UEngine::GetEngine();
|
||||
|
||||
if (Engine && Engine->ConsoleClass && Engine->GameViewport)
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user