From 83d144b7e656a81a5e985ce8791c6924ae5a1908 Mon Sep 17 00:00:00 2001 From: cdozdil Date: Thu, 14 Nov 2024 11:29:38 +0300 Subject: [PATCH] made immadiate capture default disabled and ini option refactored menu a bit --- OptiScaler/Config.cpp | 4 ++++ OptiScaler/Config.h | 2 +- OptiScaler/hooks/HooksDx.cpp | 6 +++--- OptiScaler/imgui/imgui_common.cpp | 18 ++++++++++-------- OptiScaler/resource.h | 2 +- nvngx.ini | 12 +++++++++++- 6 files changed, 30 insertions(+), 14 deletions(-) diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp index 0fb94841..aeb1d71c 100644 --- a/OptiScaler/Config.cpp +++ b/OptiScaler/Config.cpp @@ -76,6 +76,9 @@ bool Config::Reload(std::filesystem::path iniPath) if (!FGHUDFixExtended.has_value()) FGHUDFixExtended = readBool("FrameGen", "HUDFixExtended"); + if (!FGImmediateCapture.has_value()) + FGImmediateCapture = readBool("FrameGen", "HUDFixImmadiate"); + if (!FGRectLeft.has_value()) FGRectLeft = readInt("FrameGen", "RectLeft"); @@ -704,6 +707,7 @@ 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", "HUDFixImmadiate", GetBoolValue(Instance()->FGImmediateCapture).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()); diff --git a/OptiScaler/Config.h b/OptiScaler/Config.h index 46514fa9..c526714b 100644 --- a/OptiScaler/Config.h +++ b/OptiScaler/Config.h @@ -167,6 +167,7 @@ public: std::optional FGAsync; std::optional FGHUDFix; std::optional FGHUDFixExtended; + std::optional FGImmediateCapture; std::optional FGHUDLimit; std::optional FGRectLeft; std::optional FGRectTop; @@ -177,7 +178,6 @@ public: bool SCChanged = false; bool SkipHeapCapture = false; bool UseThreadingForHeaps = false; - bool FGImmediateCapture = true; bool FGCaptureResources = false; int FGCapturedResourceCount = false; diff --git a/OptiScaler/hooks/HooksDx.cpp b/OptiScaler/hooks/HooksDx.cpp index d78d5261..944cd20f 100644 --- a/OptiScaler/hooks/HooksDx.cpp +++ b/OptiScaler/hooks/HooksDx.cpp @@ -1324,7 +1324,7 @@ static void hkSetGraphicsRootDescriptorTable(ID3D12GraphicsCommandList* This, UI do { - if (Config::Instance()->FGImmediateCapture && CheckCapture(__FUNCTION__)) + if (Config::Instance()->FGImmediateCapture.value_or(false) && CheckCapture(__FUNCTION__)) { CaptureHudless(This, capturedBuffer, capturedBuffer->state); break; @@ -1412,7 +1412,7 @@ static void hkOMSetRenderTargets(ID3D12GraphicsCommandList* This, UINT NumRender LOG_DEBUG_ONLY("CommandList: {:X}", (size_t)This); resource->state = D3D12_RESOURCE_STATE_RENDER_TARGET; - if (Config::Instance()->FGImmediateCapture && CheckCapture(__FUNCTION__)) + if (Config::Instance()->FGImmediateCapture.value_or(false) && CheckCapture(__FUNCTION__)) { CaptureHudless(This, resource, resource->state); break; @@ -1491,7 +1491,7 @@ static void hkSetComputeRootDescriptorTable(ID3D12GraphicsCommandList* This, UIN do { - if (Config::Instance()->FGImmediateCapture && CheckForHudless(__FUNCTION__, capturedBuffer) && CheckCapture(__FUNCTION__)) + if (Config::Instance()->FGImmediateCapture.value_or(false) && CheckForHudless(__FUNCTION__, capturedBuffer) && CheckCapture(__FUNCTION__)) { CaptureHudless(This, capturedBuffer, capturedBuffer->state); break; diff --git a/OptiScaler/imgui/imgui_common.cpp b/OptiScaler/imgui/imgui_common.cpp index 3bfc4c52..8fed6624 100644 --- a/OptiScaler/imgui/imgui_common.cpp +++ b/OptiScaler/imgui/imgui_common.cpp @@ -917,22 +917,24 @@ void ImGuiCommon::RenderMenu() } ShowHelpMarker("Delay HUDless capture, high values might cause crash!"); - ImGui::SameLine(0.0f, 16.0f); + auto immediate = Config::Instance()->FGImmediateCapture.value_or(false); + if (ImGui::Checkbox("FG Immediate Capture", &immediate)) + { + LOG_DEBUG("Enabled set FGImmediateCapture: {}", immediate); + Config::Instance()->FGImmediateCapture = immediate; + } + ShowHelpMarker("Enables capturing of resources before shader execution.\nIncrease hudless capture chances but might cause capturing of unnecessary resources."); + auto hudExtended = Config::Instance()->FGHUDFixExtended.value_or(false); - if (ImGui::Checkbox("Extended", &hudExtended)) + if (ImGui::Checkbox("FG Extended Capture", &hudExtended)) { LOG_DEBUG("Enabled set FGHUDFixExtended: {}", hudExtended); Config::Instance()->FGHUDFixExtended = hudExtended; } - ShowHelpMarker("Extended HUDless checks, might cause crash and slowdowns!"); + ShowHelpMarker("Extended format checks for possible hudless\nMight cause crash and slowdowns!"); if (Config::Instance()->AdvancedSettings.value_or(false)) { - if (ImGui::Checkbox("FG Immediate Capture", &Config::Instance()->FGImmediateCapture)) - LOG_DEBUG("Enabled set FGImmediateCapture: {}", Config::Instance()->FGImmediateCapture); - - ShowHelpMarker("Immediately capture of resources, before shader executions.\nIncrease hudless capture chances but might cause capturing of\nunnecessary resources."); - if (ImGui::Checkbox("FG Use Threading For Heap Tracking", &Config::Instance()->UseThreadingForHeaps)) LOG_DEBUG("Enabled set UseThreadingForHeaps: {}", Config::Instance()->UseThreadingForHeaps); diff --git a/OptiScaler/resource.h b/OptiScaler/resource.h index 5cc898fb..720af01f 100644 --- a/OptiScaler/resource.h +++ b/OptiScaler/resource.h @@ -21,7 +21,7 @@ #define VER_MAJOR_VERSION 0 #define VER_MINOR_VERSION 7 #define VER_HOTFIX_VERSION 0 -#define VER_BUILD_NUMBER 59 +#define VER_BUILD_NUMBER 60 #define VER_PRE_RELEASE diff --git a/nvngx.ini b/nvngx.ini index 66128549..b326a656 100644 --- a/nvngx.ini +++ b/nvngx.ini @@ -48,10 +48,20 @@ AllowAsync=auto HUDFix=auto ; Delays HUDless image capture -; Might cause crashes, specially if set too high +; Might cause crashes, specially if set too high! ; integer value above > 0 - Default (auto) is 0 HUDLimit=auto +; Extended HUDless checks for more image formats +; Might cause crash and slowdowns. +; true or false - Default (auto) is false +HUDFixExtended=auto + +; Enables capturing of resources before shader execution. +; Increase hudless capture chances but might cause capturing of unnecessary resources. +; true or false - Default (auto) is false +HUDFixImmadiate=auto + ; Defines FG rectangle ; integer value - Default (auto) is whole screen RectLeft=auto