mirror of
https://git.citron-emu.org/citron/emu
synced 2025-05-13 03:10:36 +01:00
fix: correct implementation of present interval 0 for unlocked FPS
Fixes issues in commit bbd3253169
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>
This commit is contained in:
parent
278486d059
commit
f1e169e060
1 changed files with 6 additions and 13 deletions
|
@ -19,31 +19,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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue