1
0
Fork 0
forked from suyu/suyu

configuration: Use forward declares and remove extraneous structs

This commit is contained in:
lat9nq 2020-07-14 15:42:12 -04:00
parent 335aef78c4
commit 3ef4769f31
10 changed files with 59 additions and 63 deletions

View file

@ -120,7 +120,7 @@ void ConfigureAudio::ApplyConfiguration() {
} else { } else {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching,
ui->toggle_audio_stretching, ui->toggle_audio_stretching,
trackers.enable_audio_stretching); enable_audio_stretching);
if (ui->volume_combo_box->currentIndex() == 0) { if (ui->volume_combo_box->currentIndex() == 0) {
Settings::values.volume.SetGlobal(true); Settings::values.volume.SetGlobal(true);
} else { } else {
@ -175,7 +175,7 @@ void ConfigureAudio::SetupPerGameUI() {
ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching, "toggle_audio_stretching", ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching, "toggle_audio_stretching",
Settings::values.enable_audio_stretching, Settings::values.enable_audio_stretching,
trackers.enable_audio_stretching); enable_audio_stretching);
connect(ui->volume_combo_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), connect(ui->volume_combo_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, [this](int index) { this, [this](int index) {
ui->volume_slider->setEnabled(index == 1); ui->volume_slider->setEnabled(index == 1);

View file

@ -6,7 +6,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
#include "yuzu/configuration/configuration_shared.h"
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui { namespace Ui {
class ConfigureAudio; class ConfigureAudio;
@ -39,7 +42,5 @@ private:
std::unique_ptr<Ui::ConfigureAudio> ui; std::unique_ptr<Ui::ConfigureAudio> ui;
struct Trackers {
ConfigurationShared::CheckState enable_audio_stretching; ConfigurationShared::CheckState enable_audio_stretching;
} trackers;
}; };

View file

@ -45,8 +45,7 @@ void ConfigureGeneral::SetConfiguration() {
ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue()); ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue());
} else { } else {
ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue() && ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue() &&
trackers.use_frame_limit != use_frame_limit != ConfigurationShared::CheckState::Global);
ConfigurationShared::CheckState::Global);
} }
} }
@ -68,10 +67,9 @@ void ConfigureGeneral::ApplyConfiguration() {
} }
} else { } else {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, 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 = bool global_frame_limit = use_frame_limit == ConfigurationShared::CheckState::Global;
trackers.use_frame_limit == ConfigurationShared::CheckState::Global;
Settings::values.use_frame_limit.SetGlobal(global_frame_limit); Settings::values.use_frame_limit.SetGlobal(global_frame_limit);
Settings::values.frame_limit.SetGlobal(global_frame_limit); Settings::values.frame_limit.SetGlobal(global_frame_limit);
if (!global_frame_limit) { if (!global_frame_limit) {
@ -108,15 +106,12 @@ void ConfigureGeneral::SetupPerGameUI() {
ui->toggle_hide_mouse->setVisible(false); ui->toggle_hide_mouse->setVisible(false);
ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, "toggle_frame_limit", ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, "toggle_frame_limit",
Settings::values.use_frame_limit, Settings::values.use_frame_limit, use_frame_limit);
trackers.use_frame_limit);
ConfigurationShared::SetColoredTristate(ui->use_multi_core, "use_multi_core", ConfigurationShared::SetColoredTristate(ui->use_multi_core, "use_multi_core",
Settings::values.use_multi_core, Settings::values.use_multi_core, use_multi_core);
trackers.use_multi_core);
connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() {
ui->frame_limit->setEnabled( ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked() &&
ui->toggle_frame_limit->isChecked() && (use_frame_limit != ConfigurationShared::CheckState::Global));
(trackers.use_frame_limit != ConfigurationShared::CheckState::Global));
}); });
} }

View file

