HostInterface: Add proper turbo speed setting

This commit is contained in:
Connor McLaughlin 2020-11-03 21:21:11 +10:00
parent d5a5969bd4
commit 2b66492ed8
20 changed files with 201 additions and 98 deletions

View file

@ -538,6 +538,12 @@ void AndroidHostInterface::SetControllerAxisState(u32 index, s32 button_code, fl
false);
}
void AndroidHostInterface::SetFastForwardEnabled(bool enabled)
{
m_fast_forward_enabled = enabled;
UpdateSpeedLimiterState();
}
void AndroidHostInterface::RefreshGameList(bool invalidate_cache, bool invalidate_database,
ProgressCallback* progress_callback)
{
@ -895,6 +901,20 @@ DEFINE_JNI_ARGS_METHOD(jboolean, AndroidHostInterface_hasAnyBIOSImages, jobject
return hi->HasAnyBIOSImages();
}
DEFINE_JNI_ARGS_METHOD(jboolean, AndroidHostInterface_isFastForwardEnabled, jobject obj)
{
return AndroidHelpers::GetNativeClass(env, obj)->IsFastForwardEnabled();
}
DEFINE_JNI_ARGS_METHOD(void, AndroidHostInterface_setFastForwardEnabled, jobject obj, jboolean enabled)
{
if (!System::IsValid())
return;
AndroidHostInterface* hi = AndroidHelpers::GetNativeClass(env, obj);
hi->RunOnEmulationThread([enabled, hi]() { hi->SetFastForwardEnabled(enabled); });
}
DEFINE_JNI_ARGS_METHOD(jstring, AndroidHostInterface_importBIOSImage, jobject obj, jbyteArray data)
{
AndroidHostInterface* hi = AndroidHelpers::GetNativeClass(env, obj);

View file

@ -49,6 +49,7 @@ public:
void SetControllerType(u32 index, std::string_view type_name);
void SetControllerButtonState(u32 index, s32 button_code, bool pressed);
void SetControllerAxisState(u32 index, s32 button_code, float value);
void SetFastForwardEnabled(bool enabled);
void RefreshGameList(bool invalidate_cache, bool invalidate_database, ProgressCallback* progress_callback);
void ApplySettings(bool display_osd_messages);

View file

@ -79,6 +79,9 @@ public class AndroidHostInterface {
public native String importBIOSImage(byte[] data);
public native boolean isFastForwardEnabled();
public native void setFastForwardEnabled(boolean enabled);
static {
System.loadLibrary("duckstation-native");
}

View file

@ -284,11 +284,9 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
return;
}
case 3: // Toggle Speed Limiter
case 3: // Toggle Fast Forward
{
boolean newSetting = !getBooleanSetting("Main/SpeedLimiterEnabled", true);
setBooleanSetting("Main/SpeedLimiterEnabled", newSetting);
applySettings();
AndroidHostInterface.getInstance().setFastForwardEnabled(!AndroidHostInterface.getInstance().isFastForwardEnabled());
return;
}

View file

@ -131,7 +131,7 @@
<item>Load State</item>
<item>Save State</item>
<item>Save State Slot</item>
<item>Toggle Speed Limiter</item>
<item>Toggle Fast Forward</item>
<item>More Options</item>
<item>Quit</item>
</string-array>
@ -283,4 +283,60 @@
<item>75</item>
<item>90</item>
</string-array>
<string-array name="settings_emulation_speed_entries">
<item>Unlimited</item>
<item>10% [6 FPS (NTSC) / 5 FPS (PAL)]</item>
<item>20% [12 FPS (NTSC) / 10 FPS (PAL)]</item>
<item>30% [18 FPS (NTSC) / 15 FPS (PAL)]</item>
<item>40% [24 FPS (NTSC) / 20 FPS (PAL)]</item>
<item>50% [30 FPS (NTSC) / 25 FPS (PAL)]</item>
<item>60% [36 FPS (NTSC) / 30 FPS (PAL)]</item>
<item>70% [42 FPS (NTSC) / 35 FPS (PAL)]</item>
<item>80% [48 FPS (NTSC) / 40 FPS (PAL)]</item>
<item>90% [54 FPS (NTSC) / 45 FPS (PAL)]</item>
<item>100% [60 FPS (NTSC) / 50 FPS (PAL), Default]</item>
<item>125% [75 FPS (NTSC) / 62 FPS (PAL)]</item>
<item>150% [90 FPS (NTSC) / 75 FPS (PAL)]</item>
<item>175% [105 FPS (NTSC) / 87 FPS (PAL)]</item>
<item>200% [120 FPS (NTSC) / 100 FPS (PAL)]</item>
<item>250% [150 FPS (NTSC) / 125 FPS (PAL)]</item>
<item>300% [180 FPS (NTSC) / 150 FPS (PAL)]</item>
<item>350% [210 FPS (NTSC) / 175 FPS (PAL)]</item>
<item>400% [240 FPS (NTSC) / 200 FPS (PAL)]</item>
<item>450% [270 FPS (NTSC) / 225 FPS (PAL)]</item>
<item>500% [300 FPS (NTSC) / 250 FPS (PAL)]</item>
<item>600% [360 FPS (NTSC) / 300 FPS (PAL)]</item>
<item>700% [420 FPS (NTSC) / 350 FPS (PAL)]</item>
<item>800% [480 FPS (NTSC) / 400 FPS (PAL)]</item>
<item>900% [540 FPS (NTSC) / 450 FPS (PAL)]</item>
<item>1000% [600 FPS (NTSC) / 500 FPS (PAL)]</item>
</string-array>
<string-array name="settings_emulation_speed_values">
<item>0.0</item>
<item>0.1</item>
<item>0.2</item>
<item>0.3</item>
<item>0.4</item>
<item>0.5</item>
<item>0.6</item>
<item>0.7</item>
<item>0.8</item>
<item>0.9</item>
<item>1.0</item>
<item>1.25</item>
<item>1.5</item>
<item>1.75</item>
<item>2.0</item>
<item>2.5</item>
<item>3.0</item>
<item>3.5</item>
<item>4.0</item>
<item>4.5</item>
<item>5.0</item>
<item>6.0</item>
<item>7.0</item>
<item>8.0</item>
<item>9.0</item>
<item>10.0</item>
</string-array>
</resources>

View file

@ -17,6 +17,22 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ListPreference
app:key="Main/EmulationSpeed"
app:title="Emulation Speed"
app:entries="@array/settings_emulation_speed_entries"
app:entryValues="@array/settings_emulation_speed_values"
app:defaultValue="1.0"
app:useSimpleSummaryProvider="true"
app:iconSpaceReserved="false" />
<ListPreference
app:key="Main/FastForwardSpeed"
app:title="Fast Forward Speed"
app:entries="@array/settings_emulation_speed_entries"
app:entryValues="@array/settings_emulation_speed_values"
app:defaultValue="0.0"
app:useSimpleSummaryProvider="true"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
app:key="Main/SpeedLimiterEnabled"
app:title="@string/settings_behavior_enable_speed_limiter"

View file

@ -414,7 +414,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
si.SetStringValue("Console", "Region", Settings::GetConsoleRegionName(Settings::DEFAULT_CONSOLE_REGION));
si.SetFloatValue("Main", "EmulationSpeed", 1.0f);
si.SetBoolValue("Main", "SpeedLimiterEnabled", true);
si.SetFloatValue("Main", "FastForwardSpeed", 0.0f);
si.SetBoolValue("Main", "IncreaseTimerResolution", true);
si.SetBoolValue("Main", "StartPaused", false);
si.SetBoolValue("Main", "SaveStateOnExit", true);

View file

@ -110,7 +110,7 @@ void Settings::Load(SettingsInterface& si)
ParseConsoleRegionName(si.GetStringValue("Console", "Region", "NTSC-U").c_str()).value_or(DEFAULT_CONSOLE_REGION);
emulation_speed = si.GetFloatValue("Main", "EmulationSpeed", 1.0f);
speed_limiter_enabled = si.GetBoolValue("Main", "SpeedLimiterEnabled", true);
fast_forward_speed = si.GetFloatValue("Main", "FastForwardSpeed", 0.0f);
increase_timer_resolution = si.GetBoolValue("Main", "IncreaseTimerResolution", true);
start_paused = si.GetBoolValue("Main", "StartPaused", false);
start_fullscreen = si.GetBoolValue("Main", "StartFullscreen", false);
@ -249,7 +249,7 @@ void Settings::Save(SettingsInterface& si) const
si.SetStringValue("Console", "Region", GetConsoleRegionName(region));
si.SetFloatValue("Main", "EmulationSpeed", emulation_speed);
si.SetBoolValue("Main", "SpeedLimiterEnabled", speed_limiter_enabled);
si.SetFloatValue("Main", "FastForwardSpeed", fast_forward_speed);
si.SetBoolValue("Main", "IncreaseTimerResolution", increase_timer_resolution);
si.SetBoolValue("Main", "StartPaused", start_paused);
si.SetBoolValue("Main", "StartFullscreen", start_fullscreen);

View file

@ -79,7 +79,7 @@ struct Settings
bool cpu_fastmem = true;
float emulation_speed = 1.0f;
bool speed_limiter_enabled = true;
float fast_forward_speed = 0.0f;
bool increase_timer_resolution = true;
bool start_paused = false;
bool start_fullscreen = false;

View file

@ -78,6 +78,7 @@ static std::string s_running_game_code;
static std::string s_running_game_title;
static float s_throttle_frequency = 60.0f;
static float s_target_speed = 1.0f;
static s32 s_throttle_period = 0;
static u64 s_last_throttle_time = 0;
static Common::Timer s_throttle_timer;
@ -1170,6 +1171,12 @@ void RunFrame()
g_gpu->ResetGraphicsAPIState();
}
void SetTargetSpeed(float speed)
{
s_target_speed = speed;
UpdateThrottlePeriod();
}
void SetThrottleFrequency(float frequency)
{
s_throttle_frequency = frequency;
@ -1178,8 +1185,8 @@ void SetThrottleFrequency(float frequency)
void UpdateThrottlePeriod()
{
s_throttle_period = static_cast<s32>(1000000000.0 / static_cast<double>(s_throttle_frequency) /
static_cast<double>(g_settings.emulation_speed));
s_throttle_period =
static_cast<s32>(1000000000.0 / static_cast<double>(s_throttle_frequency) / static_cast<double>(s_target_speed));
}
void Throttle()

View file

@ -146,6 +146,9 @@ bool RecreateGPU(GPURenderer renderer);
void RunFrame();
/// Sets target emulation speed.
void SetTargetSpeed(float speed);
/// Adjusts the throttle frequency, i.e. how many times we should sleep per second.
void SetThrottleFrequency(float frequency);

View file

@ -107,6 +107,8 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface,
"UseDebugDevice", false);
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000,
0);
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Increase Timer Resolution"), "Main",
"IncreaseTimerResolution", true);
}
AdvancedSettingsWidget::~AdvancedSettingsWidget() = default;
@ -125,4 +127,5 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
setIntRangeTweakOption(m_ui.tweakOptionTable, 9, static_cast<int>(Settings::DEFAULT_GPU_MAX_RUN_AHEAD));
setBooleanTweakOption(m_ui.tweakOptionTable, 10, false);
setIntRangeTweakOption(m_ui.tweakOptionTable, 11, 0);
setBooleanTweakOption(m_ui.tweakOptionTable, 12, true);
}

