Add camera distance fix. Version update

This commit is contained in:
2025-09-28 10:02:24 +02:00
parent 89b55d3784
commit 5303fbda90

View File

@@ -29,6 +29,8 @@ static SetBoolFn SetVignettingFixEnabled = nullptr;
static SetBoolFn SetCameraFixEnabled = nullptr;
static SetBoolFn SetFogFixEnabled = nullptr;
static SetIntFn SetFOV = nullptr;
static SetFloatFn SetCameraDistance = nullptr;
static GetFloatFn GetFOVIn = nullptr;
static GetFloatFn GetFOVOut = nullptr;
@@ -43,6 +45,7 @@ static bool camera_fix_enabled = false;
static bool Fog_fix_enabled = false;
static bool fix_enabled = false;
static int worldFOVvalue = 0;
static float cameraDistanceValue = 1.f;
static bool popup_Informations = false;
@@ -50,19 +53,15 @@ static bool popup_Informations = false;
const char* SETTINGS_FILE = "PluginSettings.ini";
const char* GENERAL_FIX_SETTING = "GeneralFIX=";
const char* WORLD_FOV_FIX_SETTING = "WorldFOVFIX=";
const char* ASPECT_FIX_SETTING = "AspectFIX=";
const char* CAMERA_FIX_SETTING = "CameraFIX=";
const char* HUD_FIX_SETTING = "HUDFIX=";
const char* DOF_FIX_SETTING = "DOFFIX=";
const char* CA_FIX_SETTING = "CAFIX=";
const char* VIGNETTING_FIX_SETTING = "VignettingFIX=";
const char* FOG_FIX_SETTING = "FogFIX=";
const char* WORLD_FOV_SETTING = "WorldFOV=";
const char* CAMERA_DISTANCE_SETTING = "CameraDistance=";
const char* CAMERA_HEIGHT_SETTING = "CameraHeight=";
const char* HUD_SETTING = "HUDValue=";
const char* FIX_VERSION = "1.0.1";
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable console.\n\nDisabling Fog will not entirely remove it.";
const char* FIX_VERSION = "1.0.2";
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable console.\n\nDisabling Fog will not entirely remove it.";
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
// Scaling factor based on screen resolution
@@ -88,15 +87,18 @@ static void LoadFixDLL()
SetCAFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCAFixEnabled");
SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled");
SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled");
//SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled");
SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled");
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance");
GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn");
GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");;
GetConsoleEnabled = (GetBoolFn)GetProcAddress(fixLib, "GetConsoleEnabled");
// Apply initial values loaded from settings
if (SetFOV) SetFOV(worldFOVvalue);
if (SetCameraDistance) SetCameraDistance(cameraDistanceValue);
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true);
if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, true);
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, true);
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, true);
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, true);
@@ -113,11 +115,13 @@ static void SaveSettings()
{
file << GENERAL_FIX_SETTING << (fix_enabled ? "1" : "0") << "\n";
file << WORLD_FOV_FIX_SETTING << (fov_fix_enabled ? "1" : "0") << "\n";
file << CAMERA_FIX_SETTING << (camera_fix_enabled ? "1" : "0") << "\n";
file << DOF_FIX_SETTING << (DOF_fix_enabled ? "1" : "0") << "\n";
file << CA_FIX_SETTING << (CA_fix_enabled ? "1" : "0") << "\n";
file << VIGNETTING_FIX_SETTING << (Vignetting_fix_enabled ? "1" : "0") << "\n";
file << FOG_FIX_SETTING << (Fog_fix_enabled ? "1" : "0") << "\n";
file << WORLD_FOV_SETTING << worldFOVvalue << "\n";
file << CAMERA_DISTANCE_SETTING << cameraDistanceValue << "\n";
file.close();
}
}
@@ -140,6 +144,11 @@ static void LoadSettings()
std::string val = line.substr(strlen(WORLD_FOV_FIX_SETTING));
fov_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(CAMERA_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(CAMERA_FIX_SETTING));
camera_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(DOF_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(DOF_FIX_SETTING));
@@ -162,6 +171,8 @@ static void LoadSettings()
}
else if (line.find(WORLD_FOV_SETTING) == 0)
worldFOVvalue = std::stoi(line.substr(strlen(WORLD_FOV_SETTING)));
else if (line.find(CAMERA_DISTANCE_SETTING) == 0)
cameraDistanceValue = std::stof(line.substr(strlen(CAMERA_DISTANCE_SETTING)));
}
file.close();
}
@@ -212,6 +223,25 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
SaveSettings();
}
}
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("This will affect in game FOV only.");
ImGui::EndTooltip();
}
if (ImGui::CollapsingHeader("Camera distance (*)", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::SetNextItemWidth(150 * scale);
if (ImGui::SliderFloat("##CameraDistanceValue", &cameraDistanceValue, 0, 3)) {
if (SetCameraDistance) SetCameraDistance(cameraDistanceValue);
SaveSettings();
}
}
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("Value is a multiplier.");
ImGui::EndTooltip();
}
// Individual fixes
ImGui::TableSetColumnIndex(1);
@@ -246,6 +276,11 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
ImGui::TableSetColumnIndex(1);
if (ImGui::Checkbox("Camera", &camera_fix_enabled)) {
if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, false);
SaveSettings();
}
if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) {
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, false);
SaveSettings();
@@ -255,11 +290,6 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, false);
SaveSettings();
}
//if (ImGui::Checkbox("Camera", &camera_fix_enabled)) {
// if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, false);
// SaveSettings();
//}
ImGui::EndTable();
}
}