Unnecessary variables removal

This commit is contained in:
2026-04-04 18:07:02 +02:00
parent a0a697307f
commit bc4f725a8f

View File

@@ -75,7 +75,7 @@ static SafetyHookMid UltraWideHook{};
// Prototypes // Prototypes
static void FOVFixEnabled(); static void FOVFixEnabled();
static void UltraWideFixEnabled(GameFixes fix); static void UltraWideFixEnabled();
static void CameraFixEnabled(); static void CameraFixEnabled();
static void CutscenesFPSFixEnabled(); static void CutscenesFPSFixEnabled();
static void HUDUpdate(bool writeLog); static void HUDUpdate(bool writeLog);
@@ -97,9 +97,6 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init) {
constexpr auto CutscenesFPS2StringObfuscated = make_obfuscated<0x0F>("0F 84 ?? ?? ?? ?? 48 8D ?? ?? ?? 48 89 ?? ?? ?? E8 ?? ?? ?? ?? 83 78"); constexpr auto CutscenesFPS2StringObfuscated = make_obfuscated<0x0F>("0F 84 ?? ?? ?? ?? 48 8D ?? ?? ?? 48 89 ?? ?? ?? E8 ?? ?? ?? ?? 83 78");
constexpr auto CameraStruct1StringObfuscated = make_obfuscated<0x48>("48 89 ?? ?? ?? 57 48 83 ?? ?? 0F ?? ?? 48 8B FA 48 ?? ?? 0F ?? ?? F2 0F 10"); constexpr auto CameraStruct1StringObfuscated = make_obfuscated<0x48>("48 89 ?? ?? ?? 57 48 83 ?? ?? 0F ?? ?? 48 8B FA 48 ?? ?? 0F ?? ?? F2 0F 10");
constexpr auto CameraStringObfuscated = make_obfuscated<0x28>("F2 0F 10 ?? ?? ?? 0F 28 ?? ?? ?? ?? ?? F2 0F ?? ?? ?? F2 0F ?? ?? ?? 0F ?? ?? 0F"); constexpr auto CameraStringObfuscated = make_obfuscated<0x28>("F2 0F 10 ?? ?? ?? 0F 28 ?? ?? ?? ?? ?? F2 0F ?? ?? ?? F2 0F ?? ?? ?? 0F ?? ?? 0F");
constexpr auto CAStringObfuscated = make_obfuscated<0x39>("7F ?? 44 89 ?? ?? ?? ?? ?? 43 8B ?? ?? 39 05 ?? ?? ?? ?? 0F 8F");
constexpr auto DOFStringObfuscated = make_obfuscated<0xC1>("8B ?? ?? 48 ?? ?? E8 ?? ?? ?? ?? 0F ?? ?? 48 6B ?? ?? 48 8D");
constexpr auto FogStringObfuscated = make_obfuscated<0x75>("74 ?? 48 8B ?? ?? ?? ?? ?? 83 ?? ?? ?? 75 ?? 40 ?? ?? EB ?? 40 ?? ?? 48 8B");
constexpr auto WorldTimeDilationStringObfuscated = make_obfuscated<0x59>("F3 0F 10 ?? ?? ?? ?? ?? F3 0F 59 ?? ?? ?? ?? ?? F3 0F 59 ?? ?? ?? ?? ?? C3"); constexpr auto WorldTimeDilationStringObfuscated = make_obfuscated<0x59>("F3 0F 10 ?? ?? ?? ?? ?? F3 0F 59 ?? ?? ?? ?? ?? F3 0F 59 ?? ?? ?? ?? ?? C3");
constexpr auto TimeDilationStringObfuscated = make_obfuscated<0x59>("F3 0F ?? ?? ?? EB ?? F3 0F ?? ?? ?? ?? ?? ?? 48 8B ?? ?? 4C ?? ?? F3 0F ?? ?? 44"); constexpr auto TimeDilationStringObfuscated = make_obfuscated<0x59>("F3 0F ?? ?? ?? EB ?? F3 0F ?? ?? ?? ?? ?? ?? 48 8B ?? ?? 4C ?? ?? F3 0F ?? ?? 44");
@@ -149,7 +146,7 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init) {
ProcessEvent(); ProcessEvent();
if (init) return; if (init) return;
FOVFixEnabled(); FOVFixEnabled();
UltraWideFixEnabled(GameFixes::UltraWide); UltraWideFixEnabled();
CutscenesFPSFixEnabled(); CutscenesFPSFixEnabled();
CameraFixEnabled(); CameraFixEnabled();
HUDUpdate(true); HUDUpdate(true);
@@ -166,7 +163,7 @@ extern "C" __declspec(dllexport) void SetFixesEnabled(GameFixes fix, bool enable
if (fix == GameFixes::SkipIntro) { g_SkipIntros_enabled = enabled; } if (fix == GameFixes::SkipIntro) { g_SkipIntros_enabled = enabled; }
if (fix == GameFixes::FOV) { g_fov_fix_enabled = enabled; FOVFixEnabled(); } if (fix == GameFixes::FOV) { g_fov_fix_enabled = enabled; FOVFixEnabled(); }
if (fix == GameFixes::Framerate) { g_CutscenesFPS_fix_enabled = enabled; CutscenesFPSFixEnabled(); } if (fix == GameFixes::Framerate) { g_CutscenesFPS_fix_enabled = enabled; CutscenesFPSFixEnabled(); }
if (fix == GameFixes::UltraWide) { g_ultrawide_fix_enabled = enabled; UltraWideFixEnabled(GameFixes::UltraWide); } if (fix == GameFixes::UltraWide) { g_ultrawide_fix_enabled = enabled; UltraWideFixEnabled(); }
if (fix == GameFixes::Camera) { g_camera_fix_enabled = enabled; CameraFixEnabled(); } if (fix == GameFixes::Camera) { g_camera_fix_enabled = enabled; CameraFixEnabled(); }
if (fix == GameFixes::HUD) { g_HUD_fix_enabled = enabled; HUDUpdate(true); } if (fix == GameFixes::HUD) { g_HUD_fix_enabled = enabled; HUDUpdate(true); }
if (fix == GameFixes::DOF) { g_DOF_fix_enabled = enabled; gPendingDOF = true; LogFixToggle(fix, bVisual); } if (fix == GameFixes::DOF) { g_DOF_fix_enabled = enabled; gPendingDOF = true; LogFixToggle(fix, bVisual); }
@@ -324,7 +321,7 @@ static void FOVFixEnabled() {
logger->info("FOV fix {}", g_fix_enabled && g_fov_fix_enabled ? "enabled" : "disabled"); logger->info("FOV fix {}", g_fix_enabled && g_fov_fix_enabled ? "enabled" : "disabled");
} }
static void UltraWideFixEnabled(GameFixes fix) { static void UltraWideFixEnabled() {
if (g_fix_enabled && g_ultrawide_fix_enabled && CameraComponentaddress && CameraStructaddress) { // Taken FROM UUU if (g_fix_enabled && g_ultrawide_fix_enabled && CameraComponentaddress && CameraStructaddress) { // Taken FROM UUU
if (!UltraWideHook) { // Hook only once if (!UltraWideHook) { // Hook only once
UltraWideHook = safetyhook::create_mid(CameraComponentaddress + 0x15, UltraWideHook = safetyhook::create_mid(CameraComponentaddress + 0x15,