From 37390c441f67cd2adacabe1621639dd486f3f516 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 20 Apr 2023 20:57:32 -0400 Subject: [PATCH] feat: allow toggling vsync, fix: vrr support (#2716) --- libultraship | 2 +- soh/soh/GameMenuBar.cpp | 4 ++++ soh/soh/OTRGlobals.cpp | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libultraship b/libultraship index 709546598..10bd53be8 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 709546598603966e5e09d7915fdd9117e5447591 +Subproject commit 10bd53be80e842052b9c68aa64c03b8548dd58d8 diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 8bb141892..fd5d138dd 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -227,6 +227,10 @@ namespace GameMenuBar { UIWidgets::ReEnableComponent(""); } + if (Ship::Window::GetInstance()->CanDisableVerticalSync()) { + UIWidgets::PaddedEnhancementCheckbox("Enable Vsync", "gVsyncEnabled", true, false); + } + if (SohImGui::SupportsWindowedFullscreen()) { UIWidgets::PaddedEnhancementCheckbox("Windowed fullscreen", "gSdlWindowedFullscreen", true, false); } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 74d275b68..854aac30e 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -320,7 +320,11 @@ bool OTRGlobals::HasOriginal() { } uint32_t OTRGlobals::GetInterpolationFPS() { - if (CVarGetInteger("gMatchRefreshRate", 0) && SohImGui::WindowBackend() != SohImGui::Backend::DX11) { + if (SohImGui::WindowBackend() == SohImGui::Backend::DX11) { + return CVarGetInteger("gInterpolationFPS", 20); + } + + if (CVarGetInteger("gMatchRefreshRate", 0)) { return Ship::Window::GetInstance()->GetCurrentRefreshRate(); }