@ -6,7 +6,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
#include "yuzu/configuration/configuration_shared.h"
namespace ConfigurationShared {
enum class CheckState;
}
class HotkeyRegistry; class HotkeyRegistry;
@ -33,8 +36,6 @@ private:
std::unique_ptr<Ui::ConfigureGeneral> ui; std::unique_ptr<Ui::ConfigureGeneral> ui;
struct Trackers {
ConfigurationShared::CheckState use_frame_limit; ConfigurationShared::CheckState use_frame_limit;
ConfigurationShared::CheckState use_multi_core; ConfigurationShared::CheckState use_multi_core;
} trackers;
}; };

View file

@ -142,11 +142,10 @@ void ConfigureGraphics::ApplyConfiguration() {
ui->aspect_ratio_combobox); ui->aspect_ratio_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache,
ui->use_disk_shader_cache, ui->use_disk_shader_cache, use_disk_shader_cache);
trackers.use_disk_shader_cache);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation,
ui->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) { if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
Settings::values.bg_red.SetGlobal(true); Settings::values.bg_red.SetGlobal(true);
@ -257,10 +256,10 @@ void ConfigureGraphics::SetupPerGameUI() {
ConfigurationShared::SetColoredTristate(ui->use_disk_shader_cache, "use_disk_shader_cache", ConfigurationShared::SetColoredTristate(ui->use_disk_shader_cache, "use_disk_shader_cache",
Settings::values.use_disk_shader_cache, Settings::values.use_disk_shader_cache,
trackers.use_disk_shader_cache); use_disk_shader_cache);
ConfigurationShared::SetColoredTristate( ConfigurationShared::SetColoredTristate(
ui->use_asynchronous_gpu_emulation, "use_asynchronous_gpu_emulation", 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", ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, "ar_label",
Settings::values.aspect_ratio.GetValue(true)); Settings::values.aspect_ratio.GetValue(true));

View file

@ -9,7 +9,10 @@
#include <QString> #include <QString>
#include <QWidget> #include <QWidget>
#include "core/settings.h" #include "core/settings.h"
#include "yuzu/configuration/configuration_shared.h"
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui { namespace Ui {
class ConfigureGraphics; class ConfigureGraphics;
@ -43,10 +46,8 @@ private:
std::unique_ptr<Ui::ConfigureGraphics> ui; std::unique_ptr<Ui::ConfigureGraphics> ui;
QColor bg_color; QColor bg_color;
struct Trackers {
ConfigurationShared::CheckState use_disk_shader_cache; ConfigurationShared::CheckState use_disk_shader_cache;
ConfigurationShared::CheckState use_asynchronous_gpu_emulation; ConfigurationShared::CheckState use_asynchronous_gpu_emulation;
} trackers;
std::vector<QString> vulkan_devices; std::vector<QString> vulkan_devices;
u32 vulkan_device{}; u32 vulkan_device{};

View file

@ -89,17 +89,16 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
ui->anisotropic_filtering_combobox); ui->anisotropic_filtering_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync,
trackers.use_vsync); use_vsync);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders,
ui->use_assembly_shaders, ui->use_assembly_shaders, use_assembly_shaders);
trackers.use_assembly_shaders);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders,
ui->use_asynchronous_shaders, ui->use_asynchronous_shaders,
trackers.use_asynchronous_shaders); use_asynchronous_shaders);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, 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, 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, ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
ui->anisotropic_filtering_combobox); ui->anisotropic_filtering_combobox);
@ -141,19 +140,17 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
} }
ConfigurationShared::SetColoredTristate(ui->use_vsync, "use_vsync", Settings::values.use_vsync, 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", ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_assembly_shaders",
Settings::values.use_assembly_shaders, Settings::values.use_assembly_shaders,
trackers.use_assembly_shaders); use_assembly_shaders);
ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_asynchronous_shaders", ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_asynchronous_shaders",
Settings::values.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", ConfigurationShared::SetColoredTristate(ui->use_fast_gpu_time, "use_fast_gpu_time",
Settings::values.use_fast_gpu_time, Settings::values.use_fast_gpu_time, use_fast_gpu_time);
trackers.use_fast_gpu_time);
ConfigurationShared::SetColoredTristate(ui->force_30fps_mode, "force_30fps_mode", ConfigurationShared::SetColoredTristate(ui->force_30fps_mode, "force_30fps_mode",
Settings::values.force_30fps_mode, Settings::values.force_30fps_mode, force_30fps_mode);
trackers.force_30fps_mode);
ConfigurationShared::SetColoredComboBox( ConfigurationShared::SetColoredComboBox(
ui->gpu_accuracy, ui->label_gpu_accuracy, "label_gpu_accuracy", ui->gpu_accuracy, ui->label_gpu_accuracy, "label_gpu_accuracy",
static_cast<int>(Settings::values.gpu_accuracy.GetValue(true))); static_cast<int>(Settings::values.gpu_accuracy.GetValue(true)));

