CDROM: Add option to speed up double speed reads

pull/927/head
Connor McLaughlin 5 years ago
parent 51e8eb108e
commit 8ba93b36a0

@ -620,6 +620,10 @@ TickCount CDROM::GetAckDelayForCommand(Command command)
TickCount CDROM::GetTicksForRead() TickCount CDROM::GetTicksForRead()
{ {
const TickCount tps = System::GetTicksPerSecond(); const TickCount tps = System::GetTicksPerSecond();
if (g_settings.cdrom_read_speedup > 1 && !m_mode.cdda && !m_mode.xa_enable && m_mode.double_speed)
return tps / (150 * g_settings.cdrom_read_speedup);
return m_mode.double_speed ? (tps / 150) : (tps / 75); return m_mode.double_speed ? (tps / 150) : (tps / 75);
} }

@ -457,6 +457,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
si.SetBoolValue("CDROM", "RegionCheck", true); si.SetBoolValue("CDROM", "RegionCheck", true);
si.SetBoolValue("CDROM", "LoadImageToRAM", false); si.SetBoolValue("CDROM", "LoadImageToRAM", false);
si.SetBoolValue("CDROM", "MuteCDAudio", false); si.SetBoolValue("CDROM", "MuteCDAudio", false);
si.SetIntValue("CDROM", "ReadSpeedup", 1);
si.SetStringValue("Audio", "Backend", Settings::GetAudioBackendName(Settings::DEFAULT_AUDIO_BACKEND)); si.SetStringValue("Audio", "Backend", Settings::GetAudioBackendName(Settings::DEFAULT_AUDIO_BACKEND));
si.SetIntValue("Audio", "OutputVolume", 100); si.SetIntValue("Audio", "OutputVolume", 100);

@ -176,6 +176,7 @@ void Settings::Load(SettingsInterface& si)
cdrom_region_check = si.GetBoolValue("CDROM", "RegionCheck", true); cdrom_region_check = si.GetBoolValue("CDROM", "RegionCheck", true);
cdrom_load_image_to_ram = si.GetBoolValue("CDROM", "LoadImageToRAM", false); cdrom_load_image_to_ram = si.GetBoolValue("CDROM", "LoadImageToRAM", false);
cdrom_mute_cd_audio = si.GetBoolValue("CDROM", "MuteCDAudio", false); cdrom_mute_cd_audio = si.GetBoolValue("CDROM", "MuteCDAudio", false);
cdrom_read_speedup = si.GetIntValue("CDROM", "ReadSpeedup", 1);
audio_backend = audio_backend =
ParseAudioBackend(si.GetStringValue("Audio", "Backend", GetAudioBackendName(DEFAULT_AUDIO_BACKEND)).c_str()) ParseAudioBackend(si.GetStringValue("Audio", "Backend", GetAudioBackendName(DEFAULT_AUDIO_BACKEND)).c_str())
@ -296,6 +297,7 @@ void Settings::Save(SettingsInterface& si) const
si.SetBoolValue("CDROM", "RegionCheck", cdrom_region_check); si.SetBoolValue("CDROM", "RegionCheck", cdrom_region_check);
si.SetBoolValue("CDROM", "LoadImageToRAM", cdrom_load_image_to_ram); si.SetBoolValue("CDROM", "LoadImageToRAM", cdrom_load_image_to_ram);
si.SetBoolValue("CDROM", "MuteCDAudio", cdrom_mute_cd_audio); si.SetBoolValue("CDROM", "MuteCDAudio", cdrom_mute_cd_audio);
si.SetIntValue("CDROM", "ReadSpeedup", cdrom_read_speedup);
si.SetStringValue("Audio", "Backend", GetAudioBackendName(audio_backend)); si.SetStringValue("Audio", "Backend", GetAudioBackendName(audio_backend));
si.SetIntValue("Audio", "OutputVolume", audio_output_volume); si.SetIntValue("Audio", "OutputVolume", audio_output_volume);

@ -123,6 +123,7 @@ struct Settings
bool cdrom_region_check = true; bool cdrom_region_check = true;
bool cdrom_load_image_to_ram = false; bool cdrom_load_image_to_ram = false;
bool cdrom_mute_cd_audio = false; bool cdrom_mute_cd_audio = false;
u32 cdrom_read_speedup = 1;
AudioBackend audio_backend = AudioBackend::Cubeb; AudioBackend audio_backend = AudioBackend::Cubeb;
s32 audio_output_volume = 100; s32 audio_output_volume = 100;

