From e26e82d8d5f9a3907b3623bd50dffd1c9b84969e Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 17:08:24 -0400 Subject: [PATCH 01/25] configuration_shared: Initial functions and data for manual tristate Sets up initial support for implementing colored tristate functions. These functions color a QWidget blue when it's overriding a global setting, and discolor it when not. The lack of color indicates it uses the global state, replacing the Qt::CheckState::PartiallyChecked state with the global state. --- .../configuration/configuration_shared.cpp | 42 +++++++++++++++++++ src/yuzu/configuration/configuration_shared.h | 16 +++++++ 2 files changed, 58 insertions(+) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index bb47c39336..f32fcf3b7d 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -4,10 +4,15 @@ #include #include +#include #include "core/settings.h" #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_per_game.h" +namespace ConfigurationShared { +Trackers trackers = {}; +} + void ConfigurationShared::ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox) { if (checkbox->checkState() == Qt::PartiallyChecked) { @@ -18,6 +23,17 @@ void ConfigurationShared::ApplyPerGameSetting(Settings::Setting* setting, } } +void ConfigurationShared::ApplyPerGameSetting(Settings::Setting* setting, + const QCheckBox* checkbox, + const CheckState& tracker) { + if (tracker == CheckState::Global) { + setting->SetGlobal(true); + } else { + setting->SetGlobal(false); + setting->SetValue(checkbox->checkState()); + } +} + void ConfigurationShared::ApplyPerGameSetting(Settings::Setting* setting, const QComboBox* combobox) { if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { @@ -69,6 +85,32 @@ void ConfigurationShared::SetPerGameSetting( ConfigurationShared::USE_GLOBAL_OFFSET); } +void ConfigurationShared::SetBGColor(QWidget* widget, bool highlighted) { + if (highlighted) { + widget->setStyleSheet(QStringLiteral("background-color:rgba(0,203,255,0.5);")); + } else { + widget->setStyleSheet(QStringLiteral("background-color:rgba(0,0,0,0);")); + } + widget->show(); +} + +void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, Settings::Setting& setting, + ConfigurationShared::CheckState& tracker) { + if (setting.UsingGlobal()) { + tracker = CheckState::Global; + } else { + tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off; + } + SetBGColor(checkbox, tracker != CheckState::Global); + QObject::connect(checkbox, &QCheckBox::clicked, checkbox, [checkbox, setting, &tracker]() { + tracker = static_cast((tracker + 1) % CheckState::Count); + if (tracker == CheckState::Global) { + checkbox->setChecked(setting.GetValue(true)); + } + SetBGColor(checkbox, tracker != CheckState::Global); + }); +} + void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { const QString use_global_text = ConfigurePerGame::tr("Use global configuration"); combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index b11b1b9502..1163604bf4 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -15,8 +15,20 @@ constexpr int USE_GLOBAL_INDEX = 0; constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; constexpr int USE_GLOBAL_OFFSET = 2; +enum CheckState { + Off, + On, + Global, + Count, +}; + +struct Trackers { +} extern trackers; + // Global-aware apply and set functions +void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox, + const CheckState& tracker); void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox); void ApplyPerGameSetting(Settings::Setting* setting, const QComboBox* combobox); void ApplyPerGameSetting(Settings::Setting* setting, @@ -31,6 +43,10 @@ void SetPerGameSetting(QComboBox* combobox, void SetPerGameSetting(QComboBox* combobox, const Settings::Setting* setting); +void SetBGColor(QWidget* widget, bool highlighted); +void SetColoredTristate(QCheckBox* checkbox, Settings::Setting& setting, + ConfigurationShared::CheckState& tracker); + void InsertGlobalItem(QComboBox* combobox); } // namespace ConfigurationShared From 58672cc7b6ee58209a802e030f2a427e579ca415 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 17:08:50 -0400 Subject: [PATCH 02/25] configure_general: Implement manual tristate buttons --- src/yuzu/configuration/configuration_shared.h | 2 + src/yuzu/configuration/configure_general.cpp | 42 +++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 1163604bf4..4f0166fae3 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -23,6 +23,8 @@ enum CheckState { }; struct Trackers { + CheckState use_frame_limit; + CheckState use_multi_core; } extern trackers; // Global-aware apply and set functions diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 20316c9cca..e3ddbc2941 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -19,9 +19,10 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) SetConfiguration(); - connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit, [this]() { - ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked); - }); + if (Settings::configuring_global) { + connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, + [this]() { ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); }); + } } ConfigureGeneral::~ConfigureGeneral() = default; @@ -40,17 +41,13 @@ void ConfigureGeneral::SetConfiguration() { ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); - if (!Settings::configuring_global) { - if (Settings::values.use_multi_core.UsingGlobal()) { - ui->use_multi_core->setCheckState(Qt::PartiallyChecked); - } - if (Settings::values.use_frame_limit.UsingGlobal()) { - ui->toggle_frame_limit->setCheckState(Qt::PartiallyChecked); - } + if (Settings::configuring_global) { + ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue()); + } else { + ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue() && + ConfigurationShared::trackers.use_frame_limit != + ConfigurationShared::CheckState::Global); } - - ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked && - ui->toggle_frame_limit->isEnabled()); } void ConfigureGeneral::ApplyConfiguration() { @@ -71,9 +68,11 @@ void ConfigureGeneral::ApplyConfiguration() { } } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, - ui->use_multi_core); + ui->use_multi_core, + ConfigurationShared::trackers.use_multi_core); - bool global_frame_limit = ui->toggle_frame_limit->checkState() == Qt::PartiallyChecked; + bool global_frame_limit = ConfigurationShared::trackers.use_frame_limit == + ConfigurationShared::CheckState::Global; Settings::values.use_frame_limit.SetGlobal(global_frame_limit); Settings::values.frame_limit.SetGlobal(global_frame_limit); if (!global_frame_limit) { @@ -109,6 +108,15 @@ void ConfigureGeneral::SetupPerGameUI() { ui->toggle_background_pause->setVisible(false); ui->toggle_hide_mouse->setVisible(false); - ui->toggle_frame_limit->setTristate(true); - ui->use_multi_core->setTristate(true); + ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, + Settings::values.use_frame_limit, + ConfigurationShared::trackers.use_frame_limit); + ConfigurationShared::SetColoredTristate(ui->use_multi_core, Settings::values.use_multi_core, + ConfigurationShared::trackers.use_multi_core); + + connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { + ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked() && + (ConfigurationShared::trackers.use_frame_limit != + ConfigurationShared::CheckState::Global)); + }); } From 5a9dc8f002c68e4af1fab9b7cfbd65e86ee2d110 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 17:42:13 -0400 Subject: [PATCH 03/25] configuration_shared: Use a highlight instead of background color Fixes visibility in the built-in dark theme --- src/yuzu/configuration/configuration_shared.cpp | 10 +++++----- src/yuzu/configuration/configuration_shared.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index f32fcf3b7d..78dd76c6e2 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -85,11 +85,11 @@ void ConfigurationShared::SetPerGameSetting( ConfigurationShared::USE_GLOBAL_OFFSET); } -void ConfigurationShared::SetBGColor(QWidget* widget, bool highlighted) { +void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) { if (highlighted) { - widget->setStyleSheet(QStringLiteral("background-color:rgba(0,203,255,0.5);")); + widget->setStyleSheet(QStringLiteral("border:2px solid;border-color:rgba(0,203,255,0.5);")); } else { - widget->setStyleSheet(QStringLiteral("background-color:rgba(0,0,0,0);")); + widget->setStyleSheet(QStringLiteral("border:2px solid;border-color:rgba(0,0,0,0);")); } widget->show(); } @@ -101,13 +101,13 @@ void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, Settings::Sett } else { tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off; } - SetBGColor(checkbox, tracker != CheckState::Global); + SetHighlight(checkbox, tracker != CheckState::Global); QObject::connect(checkbox, &QCheckBox::clicked, checkbox, [checkbox, setting, &tracker]() { tracker = static_cast((tracker + 1) % CheckState::Count); if (tracker == CheckState::Global) { checkbox->setChecked(setting.GetValue(true)); } - SetBGColor(checkbox, tracker != CheckState::Global); + SetHighlight(checkbox, tracker != CheckState::Global); }); } diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 4f0166fae3..88709446ca 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -45,7 +45,7 @@ void SetPerGameSetting(QComboBox* combobox, void SetPerGameSetting(QComboBox* combobox, const Settings::Setting* setting); -void SetBGColor(QWidget* widget, bool highlighted); +void SetHighlight(QWidget* widget, bool highlighted); void SetColoredTristate(QCheckBox* checkbox, Settings::Setting& setting, ConfigurationShared::CheckState& tracker); From da65b92f9e9992413938bb084949367822b890c8 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 19:22:41 -0400 Subject: [PATCH 04/25] configuration_shared: Require name of the widget for highlighting Prevents mass-coloring of elements later on --- .../configuration/configuration_shared.cpp | 32 ++++++++++++------- src/yuzu/configuration/configuration_shared.h | 6 ++-- src/yuzu/configuration/configure_general.cpp | 5 +-- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 78dd76c6e2..08d67facd6 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "core/settings.h" #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_per_game.h" @@ -85,30 +86,37 @@ void ConfigurationShared::SetPerGameSetting( ConfigurationShared::USE_GLOBAL_OFFSET); } -void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) { +void ConfigurationShared::SetHighlight(QWidget* widget, const std::string& name, bool highlighted) { if (highlighted) { - widget->setStyleSheet(QStringLiteral("border:2px solid;border-color:rgba(0,203,255,0.5);")); + widget->setStyleSheet( + QStringLiteral("QWidget#%1 { border:2px solid;border-color:rgba(0,203,255,0.5) }") + .arg(QString::fromStdString(name))); } else { - widget->setStyleSheet(QStringLiteral("border:2px solid;border-color:rgba(0,0,0,0);")); + widget->setStyleSheet( + QStringLiteral("QWidget#%1 { border:2px solid;border-color:rgba(0,0,0,0) }") + .arg(QString::fromStdString(name))); } widget->show(); } -void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, Settings::Setting& setting, +void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, + const Settings::Setting& setting, ConfigurationShared::CheckState& tracker) { if (setting.UsingGlobal()) { tracker = CheckState::Global; } else { tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off; } - SetHighlight(checkbox, tracker != CheckState::Global); - QObject::connect(checkbox, &QCheckBox::clicked, checkbox, [checkbox, setting, &tracker]() { - tracker = static_cast((tracker + 1) % CheckState::Count); - if (tracker == CheckState::Global) { - checkbox->setChecked(setting.GetValue(true)); - } - SetHighlight(checkbox, tracker != CheckState::Global); - }); + SetHighlight(checkbox, name, tracker != CheckState::Global); + QObject::connect( + checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, setting, &tracker]() { + tracker = + static_cast((tracker + 1) % CheckState::Count); + if (tracker == CheckState::Global) { + checkbox->setChecked(setting.GetValue(true)); + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + }); } void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 88709446ca..b2bd971c80 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -25,6 +25,8 @@ enum CheckState { struct Trackers { CheckState use_frame_limit; CheckState use_multi_core; + + CheckState enable_audio_stretching; } extern trackers; // Global-aware apply and set functions @@ -45,8 +47,8 @@ void SetPerGameSetting(QComboBox* combobox, void SetPerGameSetting(QComboBox* combobox, const Settings::Setting* setting); -void SetHighlight(QWidget* widget, bool highlighted); -void SetColoredTristate(QCheckBox* checkbox, Settings::Setting& setting, +void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); +void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Settings::Setting& setting, ConfigurationShared::CheckState& tracker); void InsertGlobalItem(QComboBox* combobox); diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index e3ddbc2941..b4c288ca49 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -108,10 +108,11 @@ void ConfigureGeneral::SetupPerGameUI() { ui->toggle_background_pause->setVisible(false); ui->toggle_hide_mouse->setVisible(false); - ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, + ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, "toggle_frame_limit", Settings::values.use_frame_limit, ConfigurationShared::trackers.use_frame_limit); - ConfigurationShared::SetColoredTristate(ui->use_multi_core, Settings::values.use_multi_core, + ConfigurationShared::SetColoredTristate(ui->use_multi_core, "use_multi_core", + Settings::values.use_multi_core, ConfigurationShared::trackers.use_multi_core); connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { From bf25d583c6279aa425ed3211e1bffd67a5e7646d Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 19:30:11 -0400 Subject: [PATCH 05/25] configure_audio: Implement highlighted overrides --- src/yuzu/configuration/configure_audio.cpp | 25 ++-- src/yuzu/configuration/configure_audio.ui | 142 +++++++++++---------- 2 files changed, 87 insertions(+), 80 deletions(-) diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index cc021beecc..2418ca0053 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -49,12 +49,9 @@ void ConfigureAudio::SetConfiguration() { ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum()); - if (Settings::configuring_global) { - ui->toggle_audio_stretching->setChecked( - Settings::values.enable_audio_stretching.GetValue()); - } else { - ConfigurationShared::SetPerGameSetting(ui->toggle_audio_stretching, - &Settings::values.enable_audio_stretching); + ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue()); + + if (!Settings::configuring_global) { if (Settings::values.volume.UsingGlobal()) { ui->volume_combo_box->setCurrentIndex(0); ui->volume_slider->setEnabled(false); @@ -62,6 +59,8 @@ void ConfigureAudio::SetConfiguration() { ui->volume_combo_box->setCurrentIndex(1); ui->volume_slider->setEnabled(true); } + ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout", + !Settings::values.volume.UsingGlobal()); } SetVolumeIndicatorText(ui->volume_slider->sliderPosition()); } @@ -119,8 +118,9 @@ void ConfigureAudio::ApplyConfiguration() { ui->volume_slider->maximum()); } } else { - ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, - ui->toggle_audio_stretching); + ConfigurationShared::ApplyPerGameSetting( + &Settings::values.enable_audio_stretching, ui->toggle_audio_stretching, + ConfigurationShared::trackers.enable_audio_stretching); if (ui->volume_combo_box->currentIndex() == 0) { Settings::values.volume.SetGlobal(true); } else { @@ -173,9 +173,14 @@ void ConfigureAudio::SetupPerGameUI() { return; } - ui->toggle_audio_stretching->setTristate(true); + ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching, "toggle_audio_stretching", + Settings::values.enable_audio_stretching, + ConfigurationShared::trackers.enable_audio_stretching); connect(ui->volume_combo_box, static_cast(&QComboBox::activated), - this, [this](int index) { ui->volume_slider->setEnabled(index == 1); }); + this, [this](int index) { + ui->volume_slider->setEnabled(index == 1); + ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout", index == 1); + }); ui->output_sink_combo_box->setVisible(false); ui->output_sink_label->setVisible(false); diff --git a/src/yuzu/configuration/configure_audio.ui b/src/yuzu/configuration/configure_audio.ui index 862ccb9886..3c11479358 100644 --- a/src/yuzu/configuration/configure_audio.ui +++ b/src/yuzu/configuration/configure_audio.ui @@ -56,80 +56,82 @@ - - - 0 - - - - + + + + 1 + + + + + + Use global volume + + + + + Set volume: + + + + + + - Use global volume + Volume: + + + + + + + Qt::Horizontal + + + + 30 + 20 + + + + + + + + + 0 + 0 + + + + 100 + + + 10 + + + Qt::Horizontal + + + + + + + + 32 + 0 + - - - Set volume: + 0 % - - - - - - - Volume: - - - - - - - Qt::Horizontal - - - - 30 - 20 - - - - - - - - - 0 - 0 - - - - 100 - - - 10 - - - Qt::Horizontal - - - - - - - - 32 - 0 - - - - 0 % - - - Qt::AlignCenter - - - - + + Qt::AlignCenter + + + + + From c4246b80f84c0bd979e4506c17b1c9a34ac77ae8 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 21:32:10 -0400 Subject: [PATCH 06/25] configure_graphics: Implement highlighted overrides --- src/yuzu/configuration/configure_graphics.cpp | 43 ++- src/yuzu/configuration/configure_graphics.ui | 291 ++++++++++-------- 2 files changed, 200 insertions(+), 134 deletions(-) diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index cb4706bd6b..07dc75ccbc 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -32,7 +32,12 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) SetConfiguration(); connect(ui->api, qOverload(&QComboBox::currentIndexChanged), this, - [this] { UpdateDeviceComboBox(); }); + [this] { + UpdateDeviceComboBox(); + if (!Settings::configuring_global) { + ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", ui->api->currentIndex() != ConfigurationShared::USE_GLOBAL_INDEX); + } + }); connect(ui->device, qOverload(&QComboBox::activated), this, [this](int device) { UpdateDeviceSelection(device); }); @@ -65,25 +70,23 @@ void ConfigureGraphics::SetConfiguration() { ui->api->setEnabled(runtime_lock); ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); ui->use_disk_shader_cache->setEnabled(runtime_lock); + ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue()); + ui->use_asynchronous_gpu_emulation->setChecked( + Settings::values.use_asynchronous_gpu_emulation.GetValue()); if (Settings::configuring_global) { ui->api->setCurrentIndex(static_cast(Settings::values.renderer_backend.GetValue())); ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); - ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue()); - ui->use_asynchronous_gpu_emulation->setChecked( - Settings::values.use_asynchronous_gpu_emulation.GetValue()); } else { - ConfigurationShared::SetPerGameSetting(ui->use_disk_shader_cache, - &Settings::values.use_disk_shader_cache); - ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_gpu_emulation, - &Settings::values.use_asynchronous_gpu_emulation); - ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox, &Settings::values.aspect_ratio); ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", !Settings::values.aspect_ratio.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", !Settings::values.bg_red.UsingGlobal()); + // FIXME: ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", !Settings::values.renderer_backend.UsingGlobal()); } UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(), @@ -240,11 +243,23 @@ void ConfigureGraphics::SetupPerGameUI() { return; } + connect(ui->aspect_ratio_combobox, static_cast(&QComboBox::activated), this, [this](int index) { + ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", index != 0); + }); connect(ui->bg_combobox, static_cast(&QComboBox::activated), this, - [this](int index) { ui->bg_button->setEnabled(index == 1); }); + [this](int index) { + ui->bg_button->setEnabled(index == 1); + ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", index == 1); + }); - ui->use_disk_shader_cache->setTristate(true); - ui->use_asynchronous_gpu_emulation->setTristate(true); - ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox); - ConfigurationShared::InsertGlobalItem(ui->api); + ConfigurationShared::SetColoredTristate(ui->use_disk_shader_cache, "use_disk_shader_cache", + Settings::values.use_disk_shader_cache, + ConfigurationShared::trackers.use_disk_shader_cache); + ConfigurationShared::SetColoredTristate( + ui->use_asynchronous_gpu_emulation, "use_asynchronous_gpu_emulation", + Settings::values.use_asynchronous_gpu_emulation, + ConfigurationShared::trackers.use_asynchronous_gpu_emulation); + + ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox, ui->aspect_ratio_combobox->itemText(Settings::values.aspect_ratio.GetValue(true))); + ConfigurationShared::InsertGlobalItem(ui->api, ui->api->itemText(static_cast(Settings::values.renderer_backend.GetValue(true)))); } diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index 62418fc142..6164569fe0 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -23,43 +23,57 @@ - - - - - API: - - - - - - - - OpenGL - - - - - Vulkan - - - - - - - - - - - - Device: - - - - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + OpenGL + + + + + Vulkan + + + + + + + + API: + + + + + + + + + + Device: + + + + + + + @@ -85,96 +99,133 @@ - - - - - Aspect Ratio: - - - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + - Default (16:9) + Aspect Ratio: - - - - Force 4:3 - - - - - Force 21:9 - - - - - Stretch to Window - - - - - + + + + + + + Default (16:9) + + + + + Force 4:3 + + + + + Force 21:9 + + + + + Stretch to Window + + + + + + - - - - - Use global background color - - - 0 - - - 10 - - - + + + + 0 + 0 + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + Use global background color - - - - Set background color: + + 0 - - - - - - - Background Color: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 40 - 16777215 - - - - - + + 10 + + + + Use global background color + + + + + Set background color: + + + + + + + + Background Color: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 40 + 16777215 + + + + + + From c9f93c05f713c192f355151eae903e3faca67e7b Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 21:32:40 -0400 Subject: [PATCH 07/25] configure_audio: fix UI margins --- src/yuzu/configuration/configure_audio.ui | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/yuzu/configuration/configure_audio.ui b/src/yuzu/configuration/configure_audio.ui index 3c11479358..9bd0cca96d 100644 --- a/src/yuzu/configuration/configure_audio.ui +++ b/src/yuzu/configuration/configure_audio.ui @@ -58,8 +58,17 @@ + + 0 + - 1 + 0 + + + 0 + + + 0 From 44b3183ec859062238720d4aaa5d9d50b9a947bd Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 21:35:58 -0400 Subject: [PATCH 08/25] configuration_shared: Better use global text Also adds trackers for graphics and advanced graphics --- src/yuzu/configuration/configuration_shared.cpp | 6 ++++++ src/yuzu/configuration/configuration_shared.h | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 08d67facd6..0c881cf7d2 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -124,3 +124,9 @@ void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); } + +void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, const QString& global) { + const QString use_global_text = ConfigurePerGame::tr("Use global configuration (%1)").arg(global); + combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); + combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); +} diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index b2bd971c80..4b52834c4a 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -27,6 +27,14 @@ struct Trackers { CheckState use_multi_core; CheckState enable_audio_stretching; + + CheckState use_disk_shader_cache; + CheckState use_asynchronous_gpu_emulation; + + CheckState use_vsync; + CheckState use_assembly_shaders; + CheckState use_fast_gpu_time; + CheckState force_30fps_mode; } extern trackers; // Global-aware apply and set functions @@ -52,5 +60,6 @@ void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Sett ConfigurationShared::CheckState& tracker); void InsertGlobalItem(QComboBox* combobox); +void InsertGlobalItem(QComboBox* combobox, const QString& global); } // namespace ConfigurationShared From b79a6ebf9c45f0a3147073a3b530fa43b9344842 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 21:36:31 -0400 Subject: [PATCH 09/25] configuration_shared: Switch back to background colors Let's see if I make up my mind. --- src/yuzu/configuration/configuration_shared.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 0c881cf7d2..28b6552223 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -89,11 +89,11 @@ void ConfigurationShared::SetPerGameSetting( void ConfigurationShared::SetHighlight(QWidget* widget, const std::string& name, bool highlighted) { if (highlighted) { widget->setStyleSheet( - QStringLiteral("QWidget#%1 { border:2px solid;border-color:rgba(0,203,255,0.5) }") + QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }") .arg(QString::fromStdString(name))); } else { widget->setStyleSheet( - QStringLiteral("QWidget#%1 { border:2px solid;border-color:rgba(0,0,0,0) }") + QStringLiteral("QWidget#%1 { background-color:rgba(0,0,0,0) }") .arg(QString::fromStdString(name))); } widget->show(); From 38152ab0b9678c16c3aa902ddeaad5d437c24237 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 21:37:02 -0400 Subject: [PATCH 10/25] configure_graphics_advanced: Implement highlighted overrides --- src/yuzu/configuration/configuration_shared.h | 1 + .../configure_graphics_advanced.cpp | 87 ++++++---- .../configure_graphics_advanced.ui | 154 +++++++++++------- 3 files changed, 146 insertions(+), 96 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 4b52834c4a..71011fd92a 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -33,6 +33,7 @@ struct Trackers { CheckState use_vsync; CheckState use_assembly_shaders; + CheckState use_asynchronous_shaders; CheckState use_fast_gpu_time; CheckState force_30fps_mode; } extern trackers; diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index ce30188cd1..fbeaeccbc8 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -28,32 +28,25 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { ui->force_30fps_mode->setEnabled(runtime_lock); ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); + ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue()); + ui->use_assembly_shaders->setChecked(Settings::values.use_assembly_shaders.GetValue()); + ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue()); + ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue()); + ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode.GetValue()); + if (Settings::configuring_global) { ui->gpu_accuracy->setCurrentIndex( static_cast(Settings::values.gpu_accuracy.GetValue())); - ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue()); - ui->use_assembly_shaders->setChecked(Settings::values.use_assembly_shaders.GetValue()); - ui->use_asynchronous_shaders->setChecked( - Settings::values.use_asynchronous_shaders.GetValue()); - ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue()); - ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode.GetValue()); ui->anisotropic_filtering_combobox->setCurrentIndex( Settings::values.max_anisotropy.GetValue()); } else { ConfigurationShared::SetPerGameSetting(ui->gpu_accuracy, &Settings::values.gpu_accuracy); - ConfigurationShared::SetPerGameSetting(ui->use_vsync, &Settings::values.use_vsync); - ConfigurationShared::SetPerGameSetting(ui->use_assembly_shaders, - &Settings::values.use_assembly_shaders); - ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_shaders, - &Settings::values.use_asynchronous_shaders); - ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_shaders, - &Settings::values.use_asynchronous_shaders); - ConfigurationShared::SetPerGameSetting(ui->use_fast_gpu_time, - &Settings::values.use_fast_gpu_time); - ConfigurationShared::SetPerGameSetting(ui->force_30fps_mode, - &Settings::values.force_30fps_mode); ConfigurationShared::SetPerGameSetting(ui->anisotropic_filtering_combobox, &Settings::values.max_anisotropy); + ConfigurationShared::SetHighlight(ui->gpu_accuracy_layout, "gpu_accuracy_layout", + !Settings::values.gpu_accuracy.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->af_layout, "af_layout", + !Settings::values.max_anisotropy.UsingGlobal()); } } @@ -95,17 +88,20 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ui->anisotropic_filtering_combobox); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders, - ui->use_assembly_shaders); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, - ui->use_asynchronous_shaders); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, - ui->use_asynchronous_shaders); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, + ConfigurationShared::trackers.use_vsync); + ConfigurationShared::ApplyPerGameSetting( + &Settings::values.use_assembly_shaders, ui->use_assembly_shaders, + ConfigurationShared::trackers.use_assembly_shaders); + ConfigurationShared::ApplyPerGameSetting( + &Settings::values.use_asynchronous_shaders, ui->use_asynchronous_shaders, + ConfigurationShared::trackers.use_asynchronous_shaders); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, - ui->use_fast_gpu_time); + ui->use_fast_gpu_time, + ConfigurationShared::trackers.use_fast_gpu_time); ConfigurationShared::ApplyPerGameSetting(&Settings::values.force_30fps_mode, - ui->force_30fps_mode); + ui->force_30fps_mode, + ConfigurationShared::trackers.force_30fps_mode); ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ui->anisotropic_filtering_combobox); @@ -146,11 +142,36 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { return; } - ConfigurationShared::InsertGlobalItem(ui->gpu_accuracy); - ui->use_vsync->setTristate(true); - ui->use_assembly_shaders->setTristate(true); - ui->use_asynchronous_shaders->setTristate(true); - ui->use_fast_gpu_time->setTristate(true); - ui->force_30fps_mode->setTristate(true); - ConfigurationShared::InsertGlobalItem(ui->anisotropic_filtering_combobox); + ConfigurationShared::SetColoredTristate(ui->use_vsync, "use_vsync", Settings::values.use_vsync, + ConfigurationShared::trackers.use_vsync); + ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_assembly_shaders", + Settings::values.use_assembly_shaders, + ConfigurationShared::trackers.use_assembly_shaders); + ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_asynchronous_shaders", + Settings::values.use_asynchronous_shaders, + ConfigurationShared::trackers.use_asynchronous_shaders); + ConfigurationShared::SetColoredTristate(ui->use_fast_gpu_time, "use_fast_gpu_time", + Settings::values.use_fast_gpu_time, + ConfigurationShared::trackers.use_fast_gpu_time); + ConfigurationShared::SetColoredTristate(ui->force_30fps_mode, "force_30fps_mode", + Settings::values.force_30fps_mode, + ConfigurationShared::trackers.force_30fps_mode); + ConfigurationShared::InsertGlobalItem( + ui->gpu_accuracy, + ui->gpu_accuracy->itemText(static_cast(Settings::values.gpu_accuracy.GetValue(true)))); + ConfigurationShared::InsertGlobalItem( + ui->anisotropic_filtering_combobox, + ui->anisotropic_filtering_combobox->itemText( + static_cast(Settings::values.max_anisotropy.GetValue(true)))); + + connect(ui->gpu_accuracy, static_cast(&QComboBox::activated), this, + [this](int index) { + ConfigurationShared::SetHighlight(ui->gpu_accuracy_layout, "gpu_accuracy_layout", + index != 0); + }); + + connect(ui->anisotropic_filtering_combobox, + static_cast(&QComboBox::activated), this, [this](int index) { + ConfigurationShared::SetHighlight(ui->af_layout, "af_layout", index != 0); + }); } diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui index 71e7dfe5e9..6a0d29c272 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.ui +++ b/src/yuzu/configuration/configure_graphics_advanced.ui @@ -6,7 +6,7 @@ 0 0 - 400 + 404 321 @@ -23,34 +23,48 @@ - - - - - Accuracy Level: - - - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + - Normal + Accuracy Level: - - - - High - - - - - Extreme(very slow) - - - - - + + + + + + + Normal + + + + + High + + + + + Extreme(very slow) + + + + + + @@ -97,44 +111,58 @@ - - - - - Anisotropic Filtering: - - - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + - Default + Anisotropic Filtering: - - - - 2x - - - - - 4x - - - - - 8x - - - - - 16x - - - - - + + + + + + + Default + + + + + 2x + + + + + 4x + + + + + 8x + + + + + 16x + + + + + + From 2627241541a2b2bc691c2776f111f95d7bd94c70 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 21:48:56 -0400 Subject: [PATCH 11/25] configuration_shared: Use an int instead of a QString I noticed some of the code could be reduced to just passing the function an int, since I was doing the same thing over and over. Also clang-formats configure_graphics --- .../configuration/configuration_shared.cpp | 4 +- src/yuzu/configuration/configuration_shared.h | 2 +- src/yuzu/configuration/configure_graphics.cpp | 38 +++++++++++-------- .../configure_graphics_advanced.cpp | 6 +-- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 28b6552223..a648d339b7 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -125,8 +125,8 @@ void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); } -void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, const QString& global) { - const QString use_global_text = ConfigurePerGame::tr("Use global configuration (%1)").arg(global); +void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, int global_index) { + const QString use_global_text = ConfigurePerGame::tr("Use global configuration (%1)").arg(combobox->itemText(global_index)); combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); } diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 71011fd92a..f3676bd3ac 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -61,6 +61,6 @@ void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Sett ConfigurationShared::CheckState& tracker); void InsertGlobalItem(QComboBox* combobox); -void InsertGlobalItem(QComboBox* combobox, const QString& global); +void InsertGlobalItem(QComboBox* combobox, int global_index); } // namespace ConfigurationShared diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 07dc75ccbc..c1b38728da 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -31,13 +31,14 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) SetConfiguration(); - connect(ui->api, qOverload(&QComboBox::currentIndexChanged), this, - [this] { - UpdateDeviceComboBox(); - if (!Settings::configuring_global) { - ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", ui->api->currentIndex() != ConfigurationShared::USE_GLOBAL_INDEX); - } - }); + connect(ui->api, qOverload(&QComboBox::currentIndexChanged), this, [this] { + UpdateDeviceComboBox(); + if (!Settings::configuring_global) { + ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", + ui->api->currentIndex() != + ConfigurationShared::USE_GLOBAL_INDEX); + } + }); connect(ui->device, qOverload(&QComboBox::activated), this, [this](int device) { UpdateDeviceSelection(device); }); @@ -84,9 +85,12 @@ void ConfigureGraphics::SetConfiguration() { ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", !Settings::values.aspect_ratio.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", !Settings::values.bg_red.UsingGlobal()); - // FIXME: ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", !Settings::values.renderer_backend.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", + !Settings::values.aspect_ratio.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", + !Settings::values.bg_red.UsingGlobal()); + // FIXME: ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", + // !Settings::values.renderer_backend.UsingGlobal()); } UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(), @@ -243,9 +247,11 @@ void ConfigureGraphics::SetupPerGameUI() { return; } - connect(ui->aspect_ratio_combobox, static_cast(&QComboBox::activated), this, [this](int index) { - ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", index != 0); - }); + connect(ui->aspect_ratio_combobox, static_cast(&QComboBox::activated), + this, [this](int index) { + ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", + index != 0); + }); connect(ui->bg_combobox, static_cast(&QComboBox::activated), this, [this](int index) { ui->bg_button->setEnabled(index == 1); @@ -260,6 +266,8 @@ void ConfigureGraphics::SetupPerGameUI() { Settings::values.use_asynchronous_gpu_emulation, ConfigurationShared::trackers.use_asynchronous_gpu_emulation); - ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox, ui->aspect_ratio_combobox->itemText(Settings::values.aspect_ratio.GetValue(true))); - ConfigurationShared::InsertGlobalItem(ui->api, ui->api->itemText(static_cast(Settings::values.renderer_backend.GetValue(true)))); + ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox, + Settings::values.aspect_ratio.GetValue(true)); + ConfigurationShared::InsertGlobalItem( + ui->api, static_cast(Settings::values.renderer_backend.GetValue(true))); } diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index fbeaeccbc8..1d9a1076e5 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -157,12 +157,10 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { Settings::values.force_30fps_mode, ConfigurationShared::trackers.force_30fps_mode); ConfigurationShared::InsertGlobalItem( - ui->gpu_accuracy, - ui->gpu_accuracy->itemText(static_cast(Settings::values.gpu_accuracy.GetValue(true)))); + ui->gpu_accuracy, static_cast(Settings::values.gpu_accuracy.GetValue(true))); ConfigurationShared::InsertGlobalItem( ui->anisotropic_filtering_combobox, - ui->anisotropic_filtering_combobox->itemText( - static_cast(Settings::values.max_anisotropy.GetValue(true)))); + static_cast(Settings::values.max_anisotropy.GetValue(true))); connect(ui->gpu_accuracy, static_cast(&QComboBox::activated), this, [this](int index) { From 6316a3d8d9db432eb810c554385837c96037cba5 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 23:00:56 -0400 Subject: [PATCH 12/25] configuration_shared: Add default combobox setup function Not a catch-all, but helps clean up the code for when I do this a lot. Also fixes some bugs caught in configure_graphics. --- .../configuration/configuration_shared.cpp | 42 +++++++++++++++---- src/yuzu/configuration/configuration_shared.h | 7 +++- src/yuzu/configuration/configure_graphics.cpp | 24 +++++------ 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index a648d339b7..0c7caf8b5a 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -88,13 +88,11 @@ void ConfigurationShared::SetPerGameSetting( void ConfigurationShared::SetHighlight(QWidget* widget, const std::string& name, bool highlighted) { if (highlighted) { - widget->setStyleSheet( - QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }") - .arg(QString::fromStdString(name))); + widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }") + .arg(QString::fromStdString(name))); } else { - widget->setStyleSheet( - QStringLiteral("QWidget#%1 { background-color:rgba(0,0,0,0) }") - .arg(QString::fromStdString(name))); + widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,0,0,0) }") + .arg(QString::fromStdString(name))); } widget->show(); } @@ -119,6 +117,35 @@ void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::str }); } +void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, + bool global, bool state, bool global_state, + ConfigurationShared::CheckState& tracker) { + if (global) { + tracker = CheckState::Global; + } else { + tracker = (state == global_state) ? CheckState::On : CheckState::Off; + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + QObject::connect( + checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, global_state, &tracker]() { + tracker = + static_cast((tracker + 1) % CheckState::Count); + if (tracker == CheckState::Global) { + checkbox->setChecked(global_state); + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + }); +} + +void ConfigurationShared::SetColoredComboBox(QComboBox* combobox, QWidget* target, + const std::string& target_name, int global) { + InsertGlobalItem(combobox, global); + QObject::connect(combobox, static_cast(&QComboBox::activated), + target, [target, target_name](int index) { + ConfigurationShared::SetHighlight(target, target_name, index != 0); + }); +} + void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { const QString use_global_text = ConfigurePerGame::tr("Use global configuration"); combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); @@ -126,7 +153,8 @@ void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { } void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, int global_index) { - const QString use_global_text = ConfigurePerGame::tr("Use global configuration (%1)").arg(combobox->itemText(global_index)); + const QString use_global_text = + ConfigurePerGame::tr("Use global configuration (%1)").arg(combobox->itemText(global_index)); combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); } diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index f3676bd3ac..b5d6ea8c88 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -57,8 +57,13 @@ void SetPerGameSetting(QComboBox* combobox, const Settings::Setting* setting); void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); -void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Settings::Setting& setting, +void SetColoredTristate(QCheckBox* checkbox, const std::string& name, + const Settings::Setting& setting, ConfigurationShared::CheckState& tracker); +void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state, + bool global_state, ConfigurationShared::CheckState& tracker); +void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, + int global); void InsertGlobalItem(QComboBox* combobox); void InsertGlobalItem(QComboBox* combobox, int global_index); diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index c1b38728da..c79b256f9c 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -80,6 +80,8 @@ void ConfigureGraphics::SetConfiguration() { ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); } else { ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); + ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", + !Settings::values.renderer_backend.UsingGlobal()); ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox, &Settings::values.aspect_ratio); @@ -89,8 +91,6 @@ void ConfigureGraphics::SetConfiguration() { !Settings::values.aspect_ratio.UsingGlobal()); ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", !Settings::values.bg_red.UsingGlobal()); - // FIXME: ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", - // !Settings::values.renderer_backend.UsingGlobal()); } UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(), @@ -141,10 +141,12 @@ void ConfigureGraphics::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio, ui->aspect_ratio_combobox); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, - ui->use_disk_shader_cache); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, - ui->use_asynchronous_gpu_emulation); + ConfigurationShared::ApplyPerGameSetting( + &Settings::values.use_disk_shader_cache, ui->use_disk_shader_cache, + ConfigurationShared::trackers.use_disk_shader_cache); + ConfigurationShared::ApplyPerGameSetting( + &Settings::values.use_asynchronous_gpu_emulation, ui->use_asynchronous_gpu_emulation, + ConfigurationShared::trackers.use_asynchronous_gpu_emulation); if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { Settings::values.bg_red.SetGlobal(true); @@ -247,11 +249,6 @@ void ConfigureGraphics::SetupPerGameUI() { return; } - connect(ui->aspect_ratio_combobox, static_cast(&QComboBox::activated), - this, [this](int index) { - ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", - index != 0); - }); connect(ui->bg_combobox, static_cast(&QComboBox::activated), this, [this](int index) { ui->bg_button->setEnabled(index == 1); @@ -266,8 +263,9 @@ void ConfigureGraphics::SetupPerGameUI() { Settings::values.use_asynchronous_gpu_emulation, ConfigurationShared::trackers.use_asynchronous_gpu_emulation); - ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox, - Settings::values.aspect_ratio.GetValue(true)); + ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->aspect_ratio_layout, + "aspect_ratio_layout", + Settings::values.aspect_ratio.GetValue(true)); ConfigurationShared::InsertGlobalItem( ui->api, static_cast(Settings::values.renderer_backend.GetValue(true))); } From a350ae6be688f5fbc98dcb8657287e7116d084c3 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 23:01:18 -0400 Subject: [PATCH 13/25] configure_system: Implement highlighted overrides --- src/yuzu/configuration/configuration_shared.h | 3 + src/yuzu/configuration/configure_system.cpp | 108 +- src/yuzu/configuration/configure_system.ui | 972 +++++++++--------- 3 files changed, 544 insertions(+), 539 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index b5d6ea8c88..d3e86c3cf3 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -36,6 +36,9 @@ struct Trackers { CheckState use_asynchronous_shaders; CheckState use_fast_gpu_time; CheckState force_30fps_mode; + + CheckState use_rng_seed; + CheckState use_custom_rtc; } extern trackers; // Global-aware apply and set functions diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 68e02738ba..dffe357c75 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -67,21 +67,21 @@ void ConfigureSystem::SetConfiguration() { const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or( std::chrono::seconds(QDateTime::currentSecsSinceEpoch())); + ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); + ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() && + Settings::values.rng_seed.UsingGlobal()); + ui->rng_seed_edit->setText(rng_seed); + + ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value()); + ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() && + Settings::values.rng_seed.UsingGlobal()); + ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); + if (Settings::configuring_global) { ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue()); ui->combo_region->setCurrentIndex(Settings::values.region_index.GetValue()); ui->combo_time_zone->setCurrentIndex(Settings::values.time_zone_index.GetValue()); ui->combo_sound->setCurrentIndex(Settings::values.sound_index.GetValue()); - - ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); - ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() && - Settings::values.rng_seed.UsingGlobal()); - ui->rng_seed_edit->setText(rng_seed); - - ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value()); - ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() && - Settings::values.rng_seed.UsingGlobal()); - ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); } else { ConfigurationShared::SetPerGameSetting(ui->combo_language, &Settings::values.language_index); @@ -89,28 +89,6 @@ void ConfigureSystem::SetConfiguration() { ConfigurationShared::SetPerGameSetting(ui->combo_time_zone, &Settings::values.time_zone_index); ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index); - - if (Settings::values.rng_seed.UsingGlobal()) { - ui->rng_seed_checkbox->setCheckState(Qt::PartiallyChecked); - } else { - ui->rng_seed_checkbox->setCheckState( - Settings::values.rng_seed.GetValue().has_value() ? Qt::Checked : Qt::Unchecked); - ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value()); - if (Settings::values.rng_seed.GetValue().has_value()) { - ui->rng_seed_edit->setText(rng_seed); - } - } - - if (Settings::values.custom_rtc.UsingGlobal()) { - ui->custom_rtc_checkbox->setCheckState(Qt::PartiallyChecked); - } else { - ui->custom_rtc_checkbox->setCheckState( - Settings::values.custom_rtc.GetValue().has_value() ? Qt::Checked : Qt::Unchecked); - ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value()); - if (Settings::values.custom_rtc.GetValue().has_value()) { - ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); - } - } } } @@ -161,37 +139,42 @@ void ConfigureSystem::ApplyConfiguration() { ui->combo_time_zone); ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound); - switch (ui->rng_seed_checkbox->checkState()) { - case Qt::Checked: + switch (ConfigurationShared::trackers.use_rng_seed) { + case ConfigurationShared::CheckState::On: + case ConfigurationShared::CheckState::Off: Settings::values.rng_seed.SetGlobal(false); - Settings::values.rng_seed.SetValue(ui->rng_seed_edit->text().toULongLong(nullptr, 16)); + if (ui->rng_seed_checkbox->isChecked()) { + Settings::values.rng_seed.SetValue( + ui->rng_seed_edit->text().toULongLong(nullptr, 16)); + } else { + Settings::values.rng_seed.SetValue(std::nullopt); + } break; - case Qt::Unchecked: - Settings::values.rng_seed.SetGlobal(false); - Settings::values.rng_seed.SetValue(std::nullopt); - break; - case Qt::PartiallyChecked: + case ConfigurationShared::CheckState::Global: Settings::values.rng_seed.SetGlobal(false); Settings::values.rng_seed.SetValue(std::nullopt); Settings::values.rng_seed.SetGlobal(true); break; + case ConfigurationShared::CheckState::Count:; } - switch (ui->custom_rtc_checkbox->checkState()) { - case Qt::Checked: + switch (ConfigurationShared::trackers.use_custom_rtc) { + case ConfigurationShared::CheckState::On: + case ConfigurationShared::CheckState::Off: Settings::values.custom_rtc.SetGlobal(false); - Settings::values.custom_rtc.SetValue( - std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); + if (ui->custom_rtc_checkbox->isChecked()) { + Settings::values.custom_rtc.SetValue( + std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); + } else { + Settings::values.custom_rtc.SetValue(std::nullopt); + } break; - case Qt::Unchecked: - Settings::values.custom_rtc.SetGlobal(false); - Settings::values.custom_rtc.SetValue(std::nullopt); - break; - case Qt::PartiallyChecked: + case ConfigurationShared::CheckState::Global: Settings::values.custom_rtc.SetGlobal(false); Settings::values.custom_rtc.SetValue(std::nullopt); Settings::values.custom_rtc.SetGlobal(true); break; + case ConfigurationShared::CheckState::Count:; } } @@ -229,10 +212,25 @@ void ConfigureSystem::SetupPerGameUI() { return; } - ConfigurationShared::InsertGlobalItem(ui->combo_language); - ConfigurationShared::InsertGlobalItem(ui->combo_region); - ConfigurationShared::InsertGlobalItem(ui->combo_time_zone); - ConfigurationShared::InsertGlobalItem(ui->combo_sound); - ui->rng_seed_checkbox->setTristate(true); - ui->custom_rtc_checkbox->setTristate(true); + ConfigurationShared::SetColoredComboBox(ui->combo_language, ui->label_language, + "label_language", + Settings::values.language_index.GetValue(true)); + ConfigurationShared::SetColoredComboBox(ui->combo_region, ui->label_region, "label_region", + Settings::values.region_index.GetValue(true)); + ConfigurationShared::SetColoredComboBox(ui->combo_time_zone, ui->label_timezone, + "label_timezone", + Settings::values.time_zone_index.GetValue(true)); + ConfigurationShared::SetColoredComboBox(ui->combo_sound, ui->label_sound, "label_sound", + Settings::values.sound_index.GetValue(true)); + + ConfigurationShared::SetColoredTristate(ui->rng_seed_checkbox, "rng_seed_checkbox", + Settings::values.rng_seed.UsingGlobal(), + Settings::values.rng_seed.GetValue().has_value(), + Settings::values.rng_seed.GetValue(true).has_value(), + ConfigurationShared::trackers.use_rng_seed); + ConfigurationShared::SetColoredTristate(ui->custom_rtc_checkbox, "custom_rtc_checkbox", + Settings::values.custom_rtc.UsingGlobal(), + Settings::values.custom_rtc.GetValue().has_value(), + Settings::values.custom_rtc.GetValue(true).has_value(), + ConfigurationShared::trackers.use_custom_rtc); } diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui index 9c8cca6dc8..53b95658b8 100644 --- a/src/yuzu/configuration/configure_system.ui +++ b/src/yuzu/configuration/configure_system.ui @@ -21,490 +21,494 @@ System Settings - - - - - Sound output mode - - - - - - - Console ID: - - - - - - - Note: this can be overridden when region setting is auto-select - - - - Japanese (日本語) - - - - - English - - - - - French (français) - - - - - German (Deutsch) - - - - - Italian (italiano) - - - - - Spanish (español) - - - - - Chinese - - - - - Korean (한국어) - - - - - Dutch (Nederlands) - - - - - Portuguese (português) - - - - - Russian (Русский) - - - - - Taiwanese - - - - - British English - - - - - Canadian French - - - - - Latin American Spanish - - - - - Simplified Chinese - - - - - Traditional Chinese (正體中文) - - - - - - - - Region: - - - - - - - - Japan - - - - - USA - - - - - Europe - - - - - Australia - - - - - China - - - - - Korea - - - - - Taiwan - - - - - - - - Time Zone: - - - - - - - - Auto - - - - - Default - - - - - CET - - - - - CST6CDT - - - - - Cuba - - - - - EET - - - - - Egypt - - - - - Eire - - - - - EST - - - - - EST5EDT - - - - - GB - - - - - GB-Eire - - - - - GMT - - - - - GMT+0 - - - - - GMT-0 - - - - - GMT0 - - - - - Greenwich - - - - - Hongkong - - - - - HST - - - - - Iceland - - - - - Iran - - - - - Israel - - - - - Jamaica - - - - - Japan - - - - - Kwajalein - - - - - Libya - - - - - MET - - - - - MST - - - - - MST7MDT - - - - - Navajo - - - - - NZ - - - - - NZ-CHAT - - - - - Poland - - - - - Portugal - - - - - PRC - - - - - PST8PDT - - - - - ROC - - - - - ROK - - - - - Singapore - - - - - Turkey - - - - - UCT - - - - - Universal - - - - - UTC - - - - - W-SU - - - - - WET - - - - - Zulu - - - - - - - - RNG Seed - - - - - - - - Mono - - - - - Stereo - - - - - Surround - - - - - - - - Language - - - - - - - - 0 - 0 - - - - Qt::RightToLeft - - - Regenerate - - - - - - - Custom RTC - - - - - - - - 1970 - 1 - 1 - - - - d MMM yyyy h:mm:ss AP - - - - - - - - 0 - 0 - - - - - Lucida Console - - - - HHHHHHHH - - - 8 - - + + + + + + + Region: + + + + + + + + Auto + + + + + Default + + + + + CET + + + + + CST6CDT + + + + + Cuba + + + + + EET + + + + + Egypt + + + + + Eire + + + + + EST + + + + + EST5EDT + + + + + GB + + + + + GB-Eire + + + + + GMT + + + + + GMT+0 + + + + + GMT-0 + + + + + GMT0 + + + + + Greenwich + + + + + Hongkong + + + + + HST + + + + + Iceland + + + + + Iran + + + + + Israel + + + + + Jamaica + + + + + Japan + + + + + Kwajalein + + + + + Libya + + + + + MET + + + + + MST + + + + + MST7MDT + + + + + Navajo + + + + + NZ + + + + + NZ-CHAT + + + + + Poland + + + + + Portugal + + + + + PRC + + + + + PST8PDT + + + + + ROC + + + + + ROK + + + + + Singapore + + + + + Turkey + + + + + UCT + + + + + Universal + + + + + UTC + + + + + W-SU + + + + + WET + + + + + Zulu + + + + + + + + + Japan + + + + + USA + + + + + Europe + + + + + Australia + + + + + China + + + + + Korea + + + + + Taiwan + + + + + + + + Time Zone: + + + + + + + Note: this can be overridden when region setting is auto-select + + + + Japanese (日本語) + + + + + English + + + + + French (français) + + + + + German (Deutsch) + + + + + Italian (italiano) + + + + + Spanish (español) + + + + + Chinese + + + + + Korean (한국어) + + + + + Dutch (Nederlands) + + + + + Portuguese (português) + + + + + Russian (Русский) + + + + + Taiwanese + + + + + British English + + + + + Canadian French + + + + + Latin American Spanish + + + + + Simplified Chinese + + + + + Traditional Chinese (正體中文) + + + + + + + + Custom RTC + + + + + + + Language + + + + + + + RNG Seed + + + + + + + + Mono + + + + + Stereo + + + + + Surround + + + + + + + + Console ID: + + + + + + + Sound output mode + + + + + + + + 1970 + 1 + 1 + + + + d MMM yyyy h:mm:ss AP + + + + + + + + 0 + 0 + + + + + Lucida Console + + + + HHHHHHHH + + + 8 + + + + + + + + 0 + 0 + + + + Qt::RightToLeft + + + Regenerate + + + + From c94a8a3a439bd28c64e51753a5171fc4c3dc5903 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 23:25:14 -0400 Subject: [PATCH 14/25] configure_per_game: Improve style consistency The way the configurations are set up, it is not trivial to do this. I'll leave it as is, but the API selection, and the background color and volume slider selectors are kind of not following the style. --- src/yuzu/configuration/configure_graphics.cpp | 6 +- src/yuzu/configuration/configure_graphics.ui | 67 +++++++++---------- .../configure_graphics_advanced.cpp | 24 ++----- 3 files changed, 43 insertions(+), 54 deletions(-) diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index c79b256f9c..74ee8adfbb 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -87,7 +87,7 @@ void ConfigureGraphics::SetConfiguration() { ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", + ConfigurationShared::SetHighlight(ui->ar_label, "ar_label", !Settings::values.aspect_ratio.UsingGlobal()); ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", !Settings::values.bg_red.UsingGlobal()); @@ -263,8 +263,8 @@ void ConfigureGraphics::SetupPerGameUI() { Settings::values.use_asynchronous_gpu_emulation, ConfigurationShared::trackers.use_asynchronous_gpu_emulation); - ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->aspect_ratio_layout, - "aspect_ratio_layout", + ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, + "ar_label", Settings::values.aspect_ratio.GetValue(true)); ConfigurationShared::InsertGlobalItem( ui->api, static_cast(Settings::values.renderer_backend.GetValue(true))); diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index 6164569fe0..e3bbf2f595 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -6,7 +6,7 @@ 0 0 - 400 + 437 321 @@ -24,7 +24,7 @@ - + 0 @@ -37,40 +37,39 @@ 0 - - - - - - - OpenGL - - - - - Vulkan - - - + + 6 + + + + + API: + + + + + + + + OpenGL + - - - - API: - - + + + Vulkan + - - - - - - - Device: - - - - + + + + + + Device: + + + + + diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 1d9a1076e5..d02e6c7986 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -43,9 +43,9 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { ConfigurationShared::SetPerGameSetting(ui->gpu_accuracy, &Settings::values.gpu_accuracy); ConfigurationShared::SetPerGameSetting(ui->anisotropic_filtering_combobox, &Settings::values.max_anisotropy); - ConfigurationShared::SetHighlight(ui->gpu_accuracy_layout, "gpu_accuracy_layout", + ConfigurationShared::SetHighlight(ui->label_gpu_accuracy, "label_gpu_accuracy", !Settings::values.gpu_accuracy.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->af_layout, "af_layout", + ConfigurationShared::SetHighlight(ui->af_label, "af_label", !Settings::values.max_anisotropy.UsingGlobal()); } } @@ -156,20 +156,10 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { ConfigurationShared::SetColoredTristate(ui->force_30fps_mode, "force_30fps_mode", Settings::values.force_30fps_mode, ConfigurationShared::trackers.force_30fps_mode); - ConfigurationShared::InsertGlobalItem( - ui->gpu_accuracy, static_cast(Settings::values.gpu_accuracy.GetValue(true))); - ConfigurationShared::InsertGlobalItem( - ui->anisotropic_filtering_combobox, + ConfigurationShared::SetColoredComboBox( + ui->gpu_accuracy, ui->label_gpu_accuracy, "label_gpu_accuracy", + static_cast(Settings::values.gpu_accuracy.GetValue(true))); + ConfigurationShared::SetColoredComboBox( + ui->anisotropic_filtering_combobox, ui->af_label, "af_label", static_cast(Settings::values.max_anisotropy.GetValue(true))); - - connect(ui->gpu_accuracy, static_cast(&QComboBox::activated), this, - [this](int index) { - ConfigurationShared::SetHighlight(ui->gpu_accuracy_layout, "gpu_accuracy_layout", - index != 0); - }); - - connect(ui->anisotropic_filtering_combobox, - static_cast(&QComboBox::activated), this, [this](int index) { - ConfigurationShared::SetHighlight(ui->af_layout, "af_layout", index != 0); - }); } From 90a0fb1e0e3297f6a4a5a2ebf5144589b75addcd Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 23:38:29 -0400 Subject: [PATCH 15/25] configure_graphics: Fix layout in global config Fixes a regression where the global config takes up a lot of extra space. --- src/yuzu/configuration/configure_graphics.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index e3bbf2f595..62aa337e7c 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -149,7 +149,7 @@ - + 0 0 From 33a9218f35248afd67e1a2800c9be3c93e9c7fff Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 00:20:25 -0400 Subject: [PATCH 16/25] configure_system: Highlight labels on startup whoops --- src/yuzu/configuration/configure_system.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index dffe357c75..bc4afdbc77 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -89,6 +89,11 @@ void ConfigureSystem::SetConfiguration() { ConfigurationShared::SetPerGameSetting(ui->combo_time_zone, &Settings::values.time_zone_index); ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index); + + ConfigurationShared::SetHighlight(ui->label_language, "label_language", !Settings::values.language_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_region, "label_region", !Settings::values.region_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_timezone, "label_timezone", !Settings::values.time_zone_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_sound, "label_sound", !Settings::values.sound_index.UsingGlobal()); } } From d5fdbd88c8a94421e48197b274fa47c6a8f93926 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 00:36:58 -0400 Subject: [PATCH 17/25] clang-format --- src/yuzu/configuration/configuration_shared.cpp | 4 ++-- src/yuzu/configuration/configure_graphics.cpp | 3 +-- src/yuzu/configuration/configure_system.cpp | 12 ++++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 0c7caf8b5a..cb47c8eb59 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -140,8 +140,8 @@ void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::str void ConfigurationShared::SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, int global) { InsertGlobalItem(combobox, global); - QObject::connect(combobox, static_cast(&QComboBox::activated), - target, [target, target_name](int index) { + QObject::connect(combobox, static_cast(&QComboBox::activated), target, + [target, target_name](int index) { ConfigurationShared::SetHighlight(target, target_name, index != 0); }); } diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 74ee8adfbb..2867f3717d 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -263,8 +263,7 @@ void ConfigureGraphics::SetupPerGameUI() { Settings::values.use_asynchronous_gpu_emulation, ConfigurationShared::trackers.use_asynchronous_gpu_emulation); - ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, - "ar_label", + ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, "ar_label", Settings::values.aspect_ratio.GetValue(true)); ConfigurationShared::InsertGlobalItem( ui->api, static_cast(Settings::values.renderer_backend.GetValue(true))); diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index bc4afdbc77..5b485dd475 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -90,10 +90,14 @@ void ConfigureSystem::SetConfiguration() { &Settings::values.time_zone_index); ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index); - ConfigurationShared::SetHighlight(ui->label_language, "label_language", !Settings::values.language_index.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->label_region, "label_region", !Settings::values.region_index.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->label_timezone, "label_timezone", !Settings::values.time_zone_index.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->label_sound, "label_sound", !Settings::values.sound_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_language, "label_language", + !Settings::values.language_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_region, "label_region", + !Settings::values.region_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_timezone, "label_timezone", + !Settings::values.time_zone_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_sound, "label_sound", + !Settings::values.sound_index.UsingGlobal()); } } From e483ed21eb7b28ccc68689b7666cb39357592152 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 13:40:49 -0400 Subject: [PATCH 18/25] configure_system: break instead of semicolon Makes the code more readable Co-Authored-By: LC --- src/yuzu/configuration/configure_system.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 5b485dd475..f5828f0626 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -164,7 +164,8 @@ void ConfigureSystem::ApplyConfiguration() { Settings::values.rng_seed.SetValue(std::nullopt); Settings::values.rng_seed.SetGlobal(true); break; - case ConfigurationShared::CheckState::Count:; + case ConfigurationShared::CheckState::Count: + break; } switch (ConfigurationShared::trackers.use_custom_rtc) { @@ -183,7 +184,8 @@ void ConfigureSystem::ApplyConfiguration() { Settings::values.custom_rtc.SetValue(std::nullopt); Settings::values.custom_rtc.SetGlobal(true); break; - case ConfigurationShared::CheckState::Count:; + case ConfigurationShared::CheckState::Count: + break; } } From 0d462f560840f0ad584f1a24b02cd6c03cc4f5c2 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 13:55:47 -0400 Subject: [PATCH 19/25] configuration_shared: Break up tracker structs to respective classes One less global variable. --- .../configuration/configuration_shared.cpp | 4 ---- src/yuzu/configuration/configuration_shared.h | 19 ------------------ src/yuzu/configuration/configure_audio.cpp | 4 ++-- src/yuzu/configuration/configure_audio.h | 5 +++++ src/yuzu/configuration/configure_general.cpp | 12 +++++------ src/yuzu/configuration/configure_general.h | 6 ++++++ src/yuzu/configuration/configure_graphics.cpp | 8 ++++---- src/yuzu/configuration/configure_graphics.h | 6 ++++++ .../configure_graphics_advanced.cpp | 20 +++++++++---------- .../configure_graphics_advanced.h | 9 +++++++++ src/yuzu/configuration/configure_system.cpp | 8 ++++---- src/yuzu/configuration/configure_system.h | 6 ++++++ 12 files changed, 58 insertions(+), 49 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index cb47c8eb59..e6141e6a9e 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -10,10 +10,6 @@ #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_per_game.h" -namespace ConfigurationShared { -Trackers trackers = {}; -} - void ConfigurationShared::ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox) { if (checkbox->checkState() == Qt::PartiallyChecked) { diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index d3e86c3cf3..4cea7406fe 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -22,25 +22,6 @@ enum CheckState { Count, }; -struct Trackers { - CheckState use_frame_limit; - CheckState use_multi_core; - - CheckState enable_audio_stretching; - - CheckState use_disk_shader_cache; - CheckState use_asynchronous_gpu_emulation; - - CheckState use_vsync; - CheckState use_assembly_shaders; - CheckState use_asynchronous_shaders; - CheckState use_fast_gpu_time; - CheckState force_30fps_mode; - - CheckState use_rng_seed; - CheckState use_custom_rtc; -} extern trackers; - // Global-aware apply and set functions void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox, diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index 2418ca0053..1374e47425 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -120,7 +120,7 @@ void ConfigureAudio::ApplyConfiguration() { } else { ConfigurationShared::ApplyPerGameSetting( &Settings::values.enable_audio_stretching, ui->toggle_audio_stretching, - ConfigurationShared::trackers.enable_audio_stretching); + trackers.enable_audio_stretching); if (ui->volume_combo_box->currentIndex() == 0) { Settings::values.volume.SetGlobal(true); } else { @@ -175,7 +175,7 @@ void ConfigureAudio::SetupPerGameUI() { ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching, "toggle_audio_stretching", Settings::values.enable_audio_stretching, - ConfigurationShared::trackers.enable_audio_stretching); + trackers.enable_audio_stretching); connect(ui->volume_combo_box, static_cast(&QComboBox::activated), this, [this](int index) { ui->volume_slider->setEnabled(index == 1); diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h index d84f4a682b..ac541d9619 100644 --- a/src/yuzu/configuration/configure_audio.h +++ b/src/yuzu/configuration/configure_audio.h @@ -6,6 +6,7 @@ #include #include +#include "yuzu/configuration/configuration_shared.h" namespace Ui { class ConfigureAudio; @@ -37,4 +38,8 @@ private: void SetupPerGameUI(); std::unique_ptr ui; + + struct Trackers { + ConfigurationShared::CheckState enable_audio_stretching; + } trackers; }; diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index b4c288ca49..672f9df877 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -45,7 +45,7 @@ void ConfigureGeneral::SetConfiguration() { ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue()); } else { ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue() && - ConfigurationShared::trackers.use_frame_limit != + trackers.use_frame_limit != ConfigurationShared::CheckState::Global); } } @@ -69,9 +69,9 @@ void ConfigureGeneral::ApplyConfiguration() { } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, ui->use_multi_core, - ConfigurationShared::trackers.use_multi_core); + trackers.use_multi_core); - bool global_frame_limit = ConfigurationShared::trackers.use_frame_limit == + bool global_frame_limit = trackers.use_frame_limit == ConfigurationShared::CheckState::Global; Settings::values.use_frame_limit.SetGlobal(global_frame_limit); Settings::values.frame_limit.SetGlobal(global_frame_limit); @@ -110,14 +110,14 @@ void ConfigureGeneral::SetupPerGameUI() { ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, "toggle_frame_limit", Settings::values.use_frame_limit, - ConfigurationShared::trackers.use_frame_limit); + trackers.use_frame_limit); ConfigurationShared::SetColoredTristate(ui->use_multi_core, "use_multi_core", Settings::values.use_multi_core, - ConfigurationShared::trackers.use_multi_core); + trackers.use_multi_core); connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked() && - (ConfigurationShared::trackers.use_frame_limit != + (trackers.use_frame_limit != ConfigurationShared::CheckState::Global)); }); } diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index 9c785c22e2..a1758a973a 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h @@ -6,6 +6,7 @@ #include #include +#include "yuzu/configuration/configuration_shared.h" class HotkeyRegistry; @@ -31,4 +32,9 @@ private: void SetupPerGameUI(); std::unique_ptr ui; + + struct Trackers { + ConfigurationShared::CheckState use_frame_limit; + ConfigurationShared::CheckState use_multi_core; + } trackers; }; diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 2867f3717d..d419129ad8 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -143,10 +143,10 @@ void ConfigureGraphics::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting( &Settings::values.use_disk_shader_cache, ui->use_disk_shader_cache, - ConfigurationShared::trackers.use_disk_shader_cache); + trackers.use_disk_shader_cache); ConfigurationShared::ApplyPerGameSetting( &Settings::values.use_asynchronous_gpu_emulation, ui->use_asynchronous_gpu_emulation, - ConfigurationShared::trackers.use_asynchronous_gpu_emulation); + trackers.use_asynchronous_gpu_emulation); if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { Settings::values.bg_red.SetGlobal(true); @@ -257,11 +257,11 @@ void ConfigureGraphics::SetupPerGameUI() { ConfigurationShared::SetColoredTristate(ui->use_disk_shader_cache, "use_disk_shader_cache", Settings::values.use_disk_shader_cache, - ConfigurationShared::trackers.use_disk_shader_cache); + trackers.use_disk_shader_cache); ConfigurationShared::SetColoredTristate( ui->use_asynchronous_gpu_emulation, "use_asynchronous_gpu_emulation", Settings::values.use_asynchronous_gpu_emulation, - ConfigurationShared::trackers.use_asynchronous_gpu_emulation); + trackers.use_asynchronous_gpu_emulation); ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, "ar_label", Settings::values.aspect_ratio.GetValue(true)); diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 24f01c7395..8164d6d75f 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h @@ -9,6 +9,7 @@ #include #include #include "core/settings.h" +#include "yuzu/configuration/configuration_shared.h" namespace Ui { class ConfigureGraphics; @@ -42,6 +43,11 @@ private: std::unique_ptr ui; QColor bg_color; + struct Trackers { + ConfigurationShared::CheckState use_disk_shader_cache; + ConfigurationShared::CheckState use_asynchronous_gpu_emulation; + } trackers; + std::vector vulkan_devices; u32 vulkan_device{}; }; diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index d02e6c7986..8bebc30805 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -89,19 +89,19 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ui->anisotropic_filtering_combobox); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, - ConfigurationShared::trackers.use_vsync); + trackers.use_vsync); ConfigurationShared::ApplyPerGameSetting( &Settings::values.use_assembly_shaders, ui->use_assembly_shaders, - ConfigurationShared::trackers.use_assembly_shaders); + trackers.use_assembly_shaders); ConfigurationShared::ApplyPerGameSetting( &Settings::values.use_asynchronous_shaders, ui->use_asynchronous_shaders, - ConfigurationShared::trackers.use_asynchronous_shaders); + trackers.use_asynchronous_shaders); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, ui->use_fast_gpu_time, - ConfigurationShared::trackers.use_fast_gpu_time); + trackers.use_fast_gpu_time); ConfigurationShared::ApplyPerGameSetting(&Settings::values.force_30fps_mode, ui->force_30fps_mode, - ConfigurationShared::trackers.force_30fps_mode); + trackers.force_30fps_mode); ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ui->anisotropic_filtering_combobox); @@ -143,19 +143,19 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { } ConfigurationShared::SetColoredTristate(ui->use_vsync, "use_vsync", Settings::values.use_vsync, - ConfigurationShared::trackers.use_vsync); + trackers.use_vsync); ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_assembly_shaders", Settings::values.use_assembly_shaders, - ConfigurationShared::trackers.use_assembly_shaders); + trackers.use_assembly_shaders); ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_asynchronous_shaders", Settings::values.use_asynchronous_shaders, - ConfigurationShared::trackers.use_asynchronous_shaders); + trackers.use_asynchronous_shaders); ConfigurationShared::SetColoredTristate(ui->use_fast_gpu_time, "use_fast_gpu_time", Settings::values.use_fast_gpu_time, - ConfigurationShared::trackers.use_fast_gpu_time); + trackers.use_fast_gpu_time); ConfigurationShared::SetColoredTristate(ui->force_30fps_mode, "force_30fps_mode", Settings::values.force_30fps_mode, - ConfigurationShared::trackers.force_30fps_mode); + trackers.force_30fps_mode); ConfigurationShared::SetColoredComboBox( ui->gpu_accuracy, ui->label_gpu_accuracy, "label_gpu_accuracy", static_cast(Settings::values.gpu_accuracy.GetValue(true))); diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h index c043588ff3..86bfe822b2 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.h +++ b/src/yuzu/configuration/configure_graphics_advanced.h @@ -6,6 +6,7 @@ #include #include +#include "yuzu/configuration/configuration_shared.h" namespace Ui { class ConfigureGraphicsAdvanced; @@ -29,4 +30,12 @@ private: void SetupPerGameUI(); std::unique_ptr ui; + + struct Trackers { + ConfigurationShared::CheckState use_vsync; + ConfigurationShared::CheckState use_assembly_shaders; + ConfigurationShared::CheckState use_asynchronous_shaders; + ConfigurationShared::CheckState use_fast_gpu_time; + ConfigurationShared::CheckState force_30fps_mode; + } trackers; }; diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index f5828f0626..e1d8ccf976 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -148,7 +148,7 @@ void ConfigureSystem::ApplyConfiguration() { ui->combo_time_zone); ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound); - switch (ConfigurationShared::trackers.use_rng_seed) { + switch (trackers.use_rng_seed) { case ConfigurationShared::CheckState::On: case ConfigurationShared::CheckState::Off: Settings::values.rng_seed.SetGlobal(false); @@ -168,7 +168,7 @@ void ConfigureSystem::ApplyConfiguration() { break; } - switch (ConfigurationShared::trackers.use_custom_rtc) { + switch (trackers.use_custom_rtc) { case ConfigurationShared::CheckState::On: case ConfigurationShared::CheckState::Off: Settings::values.custom_rtc.SetGlobal(false); @@ -238,10 +238,10 @@ void ConfigureSystem::SetupPerGameUI() { Settings::values.rng_seed.UsingGlobal(), Settings::values.rng_seed.GetValue().has_value(), Settings::values.rng_seed.GetValue(true).has_value(), - ConfigurationShared::trackers.use_rng_seed); + trackers.use_rng_seed); ConfigurationShared::SetColoredTristate(ui->custom_rtc_checkbox, "custom_rtc_checkbox", Settings::values.custom_rtc.UsingGlobal(), Settings::values.custom_rtc.GetValue().has_value(), Settings::values.custom_rtc.GetValue(true).has_value(), - ConfigurationShared::trackers.use_custom_rtc); + trackers.use_custom_rtc); } diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index f317ef8b5e..64c4925597 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h @@ -8,6 +8,7 @@ #include #include +#include "yuzu/configuration/configuration_shared.h" namespace Ui { class ConfigureSystem; @@ -41,4 +42,9 @@ private: int region_index = 0; int time_zone_index = 0; int sound_index = 0; + + struct Trackers { + ConfigurationShared::CheckState use_rng_seed; + ConfigurationShared::CheckState use_custom_rtc; + } trackers; }; From 55ac28769aec7df378e8afe97b015bb2a56a7fd5 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sat, 18 Jul 2020 13:25:07 -0400 Subject: [PATCH 20/25] clang-format --- src/yuzu/configuration/configure_audio.cpp | 6 +++--- src/yuzu/configuration/configure_general.cpp | 13 ++++++------- src/yuzu/configuration/configure_graphics.cpp | 15 +++++++-------- .../configure_graphics_advanced.cpp | 18 ++++++++---------- src/yuzu/configuration/configure_system.cpp | 18 ++++++++---------- 5 files changed, 32 insertions(+), 38 deletions(-) diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index 1374e47425..392f35085d 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -118,9 +118,9 @@ void ConfigureAudio::ApplyConfiguration() { ui->volume_slider->maximum()); } } else { - ConfigurationShared::ApplyPerGameSetting( - &Settings::values.enable_audio_stretching, ui->toggle_audio_stretching, - trackers.enable_audio_stretching); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, + ui->toggle_audio_stretching, + trackers.enable_audio_stretching); if (ui->volume_combo_box->currentIndex() == 0) { Settings::values.volume.SetGlobal(true); } else { diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 672f9df877..3f7e1183ab 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -68,11 +68,10 @@ void ConfigureGeneral::ApplyConfiguration() { } } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, - ui->use_multi_core, - trackers.use_multi_core); + ui->use_multi_core, trackers.use_multi_core); - bool global_frame_limit = trackers.use_frame_limit == - ConfigurationShared::CheckState::Global; + bool global_frame_limit = + trackers.use_frame_limit == ConfigurationShared::CheckState::Global; Settings::values.use_frame_limit.SetGlobal(global_frame_limit); Settings::values.frame_limit.SetGlobal(global_frame_limit); if (!global_frame_limit) { @@ -116,8 +115,8 @@ void ConfigureGeneral::SetupPerGameUI() { trackers.use_multi_core); connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { - ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked() && - (trackers.use_frame_limit != - ConfigurationShared::CheckState::Global)); + ui->frame_limit->setEnabled( + ui->toggle_frame_limit->isChecked() && + (trackers.use_frame_limit != ConfigurationShared::CheckState::Global)); }); } diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index d419129ad8..598701bf02 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -141,12 +141,12 @@ void ConfigureGraphics::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio, ui->aspect_ratio_combobox); - ConfigurationShared::ApplyPerGameSetting( - &Settings::values.use_disk_shader_cache, ui->use_disk_shader_cache, - trackers.use_disk_shader_cache); - ConfigurationShared::ApplyPerGameSetting( - &Settings::values.use_asynchronous_gpu_emulation, ui->use_asynchronous_gpu_emulation, - trackers.use_asynchronous_gpu_emulation); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, + ui->use_disk_shader_cache, + trackers.use_disk_shader_cache); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, + ui->use_asynchronous_gpu_emulation, + trackers.use_asynchronous_gpu_emulation); if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { Settings::values.bg_red.SetGlobal(true); @@ -260,8 +260,7 @@ void ConfigureGraphics::SetupPerGameUI() { trackers.use_disk_shader_cache); ConfigurationShared::SetColoredTristate( ui->use_asynchronous_gpu_emulation, "use_asynchronous_gpu_emulation", - Settings::values.use_asynchronous_gpu_emulation, - trackers.use_asynchronous_gpu_emulation); + Settings::values.use_asynchronous_gpu_emulation, trackers.use_asynchronous_gpu_emulation); ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, "ar_label", Settings::values.aspect_ratio.GetValue(true)); diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 8bebc30805..5862ad7d14 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -90,18 +90,16 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { ui->anisotropic_filtering_combobox); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, trackers.use_vsync); - ConfigurationShared::ApplyPerGameSetting( - &Settings::values.use_assembly_shaders, ui->use_assembly_shaders, - trackers.use_assembly_shaders); - ConfigurationShared::ApplyPerGameSetting( - &Settings::values.use_asynchronous_shaders, ui->use_asynchronous_shaders, - trackers.use_asynchronous_shaders); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders, + ui->use_assembly_shaders, + trackers.use_assembly_shaders); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, + ui->use_asynchronous_shaders, + trackers.use_asynchronous_shaders); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, - ui->use_fast_gpu_time, - trackers.use_fast_gpu_time); + ui->use_fast_gpu_time, trackers.use_fast_gpu_time); ConfigurationShared::ApplyPerGameSetting(&Settings::values.force_30fps_mode, - ui->force_30fps_mode, - trackers.force_30fps_mode); + ui->force_30fps_mode, trackers.force_30fps_mode); ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ui->anisotropic_filtering_combobox); diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index e1d8ccf976..f47e7ebabf 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -234,14 +234,12 @@ void ConfigureSystem::SetupPerGameUI() { ConfigurationShared::SetColoredComboBox(ui->combo_sound, ui->label_sound, "label_sound", Settings::values.sound_index.GetValue(true)); - ConfigurationShared::SetColoredTristate(ui->rng_seed_checkbox, "rng_seed_checkbox", - Settings::values.rng_seed.UsingGlobal(), - Settings::values.rng_seed.GetValue().has_value(), - Settings::values.rng_seed.GetValue(true).has_value(), - trackers.use_rng_seed); - ConfigurationShared::SetColoredTristate(ui->custom_rtc_checkbox, "custom_rtc_checkbox", - Settings::values.custom_rtc.UsingGlobal(), - Settings::values.custom_rtc.GetValue().has_value(), - Settings::values.custom_rtc.GetValue(true).has_value(), - trackers.use_custom_rtc); + ConfigurationShared::SetColoredTristate( + ui->rng_seed_checkbox, "rng_seed_checkbox", Settings::values.rng_seed.UsingGlobal(), + Settings::values.rng_seed.GetValue().has_value(), + Settings::values.rng_seed.GetValue(true).has_value(), trackers.use_rng_seed); + ConfigurationShared::SetColoredTristate( + ui->custom_rtc_checkbox, "custom_rtc_checkbox", Settings::values.custom_rtc.UsingGlobal(), + Settings::values.custom_rtc.GetValue().has_value(), + Settings::values.custom_rtc.GetValue(true).has_value(), trackers.use_custom_rtc); } From 335aef78c43ec5b488575b5eb790ae6e32ec7b63 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 15:40:02 -0400 Subject: [PATCH 21/25] configuration_shared: Make CheckState strongly typed Also gets rid of unnecessary explicit namespace usage. --- .../configuration/configuration_shared.cpp | 40 +++++++++---------- src/yuzu/configuration/configuration_shared.h | 7 ++-- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index e6141e6a9e..30b6f7b285 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -95,42 +95,42 @@ void ConfigurationShared::SetHighlight(QWidget* widget, const std::string& name, void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Settings::Setting& setting, - ConfigurationShared::CheckState& tracker) { + CheckState& tracker) { if (setting.UsingGlobal()) { tracker = CheckState::Global; } else { tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off; } SetHighlight(checkbox, name, tracker != CheckState::Global); - QObject::connect( - checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, setting, &tracker]() { - tracker = - static_cast((tracker + 1) % CheckState::Count); - if (tracker == CheckState::Global) { - checkbox->setChecked(setting.GetValue(true)); - } - SetHighlight(checkbox, name, tracker != CheckState::Global); - }); + QObject::connect(checkbox, &QCheckBox::clicked, checkbox, + [checkbox, name, setting, &tracker]() { + tracker = static_cast((static_cast(tracker) + 1) % + static_cast(CheckState::Count)); + if (tracker == CheckState::Global) { + checkbox->setChecked(setting.GetValue(true)); + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + }); } void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state, bool global_state, - ConfigurationShared::CheckState& tracker) { + CheckState& tracker) { if (global) { tracker = CheckState::Global; } else { tracker = (state == global_state) ? CheckState::On : CheckState::Off; } SetHighlight(checkbox, name, tracker != CheckState::Global); - QObject::connect( - checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, global_state, &tracker]() { - tracker = - static_cast((tracker + 1) % CheckState::Count); - if (tracker == CheckState::Global) { - checkbox->setChecked(global_state); - } - SetHighlight(checkbox, name, tracker != CheckState::Global); - }); + QObject::connect(checkbox, &QCheckBox::clicked, checkbox, + [checkbox, name, global_state, &tracker]() { + tracker = static_cast((static_cast(tracker) + 1) % + static_cast(CheckState::Count)); + if (tracker == CheckState::Global) { + checkbox->setChecked(global_state); + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + }); } void ConfigurationShared::SetColoredComboBox(QComboBox* combobox, QWidget* target, diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 4cea7406fe..e9d765b941 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -15,7 +15,7 @@ constexpr int USE_GLOBAL_INDEX = 0; constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; constexpr int USE_GLOBAL_OFFSET = 2; -enum CheckState { +enum class CheckState { Off, On, Global, @@ -42,10 +42,9 @@ void SetPerGameSetting(QComboBox* combobox, void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); void SetColoredTristate(QCheckBox* checkbox, const std::string& name, - const Settings::Setting& setting, - ConfigurationShared::CheckState& tracker); + const Settings::Setting& setting, CheckState& tracker); void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state, - bool global_state, ConfigurationShared::CheckState& tracker); + bool global_state, CheckState& tracker); void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, int global); From 3ef4769f31df20d4f4910faebf7ea89978e6a816 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 15:42:12 -0400 Subject: [PATCH 22/25] configuration: Use forward declares and remove extraneous structs --- src/yuzu/configuration/configure_audio.cpp | 4 ++-- src/yuzu/configuration/configure_audio.h | 9 ++++---- src/yuzu/configuration/configure_general.cpp | 19 ++++++--------- src/yuzu/configuration/configure_general.h | 11 +++++---- src/yuzu/configuration/configure_graphics.cpp | 9 ++++---- src/yuzu/configuration/configure_graphics.h | 11 +++++---- .../configure_graphics_advanced.cpp | 23 ++++++++----------- .../configure_graphics_advanced.h | 17 +++++++------- src/yuzu/configuration/configure_system.cpp | 8 +++---- src/yuzu/configuration/configure_system.h | 11 +++++---- 10 files changed, 59 insertions(+), 63 deletions(-) diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index 392f35085d..fea632531f 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -120,7 +120,7 @@ void ConfigureAudio::ApplyConfiguration() { } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, ui->toggle_audio_stretching, - trackers.enable_audio_stretching); + enable_audio_stretching); if (ui->volume_combo_box->currentIndex() == 0) { Settings::values.volume.SetGlobal(true); } else { @@ -175,7 +175,7 @@ void ConfigureAudio::SetupPerGameUI() { ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching, "toggle_audio_stretching", Settings::values.enable_audio_stretching, - trackers.enable_audio_stretching); + enable_audio_stretching); connect(ui->volume_combo_box, static_cast(&QComboBox::activated), this, [this](int index) { ui->volume_slider->setEnabled(index == 1); diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h index ac541d9619..9dbd3d93ee 100644 --- a/src/yuzu/configuration/configure_audio.h +++ b/src/yuzu/configuration/configure_audio.h @@ -6,7 +6,10 @@ #include #include -#include "yuzu/configuration/configuration_shared.h" + +namespace ConfigurationShared { +enum class CheckState; +} namespace Ui { class ConfigureAudio; @@ -39,7 +42,5 @@ private: std::unique_ptr ui; - struct Trackers { - ConfigurationShared::CheckState enable_audio_stretching; - } trackers; + ConfigurationShared::CheckState enable_audio_stretching; }; diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 3f7e1183ab..c0dbd9855d 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -45,8 +45,7 @@ void ConfigureGeneral::SetConfiguration() { ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue()); } else { ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue() && - trackers.use_frame_limit != - ConfigurationShared::CheckState::Global); + use_frame_limit != ConfigurationShared::CheckState::Global); } } @@ -68,10 +67,9 @@ void ConfigureGeneral::ApplyConfiguration() { } } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, - ui->use_multi_core, trackers.use_multi_core); + ui->use_multi_core, use_multi_core); - bool global_frame_limit = - trackers.use_frame_limit == ConfigurationShared::CheckState::Global; + bool global_frame_limit = use_frame_limit == ConfigurationShared::CheckState::Global; Settings::values.use_frame_limit.SetGlobal(global_frame_limit); Settings::values.frame_limit.SetGlobal(global_frame_limit); if (!global_frame_limit) { @@ -108,15 +106,12 @@ void ConfigureGeneral::SetupPerGameUI() { ui->toggle_hide_mouse->setVisible(false); ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, "toggle_frame_limit", - Settings::values.use_frame_limit, - trackers.use_frame_limit); + Settings::values.use_frame_limit, use_frame_limit); ConfigurationShared::SetColoredTristate(ui->use_multi_core, "use_multi_core", - Settings::values.use_multi_core, - trackers.use_multi_core); + Settings::values.use_multi_core, use_multi_core); connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { - ui->frame_limit->setEnabled( - ui->toggle_frame_limit->isChecked() && - (trackers.use_frame_limit != ConfigurationShared::CheckState::Global)); + ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked() && + (use_frame_limit != ConfigurationShared::CheckState::Global)); }); } diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index a1758a973a..323ffbd8f9 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h @@ -6,7 +6,10 @@ #include #include -#include "yuzu/configuration/configuration_shared.h" + +namespace ConfigurationShared { +enum class CheckState; +} class HotkeyRegistry; @@ -33,8 +36,6 @@ private: std::unique_ptr ui; - struct Trackers { - ConfigurationShared::CheckState use_frame_limit; - ConfigurationShared::CheckState use_multi_core; - } trackers; + ConfigurationShared::CheckState use_frame_limit; + ConfigurationShared::CheckState use_multi_core; }; diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 598701bf02..3e42531c31 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -142,11 +142,10 @@ void ConfigureGraphics::ApplyConfiguration() { ui->aspect_ratio_combobox); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, - ui->use_disk_shader_cache, - trackers.use_disk_shader_cache); + ui->use_disk_shader_cache, use_disk_shader_cache); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, ui->use_asynchronous_gpu_emulation, - trackers.use_asynchronous_gpu_emulation); + use_asynchronous_gpu_emulation); if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { Settings::values.bg_red.SetGlobal(true); @@ -257,10 +256,10 @@ void ConfigureGraphics::SetupPerGameUI() { ConfigurationShared::SetColoredTristate(ui->use_disk_shader_cache, "use_disk_shader_cache", Settings::values.use_disk_shader_cache, - trackers.use_disk_shader_cache); + use_disk_shader_cache); ConfigurationShared::SetColoredTristate( ui->use_asynchronous_gpu_emulation, "use_asynchronous_gpu_emulation", - Settings::values.use_asynchronous_gpu_emulation, trackers.use_asynchronous_gpu_emulation); + Settings::values.use_asynchronous_gpu_emulation, use_asynchronous_gpu_emulation); ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, "ar_label", Settings::values.aspect_ratio.GetValue(true)); diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 8164d6d75f..b4961f7192 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h @@ -9,7 +9,10 @@ #include #include #include "core/settings.h" -#include "yuzu/configuration/configuration_shared.h" + +namespace ConfigurationShared { +enum class CheckState; +} namespace Ui { class ConfigureGraphics; @@ -43,10 +46,8 @@ private: std::unique_ptr ui; QColor bg_color; - struct Trackers { - ConfigurationShared::CheckState use_disk_shader_cache; - ConfigurationShared::CheckState use_asynchronous_gpu_emulation; - } trackers; + ConfigurationShared::CheckState use_disk_shader_cache; + ConfigurationShared::CheckState use_asynchronous_gpu_emulation; std::vector vulkan_devices; u32 vulkan_device{}; diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 5862ad7d14..90c7c901be 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -89,17 +89,16 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ui->anisotropic_filtering_combobox); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, - trackers.use_vsync); + use_vsync); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders, - ui->use_assembly_shaders, - trackers.use_assembly_shaders); + ui->use_assembly_shaders, use_assembly_shaders); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, ui->use_asynchronous_shaders, - trackers.use_asynchronous_shaders); + use_asynchronous_shaders); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, - ui->use_fast_gpu_time, trackers.use_fast_gpu_time); + ui->use_fast_gpu_time, use_fast_gpu_time); ConfigurationShared::ApplyPerGameSetting(&Settings::values.force_30fps_mode, - ui->force_30fps_mode, trackers.force_30fps_mode); + ui->force_30fps_mode, force_30fps_mode); ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ui->anisotropic_filtering_combobox); @@ -141,19 +140,17 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { } ConfigurationShared::SetColoredTristate(ui->use_vsync, "use_vsync", Settings::values.use_vsync, - trackers.use_vsync); + use_vsync); ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_assembly_shaders", Settings::values.use_assembly_shaders, - trackers.use_assembly_shaders); + use_assembly_shaders); ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_asynchronous_shaders", Settings::values.use_asynchronous_shaders, - trackers.use_asynchronous_shaders); + use_asynchronous_shaders); ConfigurationShared::SetColoredTristate(ui->use_fast_gpu_time, "use_fast_gpu_time", - Settings::values.use_fast_gpu_time, - trackers.use_fast_gpu_time); + Settings::values.use_fast_gpu_time, use_fast_gpu_time); ConfigurationShared::SetColoredTristate(ui->force_30fps_mode, "force_30fps_mode", - Settings::values.force_30fps_mode, - trackers.force_30fps_mode); + Settings::values.force_30fps_mode, force_30fps_mode); ConfigurationShared::SetColoredComboBox( ui->gpu_accuracy, ui->label_gpu_accuracy, "label_gpu_accuracy", static_cast(Settings::values.gpu_accuracy.GetValue(true))); diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h index 86bfe822b2..3c4f6f7bbc 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.h +++ b/src/yuzu/configuration/configure_graphics_advanced.h @@ -6,7 +6,10 @@ #include #include -#include "yuzu/configuration/configuration_shared.h" + +namespace ConfigurationShared { +enum class CheckState; +} namespace Ui { class ConfigureGraphicsAdvanced; @@ -31,11 +34,9 @@ private: std::unique_ptr ui; - struct Trackers { - ConfigurationShared::CheckState use_vsync; - ConfigurationShared::CheckState use_assembly_shaders; - ConfigurationShared::CheckState use_asynchronous_shaders; - ConfigurationShared::CheckState use_fast_gpu_time; - ConfigurationShared::CheckState force_30fps_mode; - } trackers; + ConfigurationShared::CheckState use_vsync; + ConfigurationShared::CheckState use_assembly_shaders; + ConfigurationShared::CheckState use_asynchronous_shaders; + ConfigurationShared::CheckState use_fast_gpu_time; + ConfigurationShared::CheckState force_30fps_mode; }; diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index f47e7ebabf..0c4daf1477 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -148,7 +148,7 @@ void ConfigureSystem::ApplyConfiguration() { ui->combo_time_zone); ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound); - switch (trackers.use_rng_seed) { + switch (use_rng_seed) { case ConfigurationShared::CheckState::On: case ConfigurationShared::CheckState::Off: Settings::values.rng_seed.SetGlobal(false); @@ -168,7 +168,7 @@ void ConfigureSystem::ApplyConfiguration() { break; } - switch (trackers.use_custom_rtc) { + switch (use_custom_rtc) { case ConfigurationShared::CheckState::On: case ConfigurationShared::CheckState::Off: Settings::values.custom_rtc.SetGlobal(false); @@ -237,9 +237,9 @@ void ConfigureSystem::SetupPerGameUI() { ConfigurationShared::SetColoredTristate( ui->rng_seed_checkbox, "rng_seed_checkbox", Settings::values.rng_seed.UsingGlobal(), Settings::values.rng_seed.GetValue().has_value(), - Settings::values.rng_seed.GetValue(true).has_value(), trackers.use_rng_seed); + Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed); ConfigurationShared::SetColoredTristate( ui->custom_rtc_checkbox, "custom_rtc_checkbox", Settings::values.custom_rtc.UsingGlobal(), Settings::values.custom_rtc.GetValue().has_value(), - Settings::values.custom_rtc.GetValue(true).has_value(), trackers.use_custom_rtc); + Settings::values.custom_rtc.GetValue(true).has_value(), use_custom_rtc); } diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index 64c4925597..fc5cd29457 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h @@ -8,7 +8,10 @@ #include #include -#include "yuzu/configuration/configuration_shared.h" + +namespace ConfigurationShared { +enum class CheckState; +} namespace Ui { class ConfigureSystem; @@ -43,8 +46,6 @@ private: int time_zone_index = 0; int sound_index = 0; - struct Trackers { - ConfigurationShared::CheckState use_rng_seed; - ConfigurationShared::CheckState use_custom_rtc; - } trackers; + ConfigurationShared::CheckState use_rng_seed; + ConfigurationShared::CheckState use_custom_rtc; }; From 520b4c7829196cef45995764509fb5b1afe2eac7 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 15:42:45 -0400 Subject: [PATCH 23/25] configuration_shared: Remove unused functions These were only kept for compatibility with old code during testing. --- src/yuzu/configuration/configuration_shared.cpp | 16 ---------------- src/yuzu/configuration/configuration_shared.h | 2 -- 2 files changed, 18 deletions(-) diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 30b6f7b285..f9becab6e9 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -10,16 +10,6 @@ #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_per_game.h" -void ConfigurationShared::ApplyPerGameSetting(Settings::Setting* setting, - const QCheckBox* checkbox) { - if (checkbox->checkState() == Qt::PartiallyChecked) { - setting->SetGlobal(true); - } else { - setting->SetGlobal(false); - setting->SetValue(checkbox->checkState() == Qt::Checked); - } -} - void ConfigurationShared::ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox, const CheckState& tracker) { @@ -142,12 +132,6 @@ void ConfigurationShared::SetColoredComboBox(QComboBox* combobox, QWidget* targe }); } -void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { - const QString use_global_text = ConfigurePerGame::tr("Use global configuration"); - combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); - combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); -} - void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, int global_index) { const QString use_global_text = ConfigurePerGame::tr("Use global configuration (%1)").arg(combobox->itemText(global_index)); diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index e9d765b941..003148c68d 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -26,7 +26,6 @@ enum class CheckState { void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox, const CheckState& tracker); -void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox); void ApplyPerGameSetting(Settings::Setting* setting, const QComboBox* combobox); void ApplyPerGameSetting(Settings::Setting* setting, const QComboBox* combobox); @@ -48,7 +47,6 @@ void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool globa void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, int global); -void InsertGlobalItem(QComboBox* combobox); void InsertGlobalItem(QComboBox* combobox, int global_index); } // namespace ConfigurationShared From 23347b886974fc7d8bad2d0569eda4ecd2cbaafc Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sat, 18 Jul 2020 13:40:11 -0400 Subject: [PATCH 24/25] configure_graphics_advanced: Fix oversight from rebase --- src/yuzu/configuration/configure_graphics_advanced.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 90c7c901be..98e8eaedb7 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -144,7 +144,7 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_assembly_shaders", Settings::values.use_assembly_shaders, use_assembly_shaders); - ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_asynchronous_shaders", + ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders, "use_asynchronous_shaders", Settings::values.use_asynchronous_shaders, use_asynchronous_shaders); ConfigurationShared::SetColoredTristate(ui->use_fast_gpu_time, "use_fast_gpu_time", From 2120740ee62afbf3bc657d9ac7b9d07da0816a87 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sat, 18 Jul 2020 13:43:07 -0400 Subject: [PATCH 25/25] configure_graphics_advnaced: clang-format mk ii --- src/yuzu/configuration/configure_graphics_advanced.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 98e8eaedb7..8b9180811d 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -144,9 +144,9 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_assembly_shaders", Settings::values.use_assembly_shaders, use_assembly_shaders); - ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders, "use_asynchronous_shaders", - Settings::values.use_asynchronous_shaders, - use_asynchronous_shaders); + ConfigurationShared::SetColoredTristate( + ui->use_asynchronous_shaders, "use_asynchronous_shaders", + Settings::values.use_asynchronous_shaders, use_asynchronous_shaders); ConfigurationShared::SetColoredTristate(ui->use_fast_gpu_time, "use_fast_gpu_time", Settings::values.use_fast_gpu_time, use_fast_gpu_time); ConfigurationShared::SetColoredTristate(ui->force_30fps_mode, "force_30fps_mode",