Add unique function to retrieve game informations
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <spdlog/sinks/rotating_file_sink.h>
|
||||
#include <filesystem>
|
||||
#include <safetyhook.hpp>
|
||||
#include "GameInformations.h"
|
||||
#include "ObfuscateString.h"
|
||||
#include "Memory.hpp";
|
||||
#include "Maths.hpp";
|
||||
@@ -21,11 +22,6 @@ const float BASE_ASPECT = 1.777777791;
|
||||
// Logger
|
||||
std::shared_ptr<spdlog::logger> logger;
|
||||
|
||||
// Screen informations
|
||||
static int screenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
static int screenHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||
static float aspectRatio = (float)screenWidth / screenHeight;
|
||||
|
||||
// Plugin states
|
||||
static bool AOBScanDone = false;
|
||||
static bool g_fix_enabled = false;
|
||||
@@ -39,9 +35,10 @@ static int g_AdditionalFOVValue = 0;
|
||||
static float g_CameraDistance = 1.f;
|
||||
|
||||
// Shared values
|
||||
static float g_reference_FOV = 65.f;
|
||||
static float g_FOV_In = 0.f;
|
||||
static float g_FOV_Out = 0.f;
|
||||
static float g_FOV_In = 65.f;
|
||||
static float g_FOV_Out = 65.f;
|
||||
static float g_Camera_In = 230.f;
|
||||
static float g_Camera_Out = 230.f;
|
||||
static bool g_Console_Enabled = false;
|
||||
|
||||
// AOB Unreal Engine offsets addresses
|
||||
@@ -175,7 +172,7 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
}
|
||||
}
|
||||
|
||||
if (FOVaddress && DOFaddress && CAaddress && Vignettingaddress && VolumetricFogaddress) {
|
||||
if (FOVaddress && Cameraaddress && DOFaddress && CAaddress && Vignettingaddress && VolumetricFogaddress) {
|
||||
logger->info("All AOB signatures found. Ready to patch...");
|
||||
AOBScanDone = true;
|
||||
}
|
||||
@@ -290,16 +287,14 @@ extern "C" __declspec(dllexport) void SetCameraDistance(float multiplier) {
|
||||
}
|
||||
|
||||
// Getters for Reshade addon call
|
||||
extern "C" __declspec(dllexport) float GetFOVIn() {
|
||||
return g_FOV_In;
|
||||
}
|
||||
extern "C" __declspec(dllexport) void GetGameInfos(GameInfos* infos) {
|
||||
if (!infos) return;
|
||||
|
||||
extern "C" __declspec(dllexport) float GetFOVOut() {
|
||||
return g_FOV_Out;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) bool GetConsoleEnabled() {
|
||||
return g_Console_Enabled;
|
||||
infos->FOVIn = g_FOV_In;
|
||||
infos->FOVOut = g_FOV_Out;
|
||||
infos->cameraIn = g_Camera_In;
|
||||
infos->cameraOut = g_Camera_Out;
|
||||
infos->consoleEnabled = g_Console_Enabled;
|
||||
}
|
||||
|
||||
// Code injection functions
|
||||
@@ -328,7 +323,9 @@ static void CameraFixEnabled() {
|
||||
if (!CameraHook) {
|
||||
CameraHook = safetyhook::create_mid(Cameraaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
g_Camera_In = ctx.xmm0.f32[0];
|
||||
ctx.xmm0.f32[0] *= g_CameraDistance;
|
||||
g_Camera_Out = ctx.xmm0.f32[0];
|
||||
});
|
||||
}
|
||||
else CameraHook.enable();
|
||||
|
||||
Reference in New Issue
Block a user