summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraMannus <mannusmenting@gmail.com>2023-04-14 16:44:58 +0200
committerGitHub <noreply@github.com>2023-04-14 10:44:58 -0400
commit831711a4597b99c5b0143ceb28c060461f0a323d (patch)
treefb5d6a2a0361a9ac5bb2f792562e88ce4d86e063
parente72eeb95aa293df241ef741e0c34a06d8fe41b44 (diff)
Revert FPS slider behaviour for DX11 (#2686)
-rw-r--r--soh/soh/GameMenuBar.cpp23
-rw-r--r--soh/soh/OTRGlobals.cpp2
2 files changed, 21 insertions, 4 deletions
diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp
index 557e22379..8bb141892 100644
--- a/soh/soh/GameMenuBar.cpp
+++ b/soh/soh/GameMenuBar.cpp
@@ -868,7 +868,12 @@ namespace GameMenuBar {
{ // FPS Slider
const int minFps = 20;
- const int maxFps = Ship::Window::GetInstance()->GetCurrentRefreshRate();
+ static int maxFps;
+ if (SohImGui::WindowBackend() == SohImGui::Backend::DX11) {
+ maxFps = 360;
+ } else {
+ maxFps = Ship::Window::GetInstance()->GetCurrentRefreshRate();
+ }
int currentFps = fmax(fmin(OTRGlobals::Instance->GetInterpolationFPS(), maxFps), minFps);
#ifdef __WIIU__
// only support divisors of 60 on the Wii U
@@ -932,8 +937,9 @@ namespace GameMenuBar {
CVarSetInteger("gInterpolationFPS", currentFps);
SohImGui::RequestCvarSaveOnNextTick();
#else
+ bool matchingRefreshRate = CVarGetInteger("gMatchRefreshRate", 0) && SohImGui::WindowBackend() != SohImGui::Backend::DX11;
UIWidgets::EnhancementSliderInt((currentFps == 20) ? "Frame interpolation: Off" : "Frame interpolation: %d FPS",
- "##FPSInterpolation", "gInterpolationFPS", minFps, maxFps, "", 20, true, CVarGetInteger("gMatchRefreshRate", 0));
+ "##FPSInterpolation", "gInterpolationFPS", minFps, maxFps, "", 20, true, matchingRefreshRate);
#endif
UIWidgets::Tooltip("Interpolate extra frames to get smoother graphics\n"
"Set to match your monitor's refresh rate, or a divisor of it\n"
@@ -942,7 +948,18 @@ namespace GameMenuBar {
"Ctrl+Click for keyboard input");
} // END FPS Slider
- UIWidgets::PaddedEnhancementCheckbox("Match Refresh Rate", "gMatchRefreshRate", true, false);
+ if (SohImGui::WindowBackend() == SohImGui::Backend::DX11) {
+ ImGui::Dummy(ImVec2(0,0));
+ if (ImGui::Button("Match Refresh Rate")) {
+ int hz = Ship::Window::GetInstance()->GetCurrentRefreshRate();
+ if (hz >= 20 && hz <= 360) {
+ CVarSetInteger("gInterpolationFPS", hz);
+ SohImGui::RequestCvarSaveOnNextTick();
+ }
+ }
+ } else {
+ UIWidgets::PaddedEnhancementCheckbox("Match Refresh Rate", "gMatchRefreshRate", true, false);
+ }
UIWidgets::Tooltip("Matches interpolation value to the current game's window refresh rate");
UIWidgets::PaddedEnhancementCheckbox("Disable LOD", "gDisableLOD", true, false);
diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp
index 638cf162b..74d275b68 100644
--- a/soh/soh/OTRGlobals.cpp
+++ b/soh/soh/OTRGlobals.cpp
@@ -320,7 +320,7 @@ bool OTRGlobals::HasOriginal() {
}
uint32_t OTRGlobals::GetInterpolationFPS() {
- if (CVarGetInteger("gMatchRefreshRate", 0)) {
+ if (CVarGetInteger("gMatchRefreshRate", 0) && SohImGui::WindowBackend() != SohImGui::Backend::DX11) {
return Ship::Window::GetInstance()->GetCurrentRefreshRate();
}