Merge pull request #1275 from briaguya/master Tools: Allow for separate fast forward ratios for held/toggled speedup
endrift vi@endrift.com
Sun, 30 Jun 2019 22:13:29 -0700
4 files changed,
106 insertions(+),
22 deletions(-)
M
src/platform/qt/CoreController.cpp
→
src/platform/qt/CoreController.cpp
@@ -253,6 +253,7 @@ Interrupter interrupter(this);
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 @@ QMetaObject::invokeMethod(this, "frameAvailable");
} 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 @@ }
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)) {
M
src/platform/qt/CoreController.h
→
src/platform/qt/CoreController.h
@@ -237,6 +237,7 @@ int m_fastForwardForced = false;
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;
M
src/platform/qt/SettingsView.cpp
→
src/platform/qt/SettingsView.cpp
@@ -425,6 +425,12 @@ } else {
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");@@ -580,6 +586,16 @@ } else {
m_ui.fastForwardUnbounded->setChecked(false); m_ui.fastForwardRatio->setEnabled(true); 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");
M
src/platform/qt/SettingsView.ui
→
src/platform/qt/SettingsView.ui
@@ -691,13 +691,56 @@ </item>
</layout> </item> <item row="1" column="0"> + <widget class="QLabel" name="label_181"> + <property name="text"> + <string>Fast forward (held) speed:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_51"> + <item> + <widget class="QDoubleSpinBox" name="fastForwardHeldRatio"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="suffix"> + <string>×</string> + </property> + <property name="minimum"> + <double>0.010000000000000</double> + </property> + <property name="maximum"> + <double>20.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.500000000000000</double> + </property> + <property name="value"> + <double>5.000000000000000</double> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="fastForwardHeldUnbounded"> + <property name="text"> + <string>Unbounded</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0"> <widget class="QLabel" name="label_31"> <property name="text"> <string>Autofire interval:</string> </property> </widget> </item> - <item row="1" column="1"> + <item row="2" column="1"> <widget class="QSpinBox" name="autofireThreshold"> <property name="minimum"> <number>1</number>@@ -707,28 +750,28 @@ <number>60</number>
</property> </widget> </item> - <item row="2" column="0" colspan="2"> + <item row="3" column="0" colspan="2"> <widget class="Line" name="line"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="3" column="1"> + <item row="4" column="1"> <widget class="QCheckBox" name="rewind"> <property name="text"> <string>Enable rewind</string> </property> </widget> </item> - <item row="4" column="0"> + <item row="5" column="0"> <widget class="QLabel" name="label_8"> <property name="text"> <string>Rewind history:</string> </property> </widget> </item> - <item row="4" column="1"> + <item row="5" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_13"> <item> <widget class="QSpinBox" name="rewindCapacity">@@ -746,21 +789,21 @@ </widget>
</item> </layout> </item> - <item row="5" column="0" colspan="2"> + <item row="6" column="0" colspan="2"> <widget class="Line" name="line_3"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="6" column="0"> + <item row="7" column="0"> <widget class="QLabel" name="label_15"> <property name="text"> <string>Idle loops:</string> </property> </widget> </item> - <item row="6" column="1"> + <item row="7" column="1"> <widget class="QComboBox" name="idleOptimization"> <item> <property name="text">@@ -779,28 +822,28 @@ </property>
</item> </widget> </item> - <item row="7" column="1"> + <item row="8" column="1"> <widget class="QCheckBox" name="preload"> <property name="text"> <string>Preload entire ROM into memory</string> </property> </widget> </item> - <item row="8" column="0" colspan="2"> + <item row="9" column="0" colspan="2"> <widget class="Line" name="line_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="9" column="0"> + <item row="10" column="0"> <widget class="QLabel" name="label_24"> <property name="text"> <string>Savestate extra data:</string> </property> </widget> </item> - <item row="9" column="1"> + <item row="10" column="1"> <widget class="QCheckBox" name="saveStateScreenshot"> <property name="text"> <string>Screenshot</string>@@ -810,7 +853,7 @@ <bool>true</bool>
</property> </widget> </item> - <item row="10" column="1"> + <item row="11" column="1"> <widget class="QCheckBox" name="saveStateSave"> <property name="text"> <string>Save data</string>@@ -820,7 +863,7 @@ <bool>true</bool>
</property> </widget> </item> - <item row="11" column="1"> + <item row="12" column="1"> <widget class="QCheckBox" name="saveStateCheats"> <property name="text"> <string>Cheat codes</string>@@ -830,21 +873,21 @@ <bool>true</bool>
</property> </widget> </item> - <item row="12" column="0" colspan="2"> + <item row="13" column="0" colspan="2"> <widget class="Line" name="line_9"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="13" column="0"> + <item row="14" column="0"> <widget class="QLabel" name="label_25"> <property name="text"> <string>Load extra data:</string> </property> </widget> </item> - <item row="13" column="1"> + <item row="14" column="1"> <widget class="QCheckBox" name="loadStateScreenshot"> <property name="text"> <string>Screenshot</string>@@ -854,14 +897,14 @@ <bool>true</bool>
</property> </widget> </item> - <item row="14" column="1"> + <item row="15" column="1"> <widget class="QCheckBox" name="loadStateSave"> <property name="text"> <string>Save data</string> </property> </widget> </item> - <item row="15" column="1"> + <item row="16" column="1"> <widget class="QCheckBox" name="loadStateCheats"> <property name="text"> <string>Cheat codes</string>@@ -1977,6 +2020,12 @@ <x>349</x>
<y>38</y> </hint> </hints> + </connection> + <connection> + <sender>fastForwardHeldUnbounded</sender> + <signal>toggled(bool)</signal> + <receiver>fastForwardHeldRatio</receiver> + <slot>setDisabled(bool)</slot> </connection> </connections> </ui>