Made the fixes work with final game release
This commit is contained in:
@@ -72,6 +72,8 @@ static void ProcessEvent();
|
||||
extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init) {
|
||||
g_fix_enabled = enabled;
|
||||
if (!AOBScanDone) { // Unreal Engine 5.4.4
|
||||
logger = InitializeLogger("Darwin's Paradox", PLUGIN_LOG);
|
||||
logger->info("Plugin {} loaded.", PLUGIN_NAME);
|
||||
logger->info("--------------- AOB scan started ---------------");
|
||||
constexpr auto CameraComponentStringObfuscated = make_obfuscated<0xF3>("EB ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? 8B 83");
|
||||
constexpr auto DOFStringObfuscated = make_obfuscated<0xC1>("8B ?? ?? 48 ?? ?? E8 ?? ?? ?? ?? 0F ?? ?? 48 6B ?? ?? 48 8D");
|
||||
@@ -121,17 +123,14 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init) {
|
||||
AOBScanDone = true;
|
||||
}
|
||||
|
||||
if (!init && CameraComponentaddress) FOVFixEnabled();
|
||||
if (!init && CameraComponentaddress) UltraWideFixEnabled();
|
||||
if (!init && DOFaddress) DOFFixEnabled();
|
||||
if (!init && CAaddress) CAFixEnabled();
|
||||
if (!init && Vignettingaddress) VignettingFixEnabled();
|
||||
if (!init && Fogaddress) FogFixEnabled();
|
||||
if (!init && WorldTimedilationaddress) {
|
||||
EnableCheats(Cheat::TimeDilation);
|
||||
EnableCheats(Cheat::Stealth);
|
||||
}
|
||||
ProcessEvent();
|
||||
if (init) return;
|
||||
FOVFixEnabled();
|
||||
UltraWideFixEnabled();
|
||||
DOFFixEnabled();
|
||||
CAFixEnabled();
|
||||
VignettingFixEnabled();
|
||||
FogFixEnabled();
|
||||
}
|
||||
|
||||
// Setters for Reshade addon call
|
||||
@@ -183,7 +182,8 @@ static void ProcessEvent() {
|
||||
}
|
||||
|
||||
static void FOVFixEnabled() {
|
||||
if (g_fix_enabled && g_fov_fix_enabled && CameraComponentaddress) {
|
||||
if (!CameraComponentaddress) return;
|
||||
if (g_fix_enabled && g_fov_fix_enabled) {
|
||||
if (!FOVHook) { // Hook only once
|
||||
FOVHook = safetyhook::create_mid(CameraComponentaddress + 0xa,
|
||||
[](SafetyHookContext& ctx) {
|
||||
@@ -193,7 +193,6 @@ static void FOVFixEnabled() {
|
||||
UZGameplayStatics::UnlockFOV(world);
|
||||
if (UZGameplayStatics::IsInCinematicMode(world)) return;
|
||||
}
|
||||
|
||||
g_FOV_In = ctx.xmm0.f32[0];
|
||||
ctx.xmm0.f32[0] += (g_fix_enabled && g_fov_fix_enabled ? g_AdditionalFOVValue : 0);
|
||||
g_FOV_Out = ctx.xmm0.f32[0];
|
||||
@@ -201,8 +200,7 @@ static void FOVFixEnabled() {
|
||||
}
|
||||
else FOVHook.enable();
|
||||
}
|
||||
if (!(g_fix_enabled && g_fov_fix_enabled) && CameraComponentaddress)
|
||||
if (FOVHook) FOVHook.disable();
|
||||
else if (FOVHook) FOVHook.disable();
|
||||
|
||||
logger->info("FOV fix {}", g_fix_enabled && g_fov_fix_enabled ? "enabled" : "disabled");
|
||||
}
|
||||
@@ -228,7 +226,6 @@ static void EnableCheats(Cheat cheat) {
|
||||
AZCharacter* character = static_cast<AZCharacter*>(object);
|
||||
if (g_Stealth_fix_enabled) {
|
||||
if (character->SensingComponent) {
|
||||
//character->SensingComponent->SetEnabled(false);
|
||||
character->SensingComponent->ResetSensing();
|
||||
character->SensingComponent->SetSensingLOD(ESensingLOD::None);
|
||||
}
|
||||
@@ -243,56 +240,48 @@ static void EnableCheats(Cheat cheat) {
|
||||
|
||||
// Memory patch fixes
|
||||
static void UltraWideFixEnabled() {
|
||||
if (g_fix_enabled && g_ultrawide_fix_enabled && CameraComponentaddress)
|
||||
if (!CameraComponentaddress) return;
|
||||
if (g_fix_enabled && g_ultrawide_fix_enabled)
|
||||
Memory::PatchBytes(CameraComponentaddress + 0x18, "\x31\xC9\x90\x90\x90\x90\x90", 7); // bConstrainAspectRatio = 0
|
||||
if (!(g_fix_enabled && g_ultrawide_fix_enabled) && CameraComponentaddress)
|
||||
Memory::RestoreBytes(CameraComponentaddress + 0x18);
|
||||
else Memory::RestoreBytes(CameraComponentaddress + 0x18);
|
||||
|
||||
logger->info("Ultrawide fix {}", g_fix_enabled && g_ultrawide_fix_enabled ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
static void DOFFixEnabled() {
|
||||
if (g_fix_enabled && g_DOF_fix_enabled && DOFaddress) {
|
||||
if (!DOFaddress) return;
|
||||
if (g_fix_enabled && g_DOF_fix_enabled)
|
||||
Memory::PatchBytes(DOFaddress, "\x31\xFF\x90", 3); // xor edi,edi r.DepthOfFieldQuality = 0
|
||||
logger->info("Depth of field fix enabled");
|
||||
}
|
||||
if (!(g_fix_enabled && g_DOF_fix_enabled) && DOFaddress) {
|
||||
Memory::RestoreBytes(DOFaddress);
|
||||
logger->info("Depth of field fix disabled");
|
||||
}
|
||||
else Memory::RestoreBytes(DOFaddress);
|
||||
|
||||
logger->info("Depth of field fix {}", g_fix_enabled && g_DOF_fix_enabled ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
static void CAFixEnabled() {
|
||||
if (g_fix_enabled && g_CA_fix_enabled && CAaddress) {
|
||||
if (!CAaddress) return;
|
||||
if (g_fix_enabled && g_CA_fix_enabled)
|
||||
Memory::PatchBytes(CAaddress, "\x90\x90", 2); // NOP x 2 r.SceneColorFringeQuality = 0
|
||||
logger->info("Chromatics aberrations fix enabled");
|
||||
}
|
||||
if (!(g_fix_enabled && g_CA_fix_enabled) && CAaddress) {
|
||||
Memory::RestoreBytes(CAaddress);
|
||||
logger->info("Chromatics aberrations fix disabled");
|
||||
}
|
||||
else Memory::RestoreBytes(CAaddress);
|
||||
|
||||
logger->info("Chromatics aberrations fix {}", g_fix_enabled && g_CA_fix_enabled ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
static void VignettingFixEnabled() {
|
||||
if (g_fix_enabled && g_Vignetting_fix_enabled && Vignettingaddress) {
|
||||
if (!Vignettingaddress) return;
|
||||
if (g_fix_enabled && g_Vignetting_fix_enabled)
|
||||
Memory::PatchBytes(Vignettingaddress, "\x31\xC9", 2); // xor ecx,ecx r.Tonemapper.Quality=0
|
||||
logger->info("Vignetting fix enabled");
|
||||
}
|
||||
if (!(g_fix_enabled && g_Vignetting_fix_enabled) && Vignettingaddress) {
|
||||
Memory::RestoreBytes(Vignettingaddress);
|
||||
logger->info("Vignetting fix disabled");
|
||||
}
|
||||
else Memory::RestoreBytes(Vignettingaddress);
|
||||
|
||||
logger->info("Vignetting fix disabled", g_fix_enabled && g_CA_fix_enabled ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
static void FogFixEnabled() {
|
||||
if (g_fix_enabled && g_Fog_fix_enabled && Fogaddress) {
|
||||
if (!Fogaddress) return;
|
||||
if (g_fix_enabled && g_Fog_fix_enabled)
|
||||
Memory::PatchBytes(Fogaddress, "\xEB", 1); // jmp -> r.Fog 0
|
||||
logger->info("Fog fix enabled");
|
||||
}
|
||||
if (!(g_fix_enabled && g_Fog_fix_enabled) && Fogaddress) {
|
||||
Memory::RestoreBytes(Fogaddress);
|
||||
logger->info("Fog fix disabled");
|
||||
}
|
||||
else Memory::RestoreBytes(Fogaddress);
|
||||
|
||||
logger->info("Fog fix disabled", g_fix_enabled && g_Fog_fix_enabled ? "enabled" : "disabled");
|
||||
}
|
||||
// UE Console creation
|
||||
static void EnableConsole() {
|
||||
@@ -309,11 +298,7 @@ static void EnableConsole() {
|
||||
}
|
||||
// Standard dll entry
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID) {
|
||||
if (reason == DLL_PROCESS_ATTACH) {
|
||||
logger = InitializeLogger("Darwin's Paradox", PLUGIN_LOG);
|
||||
logger->info("Plugin {} loaded.", PLUGIN_NAME);
|
||||
}
|
||||
else if (reason == DLL_PROCESS_DETACH) {
|
||||
if (reason == DLL_PROCESS_DETACH) {
|
||||
logger->info("Plugin {} unloaded.", PLUGIN_NAME);
|
||||
spdlog::drop_all();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user