Add cutscenes ultrawide and framerate fixes
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "UEngine.hpp";
|
||||
#include "SDK/Basic.hpp"
|
||||
#include "SDK/Engine_classes.hpp"
|
||||
#include "SDK/WBP_Cutscene_classes.hpp"
|
||||
|
||||
using namespace SDK;
|
||||
// Unreal Engine variables
|
||||
@@ -36,6 +37,8 @@ static bool g_Volumetric_Fog_fix_enabled = false;
|
||||
static bool g_Fog_Density_fix_enabled = false;
|
||||
static bool g_Fog_Max_Opacity_fix_enabled = false;
|
||||
static bool g_Camera_fix_enabled = false;
|
||||
static bool g_Cutscenes_fix_enabled = false;
|
||||
static bool g_Cutscenes_FPS_fix_enabled = false;
|
||||
static int g_AdditionalFOVValue = 0;
|
||||
static float g_CameraDistance = 1.f;
|
||||
static float g_FogDensity = 0.4f;
|
||||
@@ -67,6 +70,10 @@ static uint8_t* VolumetricFogEngineaddress_2 = nullptr;
|
||||
static uint8_t* FogDensityEngineaddress = nullptr;
|
||||
static uint8_t* FogOpacityEngineaddress = nullptr;
|
||||
static uint8_t* Cameraaddress = nullptr;
|
||||
static uint8_t* Cutscenesaddress = nullptr;
|
||||
static uint8_t* CutscenesFPSaddress = nullptr;
|
||||
static uint8_t* ConstrainAspectRatioaddress = nullptr;
|
||||
static uint8_t* AspectRatioAxisConstraintaddress = nullptr;
|
||||
|
||||
// Hooking
|
||||
static SafetyHookMid FOVHook{};
|
||||
@@ -75,6 +82,10 @@ static SafetyHookMid VolumetricFogHook{};
|
||||
static SafetyHookMid FogDensityHook{};
|
||||
static SafetyHookMid FogMaxOpacityHook{};
|
||||
static SafetyHookMid CameraHook{};
|
||||
static SafetyHookMid CutscenesHook{};
|
||||
static SafetyHookMid CutscenesFPSHook{};
|
||||
static SafetyHookMid ConstrainAspectRatioHook{};
|
||||
static SafetyHookMid AspectRatioAxisConstraintHook{};
|
||||
|
||||
// Prototypes
|
||||
static void FOVFixEnabled();
|
||||
@@ -87,6 +98,8 @@ static void FogDensityFixEnabled();
|
||||
static void FogOpacityFixEnabled();
|
||||
static void CameraFixEnabled();
|
||||
static void EnableConsole();
|
||||
static void CutscenesFixEnabled();
|
||||
static void CutscenesFPSFixEnabled();
|
||||
|
||||
extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
{
|
||||
@@ -104,9 +117,8 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
|
||||
if (!FOVaddress)
|
||||
logger->warn("FOV signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
else
|
||||
logger->info("FOV signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(FOVaddress));
|
||||
}
|
||||
}
|
||||
|
||||
if (DOFaddress == nullptr) {
|
||||
@@ -120,9 +132,8 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
|
||||
if (!DOFaddress)
|
||||
logger->warn("DOF signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
else
|
||||
logger->info("DOF signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(DOFaddress));
|
||||
}
|
||||
}
|
||||
|
||||
if (CAaddress == nullptr) {
|
||||
@@ -136,9 +147,8 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
|
||||
if (!CAaddress)
|
||||
logger->warn("Chromatic aberrations signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
else
|
||||
logger->info("Chromatic aberrations signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(CAaddress));
|
||||
}
|
||||
}
|
||||
|
||||
if (Vignettingaddress == nullptr) {
|
||||
@@ -203,9 +213,8 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
|
||||
if (!VolumetricFogEngineaddress_2)
|
||||
logger->warn("Volumetric fog signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
else
|
||||
logger->info("Volumetric Fog signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(VolumetricFogEngineaddress_2));
|
||||
}
|
||||
}
|
||||
|
||||
if (FogDensityEngineaddress == nullptr) {
|
||||
@@ -253,12 +262,55 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
|
||||
if (!Cameraaddress)
|
||||
logger->warn("Camera signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
else
|
||||
logger->info("Camera signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(Cameraaddress));
|
||||
}
|
||||
|
||||
if (!Cutscenesaddress) {
|
||||
constexpr auto Cutscenes1StringObfuscated = make_obfuscated<0x4A>("48 ?? ?? ?? ?? ?? ?? 48 8B ?? 48 8B ?? 8D ?? 01 89 ?? ?? ?? ?? ?? 3B ?? ?? ?? ?? ?? 76 ?? 8B ?? 48 81 ?? ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B ?? ?? ?? ?? ?? 48 8D");
|
||||
Cutscenesaddress = Memory::AOBScan(gameExecutable, Cutscenes1StringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!Cutscenesaddress)
|
||||
logger->warn("Cutscenes signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else
|
||||
logger->info("Cutscenes signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(Cutscenesaddress));
|
||||
}
|
||||
|
||||
if (!ConstrainAspectRatioaddress) {
|
||||
constexpr auto ConstrainAspectRatioaddressStringObfuscated = make_obfuscated<0x4A>("89 ?? ?? 0F B6 ?? ?? ?? ?? ?? D1 ?? 33 ?? 83 ?? 02 33 ?? 89");
|
||||
ConstrainAspectRatioaddress = Memory::AOBScan(gameExecutable, ConstrainAspectRatioaddressStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!ConstrainAspectRatioaddress)
|
||||
logger->warn("Constrain aspect ratio signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else
|
||||
logger->info("Constrain aspect ratio signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(ConstrainAspectRatioaddress));
|
||||
}
|
||||
|
||||
if (!AspectRatioAxisConstraintaddress) {
|
||||
constexpr auto AspectRatioAxisConstraintaddressStringObfuscated = make_obfuscated<0x4A>("48 ?? ?? ?? ?? 00 00 4C ?? ?? 4D ?? ?? E8 ?? ?? ?? ?? 48 8B");
|
||||
AspectRatioAxisConstraintaddress = Memory::AOBScan(gameExecutable, AspectRatioAxisConstraintaddressStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!AspectRatioAxisConstraintaddress)
|
||||
logger->warn("Aspect Ratio Axis Constraint signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else
|
||||
logger->info("Aspect Ratio Axis Constraint signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(AspectRatioAxisConstraintaddress));
|
||||
}
|
||||
|
||||
if (!CutscenesFPSaddress) {
|
||||
constexpr auto CutscenesFPSStringObfuscated = make_obfuscated<0x4A>("FF 50 ?? 40 38 ?? ?? ?? ?? ?? 75 ?? 40 38 ?? ?? ?? ?? ?? 75");
|
||||
CutscenesFPSaddress = Memory::AOBScan(gameExecutable, CutscenesFPSStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!CutscenesFPSaddress)
|
||||
logger->warn("Cutscenes framerate signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
logger->info("Cutscenes framerate signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(CutscenesFPSaddress));
|
||||
CutscenesFPSaddress += 0x3;
|
||||
}
|
||||
}
|
||||
|
||||
if (FOVaddress && Cameraaddress && DOFaddress && CAaddress && Vignettingaddress && Fogaddress) {
|
||||
if (FOVaddress && Cameraaddress && DOFaddress && CAaddress && Vignettingaddress && Fogaddress && VolumetricFogEngineaddress_1 &&
|
||||
VolumetricFogEngineaddress_2 && FogDensityEngineaddress && FogOpacityEngineaddress && Cutscenesaddress && ConstrainAspectRatioaddress &&
|
||||
AspectRatioAxisConstraintaddress && CutscenesFPSaddress) {
|
||||
logger->info("All AOB signatures found. Ready to patch...");
|
||||
AOBScanDone = true;
|
||||
}
|
||||
@@ -324,6 +376,10 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
if (Fogaddress && VolumetricFogEngineaddress_1 && VolumetricFogEngineaddress_2) VolumetricFogFixEnabled();
|
||||
if (Fogaddress && FogDensityEngineaddress) FogDensityFixEnabled();
|
||||
if (Fogaddress && FogOpacityEngineaddress) FogOpacityFixEnabled();
|
||||
if (Cutscenesaddress && ConstrainAspectRatioaddress)
|
||||
CutscenesFixEnabled();
|
||||
if (CutscenesFPSaddress)
|
||||
CutscenesFPSFixEnabled();
|
||||
if (!g_Console_Enabled && GObjectsaddress && GNamesaddress && AppendStringaddress && ProcessEventaddress)
|
||||
EnableConsole();
|
||||
}
|
||||
@@ -386,6 +442,18 @@ extern "C" __declspec(dllexport) void SetCameraFixEnabled(bool enabled, bool ini
|
||||
if (!init) CameraFixEnabled();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetCutscenesFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_Cutscenes_fix_enabled = enabled;
|
||||
if (!init) CutscenesFixEnabled();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetCutscenesFPSFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_Cutscenes_FPS_fix_enabled = enabled;
|
||||
if (!init) CutscenesFPSFixEnabled();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetFOV(int fov)
|
||||
{
|
||||
g_AdditionalFOVValue = fov;
|
||||
@@ -548,6 +616,52 @@ static void FogOpacityFixEnabled() {
|
||||
}
|
||||
}
|
||||
|
||||
static void CutscenesFixEnabled() {
|
||||
if (!CutscenesHook)
|
||||
CutscenesHook = safetyhook::create_mid(Cutscenesaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
auto object = reinterpret_cast<SDK::UObject*>(ctx.rdx);
|
||||
if (!object || !object->Class || !object->Class->Class) return;
|
||||
|
||||
if (object->GetName().contains("WBP_Cutscene_C") && object->IsA(UWBP_Cutscene_C::StaticClass())) {
|
||||
auto cutscene = static_cast<UWBP_Cutscene_C*>(object);
|
||||
|
||||
if (cutscene) {
|
||||
cutscene->LeftGroup->SetVisibility(g_fix_enabled && g_Cutscenes_fix_enabled ? ESlateVisibility::Collapsed : ESlateVisibility::SelfHitTestInvisible);
|
||||
cutscene->LeftGroup_1->SetVisibility(g_fix_enabled && g_Cutscenes_fix_enabled ? ESlateVisibility::Collapsed : ESlateVisibility::SelfHitTestInvisible);
|
||||
cutscene->LeftGroup_2->SetVisibility(g_fix_enabled && g_Cutscenes_fix_enabled ? ESlateVisibility::Collapsed : ESlateVisibility::SelfHitTestInvisible);
|
||||
cutscene->RightGroup->SetVisibility(g_fix_enabled && g_Cutscenes_fix_enabled ? ESlateVisibility::Collapsed : ESlateVisibility::SelfHitTestInvisible);
|
||||
cutscene->RightGroup_1->SetVisibility(g_fix_enabled && g_Cutscenes_fix_enabled ? ESlateVisibility::Collapsed : ESlateVisibility::SelfHitTestInvisible);
|
||||
cutscene->RightGroup_2->SetVisibility(g_fix_enabled && g_Cutscenes_fix_enabled ? ESlateVisibility::Collapsed : ESlateVisibility::SelfHitTestInvisible);
|
||||
}
|
||||
}
|
||||
});
|
||||
// Force cutscenes rendering full screeen
|
||||
if (g_fix_enabled && g_Cutscenes_fix_enabled && !ConstrainAspectRatioHook) {
|
||||
ConstrainAspectRatioHook = safetyhook::create_mid(ConstrainAspectRatioaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
ctx.rcx = 0; // bConstrainAspectRatio
|
||||
});
|
||||
logger->info("Cutscenes ultrawide fix enabled");
|
||||
}
|
||||
// FOV compensation
|
||||
if (g_fix_enabled && g_Cutscenes_fix_enabled && !AspectRatioAxisConstraintHook)
|
||||
AspectRatioAxisConstraintHook = safetyhook::create_mid(AspectRatioAxisConstraintaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
ctx.rdx = 0; // AspectRatioAxisConstraint Y
|
||||
});
|
||||
}
|
||||
|
||||
static void CutscenesFPSFixEnabled() {
|
||||
if (g_fix_enabled && g_Cutscenes_FPS_fix_enabled) {
|
||||
CutscenesFPSHook = safetyhook::create_mid(CutscenesFPSaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
*reinterpret_cast<BYTE*>(ctx.rbx + 0x310) = 1;
|
||||
});
|
||||
logger->info("Cutscenes FPS unlocker fix enabled");
|
||||
}
|
||||
}
|
||||
|
||||
// Memory patch fixes
|
||||
static void DOFFixEnabled() {
|
||||
if (g_fix_enabled && g_DOF_fix_enabled && DOFaddress) {
|
||||
|
||||
Reference in New Issue
Block a user