CDROM: Add option to speed up double speed reads

This commit is contained in:
Connor McLaughlin
2020-10-05 00:05:14 +10:00
parent 51e8eb108e
commit 8ba93b36a0
8 changed files with 106 additions and 7 deletions

View File

@ -39,11 +39,19 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QW
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 "
"cases also eliminates stutter when games initiate audio track playback."));
dialog->registerWidgetHelp(
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."));
m_ui.cpuClockSpeed->setEnabled(m_ui.enableCPUClockSpeedControl->checkState() == Qt::Checked);
m_ui.cdromReadSpeedup->setCurrentIndex(m_host_interface->GetIntSettingValue("CDROM", "ReadSpeedup", 1) - 1);
connect(m_ui.enableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
&ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked);
connect(m_ui.cpuClockSpeed, &QSlider::valueChanged, this, &ConsoleSettingsWidget::onCPUClockSpeedValueChanged);
connect(m_ui.cdromReadSpeedup, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&ConsoleSettingsWidget::onCDROMReadSpeedupValueChanged);
calculateCPUClockValue();
}
@ -95,6 +103,12 @@ void ConsoleSettingsWidget::updateCPUClockSpeedLabel()
m_ui.cpuClockSpeedLabel->setText(tr("%1% (%2MHz)").arg(percent).arg(frequency / 1000000.0, 0, 'f', 2));
}
void ConsoleSettingsWidget::onCDROMReadSpeedupValueChanged(int value)
{
m_host_interface->SetIntSettingValue("CDROM", "ReadSpeedup", value + 1);
m_host_interface->applySettings();
}
void ConsoleSettingsWidget::calculateCPUClockValue()
{
const u32 numerator = static_cast<u32>(m_host_interface->GetIntSettingValue("CPU", "OverclockNumerator", 1));

View File

@ -19,6 +19,7 @@ private Q_SLOTS:
void onEnableCPUClockSpeedControlChecked(int state);
void onCPUClockSpeedValueChanged(int value);
void updateCPUClockSpeedLabel();
void onCDROMReadSpeedupValueChanged(int value);
private:
void calculateCPUClockValue();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>541</width>
<height>351</height>
<width>648</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle">
@ -132,30 +132,91 @@
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>CDROM Emulation</string>
<string>CD-ROM Emulation</string>
</property>
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="0" colspan="2">
<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="1" column="0" colspan="2">
<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="2" column="0" colspan="2">
<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">
<string>Read Speedup:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cdromReadSpeedup">
<item>
<property name="text">
<string>None (Double Speed)</string>
</property>
</item>
<item>
<property name="text">
<string>2x (Quad Speed)</string>
</property>
</item>
<item>
<property name="text">
<string>3x (6x Speed)</string>
</property>
</item>
<item>
<property name="text">
<string>4x (8x Speed)</string>
</property>
</item>
<item>
<property name="text">
<string>5x (10x Speed)</string>
</property>
</item>
<item>
<property name="text">
<string>6x (12x Speed)</string>
</property>
</item>
<item>
<property name="text">
<string>7x (14x Speed)</string>
</property>
</item>
<item>
<property name="text">
<string>8x (16x Speed)</string>
</property>
</item>
<item>
<property name="text">
<string>9x (18x Speed)</string>
</property>
</item>
<item>
<property name="text">
<string>10x (20x Speed)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>