mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
Qt: Move emulation speed settings to console settings
This commit is contained in:
parent
54f5563321
commit
fdeef65676
|
@ -35,6 +35,28 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QW
|
|||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.cdromLoadImageToRAM, "CDROM", "LoadImageToRAM",
|
||||
false);
|
||||
|
||||
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.emulationSpeed);
|
||||
const int emulation_speed_index =
|
||||
m_ui.emulationSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "EmulationSpeed", 1.0f)));
|
||||
if (emulation_speed_index >= 0)
|
||||
m_ui.emulationSpeed->setCurrentIndex(emulation_speed_index);
|
||||
connect(m_ui.emulationSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&ConsoleSettingsWidget::onEmulationSpeedIndexChanged);
|
||||
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.fastForwardSpeed);
|
||||
const int fast_forward_speed_index =
|
||||
m_ui.fastForwardSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "FastForwardSpeed", 0.0f)));
|
||||
if (fast_forward_speed_index >= 0)
|
||||
m_ui.fastForwardSpeed->setCurrentIndex(fast_forward_speed_index);
|
||||
connect(m_ui.fastForwardSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&ConsoleSettingsWidget::onFastForwardSpeedIndexChanged);
|
||||
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.turboSpeed);
|
||||
const int turbo_speed_index =
|
||||
m_ui.turboSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "TurboSpeed", 0.0f)));
|
||||
if (turbo_speed_index >= 0)
|
||||
m_ui.turboSpeed->setCurrentIndex(turbo_speed_index);
|
||||
connect(m_ui.turboSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&ConsoleSettingsWidget::onTurboSpeedIndexChanged);
|
||||
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.cdromLoadImageToRAM, tr("Preload Image to RAM"), tr("Unchecked"),
|
||||
tr("Loads the game image into RAM. Useful for network paths that may become unreliable during gameplay. In some "
|
||||
|
@ -43,6 +65,16 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QW
|
|||
m_ui.cdromReadSpeedup, tr("CDROM Read Speedup"), tr("None (Double Speed"),
|
||||
tr("Speeds up CD-ROM reads by the specified factor. Only applies to double-speed reads, and is ignored when audio "
|
||||
"is playing. May improve loading speeds in some games, at the cost of breaking others."));
|
||||
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 speed. This speed will be used when the fast forward hotkey is pressed/toggled."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.turboSpeed, tr("Turbo Speed"), "100%",
|
||||
tr("Sets the turbo speed. This speed will be used when the turbo hotkey is pressed/toggled."));
|
||||
|
||||
m_ui.cpuClockSpeed->setEnabled(m_ui.enableCPUClockSpeedControl->checkState() == Qt::Checked);
|
||||
m_ui.cdromReadSpeedup->setCurrentIndex(m_host_interface->GetIntSettingValue("CDROM", "ReadSpeedup", 1) - 1);
|
||||
|
@ -118,3 +150,27 @@ void ConsoleSettingsWidget::calculateCPUClockValue()
|
|||
m_ui.cpuClockSpeed->setValue(static_cast<int>(percent));
|
||||
updateCPUClockSpeedLabel();
|
||||
}
|
||||
|
||||
void ConsoleSettingsWidget::onEmulationSpeedIndexChanged(int index)
|
||||
{
|
||||
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 ConsoleSettingsWidget::onFastForwardSpeedIndexChanged(int index)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
void ConsoleSettingsWidget::onTurboSpeedIndexChanged(int index)
|
||||
{
|
||||
bool okay;
|
||||
const float value = m_ui.turboSpeed->currentData().toFloat(&okay);
|
||||
m_host_interface->SetFloatSettingValue("Main", "TurboSpeed", okay ? value : 0.0f);
|
||||
m_host_interface->applySettings();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,9 @@ private Q_SLOTS:
|
|||
void onCPUClockSpeedValueChanged(int value);
|
||||
void updateCPUClockSpeedLabel();
|
||||
void onCDROMReadSpeedupValueChanged(int value);
|
||||
void onEmulationSpeedIndexChanged(int index);
|
||||
void onFastForwardSpeedIndexChanged(int index);
|
||||
void onTurboSpeedIndexChanged(int index);
|
||||
|
||||
private:
|
||||
void calculateCPUClockValue();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>648</width>
|
||||
<height>401</height>
|
||||
<height>456</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -45,12 +45,51 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Speed Control</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Emulation Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="emulationSpeed"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Fast Forward Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="fastForwardSpeed"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Turbo Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="turboSpeed"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>CPU Emulation</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
|
@ -61,16 +100,9 @@
|
|||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cpuExecutionMode"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>CPU Clock Speed Control</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableCPUClockSpeedControl">
|
||||
|
@ -104,7 +136,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item>
|
||||
<widget class="QSlider" name="cpuClockSpeed">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
|
@ -127,6 +159,8 @@
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -135,27 +169,6 @@
|
|||
<string>CD-ROM Emulation</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="cdromReadThread">
|
||||
<property name="text">
|
||||
<string>Use Read Thread (Asynchronous)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="cdromRegionCheck">
|
||||
<property name="text">
|
||||
<string>Enable Region Check</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="cdromLoadImageToRAM">
|
||||
<property name="text">
|
||||
<string>Preload Image To RAM</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
|
@ -217,6 +230,31 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="cdromReadThread">
|
||||
<property name="text">
|
||||
<string>Use Read Thread (Asynchronous)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="cdromRegionCheck">
|
||||
<property name="text">
|
||||
<string>Enable Region Check</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cdromLoadImageToRAM">
|
||||
<property name="text">
|
||||
<string>Preload Image To RAM</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -38,29 +38,6 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
|
|||
m_host_interface, m_ui.controllerBackend, "Main", "ControllerBackend", &ControllerInterface::ParseBackendName,
|
||||
&ControllerInterface::GetBackendName, ControllerInterface::GetDefaultBackend());
|
||||
|
||||
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.emulationSpeed);
|
||||
const int emulation_speed_index =
|
||||
m_ui.emulationSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "EmulationSpeed", 1.0f)));
|
||||
if (emulation_speed_index >= 0)
|
||||
m_ui.emulationSpeed->setCurrentIndex(emulation_speed_index);
|
||||
connect(m_ui.emulationSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&GeneralSettingsWidget::onEmulationSpeedIndexChanged);
|
||||
|
||||
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.fastForwardSpeed);
|
||||
const int fast_forward_speed_index =
|
||||
m_ui.fastForwardSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "FastForwardSpeed", 0.0f)));
|
||||
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);
|
||||
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.turboSpeed);
|
||||
const int turbo_speed_index =
|
||||
m_ui.turboSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "TurboSpeed", 0.0f)));
|
||||
if (turbo_speed_index >= 0)
|
||||
m_ui.turboSpeed->setCurrentIndex(turbo_speed_index);
|
||||
connect(m_ui.turboSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&GeneralSettingsWidget::onTurboSpeedIndexChanged);
|
||||
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.confirmPowerOff, tr("Confirm Power Off"), tr("Checked"),
|
||||
tr("Determines whether a prompt will be displayed to confirm shutting down the emulator/game "
|
||||
|
@ -90,16 +67,6 @@ 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.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 speed. This speed will be used when the fast forward hotkey is pressed/toggled."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.turboSpeed, tr("Turbo Speed"), "100%",
|
||||
tr("Sets the turbo speed. This speed will be used when the turbo hotkey is pressed/toggled."));
|
||||
dialog->registerWidgetHelp(m_ui.controllerBackend, tr("Controller Backend"),
|
||||
qApp->translate("ControllerInterface", ControllerInterface::GetBackendName(
|
||||
ControllerInterface::GetDefaultBackend())),
|
||||
|
@ -149,27 +116,3 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
|
|||
}
|
||||
|
||||
GeneralSettingsWidget::~GeneralSettingsWidget() = default;
|
||||
|
||||
void GeneralSettingsWidget::onEmulationSpeedIndexChanged(int index)
|
||||
{
|
||||
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::onFastForwardSpeedIndexChanged(int index)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
void GeneralSettingsWidget::onTurboSpeedIndexChanged(int index)
|
||||
{
|
||||
bool okay;
|
||||
const float value = m_ui.turboSpeed->currentData().toFloat(&okay);
|
||||
m_host_interface->SetFloatSettingValue("Main", "TurboSpeed", okay ? value : 0.0f);
|
||||
m_host_interface->applySettings();
|
||||
}
|
||||
|
|
|
@ -15,11 +15,6 @@ public:
|
|||
explicit GeneralSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog);
|
||||
~GeneralSettingsWidget();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onEmulationSpeedIndexChanged(int index);
|
||||
void onFastForwardSpeedIndexChanged(int index);
|
||||
void onTurboSpeedIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::GeneralSettingsWidget m_ui;
|
||||
|
||||
|
|
|
@ -105,45 +105,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Speed Control</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Emulation Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="emulationSpeed"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Fast Forward Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="fastForwardSpeed"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Turbo Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="turboSpeed"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
|
|
Loading…
Reference in a new issue