From ea22635dff5049fde87c30ebe01a2583876a82db Mon Sep 17 00:00:00 2001 From: = Date: Mon, 1 Apr 2024 12:48:41 -0400 Subject: [PATCH] Refresh rate fixes, restore timers --- soh-uwp/main.cpp | 8 +++++++- soh/soh/OTRGlobals.cpp | 8 +++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/soh-uwp/main.cpp b/soh-uwp/main.cpp index 4cd9cb94..e93f810a 100644 --- a/soh-uwp/main.cpp +++ b/soh-uwp/main.cpp @@ -67,9 +67,10 @@ using namespace winrt::Windows::Storage; #include "SDL2/SDL.h" -// Track width/height for SDL window creation +// Window state vars static int width, height; +static double refreshRate; static float scale; @@ -91,6 +92,10 @@ int WinInfo::getHostHeight() { return height; } +double WinInfo::getHostRefresh() { + return refreshRate; +} + std::string WinInfo::getSavePath() { return winrt::to_string(ApplicationData::Current().LocalFolder().Path()); } @@ -103,6 +108,7 @@ int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { width = hdi.GetCurrentDisplayMode().ResolutionWidthInRawPixels(); height = hdi.GetCurrentDisplayMode().ResolutionHeightInRawPixels(); + refreshRate = hdi.GetCurrentDisplayMode().RefreshRate(); scale = ((float)width / 1920.0f) * 1.75f; } else { diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 0e8c6a48..39d6c7ef 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -59,6 +59,7 @@ #include #include +#include "../graphic/Fast3D/wininfo.h" #ifdef __APPLE__ #include @@ -442,18 +443,15 @@ bool OTRGlobals::HasOriginal() { } uint32_t OTRGlobals::GetInterpolationFPS() { - // Locked to panel refresh for now - return LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); - if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { return CVarGetInteger("gInterpolationFPS", 20); } if (CVarGetInteger("gMatchRefreshRate", 0)) { - return LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + return (int) WinInfo::getHostRefresh(); } - return std::min(LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger("gInterpolationFPS", 20)); + return std::min((int)WinInfo::getHostRefresh(), CVarGetInteger("gInterpolationFPS", 20)); } struct ExtensionEntry {