diff options
| author | Zephyron <zephyron@citron-emu.org> | 2025-04-18 10:11:16 +1000 |
|---|---|---|
| committer | Mike Lothian <mike@fireburn.co.uk> | 2025-05-12 12:46:19 +0100 |
| commit | c8ee0041f2e42e990239267b9b4ab57ff48b6310 (patch) | |
| tree | 37ce9c28599c7a0b3bcac7a841662142f1a67504 /src | |
| parent | ea8bb22148a69ebe19b186073a06b21614913525 (diff) | |
fix: correct implementation of present interval 0 for unlocked FPS
Fixes issues in commit bbd32531697fbfb8ed5b6859d3951bf8380e5999 that could cause
crashes and deadlocks. The feature now works as intended, allowing games using
present interval 0 to run with truly unlocked FPS.
This ensures proper functionality of dynamic framerate mods like UltraCam
by MaxLastBreath (https://www.nxoptimizer.com/) without stability problems.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nvnflinger/hardware_composer.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/core/hle/service/nvnflinger/hardware_composer.cpp b/src/core/hle/service/nvnflinger/hardware_composer.cpp index a3cdad71f..7ec92aa47 100644 --- a/src/core/hle/service/nvnflinger/hardware_composer.cpp +++ b/src/core/hle/service/nvnflinger/hardware_composer.cpp @@ -21,31 +21,24 @@ namespace { s32 NormalizeSwapInterval(f32* out_speed_scale, s32 swap_interval) { if (swap_interval <= 0) { - // If swap_interval is 0 and setting enabled, respect it as unlocked FPS - if (swap_interval == 0 && Settings::values.respect_present_interval_zero.GetValue()) { - if (out_speed_scale) { - *out_speed_scale = 1.0f; - } - return 0; - } - // As an extension, treat nonpositive swap interval as speed multiplier. if (out_speed_scale) { *out_speed_scale = 2.f * static_cast<f32>(1 - swap_interval); } - - swap_interval = 1; + // Only normalize swap_interval to 1 if we're not respecting present interval 0 + if (swap_interval == 0 && Settings::values.respect_present_interval_zero.GetValue()) { + // Keep swap_interval as 0 to allow for unlocked FPS + } else { + swap_interval = 1; + } } - if (swap_interval >= 5) { // As an extension, treat high swap interval as precise speed control. if (out_speed_scale) { *out_speed_scale = static_cast<f32>(swap_interval) / 100.f; } - swap_interval = 1; } - return swap_interval; } |
