Revert FPS slider behaviour for DX11 (#2686)

This commit is contained in:
aMannus 2023-04-14 16:44:58 +02:00 committed by GitHub
parent e72eeb95aa
commit 831711a459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View File

@ -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);

View File

@ -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();
}