summaryrefslogtreecommitdiff
path: root/src/common/settings.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2021-07-18 20:33:20 +0200
committerGravatar Fernando Sahmkow2021-11-16 22:11:27 +0100
commit37ef9c913028e234509bcf70bad049b0210e4592 (patch)
tree4502ff26068fcbef55b36679c7afdc546182bf36 /src/common/settings.cpp
parentVideoCore: Initial Setup for the Resolution Scaler. (diff)
downloadyuzu-37ef9c913028e234509bcf70bad049b0210e4592.tar.gz
yuzu-37ef9c913028e234509bcf70bad049b0210e4592.tar.xz
yuzu-37ef9c913028e234509bcf70bad049b0210e4592.zip
Settings: Add resolution scaling to settings.
Diffstat (limited to 'src/common/settings.cpp')
-rw-r--r--src/common/settings.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 8c6be2c84..dd3a3d456 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -106,6 +106,57 @@ float Volume() {
106 return values.volume.GetValue() / 100.0f; 106 return values.volume.GetValue() / 100.0f;
107} 107}
108 108
109void UpdateRescalingInfo() {
110 auto setup = values.resolution_setup.GetValue();
111 auto& info = values.resolution_info;
112 switch (setup) {
113 case ResolutionSetup::Res1_2X: {
114 info.up_scale = 1;
115 info.down_shift = 1;
116 break;
117 }
118 case ResolutionSetup::Res3_4X: {
119 info.up_scale = 3;
120 info.down_shift = 2;
121 break;
122 }
123 case ResolutionSetup::Res1X: {
124 info.up_scale = 1;
125 info.down_shift = 0;
126 break;
127 }
128 case ResolutionSetup::Res3_2X: {
129 info.up_scale = 3;
130 info.down_shift = 1;
131 break;
132 }
133 case ResolutionSetup::Res2X: {
134 info.up_scale = 2;
135 info.down_shift = 0;
136 break;
137 }
138 case ResolutionSetup::Res3X: {
139 info.up_scale = 3;
140 info.down_shift = 0;
141 break;
142 }
143 case ResolutionSetup::Res4X: {
144 info.up_scale = 4;
145 info.down_shift = 0;
146 break;
147 }
148 default: {
149 UNREACHABLE();
150 info.up_scale = 1;
151 info.down_shift = 0;
152 }
153 }
154 info.up_factor = static_cast<f32>(info.up_scale) / (1U << info.down_shift);
155 info.down_factor = static_cast<f32>(1U << info.down_shift) / info.up_scale;
156 info.size_up = info.up_scale * info.up_scale;
157 info.size_shift = info.down_shift * 2;
158}
159
109void RestoreGlobalState(bool is_powered_on) { 160void RestoreGlobalState(bool is_powered_on) {
110 // If a game is running, DO NOT restore the global settings state 161 // If a game is running, DO NOT restore the global settings state
111 if (is_powered_on) { 162 if (is_powered_on) {