diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.cpp | 107 | ||||
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.h | 3 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 350 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.h | 4 |
4 files changed, 116 insertions, 348 deletions
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 80637f3a2..8d5ab8b4c 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <QObject> | 9 | #include <QObject> |
| 10 | #include <QString> | 10 | #include <QString> |
| 11 | #include <QWidget> | 11 | #include <QWidget> |
| 12 | #include <qcheckbox.h> | ||
| 12 | #include <qnamespace.h> | 13 | #include <qnamespace.h> |
| 13 | #include "common/settings.h" | 14 | #include "common/settings.h" |
| 14 | #include "yuzu/configuration/configuration_shared.h" | 15 | #include "yuzu/configuration/configuration_shared.h" |
| @@ -57,7 +58,7 @@ static std::pair<QWidget*, std::function<void()>> CreateCheckBox(Settings::Basic | |||
| 57 | } | 58 | } |
| 58 | 59 | ||
| 59 | static std::tuple<QWidget*, void*, std::function<void()>> CreateCombobox( | 60 | static std::tuple<QWidget*, void*, std::function<void()>> CreateCombobox( |
| 60 | Settings::BasicSetting* setting, const QString& label, QWidget* parent) { | 61 | Settings::BasicSetting* setting, const QString& label, QWidget* parent, bool managed) { |
| 61 | const auto type = setting->TypeId(); | 62 | const auto type = setting->TypeId(); |
| 62 | 63 | ||
| 63 | QWidget* group = new QWidget(parent); | 64 | QWidget* group = new QWidget(parent); |
| @@ -78,7 +79,7 @@ static std::tuple<QWidget*, void*, std::function<void()>> CreateCombobox( | |||
| 78 | combobox_layout->setSpacing(6); | 79 | combobox_layout->setSpacing(6); |
| 79 | combobox_layout->setContentsMargins(0, 0, 0, 0); | 80 | combobox_layout->setContentsMargins(0, 0, 0, 0); |
| 80 | 81 | ||
| 81 | if (setting->Switchable() && !Settings::IsConfiguringGlobal()) { | 82 | if (setting->Switchable() && !Settings::IsConfiguringGlobal() && managed) { |
| 82 | int current = std::stoi(setting->ToString()); | 83 | int current = std::stoi(setting->ToString()); |
| 83 | int global_value = std::stoi(setting->ToStringGlobal()); | 84 | int global_value = std::stoi(setting->ToStringGlobal()); |
| 84 | SetColoredComboBox(combobox, group, global_value); | 85 | SetColoredComboBox(combobox, group, global_value); |
| @@ -92,23 +93,26 @@ static std::tuple<QWidget*, void*, std::function<void()>> CreateCombobox( | |||
| 92 | combobox->setCurrentIndex(std::stoi(setting->ToString())); | 93 | combobox->setCurrentIndex(std::stoi(setting->ToString())); |
| 93 | } | 94 | } |
| 94 | 95 | ||
| 95 | const auto load_func = [combobox, setting]() { | 96 | std::function<void()> load_func = []() {}; |
| 96 | if (Settings::IsConfiguringGlobal()) { | 97 | if (managed) { |
| 97 | setting->LoadString(std::to_string(combobox->currentIndex())); | 98 | load_func = [combobox, setting]() { |
| 98 | } | 99 | if (Settings::IsConfiguringGlobal()) { |
| 99 | 100 | setting->LoadString(std::to_string(combobox->currentIndex())); | |
| 100 | if (Settings::IsConfiguringGlobal() || !setting->Switchable()) { | 101 | } |
| 101 | return; | 102 | |
| 102 | } | 103 | if (Settings::IsConfiguringGlobal() || !setting->Switchable()) { |
| 103 | 104 | return; | |
| 104 | bool using_global = combobox->currentIndex() == USE_GLOBAL_INDEX; | 105 | } |
| 105 | int index = combobox->currentIndex() - USE_GLOBAL_OFFSET; | 106 | |
| 106 | 107 | bool using_global = combobox->currentIndex() == USE_GLOBAL_INDEX; | |
| 107 | setting->SetGlobal(using_global); | 108 | int index = combobox->currentIndex() - USE_GLOBAL_OFFSET; |
| 108 | if (!using_global) { | 109 | |
| 109 | setting->LoadString(std::to_string(index)); | 110 | setting->SetGlobal(using_global); |
| 110 | } | 111 | if (!using_global) { |
| 111 | }; | 112 | setting->LoadString(std::to_string(index)); |
| 113 | } | ||
| 114 | }; | ||
| 115 | } | ||
| 112 | 116 | ||
| 113 | return {group, combobox, load_func}; | 117 | return {group, combobox, load_func}; |
| 114 | } | 118 | } |
| @@ -116,25 +120,68 @@ static std::tuple<QWidget*, void*, std::function<void()>> CreateCombobox( | |||
| 116 | static std::tuple<QWidget*, void*, std::function<void()>> CreateLineEdit( | 120 | static std::tuple<QWidget*, void*, std::function<void()>> CreateLineEdit( |
| 117 | Settings::BasicSetting* setting, const QString& label, QWidget* parent) { | 121 | Settings::BasicSetting* setting, const QString& label, QWidget* parent) { |
| 118 | QWidget* widget = new QWidget(parent); | 122 | QWidget* widget = new QWidget(parent); |
| 123 | widget->setObjectName(label); | ||
| 124 | |||
| 119 | QHBoxLayout* layout = new QHBoxLayout(widget); | 125 | QHBoxLayout* layout = new QHBoxLayout(widget); |
| 126 | QLineEdit* line_edit = new QLineEdit(parent); | ||
| 127 | |||
| 128 | const QString text = QString::fromStdString(setting->ToString()); | ||
| 129 | line_edit->setText(text); | ||
| 130 | |||
| 131 | std::function<void()> load_func; | ||
| 120 | 132 | ||
| 121 | QLabel* q_label = new QLabel(label, widget); | 133 | // setSizePolicy lets widget expand and take an equal part of the space as the line edit |
| 122 | QLineEdit* line_edit = new QLineEdit(widget); | 134 | if (Settings::IsConfiguringGlobal()) { |
| 135 | QLabel* q_label = new QLabel(label, widget); | ||
| 136 | q_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | ||
| 137 | layout->addWidget(q_label); | ||
| 138 | |||
| 139 | load_func = [&]() { | ||
| 140 | std::string load_text = line_edit->text().toStdString(); | ||
| 141 | setting->LoadString(load_text); | ||
| 142 | }; | ||
| 143 | } else { | ||
| 144 | QCheckBox* checkbox = new QCheckBox(label, parent); | ||
| 145 | checkbox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | ||
| 146 | layout->addWidget(checkbox); | ||
| 147 | |||
| 148 | const auto highlight_func = [widget, line_edit](int state) { | ||
| 149 | bool using_global = state != Qt::Checked; | ||
| 150 | SetHighlight(widget, !using_global); | ||
| 151 | line_edit->setEnabled(!using_global); | ||
| 152 | }; | ||
| 153 | |||
| 154 | QObject::connect(checkbox, qOverload<int>(&QCheckBox::stateChanged), widget, | ||
| 155 | highlight_func); | ||
| 156 | |||
| 157 | checkbox->setCheckState(setting->UsingGlobal() ? Qt::Unchecked : Qt::Checked); | ||
| 158 | highlight_func(checkbox->checkState()); | ||
| 159 | |||
| 160 | load_func = [&]() { | ||
| 161 | if (checkbox->checkState() == Qt::Checked) { | ||
| 162 | setting->SetGlobal(false); | ||
| 163 | |||
| 164 | std::string load_text = line_edit->text().toStdString(); | ||
| 165 | setting->LoadString(load_text); | ||
| 166 | } else { | ||
| 167 | setting->SetGlobal(true); | ||
| 168 | } | ||
| 169 | }; | ||
| 170 | } | ||
| 123 | 171 | ||
| 124 | layout->addWidget(q_label); | ||
| 125 | layout->addStretch(); | ||
| 126 | layout->addWidget(line_edit); | 172 | layout->addWidget(line_edit); |
| 127 | 173 | ||
| 128 | layout->setContentsMargins(0, 0, 0, 0); | 174 | layout->setContentsMargins(0, 0, 0, 0); |
| 129 | 175 | ||
| 130 | return {widget, line_edit, []() {}}; | 176 | return {widget, line_edit, load_func}; |
| 131 | } | 177 | } |
| 132 | 178 | ||
| 133 | std::pair<QWidget*, void*> CreateWidget(Settings::BasicSetting* setting, | 179 | std::pair<QWidget*, void*> CreateWidget(Settings::BasicSetting* setting, |
| 134 | const TranslationMap& translations, QWidget* parent, | 180 | const TranslationMap& translations, QWidget* parent, |
| 135 | bool runtime_lock, | 181 | bool runtime_lock, |
| 136 | std::forward_list<std::function<void(bool)>>& apply_funcs, | 182 | std::forward_list<std::function<void(bool)>>& apply_funcs, |
| 137 | std::list<CheckState>& trackers, RequestType request) { | 183 | std::list<CheckState>& trackers, RequestType request, |
| 184 | bool managed) { | ||
| 138 | const auto type = setting->TypeId(); | 185 | const auto type = setting->TypeId(); |
| 139 | const int id = setting->Id(); | 186 | const int id = setting->Id(); |
| 140 | QWidget* widget{nullptr}; | 187 | QWidget* widget{nullptr}; |
| @@ -162,7 +209,7 @@ std::pair<QWidget*, void*> CreateWidget(Settings::BasicSetting* setting, | |||
| 162 | widget = pair.first; | 209 | widget = pair.first; |
| 163 | load_func = pair.second; | 210 | load_func = pair.second; |
| 164 | } else if (setting->IsEnum()) { | 211 | } else if (setting->IsEnum()) { |
| 165 | auto tuple = CreateCombobox(setting, label, parent); | 212 | auto tuple = CreateCombobox(setting, label, parent, managed); |
| 166 | widget = std::get<0>(tuple); | 213 | widget = std::get<0>(tuple); |
| 167 | extra = std::get<1>(tuple); | 214 | extra = std::get<1>(tuple); |
| 168 | load_func = std::get<2>(tuple); | 215 | load_func = std::get<2>(tuple); |
| @@ -176,7 +223,7 @@ std::pair<QWidget*, void*> CreateWidget(Settings::BasicSetting* setting, | |||
| 176 | break; | 223 | break; |
| 177 | } | 224 | } |
| 178 | case RequestType::ComboBox: { | 225 | case RequestType::ComboBox: { |
| 179 | auto tuple = CreateCombobox(setting, label, parent); | 226 | auto tuple = CreateCombobox(setting, label, parent, managed); |
| 180 | widget = std::get<0>(tuple); | 227 | widget = std::get<0>(tuple); |
| 181 | extra = std::get<1>(tuple); | 228 | extra = std::get<1>(tuple); |
| 182 | load_func = std::get<2>(tuple); | 229 | load_func = std::get<2>(tuple); |
| @@ -201,9 +248,9 @@ std::pair<QWidget*, void*> CreateWidget(Settings::BasicSetting* setting, | |||
| 201 | }); | 248 | }); |
| 202 | 249 | ||
| 203 | bool enable = runtime_lock || setting->RuntimeModfiable(); | 250 | bool enable = runtime_lock || setting->RuntimeModfiable(); |
| 204 | enable &= | 251 | if (setting->Switchable() && Settings::IsConfiguringGlobal() && !runtime_lock) { |
| 205 | setting->Switchable() && !(Settings::IsConfiguringGlobal() && !setting->UsingGlobal()); | 252 | enable &= !setting->UsingGlobal(); |
| 206 | enable |= !setting->Switchable() && Settings::IsConfiguringGlobal() && runtime_lock; | 253 | } |
| 207 | widget->setEnabled(enable); | 254 | widget->setEnabled(enable); |
| 208 | 255 | ||
| 209 | widget->setVisible(Settings::IsConfiguringGlobal() || setting->Switchable()); | 256 | widget->setVisible(Settings::IsConfiguringGlobal() || setting->Switchable()); |
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index d70828935..942af0215 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h | |||
| @@ -54,7 +54,8 @@ std::pair<QWidget*, void*> CreateWidget(Settings::BasicSetting* setting, | |||
| 54 | bool runtime_lock, | 54 | bool runtime_lock, |
| 55 | std::forward_list<std::function<void(bool)>>& apply_funcs, | 55 | std::forward_list<std::function<void(bool)>>& apply_funcs, |
| 56 | std::list<CheckState>& trackers, | 56 | std::list<CheckState>& trackers, |
| 57 | RequestType request = RequestType::Default); | 57 | RequestType request = RequestType::Default, |
| 58 | bool managed = true); | ||
| 58 | 59 | ||
| 59 | // Global-aware apply and set functions | 60 | // Global-aware apply and set functions |
| 60 | 61 | ||
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index d8e95b9b1..37a10ac87 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -55,20 +55,20 @@ static constexpr VkPresentModeKHR VSyncSettingToMode(Settings::VSyncMode mode) { | |||
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | // static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode) { | 58 | static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode) { |
| 59 | // switch (mode) { | 59 | switch (mode) { |
| 60 | // case VK_PRESENT_MODE_IMMEDIATE_KHR: | 60 | case VK_PRESENT_MODE_IMMEDIATE_KHR: |
| 61 | // return Settings::VSyncMode::Immediate; | 61 | return Settings::VSyncMode::Immediate; |
| 62 | // case VK_PRESENT_MODE_MAILBOX_KHR: | 62 | case VK_PRESENT_MODE_MAILBOX_KHR: |
| 63 | // return Settings::VSyncMode::Mailbox; | 63 | return Settings::VSyncMode::Mailbox; |
| 64 | // case VK_PRESENT_MODE_FIFO_KHR: | 64 | case VK_PRESENT_MODE_FIFO_KHR: |
| 65 | // return Settings::VSyncMode::FIFO; | 65 | return Settings::VSyncMode::FIFO; |
| 66 | // case VK_PRESENT_MODE_FIFO_RELAXED_KHR: | 66 | case VK_PRESENT_MODE_FIFO_RELAXED_KHR: |
| 67 | // return Settings::VSyncMode::FIFORelaxed; | 67 | return Settings::VSyncMode::FIFORelaxed; |
| 68 | // default: | 68 | default: |
| 69 | // return Settings::VSyncMode::FIFO; | 69 | return Settings::VSyncMode::FIFO; |
| 70 | // } | 70 | } |
| 71 | // } | 71 | } |
| 72 | 72 | ||
| 73 | ConfigureGraphics::ConfigureGraphics( | 73 | ConfigureGraphics::ConfigureGraphics( |
| 74 | const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_, | 74 | const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_, |
| @@ -112,16 +112,9 @@ ConfigureGraphics::ConfigureGraphics( | |||
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | SetupPerGameUI(); | ||
| 116 | |||
| 117 | connect(api_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this, [this] { | 115 | connect(api_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this, [this] { |
| 118 | UpdateAPILayout(); | 116 | UpdateAPILayout(); |
| 119 | PopulateVSyncModeSelection(); | 117 | PopulateVSyncModeSelection(); |
| 120 | if (!Settings::IsConfiguringGlobal()) { | ||
| 121 | ConfigurationShared::SetHighlight(ui->api_widget, | ||
| 122 | api_combobox->currentIndex() != | ||
| 123 | ConfigurationShared::USE_GLOBAL_INDEX); | ||
| 124 | } | ||
| 125 | }); | 118 | }); |
| 126 | connect(vulkan_device_combobox, qOverload<int>(&QComboBox::activated), this, | 119 | connect(vulkan_device_combobox, qOverload<int>(&QComboBox::activated), this, |
| 127 | [this](int device) { | 120 | [this](int device) { |
| @@ -215,18 +208,22 @@ void ConfigureGraphics::SetConfiguration() { | |||
| 215 | QLayout& graphics_layout = *ui->graphics_widget->layout(); | 208 | QLayout& graphics_layout = *ui->graphics_widget->layout(); |
| 216 | 209 | ||
| 217 | std::map<bool, std::map<std::string, QWidget*>> hold_graphics; | 210 | std::map<bool, std::map<std::string, QWidget*>> hold_graphics; |
| 211 | std::forward_list<QWidget*> hold_api; | ||
| 218 | 212 | ||
| 219 | for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) { | 213 | for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) { |
| 220 | const auto& setting_label = setting->GetLabel(); | 214 | const auto& setting_label = setting->GetLabel(); |
| 221 | 215 | ||
| 222 | auto [widget, extra] = [&]() { | 216 | auto [widget, extra] = [&]() { |
| 223 | if (setting->Id() == Settings::values.vulkan_device.Id()) { | 217 | if (setting->Id() == Settings::values.vulkan_device.Id() || |
| 218 | setting->Id() == Settings::values.shader_backend.Id() || | ||
| 219 | setting->Id() == Settings::values.vsync_mode.Id()) { | ||
| 224 | return ConfigurationShared::CreateWidget( | 220 | return ConfigurationShared::CreateWidget( |
| 225 | setting, translations, this, runtime_lock, apply_funcs, trackers, | 221 | setting, translations, this, runtime_lock, apply_funcs, trackers, |
| 226 | ConfigurationShared::RequestType::ComboBox); | 222 | ConfigurationShared::RequestType::ComboBox, false); |
| 223 | } else { | ||
| 224 | return ConfigurationShared::CreateWidget(setting, translations, this, runtime_lock, | ||
| 225 | apply_funcs, trackers); | ||
| 227 | } | 226 | } |
| 228 | return ConfigurationShared::CreateWidget(setting, translations, this, runtime_lock, | ||
| 229 | apply_funcs, trackers); | ||
| 230 | }(); | 227 | }(); |
| 231 | 228 | ||
| 232 | if (widget == nullptr) { | 229 | if (widget == nullptr) { |
| @@ -237,11 +234,11 @@ void ConfigureGraphics::SetConfiguration() { | |||
| 237 | api_layout.addWidget(widget); | 234 | api_layout.addWidget(widget); |
| 238 | api_combobox = reinterpret_cast<QComboBox*>(extra); | 235 | api_combobox = reinterpret_cast<QComboBox*>(extra); |
| 239 | } else if (setting->Id() == Settings::values.vulkan_device.Id()) { | 236 | } else if (setting->Id() == Settings::values.vulkan_device.Id()) { |
| 240 | api_layout.addWidget(widget); | 237 | hold_api.push_front(widget); |
| 241 | vulkan_device_combobox = reinterpret_cast<QComboBox*>(extra); | 238 | vulkan_device_combobox = reinterpret_cast<QComboBox*>(extra); |
| 242 | vulkan_device_widget = widget; | 239 | vulkan_device_widget = widget; |
| 243 | } else if (setting->Id() == Settings::values.shader_backend.Id()) { | 240 | } else if (setting->Id() == Settings::values.shader_backend.Id()) { |
| 244 | api_layout.addWidget(widget); | 241 | hold_api.push_front(widget); |
| 245 | shader_backend_combobox = reinterpret_cast<QComboBox*>(extra); | 242 | shader_backend_combobox = reinterpret_cast<QComboBox*>(extra); |
| 246 | shader_backend_widget = widget; | 243 | shader_backend_widget = widget; |
| 247 | } else if (setting->Id() == Settings::values.vsync_mode.Id()) { | 244 | } else if (setting->Id() == Settings::values.vsync_mode.Id()) { |
| @@ -258,86 +255,9 @@ void ConfigureGraphics::SetConfiguration() { | |||
| 258 | } | 255 | } |
| 259 | } | 256 | } |
| 260 | 257 | ||
| 261 | // ui->api_widget->setEnabled(runtime_lock); | 258 | for (auto widget : hold_api) { |
| 262 | // ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); | 259 | api_layout.addWidget(widget); |
| 263 | // ui->use_disk_shader_cache->setEnabled(runtime_lock); | 260 | } |
| 264 | // ui->nvdec_emulation_widget->setEnabled(runtime_lock); | ||
| 265 | // ui->resolution_combobox->setEnabled(runtime_lock); | ||
| 266 | // ui->astc_decode_mode_combobox->setEnabled(runtime_lock); | ||
| 267 | // ui->vsync_mode_layout->setEnabled(runtime_lock || | ||
| 268 | // Settings::values.renderer_backend.GetValue() == | ||
| 269 | // Settings::RendererBackend::Vulkan); | ||
| 270 | // ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue()); | ||
| 271 | // ui->use_asynchronous_gpu_emulation->setChecked( | ||
| 272 | // Settings::values.use_asynchronous_gpu_emulation.GetValue()); | ||
| 273 | |||
| 274 | // if (Settings::IsConfiguringGlobal()) { | ||
| 275 | // api_combobox->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); | ||
| 276 | // ui->fullscreen_mode_combobox->setCurrentIndex( | ||
| 277 | // static_cast<int>(Settings::values.fullscreen_mode.GetValue())); | ||
| 278 | // ui->nvdec_emulation->setCurrentIndex( | ||
| 279 | // static_cast<int>(Settings::values.nvdec_emulation.GetValue())); | ||
| 280 | // ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); | ||
| 281 | // ui->resolution_combobox->setCurrentIndex( | ||
| 282 | // static_cast<int>(Settings::values.resolution_setup.GetValue())); | ||
| 283 | // ui->scaling_filter_combobox->setCurrentIndex( | ||
| 284 | // static_cast<int>(Settings::values.scaling_filter.GetValue())); | ||
| 285 | // ui->fsr_sharpening_slider->setValue(Settings::values.fsr_sharpening_slider.GetValue()); | ||
| 286 | // ui->anti_aliasing_combobox->setCurrentIndex( | ||
| 287 | // static_cast<int>(Settings::values.anti_aliasing.GetValue())); | ||
| 288 | // } else { | ||
| 289 | // ConfigurationShared::SetPerGameSetting(api_combobox, &Settings::values.renderer_backend); | ||
| 290 | // ConfigurationShared::SetHighlight(ui->api_widget, | ||
| 291 | // !Settings::values.renderer_backend.UsingGlobal()); | ||
| 292 | |||
| 293 | // ConfigurationShared::SetPerGameSetting(ui->astc_decode_mode_combobox, | ||
| 294 | // &Settings::values.accelerate_astc); | ||
| 295 | // ConfigurationShared::SetHighlight(ui->astc_decode_mode_layout, | ||
| 296 | // !Settings::values.accelerate_astc.UsingGlobal()); | ||
| 297 | |||
| 298 | // ConfigurationShared::SetPerGameSetting(ui->nvdec_emulation, | ||
| 299 | // &Settings::values.nvdec_emulation); | ||
| 300 | // ConfigurationShared::SetHighlight(ui->nvdec_emulation_widget, | ||
| 301 | // !Settings::values.nvdec_emulation.UsingGlobal()); | ||
| 302 | |||
| 303 | // ConfigurationShared::SetPerGameSetting(ui->fullscreen_mode_combobox, | ||
| 304 | // &Settings::values.fullscreen_mode); | ||
| 305 | // ConfigurationShared::SetHighlight(ui->fullscreen_mode_label, | ||
| 306 | // !Settings::values.fullscreen_mode.UsingGlobal()); | ||
| 307 | |||
| 308 | // ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox, | ||
| 309 | // &Settings::values.aspect_ratio); | ||
| 310 | // ConfigurationShared::SetHighlight(ui->ar_label, | ||
| 311 | // !Settings::values.aspect_ratio.UsingGlobal()); | ||
| 312 | |||
| 313 | // ConfigurationShared::SetPerGameSetting(ui->resolution_combobox, | ||
| 314 | // &Settings::values.resolution_setup); | ||
| 315 | // ConfigurationShared::SetHighlight(ui->resolution_label, | ||
| 316 | // !Settings::values.resolution_setup.UsingGlobal()); | ||
| 317 | |||
| 318 | // ConfigurationShared::SetPerGameSetting(ui->scaling_filter_combobox, | ||
| 319 | // &Settings::values.scaling_filter); | ||
| 320 | // ConfigurationShared::SetHighlight(ui->scaling_filter_label, | ||
| 321 | // !Settings::values.scaling_filter.UsingGlobal()); | ||
| 322 | |||
| 323 | // ConfigurationShared::SetPerGameSetting(ui->anti_aliasing_combobox, | ||
| 324 | // &Settings::values.anti_aliasing); | ||
| 325 | // ConfigurationShared::SetHighlight(ui->anti_aliasing_label, | ||
| 326 | // !Settings::values.anti_aliasing.UsingGlobal()); | ||
| 327 | |||
| 328 | // ui->fsr_sharpening_combobox->setCurrentIndex( | ||
| 329 | // Settings::values.fsr_sharpening_slider.UsingGlobal() ? 0 : 1); | ||
| 330 | // ui->fsr_sharpening_slider->setEnabled( | ||
| 331 | // !Settings::values.fsr_sharpening_slider.UsingGlobal()); | ||
| 332 | // ui->fsr_sharpening_value->setEnabled(!Settings::values.fsr_sharpening_slider.UsingGlobal()); | ||
| 333 | // ConfigurationShared::SetHighlight(ui->fsr_sharpening_layout, | ||
| 334 | // !Settings::values.fsr_sharpening_slider.UsingGlobal()); | ||
| 335 | // ui->fsr_sharpening_slider->setValue(Settings::values.fsr_sharpening_slider.GetValue()); | ||
| 336 | |||
| 337 | // ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); | ||
| 338 | // ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); | ||
| 339 | // ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal()); | ||
| 340 | // } | ||
| 341 | } | 261 | } |
| 342 | 262 | ||
| 343 | void ConfigureGraphics::SetFSRIndicatorText(int percentage) { | 263 | void ConfigureGraphics::SetFSRIndicatorText(int percentage) { |
| @@ -367,134 +287,16 @@ const QString ConfigureGraphics::TranslateVSyncMode(VkPresentModeKHR mode, | |||
| 367 | } | 287 | } |
| 368 | 288 | ||
| 369 | void ConfigureGraphics::ApplyConfiguration() { | 289 | void ConfigureGraphics::ApplyConfiguration() { |
| 370 | // const auto resolution_setup = static_cast<Settings::ResolutionSetup>( | 290 | const bool powered_on = system.IsPoweredOn(); |
| 371 | // ui->resolution_combobox->currentIndex() - | 291 | for (const auto& func : apply_funcs) { |
| 372 | // ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); | 292 | func(powered_on); |
| 373 | 293 | } | |
| 374 | // const auto scaling_filter = static_cast<Settings::ScalingFilter>( | ||
| 375 | // ui->scaling_filter_combobox->currentIndex() - | ||
| 376 | // ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 377 | |||
| 378 | // const auto anti_aliasing = static_cast<Settings::AntiAliasing>( | ||
| 379 | // ui->anti_aliasing_combobox->currentIndex() - | ||
| 380 | // ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 381 | |||
| 382 | // ConfigurationShared::ApplyPerGameSetting(&Settings::values.fullscreen_mode, | ||
| 383 | // ui->fullscreen_mode_combobox); | ||
| 384 | // ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio, | ||
| 385 | // ui->aspect_ratio_combobox); | ||
| 386 | // ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, | ||
| 387 | // ui->use_disk_shader_cache, use_disk_shader_cache); | ||
| 388 | // ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, | ||
| 389 | // ui->use_asynchronous_gpu_emulation, | ||
| 390 | // use_asynchronous_gpu_emulation); | ||
| 391 | // ConfigurationShared::ApplyPerGameSetting(&Settings::values.accelerate_astc, | ||
| 392 | // ui->astc_decode_mode_combobox); | ||
| 393 | |||
| 394 | // if (Settings::IsConfiguringGlobal()) { | ||
| 395 | // // Guard if during game and set to game-specific value | ||
| 396 | // if (Settings::values.renderer_backend.UsingGlobal()) { | ||
| 397 | // Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend()); | ||
| 398 | // } | ||
| 399 | // if (Settings::values.nvdec_emulation.UsingGlobal()) { | ||
| 400 | // Settings::values.nvdec_emulation.SetValue(GetCurrentNvdecEmulation()); | ||
| 401 | // } | ||
| 402 | // if (Settings::values.shader_backend.UsingGlobal()) { | ||
| 403 | // Settings::values.shader_backend.SetValue(shader_backend); | ||
| 404 | // } | ||
| 405 | // if (Settings::values.vulkan_device.UsingGlobal()) { | ||
| 406 | // Settings::values.vulkan_device.SetValue(vulkan_device); | ||
| 407 | // } | ||
| 408 | // if (Settings::values.bg_red.UsingGlobal()) { | ||
| 409 | // Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red())); | ||
| 410 | // Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green())); | ||
| 411 | // Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue())); | ||
| 412 | // } | ||
| 413 | // if (Settings::values.resolution_setup.UsingGlobal()) { | ||
| 414 | // Settings::values.resolution_setup.SetValue(resolution_setup); | ||
| 415 | // } | ||
| 416 | // if (Settings::values.scaling_filter.UsingGlobal()) { | ||
| 417 | // Settings::values.scaling_filter.SetValue(scaling_filter); | ||
| 418 | // } | ||
| 419 | // if (Settings::values.anti_aliasing.UsingGlobal()) { | ||
| 420 | // Settings::values.anti_aliasing.SetValue(anti_aliasing); | ||
| 421 | // } | ||
| 422 | // Settings::values.fsr_sharpening_slider.SetValue(ui->fsr_sharpening_slider->value()); | ||
| 423 | |||
| 424 | // const auto mode = vsync_mode_combobox_enum_map[vsync_mode_combobox->currentIndex()]; | ||
| 425 | // const auto vsync_mode = PresentModeToSetting(mode); | ||
| 426 | // Settings::values.vsync_mode.SetValue(vsync_mode); | ||
| 427 | // } else { | ||
| 428 | // if (ui->resolution_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 429 | // Settings::values.resolution_setup.SetGlobal(true); | ||
| 430 | // } else { | ||
| 431 | // Settings::values.resolution_setup.SetGlobal(false); | ||
| 432 | // Settings::values.resolution_setup.SetValue(resolution_setup); | ||
| 433 | // } | ||
| 434 | // if (ui->scaling_filter_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) | ||
| 435 | // { | ||
| 436 | // Settings::values.scaling_filter.SetGlobal(true); | ||
| 437 | // } else { | ||
| 438 | // Settings::values.scaling_filter.SetGlobal(false); | ||
| 439 | // Settings::values.scaling_filter.SetValue(scaling_filter); | ||
| 440 | // } | ||
| 441 | // if (ui->anti_aliasing_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) | ||
| 442 | // { | ||
| 443 | // Settings::values.anti_aliasing.SetGlobal(true); | ||
| 444 | // } else { | ||
| 445 | // Settings::values.anti_aliasing.SetGlobal(false); | ||
| 446 | // Settings::values.anti_aliasing.SetValue(anti_aliasing); | ||
| 447 | // } | ||
| 448 | // if (api_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 449 | // Settings::values.renderer_backend.SetGlobal(true); | ||
| 450 | // Settings::values.shader_backend.SetGlobal(true); | ||
| 451 | // Settings::values.vulkan_device.SetGlobal(true); | ||
| 452 | // } else { | ||
| 453 | // Settings::values.renderer_backend.SetGlobal(false); | ||
| 454 | // Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend()); | ||
| 455 | // switch (GetCurrentGraphicsBackend()) { | ||
| 456 | // case Settings::RendererBackend::OpenGL: | ||
| 457 | // case Settings::RendererBackend::Null: | ||
| 458 | // Settings::values.shader_backend.SetGlobal(false); | ||
| 459 | // Settings::values.vulkan_device.SetGlobal(true); | ||
| 460 | // Settings::values.shader_backend.SetValue(shader_backend); | ||
| 461 | // break; | ||
| 462 | // case Settings::RendererBackend::Vulkan: | ||
| 463 | // Settings::values.shader_backend.SetGlobal(true); | ||
| 464 | // Settings::values.vulkan_device.SetGlobal(false); | ||
| 465 | // Settings::values.vulkan_device.SetValue(vulkan_device); | ||
| 466 | // break; | ||
| 467 | // } | ||
| 468 | // } | ||
| 469 | |||
| 470 | // if (ui->nvdec_emulation->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 471 | // Settings::values.nvdec_emulation.SetGlobal(true); | ||
| 472 | // } else { | ||
| 473 | // Settings::values.nvdec_emulation.SetGlobal(false); | ||
| 474 | // Settings::values.nvdec_emulation.SetValue(GetCurrentNvdecEmulation()); | ||
| 475 | // } | ||
| 476 | |||
| 477 | // if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 478 | // Settings::values.bg_red.SetGlobal(true); | ||
| 479 | // Settings::values.bg_green.SetGlobal(true); | ||
| 480 | // Settings::values.bg_blue.SetGlobal(true); | ||
| 481 | // } else { | ||
| 482 | // Settings::values.bg_red.SetGlobal(false); | ||
| 483 | // Settings::values.bg_green.SetGlobal(false); | ||
| 484 | // Settings::values.bg_blue.SetGlobal(false); | ||
| 485 | // Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red())); | ||
| 486 | // Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green())); | ||
| 487 | // Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue())); | ||
| 488 | // } | ||
| 489 | 294 | ||
| 490 | // if (ui->fsr_sharpening_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) | 295 | if (Settings::IsConfiguringGlobal()) { |
| 491 | // { | 296 | const auto mode = vsync_mode_combobox_enum_map[vsync_mode_combobox->currentIndex()]; |
| 492 | // Settings::values.fsr_sharpening_slider.SetGlobal(true); | 297 | const auto vsync_mode = PresentModeToSetting(mode); |
| 493 | // } else { | 298 | Settings::values.vsync_mode.SetValue(vsync_mode); |
| 494 | // Settings::values.fsr_sharpening_slider.SetGlobal(false); | 299 | } |
| 495 | // Settings::values.fsr_sharpening_slider.SetValue(ui->fsr_sharpening_slider->value()); | ||
| 496 | // } | ||
| 497 | // } | ||
| 498 | } | 300 | } |
| 499 | 301 | ||
| 500 | void ConfigureGraphics::changeEvent(QEvent* event) { | 302 | void ConfigureGraphics::changeEvent(QEvent* event) { |
| @@ -581,83 +383,3 @@ Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { | |||
| 581 | return static_cast<Settings::RendererBackend>(api_combobox->currentIndex() - | 383 | return static_cast<Settings::RendererBackend>(api_combobox->currentIndex() - |
| 582 | ConfigurationShared::USE_GLOBAL_OFFSET); | 384 | ConfigurationShared::USE_GLOBAL_OFFSET); |
| 583 | } | 385 | } |
| 584 | |||
| 585 | Settings::NvdecEmulation ConfigureGraphics::GetCurrentNvdecEmulation() const { | ||
| 586 | return Settings::NvdecEmulation::CPU; | ||
| 587 | // if (Settings::IsConfiguringGlobal()) { | ||
| 588 | // return static_cast<Settings::NvdecEmulation>(ui->nvdec_emulation->currentIndex()); | ||
| 589 | // } | ||
| 590 | |||
| 591 | // if (ui->nvdec_emulation->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 592 | // Settings::values.nvdec_emulation.SetGlobal(true); | ||
| 593 | // return Settings::values.nvdec_emulation.GetValue(); | ||
| 594 | // } | ||
| 595 | // Settings::values.nvdec_emulation.SetGlobal(false); | ||
| 596 | // return static_cast<Settings::NvdecEmulation>(ui->nvdec_emulation->currentIndex() - | ||
| 597 | // ConfigurationShared::USE_GLOBAL_OFFSET); | ||
| 598 | } | ||
| 599 | |||
| 600 | void ConfigureGraphics::SetupPerGameUI() { | ||
| 601 | // if (Settings::IsConfiguringGlobal()) { | ||
| 602 | // api_combobox->setEnabled(Settings::values.renderer_backend.UsingGlobal()); | ||
| 603 | // vulkan_device_combobox->setEnabled(Settings::values.renderer_backend.UsingGlobal()); | ||
| 604 | // ui->fullscreen_mode_combobox->setEnabled(Settings::values.fullscreen_mode.UsingGlobal()); | ||
| 605 | // ui->aspect_ratio_combobox->setEnabled(Settings::values.aspect_ratio.UsingGlobal()); | ||
| 606 | // ui->resolution_combobox->setEnabled(Settings::values.resolution_setup.UsingGlobal()); | ||
| 607 | // ui->scaling_filter_combobox->setEnabled(Settings::values.scaling_filter.UsingGlobal()); | ||
| 608 | // ui->fsr_sharpening_slider->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal()); | ||
| 609 | // ui->anti_aliasing_combobox->setEnabled(Settings::values.anti_aliasing.UsingGlobal()); | ||
| 610 | // ui->use_asynchronous_gpu_emulation->setEnabled( | ||
| 611 | // Settings::values.use_asynchronous_gpu_emulation.UsingGlobal()); | ||
| 612 | // ui->nvdec_emulation->setEnabled(Settings::values.nvdec_emulation.UsingGlobal()); | ||
| 613 | // ui->astc_decode_mode_combobox->setEnabled(Settings::values.accelerate_astc.UsingGlobal()); | ||
| 614 | // ui->use_disk_shader_cache->setEnabled(Settings::values.use_disk_shader_cache.UsingGlobal()); | ||
| 615 | // ui->bg_button->setEnabled(Settings::values.bg_red.UsingGlobal()); | ||
| 616 | // ui->fsr_slider_layout->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal()); | ||
| 617 | |||
| 618 | // return; | ||
| 619 | // } | ||
| 620 | |||
| 621 | // connect(ui->bg_combobox, qOverload<int>(&QComboBox::activated), this, [this](int index) { | ||
| 622 | // ui->bg_button->setEnabled(index == 1); | ||
| 623 | // ConfigurationShared::SetHighlight(ui->bg_layout, index == 1); | ||
| 624 | // }); | ||
| 625 | |||
| 626 | // connect(ui->fsr_sharpening_combobox, qOverload<int>(&QComboBox::activated), this, | ||
| 627 | // [this](int index) { | ||
| 628 | // ui->fsr_sharpening_slider->setEnabled(index == 1); | ||
| 629 | // ui->fsr_sharpening_value->setEnabled(index == 1); | ||
| 630 | // ConfigurationShared::SetHighlight(ui->fsr_sharpening_layout, index == 1); | ||
| 631 | // }); | ||
| 632 | |||
| 633 | // ConfigurationShared::SetColoredTristate( | ||
| 634 | // ui->use_disk_shader_cache, Settings::values.use_disk_shader_cache, | ||
| 635 | // use_disk_shader_cache); | ||
| 636 | // ConfigurationShared::SetColoredTristate(ui->use_asynchronous_gpu_emulation, | ||
| 637 | // Settings::values.use_asynchronous_gpu_emulation, | ||
| 638 | // use_asynchronous_gpu_emulation); | ||
| 639 | |||
| 640 | // ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, | ||
| 641 | // Settings::values.aspect_ratio.GetValue(true)); | ||
| 642 | // ConfigurationShared::SetColoredComboBox( | ||
| 643 | // ui->fullscreen_mode_combobox, ui->fullscreen_mode_label, | ||
| 644 | // static_cast<int>(Settings::values.fullscreen_mode.GetValue(true))); | ||
| 645 | // ConfigurationShared::SetColoredComboBox( | ||
| 646 | // ui->resolution_combobox, ui->resolution_label, | ||
| 647 | // static_cast<int>(Settings::values.resolution_setup.GetValue(true))); | ||
| 648 | // ConfigurationShared::SetColoredComboBox( | ||
| 649 | // ui->scaling_filter_combobox, ui->scaling_filter_label, | ||
| 650 | // static_cast<int>(Settings::values.scaling_filter.GetValue(true))); | ||
| 651 | // ConfigurationShared::SetColoredComboBox( | ||
| 652 | // ui->anti_aliasing_combobox, ui->anti_aliasing_label, | ||
| 653 | // static_cast<int>(Settings::values.anti_aliasing.GetValue(true))); | ||
| 654 | // ConfigurationShared::SetColoredComboBox( | ||
| 655 | // ui->astc_decode_mode_combobox, ui->astc_decode_mode_label, | ||
| 656 | // static_cast<int>(Settings::values.accelerate_astc.GetValue(true))); | ||
| 657 | // ConfigurationShared::InsertGlobalItem( | ||
| 658 | // api_combobox, static_cast<int>(Settings::values.renderer_backend.GetValue(true))); | ||
| 659 | // ConfigurationShared::InsertGlobalItem( | ||
| 660 | // ui->nvdec_emulation, static_cast<int>(Settings::values.nvdec_emulation.GetValue(true))); | ||
| 661 | |||
| 662 | // ui->vsync_mode_layout->setVisible(false); | ||
| 663 | } | ||
diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 30dfb6163..c226e825b 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h | |||
| @@ -64,10 +64,7 @@ private: | |||
| 64 | const QString TranslateVSyncMode(VkPresentModeKHR mode, | 64 | const QString TranslateVSyncMode(VkPresentModeKHR mode, |
| 65 | Settings::RendererBackend backend) const; | 65 | Settings::RendererBackend backend) const; |
| 66 | 66 | ||
| 67 | void SetupPerGameUI(); | ||
| 68 | |||
| 69 | Settings::RendererBackend GetCurrentGraphicsBackend() const; | 67 | Settings::RendererBackend GetCurrentGraphicsBackend() const; |
| 70 | Settings::NvdecEmulation GetCurrentNvdecEmulation() const; | ||
| 71 | 68 | ||
| 72 | std::unique_ptr<Ui::ConfigureGraphics> ui; | 69 | std::unique_ptr<Ui::ConfigureGraphics> ui; |
| 73 | QColor bg_color; | 70 | QColor bg_color; |
| @@ -93,5 +90,6 @@ private: | |||
| 93 | QComboBox* shader_backend_combobox; | 90 | QComboBox* shader_backend_combobox; |
| 94 | QComboBox* vsync_mode_combobox; | 91 | QComboBox* vsync_mode_combobox; |
| 95 | QWidget* vulkan_device_widget; | 92 | QWidget* vulkan_device_widget; |
| 93 | QWidget* api_widget; | ||
| 96 | QWidget* shader_backend_widget; | 94 | QWidget* shader_backend_widget; |
| 97 | }; | 95 | }; |