diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 86d7d9382..70d12a78b 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -499,15 +499,12 @@ bool OTRGlobals::HasOriginal() { } uint32_t OTRGlobals::GetInterpolationFPS() { - if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) { - return CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20); - } - if (CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 0)) { return Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + } else if (CVarGetInteger(CVAR_VSYNC_ENABLED, 1) || !Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) { + return std::min(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20)); } - - return std::min(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20)); + return CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20); } extern "C" void OTRMessage_Init(); diff --git a/soh/soh/SohGui/SohMenu.cpp b/soh/soh/SohGui/SohMenu.cpp index d4aee295a..780aa51f2 100644 --- a/soh/soh/SohGui/SohMenu.cpp +++ b/soh/soh/SohGui/SohMenu.cpp @@ -125,7 +125,7 @@ void SohMenu::InitElement() { }, "Not Available on DirectX" } }, { DISABLE_FOR_MATCH_REFRESH_RATE_ON, - { [](disabledInfo& info) -> bool { return CVarGetInteger(CVAR_SETTING("gMatchRefreshRate"), 0); }, + { [](disabledInfo& info) -> bool { return CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 0); }, "Match Refresh Rate is Enabled" } }, { DISABLE_FOR_ADVANCED_RESOLUTION_ON, { [](disabledInfo& info) -> bool { return CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0); }, @@ -140,7 +140,7 @@ void SohMenu::InitElement() { { DISABLE_FOR_NULL_PLAY_STATE, { [](disabledInfo& info) -> bool { return gPlayState == NULL; }, "Save Not Loaded" } }, { DISABLE_FOR_DEBUG_MODE_OFF, - { [](disabledInfo& info) -> bool { return !CVarGetInteger("gDeveloperTools.DebugEnabled", 0); }, + { [](disabledInfo& info) -> bool { return !CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0); }, "Debug Mode is Disabled" } }, { DISABLE_FOR_FRAME_ADVANCE_OFF, { [](disabledInfo& info) -> bool { return !(gPlayState != nullptr && gPlayState->frameAdvCtx.enabled); }, diff --git a/soh/soh/SohGui/SohMenuSettings.cpp b/soh/soh/SohGui/SohMenuSettings.cpp index 81d5b5244..b88065281 100644 --- a/soh/soh/SohGui/SohMenuSettings.cpp +++ b/soh/soh/SohGui/SohMenuSettings.cpp @@ -201,18 +201,10 @@ void SohMenu::AddMenuSettings() { AddWidget(path, "Audio API (Needs reload)", WIDGET_AUDIO_BACKEND); // Graphics Settings - static int32_t maxFps; - const char* tooltip = ""; - if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) { - maxFps = 360; - tooltip = "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is " - "purely visual and does not impact game logic, execution of glitches etc.\n\nA higher target " - "FPS than your monitor's refresh rate will waste resources, and might give a worse result."; - } else { - maxFps = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); - tooltip = "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is " - "purely visual and does not impact game logic, execution of glitches etc."; - } + static int32_t maxFps = 360; + const char* tooltip = "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is " + "purely visual and does not impact game logic, execution of glitches etc.\n\nA higher target " + "FPS than your monitor's refresh rate will waste resources, and might give a worse result."; path.sidebarName = "Graphics"; AddSidebarEntry("Settings", "Graphics", 3); AddWidget(path, "Toggle Fullscreen", WIDGET_CVAR_CHECKBOX) @@ -276,25 +268,14 @@ void SohMenu::AddMenuSettings() { info.activeDisables.push_back(DISABLE_FOR_MATCH_REFRESH_RATE_ON); }) .Options(IntSliderOptions().Tooltip(tooltip).Min(20).Max(maxFps).DefaultValue(20).Format(fpsFormat)); - AddWidget(path, "Match Refresh Rate", WIDGET_BUTTON) - .Callback([](WidgetInfo& info) { - int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); - if (hz >= 20 && hz <= 360) { - CVarSetInteger(CVAR_SETTING("InterpolationFPS"), hz); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); - } - }) - .PreFunc([](WidgetInfo& info) { info.isHidden = mSohMenu->disabledMap.at(DISABLE_FOR_NOT_DIRECTX).active; }) - .Options(ButtonOptions().Tooltip("Matches interpolation value to the current game's window refresh rate.")); AddWidget(path, "Match Refresh Rate", WIDGET_CVAR_CHECKBOX) - .CVar("gMatchRefreshRate") - .PreFunc([](WidgetInfo& info) { info.isHidden = mSohMenu->disabledMap.at(DISABLE_FOR_DIRECTX).active; }) - .Options(CheckboxOptions().Tooltip("Matches interpolation value to the current game's window refresh rate.")); + .CVar(CVAR_SETTING("MatchRefreshRate")) + .Options(CheckboxOptions().Tooltip("Matches interpolation value to the refresh rate of your display.")); AddWidget(path, "Renderer API (Needs reload)", WIDGET_VIDEO_BACKEND); AddWidget(path, "Enable Vsync", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_VSYNC_ENABLED) .PreFunc([](WidgetInfo& info) { info.isHidden = mSohMenu->disabledMap.at(DISABLE_FOR_NO_VSYNC).active; }) - .Options(CheckboxOptions().Tooltip("Enables Vsync.")); + .Options(CheckboxOptions().Tooltip("Removes tearing, but clamps your max FPS to your displays refresh rate.")); AddWidget(path, "Windowed Fullscreen", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_SDL_WINDOWED_FULLSCREEN) .PreFunc([](WidgetInfo& info) {