Added enable/disable FG shortcut key

This commit is contained in:
cdozdil
2025-09-18 16:41:34 +03:00
parent 7e01bbb51a
commit fb795e61c2
5 changed files with 44 additions and 10 deletions
+5
View File
@@ -581,6 +581,11 @@ FpsOverlayHorizontal=auto
; 0.0 to 1.0 - Default (auto) is 0.4
FpsOverlayAlpha=auto
; Shortcut key for enable/disable FG
; Integer value - Default (auto) is 0x23 -> VK_END
; -1 -> No shortcut key
FGShortcutKey=auto
; -------------------------------------------------------
+6
View File
@@ -333,6 +333,8 @@ bool Config::Reload(std::filesystem::path iniPath)
FpsScale.set_from_config(std::clamp(setting.value(), 0.5f, 2.0f));
TTFFontPath.set_from_config(readWString("Menu", "TTFFontPath"));
FGShortcutKey.set_from_config(readInt("Menu", "FGShortcutKey"));
}
// Hooks
@@ -836,6 +838,10 @@ bool Config::SaveIni()
ini.SetValue("Menu", "UseHQFont", GetBoolValue(Instance()->UseHQFont.value_for_config()).c_str());
ini.SetValue("Menu", "DisableSplash", GetBoolValue(Instance()->DisableSplash.value_for_config()).c_str());
setting = Instance()->FGShortcutKey.value_for_config();
ini.SetValue("Menu", "FGShortcutKey",
GetIntValue(Instance()->FGShortcutKey.value_for_config(), setting > 0).c_str());
setting = Instance()->FpsShortcutKey.value_for_config();
ini.SetValue("Menu", "FpsShortcutKey",
GetIntValue(Instance()->FpsShortcutKey.value_for_config(), setting > 0).c_str());
+1
View File
@@ -243,6 +243,7 @@ class Config
CustomOptional<bool> UseHQFont { true };
CustomOptional<bool> DisableSplash { false };
CustomOptional<std::wstring, NoDefault> TTFFontPath;
CustomOptional<int> FGShortcutKey { VK_END };
// Hooks
CustomOptional<bool> HookOriginalNvngxOnly { false };
-4
View File
@@ -677,8 +677,6 @@ static void CheckWorkingMode()
{
LOG_DEBUG("dxgi.dll already in memory");
CheckForGPU();
DxgiProxy::Init(dxgiModule);
if (Config::Instance()->DxgiSpoofing.value_or_default())
@@ -692,8 +690,6 @@ static void CheckWorkingMode()
{
LOG_DEBUG("dxgi.dll already in memory");
CheckForGPU();
if (Config::Instance()->DxgiSpoofing.value_or_default())
HookDxgiForSpoofing();
+32 -6
View File
@@ -10,7 +10,7 @@
#include <inputs/FG/DLSSG_Mod.h>
#include <framegen/ffx/FSRFG_Dx12.h>
#include <fsr4/FSR4Upgrade.h>
#include <nvapi/fakenvapi.h>
#include <nvapi/ReflexHooks.h>
@@ -28,6 +28,7 @@ static bool _hdrTonemapApplied = false;
static ImVec4 SdrColors[ImGuiCol_COUNT];
static bool receivingWmInputs = false;
static bool inputMenu = false;
static bool inputFG = false;
static bool inputFps = false;
static bool inputFpsCycle = false;
static bool hasGamepad = false;
@@ -683,6 +684,9 @@ LRESULT MenuCommon::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (!inputFps)
inputFps = rawData.data.keyboard.VKey == Config::Instance()->FpsShortcutKey.value_or_default();
if (!inputFG)
inputFG = rawData.data.keyboard.VKey == Config::Instance()->FGShortcutKey.value_or_default();
if (!inputFpsCycle)
inputFpsCycle =
rawData.data.keyboard.VKey == Config::Instance()->FpsCycleShortcutKey.value_or_default();
@@ -698,6 +702,9 @@ LRESULT MenuCommon::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (!inputFps)
inputFps = msg == WM_KEYUP && wParam == Config::Instance()->FpsShortcutKey.value_or_default();
if (!inputFG)
inputFG = msg == WM_KEYUP && wParam == Config::Instance()->FGShortcutKey.value_or_default();
if (!inputFpsCycle)
inputFpsCycle = msg == WM_KEYUP && wParam == Config::Instance()->FpsCycleShortcutKey.value_or_default();
@@ -855,6 +862,7 @@ void KeyUp(UINT vKey)
{
inputMenu = vKey == Config::Instance()->ShortcutKey.value_or_default();
inputFps = vKey == Config::Instance()->FpsShortcutKey.value_or_default();
inputFG = vKey == Config::Instance()->FGShortcutKey.value_or_default();
inputFpsCycle = vKey == Config::Instance()->FpsCycleShortcutKey.value_or_default();
}
@@ -1350,6 +1358,21 @@ bool MenuCommon::RenderMenu()
// Handle Inputs
{
if (inputFG)
{
inputFG = false;
if (State::Instance().activeFgInput != FGInput::NoFG &&
State::Instance().activeFgOutput != FGOutput::NoFG &&
(State::Instance().api != API::Vulkan || State::Instance().activeFgInput == FGInput::Nukems))
{
Config::Instance()->FGEnabled = !Config::Instance()->FGEnabled.value_or_default();
if (Config::Instance()->FGEnabled.value_or_default())
State::Instance().FGchanged = true;
}
}
if (inputFps)
{
inputFps = false;
@@ -1853,6 +1876,9 @@ bool MenuCommon::RenderMenu()
if (!_isVisible)
return false;
// Check for gpu support
CheckForGPU();
{
// Overlay font
if (Config::Instance()->UseHQFont.value_or_default())
@@ -3024,11 +3050,9 @@ bool MenuCommon::RenderMenu()
ImGui::TreePop();
}
FSRFG_Dx12* fsrFG = nullptr;
if (State::Instance().currentFG != nullptr)
fsrFG = reinterpret_cast<FSRFG_Dx12*>(State::Instance().currentFG);
if (fsrFG != nullptr && FfxApiProxy::VersionDx12() >= feature_version { 3, 1, 3 })
auto fg = State::Instance().currentFG;
if (fg != nullptr && strcmp(fg->Name(), "FSR-FG") == 0 &&
FfxApiProxy::VersionDx12() >= feature_version { 3, 1, 3 })
{
ImGui::Spacing();
if (ImGui::TreeNode("Frame Pacing Tuning"))
@@ -4743,10 +4767,12 @@ bool MenuCommon::RenderMenu()
static auto menu = Keybind("Menu", 10);
static auto fpsOverlay = Keybind("FPS Overlay", 11);
static auto fpsOverlayCycle = Keybind("FPS Overlay Cycle", 12);
static auto fgEnable = Keybind("Frame Generation", 13);
menu.Render(Config::Instance()->ShortcutKey);
fpsOverlay.Render(Config::Instance()->FpsShortcutKey);
fpsOverlayCycle.Render(Config::Instance()->FpsCycleShortcutKey);
fgEnable.Render(Config::Instance()->FGShortcutKey);
}
ImGui::EndTable();