@ -445,7 +445,7 @@ void LibretroHostInterface::OnSystemDestroyed()
m_using_hardware_renderer = false; m_using_hardware_renderer = false;
} }
static std::array<retro_core_option_definition, 35> s_option_definitions = {{ static std::array<retro_core_option_definition, 36> s_option_definitions = {{
{"duckstation_Console.Region", {"duckstation_Console.Region",
"Console Region", "Console Region",
"Determines which region/hardware to emulate. Auto-Detect will use the region of the disc inserted.", "Determines which region/hardware to emulate. Auto-Detect will use the region of the disc inserted.",
@ -481,6 +481,21 @@ static std::array<retro_core_option_definition, 35> s_option_definitions = {{
"Forcibly mutes both CD-DA and XA audio from the CD-ROM. Can be used to disable background music in some games.", "Forcibly mutes both CD-DA and XA audio from the CD-ROM. Can be used to disable background music in some games.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"duckstation_CDROM.ReadSpeedup",
"Mute CD Audio",
"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.",
{{"1", "None (Double Speed)"},
{"2", "2x (Quad Speed)"},
{"3", "3x (6x Speed)"},
{"4", "4x (8x Speed)"},
{"5", "5x (10x Speed)"},
{"6", "6x (12x Speed)"},
{"7", "7x (14x Speed)"},
{"8", "8x (16x Speed)"},
{"9", "9x (18x Speed)"},
{"10", "10x (20x Speed)"}},
"1"},
{"duckstation_CPU.ExecutionMode", {"duckstation_CPU.ExecutionMode",
"CPU Execution Mode", "CPU Execution Mode",
"Which mode to use for CPU emulation. Recompiler provides the best performance.", "Which mode to use for CPU emulation. Recompiler provides the best performance.",

@ -39,11 +39,19 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QW
m_ui.cdromLoadImageToRAM, tr("Preload Image to RAM"), tr("Unchecked"), 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 " 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.")); "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.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, connect(m_ui.enableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
&ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked); &ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked);
connect(m_ui.cpuClockSpeed, &QSlider::valueChanged, this, &ConsoleSettingsWidget::onCPUClockSpeedValueChanged); connect(m_ui.cpuClockSpeed, &QSlider::valueChanged, this, &ConsoleSettingsWidget::onCPUClockSpeedValueChanged);
connect(m_ui.cdromReadSpeedup, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&ConsoleSettingsWidget::onCDROMReadSpeedupValueChanged);
calculateCPUClockValue(); calculateCPUClockValue();
} }
@ -95,6 +103,12 @@ void ConsoleSettingsWidget::updateCPUClockSpeedLabel()
m_ui.cpuClockSpeedLabel->setText(tr("%1% (%2MHz)").arg(percent).arg(frequency / 1000000.0, 0, 'f', 2)); 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() void ConsoleSettingsWidget::calculateCPUClockValue()
{ {
const u32 numerator = static_cast<u32>(m_host_interface->GetIntSettingValue("CPU", "OverclockNumerator", 1)); const u32 numerator = static_cast<u32>(m_host_interface->GetIntSettingValue("CPU", "OverclockNumerator", 1));

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

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>541</width> <width>648</width>
<height>351</height> <height>401</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -132,30 +132,91 @@
<item> <item>
<widget class="QGroupBox" name="groupBox_4"> <widget class="QGroupBox" name="groupBox_4">
<property name="title"> <property name="title">
<string>CDROM Emulation</string> <string>CD-ROM Emulation</string>
</property> </property>
<layout class="QFormLayout" name="formLayout_4"> <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"> <widget class="QCheckBox" name="cdromReadThread">
<property name="text"> <property name="text">
<string>Use Read Thread (Asynchronous)</string> <string>Use Read Thread (Asynchronous)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="cdromRegionCheck"> <widget class="QCheckBox" name="cdromRegionCheck">
<property name="text"> <property name="text">
<string>Enable Region Check</string> <string>Enable Region Check</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="cdromLoadImageToRAM"> <widget class="QCheckBox" name="cdromLoadImageToRAM">
<property name="text"> <property name="text">
<string>Preload Image To RAM</string> <string>Preload Image To RAM</string>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>

Loading…
Cancel
Save