aboutsummaryrefslogtreecommitdiff
path: root/src/common/settings.cpp
diff options
context:
space:
mode:
authorcrueter <crueter@eden-emu.dev>2026-02-12 01:31:55 +0100
committercrueter <crueter@eden-emu.dev>2026-02-12 01:31:55 +0100
commit2b979024cb901099fee264866c135acc59256189 (patch)
treea67676439e41cc8d0e524d42e33c5b6235ad33fe /src/common/settings.cpp
parent5f676a6a55aa4d748e545b0fc6956e9a5dbd2f7f (diff)
[frontend] Slow and Turbo modes (#3525)
Closes #3344 Adds slow and turbo modes with configurable speeds that can then be toggled by the user. Behavior is: - Standard/slow limit, toggle turbo = turbo - Turbo limit, toggle turbo = standard - Standard/turbo limit, toggle slow = slow - Slow limit, toggle slow = standard Enabling the turbo/slow mode enables the frame limiter unconditionally. This has some conflicts with VSync. For example when I set my refresh rate to 60hz and enable vsync, turbo mode does nothing. Not sure how to go about fixing this, @MaranBr probably knows better the proper solution. Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3525 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'src/common/settings.cpp')
-rw-r--r--src/common/settings.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 5d8a0e41f6..c952567e63 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -379,4 +379,52 @@ void SetConfiguringGlobal(bool is_global) {
configuring_global = is_global;
}
+u16 SpeedLimit() {
+ switch (SpeedMode(values.current_speed_mode)) {
+ case SpeedMode::Standard:
+ return values.speed_limit.GetValue();
+ case SpeedMode::Turbo:
+ return values.turbo_speed_limit.GetValue();
+ case SpeedMode::Slow:
+ return values.slow_speed_limit.GetValue();
+ default:
+ UNIMPLEMENTED();
+ }
+
+ return 100;
+}
+
+void SetSpeedMode(const SpeedMode& mode) {
+ values.current_speed_mode.SetValue(mode);
+
+ switch (mode) {
+ case SpeedMode::Turbo:
+ case SpeedMode::Slow:
+ values.use_speed_limit.SetValue(true);
+ break;
+ case SpeedMode::Standard:
+ default:
+ break;
+ }
+}
+
+void ToggleStandardMode() {
+ values.use_speed_limit.SetValue(!values.use_speed_limit.GetValue());
+ SetSpeedMode(SpeedMode::Standard);
+}
+
+void ToggleTurboMode() {
+ if (values.current_speed_mode.GetValue() != SpeedMode::Turbo)
+ SetSpeedMode(SpeedMode::Turbo);
+ else
+ SetSpeedMode(SpeedMode::Standard);
+}
+
+void ToggleSlowMode() {
+ if (values.current_speed_mode.GetValue() != SpeedMode::Slow)
+ SetSpeedMode(SpeedMode::Slow);
+ else
+ SetSpeedMode(SpeedMode::Standard);
+}
+
} // namespace Settings