소스 검색

settings: Add AspectRatio enum, split res scale function

lat9nq 2 년 전
부모
커밋
3e28e85468
3개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 7 3
      src/common/settings.cpp
  2. 1 0
      src/common/settings.h
  3. 2 0
      src/common/settings_enums.h

+ 7 - 3
src/common/settings.cpp

@@ -207,9 +207,7 @@ const char* TranslateCategory(Category category) {
     return "Miscellaneous";
     return "Miscellaneous";
 }
 }
 
 
-void UpdateRescalingInfo() {
-    const auto setup = values.resolution_setup.GetValue();
-    auto& info = values.resolution_info;
+void TranslateResolutionInfo(ResolutionSetup setup, ResolutionScalingInfo& info) {
     info.downscale = false;
     info.downscale = false;
     switch (setup) {
     switch (setup) {
     case ResolutionSetup::Res1_2X:
     case ResolutionSetup::Res1_2X:
@@ -269,6 +267,12 @@ void UpdateRescalingInfo() {
     info.active = info.up_scale != 1 || info.down_shift != 0;
     info.active = info.up_scale != 1 || info.down_shift != 0;
 }
 }
 
 
+void UpdateRescalingInfo() {
+    const auto setup = values.resolution_setup.GetValue();
+    auto& info = values.resolution_info;
+    TranslateResolutionInfo(setup, info);
+}
+
 void RestoreGlobalState(bool is_powered_on) {
 void RestoreGlobalState(bool is_powered_on) {
     // If a game is running, DO NOT restore the global settings state
     // If a game is running, DO NOT restore the global settings state
     if (is_powered_on) {
     if (is_powered_on) {

+ 1 - 0
src/common/settings.h

@@ -525,6 +525,7 @@ std::string GetTimeZoneString(TimeZone time_zone);
 
 
 void LogSettings();
 void LogSettings();
 
 
+void TranslateResolutionInfo(ResolutionSetup setup, ResolutionScalingInfo& info);
 void UpdateRescalingInfo();
 void UpdateRescalingInfo();
 
 
 // Restore the global state of all applicable settings in the Values struct
 // Restore the global state of all applicable settings in the Values struct

+ 2 - 0
src/common/settings_enums.h

@@ -146,6 +146,8 @@ ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum);
 
 
 ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch);
 ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch);
 
 
+ENUM(ScreenshotAspectRatio, Auto, R16_9, R4_3, R21_9, R16_10);
+
 template <typename Type>
 template <typename Type>
 inline std::string CanonicalizeEnum(Type id) {
 inline std::string CanonicalizeEnum(Type id) {
     const auto group = EnumMetadata<Type>::Canonicalizations();
     const auto group = EnumMetadata<Type>::Canonicalizations();