View file

@ -6,7 +6,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
#include "yuzu/configuration/configuration_shared.h"
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui { namespace Ui {
class ConfigureGraphicsAdvanced; class ConfigureGraphicsAdvanced;
@ -31,11 +34,9 @@ private:
std::unique_ptr<Ui::ConfigureGraphicsAdvanced> ui; std::unique_ptr<Ui::ConfigureGraphicsAdvanced> ui;
struct Trackers {
ConfigurationShared::CheckState use_vsync; ConfigurationShared::CheckState use_vsync;
ConfigurationShared::CheckState use_assembly_shaders; ConfigurationShared::CheckState use_assembly_shaders;
ConfigurationShared::CheckState use_asynchronous_shaders; ConfigurationShared::CheckState use_asynchronous_shaders;
ConfigurationShared::CheckState use_fast_gpu_time; ConfigurationShared::CheckState use_fast_gpu_time;
ConfigurationShared::CheckState force_30fps_mode; ConfigurationShared::CheckState force_30fps_mode;
} trackers;
}; };

View file

@ -148,7 +148,7 @@ void ConfigureSystem::ApplyConfiguration() {
ui->combo_time_zone); ui->combo_time_zone);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound); 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::On:
case ConfigurationShared::CheckState::Off: case ConfigurationShared::CheckState::Off:
Settings::values.rng_seed.SetGlobal(false); Settings::values.rng_seed.SetGlobal(false);
@ -168,7 +168,7 @@ void ConfigureSystem::ApplyConfiguration() {
break; break;
} }
switch (trackers.use_custom_rtc) { switch (use_custom_rtc) {
case ConfigurationShared::CheckState::On: case ConfigurationShared::CheckState::On:
case ConfigurationShared::CheckState::Off: case ConfigurationShared::CheckState::Off:
Settings::values.custom_rtc.SetGlobal(false); Settings::values.custom_rtc.SetGlobal(false);
@ -237,9 +237,9 @@ void ConfigureSystem::SetupPerGameUI() {
ConfigurationShared::SetColoredTristate( ConfigurationShared::SetColoredTristate(
ui->rng_seed_checkbox, "rng_seed_checkbox", Settings::values.rng_seed.UsingGlobal(), ui->rng_seed_checkbox, "rng_seed_checkbox", Settings::values.rng_seed.UsingGlobal(),
Settings::values.rng_seed.GetValue().has_value(), 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( ConfigurationShared::SetColoredTristate(
ui->custom_rtc_checkbox, "custom_rtc_checkbox", Settings::values.custom_rtc.UsingGlobal(), ui->custom_rtc_checkbox, "custom_rtc_checkbox", Settings::values.custom_rtc.UsingGlobal(),
Settings::values.custom_rtc.GetValue().has_value(), 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);
} }

View file

@ -8,7 +8,10 @@
#include <QList> #include <QList>
#include <QWidget> #include <QWidget>
#include "yuzu/configuration/configuration_shared.h"
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui { namespace Ui {
class ConfigureSystem; class ConfigureSystem;
@ -43,8 +46,6 @@ private:
int time_zone_index = 0; int time_zone_index = 0;
int sound_index = 0; int sound_index = 0;
struct Trackers {
ConfigurationShared::CheckState use_rng_seed; ConfigurationShared::CheckState use_rng_seed;
ConfigurationShared::CheckState use_custom_rtc; ConfigurationShared::CheckState use_custom_rtc;
} trackers;
}; };