1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <vector>
#include <QCheckBox>
#include <QLabel>
#include <QSlider>
#include <qnamespace.h>
#include "common/settings.h"
#include "core/core.h"
#include "qt_common/config/shared_translation.h"
#include "ui_configure_graphics_extensions.h"
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_graphics_extensions.h"
#include "yuzu/configuration/shared_widget.h"
ConfigureGraphicsExtensions::ConfigureGraphicsExtensions(
const Core::System& system_, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_,
const ConfigurationShared::Builder& builder, QWidget* parent)
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGraphicsExtensions>()},
system{system_} {
ui->setupUi(this);
Setup(builder);
SetConfiguration();
}
ConfigureGraphicsExtensions::~ConfigureGraphicsExtensions() = default;
void ConfigureGraphicsExtensions::SetConfiguration() {}
void ConfigureGraphicsExtensions::Setup(const ConfigurationShared::Builder& builder) {
auto& layout = *ui->populate_target->layout();
std::map<u32, QWidget*> hold{}; // A map will sort the data for us
for (auto setting :
Settings::values.linkage.by_category[Settings::Category::RendererExtensions]) {
ConfigurationShared::Widget* widget = [&]() {
if (setting->Id() == Settings::values.sample_shading.Id()) {
// TODO(crueter): should support this natively perhaps?
return builder.BuildWidget(
setting, apply_funcs, ConfigurationShared::RequestType::Slider, true, 1.0f,
nullptr, tr("%", "Sample Shading percentage (e.g. 50%)"));
} else {
return builder.BuildWidget(setting, apply_funcs);
}
}();
if (widget == nullptr) {
continue;
}
if (!widget->Valid()) {
widget->deleteLater();
continue;
}
hold.emplace(setting->Id(), widget);
#ifdef __APPLE__
if (setting->Id() == Settings::values.dyna_state.Id()) {
widget->setEnabled(false);
widget->setToolTip(tr("Extended Dynamic State is disabled on macOS due to MoltenVK "
"compatibility issues that cause black screens."));
}
#endif
}
for (const auto& [id, widget] : hold) {
layout.addWidget(widget);
}
auto& hacks = *ui->hacks_target->layout();
std::map<u32, QWidget*> hacks_hold{}; // A map will sort the data for us
for (auto setting : Settings::values.linkage.by_category[Settings::Category::RendererHacks]) {
auto* widget = builder.BuildWidget(setting, apply_funcs);
if (widget == nullptr) {
continue;
}
if (!widget->Valid()) {
widget->deleteLater();
continue;
}
hacks_hold.emplace(setting->Id(), widget);
}
for (const auto& [id, widget] : hacks_hold) {
hacks.addWidget(widget);
}
}
void ConfigureGraphicsExtensions::ApplyConfiguration() {
const bool is_powered_on = system.IsPoweredOn();
for (const auto& func : apply_funcs) {
func(is_powered_on);
}
}
void ConfigureGraphicsExtensions::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureGraphicsExtensions::RetranslateUI() {
ui->retranslateUi(this);
}
|