Ultrawide fix is now revertible in real time
This commit is contained in:
@@ -58,6 +58,7 @@ static uint8_t* FPSaddress = nullptr;
|
|||||||
|
|
||||||
// Hooking
|
// Hooking
|
||||||
static SafetyHookMid FOVHook{};
|
static SafetyHookMid FOVHook{};
|
||||||
|
static SafetyHookMid UltraWideHook{};
|
||||||
static SafetyHookMid FPSHook{};
|
static SafetyHookMid FPSHook{};
|
||||||
static SafetyHookMid VignettingHook{};
|
static SafetyHookMid VignettingHook{};
|
||||||
static SafetyHookMid FogHook{};
|
static SafetyHookMid FogHook{};
|
||||||
@@ -88,7 +89,7 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!UltraWideaddress) {
|
if (!UltraWideaddress) {
|
||||||
constexpr auto AspectRatioAxisConstraintStringObfuscated = make_obfuscated<0x4A>("C7 80 ?? ?? ?? ?? 3B 8E E3 3F 48 8B");
|
constexpr auto AspectRatioAxisConstraintStringObfuscated = make_obfuscated<0x4A>("89 ?? ?? 0F B6 ?? ?? ?? ?? ?? 33 ?? ?? 83 ?? ?? 31 ?? ?? 0F B6");
|
||||||
UltraWideaddress = Memory::AOBScan("", AspectRatioAxisConstraintStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
UltraWideaddress = Memory::AOBScan("", AspectRatioAxisConstraintStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||||
|
|
||||||
if (!UltraWideaddress)
|
if (!UltraWideaddress)
|
||||||
@@ -256,6 +257,26 @@ static void FOVFixEnabled() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void UltraWideFixEnabled() {
|
||||||
|
if (g_fix_enabled && g_ultrawide_fix_enabled && UltraWideaddress) {
|
||||||
|
if (!UltraWideHook) {
|
||||||
|
UltraWideHook = safetyhook::create_mid(UltraWideaddress,
|
||||||
|
[](SafetyHookContext& ctx) {
|
||||||
|
ctx.rax = *(uint32_t*)&aspectRatio;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else UltraWideHook.enable();
|
||||||
|
logger->info("Ultrawide fix enabled");
|
||||||
|
FOVFixEnabled();
|
||||||
|
}
|
||||||
|
if (!(g_fix_enabled && g_ultrawide_fix_enabled) && UltraWideaddress) {
|
||||||
|
if (UltraWideHook) UltraWideHook.disable();
|
||||||
|
logger->info("Ultrawide fix disabled");
|
||||||
|
if (!g_fov_fix_enabled) FOVFixEnabled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void VignettingFixEnabled() {
|
static void VignettingFixEnabled() {
|
||||||
if (g_fix_enabled && g_Vignetting_fix_enabled && Vignettingaddress) {
|
if (g_fix_enabled && g_Vignetting_fix_enabled && Vignettingaddress) {
|
||||||
if (!VignettingHook) { // Hook only once
|
if (!VignettingHook) { // Hook only once
|
||||||
@@ -308,21 +329,6 @@ static void FPSFixEnabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Memory patch fixes
|
// Memory patch fixes
|
||||||
static void UltraWideFixEnabled() {
|
|
||||||
if (g_fix_enabled && g_ultrawide_fix_enabled && UltraWideaddress) {
|
|
||||||
const char* newAspectRatio = Memory::Float32ToHexBytes(aspectRatio); // Converts new apsect ratio in 4 char bytes
|
|
||||||
Memory::PatchBytes(UltraWideaddress + 0x6, newAspectRatio, 4); // mov [rax+00000208],3FE38E3B <= patched
|
|
||||||
logger->info("Ultrawide fix enabled");
|
|
||||||
FOVFixEnabled();
|
|
||||||
}
|
|
||||||
if (!(g_fix_enabled && g_ultrawide_fix_enabled) && UltraWideaddress) {
|
|
||||||
Memory::RestoreBytes(UltraWideaddress + 0x6);
|
|
||||||
logger->info("Ultrawide fix disabled");
|
|
||||||
if (!g_fov_fix_enabled)
|
|
||||||
FOVFixEnabled();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DOFFixEnabled() { // Depth of field (bokeh)
|
static void DOFFixEnabled() { // Depth of field (bokeh)
|
||||||
if (g_fix_enabled && g_DOF_fix_enabled && DOFaddress) {
|
if (g_fix_enabled && g_DOF_fix_enabled && DOFaddress) {
|
||||||
Memory::PatchBytes(DOFaddress, "\x31\xFF\x90", 3); // xor edi,edi r.DepthOfFieldQuality = 0
|
Memory::PatchBytes(DOFaddress, "\x31\xFF\x90", 3); // xor edi,edi r.DepthOfFieldQuality = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user