2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

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 {
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<void (QComboBox::*)(int)>(&QComboBox::activated),
this, [this](int index) {
ui->volume_slider->setEnabled(index == 1);

View file

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

View file

@ -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));
});
}

View file

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

View file

@ -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));

View file

@ -9,7 +9,10 @@
#include <QString>
#include <QWidget>
#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::ConfigureGraphics> 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<QString> vulkan_devices;
u32 vulkan_device{};

View file

@ -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<int>(Settings::values.gpu_accuracy.GetValue(true)));

View file

@ -6,7 +6,10 @@
#include <memory>
#include <QWidget>
#include "yuzu/configuration/configuration_shared.h"
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui {
class ConfigureGraphicsAdvanced;
@ -31,11 +34,9 @@ private:
std::unique_ptr<Ui::ConfigureGraphicsAdvanced> 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;
};

View file

@ -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);
}

View file

@ -8,7 +8,10 @@
#include <QList>
#include <QWidget>
#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;
};