From 3ef4769f31df20d4f4910faebf7ea89978e6a816 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 15:42:12 -0400 Subject: 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 ++++++----- .../configuration/configure_graphics_advanced.cpp | 23 ++++++++++------------ .../configuration/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 392f35085..fea632531 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 ac541d961..9dbd3d93e 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 3f7e1183a..c0dbd9855 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 a1758a973..323ffbd8f 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 598701bf0..3e42531c3 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 8164d6d75..b4961f719 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 5862ad7d1..90c7c901b 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 86bfe822b..3c4f6f7bb 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 f47e7ebab..0c4daf147 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 64c492559..fc5cd2945 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; }; -- cgit v1.2.3