View file

@ -1,6 +1,7 @@
#include "generalsettingswidget.h"
#include "autoupdaterdialog.h"
#include "frontend-common/controller_interface.h"
#include "qtutils.h"
#include "settingsdialog.h"
#include "settingwidgetbinder.h"
@ -27,22 +28,25 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
true);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.autoLoadCheats, "Main", "AutoLoadCheats", false);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.enableSpeedLimiter, "Main", "SpeedLimiterEnabled",
true);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.increaseTimerResolution, "Main",
"IncreaseTimerResolution", true);
SettingWidgetBinder::BindWidgetToNormalizedSetting(m_host_interface, m_ui.emulationSpeed, "Main", "EmulationSpeed",
100.0f, 1.0f);
SettingWidgetBinder::BindWidgetToEnumSetting(
m_host_interface, m_ui.controllerBackend, "Main", "ControllerBackend", &ControllerInterface::ParseBackendName,
&ControllerInterface::GetBackendName, ControllerInterface::GetDefaultBackend());
connect(m_ui.enableSpeedLimiter, &QCheckBox::stateChanged, this,
&GeneralSettingsWidget::onEnableSpeedLimiterStateChanged);
connect(m_ui.emulationSpeed, &QSlider::valueChanged, this, &GeneralSettingsWidget::onEmulationSpeedValueChanged);
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.emulationSpeed);
const int emulation_speed_index =
m_ui.emulationSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "EmulationSpeed")));
if (emulation_speed_index >= 0)
m_ui.emulationSpeed->setCurrentIndex(emulation_speed_index);
connect(m_ui.emulationSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&GeneralSettingsWidget::onEmulationSpeedIndexChanged);
onEnableSpeedLimiterStateChanged();
onEmulationSpeedValueChanged(m_ui.emulationSpeed->value());
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.fastForwardSpeed);
const int fast_forward_speed_index =
m_ui.emulationSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "FastForwardSpeed")));
if (fast_forward_speed_index >= 0)
m_ui.fastForwardSpeed->setCurrentIndex(fast_forward_speed_index);
connect(m_ui.fastForwardSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&GeneralSettingsWidget::onFastForwardSpeedIndexChanged);
dialog->registerWidgetHelp(
m_ui.confirmPowerOff, tr("Confirm Power Off"), tr("Checked"),
@ -68,18 +72,14 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
m_ui.applyGameSettings, tr("Apply Per-Game Settings"), tr("Checked"),
tr("When enabled, per-game settings will be applied, and incompatible enhancements will be disabled. You should "
"leave this option enabled except when testing enhancements with incompatible games."));
dialog->registerWidgetHelp(
m_ui.enableSpeedLimiter, tr("Enable Speed Limiter"), tr("Checked"),
tr("Throttles the emulation speed to the chosen speed above. If unchecked, the emulator will "
"run as fast as possible, which may not be playable."));
dialog->registerWidgetHelp(
m_ui.increaseTimerResolution, tr("Increase Timer Resolution"), tr("Checked"),
tr("Increases the system timer resolution when emulation is started to provide more accurate "
"frame pacing. May increase battery usage on laptops."));
dialog->registerWidgetHelp(
m_ui.emulationSpeed, tr("Emulation Speed"), "100%",
tr("Sets the target emulation speed. It is not guaranteed that this speed will be reached, "
"and if not, the emulator will run as fast as it can manage."));
dialog->registerWidgetHelp(
m_ui.fastForwardSpeed, tr("Fast Forward Speed"), "100%",
tr(
"Sets the fast forward (turbo) speed. This speed will be used when the fast forward hotkey is pressed/toggled."));
dialog->registerWidgetHelp(m_ui.controllerBackend, tr("Controller Backend"),
qApp->translate("ControllerInterface", ControllerInterface::GetBackendName(
ControllerInterface::GetDefaultBackend())),
@ -119,12 +119,18 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
GeneralSettingsWidget::~GeneralSettingsWidget() = default;
void GeneralSettingsWidget::onEnableSpeedLimiterStateChanged()
void GeneralSettingsWidget::onEmulationSpeedIndexChanged(int index)
{
m_ui.emulationSpeed->setDisabled(!m_ui.enableSpeedLimiter->isChecked());
bool okay;
const float value = m_ui.emulationSpeed->currentData().toFloat(&okay);
m_host_interface->SetFloatSettingValue("Main", "EmulationSpeed", okay ? value : 1.0f);
m_host_interface->applySettings();
}
void GeneralSettingsWidget::onEmulationSpeedValueChanged(int value)
void GeneralSettingsWidget::onFastForwardSpeedIndexChanged(int index)
{
m_ui.emulationSpeedLabel->setText(tr("%1%").arg(value));
bool okay;
const float value = m_ui.fastForwardSpeed->currentData().toFloat(&okay);
m_host_interface->SetFloatSettingValue("Main", "FastForwardSpeed", okay ? value : 0.0f);
m_host_interface->applySettings();
}

View file

@ -16,8 +16,8 @@ public:
~GeneralSettingsWidget();
private Q_SLOTS:
void onEnableSpeedLimiterStateChanged();
void onEmulationSpeedValueChanged(int value);
void onEmulationSpeedIndexChanged(int index);
void onFastForwardSpeedIndexChanged(int index);
private:
Ui::GeneralSettingsWidget m_ui;

View file

@ -94,61 +94,28 @@
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Emulation Speed</string>
<string>Speed Control</string>
</property>
<layout class="QGridLayout" name="formLayout_3">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSlider" name="emulationSpeed">
<property name="minimum">
<number>25</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="singleStep">
<number>25</number>
</property>
<property name="pageStep">
<number>25</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>25</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="emulationSpeedLabel">
<layout class="QGridLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>100%</string>
<string>Emulation Speed:</string>
</property>
</widget>
</item>
</layout>
<item row="0" column="1">
<widget class="QComboBox" name="emulationSpeed"/>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="enableSpeedLimiter">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Enable Speed Limiter</string>
<string>Fast Forward Speed:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="increaseTimerResolution">
<property name="text">
<string>Increase Timer Resolution</string>
</property>
</widget>
<widget class="QComboBox" name="fastForwardSpeed"/>
</item>
</layout>
</widget>
@ -192,7 +159,7 @@
</layout>
</widget>
<resources>
<include location="resources/icons.qrc"/>
<include location="resources/resources.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -1,5 +1,6 @@
#include "qtutils.h"
#include "common/byte_stream.h"
#include "common/make_array.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QMetaObject>
#include <QtGui/QDesktopServices>
@ -719,4 +720,20 @@ void FillComboBoxWithMSAAModes(QComboBox* cb)
cb->addItem(qApp->translate("GPUSettingsWidget", "%1x SSAA").arg(i), GetMSAAModeValue(i, true));
}
void FillComboBoxWithEmulationSpeeds(QComboBox* cb)
{
cb->addItem(qApp->translate("GeneralSettingsWidget", "Unlimited"), QVariant(0.0f));
static constexpr auto speeds = make_array(10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 125, 150, 175, 200, 250, 300, 350,
400, 450, 500, 600, 700, 800, 900, 1000);
for (const int speed : speeds)
{
cb->addItem(qApp->translate("GeneralSettingsWidget", "%1% [%2 FPS (NTSC) / %3 FPS (PAL)]")
.arg(speed)
.arg((60 * speed) / 100)
.arg((50 * speed) / 100),
QVariant(static_cast<float>(speed) / 100.0f));
}
}
} // namespace QtUtils

