From ee750cbfc4b87d7cef838457257ab65238cd3895 Mon Sep 17 00:00:00 2001 From: Emmanuel AYME Date: Sun, 22 Mar 2026 22:52:31 +0100 Subject: [PATCH] Add camera distance fix --- DeathStranding2/dllmain.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/DeathStranding2/dllmain.cpp b/DeathStranding2/dllmain.cpp index 77439a6..87332a0 100644 --- a/DeathStranding2/dllmain.cpp +++ b/DeathStranding2/dllmain.cpp @@ -23,8 +23,10 @@ static GetGameInfosStruct GetGameInfos = nullptr; // Plugin variables for checkboxes and sliders static bool fov_fix_enabled = false; static bool ultrawide_fix_enabled = false; +static bool camera_fix_enabled = false; static bool fix_enabled = false; static int worldFOVvalue = 0; +static float cameraDistancevalue = 1.f; // Overlays popups static bool popup_Informations = false; @@ -33,8 +35,8 @@ static std::string log_content; // Plugin settings const std::string SETTINGS_FILE = "./pluginsettings.ini"; -const char* FIX_VERSION = "1.0.1"; -const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Enable ultrawide."; +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 - Enable ultrawide."; const char* DONATION_URL = "https://buymeacoffee.com/k4sh44"; // Scaling factor based on screen resolution @@ -45,7 +47,8 @@ static FixToggle individualFixes[] = { { "FOV", &fov_fix_enabled, GameFixes::FOV }, { "Ultrawide", &ultrawide_fix_enabled, GameFixes::UltraWide, "This fix is only intended for aspect ratio higher than 32/9.\n" "You will have every run to change aspect ratio in the settings,\n" - "from (16/9, 21/9, 32/9) to Auto to have it take effect."} }; + "from (16/9, 21/9, 32/9) to Auto to have it take effect."}, + { "Camera", &camera_fix_enabled, GameFixes::Camera } }; // Prepare array of sliders for ImGui static SliderFix2 sliders[2]; @@ -71,14 +74,19 @@ static void LoadFixDLL(reshade::api::effect_runtime* runtime) { // Apply initial values loaded from settings if (SetValues) { SetValues(GameSetting::FOV, worldFOVvalue); + SetValues(GameSetting::CameraDistance, cameraDistancevalue); } if (SetFixEnabled) SetFixEnabled(fix_enabled, true); if (SetFixes) { SetFixes(GameFixes::FOV, fov_fix_enabled); SetFixes(GameFixes::UltraWide, ultrawide_fix_enabled); + SetFixes(GameFixes::Camera, camera_fix_enabled); + SetFixes(GameFixes::None, false); } 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", + "Value is a multiplier.\nFinal value reported below is in meters."}; } } @@ -93,8 +101,10 @@ static void SaveSettings() { pluginIniFile["2#Individual fix"].setComment("Controls each fix individually"); pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled; pluginIniFile["2#Individual fix"]["UltraWide"] = ultrawide_fix_enabled; + pluginIniFile["2#Individual fix"]["Camera"] = camera_fix_enabled; pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune"); pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue; + pluginIniFile["3#Fixes tuning"]["Camera distance"] = cameraDistancevalue; pluginIniFile.save(SETTINGS_FILE); } @@ -106,7 +116,9 @@ static void LoadSettings() { fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as(); fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as(); ultrawide_fix_enabled = pluginIniFile["2#Individual fix"]["UltraWide"].as(); + camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as(); worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as(); + cameraDistancevalue = pluginIniFile["3#Fixes tuning"]["Camera distance"].as(); } catch (const std::exception& e) {} } @@ -182,6 +194,7 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) { DrawFixCheckbox(individualFixes[0]); ImGui::TableSetColumnIndex(1); DrawFixCheckbox(individualFixes[1]); + DrawFixCheckbox(individualFixes[2]); ImGui::EndTable(); } @@ -194,6 +207,8 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); DrawSlider2(sliders[0], 200); + ImGui::TableSetColumnIndex(1); + DrawSlider2(sliders[1], 200); ImGui::EndTable(); } ImGui::PopStyleVar(); @@ -207,6 +222,7 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) { GetGameInfos(&infos); ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", infos.screenWidth, infos.screenHeight, infos.aspectRatio); ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Out: %.2f", infos.FOVIn, infos.FOVOut); + ImGui::TextColored(ImColor(48, 179, 25), "Camera distance In: %.2f, Out: %.2f", infos.cameraIn, infos.cameraOut); } } }