Unify CPU clock speed behaviour in Game Properties and Console Settings
This commit is contained in:
parent
7d8f3d26a6
commit
fce4829d2d
|
@ -311,6 +311,7 @@ void GamePropertiesDialog::populateGameSettings()
|
||||||
|
|
||||||
populateBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, gs.cpu_overclock_enable);
|
populateBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, gs.cpu_overclock_enable);
|
||||||
populateBooleanUserSetting(m_ui.userEnable8MBRAM, gs.enable_8mb_ram);
|
populateBooleanUserSetting(m_ui.userEnable8MBRAM, gs.enable_8mb_ram);
|
||||||
|
m_ui.userCPUClockSpeed->setEnabled(m_ui.userEnableCPUClockSpeedControl->checkState() != Qt::Unchecked);
|
||||||
updateCPUClockSpeedLabel();
|
updateCPUClockSpeedLabel();
|
||||||
|
|
||||||
if (gs.cdrom_read_speedup.has_value())
|
if (gs.cdrom_read_speedup.has_value())
|
||||||
|
@ -567,7 +568,7 @@ void GamePropertiesDialog::connectUi()
|
||||||
connectBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, &m_game_settings.cpu_overclock_enable);
|
connectBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, &m_game_settings.cpu_overclock_enable);
|
||||||
connectBooleanUserSetting(m_ui.userEnable8MBRAM, &m_game_settings.enable_8mb_ram);
|
connectBooleanUserSetting(m_ui.userEnable8MBRAM, &m_game_settings.enable_8mb_ram);
|
||||||
connect(m_ui.userEnableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
|
connect(m_ui.userEnableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
|
||||||
&GamePropertiesDialog::updateCPUClockSpeedLabel);
|
&GamePropertiesDialog::onEnableCPUClockSpeedControlChecked);
|
||||||
|
|
||||||
connect(m_ui.userCPUClockSpeed, &QSlider::valueChanged, [this](int value) {
|
connect(m_ui.userCPUClockSpeed, &QSlider::valueChanged, [this](int value) {
|
||||||
if (value == 100)
|
if (value == 100)
|
||||||
|
@ -856,11 +857,18 @@ void GamePropertiesDialog::connectUi()
|
||||||
|
|
||||||
void GamePropertiesDialog::updateCPUClockSpeedLabel()
|
void GamePropertiesDialog::updateCPUClockSpeedLabel()
|
||||||
{
|
{
|
||||||
const int percent = m_ui.userCPUClockSpeed->value();
|
const int percent =
|
||||||
|
m_ui.userEnableCPUClockSpeedControl->checkState() != Qt::Unchecked ? m_ui.userCPUClockSpeed->value() : 100;
|
||||||
const double frequency = (static_cast<double>(System::MASTER_CLOCK) * static_cast<double>(percent)) / 100.0;
|
const double frequency = (static_cast<double>(System::MASTER_CLOCK) * static_cast<double>(percent)) / 100.0;
|
||||||
m_ui.userCPUClockSpeedLabel->setText(tr("%1% (%2MHz)").arg(percent).arg(frequency / 1000000.0, 0, 'f', 2));
|
m_ui.userCPUClockSpeedLabel->setText(tr("%1% (%2MHz)").arg(percent).arg(frequency / 1000000.0, 0, 'f', 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GamePropertiesDialog::onEnableCPUClockSpeedControlChecked(int state)
|
||||||
|
{
|
||||||
|
m_ui.userCPUClockSpeed->setEnabled(state != Qt::Unchecked);
|
||||||
|
updateCPUClockSpeedLabel();
|
||||||
|
}
|
||||||
|
|
||||||
void GamePropertiesDialog::onUserAspectRatioChanged()
|
void GamePropertiesDialog::onUserAspectRatioChanged()
|
||||||
{
|
{
|
||||||
const int index = m_ui.userAspectRatio->currentIndex();
|
const int index = m_ui.userAspectRatio->currentIndex();
|
||||||
|
|
|
@ -37,6 +37,7 @@ private Q_SLOTS:
|
||||||
void onVerifyDumpClicked();
|
void onVerifyDumpClicked();
|
||||||
void onExportCompatibilityInfoClicked();
|
void onExportCompatibilityInfoClicked();
|
||||||
void updateCPUClockSpeedLabel();
|
void updateCPUClockSpeedLabel();
|
||||||
|
void onEnableCPUClockSpeedControlChecked(int state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupAdditionalUi();
|
void setupAdditionalUi();
|
||||||
|
|
Loading…
Reference in New Issue