diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp index d90d8d4f..f26e2e58 100644 --- a/OptiScaler/Config.cpp +++ b/OptiScaler/Config.cpp @@ -57,6 +57,10 @@ bool Config::Reload(std::filesystem::path iniPath) FGHUDFix = readBool("FrameGen", "HUDFix"); FGHUDLimit = readInt("FrameGen", "HUDLimit"); FGHUDFixExtended = readBool("FrameGen", "HUDFixExtended"); + FGRectLeft = readInt("FrameGen", "RectLeft"); + FGRectTop = readInt("FrameGen", "RectTop"); + FGRectWidth = readInt("FrameGen", "RectWidth"); + FGRectHeight = readInt("FrameGen", "RectHeight"); } // FSR @@ -480,6 +484,10 @@ bool Config::SaveIni() ini.SetValue("FrameGen", "HUDFix", GetBoolValue(Instance()->FGHUDFix).c_str()); ini.SetValue("FrameGen", "HUDLimit", GetIntValue(Instance()->FGHUDLimit).c_str()); ini.SetValue("FrameGen", "HUDFixExtended", GetBoolValue(Instance()->FGHUDFixExtended).c_str()); + ini.SetValue("FrameGen", "RectLeft", GetIntValue(Instance()->FGRectLeft).c_str()); + ini.SetValue("FrameGen", "RectTop", GetIntValue(Instance()->FGRectTop).c_str()); + ini.SetValue("FrameGen", "RectWidth", GetIntValue(Instance()->FGRectWidth).c_str()); + ini.SetValue("FrameGen", "RectHeight", GetIntValue(Instance()->FGRectHeight).c_str()); } // Output Scaling diff --git a/OptiScaler/Config.h b/OptiScaler/Config.h index 89a56964..c34b5e0c 100644 --- a/OptiScaler/Config.h +++ b/OptiScaler/Config.h @@ -167,6 +167,10 @@ public: std::optional FGHUDFix; std::optional FGHUDFixExtended; std::optional FGHUDLimit; + std::optional FGRectLeft; + std::optional FGRectTop; + std::optional FGRectWidth; + std::optional FGRectHeight; bool FGOnlyGenerated = false; bool FGChanged = false; bool SCChanged = false; diff --git a/OptiScaler/imgui/imgui_common.cpp b/OptiScaler/imgui/imgui_common.cpp index f7f24a2f..c7cb2a5e 100644 --- a/OptiScaler/imgui/imgui_common.cpp +++ b/OptiScaler/imgui/imgui_common.cpp @@ -964,6 +964,46 @@ void ImGuiCommon::RenderMenu() ImGui::Checkbox("FG Only Generated", &Config::Instance()->FGOnlyGenerated); ShowHelpMarker("Display only FSR 3.1 generated frames"); + + if (Config::Instance()->AdvancedSettings.value_or(false)) + { + ImGui::PushItemWidth(95.0); + int rectLeft = Config::Instance()->FGRectLeft.value_or(0); + if (ImGui::InputInt("Rect Left", &rectLeft)) + Config::Instance()->FGRectLeft = rectLeft; + + ImGui::SameLine(0.0f, 16.0f); + int rectTop = Config::Instance()->FGRectTop.value_or(0); + if (ImGui::InputInt("Rect Top", &rectTop)) + Config::Instance()->FGRectTop = rectTop; + + int rectWidth = Config::Instance()->FGRectWidth.value_or(0); + if (ImGui::InputInt("Rect Width", &rectWidth)) + Config::Instance()->FGRectWidth = rectWidth; + + ImGui::SameLine(0.0f, 16.0f); + int rectHeight = Config::Instance()->FGRectHeight.value_or(0); + if (ImGui::InputInt("Rect Height", &rectHeight)) + Config::Instance()->FGRectHeight = rectHeight; + + ImGui::PopItemWidth(); + ShowHelpMarker("Frame generation rectangle, adjust for letterboxed content"); + + ImGui::BeginDisabled(!Config::Instance()->FGRectLeft.has_value() && !Config::Instance()->FGRectTop.has_value() && + !Config::Instance()->FGRectWidth.has_value() && !Config::Instance()->FGRectHeight.has_value()); + + if (ImGui::Button("Reset FG Rect")) + { + Config::Instance()->FGRectLeft.reset(); + Config::Instance()->FGRectTop.reset(); + Config::Instance()->FGRectWidth.reset(); + Config::Instance()->FGRectHeight.reset(); + } + + ShowHelpMarker("Resets frame generation rectangle"); + + ImGui::EndDisabled(); + } } // Dx11 with Dx12