diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/settings.cpp | 5 | ||||
| -rw-r--r-- | src/common/settings.h | 10 | ||||
| -rw-r--r-- | src/common/settings_common.h | 1 | ||||
| -rw-r--r-- | src/common/settings_enums.h | 2 | ||||
| -rw-r--r-- | src/common/swap.h | 5 |
5 files changed, 17 insertions, 6 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 16a58a750..524056841 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <version> | 4 | #include <version> |
| 5 | #include "common/settings_enums.h" | ||
| 5 | #if __cpp_lib_chrono >= 201907L | 6 | #if __cpp_lib_chrono >= 201907L |
| 6 | #include <chrono> | 7 | #include <chrono> |
| 7 | #include <exception> | 8 | #include <exception> |
| @@ -145,6 +146,10 @@ bool IsFastmemEnabled() { | |||
| 145 | return true; | 146 | return true; |
| 146 | } | 147 | } |
| 147 | 148 | ||
| 149 | bool IsDockedMode() { | ||
| 150 | return values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked; | ||
| 151 | } | ||
| 152 | |||
| 148 | float Volume() { | 153 | float Volume() { |
| 149 | if (values.audio_muted) { | 154 | if (values.audio_muted) { |
| 150 | return 0.0f; | 155 | return 0.0f; |
diff --git a/src/common/settings.h b/src/common/settings.h index 4407c1e6d..b15213bd7 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -379,7 +379,13 @@ struct Values { | |||
| 379 | 379 | ||
| 380 | Setting<s32> current_user{linkage, 0, "current_user", Category::System}; | 380 | Setting<s32> current_user{linkage, 0, "current_user", Category::System}; |
| 381 | 381 | ||
| 382 | SwitchableSetting<bool> use_docked_mode{linkage, true, "use_docked_mode", Category::System}; | 382 | SwitchableSetting<ConsoleMode> use_docked_mode{linkage, |
| 383 | ConsoleMode::Docked, | ||
| 384 | "use_docked_mode", | ||
| 385 | Category::System, | ||
| 386 | Specialization::Radio, | ||
| 387 | true, | ||
| 388 | true}; | ||
| 383 | 389 | ||
| 384 | // Controls | 390 | // Controls |
| 385 | InputSetting<std::array<PlayerInput, 10>> players; | 391 | InputSetting<std::array<PlayerInput, 10>> players; |
| @@ -519,6 +525,8 @@ bool IsGPULevelHigh(); | |||
| 519 | 525 | ||
| 520 | bool IsFastmemEnabled(); | 526 | bool IsFastmemEnabled(); |
| 521 | 527 | ||
| 528 | bool IsDockedMode(); | ||
| 529 | |||
| 522 | float Volume(); | 530 | float Volume(); |
| 523 | 531 | ||
| 524 | std::string GetTimeZoneString(TimeZone time_zone); | 532 | std::string GetTimeZoneString(TimeZone time_zone); |
diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 2efb329b0..3082e0ce1 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h | |||
| @@ -56,6 +56,7 @@ enum Specialization : u8 { | |||
| 56 | Scalar = 5, // Values are continuous | 56 | Scalar = 5, // Values are continuous |
| 57 | Countable = 6, // Can be stepped through | 57 | Countable = 6, // Can be stepped through |
| 58 | Paired = 7, // Another setting is associated with this setting | 58 | Paired = 7, // Another setting is associated with this setting |
| 59 | Radio = 8, // Setting should be presented in a radio group | ||
| 59 | 60 | ||
| 60 | Percentage = (1 << SpecializationAttributeOffset), // Should be represented as a percentage | 61 | Percentage = (1 << SpecializationAttributeOffset), // Should be represented as a percentage |
| 61 | }; | 62 | }; |
diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index e7cb59ea5..815cafe15 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h | |||
| @@ -146,6 +146,8 @@ ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum); | |||
| 146 | 146 | ||
| 147 | ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); | 147 | ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); |
| 148 | 148 | ||
| 149 | ENUM(ConsoleMode, Handheld, Docked); | ||
| 150 | |||
| 149 | template <typename Type> | 151 | template <typename Type> |
| 150 | inline std::string CanonicalizeEnum(Type id) { | 152 | inline std::string CanonicalizeEnum(Type id) { |
| 151 | const auto group = EnumMetadata<Type>::Canonicalizations(); | 153 | const auto group = EnumMetadata<Type>::Canonicalizations(); |
diff --git a/src/common/swap.h b/src/common/swap.h index 085baaf9a..fde343e45 100644 --- a/src/common/swap.h +++ b/src/common/swap.h | |||
| @@ -460,11 +460,6 @@ S operator&(const S& i, const swap_struct_t<T, F> v) { | |||
| 460 | return i & v.swap(); | 460 | return i & v.swap(); |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | template <typename S, typename T, typename F> | ||
| 464 | S operator&(const swap_struct_t<T, F> v, const S& i) { | ||
| 465 | return static_cast<S>(v.swap() & i); | ||
| 466 | } | ||
| 467 | |||
| 468 | // Comparison | 463 | // Comparison |
| 469 | template <typename S, typename T, typename F> | 464 | template <typename S, typename T, typename F> |
| 470 | bool operator<(const S& p, const swap_struct_t<T, F> v) { | 465 | bool operator<(const S& p, const swap_struct_t<T, F> v) { |