GameSettings: Add runahead as per-game setting

This commit is contained in:
Connor McLaughlin
2021-01-26 03:12:19 +10:00
parent 16a32bf696
commit a5dfc68ac9
5 changed files with 120 additions and 9 deletions

View File

@ -268,6 +268,12 @@ void GamePropertiesDialog::populateGameSettings()
m_trait_checkboxes[i]->setChecked(gs.HasTrait(static_cast<GameSettings::Trait>(i)));
}
if (gs.runahead_frames.has_value())
{
QSignalBlocker sb(m_ui.userRunaheadFrames);
m_ui.userRunaheadFrames->setCurrentIndex(static_cast<int>(gs.runahead_frames.value()));
}
if (gs.cpu_overclock_numerator.has_value() || gs.cpu_overclock_denominator.has_value())
{
const u32 numerator = gs.cpu_overclock_numerator.value_or(1);
@ -491,6 +497,14 @@ void GamePropertiesDialog::connectUi()
m_ui.exportCompatibilityInfo->setVisible(show_buttons);
});
connect(m_ui.userRunaheadFrames, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
if (index <= 0)
m_game_settings.runahead_frames.reset();
else
m_game_settings.runahead_frames = static_cast<u32>(index - 1);
saveGameSettings();
});
connectBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, &m_game_settings.cpu_overclock_enable);
connect(m_ui.userEnableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
&GamePropertiesDialog::updateCPUClockSpeedLabel);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>750</width>
<height>567</height>
<width>793</width>
<height>619</height>
</rect>
</property>
<property name="windowTitle">
@ -436,7 +436,7 @@
<property name="title">
<string>Other Settings</string>
</property>
<layout class="QFormLayout" name="formLayout_7">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
@ -503,6 +503,77 @@
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_32">
<property name="text">
<string>Runahead Frames:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="userRunaheadFrames">
<item>
<property name="text">
<string>(unchanged)</string>
</property>
</item>
<item>
<property name="text">
<string>Disabled</string>
</property>
</item>
<item>
<property name="text">
<string>1 Frame</string>
</property>
</item>
<item>
<property name="text">
<string>2 Frames</string>
</property>
</item>
<item>
<property name="text">
<string>3 Frames</string>
</property>
</item>
<item>
<property name="text">
<string>4 Frames</string>
</property>
</item>
<item>
<property name="text">
<string>5 Frames</string>
</property>
</item>
<item>
<property name="text">
<string>6 Frames</string>
</property>
</item>
<item>
<property name="text">
<string>7 Frames</string>
</property>
</item>
<item>
<property name="text">
<string>8 Frames</string>
</property>
</item>
<item>
<property name="text">
<string>9 Frames</string>
</property>
</item>
<item>
<property name="text">
<string>10 Frames</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>