Code refactoring
This commit is contained in:
@@ -7,11 +7,13 @@
|
||||
#include "Memory.hpp"
|
||||
#include "Maths.hpp"
|
||||
#include "UEngine.hpp"
|
||||
#include "UEMath.hpp"
|
||||
#include "SDK/Basic.hpp"
|
||||
#include "SDK/Engine_classes.hpp"
|
||||
#include "SDK/Phoenix_classes.hpp"
|
||||
|
||||
using namespace SDK;
|
||||
using namespace UEMath;
|
||||
|
||||
// Constants
|
||||
const std::string PLUGIN_NAME = "TheCallistoProtocol";
|
||||
@@ -119,88 +121,33 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_fix_enabled = enabled;
|
||||
if (g_fix_enabled && !AOBScanDone) { // Unreal Engine 4.27.2
|
||||
uint8_t* baseModule = reinterpret_cast<uint8_t*>(GetModuleHandleA(nullptr)); // Get game base address
|
||||
logger->info("--------------- AOB scan started ---------------");
|
||||
if (!FOVaddress) {
|
||||
constexpr auto FOVStringObfuscated = make_obfuscated<0x4A>("EB ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? 8B");
|
||||
FOVaddress = Memory::AOBScan("", FOVStringObfuscated.decrypt(), PAGE_EXECUTE_READ, logger);
|
||||
|
||||
if (!FOVaddress)
|
||||
logger->warn("FOV signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
logger->info("FOV signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(FOVaddress));
|
||||
ConstrainAspectaddress = FOVaddress + 0x25;
|
||||
}
|
||||
}
|
||||
using AOBScan::Make;
|
||||
using OffsetScan::Make;
|
||||
|
||||
if (!Cameraaddress) {
|
||||
constexpr auto CameraStringObfuscated = make_obfuscated<0x4A>("49 8B ?? ?? ?? ?? ?? 48 ?? ?? 74 ?? 48 8D ?? ?? ?? E8 ?? ?? ?? ?? 49 8B ?? ?? ?? ?? ?? EB");
|
||||
Cameraaddress = Memory::AOBScan("", CameraStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!Cameraaddress)
|
||||
logger->warn("Camera signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else
|
||||
logger->info("Camera signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(Cameraaddress));
|
||||
}
|
||||
|
||||
if (!SetBenchmarkModeaddress) {
|
||||
constexpr auto BenchMarkStringObfuscated = make_obfuscated<0x4A>("88 86 58 03 ?? ?? 48 8B ?? ?? ?? 48 83 ?? ?? 5F C3");
|
||||
SetBenchmarkModeaddress = Memory::AOBScan("", BenchMarkStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!SetBenchmarkModeaddress)
|
||||
logger->warn("Set BenchMark mode signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else
|
||||
logger->info("Set BenchMark mode signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(SetBenchmarkModeaddress));
|
||||
}
|
||||
|
||||
if (!HUDaddress) {
|
||||
constexpr auto HUDStringObfuscated = make_obfuscated<0x4A>("FF ?? 48 8B ?? ?? ?? 0F ?? ?? 48 ?? ?? 0F ?? ?? 48 83");
|
||||
HUDaddress = Memory::AOBScan("", HUDStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
if (!CAaddress) {
|
||||
constexpr auto CAStringObfuscated = make_obfuscated<0x4A>("7F ?? 89 B3 ?? ?? ?? ?? 8B ?? ?? 39 05 ?? ?? ?? ?? 0F");
|
||||
CAaddress = Memory::AOBScan("", CAStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!CAaddress)
|
||||
logger->warn("Chromatic aberrations signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else
|
||||
logger->info("Chromatic aberrations signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(CAaddress));
|
||||
}
|
||||
|
||||
if (!Vignettingaddress) {
|
||||
constexpr auto VignettingStringObfuscated = make_obfuscated<0x4A>("8B ?? 83 ?? ?? 7D ?? 89 B3");
|
||||
Vignettingaddress = Memory::AOBScan("", VignettingStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!Vignettingaddress)
|
||||
logger->warn("Vignetting signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else
|
||||
logger->info("Vignetting signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(Vignettingaddress));
|
||||
}
|
||||
|
||||
if (!Fogaddress) {
|
||||
constexpr auto FogStringObfuscated = make_obfuscated<0x4A>("83 ?? ?? ?? 75 ?? B3 ?? EB ?? 32 ?? 48 8B ?? ?? ?? 48 ?? ?? 74 ?? E8");
|
||||
Fogaddress = Memory::AOBScan("", FogStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!Fogaddress)
|
||||
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<uintptr_t>(Fogaddress));
|
||||
}
|
||||
|
||||
if (!WorldTimedilationaddress) {
|
||||
constexpr auto WorldTimeDilationStringObfuscated = make_obfuscated<0x4A>("F3 0F 10 ?? ?? ?? ?? ?? F3 0F 10 ?? ?? ?? ?? ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? C3");
|
||||
WorldTimedilationaddress = Memory::AOBScan("", WorldTimeDilationStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!WorldTimedilationaddress)
|
||||
logger->warn("World time dilation signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else
|
||||
logger->info("World time dilation signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(WorldTimedilationaddress));
|
||||
}
|
||||
constexpr auto FOVStringObfuscated = make_obfuscated<0x4A>("EB ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? 8B");
|
||||
constexpr auto CameraStringObfuscated = make_obfuscated<0x2F>("49 8B ?? ?? ?? ?? ?? 48 ?? ?? 74 ?? 48 8D ?? ?? ?? E8 ?? ?? ?? ?? 49 8B ?? ?? ?? ?? ?? EB");
|
||||
constexpr auto BenchMarkStringObfuscated = make_obfuscated<0xC3>("88 86 58 03 ?? ?? 48 8B ?? ?? ?? 48 83 ?? ?? 5F C3");
|
||||
constexpr auto HUDStringObfuscated = make_obfuscated<0x8A>("FF ?? 48 8B ?? ?? ?? 0F ?? ?? 48 ?? ?? 0F ?? ?? 48 83");
|
||||
constexpr auto CAStringObfuscated = make_obfuscated<0xFC>("7F ?? 89 B3 ?? ?? ?? ?? 8B ?? ?? 39 05 ?? ?? ?? ?? 0F");
|
||||
constexpr auto VignettingStringObfuscated = make_obfuscated<0x97>("8B ?? 83 ?? ?? 7D ?? 89 B3");
|
||||
constexpr auto FogStringObfuscated = make_obfuscated<0x46>("83 ?? ?? ?? 75 ?? B3 ?? EB ?? 32 ?? 48 8B ?? ?? ?? 48 ?? ?? 74 ?? E8");
|
||||
constexpr auto WorldTimeDilationStringObfuscated = make_obfuscated<0x6E>("F3 0F 10 ?? ?? ?? ?? ?? F3 0F 10 ?? ?? ?? ?? ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? C3");
|
||||
// Prepare all data for scanning
|
||||
std::vector<AOBScanEntry> signatures = {
|
||||
Make(&FOVaddress, FOVStringObfuscated, "FOV"),
|
||||
Make(&Cameraaddress, CameraStringObfuscated, "Camera"),
|
||||
Make(&SetBenchmarkModeaddress, BenchMarkStringObfuscated, "Set Benchmark mode"),
|
||||
Make(&HUDaddress, HUDStringObfuscated, "HUD"),
|
||||
Make(&CAaddress, CAStringObfuscated, "Chromatic aberrations"),
|
||||
Make(&Vignettingaddress, VignettingStringObfuscated, "Vignetting"),
|
||||
Make(&Fogaddress, FogStringObfuscated, "Fog"),
|
||||
Make(&WorldTimedilationaddress, WorldTimeDilationStringObfuscated, "World time dilation")
|
||||
};
|
||||
// Scan all signature in a batch
|
||||
Memory::AOBScanBatch(signatures, logger);
|
||||
|
||||
if (FOVaddress && Cameraaddress && SetBenchmarkModeaddress && HUDaddress &&
|
||||
CAaddress && Vignettingaddress && Fogaddress && WorldTimedilationaddress)
|
||||
@@ -210,55 +157,22 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init)
|
||||
|
||||
if (!GObjectsaddress || !AppendStringaddress || !ProcessEventaddress) {
|
||||
logger->info("------------ UEngine offsets search ------------");
|
||||
uint8_t* baseModule = reinterpret_cast<uint8_t*>(GetModuleHandleA(nullptr)); // Get game base address
|
||||
|
||||
constexpr auto GWorldStringObfuscated = make_obfuscated<0x4A>("48 8B ?? ?? ?? ?? ?? 48 ?? ?? 74 ?? 48 ?? ?? E8 ?? ?? ?? ?? 83 ?? ?? 74");
|
||||
GWorldaddress = Memory::AOBScan("", GWorldStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
constexpr auto GObjetcsStringObfuscated = make_obfuscated<0x4A>("48 8B ?? ?? ?? ?? ?? 48 8B ?? ?? 48 8D ?? ?? EB ?? 33");
|
||||
GObjectsaddress = Memory::AOBScan("", GObjetcsStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
constexpr auto AppendStringStringObfuscated = make_obfuscated<0x4A>("48 89 ?? ?? ?? 48 89 ?? ?? ?? 57 48 ?? ?? ?? 8B ?? 48 ?? ?? 8B ?? 44 ?? ?? ?? C1 ?? ?? 48 ?? ?? 80 3D ?? ?? ?? ?? ?? 89 ?? ?? ?? 44 89 ?? ?? ?? 74 ?? 4C 8D ?? ?? ?? ?? ?? EB ?? 48 8D ?? ?? ?? ?? ?? E8 ?? ?? ?? ?? 4C ?? ?? C6 05 ?? ?? ?? ?? ?? 48 8B ?? ?? ?? 48 ?? ?? 48 ?? ?? ?? 8D ?? ?? 49 03 ?? ?? ?? E8 ?? ?? ?? ?? 83");
|
||||
AppendStringaddress = Memory::AOBScan("", AppendStringStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
constexpr auto ProcessEventStringObfuscated = make_obfuscated<0x4A>("40 ?? 56 57 41 ?? 41 ?? 41 ?? 41 ?? 48 81 ?? ?? ?? ?? ?? 48 8D ?? ?? ?? 48 89 ?? ?? ?? ?? ?? 48 8B ?? ?? ?? ?? ?? 48 ?? ?? 48 89 ?? ?? ?? ?? ?? 8B");
|
||||
ProcessEventaddress = Memory::AOBScan("", ProcessEventStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
constexpr auto GWorldStringObfuscated = make_obfuscated<0xCA>("48 8B ?? ?? ?? ?? ?? 48 ?? ?? 74 ?? 48 ?? ?? E8 ?? ?? ?? ?? 83 ?? ?? 74");
|
||||
constexpr auto GObjetcsStringObfuscated = make_obfuscated<0x87>("48 8B ?? ?? ?? ?? ?? 48 8B ?? ?? 48 8D ?? ?? EB ?? 33");
|
||||
constexpr auto AppendStringStringObfuscated = make_obfuscated<0x32>("48 89 ?? ?? ?? 48 89 ?? ?? ?? 57 48 ?? ?? ?? 8B ?? 48 ?? ?? 8B ?? 44 ?? ?? ?? C1 ?? ?? 48 ?? ?? 80 3D ?? ?? ?? ?? ?? 89 ?? ?? ?? 44 89 ?? ?? ?? 74 ?? 4C 8D ?? ?? ?? ?? ?? EB ?? 48 8D ?? ?? ?? ?? ?? E8 ?? ?? ?? ?? 4C ?? ?? C6 05 ?? ?? ?? ?? ?? 48 8B ?? ?? ?? 48 ?? ?? 48 ?? ?? ?? 8D ?? ?? 49 03 ?? ?? ?? E8 ?? ?? ?? ?? 83");
|
||||
constexpr auto ProcessEventStringObfuscated = make_obfuscated<0xAC>("40 ?? 56 57 41 ?? 41 ?? 41 ?? 41 ?? 48 81 ?? ?? ?? ?? ?? 48 8D ?? ?? ?? 48 89 ?? ?? ?? ?? ?? 48 8B ?? ?? ?? ?? ?? 48 ?? ?? 48 89 ?? ?? ?? ?? ?? 8B");
|
||||
// Prepare all data for scanning
|
||||
std::vector<OffsetScanEntry> UEoffsetsScans = {
|
||||
Make(&GWorldaddress, GWorldStringObfuscated, "GWorld", OffsetCalcType::GetOffsetFromOpcode, &Offsets::GWorld, 0x3),
|
||||
Make(&GObjectsaddress, GObjetcsStringObfuscated, "GObjects", OffsetCalcType::GetOffsetFromOpcode, &Offsets::GObjects, 0x3),
|
||||
Make(&AppendStringaddress, AppendStringStringObfuscated, "AppendString", OffsetCalcType::UE_CalculateOffset, &Offsets::AppendString),
|
||||
Make(&ProcessEventaddress, ProcessEventStringObfuscated, "ProcessEvent", OffsetCalcType::UE_CalculateOffset, &Offsets::ProcessEvent)
|
||||
};
|
||||
// Retrieve all Unreal Engine offsets in a batch
|
||||
Memory::OffsetScanBatch(UEoffsetsScans, baseModule, logger, "");
|
||||
|
||||
if (!GWorldaddress)
|
||||
logger->warn("GWorld signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
uint32_t gWorldOffset = static_cast<uint32_t>(Memory::GetOffsetFromOpcode(GWorldaddress + 0x3) -
|
||||
baseModule);
|
||||
logger->info("GWorld offset is: 0x{:X}.", gWorldOffset);
|
||||
Offsets::GWorld = static_cast<UC::uint32>(gWorldOffset); // Update GWorld offset
|
||||
}
|
||||
|
||||
if (!GObjectsaddress)
|
||||
logger->warn("GObjects signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
uint32_t gObjectsOffset = static_cast<uint32_t>(Memory::GetOffsetFromOpcode(GObjectsaddress + 0x3) -
|
||||
baseModule);
|
||||
logger->info("GObjects offset is: 0x{:X}.", gObjectsOffset);
|
||||
Offsets::GObjects = static_cast<UC::uint32>(gObjectsOffset); // Update GObjects offset
|
||||
}
|
||||
|
||||
if (!AppendStringaddress)
|
||||
logger->warn("AppendString signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
std::optional<uint32_t> gAppendStringOffsetOpt = UE::CalculateOffset("", AppendStringaddress); // Get Offset from opcode
|
||||
uint32_t gAppendStringOffset = *gAppendStringOffsetOpt;
|
||||
logger->info("AppendString offset is: 0x{:X}.", gAppendStringOffset);
|
||||
Offsets::AppendString = static_cast<UC::uint32>(gAppendStringOffset); // Update AppendString offset
|
||||
}
|
||||
|
||||
if (!ProcessEventaddress)
|
||||
logger->warn("Process Event signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
std::optional<uint32_t> gProcessEventOffsetOpt = UE::CalculateOffset("", ProcessEventaddress);
|
||||
uint32_t gProcessEventOffset = *gProcessEventOffsetOpt;
|
||||
logger->info("Process Event offset is: 0x{:X}.", gProcessEventOffset);
|
||||
Offsets::ProcessEvent = static_cast<UC::uint32>(gProcessEventOffset);// Update ProcessEvent offset
|
||||
}
|
||||
|
||||
if (!init)
|
||||
logger->info("-------------- Fixes initialisation -------------");
|
||||
if (!init) logger->info("-------------- Fixes initialisation -------------");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +186,7 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init)
|
||||
if (!init && Fogaddress) FogFixEnabled();
|
||||
if (!init && WorldTimedilationaddress) TimeDilation();
|
||||
if (!init && GObjectsaddress && AppendStringaddress && ProcessEventaddress) EnableConsole();
|
||||
if (ConstrainAspectaddress) UltraWideFixEnabled();
|
||||
if (FOVaddress) UltraWideFixEnabled();
|
||||
}
|
||||
|
||||
// Setters for Reshade addon call
|
||||
@@ -314,25 +228,6 @@ extern "C" __declspec(dllexport) void SetCameraSmoothness(float smoothness) {
|
||||
}
|
||||
|
||||
// Unreal Engine functions
|
||||
/**
|
||||
* @brief Converts a rotator (Pitch, Yaw) to a forward direction vector.
|
||||
* Computes a normalized forward vector from the given FRotator,
|
||||
* using Pitch and Yaw angles (in degrees).
|
||||
* @param rotator Input rotation (degrees).
|
||||
* @return Forward direction vector.
|
||||
*/
|
||||
static FVector RotatorToForwardVector(const FRotator& rotator)
|
||||
{
|
||||
const float DEG_TO_RAD = 3.1415926535f / 180.0f;
|
||||
|
||||
float cp = cosf(rotator.Pitch * DEG_TO_RAD);
|
||||
float sp = sinf(rotator.Pitch * DEG_TO_RAD);
|
||||
float cy = cosf(rotator.Yaw * DEG_TO_RAD);
|
||||
float sy = sinf(rotator.Yaw * DEG_TO_RAD);
|
||||
|
||||
return FVector(cp * cy, cp * sy, sp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the current player Pawn from the world.
|
||||
* @param world Optional UWorld pointer.
|
||||
@@ -450,8 +345,10 @@ static void CameraFixEnabled() {
|
||||
FVector pawnPos = pawn->K2_GetActorLocation();
|
||||
FVector engineCamPos = cameraParams->ViewLocation;
|
||||
// --- Camera direction ---
|
||||
FVector forward = RotatorToForwardVector(cameraParams->ViewRotation);
|
||||
FVector backward = forward * -1.f;
|
||||
Vector forward = RotatorToForwardVector(*reinterpret_cast<Rotator*>(&cameraParams->ViewRotation));
|
||||
// Transform own vector into UE SDK vector
|
||||
FVector forwardVector { forward.X , forward.Y, forward.Z };
|
||||
FVector backward = forwardVector * -1.f;
|
||||
// --- ENGINE OFFSET (full) ---
|
||||
FVector engineOffset = engineCamPos - pawnPos;
|
||||
// --- DECOMPOSE OFFSET ---
|
||||
@@ -459,12 +356,11 @@ static void CameraFixEnabled() {
|
||||
float engineBackDist = engineOffset.Dot(backward);
|
||||
g_NativeCameraDistance = engineBackDist;
|
||||
FVector backComponent = backward * engineBackDist;
|
||||
|
||||
// No need to set camera offset in these modes
|
||||
if (bIsInBenchmarkMode || bIsInCinematicMode || bIsAiming) return;
|
||||
|
||||
// What we KEEP (height + lateral)
|
||||
FVector preservedOffset = engineOffset - backComponent;
|
||||
|
||||
// --- Desired corrected distance ---
|
||||
float maxDistance = g_TransitionCameraOffset;
|
||||
FVector traceStart = pawnPos /*+ preservedOffset*/;
|
||||
@@ -476,16 +372,11 @@ static void CameraFixEnabled() {
|
||||
float radius = 12.f;
|
||||
|
||||
bool bHit = UKismetSystemLibrary::SphereTraceMulti(
|
||||
object,
|
||||
traceStart,
|
||||
traceEnd,
|
||||
radius,
|
||||
object, traceStart, traceEnd, radius,
|
||||
ETraceTypeQuery::TraceTypeQuery2, // camera channel
|
||||
true,
|
||||
ignoreActors,
|
||||
true, ignoreActors,
|
||||
EDrawDebugTrace::None,
|
||||
&hits,
|
||||
true,
|
||||
&hits, true,
|
||||
FLinearColor(1, 0, 0, 1),
|
||||
FLinearColor(0, 1, 0, 1),
|
||||
0.f);
|
||||
@@ -493,13 +384,11 @@ static void CameraFixEnabled() {
|
||||
// --- Compute target distance ---
|
||||
float targetDist = maxDistance;
|
||||
|
||||
if (bHit && hits.Num() > 0)
|
||||
{
|
||||
if (bHit && hits.Num() > 0) {
|
||||
float best = maxDistance;
|
||||
float padding = 15.f;
|
||||
|
||||
for (const FHitResult& hit : hits)
|
||||
{
|
||||
for (const FHitResult& hit : hits) {
|
||||
if (hit.bStartPenetrating) continue;
|
||||
if (hit.PenetrationDepth > 2.f) continue;
|
||||
|
||||
@@ -522,8 +411,7 @@ static void CameraFixEnabled() {
|
||||
lastSafeDistance = std::clamp(lastSafeDistance, 0.f, maxDistance);
|
||||
|
||||
// --- FINAL CAMERA POSITION ---
|
||||
FVector finalCamPos = pawnPos + preservedOffset +
|
||||
backward * lastSafeDistance;
|
||||
FVector finalCamPos = pawnPos + preservedOffset + backward * lastSafeDistance;
|
||||
|
||||
if (!world->K2_GetWorldSettings()) return;
|
||||
// --- APPLY ---
|
||||
@@ -550,8 +438,7 @@ static void CameraFixEnabled() {
|
||||
}
|
||||
|
||||
float dt = g_LastCameraDeltaTime;
|
||||
// Secure
|
||||
if (dt <= 0.f || dt > 0.1f) dt = 1.f / 60.f;
|
||||
if (dt <= 0.f || dt > 0.1f) dt = 1.f / 60.f; // Secure
|
||||
|
||||
float targetOffset = g_CameraOffset;
|
||||
if (bIsInCinematicMode || bIsAiming) targetOffset = g_NativeCameraDistance;
|
||||
@@ -641,10 +528,25 @@ static void TimeDilation() {
|
||||
logger->info("Time dilation fix disabled");
|
||||
}
|
||||
|
||||
static void FogFixEnabled() {
|
||||
if (g_fix_enabled && g_Fog_fix_enabled && Fogaddress) {
|
||||
if (!FogHook) {
|
||||
FogHook = safetyhook::create_mid(Fogaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
if (!ctx.rax) return;
|
||||
*reinterpret_cast<uint8_t*>(ctx.rax + 0x4) = g_fix_enabled && g_Fog_fix_enabled ? 0 : 1; // r.Fog = 0
|
||||
});
|
||||
}
|
||||
logger->info("Fog fix enabled");
|
||||
}
|
||||
if (!(g_fix_enabled && g_Fog_fix_enabled) && Fogaddress)
|
||||
logger->info("Fog fix disabled");
|
||||
}
|
||||
|
||||
// Memory patch fixes
|
||||
static void UltraWideFixEnabled() {
|
||||
if (ConstrainAspectaddress)
|
||||
Memory::PatchBytes(ConstrainAspectaddress, "\x31\xC0\x90\x90\x90\x90\x90", 7); // bConstrainAspectRatio = 0
|
||||
if (FOVaddress)
|
||||
Memory::PatchBytes(FOVaddress + 0x25, "\x31\xC0\x90\x90\x90\x90\x90", 7); // bConstrainAspectRatio = 0
|
||||
}
|
||||
|
||||
static void CAFixEnabled() {
|
||||
@@ -669,21 +571,6 @@ static void VignettingFixEnabled() {
|
||||
}
|
||||
}
|
||||
|
||||
static void FogFixEnabled() {
|
||||
if (g_fix_enabled && g_Fog_fix_enabled && Fogaddress) {
|
||||
if (!FogHook) {
|
||||
FogHook = safetyhook::create_mid(Fogaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
if (!ctx.rax) return;
|
||||
*reinterpret_cast<uint8_t*>(ctx.rax + 0x4) = g_fix_enabled && g_Fog_fix_enabled ? 0 : 1; // r.Fog = 0
|
||||
});
|
||||
}
|
||||
logger->info("Fog fix enabled");
|
||||
}
|
||||
if (!(g_fix_enabled && g_Fog_fix_enabled) && Fogaddress)
|
||||
logger->info("Fog fix disabled");
|
||||
}
|
||||
|
||||
// UE Console creation
|
||||
static void EnableConsole()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user