View file

@ -68,4 +68,7 @@ QVariant GetMSAAModeValue(uint multisamples, bool ssaa);
void DecodeMSAAModeValue(const QVariant& userdata, uint* multisamples, bool* ssaa);
void FillComboBoxWithMSAAModes(QComboBox* cb);
/// Fills a combo box with emulation speed options.
void FillComboBoxWithEmulationSpeeds(QComboBox* cb);
} // namespace QtUtils

View file

@ -843,9 +843,6 @@ void SDLHostInterface::DrawMainMenuBar()
void SDLHostInterface::DrawQuickSettingsMenu()
{
bool settings_changed = false;
settings_changed |= ImGui::MenuItem("Enable Speed Limiter", nullptr, &m_settings_copy.speed_limiter_enabled);
ImGui::Separator();
if (ImGui::BeginMenu("CPU Execution Mode"))
{
@ -1288,7 +1285,6 @@ void SDLHostInterface::DrawSettingsWindow()
ImGui::SameLine(indent);
settings_changed |= ImGui::SliderFloat("##speed", &m_settings_copy.emulation_speed, 0.25f, 5.0f);
settings_changed |= ImGui::Checkbox("Enable Speed Limiter", &m_settings_copy.speed_limiter_enabled);
settings_changed |= ImGui::Checkbox("Increase Timer Resolution", &m_settings_copy.increase_timer_resolution);
settings_changed |= ImGui::Checkbox("Pause On Start", &m_settings_copy.start_paused);
settings_changed |= ImGui::Checkbox("Start Fullscreen", &m_settings_copy.start_fullscreen);

View file

@ -598,9 +598,10 @@ bool CommonHostInterface::ResumeSystemFromMostRecentState()
void CommonHostInterface::UpdateSpeedLimiterState()
{
m_speed_limiter_enabled = g_settings.speed_limiter_enabled && !m_speed_limiter_temp_disabled;
const float target_speed = m_fast_forward_enabled ? g_settings.fast_forward_speed : g_settings.emulation_speed;
m_speed_limiter_enabled = (target_speed != 0.0f);
const bool is_non_standard_speed = (std::abs(g_settings.emulation_speed - 1.0f) > 0.05f);
const bool is_non_standard_speed = (std::abs(target_speed - 1.0f) > 0.05f);
const bool audio_sync_enabled =
!System::IsRunning() || (m_speed_limiter_enabled && g_settings.audio_sync_enabled && !is_non_standard_speed);
const bool video_sync_enabled =
@ -627,8 +628,11 @@ void CommonHostInterface::UpdateSpeedLimiterState()
SetTimerResolutionIncreased(m_speed_limiter_enabled);
if (System::IsValid())
{
System::SetTargetSpeed(m_speed_limiter_enabled ? target_speed : 1.0f);
System::ResetPerformanceCounters();
}
}
void CommonHostInterface::RecreateSystem()
{
@ -1367,7 +1371,7 @@ void CommonHostInterface::RegisterGeneralHotkeys()
{
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "General")), StaticString("FastForward"),
TRANSLATABLE("Hotkeys", "Fast Forward"), [this](bool pressed) {
m_speed_limiter_temp_disabled = pressed;
m_fast_forward_enabled = pressed;
UpdateSpeedLimiterState();
});
@ -1375,11 +1379,11 @@ void CommonHostInterface::RegisterGeneralHotkeys()
StaticString(TRANSLATABLE("Hotkeys", "Toggle Fast Forward")), [this](bool pressed) {
if (pressed)
{
m_speed_limiter_temp_disabled = !m_speed_limiter_temp_disabled;
m_fast_forward_enabled = !m_fast_forward_enabled;
UpdateSpeedLimiterState();
AddOSDMessage(m_speed_limiter_enabled ?
TranslateStdString("OSDMessage", "Speed limiter enabled.") :
TranslateStdString("OSDMessage", "Speed limiter disabled."),
AddOSDMessage(m_fast_forward_enabled ?
TranslateStdString("OSDMessage", "Fast forwarding...") :
TranslateStdString("OSDMessage", "Stopped fast forwarding."),
2.0f);
}
});
@ -2080,9 +2084,9 @@ void CommonHostInterface::CheckForSettingsChanges(const Settings& old_settings)
g_settings.audio_buffer_size != old_settings.audio_buffer_size ||
g_settings.video_sync_enabled != old_settings.video_sync_enabled ||
g_settings.audio_sync_enabled != old_settings.audio_sync_enabled ||
g_settings.speed_limiter_enabled != old_settings.speed_limiter_enabled ||
g_settings.increase_timer_resolution != old_settings.increase_timer_resolution ||
g_settings.emulation_speed != old_settings.emulation_speed ||
g_settings.fast_forward_speed != old_settings.fast_forward_speed ||
g_settings.display_max_fps != old_settings.display_max_fps)
{
UpdateSpeedLimiterState();

View file

@ -180,6 +180,9 @@ public:
/// Parses a fullscreen mode into its components (width * height @ refresh hz)
static bool ParseFullscreenMode(const std::string_view& mode, u32* width, u32* height, float* refresh_rate);
/// Returns true if fast forwarding is currently active.
bool IsFastForwardEnabled() const { return m_fast_forward_enabled; }
protected:
enum : u32
{
@ -325,9 +328,9 @@ protected:
std::mutex m_osd_messages_lock;
bool m_frame_step_request = false;
bool m_speed_limiter_temp_disabled = false;
bool m_speed_limiter_enabled = false;
bool m_fast_forward_enabled = false;
bool m_timer_resolution_increased = false;
bool m_speed_limiter_enabled = true;
private:
void InitializeUserDirectory();