From ffe5a73940ced49ac0a3f5901efd816ae2f59304 Mon Sep 17 00:00:00 2001 From: cdozdil Date: Mon, 28 Apr 2025 17:10:21 +0300 Subject: [PATCH] Added saving ini settings as hex --- OptiScaler/Config.cpp | 9 +- OptiScaler/Config.h | 635 +++++++++++++++++++++--------------------- 2 files changed, 324 insertions(+), 320 deletions(-) diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp index 04457a9a..5aaacd03 100644 --- a/OptiScaler/Config.cpp +++ b/OptiScaler/Config.cpp @@ -508,11 +508,14 @@ std::string GetBoolValue(std::optional value) return value.value() ? "true" : "false"; } -std::string GetIntValue(std::optional value) +std::string GetIntValue(std::optional value, bool getHex = false) { if (!value.has_value()) return "auto"; + if(getHex) + return std::format("{:#x}", value.value()); + return std::to_string(value.value()); } @@ -678,10 +681,12 @@ bool Config::SaveIni() { ini.SetValue("Menu", "Scale", GetFloatValue(Instance()->MenuScale.value_for_config()).c_str()); ini.SetValue("Menu", "OverlayMenu", GetBoolValue(Instance()->OverlayMenu.value_for_config()).c_str()); - ini.SetValue("Menu", "ShortcutKey", GetIntValue(Instance()->ShortcutKey.value_for_config()).c_str()); + ini.SetValue("Menu", "ShortcutKey", GetIntValue(Instance()->ShortcutKey.value_for_config(), true).c_str()); ini.SetValue("Menu", "ExtendedLimits", GetBoolValue(Instance()->ExtendedLimits.value_for_config()).c_str()); ini.SetValue("Menu", "ShowFps", GetBoolValue(Instance()->ShowFps.value_for_config()).c_str()); ini.SetValue("Menu", "UseHQFont", GetBoolValue(Instance()->UseHQFont.value_for_config()).c_str()); + ini.SetValue("Menu", "FpsShortcutKey", GetIntValue(Instance()->FpsShortcutKey.value_for_config(), true).c_str()); + ini.SetValue("Menu", "FpsCycleShortcutKey", GetIntValue(Instance()->FpsCycleShortcutKey.value_for_config(), true).c_str()); ini.SetValue("Menu", "FpsOverlayPos", GetIntValue(Instance()->FpsOverlayPos.value_for_config()).c_str()); ini.SetValue("Menu", "FpsOverlayType", GetIntValue(Instance()->FpsOverlayType.value_for_config()).c_str()); ini.SetValue("Menu", "FpsOverlayHorizontal", GetBoolValue(Instance()->FpsOverlayHorizontal.value_for_config()).c_str()); diff --git a/OptiScaler/Config.h b/OptiScaler/Config.h index 8c979de5..0d091e06 100644 --- a/OptiScaler/Config.h +++ b/OptiScaler/Config.h @@ -7,401 +7,400 @@ enum HasDefaultValue { - WithDefault, + WithDefault, NoDefault, - SoftDefault // Change always gets saved to the config + SoftDefault // Change always gets saved to the config }; template class CustomOptional : public std::optional { private: - T _defaultValue; - std::optional _configIni; - bool _volatile; + T _defaultValue; + std::optional _configIni; + bool _volatile; public: - CustomOptional(T defaultValue) requires (defaultState != NoDefault) - : std::optional(), _defaultValue(std::move(defaultValue)), _configIni(std::nullopt), _volatile(false) {} + CustomOptional(T defaultValue) requires (defaultState != NoDefault) + : std::optional(), _defaultValue(std::move(defaultValue)), _configIni(std::nullopt), _volatile(false) {} - CustomOptional() requires (defaultState == NoDefault) - : std::optional(), _defaultValue(T{}), _configIni(std::nullopt), _volatile(false) {} + CustomOptional() requires (defaultState == NoDefault) + : std::optional(), _defaultValue(T{}), _configIni(std::nullopt), _volatile(false) {} - // Prevents a change from being saved to ini - constexpr void set_volatile_value(const T& value) { - if (!_volatile) { // make sure the previously set value is saved - if (this->has_value()) - _configIni = this->value(); - else - _configIni = std::nullopt; - } - _volatile = true; - std::optional::operator=(value); - } - - // Use this when first setting a CustomOptional - constexpr void set_from_config(const std::optional& opt) { - if (!this->has_value()) { - _configIni = opt; - std::optional::operator=(opt); - } - } + // Prevents a change from being saved to ini + constexpr void set_volatile_value(const T& value) { + if (!_volatile) { // make sure the previously set value is saved + if (this->has_value()) + _configIni = this->value(); + else + _configIni = std::nullopt; + } + _volatile = true; + std::optional::operator=(value); + } - constexpr CustomOptional& operator=(const T& value) { - _volatile = false; - std::optional::operator=(value); - return *this; - } + // Use this when first setting a CustomOptional + constexpr void set_from_config(const std::optional& opt) { + if (!this->has_value()) { + _configIni = opt; + std::optional::operator=(opt); + } + } - constexpr CustomOptional& operator=(T&& value) { - _volatile = false; - std::optional::operator=(std::move(value)); - return *this; - } + constexpr CustomOptional& operator=(const T& value) { + _volatile = false; + std::optional::operator=(value); + return *this; + } - constexpr CustomOptional& operator=(const std::optional& opt) { - _volatile = false; - std::optional::operator=(opt); - return *this; - } + constexpr CustomOptional& operator=(T&& value) { + _volatile = false; + std::optional::operator=(std::move(value)); + return *this; + } - constexpr CustomOptional& operator=(std::optional&& opt) { - _volatile = false; - std::optional::operator=(std::move(opt)); - return *this; - } + constexpr CustomOptional& operator=(const std::optional& opt) { + _volatile = false; + std::optional::operator=(opt); + return *this; + } - // Needed for string literals for some reason - constexpr CustomOptional& operator=(const char* value) requires std::same_as { - _volatile = false; - std::optional::operator=(T(value)); - return *this; - } + constexpr CustomOptional& operator=(std::optional&& opt) { + _volatile = false; + std::optional::operator=(std::move(opt)); + return *this; + } - constexpr T value_or_default() const& requires (defaultState != NoDefault) { - return this->has_value() ? this->value() : _defaultValue; - } + // Needed for string literals for some reason + constexpr CustomOptional& operator=(const char* value) requires std::same_as { + _volatile = false; + std::optional::operator=(T(value)); + return *this; + } - constexpr T value_or_default()&& requires (defaultState != NoDefault) { - return this->has_value() ? std::move(this->value()) : std::move(_defaultValue); - } + constexpr T value_or_default() const& requires (defaultState != NoDefault) { + return this->has_value() ? this->value() : _defaultValue; + } - constexpr std::optional value_for_config() requires (defaultState == WithDefault) { - if (_volatile) { - if (_configIni != _defaultValue) - return _configIni; + constexpr T value_or_default() && requires (defaultState != NoDefault) { + return this->has_value() ? std::move(this->value()) : std::move(_defaultValue); + } - return std::nullopt; - } + constexpr std::optional value_for_config() requires (defaultState == WithDefault) { + if (_volatile) { + if (_configIni != _defaultValue) + return _configIni; - if (!this->has_value() || *this == _defaultValue) - return std::nullopt; + return std::nullopt; + } - return this->value(); - } + if (!this->has_value() || *this == _defaultValue) + return std::nullopt; - constexpr std::optional value_for_config() requires (defaultState != WithDefault) { - if (_volatile) - return _configIni; + return this->value(); + } - if (this->has_value()) - return this->value(); + constexpr std::optional value_for_config() requires (defaultState != WithDefault) { + if (_volatile) + return _configIni; - return std::nullopt; - } + if (this->has_value()) + return this->value(); - constexpr T value_for_config_or(T other) { - auto option = value_for_config(); + return std::nullopt; + } - if (option.has_value()) - return option.value(); - else - return other; - } + constexpr T value_for_config_or(T other) { + auto option = value_for_config(); + + if (option.has_value()) + return option.value(); + else + return other; + } }; class Config { public: - Config(); + Config(); - // Init flags - CustomOptional DepthInverted; - CustomOptional AutoExposure; - CustomOptional HDR; - CustomOptional JitterCancellation; - CustomOptional DisplayResolution; - CustomOptional DisableReactiveMask; - CustomOptional DlssReactiveMaskBias{ 0.45f }; + // Init flags + CustomOptional DepthInverted; + CustomOptional AutoExposure; + CustomOptional HDR; + CustomOptional JitterCancellation; + CustomOptional DisplayResolution; + CustomOptional DisableReactiveMask; + CustomOptional DlssReactiveMaskBias{ 0.45f }; - // Logging - CustomOptional LogToFile{ false }; - CustomOptional LogToConsole{ false }; - CustomOptional LogToNGX{ false }; - CustomOptional OpenConsole{ false }; - CustomOptional DebugWait{ false }; // not in ini - CustomOptional LogLevel{ 2 }; - CustomOptional LogFileName{ L"OptiScaler.log" }; - CustomOptional LogSingleFile{ true }; - CustomOptional LogAsync{ false }; - CustomOptional LogAsyncThreads{ 4 }; + // Logging + CustomOptional LogToFile{ false }; + CustomOptional LogToConsole{ false }; + CustomOptional LogToNGX{ false }; + CustomOptional OpenConsole{ false }; + CustomOptional DebugWait{ false }; // not in ini + CustomOptional LogLevel{ 2 }; + CustomOptional LogFileName{ L"OptiScaler.log" }; + CustomOptional LogSingleFile{ true }; + CustomOptional LogAsync{ false }; + CustomOptional LogAsyncThreads{ 4 }; - // XeSS - CustomOptional BuildPipelines{ true }; - CustomOptional NetworkModel{ 0 }; - CustomOptional CreateHeaps{ true }; - CustomOptional XeSSLibrary; - CustomOptional XeSSDx11Library; + // XeSS + CustomOptional BuildPipelines{ true }; + CustomOptional NetworkModel{ 0 }; + CustomOptional CreateHeaps{ true }; + CustomOptional XeSSLibrary; + CustomOptional XeSSDx11Library; - // DLSS - CustomOptional DLSSEnabled{ true }; - CustomOptional NvngxPath; - CustomOptional NVNGX_DLSS_Library; - CustomOptional DLSSFeaturePath; - CustomOptional RenderPresetOverride{ false }; - CustomOptional RenderPresetForAll{ 0 }; - CustomOptional RenderPresetDLAA{ 0 }; - CustomOptional RenderPresetUltraQuality{ 0 }; - CustomOptional RenderPresetQuality{ 0 }; - CustomOptional RenderPresetBalanced{ 0 }; - CustomOptional RenderPresetPerformance{ 0 }; - CustomOptional RenderPresetUltraPerformance{ 0 }; + // DLSS + CustomOptional DLSSEnabled{ true }; + CustomOptional NvngxPath; + CustomOptional NVNGX_DLSS_Library; + CustomOptional DLSSFeaturePath; + CustomOptional RenderPresetOverride{ false }; + CustomOptional RenderPresetForAll{ 0 }; + CustomOptional RenderPresetDLAA{ 0 }; + CustomOptional RenderPresetUltraQuality{ 0 }; + CustomOptional RenderPresetQuality{ 0 }; + CustomOptional RenderPresetBalanced{ 0 }; + CustomOptional RenderPresetPerformance{ 0 }; + CustomOptional RenderPresetUltraPerformance{ 0 }; - // Nukems - CustomOptional MakeDepthCopy{ false }; + // Nukems + CustomOptional MakeDepthCopy{ false }; - // CAS - CustomOptional RcasEnabled{ false }; - CustomOptional MotionSharpnessEnabled{ false }; - CustomOptional MotionSharpnessDebug{ false }; - CustomOptional MotionSharpness{ 0.4f }; - CustomOptional MotionThreshold{ 0.0f }; - CustomOptional MotionScaleLimit{ 10.0f }; + // CAS + CustomOptional RcasEnabled{ false }; + CustomOptional MotionSharpnessEnabled{ false }; + CustomOptional MotionSharpnessDebug{ false }; + CustomOptional MotionSharpness{ 0.4f }; + CustomOptional MotionThreshold{ 0.0f }; + CustomOptional MotionScaleLimit{ 10.0f }; - // Sharpness - CustomOptional OverrideSharpness{ false }; - CustomOptional Sharpness{ 0.3f }; - CustomOptional ContrastEnabled{ false }; - CustomOptional Contrast{ 0.0f }; + // Sharpness + CustomOptional OverrideSharpness{ false }; + CustomOptional Sharpness{ 0.3f }; + CustomOptional ContrastEnabled{ false }; + CustomOptional Contrast{ 0.0f }; - // Menu - CustomOptional MenuScale{ 1.0f }; - CustomOptional OverlayMenu{ true }; - CustomOptional ShortcutKey{ VK_INSERT }; - CustomOptional ExtendedLimits{ false }; - CustomOptional ShowFps{ false }; - CustomOptional FpsOverlayPos{ 0 }; // 0 Top Left, 1 Top Right, 2 Bottom Left, 3 Bottom Right - CustomOptional FpsOverlayType{ 0 }; // 0 Only FPS, 1 +Frame Time, 2 +Upscaler Time, 3 +Frame Time Graph, 4 +Upscaler Time Graph - CustomOptional FpsShortcutKey{ VK_PRIOR }; - CustomOptional FpsCycleShortcutKey{ VK_NEXT }; - CustomOptional FpsOverlayHorizontal{ false }; - CustomOptional FpsOverlayAlpha{ 0.4f }; - CustomOptional UseHQFont{ true }; + // Menu + CustomOptional MenuScale{ 1.0f }; + CustomOptional OverlayMenu{ true }; + CustomOptional ShortcutKey{ VK_INSERT }; + CustomOptional ExtendedLimits{ false }; + CustomOptional ShowFps{ false }; + CustomOptional FpsOverlayPos{ 0 }; // 0 Top Left, 1 Top Right, 2 Bottom Left, 3 Bottom Right + CustomOptional FpsOverlayType{ 0 }; // 0 Only FPS, 1 +Frame Time, 2 +Upscaler Time, 3 +Frame Time Graph, 4 +Upscaler Time Graph + CustomOptional FpsShortcutKey{ VK_PRIOR }; + CustomOptional FpsCycleShortcutKey{ VK_NEXT }; + CustomOptional FpsOverlayHorizontal{ false }; + CustomOptional FpsOverlayAlpha{ 0.4f }; + CustomOptional UseHQFont{ true }; - // Hooks - CustomOptional HookOriginalNvngxOnly{ false }; + // Hooks + CustomOptional HookOriginalNvngxOnly{ false }; - // Upscale Ratio Override - CustomOptional UpscaleRatioOverrideEnabled{ false }; - CustomOptional UpscaleRatioOverrideValue{ 1.3f }; + // Upscale Ratio Override + CustomOptional UpscaleRatioOverrideEnabled{ false }; + CustomOptional UpscaleRatioOverrideValue{ 1.3f }; - // DRS - CustomOptional DrsMinOverrideEnabled{ false }; - CustomOptional DrsMaxOverrideEnabled{ false }; + // DRS + CustomOptional DrsMinOverrideEnabled{ false }; + CustomOptional DrsMaxOverrideEnabled{ false }; - // Quality Overrides - CustomOptional QualityRatioOverrideEnabled{ false }; - CustomOptional QualityRatio_DLAA{ 1.0f }; - CustomOptional QualityRatio_UltraQuality{ 1.3f }; - CustomOptional QualityRatio_Quality{ 1.5f }; - CustomOptional QualityRatio_Balanced{ 1.7f }; - CustomOptional QualityRatio_Performance{ 2.0f }; - CustomOptional QualityRatio_UltraPerformance{ 3.0f }; + // Quality Overrides + CustomOptional QualityRatioOverrideEnabled{ false }; + CustomOptional QualityRatio_DLAA{ 1.0f }; + CustomOptional QualityRatio_UltraQuality{ 1.3f }; + CustomOptional QualityRatio_Quality{ 1.5f }; + CustomOptional QualityRatio_Balanced{ 1.7f }; + CustomOptional QualityRatio_Performance{ 2.0f }; + CustomOptional QualityRatio_UltraPerformance{ 3.0f }; - // Hotfixes - CustomOptional MipmapBiasOverride; // disabled by default - CustomOptional MipmapBiasFixedOverride{ false }; - CustomOptional MipmapBiasScaleOverride{ false }; - CustomOptional MipmapBiasOverrideAll{ false }; - CustomOptional AnisotropyOverride; // disabled by default - CustomOptional OverrideShaderSampler{ false }; - CustomOptional RoundInternalResolution; // disabled by default + // Hotfixes + CustomOptional MipmapBiasOverride; // disabled by default + CustomOptional MipmapBiasFixedOverride{ false }; + CustomOptional MipmapBiasScaleOverride{ false }; + CustomOptional MipmapBiasOverrideAll{ false }; + CustomOptional AnisotropyOverride; // disabled by default + CustomOptional OverrideShaderSampler{ false }; + CustomOptional RoundInternalResolution; // disabled by default - CustomOptional RestoreComputeSignature{ false }; - CustomOptional RestoreGraphicSignature{ false }; - CustomOptional SkipFirstFrames; // disabled by default + CustomOptional RestoreComputeSignature{ false }; + CustomOptional RestoreGraphicSignature{ false }; + CustomOptional SkipFirstFrames; // disabled by default - CustomOptional UsePrecompiledShaders{ true }; + CustomOptional UsePrecompiledShaders{ true }; - CustomOptional UseGenericAppIdWithDlss{ false }; - CustomOptional PreferDedicatedGpu{ false }; - CustomOptional PreferFirstDedicatedGpu{ false }; + CustomOptional UseGenericAppIdWithDlss{ false }; + CustomOptional PreferDedicatedGpu{ false }; + CustomOptional PreferFirstDedicatedGpu{ false }; - CustomOptional ColorResourceBarrier; // disabled by default - CustomOptional MVResourceBarrier; // disabled by default - CustomOptional DepthResourceBarrier; // disabled by default - CustomOptional ExposureResourceBarrier; // disabled by default - CustomOptional MaskResourceBarrier; // disabled by default - CustomOptional OutputResourceBarrier; // disabled by default + CustomOptional ColorResourceBarrier; // disabled by default + CustomOptional MVResourceBarrier; // disabled by default + CustomOptional DepthResourceBarrier; // disabled by default + CustomOptional ExposureResourceBarrier; // disabled by default + CustomOptional MaskResourceBarrier; // disabled by default + CustomOptional OutputResourceBarrier; // disabled by default - // Upscalers - CustomOptional Dx11Upscaler{ "fsr22" }; - CustomOptional Dx12Upscaler{ "xess" }; - CustomOptional VulkanUpscaler{ "fsr21" }; + // Upscalers + CustomOptional Dx11Upscaler{ "fsr22" }; + CustomOptional Dx12Upscaler{ "xess" }; + CustomOptional VulkanUpscaler{ "fsr21" }; - // Output Scaling - CustomOptional OutputScalingEnabled{ false }; - CustomOptional OutputScalingMultiplier{ 1.5f }; - CustomOptional OutputScalingUseFsr{ true }; - CustomOptional OutputScalingDownscaler{ 0 }; // 0 = Bicubic | 1 = Lanczos | 2 = Catmull-Rom | 3 = MAGC + // Output Scaling + CustomOptional OutputScalingEnabled{ false }; + CustomOptional OutputScalingMultiplier{ 1.5f }; + CustomOptional OutputScalingUseFsr{ true }; + CustomOptional OutputScalingDownscaler{ 0 }; // 0 = Bicubic | 1 = Lanczos | 2 = Catmull-Rom | 3 = MAGC - // FSR - CustomOptional FsrDebugView{ false }; - CustomOptional Fsr3xIndex{ 0 }; - CustomOptional FsrUseMaskForTransparency{ true }; - CustomOptional FsrVelocity{ 1.0f }; - CustomOptional Fsr4Update{ false }; - CustomOptional FsrNonLinearSRGB{ false }; - CustomOptional FsrNonLinearPQ{ false }; - CustomOptional FsrAgilitySDKUpgrade{ false }; + // FSR + CustomOptional FsrDebugView{ false }; + CustomOptional Fsr3xIndex{ 0 }; + CustomOptional FsrUseMaskForTransparency{ true }; + CustomOptional FsrVelocity{ 1.0f }; + CustomOptional Fsr4Update{ false }; + CustomOptional FsrNonLinearSRGB{ false }; + CustomOptional FsrNonLinearPQ{ false }; + CustomOptional FsrAgilitySDKUpgrade{ false }; - // FSR Common - CustomOptional FsrVerticalFov{ 60.0f }; - CustomOptional FsrHorizontalFov{ 0.0f }; // off by default - CustomOptional FsrCameraNear{ 0.1f }; - CustomOptional FsrCameraFar{ 100000.0f }; - CustomOptional FsrUseFsrInputValues{ true }; + // FSR Common + CustomOptional FsrVerticalFov{ 60.0f }; + CustomOptional FsrHorizontalFov{ 0.0f }; // off by default + CustomOptional FsrCameraNear{ 0.1f }; + CustomOptional FsrCameraFar{ 100000.0f }; + CustomOptional FsrUseFsrInputValues{ true }; - CustomOptional FfxDx12Path; - CustomOptional FfxVkPath; + CustomOptional FfxDx12Path; + CustomOptional FfxVkPath; - // dx11wdx12 - // Valid values are; - // 0 - No syncing(fastest, most prone to errors) - // 1 - Fence - // 2 - Fences + Flush - // 3 - Fences + Event - // 4 - Fences + Flush + Event - // 5 - Query Only - CustomOptional TextureSyncMethod{ 1 }; - CustomOptional CopyBackSyncMethod{ 5 }; - CustomOptional Dx11DelayedInit{ false }; - CustomOptional SyncAfterDx12{ true }; - CustomOptional DontUseNTShared{ false }; + // dx11wdx12 + // Valid values are; + // 0 - No syncing(fastest, most prone to errors) + // 1 - Fence + // 2 - Fences + Flush + // 3 - Fences + Event + // 4 - Fences + Flush + Event + // 5 - Query Only + CustomOptional TextureSyncMethod{ 1 }; + CustomOptional CopyBackSyncMethod{ 5 }; + CustomOptional Dx11DelayedInit{ false }; + CustomOptional SyncAfterDx12{ true }; + CustomOptional DontUseNTShared{ false }; - // NVAPI Override - CustomOptional OverrideNvapiDll{ false }; - CustomOptional NvapiDllPath; + // NVAPI Override + CustomOptional OverrideNvapiDll{ false }; + CustomOptional NvapiDllPath; - // Spoofing - CustomOptional DxgiSpoofing{ true }; - CustomOptional DxgiBlacklist; // disabled by default - CustomOptional DxgiVRAM; // disabled by default - CustomOptional VulkanSpoofing{ false }; - CustomOptional VulkanExtensionSpoofing{ false }; - CustomOptional SpoofedGPUName{ L"NVIDIA GeForce RTX 4090" }; - CustomOptional VulkanVRAM; // disabled by default - CustomOptional SpoofHAGS{ false }; - CustomOptional SpoofFeatureLevel{ false }; + // Spoofing + CustomOptional DxgiSpoofing{ true }; + CustomOptional DxgiBlacklist; // disabled by default + CustomOptional DxgiVRAM; // disabled by default + CustomOptional VulkanSpoofing{ false }; + CustomOptional VulkanExtensionSpoofing{ false }; + CustomOptional VulkanVRAM; // disabled by default + CustomOptional SpoofHAGS{ false }; + CustomOptional SpoofFeatureLevel{ false }; CustomOptional SpoofedVendorId{ 0x10de }; CustomOptional SpoofedDeviceId{ 0x2684 }; CustomOptional TargetVendorId; CustomOptional TargetDeviceId; CustomOptional SpoofedGPUName{ L"NVIDIA GeForce RTX 4090" }; - // Plugins - CustomOptional PluginPath{ L"plugins" }; - CustomOptional LoadSpecialK{ false }; - CustomOptional LoadReShade{ false }; + // Plugins + CustomOptional PluginPath{ L"plugins" }; + CustomOptional LoadSpecialK{ false }; + CustomOptional LoadReShade{ false }; CustomOptional LoadAsiPlugins{ true }; - // Frame Generation - CustomOptional FGType{ FGType::NoFG }; + // Frame Generation + CustomOptional FGType{ FGType::NoFG }; - // OptiFG - CustomOptional FGEnabled{ false }; - CustomOptional FGHighPriority{ true }; - CustomOptional FGDebugView{ false }; - CustomOptional FGAsync{ false }; - CustomOptional FGHUDFix{ false }; - CustomOptional FGHUDFixExtended{ false }; - CustomOptional FGImmediateCapture{ false }; - CustomOptional FGHUDLimit{ 1 }; - CustomOptional FGRectLeft; - CustomOptional FGRectTop; - CustomOptional FGRectWidth; - CustomOptional FGRectHeight; - CustomOptional FGDisableOverlays{ false }; - CustomOptional FGAlwaysTrackHeaps{ false }; - CustomOptional FGMakeDepthCopy{ true }; - CustomOptional FGEnableDepthScale{ false }; - CustomOptional FGDepthScaleMax{ 10000.0f }; - CustomOptional FGMakeMVCopy{ true }; - CustomOptional FGHudFixCloseAfterCallback{ true }; - CustomOptional FGUseMutexForSwaphain{ true }; - CustomOptional FGFramePacingTuning{ true }; - CustomOptional FGFPTSafetyMarginInMs{ 0.01f }; - CustomOptional FGFPTVarianceFactor{ 0.3f }; - CustomOptional FGFPTAllowHybridSpin{ true }; - CustomOptional FGFPTHybridSpinTime{ 2 }; - CustomOptional FGFPTAllowWaitForSingleObjectOnFence{ false }; + // OptiFG + CustomOptional FGEnabled{ false }; + CustomOptional FGHighPriority{ true }; + CustomOptional FGDebugView{ false }; + CustomOptional FGAsync{ false }; + CustomOptional FGHUDFix{ false }; + CustomOptional FGHUDFixExtended{ false }; + CustomOptional FGImmediateCapture{ false }; + CustomOptional FGHUDLimit{ 1 }; + CustomOptional FGRectLeft; + CustomOptional FGRectTop; + CustomOptional FGRectWidth; + CustomOptional FGRectHeight; + CustomOptional FGDisableOverlays{ false }; + CustomOptional FGAlwaysTrackHeaps{ false }; + CustomOptional FGMakeDepthCopy{ true }; + CustomOptional FGEnableDepthScale{ false }; + CustomOptional FGDepthScaleMax{ 10000.0f }; + CustomOptional FGMakeMVCopy{ true }; + CustomOptional FGHudFixCloseAfterCallback{ true }; + CustomOptional FGUseMutexForSwaphain{ true }; + CustomOptional FGFramePacingTuning{ true }; + CustomOptional FGFPTSafetyMarginInMs{ 0.01f }; + CustomOptional FGFPTVarianceFactor{ 0.3f }; + CustomOptional FGFPTAllowHybridSpin{ true }; + CustomOptional FGFPTHybridSpinTime{ 2 }; + CustomOptional FGFPTAllowWaitForSingleObjectOnFence{ false }; - // DLSS Enabler - std::optional DE_FramerateLimit; // off - vsync - number - std::optional DE_FramerateLimitVsync; - std::optional DE_DynamicLimitAvailable; // DFG.Available - std::optional DE_DynamicLimitEnabled; // DFG.Enabled - std::optional DE_Generator; // auto - fsr30 - fsr31 - dlssg // "auto" - std::optional DE_Reflex; // on - boost - off // "on" - std::optional DE_ReflexEmu; // auto - on - off // "auto" + // DLSS Enabler + std::optional DE_FramerateLimit; // off - vsync - number + std::optional DE_FramerateLimitVsync; + std::optional DE_DynamicLimitAvailable; // DFG.Available + std::optional DE_DynamicLimitEnabled; // DFG.Enabled + std::optional DE_Generator; // auto - fsr30 - fsr31 - dlssg // "auto" + std::optional DE_Reflex; // on - boost - off // "on" + std::optional DE_ReflexEmu; // auto - on - off // "auto" - // fakenvapi - CustomOptional FN_EnableLogs{ true }; - CustomOptional FN_EnableTraceLogs{ false }; - CustomOptional FN_ForceLatencyFlex{ false }; - CustomOptional FN_LatencyFlexMode{ 0 }; // conservative - aggressive - reflex ids - CustomOptional FN_ForceReflex{ 0 }; // in-game - force disable - force enable + // fakenvapi + CustomOptional FN_EnableLogs{ true }; + CustomOptional FN_EnableTraceLogs{ false }; + CustomOptional FN_ForceLatencyFlex{ false }; + CustomOptional FN_LatencyFlexMode{ 0 }; // conservative - aggressive - reflex ids + CustomOptional FN_ForceReflex{ 0 }; // in-game - force disable - force enable - // Inputs - CustomOptional DlssInputs{ true }; - CustomOptional XeSSInputs{ true }; - CustomOptional Fsr2Inputs{ true }; - CustomOptional Fsr2Pattern{ false }; - CustomOptional Fsr3Inputs{ true }; - CustomOptional Fsr3Pattern{ false }; - CustomOptional FfxInputs{ true }; - CustomOptional EnableHotSwapping{ true }; + // Inputs + CustomOptional DlssInputs{ true }; + CustomOptional XeSSInputs{ true }; + CustomOptional Fsr2Inputs{ true }; + CustomOptional Fsr2Pattern{ false }; + CustomOptional Fsr3Inputs{ true }; + CustomOptional Fsr3Pattern{ false }; + CustomOptional FfxInputs{ true }; + CustomOptional EnableHotSwapping{ true }; - // Framerate - CustomOptional FramerateLimit{ 0.0f }; + // Framerate + CustomOptional FramerateLimit{ 0.0f }; - // HDR - CustomOptional ForceHDR{ false }; - CustomOptional UseHDR10{ false }; + // HDR + CustomOptional ForceHDR{ false }; + CustomOptional UseHDR10{ false }; - bool LoadFromPath(const wchar_t* InPath); - bool SaveIni(); + bool LoadFromPath(const wchar_t* InPath); + bool SaveIni(); - bool ReloadFakenvapi(); - bool SaveFakenvapiIni(); + bool ReloadFakenvapi(); + bool SaveFakenvapiIni(); - void CheckUpscalerFiles(); + void CheckUpscalerFiles(); - static Config* Instance(); + static Config* Instance(); private: - inline static Config* _config; + inline static Config* _config; - CSimpleIniA ini; - CSimpleIniA fakenvapiIni; - std::filesystem::path absoluteFileName; - std::wstring fileName = L"OptiScaler.ini"; + CSimpleIniA ini; + CSimpleIniA fakenvapiIni; + std::filesystem::path absoluteFileName; + std::wstring fileName = L"OptiScaler.ini"; - bool Reload(std::filesystem::path iniPath); + bool Reload(std::filesystem::path iniPath); - std::optional readString(std::string section, std::string key, bool lowercase = false); - std::optional readWString(std::string section, std::string key, bool lowercase = false); - std::optional readFloat(std::string section, std::string key); - std::optional readInt(std::string section, std::string key); - std::optional readUInt(std::string section, std::string key); - std::optional readBool(std::string section, std::string key); + std::optional readString(std::string section, std::string key, bool lowercase = false); + std::optional readWString(std::string section, std::string key, bool lowercase = false); + std::optional readFloat(std::string section, std::string key); + std::optional readInt(std::string section, std::string key); + std::optional readUInt(std::string section, std::string key); + std::optional readBool(std::string section, std::string key); };