Add camera distance
This commit is contained in:
@@ -36,7 +36,9 @@ static bool g_DOF_fix_enabled = false;
|
|||||||
static bool g_CA_fix_enabled = false;
|
static bool g_CA_fix_enabled = false;
|
||||||
static bool g_Vignetting_fix_enabled = false;
|
static bool g_Vignetting_fix_enabled = false;
|
||||||
static bool g_Fog_fix_enabled = false;
|
static bool g_Fog_fix_enabled = false;
|
||||||
|
static bool g_Camera_distance_fix_enabled = false;
|
||||||
static int g_AdditionalFOVValue = 0;
|
static int g_AdditionalFOVValue = 0;
|
||||||
|
static float g_cameraDistanceMultiplier = 1.f;
|
||||||
|
|
||||||
// Shared values
|
// Shared values
|
||||||
static float g_FOV_In = 0;
|
static float g_FOV_In = 0;
|
||||||
@@ -58,11 +60,13 @@ static uint8_t* DOFaddress = nullptr;
|
|||||||
static uint8_t* CAaddress = nullptr;
|
static uint8_t* CAaddress = nullptr;
|
||||||
static uint8_t* Vignettingaddress = nullptr;
|
static uint8_t* Vignettingaddress = nullptr;
|
||||||
static uint8_t* Fogaddress = nullptr;
|
static uint8_t* Fogaddress = nullptr;
|
||||||
|
static uint8_t* CameraDistanceaddress = nullptr;
|
||||||
|
|
||||||
// Hooking
|
// Hooking
|
||||||
static SafetyHookMid FOVHook{};
|
static SafetyHookMid FOVHook{};
|
||||||
static SafetyHookMid AspectHook{};
|
static SafetyHookMid AspectHook{};
|
||||||
static SafetyHookMid FogHook{};
|
static SafetyHookMid FogHook{};
|
||||||
|
static SafetyHookMid CameraDistanceHook{};
|
||||||
|
|
||||||
// Prototypes
|
// Prototypes
|
||||||
static void FOVFixEnabled(bool fix_enabled);
|
static void FOVFixEnabled(bool fix_enabled);
|
||||||
@@ -71,6 +75,7 @@ static void DOFFixEnabled(bool fix_enabled);
|
|||||||
static void CAFixEnabled(bool fix_enabled);
|
static void CAFixEnabled(bool fix_enabled);
|
||||||
static void VignettingFixEnabled(bool fix_enabled);
|
static void VignettingFixEnabled(bool fix_enabled);
|
||||||
static void FogFixEnabled(bool fix_enabled);
|
static void FogFixEnabled(bool fix_enabled);
|
||||||
|
static void CameraDistanceFixEnabled(bool fix_enabled);
|
||||||
static void EnableConsole();
|
static void EnableConsole();
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||||
@@ -181,6 +186,22 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CameraDistanceaddress == nullptr) {
|
||||||
|
constexpr auto FogStringObfuscated = make_obfuscated<0x4A>("28 C3 48 83 ?? ?? 48 8B ?? ?? ?? ?? ?? 48 8B ?? 48 85 ?? 75");
|
||||||
|
CameraDistanceaddress = Memory::AOBScan(gameExecutable, FogStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||||
|
//"HellIsUs-Win64-Shipping.exe" + 4E9D3F2 - 48 85 C0 - test rax, rax
|
||||||
|
//"HellIsUs-Win64-Shipping.exe" + 4E9D3F5 - 74 0A - je "HellIsUs-Win64-Shipping.exe" + 4E9D401
|
||||||
|
//"HellIsUs-Win64-Shipping.exe" + 4E9D3F7 - F3 0F 10 40 4C - movss xmm0, [rax + 4C]
|
||||||
|
//"HellIsUs-Win64-Shipping.exe" + 4E9D3FC - 48 83 C4 28 - add rsp, 28
|
||||||
|
//"HellIsUs-Win64-Shipping.exe" + 4E9D400 - C3 - ret
|
||||||
|
|
||||||
|
if (!CameraDistanceaddress)
|
||||||
|
logger->warn("Camera distance signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||||
|
else {
|
||||||
|
logger->info("Camera distance signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(CameraDistanceaddress));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (FOVaddress && FOVOtheraddress && Aspectaddress && DOFaddress && CAaddress && Vignettingaddress && Fogaddress) {
|
if (FOVaddress && FOVOtheraddress && Aspectaddress && DOFaddress && CAaddress && Vignettingaddress && Fogaddress) {
|
||||||
logger->info("All AOB signatures found. Ready to patch...");
|
logger->info("All AOB signatures found. Ready to patch...");
|
||||||
AOBScanDone = true;
|
AOBScanDone = true;
|
||||||
@@ -293,11 +314,22 @@ extern "C" __declspec(dllexport) void SetFogFixEnabled(bool enabled, bool init)
|
|||||||
if (!init) FogFixEnabled(g_Fog_fix_enabled);
|
if (!init) FogFixEnabled(g_Fog_fix_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport) void SetCameraDistanceFixEnabled(bool enabled, bool init)
|
||||||
|
{
|
||||||
|
g_Camera_distance_fix_enabled = enabled;
|
||||||
|
if (!init) CameraDistanceFixEnabled(g_Camera_distance_fix_enabled);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) void SetFOV(int fov)
|
extern "C" __declspec(dllexport) void SetFOV(int fov)
|
||||||
{
|
{
|
||||||
g_AdditionalFOVValue = fov;
|
g_AdditionalFOVValue = fov;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport) void SetCameraDistance(float cameraDistance)
|
||||||
|
{
|
||||||
|
g_cameraDistanceMultiplier = cameraDistance;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) void SetConsole()
|
extern "C" __declspec(dllexport) void SetConsole()
|
||||||
{
|
{
|
||||||
EnableConsole();
|
EnableConsole();
|
||||||
@@ -408,6 +440,18 @@ static void FogFixEnabled(bool fix_enabled) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CameraDistanceFixEnabled(bool fix_enabled) {
|
||||||
|
if (g_fix_enabled && fix_enabled && CameraDistanceaddress) {
|
||||||
|
if (!CameraDistanceHook) { // Hook only once +0x4e or start to test +0x13
|
||||||
|
CameraDistanceHook = safetyhook::create_mid(CameraDistanceaddress + 0x4e,
|
||||||
|
[](SafetyHookContext& ctx) {
|
||||||
|
ctx.xmm0.f32[0] *= g_cameraDistanceMultiplier;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
logger->info("CameraDistance fix enabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// UE Console creation
|
// UE Console creation
|
||||||
static void EnableConsole()
|
static void EnableConsole()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user