Add HUD safezone fix

This commit is contained in:
2025-09-19 19:28:15 +02:00
parent d9f3070e43
commit 7630b42862

View File

@@ -29,9 +29,11 @@ static SetBoolFn SetCAFixEnabled = nullptr;
static SetBoolFn SetVignettingFixEnabled = nullptr;
static SetBoolFn SetFogFixEnabled = nullptr;
static SetBoolFn SetCameraFixEnabled = nullptr;
static SetBoolFn SetHUDFixEnabled = nullptr;
static SetIntFn SetFOV = nullptr;
static SetFloatFn SetCameraDistance = nullptr;
static SetIntFn SetCameraHeight = nullptr;
static SetIntFn SetHUD = nullptr;
static GetFloatFn GetFOVIn = nullptr;
static GetFloatFn GetCompensadedFOV = nullptr;
@@ -46,10 +48,12 @@ static bool CA_fix_enabled = false;
static bool Vignetting_fix_enabled = false;
static bool Fog_fix_enabled = false;
static bool camera_fix_enabled = false;
static bool HUD_fix_enabled = false;
static bool fix_enabled = false;
static int worldFOVvalue = 0;
static float cameraDistancevalue = 1.f;
static int cameraHeightvalue = -15;
static int HUDvalue = 0;
static bool popup_Informations = false;
@@ -59,6 +63,7 @@ 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=";
@@ -66,8 +71,9 @@ 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* FIX_VERSION = "1.0.4";
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Disable pillar boxing in cutscences.\n - Control camera.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable FOG.\n - Re enable console.\n\nDisabling pillar boxing will compensate FOV\nfor main menu and cutscenes.\nDisabling Fog will not entirely remove it.";
const char* HUD_SETTING = "HUDValue=";
const char* FIX_VERSION = "1.0.5";
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Disable pillar boxing in cutscences.\n - Control camera.\n - Control HUD safezone.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable FOG.\n - Re enable console.\n\nDisabling pillar boxing will compensate FOV\nfor main menu and cutscenes.\nDisabling Fog will not entirely remove it.";
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
// Scaling factor based on screen resolution
@@ -95,9 +101,11 @@ static void LoadFixDLL()
SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled");
SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled");
SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled");
SetHUDFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetHUDFixEnabled");
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance");
SetCameraHeight = (SetIntFn)GetProcAddress(fixLib, "SetCameraHeight");
SetHUD = (SetIntFn)GetProcAddress(fixLib, "SetHUD");
GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn");
GetCompensadedFOV = (GetFloatFn)GetProcAddress(fixLib, "GetCompensatedFOV");
GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");;
@@ -107,8 +115,10 @@ static void LoadFixDLL()
if (SetFOV) SetFOV(worldFOVvalue);
if (SetCameraDistance) SetCameraDistance(cameraDistancevalue);
if (SetCameraHeight) SetCameraHeight(cameraHeightvalue);
if (SetHUD) SetHUD(HUDvalue);
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true);
if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, true);
if (SetHUDFixEnabled) SetHUDFixEnabled(HUD_fix_enabled, true);
if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(Aspect_fix_enabled, true);
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, true);
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, true);
@@ -128,6 +138,7 @@ static void SaveSettings()
file << WORLD_FOV_FIX_SETTING << (fov_fix_enabled ? "1" : "0") << "\n";
file << ASPECT_FIX_SETTING << (Aspect_fix_enabled ? "1" : "0") << "\n";
file << CAMERA_FIX_SETTING << (camera_fix_enabled ? "1" : "0") << "\n";
file << HUD_FIX_SETTING << (HUD_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";
@@ -135,6 +146,7 @@ static void SaveSettings()
file << WORLD_FOV_SETTING << worldFOVvalue << "\n";
file << CAMERA_DISTANCE_SETTING << cameraDistancevalue << "\n";
file << CAMERA_HEIGHT_SETTING << cameraHeightvalue << "\n";
file << HUD_SETTING << HUDvalue << "\n";
file.close();
}
}
@@ -162,6 +174,11 @@ static void LoadSettings()
std::string val = line.substr(strlen(CAMERA_FIX_SETTING));
camera_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(HUD_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(HUD_FIX_SETTING));
HUD_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(ASPECT_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(ASPECT_FIX_SETTING));
@@ -193,6 +210,8 @@ static void LoadSettings()
cameraDistancevalue = std::stof(line.substr(strlen(CAMERA_DISTANCE_SETTING)));
else if (line.find(CAMERA_HEIGHT_SETTING) == 0)
cameraHeightvalue = std::stoi(line.substr(strlen(CAMERA_HEIGHT_SETTING)));
else if (line.find(HUD_SETTING) == 0)
HUDvalue = std::stoi(line.substr(strlen(HUD_SETTING)));
}
file.close();
}
@@ -328,6 +347,18 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
ImGui::EndTooltip();
}
if (ImGui::Checkbox("HUD safe zone", &HUD_fix_enabled)) {
if (SetHUDFixEnabled) SetHUDFixEnabled(HUD_fix_enabled, false);
SaveSettings();
}
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("This fix is intended for ultrawide displays.");
ImGui::Text("This is not a real time fix.");
ImGui::Text("It will take effect after you load your savegame.");
ImGui::EndTooltip();
}
if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) {
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, false);
SaveSettings();
@@ -340,6 +371,19 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
ImGui::EndTable();
}
}
if (ImGui::CollapsingHeader("HUD safe zone (*)", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::SetNextItemWidth(150 * scale);
if (ImGui::SliderInt("##HUDValue", &HUDvalue, 0, 40)) {
if (SetHUD) SetHUD(HUDvalue);
SaveSettings();
}
}
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("Percentage HUD bounds (let and right).");
ImGui::EndTooltip();
}
ImGui::EndTable();
}