Move FG configs to common; turn fps overlay type into an enum

This commit is contained in:
FakeMichau
2025-08-27 19:14:15 +02:00
parent 014b63d131
commit 4093f6e8ad
5 changed files with 43 additions and 50 deletions
+7 -8
View File
@@ -18,6 +18,13 @@ VulkanUpscaler=auto
; -------------------------------------------------------
[FrameGen]
; -------------------------------------------------------
; Enables frame generation
; true or false - Default (auto) is false
Enabled=auto
; Enables frame generation debug view
; true or false - Default (auto) is false
DebugView=auto
; Selected FG Input/Source
; nukems - Limited to FSR 3 FG. Requires DLSSG in the game. Supports hudless out of the box. Uses streamline swapchain for pacing.
@@ -38,14 +45,6 @@ FGOutput=auto
; -------------------------------------------------------
[FSRFG]
; -------------------------------------------------------
; Enables FSR3.1 frame generation
; true or false - Default (auto) is false
Enabled=auto
; Enables FSR3.1 frame generation debug view
; true or false - Default (auto) is false
DebugView=auto
; Enables FSR3.1 frame generation tear lines
; true or false - Default (auto) is false
DebugTearLines=auto
+11 -29
View File
@@ -56,6 +56,8 @@ bool Config::Reload(std::filesystem::path iniPath)
// Frame Generation
{
FGEnabled.set_from_config(readBool("FrameGen", "Enabled"));
FGDebugView.set_from_config(readBool("FrameGen", "DebugView"));
if (auto FGInputString = readString("FrameGen", "FGInput"); FGInputString.has_value())
{
if (lstrcmpiA(FGInputString.value().c_str(), "nofg") == 0)
@@ -89,8 +91,6 @@ bool Config::Reload(std::filesystem::path iniPath)
// FSR FG
{
FGEnabled.set_from_config(readBool("FSRFG", "Enabled"));
FGDebugView.set_from_config(readBool("FSRFG", "DebugView"));
FGDebugTearLines.set_from_config(readBool("FSRFG", "DebugTearLines"));
FGDebugResetLines.set_from_config(readBool("FSRFG", "DebugResetLines"));
FGDebugPacingLines.set_from_config(readBool("FSRFG", "DebugPacingLines"));
@@ -110,28 +110,6 @@ bool Config::Reload(std::filesystem::path iniPath)
// OptiFG
{
{
// If settings in the FSRFG section are not set, try using the old OptiFG section
FGEnabled.set_from_config(readBool("OptiFG", "Enabled"));
FGDebugView.set_from_config(readBool("OptiFG", "DebugView"));
FGDebugTearLines.set_from_config(readBool("OptiFG", "DebugTearLines"));
FGDebugResetLines.set_from_config(readBool("OptiFG", "DebugResetLines"));
FGDebugPacingLines.set_from_config(readBool("OptiFG", "DebugPacingLines"));
FGAsync.set_from_config(readBool("OptiFG", "AllowAsync"));
FGRectLeft.set_from_config(readInt("OptiFG", "RectLeft"));
FGRectTop.set_from_config(readInt("OptiFG", "RectTop"));
FGRectWidth.set_from_config(readInt("OptiFG", "RectWidth"));
FGRectHeight.set_from_config(readInt("OptiFG", "RectHeight"));
FGUseMutexForSwapchain.set_from_config(readBool("OptiFG", "UseMutexForSwapchain"));
FGFramePacingTuning.set_from_config(readBool("OptiFG", "FramePacingTuning"));
FGFPTSafetyMarginInMs.set_from_config(readFloat("OptiFG", "FPTSafetyMarginInMs"));
FGFPTVarianceFactor.set_from_config(readFloat("OptiFG", "FPTVarianceFactor"));
FGFPTAllowHybridSpin.set_from_config(readBool("OptiFG", "FPTHybridSpin"));
FGFPTHybridSpinTime.set_from_config(readInt("OptiFG", "FPTHybridSpinTime"));
FGFPTAllowWaitForSingleObjectOnFence.set_from_config(
readInt("OptiFG", "FPTWaitForSingleObjectOnFence"));
}
FGHUDFix.set_from_config(readBool("OptiFG", "HUDFix"));
FGHUDLimit.set_from_config(readInt("OptiFG", "HUDLimit"));
FGHUDFixExtended.set_from_config(readBool("OptiFG", "HUDFixExtended"));
@@ -323,8 +301,11 @@ bool Config::Reload(std::filesystem::path iniPath)
if (auto setting = readInt("Menu", "FpsOverlayPos"); setting.has_value())
FpsOverlayPos.set_from_config(std::clamp(setting.value(), 0, 3));
if (auto setting = readInt("Menu", "FpsOverlayType"); setting.has_value())
FpsOverlayType.set_from_config(std::clamp(setting.value(), 0, 6));
if (auto setting = readUInt("Menu", "FpsOverlayType"); setting.has_value())
{
FpsOverlayType.set_from_config(
(FpsOverlay) std::clamp(setting.value(), (uint32_t) FpsOverlay_JustFPS, FpsOverlay_COUNT - 1));
}
FpsShortcutKey.set_from_config(readInt("Menu", "FpsShortcutKey"));
FpsCycleShortcutKey.set_from_config(readInt("Menu", "FpsCycleShortcutKey"));
@@ -685,6 +666,8 @@ bool Config::SaveIni()
// Frame Generation
{
ini.SetValue("FrameGen", "Enabled", GetBoolValue(Instance()->FGEnabled.value_for_config()).c_str());
ini.SetValue("FrameGen", "DebugView", GetBoolValue(Instance()->FGDebugView.value_for_config()).c_str());
std::string FGInputString = "auto";
if (auto FGInputHeld = Instance()->FGInput.value_for_config(); FGInputHeld.has_value())
{
@@ -716,10 +699,8 @@ bool Config::SaveIni()
ini.SetValue("FrameGen", "FGOutput", FGOutputString.c_str());
}
// FSR FG
// FSR FG output
{
ini.SetValue("FSRFG", "Enabled", GetBoolValue(Instance()->FGEnabled.value_for_config()).c_str());
ini.SetValue("FSRFG", "DebugView", GetBoolValue(Instance()->FGDebugView.value_for_config()).c_str());
ini.SetValue("FSRFG", "DebugTearLines", GetBoolValue(Instance()->FGDebugTearLines.value_for_config()).c_str());
ini.SetValue("FSRFG", "DebugResetLines",
GetBoolValue(Instance()->FGDebugResetLines.value_for_config()).c_str());
@@ -746,6 +727,7 @@ bool Config::SaveIni()
GetBoolValue(Instance()->FGFPTAllowWaitForSingleObjectOnFence.value_for_config()).c_str());
}
// XeFG output
{
ini.SetValue("XeFG", "DepthInverted", GetBoolValue(Instance()->FGXeFGDepthInverted.value_for_config()).c_str());
ini.SetValue("XeFG", "JitteredMV", GetBoolValue(Instance()->FGXeFGJitteredMV.value_for_config()).c_str());
+13 -1
View File
@@ -146,6 +146,18 @@ template <class T, HasDefaultValue defaultState = WithDefault> class CustomOptio
constexpr int UnboundKey = -1;
enum FpsOverlay : uint32_t
{
FpsOverlay_JustFPS,
FpsOverlay_Simple,
FpsOverlay_Detailed,
FpsOverlay_DetailedGraph,
FpsOverlay_Full,
FpsOverlay_FullGraph,
FpsOverlay_ReflexTimings,
FpsOverlay_COUNT,
};
class Config
{
public:
@@ -221,7 +233,7 @@ class Config
/// 0 Only FPS, 1 +Avg FPS & Upscaler info 2 +Frame Time,
/// 3 +Upscaler Time, 4 +Frame Time Graph, 5 +Upscaler Time Graph
/// 6 +Reflex timings
CustomOptional<int> FpsOverlayType { 0 };
CustomOptional<FpsOverlay> FpsOverlayType { FpsOverlay_JustFPS };
CustomOptional<int> FpsShortcutKey { VK_PRIOR };
CustomOptional<int> FpsCycleShortcutKey { VK_NEXT };
CustomOptional<bool> FpsOverlayHorizontal { false };
-1
View File
@@ -1218,7 +1218,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
State::Instance().isRunningOnLinux = IsRunningOnWine();
State::Instance().isRunningOnDXVK = State::Instance().isRunningOnLinux;
if (!Config::Instance()->OverrideNvapiDll.has_value())
{
spdlog::info("OverrideNvapiDll not set, setting it to: {}",
+12 -11
View File
@@ -1341,7 +1341,8 @@ bool MenuCommon::RenderMenu()
}
if (inputFpsCycle && Config::Instance()->ShowFps.value_or_default())
Config::Instance()->FpsOverlayType = (Config::Instance()->FpsOverlayType.value_or_default() + 1) % 6;
Config::Instance()->FpsOverlayType =
(FpsOverlay) ((Config::Instance()->FpsOverlayType.value_or_default() + 1) % FpsOverlay_COUNT);
if (inputMenu)
{
@@ -1608,11 +1609,11 @@ bool MenuCommon::RenderMenu()
std::string thirdLine = "";
// Prepare Line 1
if (Config::Instance()->FpsOverlayType.value_or_default() == 0)
if (Config::Instance()->FpsOverlayType.value_or_default() == FpsOverlay_JustFPS)
{
firstLine = std::format("{} | FPS: {:5.1f}", api.c_str(), frameRate);
}
else if (Config::Instance()->FpsOverlayType.value_or_default() == 1)
else if (Config::Instance()->FpsOverlayType.value_or_default() == FpsOverlay_Simple)
{
if (currentFeature != nullptr && !currentFeature->IsFrozen())
firstLine =
@@ -1639,7 +1640,7 @@ bool MenuCommon::RenderMenu()
}
// Prepare Line 2
if (Config::Instance()->FpsOverlayType.value_or_default() > 1)
if (Config::Instance()->FpsOverlayType.value_or_default() >= FpsOverlay_Detailed)
{
if (Config::Instance()->FpsOverlayHorizontal.value_or_default())
{
@@ -1657,7 +1658,7 @@ bool MenuCommon::RenderMenu()
}
// Prepare Line 3
if (Config::Instance()->FpsOverlayType.value_or_default() > 3)
if (Config::Instance()->FpsOverlayType.value_or_default() >= FpsOverlay_Full)
{
thirdLine = std::format("Upscaler Time: {:6.2f} ms, Avg: {:6.2f} ms",
State::Instance().upscaleTimes.back(), averageUpscalerFT);
@@ -1690,7 +1691,7 @@ bool MenuCommon::RenderMenu()
// Draw the overlay
ImGui::Text(firstLine.c_str());
if (Config::Instance()->FpsOverlayType.value_or_default() > 1)
if (Config::Instance()->FpsOverlayType.value_or_default() >= FpsOverlay_Detailed)
{
if (Config::Instance()->FpsOverlayHorizontal.value_or_default())
{
@@ -1706,7 +1707,7 @@ bool MenuCommon::RenderMenu()
ImGui::Text(secondLine.c_str());
}
if (Config::Instance()->FpsOverlayType.value_or_default() > 2)
if (Config::Instance()->FpsOverlayType.value_or_default() >= FpsOverlay_DetailedGraph)
{
if (Config::Instance()->FpsOverlayHorizontal.value_or_default())
ImGui::SameLine(0.0f, 0.0f);
@@ -1716,7 +1717,7 @@ bool MenuCommon::RenderMenu()
nullptr, 0.0f, 66.6f, plotSize);
}
if (Config::Instance()->FpsOverlayType.value_or_default() > 3)
if (Config::Instance()->FpsOverlayType.value_or_default() >= FpsOverlay_Full)
{
if (Config::Instance()->FpsOverlayHorizontal.value_or_default())
{
@@ -1732,7 +1733,7 @@ bool MenuCommon::RenderMenu()
ImGui::Text(thirdLine.c_str());
}
if (Config::Instance()->FpsOverlayType.value_or_default() > 4)
if (Config::Instance()->FpsOverlayType.value_or_default() >= FpsOverlay_FullGraph)
{
if (Config::Instance()->FpsOverlayHorizontal.value_or_default())
ImGui::SameLine(0.0f, 0.0f);
@@ -1742,7 +1743,7 @@ bool MenuCommon::RenderMenu()
static_cast<int>(upscalerFrameTimeArray.size()), 0, nullptr, 0.0f, 20.0f, plotSize);
}
if (Config::Instance()->FpsOverlayType.value_or_default() > 5)
if (Config::Instance()->FpsOverlayType.value_or_default() >= FpsOverlay_ReflexTimings)
{
constexpr auto delayBetweenPollsMs = 500;
static auto previousPoll = 0;
@@ -4429,7 +4430,7 @@ bool MenuCommon::RenderMenu()
{
if (ImGui::Selectable(fpsType[n],
(Config::Instance()->FpsOverlayType.value_or_default() == n)))
Config::Instance()->FpsOverlayType = n;
Config::Instance()->FpsOverlayType = (FpsOverlay) n;
}
ImGui::EndCombo();