settings: implement KeyValueStore (#1659)

* settings: implement KeyValueStore and dependencies

* settings: update KeyValueStore for recent refactoring

* settings: address feedback
This commit is contained in:
Adubbz
2021-10-10 03:16:40 +11:00
committed by GitHub
parent 14c8801259
commit 303c6eb5f9
23 changed files with 2767 additions and 81 deletions

View File

@@ -114,6 +114,7 @@ namespace ams::impl {
/* settings. */
AMS_DEFINE_SYSTEM_THREAD(21, settings, Main);
AMS_DEFINE_SYSTEM_THREAD(21, settings, IpcServer);
AMS_DEFINE_SYSTEM_THREAD(21, settings, LazyWriter);
/* erpt. */
AMS_DEFINE_SYSTEM_THREAD(21, erpt, Main);

View File

@@ -267,6 +267,10 @@ namespace ams::ncm {
static const SystemDataId RebootlessSystemUpdateVersion;
static const SystemDataId ContentActionTable;
static const SystemDataId PlatformConfigCalcio;
static const SystemDataId PlatformConfigAula;
static const SystemDataId End;
};
@@ -312,6 +316,10 @@ namespace ams::ncm {
inline constexpr const SystemDataId SystemDataId::RebootlessSystemUpdateVersion = { 0x0100000000000826ul };
inline constexpr const SystemDataId SystemDataId::ContentActionTable = { 0x0100000000000827ul };
inline constexpr const SystemDataId SystemDataId::PlatformConfigCalcio = { 0x0100000000000829ul };
inline constexpr const SystemDataId SystemDataId::PlatformConfigAula = { 0x0100000000000831ul };
inline constexpr const SystemDataId SystemDataId::End = { 0x0100000000000FFFul };
inline constexpr bool IsSystemDataId(const DataId &data_id) {

View File

@@ -20,19 +20,4 @@
namespace ams::settings::fwdbg {
constexpr size_t SettingsNameLengthMax = 0x40;
constexpr size_t SettingsItemKeyLengthMax = 0x40;
struct SettingsName : sf::LargeData {
char value[util::AlignUp(SettingsNameLengthMax + 1, alignof(u64))];
};
static_assert(util::is_pod<SettingsName>::value && sizeof(SettingsName) > SettingsNameLengthMax);
struct SettingsItemKey : sf::LargeData {
char value[util::AlignUp(SettingsItemKeyLengthMax + 1, alignof(u64))];
};
static_assert(util::is_pod<SettingsItemKey>::value && sizeof(SettingsItemKey) > SettingsItemKeyLengthMax);
}

View File

@@ -19,6 +19,21 @@
namespace ams::settings {
constexpr size_t SettingsNameLengthMax = 0x40;
constexpr size_t SettingsItemKeyLengthMax = 0x40;
struct SettingsName : public sf::LargeData {
char value[util::AlignUp(SettingsNameLengthMax + 1, alignof(u64))];
};
static_assert(util::is_pod<SettingsName>::value && sizeof(SettingsName) > SettingsNameLengthMax);
struct SettingsItemKey : public sf::LargeData {
char value[util::AlignUp(SettingsItemKeyLengthMax + 1, alignof(u64))];
};
static_assert(util::is_pod<SettingsItemKey>::value && sizeof(SettingsItemKey) > SettingsItemKeyLengthMax);
enum Language {
Language_Japanese,
Language_AmericanEnglish,

View File

@@ -60,6 +60,12 @@ namespace ams::spl {
return static_cast<HardwareState>(v);
}
inline RetailInteractiveDisplayState GetRetailInteractiveDisplayState() {
u64 v;
R_ABORT_UNLESS(::ams::spl::GetConfig(std::addressof(v), ::ams::spl::ConfigItem::RetailInteractiveDisplayState));
return static_cast<RetailInteractiveDisplayState>(v);
}
inline u64 GetDeviceIdLow() {
u64 v;
R_ABORT_UNLESS(::ams::spl::GetConfig(std::addressof(v), ::ams::spl::ConfigItem::DeviceId));

View File

@@ -138,6 +138,11 @@ namespace ams::spl {
MemoryArrangement_Count,
};
enum RetailInteractiveDisplayState {
RetailInteractiveDisplayState_Disabled = 0,
RetailInteractiveDisplayState_Enabled = 1,
};
struct BootReasonValue {
union {
struct {
@@ -217,7 +222,7 @@ namespace ams::spl {
IsDevelopmentFunctionEnabled = 11,
KernelConfiguration = 12,
IsChargerHiZModeEnabled = 13,
QuestState = 14,
RetailInteractiveDisplayState = 14,
RegulatorType = 15,
DeviceUniqueKeyGeneration = 16,
Package2Hash = 17,