summaryrefslogtreecommitdiff
path: root/src/citra_qt
diff options
context:
space:
mode:
authorGravatar bunnei2016-12-29 23:28:27 -0500
committerGravatar bunnei2017-01-07 03:23:22 -0500
commit22ad9094e6355e84f2e45abcd66748b2c74dfaf9 (patch)
tree1124bc25253f2c4f6adc7ec9a90aa9a3d2213ba6 /src/citra_qt
parentMerge pull request #2410 from Subv/sleepthread (diff)
downloadyuzu-22ad9094e6355e84f2e45abcd66748b2c74dfaf9.tar.gz
yuzu-22ad9094e6355e84f2e45abcd66748b2c74dfaf9.tar.xz
yuzu-22ad9094e6355e84f2e45abcd66748b2c74dfaf9.zip
config: Add option for specifying screen resolution scale factor.
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/config.cpp5
-rw-r--r--src/citra_qt/configure_graphics.cpp76
-rw-r--r--src/citra_qt/configure_graphics.ui86
3 files changed, 154 insertions, 13 deletions
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index c904c4b00..8021667d0 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -44,8 +44,7 @@ void Config::ReadValues() {
44 qt_config->beginGroup("Renderer"); 44 qt_config->beginGroup("Renderer");
45 Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool(); 45 Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool();
46 Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool(); 46 Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool();
47 Settings::values.use_scaled_resolution = 47 Settings::values.resolution_factor = qt_config->value("resolution_factor", 1.0).toFloat();
48 qt_config->value("use_scaled_resolution", false).toBool();
49 Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool(); 48 Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool();
50 Settings::values.toggle_framelimit = qt_config->value("toggle_framelimit", true).toBool(); 49 Settings::values.toggle_framelimit = qt_config->value("toggle_framelimit", true).toBool();
51 50
@@ -152,7 +151,7 @@ void Config::SaveValues() {
152 qt_config->beginGroup("Renderer"); 151 qt_config->beginGroup("Renderer");
153 qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer); 152 qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer);
154 qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit); 153 qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit);
155 qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution); 154 qt_config->setValue("resolution_factor", (double)Settings::values.resolution_factor);
156 qt_config->setValue("use_vsync", Settings::values.use_vsync); 155 qt_config->setValue("use_vsync", Settings::values.use_vsync);
157 qt_config->setValue("toggle_framelimit", Settings::values.toggle_framelimit); 156 qt_config->setValue("toggle_framelimit", Settings::values.toggle_framelimit);
158 157
diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp
index cea7db388..54f799b47 100644
--- a/src/citra_qt/configure_graphics.cpp
+++ b/src/citra_qt/configure_graphics.cpp
@@ -18,10 +18,81 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
18 18
19ConfigureGraphics::~ConfigureGraphics() {} 19ConfigureGraphics::~ConfigureGraphics() {}
20 20
21enum class Resolution : int {
22 Auto,
23 Scale1x,
24 Scale2x,
25 Scale3x,
26 Scale4x,
27 Scale5x,
28 Scale6x,
29 Scale7x,
30 Scale8x,
31 Scale9x,
32 Scale10x,
33};
34
35float ToResolutionFactor(Resolution option) {
36 switch (option) {
37 case Resolution::Auto:
38 return 0.f;
39 case Resolution::Scale1x:
40 return 1.f;
41 case Resolution::Scale2x:
42 return 2.f;
43 case Resolution::Scale3x:
44 return 3.f;
45 case Resolution::Scale4x:
46 return 4.f;
47 case Resolution::Scale5x:
48 return 5.f;
49 case Resolution::Scale6x:
50 return 6.f;
51 case Resolution::Scale7x:
52 return 7.f;
53 case Resolution::Scale8x:
54 return 8.f;
55 case Resolution::Scale9x:
56 return 9.f;
57 case Resolution::Scale10x:
58 return 10.f;
59 }
60 return 0.f;
61}
62
63Resolution FromResolutionFactor(float factor) {
64 if (factor == 0.f) {
65 return Resolution::Auto;
66 } else if (factor == 1.f) {
67 return Resolution::Scale1x;
68 } else if (factor == 2.f) {
69 return Resolution::Scale2x;
70 } else if (factor == 3.f) {
71 return Resolution::Scale3x;
72 } else if (factor == 4.f) {
73 return Resolution::Scale4x;
74 } else if (factor == 5.f) {
75 return Resolution::Scale5x;
76 } else if (factor == 6.f) {
77 return Resolution::Scale6x;
78 } else if (factor == 7.f) {
79 return Resolution::Scale7x;
80 } else if (factor == 8.f) {
81 return Resolution::Scale8x;
82 } else if (factor == 9.f) {
83 return Resolution::Scale9x;
84 } else if (factor == 10.f) {
85 return Resolution::Scale10x;
86 }
87 return Resolution::Auto;
88}
89
21void ConfigureGraphics::setConfiguration() { 90void ConfigureGraphics::setConfiguration() {
22 ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer); 91 ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
92 ui->resolution_factor_combobox->setEnabled(Settings::values.use_hw_renderer);
23 ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit); 93 ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit);
24 ui->toggle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution); 94 ui->resolution_factor_combobox->setCurrentIndex(
95 static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor)));
25 ui->toggle_vsync->setChecked(Settings::values.use_vsync); 96 ui->toggle_vsync->setChecked(Settings::values.use_vsync);
26 ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit); 97 ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit);
27 ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option)); 98 ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
@@ -31,7 +102,8 @@ void ConfigureGraphics::setConfiguration() {
31void ConfigureGraphics::applyConfiguration() { 102void ConfigureGraphics::applyConfiguration() {
32 Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked(); 103 Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked();
33 Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked(); 104 Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked();
34 Settings::values.use_scaled_resolution = ui->toggle_scaled_resolution->isChecked(); 105 Settings::values.resolution_factor =
106 ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
35 Settings::values.use_vsync = ui->toggle_vsync->isChecked(); 107 Settings::values.use_vsync = ui->toggle_vsync->isChecked();
36 Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked(); 108 Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked();
37 Settings::values.layout_option = 109 Settings::values.layout_option =
diff --git a/src/citra_qt/configure_graphics.ui b/src/citra_qt/configure_graphics.ui
index 964aa0bbd..62021fe22 100644
--- a/src/citra_qt/configure_graphics.ui
+++ b/src/citra_qt/configure_graphics.ui
@@ -37,13 +37,6 @@
37 </widget> 37 </widget>
38 </item> 38 </item>
39 <item> 39 <item>
40 <widget class="QCheckBox" name="toggle_scaled_resolution">
41 <property name="text">
42 <string>Enable scaled resolution</string>
43 </property>
44 </widget>
45 </item>
46 <item>
47 <widget class="QCheckBox" name="toggle_vsync"> 40 <widget class="QCheckBox" name="toggle_vsync">
48 <property name="text"> 41 <property name="text">
49 <string>Enable V-Sync</string> 42 <string>Enable V-Sync</string>
@@ -57,6 +50,76 @@
57 </property> 50 </property>
58 </widget> 51 </widget>
59 </item> 52 </item>
53 <item>
54 <layout class="QHBoxLayout" name="horizontalLayout">
55 <item>
56 <widget class="QLabel" name="label">
57 <property name="text">
58 <string>Internal Resolution:</string>
59 </property>
60 </widget>
61 </item>
62 <item>
63 <widget class="QComboBox" name="resolution_factor_combobox">
64 <item>
65 <property name="text">
66 <string notr="true">Auto (Window Size)</string>
67 </property>
68 </item>
69 <item>
70 <property name="text">
71 <string notr="true">Native (400x240)</string>
72 </property>
73 </item>
74 <item>
75 <property name="text">
76 <string notr="true">2x Native (800x480)</string>
77 </property>
78 </item>
79 <item>
80 <property name="text">
81 <string notr="true">3x Native (1200x720)</string>
82 </property>
83 </item>
84 <item>
85 <property name="text">
86 <string notr="true">4x Native (1600x960)</string>
87 </property>
88 </item>
89 <item>
90 <property name="text">
91 <string notr="true">5x Native (2000x1200)</string>
92 </property>
93 </item>
94 <item>
95 <property name="text">
96 <string notr="true">6x Native (2400x1440)</string>
97 </property>
98 </item>
99 <item>
100 <property name="text">
101 <string notr="true">7x Native (2800x1680)</string>
102 </property>
103 </item>
104 <item>
105 <property name="text">
106 <string notr="true">8x Native (3200x1920)</string>
107 </property>
108 </item>
109 <item>
110 <property name="text">
111 <string notr="true">9x Native (3600x2160)</string>
112 </property>
113 </item>
114 <item>
115 <property name="text">
116 <string notr="true">10x Native (4000x2400)</string>
117 </property>
118 </item>
119 </widget>
120 </item>
121 </layout>
122 </item>
60 </layout> 123 </layout>
61 </widget> 124 </widget>
62 </item> 125 </item>
@@ -128,5 +191,12 @@
128 </layout> 191 </layout>
129 </widget> 192 </widget>
130 <resources/> 193 <resources/>
131 <connections/> 194 <connections>
195 <connection>
196 <sender>toggle_hw_renderer</sender>
197 <signal>toggled(bool)</signal>
198 <receiver>resolution_factor_combobox</receiver>
199 <slot>setEnabled(bool)</slot>
200 </connection>
201 </connections>
132</ui> 202</ui>