From f8435d676f0073dee4d2ea87c84767a53911fbe6 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sun, 7 May 2023 12:03:40 -0400 Subject: configure_graphics: Partial runtime implementation --- src/common/settings.h | 2 +- src/yuzu/configuration/configuration_shared.cpp | 72 +- src/yuzu/configuration/configuration_shared.h | 18 +- src/yuzu/configuration/configure_dialog.cpp | 2 +- src/yuzu/configuration/configure_graphics.cpp | 785 +++++++++++---------- src/yuzu/configuration/configure_graphics.h | 16 +- src/yuzu/configuration/configure_graphics.ui | 751 +------------------- .../configuration/configure_graphics_advanced.cpp | 4 +- src/yuzu/configuration/configure_per_game.cpp | 2 +- src/yuzu/configuration/shared_translation.cpp | 9 +- 10 files changed, 513 insertions(+), 1148 deletions(-) diff --git a/src/common/settings.h b/src/common/settings.h index 70ab8d584..8f02fa9af 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -733,7 +733,7 @@ struct Values { linkage, ShaderBackend::GLSL, ShaderBackend::GLSL, ShaderBackend::SPIRV, "shader_backend", Category::Renderer}; SwitchableSetting use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders", - Category::Renderer}; + Category::RendererAdvanced}; SwitchableSetting use_fast_gpu_time{linkage, true, "use_fast_gpu_time", Category::RendererAdvanced}; SwitchableSetting use_vulkan_driver_pipeline_cache{ diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index dc11a318a..575d239eb 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -55,9 +56,8 @@ static std::pair> CreateCheckBox(Settings::Basic return {checkbox, load_func}; } -static std::pair> CreateCombobox(Settings::BasicSetting* setting, - const QString& label, - QWidget* parent) { +static std::tuple> CreateCombobox( + Settings::BasicSetting* setting, const QString& label, QWidget* parent) { const auto type = setting->TypeId(); QWidget* group = new QWidget(parent); @@ -110,15 +110,34 @@ static std::pair> CreateCombobox(Settings::Basic } }; - return {group, load_func}; + return {group, combobox, load_func}; +} + +static std::tuple> CreateLineEdit( + Settings::BasicSetting* setting, const QString& label, QWidget* parent) { + QWidget* widget = new QWidget(parent); + QHBoxLayout* layout = new QHBoxLayout(widget); + + QLabel* q_label = new QLabel(label, widget); + QLineEdit* line_edit = new QLineEdit(widget); + + layout->addWidget(q_label); + layout->addStretch(); + layout->addWidget(line_edit); + + layout->setContentsMargins(0, 0, 0, 0); + + return {widget, line_edit, []() {}}; } -QWidget* CreateWidget(Settings::BasicSetting* setting, const TranslationMap& translations, - QWidget* parent, bool runtime_lock, - std::forward_list>& apply_funcs, - std::list& trackers) { +std::pair CreateWidget(Settings::BasicSetting* setting, + const TranslationMap& translations, QWidget* parent, + bool runtime_lock, + std::forward_list>& apply_funcs, + std::list& trackers, RequestType request) { const auto type = setting->TypeId(); QWidget* widget{nullptr}; + void* extra{nullptr}; std::function load_func; @@ -135,7 +154,7 @@ QWidget* CreateWidget(Settings::BasicSetting* setting, const TranslationMap& tra if (label == QStringLiteral("")) { LOG_DEBUG(Frontend, "Translation table has emtpy entry for \"{}\", skipping...", setting->GetLabel()); - return widget; + return {nullptr, nullptr}; } if (type == typeid(bool)) { @@ -143,14 +162,36 @@ QWidget* CreateWidget(Settings::BasicSetting* setting, const TranslationMap& tra widget = pair.first; load_func = pair.second; } else if (setting->IsEnum()) { - auto pair = CreateCombobox(setting, label, parent); - widget = pair.first; - load_func = pair.second; + auto tuple = CreateCombobox(setting, label, parent); + widget = std::get<0>(tuple); + extra = std::get<1>(tuple); + load_func = std::get<2>(tuple); + } else if (type == typeid(u32) || type == typeid(int)) { + switch (request) { + case RequestType::Default: { + auto tuple = CreateLineEdit(setting, label, parent); + widget = std::get<0>(tuple); + extra = std::get<1>(tuple); + load_func = std::get<2>(tuple); + break; + } + case RequestType::ComboBox: { + auto tuple = CreateCombobox(setting, label, parent); + widget = std::get<0>(tuple); + extra = std::get<1>(tuple); + load_func = std::get<2>(tuple); + break; + } + case RequestType::SpinBox: + case RequestType::Slider: + case RequestType::MaxEnum: + break; + } } if (widget == nullptr) { LOG_ERROR(Frontend, "No widget was created for \"{}\"", setting->GetLabel()); - return widget; + return {nullptr, nullptr}; } apply_funcs.push_front([load_func, setting](bool powered_on) { @@ -162,13 +203,14 @@ QWidget* CreateWidget(Settings::BasicSetting* setting, const TranslationMap& tra bool enable = runtime_lock || setting->RuntimeModfiable(); enable &= setting->Switchable() && !(Settings::IsConfiguringGlobal() && !setting->UsingGlobal()); - + enable |= !setting->Switchable() && Settings::IsConfiguringGlobal() && runtime_lock; widget->setEnabled(enable); + widget->setVisible(Settings::IsConfiguringGlobal() || setting->Switchable()); widget->setToolTip(tooltip); - return widget; + return {widget, extra}; } Tab::Tab(std::shared_ptr> group_, QWidget* parent) diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 7040673ea..d0fe6ea38 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -41,10 +41,20 @@ enum class CheckState { Count, // Simply the number of states, not a valid checkbox state }; -QWidget* CreateWidget(Settings::BasicSetting* setting, const TranslationMap& translations, - QWidget* parent, bool runtime_lock, - std::forward_list>& apply_funcs, - std::list& trackers); +enum class RequestType { + Default, + ComboBox, + SpinBox, + Slider, + MaxEnum, +}; + +std::pair CreateWidget(Settings::BasicSetting* setting, + const TranslationMap& translations, QWidget* parent, + bool runtime_lock, + std::forward_list>& apply_funcs, + std::list& trackers, + RequestType request = RequestType::Default); // Global-aware apply and set functions diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index b3f4764c7..5b356a074 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -43,7 +43,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, std::make_unique(system_, nullptr, *translations, this)}, graphics_tab{std::make_unique( system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, - nullptr, this)}, + nullptr, *translations, this)}, hotkeys_tab{std::make_unique(system_.HIDCore(), this)}, input_tab{std::make_unique(system_, this)}, network_tab{std::make_unique(system_, this)}, diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index a8c5b1d9f..8128a4047 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -55,100 +55,123 @@ static constexpr VkPresentModeKHR VSyncSettingToMode(Settings::VSyncMode mode) { } } -static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode) { - switch (mode) { - case VK_PRESENT_MODE_IMMEDIATE_KHR: - return Settings::VSyncMode::Immediate; - case VK_PRESENT_MODE_MAILBOX_KHR: - return Settings::VSyncMode::Mailbox; - case VK_PRESENT_MODE_FIFO_KHR: - return Settings::VSyncMode::FIFO; - case VK_PRESENT_MODE_FIFO_RELAXED_KHR: - return Settings::VSyncMode::FIFORelaxed; - default: - return Settings::VSyncMode::FIFO; - } -} +// static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode) { +// switch (mode) { +// case VK_PRESENT_MODE_IMMEDIATE_KHR: +// return Settings::VSyncMode::Immediate; +// case VK_PRESENT_MODE_MAILBOX_KHR: +// return Settings::VSyncMode::Mailbox; +// case VK_PRESENT_MODE_FIFO_KHR: +// return Settings::VSyncMode::FIFO; +// case VK_PRESENT_MODE_FIFO_RELAXED_KHR: +// return Settings::VSyncMode::FIFORelaxed; +// default: +// return Settings::VSyncMode::FIFO; +// } +// } ConfigureGraphics::ConfigureGraphics( const Core::System& system_, std::vector& records_, const std::function& expose_compute_option_, - std::shared_ptr> group, QWidget* parent) + std::shared_ptr> group, + const ConfigurationShared::TranslationMap& translations_, QWidget* parent) : ConfigurationShared::Tab(group, parent), ui{std::make_unique()}, - records{records_}, expose_compute_option{expose_compute_option_}, system{system_} { + records{records_}, expose_compute_option{expose_compute_option_}, system{system_}, + translations{translations_} { vulkan_device = Settings::values.vulkan_device.GetValue(); RetrieveVulkanDevices(); ui->setupUi(this); + SetConfiguration(); + for (const auto& device : vulkan_devices) { - ui->device->addItem(device); + vulkan_device_combobox->addItem(device); } - ui->backend->addItem(QStringLiteral("GLSL")); - ui->backend->addItem(tr("GLASM (Assembly Shaders, NVIDIA Only)")); - ui->backend->addItem(tr("SPIR-V (Experimental, Mesa Only)")); + UpdateBackgroundColorButton(QColor::fromRgb(Settings::values.bg_red.GetValue(), + Settings::values.bg_green.GetValue(), + Settings::values.bg_blue.GetValue())); + UpdateAPILayout(); + PopulateVSyncModeSelection(); //< must happen after UpdateAPILayout + // SetFSRIndicatorText(ui->fsr_sharpening_slider->sliderPosition()); - SetupPerGameUI(); + // VSync setting needs to be determined after populating the VSync combobox + if (Settings::IsConfiguringGlobal()) { + const auto vsync_mode_setting = Settings::values.vsync_mode.GetValue(); + const auto vsync_mode = VSyncSettingToMode(vsync_mode_setting); + int index{}; + for (const auto mode : vsync_mode_combobox_enum_map) { + if (mode == vsync_mode) { + break; + } + index++; + } + if (static_cast(index) < vsync_mode_combobox_enum_map.size()) { + vsync_mode_combobox->setCurrentIndex(index); + } + } - SetConfiguration(); + SetupPerGameUI(); - connect(ui->api, qOverload(&QComboBox::currentIndexChanged), this, [this] { + connect(api_combobox, qOverload(&QComboBox::currentIndexChanged), this, [this] { UpdateAPILayout(); PopulateVSyncModeSelection(); if (!Settings::IsConfiguringGlobal()) { - ConfigurationShared::SetHighlight( - ui->api_widget, ui->api->currentIndex() != ConfigurationShared::USE_GLOBAL_INDEX); + ConfigurationShared::SetHighlight(ui->api_widget, + api_combobox->currentIndex() != + ConfigurationShared::USE_GLOBAL_INDEX); } }); - connect(ui->device, qOverload(&QComboBox::activated), this, [this](int device) { - UpdateDeviceSelection(device); - PopulateVSyncModeSelection(); - }); - connect(ui->backend, qOverload(&QComboBox::activated), this, + connect(vulkan_device_combobox, qOverload(&QComboBox::activated), this, + [this](int device) { + UpdateDeviceSelection(device); + PopulateVSyncModeSelection(); + }); + connect(shader_backend_combobox, qOverload(&QComboBox::activated), this, [this](int backend) { UpdateShaderBackendSelection(backend); }); - connect(ui->bg_button, &QPushButton::clicked, this, [this] { - const QColor new_bg_color = QColorDialog::getColor(bg_color); - if (!new_bg_color.isValid()) { - return; - } - UpdateBackgroundColorButton(new_bg_color); - }); + // connect(ui->bg_button, &QPushButton::clicked, this, [this] { + // const QColor new_bg_color = QColorDialog::getColor(bg_color); + // if (!new_bg_color.isValid()) { + // return; + // } + // UpdateBackgroundColorButton(new_bg_color); + // }); - ui->api->setEnabled(!UISettings::values.has_broken_vulkan && ui->api->isEnabled()); + api_combobox->setEnabled(!UISettings::values.has_broken_vulkan && api_combobox->isEnabled()); ui->api_widget->setEnabled( (!UISettings::values.has_broken_vulkan || Settings::IsConfiguringGlobal()) && ui->api_widget->isEnabled()); - ui->bg_label->setVisible(Settings::IsConfiguringGlobal()); - ui->bg_combobox->setVisible(!Settings::IsConfiguringGlobal()); + // ui->bg_label->setVisible(Settings::IsConfiguringGlobal()); + // ui->bg_combobox->setVisible(!Settings::IsConfiguringGlobal()); - connect(ui->fsr_sharpening_slider, &QSlider::valueChanged, this, - &ConfigureGraphics::SetFSRIndicatorText); - ui->fsr_sharpening_combobox->setVisible(!Settings::IsConfiguringGlobal()); - ui->fsr_sharpening_label->setVisible(Settings::IsConfiguringGlobal()); + // connect(ui->fsr_sharpening_slider, &QSlider::valueChanged, this, + // &ConfigureGraphics::SetFSRIndicatorText); + // ui->fsr_sharpening_combobox->setVisible(!Settings::IsConfiguringGlobal()); + // ui->fsr_sharpening_label->setVisible(Settings::IsConfiguringGlobal()); } void ConfigureGraphics::PopulateVSyncModeSelection() { const Settings::RendererBackend backend{GetCurrentGraphicsBackend()}; if (backend == Settings::RendererBackend::Null) { - ui->vsync_mode_combobox->setEnabled(false); + vsync_mode_combobox->setEnabled(false); return; } - ui->vsync_mode_combobox->setEnabled(true); + vsync_mode_combobox->setEnabled(true); const int current_index = //< current selected vsync mode from combobox - ui->vsync_mode_combobox->currentIndex(); + vsync_mode_combobox->currentIndex(); const auto current_mode = //< current selected vsync mode as a VkPresentModeKHR current_index == -1 ? VSyncSettingToMode(Settings::values.vsync_mode.GetValue()) : vsync_mode_combobox_enum_map[current_index]; int index{}; - const int device{ui->device->currentIndex()}; //< current selected Vulkan device + const int device{vulkan_device_combobox->currentIndex()}; //< current selected Vulkan device const auto& present_modes = //< relevant vector of present modes for the selected device or API backend == Settings::RendererBackend::Vulkan ? device_present_modes[device] : default_present_modes; - ui->vsync_mode_combobox->clear(); + vsync_mode_combobox->clear(); vsync_mode_combobox_enum_map.clear(); vsync_mode_combobox_enum_map.reserve(present_modes.size()); for (const auto present_mode : present_modes) { @@ -157,10 +180,10 @@ void ConfigureGraphics::PopulateVSyncModeSelection() { continue; } - ui->vsync_mode_combobox->insertItem(index, mode_name); + vsync_mode_combobox->insertItem(index, mode_name); vsync_mode_combobox_enum_map.push_back(present_mode); if (present_mode == current_mode) { - ui->vsync_mode_combobox->setCurrentIndex(index); + vsync_mode_combobox->setCurrentIndex(index); } index++; } @@ -188,114 +211,137 @@ ConfigureGraphics::~ConfigureGraphics() = default; void ConfigureGraphics::SetConfiguration() { const bool runtime_lock = !system.IsPoweredOn(); + QLayout& api_layout = *ui->api_widget->layout(); + QLayout& graphics_layout = *ui->graphics_widget->layout(); - ui->api_widget->setEnabled(runtime_lock); - ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); - ui->use_disk_shader_cache->setEnabled(runtime_lock); - ui->nvdec_emulation_widget->setEnabled(runtime_lock); - ui->resolution_combobox->setEnabled(runtime_lock); - ui->astc_decode_mode_combobox->setEnabled(runtime_lock); - ui->vsync_mode_layout->setEnabled(runtime_lock || - Settings::values.renderer_backend.GetValue() == - Settings::RendererBackend::Vulkan); - 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()); + std::map hold_graphics; - if (Settings::IsConfiguringGlobal()) { - ui->api->setCurrentIndex(static_cast(Settings::values.renderer_backend.GetValue())); - ui->fullscreen_mode_combobox->setCurrentIndex( - static_cast(Settings::values.fullscreen_mode.GetValue())); - ui->nvdec_emulation->setCurrentIndex( - static_cast(Settings::values.nvdec_emulation.GetValue())); - ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); - ui->resolution_combobox->setCurrentIndex( - static_cast(Settings::values.resolution_setup.GetValue())); - ui->scaling_filter_combobox->setCurrentIndex( - static_cast(Settings::values.scaling_filter.GetValue())); - ui->fsr_sharpening_slider->setValue(Settings::values.fsr_sharpening_slider.GetValue()); - ui->anti_aliasing_combobox->setCurrentIndex( - static_cast(Settings::values.anti_aliasing.GetValue())); - } else { - ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); - ConfigurationShared::SetHighlight(ui->api_widget, - !Settings::values.renderer_backend.UsingGlobal()); - - ConfigurationShared::SetPerGameSetting(ui->astc_decode_mode_combobox, - &Settings::values.accelerate_astc); - ConfigurationShared::SetHighlight(ui->astc_decode_mode_layout, - !Settings::values.accelerate_astc.UsingGlobal()); - - ConfigurationShared::SetPerGameSetting(ui->nvdec_emulation, - &Settings::values.nvdec_emulation); - ConfigurationShared::SetHighlight(ui->nvdec_emulation_widget, - !Settings::values.nvdec_emulation.UsingGlobal()); - - ConfigurationShared::SetPerGameSetting(ui->fullscreen_mode_combobox, - &Settings::values.fullscreen_mode); - ConfigurationShared::SetHighlight(ui->fullscreen_mode_label, - !Settings::values.fullscreen_mode.UsingGlobal()); - - ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox, - &Settings::values.aspect_ratio); - ConfigurationShared::SetHighlight(ui->ar_label, - !Settings::values.aspect_ratio.UsingGlobal()); - - ConfigurationShared::SetPerGameSetting(ui->resolution_combobox, - &Settings::values.resolution_setup); - ConfigurationShared::SetHighlight(ui->resolution_label, - !Settings::values.resolution_setup.UsingGlobal()); - - ConfigurationShared::SetPerGameSetting(ui->scaling_filter_combobox, - &Settings::values.scaling_filter); - ConfigurationShared::SetHighlight(ui->scaling_filter_label, - !Settings::values.scaling_filter.UsingGlobal()); - - ConfigurationShared::SetPerGameSetting(ui->anti_aliasing_combobox, - &Settings::values.anti_aliasing); - ConfigurationShared::SetHighlight(ui->anti_aliasing_label, - !Settings::values.anti_aliasing.UsingGlobal()); - - ui->fsr_sharpening_combobox->setCurrentIndex( - Settings::values.fsr_sharpening_slider.UsingGlobal() ? 0 : 1); - ui->fsr_sharpening_slider->setEnabled( - !Settings::values.fsr_sharpening_slider.UsingGlobal()); - ui->fsr_sharpening_value->setEnabled(!Settings::values.fsr_sharpening_slider.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->fsr_sharpening_layout, - !Settings::values.fsr_sharpening_slider.UsingGlobal()); - ui->fsr_sharpening_slider->setValue(Settings::values.fsr_sharpening_slider.GetValue()); - - ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); - ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); - ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal()); - } - UpdateBackgroundColorButton(QColor::fromRgb(Settings::values.bg_red.GetValue(), - Settings::values.bg_green.GetValue(), - Settings::values.bg_blue.GetValue())); - UpdateAPILayout(); - PopulateVSyncModeSelection(); //< must happen after UpdateAPILayout - SetFSRIndicatorText(ui->fsr_sharpening_slider->sliderPosition()); + for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) { + const auto& setting_label = setting->GetLabel(); - // VSync setting needs to be determined after populating the VSync combobox - if (Settings::IsConfiguringGlobal()) { - const auto vsync_mode_setting = Settings::values.vsync_mode.GetValue(); - const auto vsync_mode = VSyncSettingToMode(vsync_mode_setting); - int index{}; - for (const auto mode : vsync_mode_combobox_enum_map) { - if (mode == vsync_mode) { - break; + auto [widget, extra] = [&]() { + if (setting_label == "vulkan_device") { + return ConfigurationShared::CreateWidget( + setting, translations, this, runtime_lock, apply_funcs, trackers, + ConfigurationShared::RequestType::ComboBox); } - index++; + return ConfigurationShared::CreateWidget(setting, translations, this, runtime_lock, + apply_funcs, trackers); + }(); + + if (widget == nullptr) { + continue; } - if (static_cast(index) < vsync_mode_combobox_enum_map.size()) { - ui->vsync_mode_combobox->setCurrentIndex(index); + + if (setting_label == "backend") { + api_layout.addWidget(widget); + api_combobox = reinterpret_cast(extra); + } else if (setting_label == "vulkan_device") { + api_layout.addWidget(widget); + vulkan_device_combobox = reinterpret_cast(extra); + vulkan_device_widget = widget; + } else if (setting_label == "shader_backend") { + api_layout.addWidget(widget); + shader_backend_combobox = reinterpret_cast(extra); + shader_backend_widget = widget; + } else { + hold_graphics.insert(std::pair(setting_label, widget)); } + + if (setting_label == "use_vsync") { + vsync_mode_combobox = reinterpret_cast(extra); + } + } + + for (const auto& [label, widget] : hold_graphics) { + graphics_layout.addWidget(widget); } + + // ui->api_widget->setEnabled(runtime_lock); + // ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); + // ui->use_disk_shader_cache->setEnabled(runtime_lock); + // ui->nvdec_emulation_widget->setEnabled(runtime_lock); + // ui->resolution_combobox->setEnabled(runtime_lock); + // ui->astc_decode_mode_combobox->setEnabled(runtime_lock); + // ui->vsync_mode_layout->setEnabled(runtime_lock || + // Settings::values.renderer_backend.GetValue() == + // Settings::RendererBackend::Vulkan); + // 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::IsConfiguringGlobal()) { + // api_combobox->setCurrentIndex(static_cast(Settings::values.renderer_backend.GetValue())); + // ui->fullscreen_mode_combobox->setCurrentIndex( + // static_cast(Settings::values.fullscreen_mode.GetValue())); + // ui->nvdec_emulation->setCurrentIndex( + // static_cast(Settings::values.nvdec_emulation.GetValue())); + // ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); + // ui->resolution_combobox->setCurrentIndex( + // static_cast(Settings::values.resolution_setup.GetValue())); + // ui->scaling_filter_combobox->setCurrentIndex( + // static_cast(Settings::values.scaling_filter.GetValue())); + // ui->fsr_sharpening_slider->setValue(Settings::values.fsr_sharpening_slider.GetValue()); + // ui->anti_aliasing_combobox->setCurrentIndex( + // static_cast(Settings::values.anti_aliasing.GetValue())); + // } else { + // ConfigurationShared::SetPerGameSetting(api_combobox, &Settings::values.renderer_backend); + // ConfigurationShared::SetHighlight(ui->api_widget, + // !Settings::values.renderer_backend.UsingGlobal()); + + // ConfigurationShared::SetPerGameSetting(ui->astc_decode_mode_combobox, + // &Settings::values.accelerate_astc); + // ConfigurationShared::SetHighlight(ui->astc_decode_mode_layout, + // !Settings::values.accelerate_astc.UsingGlobal()); + + // ConfigurationShared::SetPerGameSetting(ui->nvdec_emulation, + // &Settings::values.nvdec_emulation); + // ConfigurationShared::SetHighlight(ui->nvdec_emulation_widget, + // !Settings::values.nvdec_emulation.UsingGlobal()); + + // ConfigurationShared::SetPerGameSetting(ui->fullscreen_mode_combobox, + // &Settings::values.fullscreen_mode); + // ConfigurationShared::SetHighlight(ui->fullscreen_mode_label, + // !Settings::values.fullscreen_mode.UsingGlobal()); + + // ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox, + // &Settings::values.aspect_ratio); + // ConfigurationShared::SetHighlight(ui->ar_label, + // !Settings::values.aspect_ratio.UsingGlobal()); + + // ConfigurationShared::SetPerGameSetting(ui->resolution_combobox, + // &Settings::values.resolution_setup); + // ConfigurationShared::SetHighlight(ui->resolution_label, + // !Settings::values.resolution_setup.UsingGlobal()); + + // ConfigurationShared::SetPerGameSetting(ui->scaling_filter_combobox, + // &Settings::values.scaling_filter); + // ConfigurationShared::SetHighlight(ui->scaling_filter_label, + // !Settings::values.scaling_filter.UsingGlobal()); + + // ConfigurationShared::SetPerGameSetting(ui->anti_aliasing_combobox, + // &Settings::values.anti_aliasing); + // ConfigurationShared::SetHighlight(ui->anti_aliasing_label, + // !Settings::values.anti_aliasing.UsingGlobal()); + + // ui->fsr_sharpening_combobox->setCurrentIndex( + // Settings::values.fsr_sharpening_slider.UsingGlobal() ? 0 : 1); + // ui->fsr_sharpening_slider->setEnabled( + // !Settings::values.fsr_sharpening_slider.UsingGlobal()); + // ui->fsr_sharpening_value->setEnabled(!Settings::values.fsr_sharpening_slider.UsingGlobal()); + // ConfigurationShared::SetHighlight(ui->fsr_sharpening_layout, + // !Settings::values.fsr_sharpening_slider.UsingGlobal()); + // ui->fsr_sharpening_slider->setValue(Settings::values.fsr_sharpening_slider.GetValue()); + + // ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); + // ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); + // ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal()); + // } } void ConfigureGraphics::SetFSRIndicatorText(int percentage) { - ui->fsr_sharpening_value->setText( - tr("%1%", "FSR sharpening percentage (e.g. 50%)").arg(100 - (percentage / 2))); + // ui->fsr_sharpening_value->setText( + // tr("%1%", "FSR sharpening percentage (e.g. 50%)").arg(100 - (percentage / 2))); } const QString ConfigureGraphics::TranslateVSyncMode(VkPresentModeKHR mode, @@ -320,131 +366,134 @@ const QString ConfigureGraphics::TranslateVSyncMode(VkPresentModeKHR mode, } void ConfigureGraphics::ApplyConfiguration() { - const auto resolution_setup = static_cast( - ui->resolution_combobox->currentIndex() - - ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); - - const auto scaling_filter = static_cast( - ui->scaling_filter_combobox->currentIndex() - - ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); - - const auto anti_aliasing = static_cast( - ui->anti_aliasing_combobox->currentIndex() - - ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); - - ConfigurationShared::ApplyPerGameSetting(&Settings::values.fullscreen_mode, - ui->fullscreen_mode_combobox); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio, - ui->aspect_ratio_combobox); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.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, - use_asynchronous_gpu_emulation); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.accelerate_astc, - ui->astc_decode_mode_combobox); - - if (Settings::IsConfiguringGlobal()) { - // Guard if during game and set to game-specific value - if (Settings::values.renderer_backend.UsingGlobal()) { - Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend()); - } - if (Settings::values.nvdec_emulation.UsingGlobal()) { - Settings::values.nvdec_emulation.SetValue(GetCurrentNvdecEmulation()); - } - if (Settings::values.shader_backend.UsingGlobal()) { - Settings::values.shader_backend.SetValue(shader_backend); - } - if (Settings::values.vulkan_device.UsingGlobal()) { - Settings::values.vulkan_device.SetValue(vulkan_device); - } - if (Settings::values.bg_red.UsingGlobal()) { - Settings::values.bg_red.SetValue(static_cast(bg_color.red())); - Settings::values.bg_green.SetValue(static_cast(bg_color.green())); - Settings::values.bg_blue.SetValue(static_cast(bg_color.blue())); - } - if (Settings::values.resolution_setup.UsingGlobal()) { - Settings::values.resolution_setup.SetValue(resolution_setup); - } - if (Settings::values.scaling_filter.UsingGlobal()) { - Settings::values.scaling_filter.SetValue(scaling_filter); - } - if (Settings::values.anti_aliasing.UsingGlobal()) { - Settings::values.anti_aliasing.SetValue(anti_aliasing); - } - Settings::values.fsr_sharpening_slider.SetValue(ui->fsr_sharpening_slider->value()); - - const auto mode = vsync_mode_combobox_enum_map[ui->vsync_mode_combobox->currentIndex()]; - const auto vsync_mode = PresentModeToSetting(mode); - Settings::values.vsync_mode.SetValue(vsync_mode); - } else { - if (ui->resolution_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { - Settings::values.resolution_setup.SetGlobal(true); - } else { - Settings::values.resolution_setup.SetGlobal(false); - Settings::values.resolution_setup.SetValue(resolution_setup); - } - if (ui->scaling_filter_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { - Settings::values.scaling_filter.SetGlobal(true); - } else { - Settings::values.scaling_filter.SetGlobal(false); - Settings::values.scaling_filter.SetValue(scaling_filter); - } - if (ui->anti_aliasing_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { - Settings::values.anti_aliasing.SetGlobal(true); - } else { - Settings::values.anti_aliasing.SetGlobal(false); - Settings::values.anti_aliasing.SetValue(anti_aliasing); - } - if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { - Settings::values.renderer_backend.SetGlobal(true); - Settings::values.shader_backend.SetGlobal(true); - Settings::values.vulkan_device.SetGlobal(true); - } else { - Settings::values.renderer_backend.SetGlobal(false); - Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend()); - switch (GetCurrentGraphicsBackend()) { - case Settings::RendererBackend::OpenGL: - case Settings::RendererBackend::Null: - Settings::values.shader_backend.SetGlobal(false); - Settings::values.vulkan_device.SetGlobal(true); - Settings::values.shader_backend.SetValue(shader_backend); - break; - case Settings::RendererBackend::Vulkan: - Settings::values.shader_backend.SetGlobal(true); - Settings::values.vulkan_device.SetGlobal(false); - Settings::values.vulkan_device.SetValue(vulkan_device); - break; - } - } - - if (ui->nvdec_emulation->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { - Settings::values.nvdec_emulation.SetGlobal(true); - } else { - Settings::values.nvdec_emulation.SetGlobal(false); - Settings::values.nvdec_emulation.SetValue(GetCurrentNvdecEmulation()); - } - - if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { - Settings::values.bg_red.SetGlobal(true); - Settings::values.bg_green.SetGlobal(true); - Settings::values.bg_blue.SetGlobal(true); - } else { - Settings::values.bg_red.SetGlobal(false); - Settings::values.bg_green.SetGlobal(false); - Settings::values.bg_blue.SetGlobal(false); - Settings::values.bg_red.SetValue(static_cast(bg_color.red())); - Settings::values.bg_green.SetValue(static_cast(bg_color.green())); - Settings::values.bg_blue.SetValue(static_cast(bg_color.blue())); - } - - if (ui->fsr_sharpening_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { - Settings::values.fsr_sharpening_slider.SetGlobal(true); - } else { - Settings::values.fsr_sharpening_slider.SetGlobal(false); - Settings::values.fsr_sharpening_slider.SetValue(ui->fsr_sharpening_slider->value()); - } - } + // const auto resolution_setup = static_cast( + // ui->resolution_combobox->currentIndex() - + // ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); + + // const auto scaling_filter = static_cast( + // ui->scaling_filter_combobox->currentIndex() - + // ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); + + // const auto anti_aliasing = static_cast( + // ui->anti_aliasing_combobox->currentIndex() - + // ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); + + // ConfigurationShared::ApplyPerGameSetting(&Settings::values.fullscreen_mode, + // ui->fullscreen_mode_combobox); + // ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio, + // ui->aspect_ratio_combobox); + // ConfigurationShared::ApplyPerGameSetting(&Settings::values.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, + // use_asynchronous_gpu_emulation); + // ConfigurationShared::ApplyPerGameSetting(&Settings::values.accelerate_astc, + // ui->astc_decode_mode_combobox); + + // if (Settings::IsConfiguringGlobal()) { + // // Guard if during game and set to game-specific value + // if (Settings::values.renderer_backend.UsingGlobal()) { + // Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend()); + // } + // if (Settings::values.nvdec_emulation.UsingGlobal()) { + // Settings::values.nvdec_emulation.SetValue(GetCurrentNvdecEmulation()); + // } + // if (Settings::values.shader_backend.UsingGlobal()) { + // Settings::values.shader_backend.SetValue(shader_backend); + // } + // if (Settings::values.vulkan_device.UsingGlobal()) { + // Settings::values.vulkan_device.SetValue(vulkan_device); + // } + // if (Settings::values.bg_red.UsingGlobal()) { + // Settings::values.bg_red.SetValue(static_cast(bg_color.red())); + // Settings::values.bg_green.SetValue(static_cast(bg_color.green())); + // Settings::values.bg_blue.SetValue(static_cast(bg_color.blue())); + // } + // if (Settings::values.resolution_setup.UsingGlobal()) { + // Settings::values.resolution_setup.SetValue(resolution_setup); + // } + // if (Settings::values.scaling_filter.UsingGlobal()) { + // Settings::values.scaling_filter.SetValue(scaling_filter); + // } + // if (Settings::values.anti_aliasing.UsingGlobal()) { + // Settings::values.anti_aliasing.SetValue(anti_aliasing); + // } + // Settings::values.fsr_sharpening_slider.SetValue(ui->fsr_sharpening_slider->value()); + + // const auto mode = vsync_mode_combobox_enum_map[vsync_mode_combobox->currentIndex()]; + // const auto vsync_mode = PresentModeToSetting(mode); + // Settings::values.vsync_mode.SetValue(vsync_mode); + // } else { + // if (ui->resolution_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { + // Settings::values.resolution_setup.SetGlobal(true); + // } else { + // Settings::values.resolution_setup.SetGlobal(false); + // Settings::values.resolution_setup.SetValue(resolution_setup); + // } + // if (ui->scaling_filter_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) + // { + // Settings::values.scaling_filter.SetGlobal(true); + // } else { + // Settings::values.scaling_filter.SetGlobal(false); + // Settings::values.scaling_filter.SetValue(scaling_filter); + // } + // if (ui->anti_aliasing_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) + // { + // Settings::values.anti_aliasing.SetGlobal(true); + // } else { + // Settings::values.anti_aliasing.SetGlobal(false); + // Settings::values.anti_aliasing.SetValue(anti_aliasing); + // } + // if (api_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { + // Settings::values.renderer_backend.SetGlobal(true); + // Settings::values.shader_backend.SetGlobal(true); + // Settings::values.vulkan_device.SetGlobal(true); + // } else { + // Settings::values.renderer_backend.SetGlobal(false); + // Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend()); + // switch (GetCurrentGraphicsBackend()) { + // case Settings::RendererBackend::OpenGL: + // case Settings::RendererBackend::Null: + // Settings::values.shader_backend.SetGlobal(false); + // Settings::values.vulkan_device.SetGlobal(true); + // Settings::values.shader_backend.SetValue(shader_backend); + // break; + // case Settings::RendererBackend::Vulkan: + // Settings::values.shader_backend.SetGlobal(true); + // Settings::values.vulkan_device.SetGlobal(false); + // Settings::values.vulkan_device.SetValue(vulkan_device); + // break; + // } + // } + + // if (ui->nvdec_emulation->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { + // Settings::values.nvdec_emulation.SetGlobal(true); + // } else { + // Settings::values.nvdec_emulation.SetGlobal(false); + // Settings::values.nvdec_emulation.SetValue(GetCurrentNvdecEmulation()); + // } + + // if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { + // Settings::values.bg_red.SetGlobal(true); + // Settings::values.bg_green.SetGlobal(true); + // Settings::values.bg_blue.SetGlobal(true); + // } else { + // Settings::values.bg_red.SetGlobal(false); + // Settings::values.bg_green.SetGlobal(false); + // Settings::values.bg_blue.SetGlobal(false); + // Settings::values.bg_red.SetValue(static_cast(bg_color.red())); + // Settings::values.bg_green.SetValue(static_cast(bg_color.green())); + // Settings::values.bg_blue.SetValue(static_cast(bg_color.blue())); + // } + + // if (ui->fsr_sharpening_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) + // { + // Settings::values.fsr_sharpening_slider.SetGlobal(true); + // } else { + // Settings::values.fsr_sharpening_slider.SetGlobal(false); + // Settings::values.fsr_sharpening_slider.SetValue(ui->fsr_sharpening_slider->value()); + // } + // } } void ConfigureGraphics::changeEvent(QEvent* event) { @@ -462,43 +511,43 @@ void ConfigureGraphics::RetranslateUI() { void ConfigureGraphics::UpdateBackgroundColorButton(QColor color) { bg_color = color; - QPixmap pixmap(ui->bg_button->size()); - pixmap.fill(bg_color); + // QPixmap pixmap(ui->bg_button->size()); + // pixmap.fill(bg_color); - const QIcon color_icon(pixmap); - ui->bg_button->setIcon(color_icon); + // const QIcon color_icon(pixmap); + // ui->bg_button->setIcon(color_icon); } void ConfigureGraphics::UpdateAPILayout() { if (!Settings::IsConfiguringGlobal() && - ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { + api_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { vulkan_device = Settings::values.vulkan_device.GetValue(true); shader_backend = Settings::values.shader_backend.GetValue(true); - ui->device_widget->setEnabled(false); - ui->backend_widget->setEnabled(false); + vulkan_device_widget->setEnabled(false); + shader_backend_widget->setEnabled(false); } else { vulkan_device = Settings::values.vulkan_device.GetValue(); shader_backend = Settings::values.shader_backend.GetValue(); - ui->device_widget->setEnabled(true); - ui->backend_widget->setEnabled(true); + vulkan_device_widget->setEnabled(true); + shader_backend_widget->setEnabled(true); } switch (GetCurrentGraphicsBackend()) { case Settings::RendererBackend::OpenGL: - ui->backend->setCurrentIndex(static_cast(shader_backend)); - ui->device_widget->setVisible(false); - ui->backend_widget->setVisible(true); + shader_backend_combobox->setCurrentIndex(static_cast(shader_backend)); + vulkan_device_widget->setVisible(false); + shader_backend_widget->setVisible(true); break; case Settings::RendererBackend::Vulkan: - if (static_cast(vulkan_device) < ui->device->count()) { - ui->device->setCurrentIndex(vulkan_device); + if (static_cast(vulkan_device) < vulkan_device_combobox->count()) { + vulkan_device_combobox->setCurrentIndex(vulkan_device); } - ui->device_widget->setVisible(true); - ui->backend_widget->setVisible(false); + vulkan_device_widget->setVisible(true); + shader_backend_widget->setVisible(false); break; case Settings::RendererBackend::Null: - ui->device_widget->setVisible(false); - ui->backend_widget->setVisible(false); + vulkan_device_widget->setVisible(false); + shader_backend_widget->setVisible(false); break; } } @@ -520,92 +569,94 @@ void ConfigureGraphics::RetrieveVulkanDevices() { Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { if (Settings::IsConfiguringGlobal()) { - return static_cast(ui->api->currentIndex()); + return static_cast(api_combobox->currentIndex()); } - if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { + if (api_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { Settings::values.renderer_backend.SetGlobal(true); return Settings::values.renderer_backend.GetValue(); } Settings::values.renderer_backend.SetGlobal(false); - return static_cast(ui->api->currentIndex() - + return static_cast(api_combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET); } Settings::NvdecEmulation ConfigureGraphics::GetCurrentNvdecEmulation() const { - if (Settings::IsConfiguringGlobal()) { - return static_cast(ui->nvdec_emulation->currentIndex()); - } - - if (ui->nvdec_emulation->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { - Settings::values.nvdec_emulation.SetGlobal(true); - return Settings::values.nvdec_emulation.GetValue(); - } - Settings::values.nvdec_emulation.SetGlobal(false); - return static_cast(ui->nvdec_emulation->currentIndex() - - ConfigurationShared::USE_GLOBAL_OFFSET); + return Settings::NvdecEmulation::CPU; + // if (Settings::IsConfiguringGlobal()) { + // return static_cast(ui->nvdec_emulation->currentIndex()); + // } + + // if (ui->nvdec_emulation->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { + // Settings::values.nvdec_emulation.SetGlobal(true); + // return Settings::values.nvdec_emulation.GetValue(); + // } + // Settings::values.nvdec_emulation.SetGlobal(false); + // return static_cast(ui->nvdec_emulation->currentIndex() - + // ConfigurationShared::USE_GLOBAL_OFFSET); } void ConfigureGraphics::SetupPerGameUI() { - if (Settings::IsConfiguringGlobal()) { - ui->api->setEnabled(Settings::values.renderer_backend.UsingGlobal()); - ui->device->setEnabled(Settings::values.renderer_backend.UsingGlobal()); - ui->fullscreen_mode_combobox->setEnabled(Settings::values.fullscreen_mode.UsingGlobal()); - ui->aspect_ratio_combobox->setEnabled(Settings::values.aspect_ratio.UsingGlobal()); - ui->resolution_combobox->setEnabled(Settings::values.resolution_setup.UsingGlobal()); - ui->scaling_filter_combobox->setEnabled(Settings::values.scaling_filter.UsingGlobal()); - ui->fsr_sharpening_slider->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal()); - ui->anti_aliasing_combobox->setEnabled(Settings::values.anti_aliasing.UsingGlobal()); - ui->use_asynchronous_gpu_emulation->setEnabled( - Settings::values.use_asynchronous_gpu_emulation.UsingGlobal()); - ui->nvdec_emulation->setEnabled(Settings::values.nvdec_emulation.UsingGlobal()); - ui->astc_decode_mode_combobox->setEnabled(Settings::values.accelerate_astc.UsingGlobal()); - ui->use_disk_shader_cache->setEnabled(Settings::values.use_disk_shader_cache.UsingGlobal()); - ui->bg_button->setEnabled(Settings::values.bg_red.UsingGlobal()); - ui->fsr_slider_layout->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal()); - - return; - } - - connect(ui->bg_combobox, qOverload(&QComboBox::activated), this, [this](int index) { - ui->bg_button->setEnabled(index == 1); - ConfigurationShared::SetHighlight(ui->bg_layout, index == 1); - }); - - connect(ui->fsr_sharpening_combobox, qOverload(&QComboBox::activated), this, - [this](int index) { - ui->fsr_sharpening_slider->setEnabled(index == 1); - ui->fsr_sharpening_value->setEnabled(index == 1); - ConfigurationShared::SetHighlight(ui->fsr_sharpening_layout, index == 1); - }); - - ConfigurationShared::SetColoredTristate( - ui->use_disk_shader_cache, Settings::values.use_disk_shader_cache, use_disk_shader_cache); - ConfigurationShared::SetColoredTristate(ui->use_asynchronous_gpu_emulation, - Settings::values.use_asynchronous_gpu_emulation, - use_asynchronous_gpu_emulation); - - ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, - Settings::values.aspect_ratio.GetValue(true)); - ConfigurationShared::SetColoredComboBox( - ui->fullscreen_mode_combobox, ui->fullscreen_mode_label, - static_cast(Settings::values.fullscreen_mode.GetValue(true))); - ConfigurationShared::SetColoredComboBox( - ui->resolution_combobox, ui->resolution_label, - static_cast(Settings::values.resolution_setup.GetValue(true))); - ConfigurationShared::SetColoredComboBox( - ui->scaling_filter_combobox, ui->scaling_filter_label, - static_cast(Settings::values.scaling_filter.GetValue(true))); - ConfigurationShared::SetColoredComboBox( - ui->anti_aliasing_combobox, ui->anti_aliasing_label, - static_cast(Settings::values.anti_aliasing.GetValue(true))); - ConfigurationShared::SetColoredComboBox( - ui->astc_decode_mode_combobox, ui->astc_decode_mode_label, - static_cast(Settings::values.accelerate_astc.GetValue(true))); - ConfigurationShared::InsertGlobalItem( - ui->api, static_cast(Settings::values.renderer_backend.GetValue(true))); - ConfigurationShared::InsertGlobalItem( - ui->nvdec_emulation, static_cast(Settings::values.nvdec_emulation.GetValue(true))); - - ui->vsync_mode_layout->setVisible(false); + // if (Settings::IsConfiguringGlobal()) { + // api_combobox->setEnabled(Settings::values.renderer_backend.UsingGlobal()); + // vulkan_device_combobox->setEnabled(Settings::values.renderer_backend.UsingGlobal()); + // ui->fullscreen_mode_combobox->setEnabled(Settings::values.fullscreen_mode.UsingGlobal()); + // ui->aspect_ratio_combobox->setEnabled(Settings::values.aspect_ratio.UsingGlobal()); + // ui->resolution_combobox->setEnabled(Settings::values.resolution_setup.UsingGlobal()); + // ui->scaling_filter_combobox->setEnabled(Settings::values.scaling_filter.UsingGlobal()); + // ui->fsr_sharpening_slider->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal()); + // ui->anti_aliasing_combobox->setEnabled(Settings::values.anti_aliasing.UsingGlobal()); + // ui->use_asynchronous_gpu_emulation->setEnabled( + // Settings::values.use_asynchronous_gpu_emulation.UsingGlobal()); + // ui->nvdec_emulation->setEnabled(Settings::values.nvdec_emulation.UsingGlobal()); + // ui->astc_decode_mode_combobox->setEnabled(Settings::values.accelerate_astc.UsingGlobal()); + // ui->use_disk_shader_cache->setEnabled(Settings::values.use_disk_shader_cache.UsingGlobal()); + // ui->bg_button->setEnabled(Settings::values.bg_red.UsingGlobal()); + // ui->fsr_slider_layout->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal()); + + // return; + // } + + // connect(ui->bg_combobox, qOverload(&QComboBox::activated), this, [this](int index) { + // ui->bg_button->setEnabled(index == 1); + // ConfigurationShared::SetHighlight(ui->bg_layout, index == 1); + // }); + + // connect(ui->fsr_sharpening_combobox, qOverload(&QComboBox::activated), this, + // [this](int index) { + // ui->fsr_sharpening_slider->setEnabled(index == 1); + // ui->fsr_sharpening_value->setEnabled(index == 1); + // ConfigurationShared::SetHighlight(ui->fsr_sharpening_layout, index == 1); + // }); + + // ConfigurationShared::SetColoredTristate( + // ui->use_disk_shader_cache, Settings::values.use_disk_shader_cache, + // use_disk_shader_cache); + // ConfigurationShared::SetColoredTristate(ui->use_asynchronous_gpu_emulation, + // Settings::values.use_asynchronous_gpu_emulation, + // use_asynchronous_gpu_emulation); + + // ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, + // Settings::values.aspect_ratio.GetValue(true)); + // ConfigurationShared::SetColoredComboBox( + // ui->fullscreen_mode_combobox, ui->fullscreen_mode_label, + // static_cast(Settings::values.fullscreen_mode.GetValue(true))); + // ConfigurationShared::SetColoredComboBox( + // ui->resolution_combobox, ui->resolution_label, + // static_cast(Settings::values.resolution_setup.GetValue(true))); + // ConfigurationShared::SetColoredComboBox( + // ui->scaling_filter_combobox, ui->scaling_filter_label, + // static_cast(Settings::values.scaling_filter.GetValue(true))); + // ConfigurationShared::SetColoredComboBox( + // ui->anti_aliasing_combobox, ui->anti_aliasing_label, + // static_cast(Settings::values.anti_aliasing.GetValue(true))); + // ConfigurationShared::SetColoredComboBox( + // ui->astc_decode_mode_combobox, ui->astc_decode_mode_label, + // static_cast(Settings::values.accelerate_astc.GetValue(true))); + // ConfigurationShared::InsertGlobalItem( + // api_combobox, static_cast(Settings::values.renderer_backend.GetValue(true))); + // ConfigurationShared::InsertGlobalItem( + // ui->nvdec_emulation, static_cast(Settings::values.nvdec_emulation.GetValue(true))); + + // ui->vsync_mode_layout->setVisible(false); } diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index adc3faffa..30dfb6163 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h @@ -17,6 +17,7 @@ class QEvent; class QObject; +class QComboBox; namespace Settings { enum class NvdecEmulation : u32; @@ -38,6 +39,7 @@ public: std::vector& records, const std::function& expose_compute_option_, std::shared_ptr> group, + const ConfigurationShared::TranslationMap& translations_, QWidget* parent = nullptr); ~ConfigureGraphics() override; @@ -70,10 +72,8 @@ private: std::unique_ptr ui; QColor bg_color; - ConfigurationShared::CheckState use_nvdec_emulation; - ConfigurationShared::CheckState accelerate_astc; - ConfigurationShared::CheckState use_disk_shader_cache; - ConfigurationShared::CheckState use_asynchronous_gpu_emulation; + std::list trackers{}; + std::forward_list> apply_funcs{}; std::vector& records; std::vector vulkan_devices; @@ -86,4 +86,12 @@ private: const std::function& expose_compute_option; const Core::System& system; + const ConfigurationShared::TranslationMap& translations; + + QComboBox* vulkan_device_combobox; + QComboBox* api_combobox; + QComboBox* shader_backend_combobox; + QComboBox* vsync_mode_combobox; + QWidget* vulkan_device_widget; + QWidget* shader_backend_widget; }; diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index 91b09625b..565429c98 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -43,112 +43,6 @@ 6 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Shader Backend: - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Device: - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - API: - - - - - - - - 0 - 0 - - - - - OpenGL - - - - - Vulkan - - - - - None - - - - - - - @@ -168,649 +62,8 @@ - - - Use disk pipeline cache - - - - - - - Use asynchronous GPU emulation - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - VSync Mode: - - - - - - - FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. -FIFO Relaxed is similar to FIFO but allows tearing as it recovers from a slow down. -Mailbox can have lower latency than FIFO and does not tear but may drop frames. -Immediate (no synchronization) just presents whatever is available and can exhibit tearing. - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - ASTC Texture Decoding Method: - - - - - - - - CPU - - - - - GPU Compute - - - - - CPU Asynchronous (Hack) - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - NVDEC emulation: - - - - - - - - No Video Output - - - - - CPU Video Decoding - - - - - GPU Video Decoding (Default) - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Fullscreen Mode: - - - - - - - - Borderless Windowed - - - - - Exclusive Fullscreen - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Aspect Ratio: - - - - - - - - Default (16:9) - - - - - Force 4:3 - - - - - Force 21:9 - - - - - Force 16:10 - - - - - Stretch to Window - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Resolution: - - - - - - - - 0.5X (360p/540p) [EXPERIMENTAL] - - - - - 0.75X (540p/810p) [EXPERIMENTAL] - - - - - 1X (720p/1080p) - - - - - 1.5X (1080p/1620p) [EXPERIMENTAL] - - - - - 2X (1440p/2160p) - - - - - 3X (2160p/3240p) - - - - - 4X (2880p/4320p) - - - - - 5X (3600p/5400p) - - - - - 6X (4320p/6480p) - - - - - 7X (5040p/7560p) - - - - - 8X (5760p/8640p) - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Window Adapting Filter: - - - - - - - - Nearest Neighbor - - - - - Bilinear - - - - - Bicubic - - - - - Gaussian - - - - - ScaleForce - - - - - AMD FidelityFX™️ Super Resolution - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Anti-Aliasing Method: - - - - - - - - None - - - - - FXAA - - - - - SMAA - - - - - - - - - - - true - - - - 0 - 0 - - - - - 6 - - - QLayout::SetDefaultConstraint - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - Use global FSR Sharpness - - - - - Set FSR Sharpness - - - - - - - - - 0 - 0 - - - - FSR Sharpness: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 6 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - 200 - - - 25 - - - Qt::Horizontal - - - true - - - - - - - - 0 - 0 - - - - - 32 - 0 - - - - 100% - - - Qt::AlignCenter - - - - - - - - - - - - - 0 - 0 - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Use global background color - - - 0 - - - 10 - - - - Use global background color - - - - - Set background color: - - - - - - - - Background Color: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 40 - 16777215 - - - - - + + diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 7d79044d4..8a9495109 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -32,8 +32,8 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { for (auto setting : Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) { - QWidget* widget = ConfigurationShared::CreateWidget(setting, translations, this, - runtime_lock, apply_funcs, trackers); + auto [widget, extra] = ConfigurationShared::CreateWidget( + setting, translations, this, runtime_lock, apply_funcs, trackers); if (widget == nullptr) { continue; diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index 339768017..9e229977d 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp @@ -58,7 +58,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st std::make_unique(system_, tab_group, *translations, this); graphics_tab = std::make_unique( system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, - tab_group, this); + tab_group, *translations, this); input_tab = std::make_unique(system_, game_config.get(), this); system_tab = std::make_unique(system_, tab_group, this); diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index ddc7569f1..73c3086ae 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp @@ -36,6 +36,7 @@ std::unique_ptr InitializeTranslations(QWidget* parent) { // Cpu INSERT("cpu_accuracy", "Accuracy:", ""); + INSERT("cpu_accuracy_first_time", "", ""); // Cpu Debug INSERT("cpu_debug_mode", "Enable CPU Debugging", ""); @@ -75,13 +76,16 @@ std::unique_ptr InitializeTranslations(QWidget* parent) { INSERT("use_disk_shader_cache", "Use disk pipeline cache", ""); INSERT("use_asynchronous_gpu_emulation", "Use asynchronous GPU emulation", ""); INSERT("nvdec_emulation", "NVDEC emulation:", ""); - INSERT("acclerate_astc", "ASTC Decoding Method:", ""); + INSERT("accelerate_astc", "ASTC Decoding Method:", ""); INSERT( "use_vsync", "VSync Mode:", "FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh " "rate. FIFO Relaxed is similar to FIFO but allows tearing as it recovers from a slow down. " "Mailbox can have lower latency than FIFO and does not tear but may drop frames. Immediate " "(no synchronization) just presents whatever is available and can exhibit tearing."); + INSERT("bg_red", "", ""); + INSERT("bg_green", "", ""); + INSERT("bg_blue", "", ""); // Renderer (Advanced Graphics) INSERT("async_presentation", "Enable asynchronous presentation (Vulkan only)", ""); @@ -104,9 +108,6 @@ std::unique_ptr InitializeTranslations(QWidget* parent) { "Enable compute pipelines, required by some games.\nThis setting only exists for Intel " "proprietary drivers, and may crash if enabled.\nCompute pipelines are always enabled " "on all other drivers."); - INSERT("bg_red", "Background Color:", ""); - INSERT("bg_green", "Background Color:", ""); - INSERT("bg_blue", "Background Color:", ""); // Renderer (Debug) INSERT("debug", "Enable Graphics Debugging", -- cgit v1.2.3