From 387ede76d2e1e427f6722cbe19a018c95d762748 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:03:30 -0400 Subject: general: Convert use_docked_mode to an enumeration Allows some special interactions with it in the Qt frontend. --- src/common/settings.h | 8 +++++++- src/common/settings_common.h | 1 + src/common/settings_enums.h | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/settings.h b/src/common/settings.h index 4407c1e6d..6d44fc626 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -379,7 +379,13 @@ struct Values { Setting current_user{linkage, 0, "current_user", Category::System}; - SwitchableSetting use_docked_mode{linkage, true, "use_docked_mode", Category::System}; + SwitchableSetting use_docked_mode{linkage, + ConsoleMode::Docked, + "use_docked_mode", + Category::System, + Specialization::Radio, + true, + true}; // Controls InputSetting> players; 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 { Scalar = 5, // Values are continuous Countable = 6, // Can be stepped through Paired = 7, // Another setting is associated with this setting + Radio = 8, // Setting should be presented in a radio group Percentage = (1 << SpecializationAttributeOffset), // Should be represented as a percentage }; 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); ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); +ENUM(ConsoleMode, Handheld, Docked); + template inline std::string CanonicalizeEnum(Type id) { const auto group = EnumMetadata::Canonicalizations(); -- cgit v1.2.3 From ab862207d7f2de712e1f711141d20921b414cdf7 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 22 Aug 2023 21:58:09 -0400 Subject: settings: Add docked mode helper function --- src/common/settings.cpp | 5 +++++ src/common/settings.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'src/common') 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 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include +#include "common/settings_enums.h" #if __cpp_lib_chrono >= 201907L #include #include @@ -145,6 +146,10 @@ bool IsFastmemEnabled() { return true; } +bool IsDockedMode() { + return values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked; +} + float Volume() { if (values.audio_muted) { return 0.0f; diff --git a/src/common/settings.h b/src/common/settings.h index 6d44fc626..b15213bd7 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -525,6 +525,8 @@ bool IsGPULevelHigh(); bool IsFastmemEnabled(); +bool IsDockedMode(); + float Volume(); std::string GetTimeZoneString(TimeZone time_zone); -- cgit v1.2.3