diff --git a/src/platform/qt/CoreController.cpp b/src/platform/qt/CoreController.cpp index f0e29584d..dc90b73c5 100644 --- a/src/platform/qt/CoreController.cpp +++ b/src/platform/qt/CoreController.cpp @@ -253,6 +253,7 @@ void CoreController::loadConfig(ConfigController* config) { m_loadStateFlags = config->getOption("loadStateExtdata", m_loadStateFlags).toInt(); m_saveStateFlags = config->getOption("saveStateExtdata", m_saveStateFlags).toInt(); m_fastForwardRatio = config->getOption("fastForwardRatio", m_fastForwardRatio).toFloat(); + m_fastForwardHeldRatio = config->getOption("fastForwardHeldRatio", m_fastForwardRatio).toFloat(); m_videoSync = config->getOption("videoSync", m_videoSync).toInt(); m_audioSync = config->getOption("audioSync", m_audioSync).toInt(); m_fpsTarget = config->getOption("fpsTarget").toFloat(); @@ -900,6 +901,8 @@ void CoreController::finishFrame() { } void CoreController::updateFastForward() { + // If we have "Fast forward" checked in the menu (m_fastForwardForced) + // or are holding the fast forward button (m_fastForward): if (m_fastForward || m_fastForwardForced) { if (m_fastForwardVolume >= 0) { m_threadContext.core->opts.volume = m_fastForwardVolume; @@ -907,10 +910,25 @@ void CoreController::updateFastForward() { if (m_fastForwardMute >= 0) { m_threadContext.core->opts.mute = m_fastForwardMute; } - if (m_fastForwardRatio > 0) { - m_threadContext.impl->sync.fpsTarget = m_fpsTarget * m_fastForwardRatio; + + // If we aren't holding the fast forward button + // then use the non "(held)" ratio + if(!m_fastForward) { + if (m_fastForwardRatio > 0) { + m_threadContext.impl->sync.fpsTarget = m_fpsTarget * m_fastForwardRatio; + setSync(true); + } else { + setSync(false); + } } else { - setSync(false); + // If we are holding the fast forward button, + // then use the held ratio + if (m_fastForwardHeldRatio > 0) { + m_threadContext.impl->sync.fpsTarget = m_fpsTarget * m_fastForwardHeldRatio; + setSync(true); + } else { + setSync(false); + } } } else { if (!mCoreConfigGetIntValue(&m_threadContext.core->config, "volume", &m_threadContext.core->opts.volume)) { diff --git a/src/platform/qt/CoreController.h b/src/platform/qt/CoreController.h index e0ba677f7..8f89c5858 100644 --- a/src/platform/qt/CoreController.h +++ b/src/platform/qt/CoreController.h @@ -237,6 +237,7 @@ private: int m_fastForwardVolume = -1; int m_fastForwardMute = -1; float m_fastForwardRatio = -1.f; + float m_fastForwardHeldRatio = -1.f; float m_fpsTarget; InputController* m_inputController = nullptr; diff --git a/src/platform/qt/SettingsView.cpp b/src/platform/qt/SettingsView.cpp index dc1e9a26a..ff1485dc5 100644 --- a/src/platform/qt/SettingsView.cpp +++ b/src/platform/qt/SettingsView.cpp @@ -425,6 +425,12 @@ void SettingsView::updateConfig() { saveSetting("fpsTarget", m_ui.fpsTarget); } + if (m_ui.fastForwardHeldUnbounded->isChecked()) { + saveSetting("fastForwardHeldRatio", "-1"); + } else { + saveSetting("fastForwardHeldRatio", m_ui.fastForwardHeldRatio); + } + switch (m_ui.idleOptimization->currentIndex() + IDLE_LOOP_IGNORE) { case IDLE_LOOP_IGNORE: saveSetting("idleOptimization", "ignore"); @@ -582,6 +588,16 @@ void SettingsView::reloadConfig() { m_ui.fastForwardRatio->setValue(fastForwardRatio); } + double fastForwardHeldRatio = loadSetting("fastForwardHeldRatio").toDouble(); + if (fastForwardHeldRatio <= 0) { + m_ui.fastForwardHeldUnbounded->setChecked(true); + m_ui.fastForwardHeldRatio->setEnabled(false); + } else { + m_ui.fastForwardHeldUnbounded->setChecked(false); + m_ui.fastForwardHeldRatio->setEnabled(true); + m_ui.fastForwardHeldRatio->setValue(fastForwardHeldRatio); + } + QString idleOptimization = loadSetting("idleOptimization"); if (idleOptimization == "ignore") { m_ui.idleOptimization->setCurrentIndex(0); diff --git a/src/platform/qt/SettingsView.ui b/src/platform/qt/SettingsView.ui index 3f4068bb5..bc95d5416 100644 --- a/src/platform/qt/SettingsView.ui +++ b/src/platform/qt/SettingsView.ui @@ -691,13 +691,56 @@ + + + Fast forward (held) speed: + + + + + + + + + false + + + × + + + 0.010000000000000 + + + 20.000000000000000 + + + 0.500000000000000 + + + 5.000000000000000 + + + + + + + Unbounded + + + true + + + + + + Autofire interval: - + 1 @@ -707,28 +750,28 @@ - + Qt::Horizontal - + Enable rewind - + Rewind history: - + @@ -746,21 +789,21 @@ - + Qt::Horizontal - + Idle loops: - + @@ -779,28 +822,28 @@ - + Preload entire ROM into memory - + Qt::Horizontal - + Savestate extra data: - + Screenshot @@ -810,7 +853,7 @@ - + Save data @@ -820,7 +863,7 @@ - + Cheat codes @@ -830,21 +873,21 @@ - + Qt::Horizontal - + Load extra data: - + Screenshot @@ -854,14 +897,14 @@ - + Save data - + Cheat codes @@ -1978,5 +2021,11 @@ + + fastForwardHeldUnbounded + toggled(bool) + fastForwardHeldRatio + setDisabled(bool) +