diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index c27d659ff..e66718d78 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -2460,6 +2460,42 @@ void CommonHostInterface::RegisterSystemHotkeys() } } }); + + RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "System")), StaticString("IncreaseEmulationSpeed"), + StaticString(TRANSLATABLE("Hotkeys", "Increase Emulation Speed")), [this](bool pressed) { + if (pressed && System::IsValid()) + { + g_settings.emulation_speed += 0.1f; + UpdateSpeedLimiterState(); + AddKeyedFormattedOSDMessage("EmulationSpeedChange", 5.0f, + TranslateString("OSDMessage", "Emulation speed set to %u%%."), + static_cast(std::lround(g_settings.emulation_speed * 100.0f))); + } + }); + + RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "System")), StaticString("DecreaseEmulationSpeed"), + StaticString(TRANSLATABLE("Hotkeys", "Decrease Emulation Speed")), [this](bool pressed) { + if (pressed && System::IsValid()) + { + g_settings.emulation_speed = std::max(g_settings.emulation_speed - 0.1f, 0.1f); + UpdateSpeedLimiterState(); + AddKeyedFormattedOSDMessage("EmulationSpeedChange", 5.0f, + TranslateString("OSDMessage", "Emulation speed set to %u%%."), + static_cast(std::lround(g_settings.emulation_speed * 100.0f))); + } + }); + + RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "System")), StaticString("ResetEmulationSpeed"), + StaticString(TRANSLATABLE("Hotkeys", "Reset Emulation Speed")), [this](bool pressed) { + if (pressed && System::IsValid()) + { + g_settings.emulation_speed = GetFloatSettingValue("Main", "EmulationSpeed", 1.0f); + UpdateSpeedLimiterState(); + AddKeyedFormattedOSDMessage("EmulationSpeedChange", 5.0f, + TranslateString("OSDMessage", "Emulation speed set to %u%%."), + static_cast(std::lround(g_settings.emulation_speed * 100.0f))); + } + }); } void CommonHostInterface::RegisterGraphicsHotkeys()