Add HUD scaling fix
This commit is contained in:
@@ -27,12 +27,14 @@ static GetGameInfosStruct GetGameInfos = nullptr;
|
|||||||
// Plugin variables for checkboxes and sliders
|
// Plugin variables for checkboxes and sliders
|
||||||
static bool fov_fix_enabled = false;
|
static bool fov_fix_enabled = false;
|
||||||
static bool ultrawide_fix_enabled = false;
|
static bool ultrawide_fix_enabled = false;
|
||||||
|
static bool HUD_fix_enabled = false;
|
||||||
static bool camera_fix_enabled = false;
|
static bool camera_fix_enabled = false;
|
||||||
static bool DOF_fix_enabled = false;
|
static bool DOF_fix_enabled = false;
|
||||||
static bool vignetting_fix_enabled = false;
|
static bool vignetting_fix_enabled = false;
|
||||||
static bool fix_enabled = false;
|
static bool fix_enabled = false;
|
||||||
static int worldFOVvalue = 0;
|
static int worldFOVvalue = 0;
|
||||||
static float cameraDistancevalue = 1.f;
|
static float cameraDistancevalue = 1.f;
|
||||||
|
static int HUDvalue = 0;
|
||||||
static int triggerDelayMs = 2000; // Default delay between shortcuts
|
static int triggerDelayMs = 2000; // Default delay between shortcuts
|
||||||
|
|
||||||
// Overlays popups
|
// Overlays popups
|
||||||
@@ -42,8 +44,8 @@ static std::string log_content;
|
|||||||
|
|
||||||
// Plugin settings
|
// Plugin settings
|
||||||
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
||||||
const char* FIX_VERSION = "1.0.3";
|
const char* FIX_VERSION = "1.0.4";
|
||||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Enable ultrawide.\n - Disable depth of field in cutscenes.\n - Disable vignetting.";
|
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Enable ultrawide.\n - Control HUD scaling.\n - Disable depth of field in cutscenes.\n - Disable vignetting.";
|
||||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||||
|
|
||||||
// Scaling factor based on screen resolution
|
// Scaling factor based on screen resolution
|
||||||
@@ -58,10 +60,11 @@ static FixToggle individualFixes[] = {
|
|||||||
"It forces the engine to redraw the aspect by simulating shortcuts.\n"
|
"It forces the engine to redraw the aspect by simulating shortcuts.\n"
|
||||||
"Use the threshold slider below to fine tune the delay between simulated shortcuts.\n"
|
"Use the threshold slider below to fine tune the delay between simulated shortcuts.\n"
|
||||||
"Increase the delay on slower PCs, decrease it on faster ones."},
|
"Increase the delay on slower PCs, decrease it on faster ones."},
|
||||||
|
{ "HUD", &HUD_fix_enabled, GameFixes::HUD },
|
||||||
{ "Camera", &camera_fix_enabled, GameFixes::Camera } };
|
{ "Camera", &camera_fix_enabled, GameFixes::Camera } };
|
||||||
|
|
||||||
// Prepare array of sliders for ImGui
|
// Prepare array of sliders for ImGui
|
||||||
static SliderFix2 sliders[3];
|
static SliderFix2 sliders[4];
|
||||||
|
|
||||||
// Load and unload game core dll functions /!\ necessary
|
// Load and unload game core dll functions /!\ necessary
|
||||||
static void LoadFixDLL(reshade::api::effect_runtime* runtime) {
|
static void LoadFixDLL(reshade::api::effect_runtime* runtime) {
|
||||||
@@ -84,20 +87,23 @@ static void LoadFixDLL(reshade::api::effect_runtime* runtime) {
|
|||||||
// Apply initial values loaded from settings
|
// Apply initial values loaded from settings
|
||||||
if (SetValues) {
|
if (SetValues) {
|
||||||
SetValues(GameSetting::FOV, worldFOVvalue);
|
SetValues(GameSetting::FOV, worldFOVvalue);
|
||||||
|
SetValues(GameSetting::HUD, HUDvalue);
|
||||||
SetValues(GameSetting::CameraDistance, cameraDistancevalue);
|
SetValues(GameSetting::CameraDistance, cameraDistancevalue);
|
||||||
}
|
}
|
||||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||||
if (SetFixes) {
|
if (SetFixes) {
|
||||||
SetFixes(GameFixes::FOV, fov_fix_enabled);
|
SetFixes(GameFixes::FOV, fov_fix_enabled);
|
||||||
|
SetFixes(GameFixes::HUD, HUD_fix_enabled);
|
||||||
SetFixes(GameFixes::Camera, camera_fix_enabled);
|
SetFixes(GameFixes::Camera, camera_fix_enabled);
|
||||||
SetFixes(GameFixes::DOF, DOF_fix_enabled);
|
SetFixes(GameFixes::DOF, DOF_fix_enabled);
|
||||||
SetFixes(GameFixes::Vignetting, vignetting_fix_enabled);
|
SetFixes(GameFixes::Vignetting, vignetting_fix_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 50, GameSetting::FOV, SetValues };
|
sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 50, GameSetting::FOV, SetValues };
|
||||||
sliders[1] = { "Camera distance", "##CamValue", SliderType::Float, &cameraDistancevalue, 0, 5, GameSetting::CameraDistance, SetValues, "%.1f",
|
sliders[1] = { "HUD scaling", "##HUDValue", SliderType::Int, &HUDvalue, -20, 40, GameSetting::HUD, SetValues };
|
||||||
|
sliders[2] = { "Camera distance", "##CamValue", SliderType::Float, &cameraDistancevalue, 0, 5, GameSetting::CameraDistance, SetValues, "%.1f",
|
||||||
"Value is a multiplier.\nFinal value reported below is in meters."};
|
"Value is a multiplier.\nFinal value reported below is in meters."};
|
||||||
sliders[2] = { "Ultrawide enforce delay", "##AltEnterValue", SliderType::Int, &triggerDelayMs, 1000, 5000, GameSetting::Threshold, SetValues, "",
|
sliders[3] = { "Ultrawide enforce delay", "##AltEnterValue", SliderType::Int, &triggerDelayMs, 1000, 5000, GameSetting::Threshold, SetValues, "",
|
||||||
"This value is a threshold in ms between the simulated alt + enter." };
|
"This value is a threshold in ms between the simulated alt + enter." };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,11 +120,13 @@ static void SaveSettings() {
|
|||||||
pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
|
pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
|
||||||
pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled;
|
pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled;
|
||||||
pluginIniFile["2#Individual fix"]["UltraWide"] = ultrawide_fix_enabled;
|
pluginIniFile["2#Individual fix"]["UltraWide"] = ultrawide_fix_enabled;
|
||||||
|
pluginIniFile["2#Individual fix"]["HUD"] = HUD_fix_enabled;
|
||||||
pluginIniFile["2#Individual fix"]["Camera"] = camera_fix_enabled;
|
pluginIniFile["2#Individual fix"]["Camera"] = camera_fix_enabled;
|
||||||
pluginIniFile["2#Individual fix"]["DOF"] = DOF_fix_enabled;
|
pluginIniFile["2#Individual fix"]["DOF"] = DOF_fix_enabled;
|
||||||
pluginIniFile["2#Individual fix"]["Vignetting"] = vignetting_fix_enabled;
|
pluginIniFile["2#Individual fix"]["Vignetting"] = vignetting_fix_enabled;
|
||||||
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
||||||
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue;
|
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue;
|
||||||
|
pluginIniFile["3#Fixes tuning"]["HUD scaling"] = HUDvalue;
|
||||||
pluginIniFile["3#Fixes tuning"]["Camera distance"] = cameraDistancevalue;
|
pluginIniFile["3#Fixes tuning"]["Camera distance"] = cameraDistancevalue;
|
||||||
|
|
||||||
pluginIniFile.save(SETTINGS_FILE);
|
pluginIniFile.save(SETTINGS_FILE);
|
||||||
@@ -132,10 +140,12 @@ static void LoadSettings() {
|
|||||||
triggerDelayMs = pluginIniFile["1#General fix"]["TriggerDelayMs"].as<int>();
|
triggerDelayMs = pluginIniFile["1#General fix"]["TriggerDelayMs"].as<int>();
|
||||||
fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
|
fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
|
||||||
ultrawide_fix_enabled = pluginIniFile["2#Individual fix"]["UltraWide"].as<bool>();
|
ultrawide_fix_enabled = pluginIniFile["2#Individual fix"]["UltraWide"].as<bool>();
|
||||||
|
HUD_fix_enabled = pluginIniFile["2#Individual fix"]["HUD"].as<bool>();
|
||||||
camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as<bool>();
|
camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as<bool>();
|
||||||
DOF_fix_enabled = pluginIniFile["2#Individual fix"]["DOF"].as<bool>();
|
DOF_fix_enabled = pluginIniFile["2#Individual fix"]["DOF"].as<bool>();
|
||||||
vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as<bool>();
|
vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as<bool>();
|
||||||
worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
||||||
|
HUDvalue = pluginIniFile["3#Fixes tuning"]["HUD scaling"].as<int>();
|
||||||
cameraDistancevalue = pluginIniFile["3#Fixes tuning"]["Camera distance"].as<float>();
|
cameraDistancevalue = pluginIniFile["3#Fixes tuning"]["Camera distance"].as<float>();
|
||||||
}
|
}
|
||||||
catch (const std::exception& e) {}
|
catch (const std::exception& e) {}
|
||||||
@@ -209,12 +219,9 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
|||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
DrawFixCheckbox(individualFixes[0]);
|
for (int i = 0; i < 3; ++i) DrawFixCheckbox(individualFixes[i]);
|
||||||
DrawFixCheckbox(individualFixes[1]);
|
|
||||||
DrawFixCheckbox(individualFixes[2]);
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::TableSetColumnIndex(1);
|
||||||
DrawFixCheckbox(individualFixes[3]);
|
for (int i = 3; i < IM_ARRAYSIZE(individualFixes); ++i) DrawFixCheckbox(individualFixes[i]);
|
||||||
DrawFixCheckbox(individualFixes[4]);
|
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
@@ -226,10 +233,9 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
|||||||
if (ImGui::BeginTable("FixesSliders", 2, ImGuiTableFlags_SizingStretchSame)) {
|
if (ImGui::BeginTable("FixesSliders", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
DrawSlider2(sliders[0], 200);
|
for (int i = 0; i < 2; ++i) DrawSlider2(sliders[i], 200);
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::TableSetColumnIndex(1);
|
||||||
DrawSlider2(sliders[1], 200);
|
for (int i = 2; i < 4; ++i) DrawSlider2(sliders[i], 200);
|
||||||
DrawSlider2(sliders[2], 200);
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|||||||
Reference in New Issue
Block a user