From 75814ca04d6634a4d20d49d7f30e89351b146212 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 27 Apr 2023 18:17:56 -0500 Subject: [PATCH] [Experimental Feature] Adds VariableFastForward.allowUnrestrictedSpeeds @Option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When enabled, the user can choose any integer speed from 1x to 8x for their preferred Fast Forward speed, regardless of the system’s maximumFastForwardSpeed. --- Delta/Emulation/GameViewController.swift | 2 +- .../Features/VariableFastForward.swift | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Delta/Emulation/GameViewController.swift b/Delta/Emulation/GameViewController.swift index f8ae447..c8ce16b 100644 --- a/Delta/Emulation/GameViewController.swift +++ b/Delta/Emulation/GameViewController.swift @@ -1111,7 +1111,7 @@ extension GameViewController { if ExperimentalFeatures.shared.variableFastForward.isEnabled, let preferredSpeed = ExperimentalFeatures.shared.variableFastForward[emulatorCore.game.type], - preferredSpeed.rawValue <= emulatorCore.deltaCore.supportedRates.upperBound + (preferredSpeed.rawValue <= emulatorCore.deltaCore.supportedRates.upperBound || ExperimentalFeatures.shared.variableFastForward.allowUnrestrictedSpeeds) { emulatorCore.rate = preferredSpeed.rawValue } diff --git a/Delta/Experimental Features/Features/VariableFastForward.swift b/Delta/Experimental Features/Features/VariableFastForward.swift index 735ec11..501515e 100644 --- a/Delta/Experimental Features/Features/VariableFastForward.swift +++ b/Delta/Experimental Features/Features/VariableFastForward.swift @@ -22,6 +22,13 @@ struct FastForwardSpeed: RawRepresentable static func speeds(in range: ClosedRange) -> [FastForwardSpeed] { + var range = range + + if ExperimentalFeatures.shared.variableFastForward.allowUnrestrictedSpeeds + { + range = 1.0...8.0 + } + // .dropFirst() to remove 1x speed. var speeds = stride(from: range.lowerBound, to: range.upperBound, by: 1.0).dropFirst().map { FastForwardSpeed(rawValue: $0) } @@ -84,6 +91,9 @@ struct VariableFastForwardOptions @Option(name: "Nintendo DS", description: "Preferred DS fast forward speed.", values: FastForwardSpeed.speeds(in: System.ds.deltaCore.supportedRates)) var ds: FastForwardSpeed? + + @Option(name: "Allow Unrestricted Speeds", description: "Allow choosing speeds that exceed the maximum supported speed of a system.\n\nThis can be used to test the performance of new iOS devices.") + var allowUnrestrictedSpeeds: Bool = false } extension Feature where Options == VariableFastForwardOptions