From 2a729ebd6478d56d694b9f8bd2d4ac4d60b96f16 Mon Sep 17 00:00:00 2001 From: cdozdil Date: Sun, 30 Jun 2024 22:29:24 +0300 Subject: [PATCH] added advanced options fixed changeBackend issues --- OptiScaler/Config.cpp | 4 +- OptiScaler/Config.h | 2 +- OptiScaler/imgui/imgui_common.h | 122 ++++++++++++++++++++------------ nvngx.ini | 4 +- 4 files changed, 81 insertions(+), 51 deletions(-) diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp index d52c8b56..6568b189 100644 --- a/OptiScaler/Config.cpp +++ b/OptiScaler/Config.cpp @@ -97,7 +97,7 @@ bool Config::Reload(std::filesystem::path iniPath) ShortcutKey = readInt("Menu", "ShortcutKey"); ResetKey = readInt("Menu", "ResetKey"); MenuInitDelay = readInt("Menu", "MenuInitDelay"); - ExtraEnablerSettings = readBool("Menu", "ExtraEnablerSettings"); + AdvancedSettings = readBool("Menu", "AdvancedSettings"); // Hooks HookOriginalNvngxOnly = readBool("Hooks", "HookOriginalNvngxOnly"); @@ -366,7 +366,7 @@ bool Config::SaveIni() ini.SetValue("Menu", "ResetKey", GetIntValue(Instance()->ResetKey).c_str()); ini.SetValue("Menu", "ShortcutKey", GetIntValue(Instance()->ShortcutKey).c_str()); ini.SetValue("Menu", "MenuInitDelay", GetIntValue(Instance()->MenuInitDelay).c_str()); - ini.SetValue("Menu", "ExtraEnablerSettings", GetBoolValue(Instance()->ExtraEnablerSettings).c_str()); + ini.SetValue("Menu", "AdvancedSettings", GetBoolValue(Instance()->AdvancedSettings).c_str()); // Hooks ini.SetValue("Hooks", "HookOriginalNvngxOnly", GetBoolValue(Instance()->HookOriginalNvngxOnly).c_str()); diff --git a/OptiScaler/Config.h b/OptiScaler/Config.h index 53d17fd7..c1ddce8d 100644 --- a/OptiScaler/Config.h +++ b/OptiScaler/Config.h @@ -73,7 +73,7 @@ public: std::optional ShortcutKey; std::optional ResetKey; std::optional MenuInitDelay; - std::optional ExtraEnablerSettings; + std::optional AdvancedSettings; // hooks std::optional HookOriginalNvngxOnly; diff --git a/OptiScaler/imgui/imgui_common.h b/OptiScaler/imgui/imgui_common.h index 5932d694..692e8311 100644 --- a/OptiScaler/imgui/imgui_common.h +++ b/OptiScaler/imgui/imgui_common.h @@ -861,7 +861,7 @@ public: // DYNAMIC PROPERTIES ----------------------------- // Dx11 with Dx12 - if (Config::Instance()->Api == NVNGX_DX11 && + if (Config::Instance()->AdvancedSettings.value_or(false) && Config::Instance()->Api == NVNGX_DX11 && Config::Instance()->Dx11Upscaler.value_or("fsr22") != "fsr22" && Config::Instance()->Dx11Upscaler.value_or("fsr22") != "dlss") { ImGui::SeparatorText("Dx11 with Dx12 Settings"); @@ -927,6 +927,7 @@ public: if (ImGui::Selectable(models[n], (Config::Instance()->NetworkModel.value_or(0) == n))) { Config::Instance()->NetworkModel = n; + Config::Instance()->newBackend = currentBackend; Config::Instance()->changeBackend = true; } } @@ -1026,6 +1027,8 @@ public: { if (Config::Instance()->CurrentFeature->Name() == "DLSSD") Config::Instance()->newBackend = "dlssd"; + else + Config::Instance()->newBackend = currentBackend; Config::Instance()->changeBackend = true; } @@ -1121,11 +1124,7 @@ public: Config::Instance()->DE_DynamicLimitEnabled = dfgEnabled; } - bool extraSettings = Config::Instance()->ExtraEnablerSettings.value_or(false); - if (ImGui::Checkbox("Advanced Settings", &extraSettings)) - Config::Instance()->ExtraEnablerSettings = extraSettings; - - if (Config::Instance()->ExtraEnablerSettings.value_or(false)) + if (Config::Instance()->AdvancedSettings.value_or(false)) { std::string selected; @@ -1224,6 +1223,9 @@ public: if (Config::Instance()->CurrentFeature->Name() == "DLSSD") Config::Instance()->newBackend = "dlssd"; + else + Config::Instance()->newBackend = currentBackend; + Config::Instance()->changeBackend = true; } @@ -1239,7 +1241,7 @@ public: } // DX12 ----------------------------- - if (Config::Instance()->Api == NVNGX_DX12) + if (Config::Instance()->AdvancedSettings.value_or(false) && Config::Instance()->Api == NVNGX_DX12) { // MIPMAP BIAS ----------------------------- ImGui::SeparatorText("Mipmap Bias (Dx12)"); @@ -1309,7 +1311,10 @@ public: Config::Instance()->OverrideSharpness = overrideSharpness; if (currentBackend == "dlss" && Config::Instance()->CurrentFeature->Version().major < 3) + { + Config::Instance()->newBackend = currentBackend; Config::Instance()->changeBackend = true; + } } ImGui::BeginDisabled(!Config::Instance()->OverrideSharpness.value_or(false)); @@ -1393,6 +1398,8 @@ public: if (Config::Instance()->CurrentFeature->Name() == "DLSSD") Config::Instance()->newBackend = "dlssd"; + else + Config::Instance()->newBackend = currentBackend; Config::Instance()->changeBackend = true; } @@ -1404,58 +1411,72 @@ public: if (Config::Instance()->CurrentFeature->Name() == "DLSSD") Config::Instance()->newBackend = "dlssd"; + else + Config::Instance()->newBackend = currentBackend; Config::Instance()->changeBackend = true; } ImGui::TableNextColumn(); - if (bool depth = Config::Instance()->DepthInverted.value_or(false); ImGui::Checkbox("Depth Inverted", &depth)) + + if (Config::Instance()->AdvancedSettings.value_or(false)) { - Config::Instance()->DepthInverted = depth; - - if (Config::Instance()->CurrentFeature->Name() == "DLSSD") - Config::Instance()->newBackend = "dlssd"; - - Config::Instance()->changeBackend = true; - } - - ImGui::TableNextColumn(); - if (bool jitter = Config::Instance()->JitterCancellation.value_or(false); ImGui::Checkbox("Jitter Cancellation", &jitter)) - { - Config::Instance()->JitterCancellation = jitter; - - if (Config::Instance()->CurrentFeature->Name() == "DLSSD") - Config::Instance()->newBackend = "dlssd"; - - Config::Instance()->changeBackend = true; - } - - ImGui::TableNextColumn(); - if (bool mv = Config::Instance()->DisplayResolution.value_or(false); ImGui::Checkbox("Display Res. MV", &mv)) - { - Config::Instance()->DisplayResolution = mv; - - if (mv) + if (bool depth = Config::Instance()->DepthInverted.value_or(false); ImGui::Checkbox("Depth Inverted", &depth)) { - Config::Instance()->OutputScalingEnabled = false; - _ssEnabled = false; + Config::Instance()->DepthInverted = depth; + + if (Config::Instance()->CurrentFeature->Name() == "DLSSD") + Config::Instance()->newBackend = "dlssd"; + else + Config::Instance()->newBackend = currentBackend; + + Config::Instance()->changeBackend = true; } - if (Config::Instance()->CurrentFeature->Name() == "DLSSD") - Config::Instance()->newBackend = "dlssd"; + ImGui::TableNextColumn(); + if (bool jitter = Config::Instance()->JitterCancellation.value_or(false); ImGui::Checkbox("Jitter Cancellation", &jitter)) + { + Config::Instance()->JitterCancellation = jitter; - Config::Instance()->changeBackend = true; - } + if (Config::Instance()->CurrentFeature->Name() == "DLSSD") + Config::Instance()->newBackend = "dlssd"; + else + Config::Instance()->newBackend = currentBackend; - ImGui::TableNextColumn(); - if (bool rm = Config::Instance()->DisableReactiveMask.value_or(true); ImGui::Checkbox("Disable Reactive Mask", &rm)) - { - Config::Instance()->DisableReactiveMask = rm; + Config::Instance()->changeBackend = true; + } - if (Config::Instance()->CurrentFeature->Name() == "DLSSD") - Config::Instance()->newBackend = "dlssd"; + ImGui::TableNextColumn(); + if (bool mv = Config::Instance()->DisplayResolution.value_or(false); ImGui::Checkbox("Display Res. MV", &mv)) + { + Config::Instance()->DisplayResolution = mv; - Config::Instance()->changeBackend = true; + if (mv) + { + Config::Instance()->OutputScalingEnabled = false; + _ssEnabled = false; + } + + if (Config::Instance()->CurrentFeature->Name() == "DLSSD") + Config::Instance()->newBackend = "dlssd"; + else + Config::Instance()->newBackend = currentBackend; + + Config::Instance()->changeBackend = true; + } + + ImGui::TableNextColumn(); + if (bool rm = Config::Instance()->DisableReactiveMask.value_or(true); ImGui::Checkbox("Disable Reactive Mask", &rm)) + { + Config::Instance()->DisableReactiveMask = rm; + + if (Config::Instance()->CurrentFeature->Name() == "DLSSD") + Config::Instance()->newBackend = "dlssd"; + else + Config::Instance()->newBackend = currentBackend; + + Config::Instance()->changeBackend = true; + } } ImGui::EndTable(); @@ -1505,6 +1526,15 @@ public: ImGui::EndCombo(); } + // ADVANCED SETTINGS ----------------------------- + ImGui::SeparatorText("Advanced Settings"); + + bool advancedSettings = Config::Instance()->AdvancedSettings.value_or(false); + if (ImGui::Checkbox("Enable Advanced Settings", &advancedSettings)) + Config::Instance()->AdvancedSettings = advancedSettings; + + + ImGui::EndTable(); // BOTTOM LINE --------------- diff --git a/nvngx.ini b/nvngx.ini index 1ba3c560..1b4ecc74 100644 --- a/nvngx.ini +++ b/nvngx.ini @@ -154,9 +154,9 @@ ResetKey=auto ; Integer value - Default (auto) is 90 frames MenuInitDelay=auto -; Enables advanced settings for DLSS Enabler in menu +; Enables advanced settings ; true or false - Default (auto) is false -ExtraEnablerSettings=auto +AdvancedSettings=auto