GameSettings: Add CD-ROM Read Speedup

This commit is contained in:
Connor McLaughlin 2020-10-05 00:17:12 +10:00
parent 8ba93b36a0
commit a3f2f13fa9
5 changed files with 104 additions and 4 deletions

View File

@ -270,6 +270,12 @@ void GamePropertiesDialog::populateGameSettings()
populateBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, gs.cpu_overclock_enable);
updateCPUClockSpeedLabel();
if (gs.cdrom_read_speedup.has_value())
{
QSignalBlocker sb(m_ui.userCDROMReadSpeedup);
m_ui.userCDROMReadSpeedup->setCurrentIndex(static_cast<int>(gs.cdrom_read_speedup.value()));
}
if (gs.display_active_start_offset.has_value())
{
QSignalBlocker sb(m_ui.displayActiveStartOffset);
@ -435,6 +441,14 @@ void GamePropertiesDialog::connectUi()
updateCPUClockSpeedLabel();
});
connect(m_ui.userCDROMReadSpeedup, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
if (index <= 0)
m_game_settings.cdrom_read_speedup.reset();
else
m_game_settings.cdrom_read_speedup = static_cast<u32>(index);
saveGameSettings();
});
connect(m_ui.userAspectRatio, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
if (index <= 0)
m_game_settings.display_aspect_ratio.reset();

View File

@ -402,7 +402,82 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Other Settings</string>
</property>
<layout class="QFormLayout" name="formLayout_7">
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>CD-ROM Read Speedup:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="userCDROMReadSpeedup">
<item>
<property name="text">
<string>(unchanged)</string>
</property>
</item>
<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>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>

View File

@ -115,7 +115,7 @@ private:
enum : u32
{
GAME_LIST_CACHE_SIGNATURE = 0x45434C47,
GAME_LIST_CACHE_VERSION = 12
GAME_LIST_CACHE_VERSION = 13
};
using DatabaseMap = std::unordered_map<std::string, GameListDatabaseEntry>;

View File

@ -106,7 +106,7 @@ bool Entry::LoadFromStream(ByteStream* stream)
if (!stream->Read2(bits.data(), num_bytes) || !ReadOptionalFromStream(stream, &cpu_overclock_numerator) ||
!ReadOptionalFromStream(stream, &cpu_overclock_denominator) ||
!ReadOptionalFromStream(stream, &cpu_overclock_enable) ||
!ReadOptionalFromStream(stream, &cpu_overclock_enable) || !ReadOptionalFromStream(stream, &cdrom_read_speedup) ||
!ReadOptionalFromStream(stream, &display_active_start_offset) ||
!ReadOptionalFromStream(stream, &display_active_end_offset) ||
!ReadOptionalFromStream(stream, &display_crop_mode) || !ReadOptionalFromStream(stream, &display_aspect_ratio) ||
@ -149,7 +149,7 @@ bool Entry::SaveToStream(ByteStream* stream) const
return stream->Write2(bits.data(), num_bytes) && WriteOptionalToStream(stream, cpu_overclock_numerator) &&
WriteOptionalToStream(stream, cpu_overclock_denominator) &&
WriteOptionalToStream(stream, cpu_overclock_enable) &&
WriteOptionalToStream(stream, cpu_overclock_enable) && WriteOptionalToStream(stream, cdrom_read_speedup) &&
WriteOptionalToStream(stream, display_active_start_offset) &&
WriteOptionalToStream(stream, display_active_end_offset) && WriteOptionalToStream(stream, display_crop_mode) &&
WriteOptionalToStream(stream, display_aspect_ratio) &&
@ -183,6 +183,10 @@ static void ParseIniSection(Entry* entry, const char* section, const CSimpleIniA
if (cvalue)
entry->cpu_overclock_enable = StringUtil::FromChars<bool>(cvalue);
cvalue = ini.GetValue(section, "CDROMReadSpeedup", nullptr);
if (cvalue)
entry->cdrom_read_speedup = StringUtil::FromChars<u32>(cvalue);
long lvalue = ini.GetLongValue(section, "DisplayActiveStartOffset", 0);
if (lvalue != 0)
entry->display_active_start_offset = static_cast<s16>(lvalue);
@ -267,6 +271,9 @@ static void StoreIniSection(const Entry& entry, const char* section, CSimpleIniA
if (entry.cpu_overclock_enable.has_value())
ini.SetBoolValue(section, "CPUOverclockEnable", entry.cpu_overclock_enable.value());
if (entry.cdrom_read_speedup.has_value())
ini.SetBoolValue(section, "CDROMReadSpeedup", entry.cdrom_read_speedup.value());
if (entry.display_active_start_offset.has_value())
ini.SetLongValue(section, "DisplayActiveStartOffset", entry.display_active_start_offset.value());
@ -430,6 +437,9 @@ void Entry::ApplySettings(bool display_osd_messages) const
g_settings.cpu_overclock_enable = cpu_overclock_enable.value();
g_settings.UpdateOverclockActive();
if (cdrom_read_speedup.has_value())
g_settings.cdrom_read_speedup = cdrom_read_speedup.value();
if (display_active_start_offset.has_value())
g_settings.display_active_start_offset = display_active_start_offset.value();
if (display_active_end_offset.has_value())

View File

@ -43,6 +43,7 @@ struct Entry
std::optional<u32> cpu_overclock_numerator;
std::optional<u32> cpu_overclock_denominator;
std::optional<bool> cpu_overclock_enable;
std::optional<u32> cdrom_read_speedup;
std::optional<DisplayCropMode> display_crop_mode;
std::optional<DisplayAspectRatio> display_aspect_ratio;
std::optional<bool> display_linear_upscaling;