diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/am.h | 24 | ||||
| -rw-r--r-- | src/core/hle/service/set/set.cpp | 60 | ||||
| -rw-r--r-- | src/core/hle/service/set/set.h | 61 | ||||
| -rw-r--r-- | src/core/hle/service/set/set_sys.cpp | 375 | ||||
| -rw-r--r-- | src/core/hle/service/set/set_sys.h | 322 |
5 files changed, 723 insertions, 119 deletions
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 3db09c214..d68998f04 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -22,30 +22,6 @@ class Nvnflinger; | |||
| 22 | 22 | ||
| 23 | namespace Service::AM { | 23 | namespace Service::AM { |
| 24 | 24 | ||
| 25 | // This is nn::settings::Language | ||
| 26 | enum SystemLanguage { | ||
| 27 | Japanese = 0, | ||
| 28 | English = 1, // en-US | ||
| 29 | French = 2, | ||
| 30 | German = 3, | ||
| 31 | Italian = 4, | ||
| 32 | Spanish = 5, | ||
| 33 | Chinese = 6, | ||
| 34 | Korean = 7, | ||
| 35 | Dutch = 8, | ||
| 36 | Portuguese = 9, | ||
| 37 | Russian = 10, | ||
| 38 | Taiwanese = 11, | ||
| 39 | BritishEnglish = 12, // en-GB | ||
| 40 | CanadianFrench = 13, | ||
| 41 | LatinAmericanSpanish = 14, // es-419 | ||
| 42 | // 4.0.0+ | ||
| 43 | SimplifiedChinese = 15, | ||
| 44 | TraditionalChinese = 16, | ||
| 45 | // 10.1.0+ | ||
| 46 | BrazilianPortuguese = 17, | ||
| 47 | }; | ||
| 48 | |||
| 49 | class AppletMessageQueue { | 25 | class AppletMessageQueue { |
| 50 | public: | 26 | public: |
| 51 | // This is nn::am::AppletMessage | 27 | // This is nn::am::AppletMessage |
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 83f888c54..2082b8ef7 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp | |||
| @@ -11,66 +11,6 @@ | |||
| 11 | 11 | ||
| 12 | namespace Service::Set { | 12 | namespace Service::Set { |
| 13 | namespace { | 13 | namespace { |
| 14 | constexpr std::array<LanguageCode, 18> available_language_codes = {{ | ||
| 15 | LanguageCode::JA, | ||
| 16 | LanguageCode::EN_US, | ||
| 17 | LanguageCode::FR, | ||
| 18 | LanguageCode::DE, | ||
| 19 | LanguageCode::IT, | ||
| 20 | LanguageCode::ES, | ||
| 21 | LanguageCode::ZH_CN, | ||
| 22 | LanguageCode::KO, | ||
| 23 | LanguageCode::NL, | ||
| 24 | LanguageCode::PT, | ||
| 25 | LanguageCode::RU, | ||
| 26 | LanguageCode::ZH_TW, | ||
| 27 | LanguageCode::EN_GB, | ||
| 28 | LanguageCode::FR_CA, | ||
| 29 | LanguageCode::ES_419, | ||
| 30 | LanguageCode::ZH_HANS, | ||
| 31 | LanguageCode::ZH_HANT, | ||
| 32 | LanguageCode::PT_BR, | ||
| 33 | }}; | ||
| 34 | |||
| 35 | enum class KeyboardLayout : u64 { | ||
| 36 | Japanese = 0, | ||
| 37 | EnglishUs = 1, | ||
| 38 | EnglishUsInternational = 2, | ||
| 39 | EnglishUk = 3, | ||
| 40 | French = 4, | ||
| 41 | FrenchCa = 5, | ||
| 42 | Spanish = 6, | ||
| 43 | SpanishLatin = 7, | ||
| 44 | German = 8, | ||
| 45 | Italian = 9, | ||
| 46 | Portuguese = 10, | ||
| 47 | Russian = 11, | ||
| 48 | Korean = 12, | ||
| 49 | ChineseSimplified = 13, | ||
| 50 | ChineseTraditional = 14, | ||
| 51 | }; | ||
| 52 | |||
| 53 | constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_layout{{ | ||
| 54 | {LanguageCode::JA, KeyboardLayout::Japanese}, | ||
| 55 | {LanguageCode::EN_US, KeyboardLayout::EnglishUs}, | ||
| 56 | {LanguageCode::FR, KeyboardLayout::French}, | ||
| 57 | {LanguageCode::DE, KeyboardLayout::German}, | ||
| 58 | {LanguageCode::IT, KeyboardLayout::Italian}, | ||
| 59 | {LanguageCode::ES, KeyboardLayout::Spanish}, | ||
| 60 | {LanguageCode::ZH_CN, KeyboardLayout::ChineseSimplified}, | ||
| 61 | {LanguageCode::KO, KeyboardLayout::Korean}, | ||
| 62 | {LanguageCode::NL, KeyboardLayout::EnglishUsInternational}, | ||
| 63 | {LanguageCode::PT, KeyboardLayout::Portuguese}, | ||
| 64 | {LanguageCode::RU, KeyboardLayout::Russian}, | ||
| 65 | {LanguageCode::ZH_TW, KeyboardLayout::ChineseTraditional}, | ||
| 66 | {LanguageCode::EN_GB, KeyboardLayout::EnglishUk}, | ||
| 67 | {LanguageCode::FR_CA, KeyboardLayout::FrenchCa}, | ||
| 68 | {LanguageCode::ES_419, KeyboardLayout::SpanishLatin}, | ||
| 69 | {LanguageCode::ZH_HANS, KeyboardLayout::ChineseSimplified}, | ||
| 70 | {LanguageCode::ZH_HANT, KeyboardLayout::ChineseTraditional}, | ||
| 71 | {LanguageCode::PT_BR, KeyboardLayout::Portuguese}, | ||
| 72 | }}; | ||
| 73 | |||
| 74 | constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF; | 14 | constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF; |
| 75 | constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40; | 15 | constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40; |
| 76 | 16 | ||
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h index 7fd3a7654..b61a3560d 100644 --- a/src/core/hle/service/set/set.h +++ b/src/core/hle/service/set/set.h | |||
| @@ -32,6 +32,67 @@ enum class LanguageCode : u64 { | |||
| 32 | ZH_HANT = 0x00746E61482D687A, | 32 | ZH_HANT = 0x00746E61482D687A, |
| 33 | PT_BR = 0x00000052422D7470, | 33 | PT_BR = 0x00000052422D7470, |
| 34 | }; | 34 | }; |
| 35 | |||
| 36 | enum class KeyboardLayout : u64 { | ||
| 37 | Japanese = 0, | ||
| 38 | EnglishUs = 1, | ||
| 39 | EnglishUsInternational = 2, | ||
| 40 | EnglishUk = 3, | ||
| 41 | French = 4, | ||
| 42 | FrenchCa = 5, | ||
| 43 | Spanish = 6, | ||
| 44 | SpanishLatin = 7, | ||
| 45 | German = 8, | ||
| 46 | Italian = 9, | ||
| 47 | Portuguese = 10, | ||
| 48 | Russian = 11, | ||
| 49 | Korean = 12, | ||
| 50 | ChineseSimplified = 13, | ||
| 51 | ChineseTraditional = 14, | ||
| 52 | }; | ||
| 53 | |||
| 54 | constexpr std::array<LanguageCode, 18> available_language_codes = {{ | ||
| 55 | LanguageCode::JA, | ||
| 56 | LanguageCode::EN_US, | ||
| 57 | LanguageCode::FR, | ||
| 58 | LanguageCode::DE, | ||
| 59 | LanguageCode::IT, | ||
| 60 | LanguageCode::ES, | ||
| 61 | LanguageCode::ZH_CN, | ||
| 62 | LanguageCode::KO, | ||
| 63 | LanguageCode::NL, | ||
| 64 | LanguageCode::PT, | ||
| 65 | LanguageCode::RU, | ||
| 66 | LanguageCode::ZH_TW, | ||
| 67 | LanguageCode::EN_GB, | ||
| 68 | LanguageCode::FR_CA, | ||
| 69 | LanguageCode::ES_419, | ||
| 70 | LanguageCode::ZH_HANS, | ||
| 71 | LanguageCode::ZH_HANT, | ||
| 72 | LanguageCode::PT_BR, | ||
| 73 | }}; | ||
| 74 | |||
| 75 | static constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_layout{{ | ||
| 76 | {LanguageCode::JA, KeyboardLayout::Japanese}, | ||
| 77 | {LanguageCode::EN_US, KeyboardLayout::EnglishUs}, | ||
| 78 | {LanguageCode::FR, KeyboardLayout::French}, | ||
| 79 | {LanguageCode::DE, KeyboardLayout::German}, | ||
| 80 | {LanguageCode::IT, KeyboardLayout::Italian}, | ||
| 81 | {LanguageCode::ES, KeyboardLayout::Spanish}, | ||
| 82 | {LanguageCode::ZH_CN, KeyboardLayout::ChineseSimplified}, | ||
| 83 | {LanguageCode::KO, KeyboardLayout::Korean}, | ||
| 84 | {LanguageCode::NL, KeyboardLayout::EnglishUsInternational}, | ||
| 85 | {LanguageCode::PT, KeyboardLayout::Portuguese}, | ||
| 86 | {LanguageCode::RU, KeyboardLayout::Russian}, | ||
| 87 | {LanguageCode::ZH_TW, KeyboardLayout::ChineseTraditional}, | ||
| 88 | {LanguageCode::EN_GB, KeyboardLayout::EnglishUk}, | ||
| 89 | {LanguageCode::FR_CA, KeyboardLayout::FrenchCa}, | ||
| 90 | {LanguageCode::ES_419, KeyboardLayout::SpanishLatin}, | ||
| 91 | {LanguageCode::ZH_HANS, KeyboardLayout::ChineseSimplified}, | ||
| 92 | {LanguageCode::ZH_HANT, KeyboardLayout::ChineseTraditional}, | ||
| 93 | {LanguageCode::PT_BR, KeyboardLayout::Portuguese}, | ||
| 94 | }}; | ||
| 95 | |||
| 35 | LanguageCode GetLanguageCodeFromIndex(std::size_t idx); | 96 | LanguageCode GetLanguageCodeFromIndex(std::size_t idx); |
| 36 | 97 | ||
| 37 | class SET final : public ServiceFramework<SET> { | 98 | class SET final : public ServiceFramework<SET> { |
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index 2e38d1cfc..165b97dad 100644 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp | |||
| @@ -4,10 +4,12 @@ | |||
| 4 | #include "common/assert.h" | 4 | #include "common/assert.h" |
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "common/settings.h" | 6 | #include "common/settings.h" |
| 7 | #include "common/string_util.h" | ||
| 7 | #include "core/file_sys/errors.h" | 8 | #include "core/file_sys/errors.h" |
| 8 | #include "core/file_sys/system_archive/system_version.h" | 9 | #include "core/file_sys/system_archive/system_version.h" |
| 9 | #include "core/hle/service/filesystem/filesystem.h" | 10 | #include "core/hle/service/filesystem/filesystem.h" |
| 10 | #include "core/hle/service/ipc_helpers.h" | 11 | #include "core/hle/service/ipc_helpers.h" |
| 12 | #include "core/hle/service/set/set.h" | ||
| 11 | #include "core/hle/service/set/set_sys.h" | 13 | #include "core/hle/service/set/set_sys.h" |
| 12 | 14 | ||
| 13 | namespace Service::Set { | 15 | namespace Service::Set { |
| @@ -73,6 +75,16 @@ void GetFirmwareVersionImpl(HLERequestContext& ctx, GetFirmwareVersionType type) | |||
| 73 | } | 75 | } |
| 74 | } // Anonymous namespace | 76 | } // Anonymous namespace |
| 75 | 77 | ||
| 78 | void SET_SYS::SetLanguageCode(HLERequestContext& ctx) { | ||
| 79 | IPC::RequestParser rp{ctx}; | ||
| 80 | language_code_setting = rp.PopEnum<LanguageCode>(); | ||
| 81 | |||
| 82 | LOG_INFO(Service_SET, "called, language_code={}", language_code_setting); | ||
| 83 | |||
| 84 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 85 | rb.Push(ResultSuccess); | ||
| 86 | } | ||
| 87 | |||
| 76 | void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) { | 88 | void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) { |
| 77 | LOG_DEBUG(Service_SET, "called"); | 89 | LOG_DEBUG(Service_SET, "called"); |
| 78 | GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1); | 90 | GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1); |
| @@ -83,21 +95,113 @@ void SET_SYS::GetFirmwareVersion2(HLERequestContext& ctx) { | |||
| 83 | GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version2); | 95 | GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version2); |
| 84 | } | 96 | } |
| 85 | 97 | ||
| 98 | void SET_SYS::GetAccountSettings(HLERequestContext& ctx) { | ||
| 99 | LOG_INFO(Service_SET, "called"); | ||
| 100 | |||
| 101 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 102 | rb.Push(ResultSuccess); | ||
| 103 | rb.PushRaw(account_settings); | ||
| 104 | } | ||
| 105 | |||
| 106 | void SET_SYS::SetAccountSettings(HLERequestContext& ctx) { | ||
| 107 | IPC::RequestParser rp{ctx}; | ||
| 108 | account_settings = rp.PopRaw<AccountSettings>(); | ||
| 109 | |||
| 110 | LOG_INFO(Service_SET, "called, account_settings_flags={}", account_settings.flags); | ||
| 111 | |||
| 112 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 113 | rb.Push(ResultSuccess); | ||
| 114 | } | ||
| 115 | |||
| 116 | void SET_SYS::GetEulaVersions(HLERequestContext& ctx) { | ||
| 117 | LOG_INFO(Service_SET, "called"); | ||
| 118 | |||
| 119 | ctx.WriteBuffer(eula_versions); | ||
| 120 | |||
| 121 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 122 | rb.Push(ResultSuccess); | ||
| 123 | rb.Push(static_cast<u32>(eula_versions.size())); | ||
| 124 | } | ||
| 125 | |||
| 126 | void SET_SYS::SetEulaVersions(HLERequestContext& ctx) { | ||
| 127 | const auto elements = ctx.GetReadBufferNumElements<EulaVersion>(); | ||
| 128 | const auto buffer_data = ctx.ReadBuffer(); | ||
| 129 | |||
| 130 | LOG_INFO(Service_SET, "called, elements={}", elements); | ||
| 131 | |||
| 132 | eula_versions.resize(elements); | ||
| 133 | for (std::size_t index = 0; index < elements; index++) { | ||
| 134 | const std::size_t start_index = index * sizeof(EulaVersion); | ||
| 135 | memcpy(eula_versions.data() + start_index, buffer_data.data() + start_index, | ||
| 136 | sizeof(EulaVersion)); | ||
| 137 | } | ||
| 138 | |||
| 139 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 140 | rb.Push(ResultSuccess); | ||
| 141 | } | ||
| 142 | |||
| 86 | void SET_SYS::GetColorSetId(HLERequestContext& ctx) { | 143 | void SET_SYS::GetColorSetId(HLERequestContext& ctx) { |
| 87 | LOG_DEBUG(Service_SET, "called"); | 144 | LOG_DEBUG(Service_SET, "called"); |
| 88 | 145 | ||
| 89 | IPC::ResponseBuilder rb{ctx, 3}; | 146 | IPC::ResponseBuilder rb{ctx, 3}; |
| 90 | |||
| 91 | rb.Push(ResultSuccess); | 147 | rb.Push(ResultSuccess); |
| 92 | rb.PushEnum(color_set); | 148 | rb.PushEnum(color_set); |
| 93 | } | 149 | } |
| 94 | 150 | ||
| 95 | void SET_SYS::SetColorSetId(HLERequestContext& ctx) { | 151 | void SET_SYS::SetColorSetId(HLERequestContext& ctx) { |
| 96 | LOG_DEBUG(Service_SET, "called"); | ||
| 97 | |||
| 98 | IPC::RequestParser rp{ctx}; | 152 | IPC::RequestParser rp{ctx}; |
| 99 | color_set = rp.PopEnum<ColorSet>(); | 153 | color_set = rp.PopEnum<ColorSet>(); |
| 100 | 154 | ||
| 155 | LOG_DEBUG(Service_SET, "called, color_set={}", color_set); | ||
| 156 | |||
| 157 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 158 | rb.Push(ResultSuccess); | ||
| 159 | } | ||
| 160 | |||
| 161 | void SET_SYS::GetNotificationSettings(HLERequestContext& ctx) { | ||
| 162 | LOG_INFO(Service_SET, "called"); | ||
| 163 | |||
| 164 | IPC::ResponseBuilder rb{ctx, 8}; | ||
| 165 | rb.Push(ResultSuccess); | ||
| 166 | rb.PushRaw(notification_settings); | ||
| 167 | } | ||
| 168 | |||
| 169 | void SET_SYS::SetNotificationSettings(HLERequestContext& ctx) { | ||
| 170 | IPC::RequestParser rp{ctx}; | ||
| 171 | notification_settings = rp.PopRaw<NotificationSettings>(); | ||
| 172 | |||
| 173 | LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}", | ||
| 174 | notification_settings.flags.raw, notification_settings.volume, | ||
| 175 | notification_settings.start_time.hour, notification_settings.start_time.minute, | ||
| 176 | notification_settings.stop_time.hour, notification_settings.stop_time.minute); | ||
| 177 | |||
| 178 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 179 | rb.Push(ResultSuccess); | ||
| 180 | } | ||
| 181 | |||
| 182 | void SET_SYS::GetAccountNotificationSettings(HLERequestContext& ctx) { | ||
| 183 | LOG_INFO(Service_SET, "called"); | ||
| 184 | |||
| 185 | ctx.WriteBuffer(account_notifications); | ||
| 186 | |||
| 187 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 188 | rb.Push(ResultSuccess); | ||
| 189 | rb.Push(static_cast<u32>(account_notifications.size())); | ||
| 190 | } | ||
| 191 | |||
| 192 | void SET_SYS::SetAccountNotificationSettings(HLERequestContext& ctx) { | ||
| 193 | const auto elements = ctx.GetReadBufferNumElements<AccountNotificationSettings>(); | ||
| 194 | const auto buffer_data = ctx.ReadBuffer(); | ||
| 195 | |||
| 196 | LOG_INFO(Service_SET, "called, elements={}", elements); | ||
| 197 | |||
| 198 | account_notifications.resize(elements); | ||
| 199 | for (std::size_t index = 0; index < elements; index++) { | ||
| 200 | const std::size_t start_index = index * sizeof(AccountNotificationSettings); | ||
| 201 | memcpy(account_notifications.data() + start_index, buffer_data.data() + start_index, | ||
| 202 | sizeof(AccountNotificationSettings)); | ||
| 203 | } | ||
| 204 | |||
| 101 | IPC::ResponseBuilder rb{ctx, 2}; | 205 | IPC::ResponseBuilder rb{ctx, 2}; |
| 102 | rb.Push(ResultSuccess); | 206 | rb.Push(ResultSuccess); |
| 103 | } | 207 | } |
| @@ -177,17 +281,218 @@ void SET_SYS::GetSettingsItemValue(HLERequestContext& ctx) { | |||
| 177 | rb.Push(response); | 281 | rb.Push(response); |
| 178 | } | 282 | } |
| 179 | 283 | ||
| 284 | void SET_SYS::GetTvSettings(HLERequestContext& ctx) { | ||
| 285 | LOG_INFO(Service_SET, "called"); | ||
| 286 | |||
| 287 | IPC::ResponseBuilder rb{ctx, 10}; | ||
| 288 | rb.Push(ResultSuccess); | ||
| 289 | rb.PushRaw(tv_settings); | ||
| 290 | } | ||
| 291 | |||
| 292 | void SET_SYS::SetTvSettings(HLERequestContext& ctx) { | ||
| 293 | IPC::RequestParser rp{ctx}; | ||
| 294 | tv_settings = rp.PopRaw<TvSettings>(); | ||
| 295 | |||
| 296 | LOG_INFO(Service_SET, | ||
| 297 | "called, flags={}, cmu_mode={}, constrast_ratio={}, hdmi_content_type={}, " | ||
| 298 | "rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}", | ||
| 299 | tv_settings.flags.raw, tv_settings.cmu_mode, tv_settings.constrast_ratio, | ||
| 300 | tv_settings.hdmi_content_type, tv_settings.rgb_range, tv_settings.tv_gama, | ||
| 301 | tv_settings.tv_resolution, tv_settings.tv_underscan); | ||
| 302 | |||
| 303 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 304 | rb.Push(ResultSuccess); | ||
| 305 | } | ||
| 306 | |||
| 307 | void SET_SYS::GetQuestFlag(HLERequestContext& ctx) { | ||
| 308 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 309 | |||
| 310 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 311 | rb.Push(ResultSuccess); | ||
| 312 | rb.PushEnum(QuestFlag::Retail); | ||
| 313 | } | ||
| 314 | |||
| 315 | void SET_SYS::SetRegionCode(HLERequestContext& ctx) { | ||
| 316 | IPC::RequestParser rp{ctx}; | ||
| 317 | region_code = rp.PopEnum<RegionCode>(); | ||
| 318 | |||
| 319 | LOG_INFO(Service_SET, "called, region_code={}", region_code); | ||
| 320 | |||
| 321 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 322 | rb.Push(ResultSuccess); | ||
| 323 | } | ||
| 324 | |||
| 325 | void SET_SYS::GetPrimaryAlbumStorage(HLERequestContext& ctx) { | ||
| 326 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 327 | |||
| 328 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 329 | rb.Push(ResultSuccess); | ||
| 330 | rb.PushEnum(PrimaryAlbumStorage::SdCard); | ||
| 331 | } | ||
| 332 | |||
| 333 | void SET_SYS::GetSleepSettings(HLERequestContext& ctx) { | ||
| 334 | LOG_INFO(Service_SET, "called"); | ||
| 335 | |||
| 336 | IPC::ResponseBuilder rb{ctx, 5}; | ||
| 337 | rb.Push(ResultSuccess); | ||
| 338 | rb.PushRaw(sleep_settings); | ||
| 339 | } | ||
| 340 | |||
| 341 | void SET_SYS::SetSleepSettings(HLERequestContext& ctx) { | ||
| 342 | IPC::RequestParser rp{ctx}; | ||
| 343 | sleep_settings = rp.PopRaw<SleepSettings>(); | ||
| 344 | |||
| 345 | LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}", | ||
| 346 | sleep_settings.flags.raw, sleep_settings.handheld_sleep_plan, | ||
| 347 | sleep_settings.console_sleep_plan); | ||
| 348 | |||
| 349 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 350 | rb.Push(ResultSuccess); | ||
| 351 | } | ||
| 352 | |||
| 353 | void SET_SYS::GetInitialLaunchSettings(HLERequestContext& ctx) { | ||
| 354 | LOG_INFO(Service_SET, "called"); | ||
| 355 | IPC::ResponseBuilder rb{ctx, 10}; | ||
| 356 | rb.Push(ResultSuccess); | ||
| 357 | rb.PushRaw(launch_settings); | ||
| 358 | } | ||
| 359 | |||
| 360 | void SET_SYS::SetInitialLaunchSettings(HLERequestContext& ctx) { | ||
| 361 | IPC::RequestParser rp{ctx}; | ||
| 362 | launch_settings = rp.PopRaw<InitialLaunchSettings>(); | ||
| 363 | |||
| 364 | LOG_INFO(Service_SET, "called, flags={}, timestamp={}", launch_settings.flags.raw, | ||
| 365 | launch_settings.timestamp.time_point); | ||
| 366 | |||
| 367 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 368 | rb.Push(ResultSuccess); | ||
| 369 | } | ||
| 370 | |||
| 180 | void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) { | 371 | void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) { |
| 181 | LOG_DEBUG(Service_SET, "called"); | 372 | LOG_DEBUG(Service_SET, "called"); |
| 373 | |||
| 374 | ctx.WriteBuffer(::Settings::values.device_name.GetValue()); | ||
| 375 | |||
| 182 | IPC::ResponseBuilder rb{ctx, 2}; | 376 | IPC::ResponseBuilder rb{ctx, 2}; |
| 183 | rb.Push(ResultSuccess); | 377 | rb.Push(ResultSuccess); |
| 184 | ctx.WriteBuffer(::Settings::values.device_name.GetValue()); | 378 | } |
| 379 | |||
| 380 | void SET_SYS::SetDeviceNickName(HLERequestContext& ctx) { | ||
| 381 | const std::string device_name = Common::StringFromBuffer(ctx.ReadBuffer()); | ||
| 382 | |||
| 383 | LOG_INFO(Service_SET, "called, device_name={}", device_name); | ||
| 384 | |||
| 385 | ::Settings::values.device_name = device_name; | ||
| 386 | |||
| 387 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 388 | rb.Push(ResultSuccess); | ||
| 389 | } | ||
| 390 | |||
| 391 | void SET_SYS::GetProductModel(HLERequestContext& ctx) { | ||
| 392 | const u32 product_model = 1; | ||
| 393 | |||
| 394 | LOG_WARNING(Service_SET, "(STUBBED) called, product_model={}", product_model); | ||
| 395 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 396 | rb.Push(ResultSuccess); | ||
| 397 | rb.Push(product_model); | ||
| 398 | } | ||
| 399 | |||
| 400 | void SET_SYS::GetMiiAuthorId(HLERequestContext& ctx) { | ||
| 401 | const auto author_id = Common::UUID::MakeDefault(); | ||
| 402 | |||
| 403 | LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString()); | ||
| 404 | |||
| 405 | IPC::ResponseBuilder rb{ctx, 6}; | ||
| 406 | rb.Push(ResultSuccess); | ||
| 407 | rb.PushRaw(author_id); | ||
| 408 | } | ||
| 409 | |||
| 410 | void SET_SYS::GetAutoUpdateEnableFlag(HLERequestContext& ctx) { | ||
| 411 | u8 auto_update_flag{}; | ||
| 412 | |||
| 413 | LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag); | ||
| 414 | |||
| 415 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 416 | rb.Push(ResultSuccess); | ||
| 417 | rb.Push(auto_update_flag); | ||
| 418 | } | ||
| 419 | |||
| 420 | void SET_SYS::GetBatteryPercentageFlag(HLERequestContext& ctx) { | ||
| 421 | u8 battery_percentage_flag{1}; | ||
| 422 | |||
| 423 | LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}", | ||
| 424 | battery_percentage_flag); | ||
| 425 | |||
| 426 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 427 | rb.Push(ResultSuccess); | ||
| 428 | rb.Push(battery_percentage_flag); | ||
| 429 | } | ||
| 430 | |||
| 431 | void SET_SYS::GetErrorReportSharePermission(HLERequestContext& ctx) { | ||
| 432 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 433 | |||
| 434 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 435 | rb.Push(ResultSuccess); | ||
| 436 | rb.PushEnum(ErrorReportSharePermission::Denied); | ||
| 437 | } | ||
| 438 | |||
| 439 | void SET_SYS::GetAppletLaunchFlags(HLERequestContext& ctx) { | ||
| 440 | LOG_INFO(Service_SET, "called, applet_launch_flag={}", applet_launch_flag); | ||
| 441 | |||
| 442 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 443 | rb.Push(ResultSuccess); | ||
| 444 | rb.Push(applet_launch_flag); | ||
| 445 | } | ||
| 446 | |||
| 447 | void SET_SYS::SetAppletLaunchFlags(HLERequestContext& ctx) { | ||
| 448 | IPC::RequestParser rp{ctx}; | ||
| 449 | applet_launch_flag = rp.Pop<u32>(); | ||
| 450 | |||
| 451 | LOG_INFO(Service_SET, "called, applet_launch_flag={}", applet_launch_flag); | ||
| 452 | |||
| 453 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 454 | rb.Push(ResultSuccess); | ||
| 455 | } | ||
| 456 | |||
| 457 | void SET_SYS::GetKeyboardLayout(HLERequestContext& ctx) { | ||
| 458 | const auto language_code = | ||
| 459 | available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())]; | ||
| 460 | const auto key_code = | ||
| 461 | std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), | ||
| 462 | [=](const auto& element) { return element.first == language_code; }); | ||
| 463 | |||
| 464 | KeyboardLayout selected_keyboard_layout = KeyboardLayout::EnglishUs; | ||
| 465 | if (key_code != language_to_layout.end()) { | ||
| 466 | selected_keyboard_layout = key_code->second; | ||
| 467 | } | ||
| 468 | |||
| 469 | LOG_INFO(Service_SET, "called, selected_keyboard_layout={}", selected_keyboard_layout); | ||
| 470 | |||
| 471 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 472 | rb.Push(ResultSuccess); | ||
| 473 | rb.Push(static_cast<u32>(selected_keyboard_layout)); | ||
| 474 | } | ||
| 475 | |||
| 476 | void SET_SYS::GetChineseTraditionalInputMethod(HLERequestContext& ctx) { | ||
| 477 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 478 | |||
| 479 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 480 | rb.Push(ResultSuccess); | ||
| 481 | rb.PushEnum(ChineseTraditionalInputMethod::Unknown0); | ||
| 482 | } | ||
| 483 | |||
| 484 | void SET_SYS::GetFieldTestingFlag(HLERequestContext& ctx) { | ||
| 485 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 486 | |||
| 487 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 488 | rb.Push(ResultSuccess); | ||
| 489 | rb.Push<u8>(false); | ||
| 185 | } | 490 | } |
| 186 | 491 | ||
| 187 | SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | 492 | SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { |
| 188 | // clang-format off | 493 | // clang-format off |
| 189 | static const FunctionInfo functions[] = { | 494 | static const FunctionInfo functions[] = { |
| 190 | {0, nullptr, "SetLanguageCode"}, | 495 | {0, &SET_SYS::SetLanguageCode, "SetLanguageCode"}, |
| 191 | {1, nullptr, "SetNetworkSettings"}, | 496 | {1, nullptr, "SetNetworkSettings"}, |
| 192 | {2, nullptr, "GetNetworkSettings"}, | 497 | {2, nullptr, "GetNetworkSettings"}, |
| 193 | {3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"}, | 498 | {3, &SET_SYS::GetFirmwareVersion, "GetFirmwareVersion"}, |
| @@ -203,35 +508,35 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 203 | {14, nullptr, "SetExternalSteadyClockSourceId"}, | 508 | {14, nullptr, "SetExternalSteadyClockSourceId"}, |
| 204 | {15, nullptr, "GetUserSystemClockContext"}, | 509 | {15, nullptr, "GetUserSystemClockContext"}, |
| 205 | {16, nullptr, "SetUserSystemClockContext"}, | 510 | {16, nullptr, "SetUserSystemClockContext"}, |
| 206 | {17, nullptr, "GetAccountSettings"}, | 511 | {17, &SET_SYS::GetAccountSettings, "GetAccountSettings"}, |
| 207 | {18, nullptr, "SetAccountSettings"}, | 512 | {18, &SET_SYS::SetAccountSettings, "SetAccountSettings"}, |
| 208 | {19, nullptr, "GetAudioVolume"}, | 513 | {19, nullptr, "GetAudioVolume"}, |
| 209 | {20, nullptr, "SetAudioVolume"}, | 514 | {20, nullptr, "SetAudioVolume"}, |
| 210 | {21, nullptr, "GetEulaVersions"}, | 515 | {21, &SET_SYS::GetEulaVersions, "GetEulaVersions"}, |
| 211 | {22, nullptr, "SetEulaVersions"}, | 516 | {22, &SET_SYS::SetEulaVersions, "SetEulaVersions"}, |
| 212 | {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, | 517 | {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, |
| 213 | {24, &SET_SYS::SetColorSetId, "SetColorSetId"}, | 518 | {24, &SET_SYS::SetColorSetId, "SetColorSetId"}, |
| 214 | {25, nullptr, "GetConsoleInformationUploadFlag"}, | 519 | {25, nullptr, "GetConsoleInformationUploadFlag"}, |
| 215 | {26, nullptr, "SetConsoleInformationUploadFlag"}, | 520 | {26, nullptr, "SetConsoleInformationUploadFlag"}, |
| 216 | {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, | 521 | {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, |
| 217 | {28, nullptr, "SetAutomaticApplicationDownloadFlag"}, | 522 | {28, nullptr, "SetAutomaticApplicationDownloadFlag"}, |
| 218 | {29, nullptr, "GetNotificationSettings"}, | 523 | {29, &SET_SYS::GetNotificationSettings, "GetNotificationSettings"}, |
| 219 | {30, nullptr, "SetNotificationSettings"}, | 524 | {30, &SET_SYS::SetNotificationSettings, "SetNotificationSettings"}, |
| 220 | {31, nullptr, "GetAccountNotificationSettings"}, | 525 | {31, &SET_SYS::GetAccountNotificationSettings, "GetAccountNotificationSettings"}, |
| 221 | {32, nullptr, "SetAccountNotificationSettings"}, | 526 | {32, &SET_SYS::SetAccountNotificationSettings, "SetAccountNotificationSettings"}, |
| 222 | {35, nullptr, "GetVibrationMasterVolume"}, | 527 | {35, nullptr, "GetVibrationMasterVolume"}, |
| 223 | {36, nullptr, "SetVibrationMasterVolume"}, | 528 | {36, nullptr, "SetVibrationMasterVolume"}, |
| 224 | {37, &SET_SYS::GetSettingsItemValueSize, "GetSettingsItemValueSize"}, | 529 | {37, &SET_SYS::GetSettingsItemValueSize, "GetSettingsItemValueSize"}, |
| 225 | {38, &SET_SYS::GetSettingsItemValue, "GetSettingsItemValue"}, | 530 | {38, &SET_SYS::GetSettingsItemValue, "GetSettingsItemValue"}, |
| 226 | {39, nullptr, "GetTvSettings"}, | 531 | {39, &SET_SYS::GetTvSettings, "GetTvSettings"}, |
| 227 | {40, nullptr, "SetTvSettings"}, | 532 | {40, &SET_SYS::SetTvSettings, "SetTvSettings"}, |
| 228 | {41, nullptr, "GetEdid"}, | 533 | {41, nullptr, "GetEdid"}, |
| 229 | {42, nullptr, "SetEdid"}, | 534 | {42, nullptr, "SetEdid"}, |
| 230 | {43, nullptr, "GetAudioOutputMode"}, | 535 | {43, nullptr, "GetAudioOutputMode"}, |
| 231 | {44, nullptr, "SetAudioOutputMode"}, | 536 | {44, nullptr, "SetAudioOutputMode"}, |
| 232 | {45, nullptr, "IsForceMuteOnHeadphoneRemoved"}, | 537 | {45, nullptr, "IsForceMuteOnHeadphoneRemoved"}, |
| 233 | {46, nullptr, "SetForceMuteOnHeadphoneRemoved"}, | 538 | {46, nullptr, "SetForceMuteOnHeadphoneRemoved"}, |
| 234 | {47, nullptr, "GetQuestFlag"}, | 539 | {47, &SET_SYS::GetQuestFlag, "GetQuestFlag"}, |
| 235 | {48, nullptr, "SetQuestFlag"}, | 540 | {48, nullptr, "SetQuestFlag"}, |
| 236 | {49, nullptr, "GetDataDeletionSettings"}, | 541 | {49, nullptr, "GetDataDeletionSettings"}, |
| 237 | {50, nullptr, "SetDataDeletionSettings"}, | 542 | {50, nullptr, "SetDataDeletionSettings"}, |
| @@ -241,13 +546,13 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 241 | {54, nullptr, "SetDeviceTimeZoneLocationName"}, | 546 | {54, nullptr, "SetDeviceTimeZoneLocationName"}, |
| 242 | {55, nullptr, "GetWirelessCertificationFileSize"}, | 547 | {55, nullptr, "GetWirelessCertificationFileSize"}, |
| 243 | {56, nullptr, "GetWirelessCertificationFile"}, | 548 | {56, nullptr, "GetWirelessCertificationFile"}, |
| 244 | {57, nullptr, "SetRegionCode"}, | 549 | {57, &SET_SYS::SetRegionCode, "SetRegionCode"}, |
| 245 | {58, nullptr, "GetNetworkSystemClockContext"}, | 550 | {58, nullptr, "GetNetworkSystemClockContext"}, |
| 246 | {59, nullptr, "SetNetworkSystemClockContext"}, | 551 | {59, nullptr, "SetNetworkSystemClockContext"}, |
| 247 | {60, nullptr, "IsUserSystemClockAutomaticCorrectionEnabled"}, | 552 | {60, nullptr, "IsUserSystemClockAutomaticCorrectionEnabled"}, |
| 248 | {61, nullptr, "SetUserSystemClockAutomaticCorrectionEnabled"}, | 553 | {61, nullptr, "SetUserSystemClockAutomaticCorrectionEnabled"}, |
| 249 | {62, nullptr, "GetDebugModeFlag"}, | 554 | {62, nullptr, "GetDebugModeFlag"}, |
| 250 | {63, nullptr, "GetPrimaryAlbumStorage"}, | 555 | {63, &SET_SYS::GetPrimaryAlbumStorage, "GetPrimaryAlbumStorage"}, |
| 251 | {64, nullptr, "SetPrimaryAlbumStorage"}, | 556 | {64, nullptr, "SetPrimaryAlbumStorage"}, |
| 252 | {65, nullptr, "GetUsb30EnableFlag"}, | 557 | {65, nullptr, "GetUsb30EnableFlag"}, |
| 253 | {66, nullptr, "SetUsb30EnableFlag"}, | 558 | {66, nullptr, "SetUsb30EnableFlag"}, |
| @@ -255,15 +560,15 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 255 | {68, nullptr, "GetSerialNumber"}, | 560 | {68, nullptr, "GetSerialNumber"}, |
| 256 | {69, nullptr, "GetNfcEnableFlag"}, | 561 | {69, nullptr, "GetNfcEnableFlag"}, |
| 257 | {70, nullptr, "SetNfcEnableFlag"}, | 562 | {70, nullptr, "SetNfcEnableFlag"}, |
| 258 | {71, nullptr, "GetSleepSettings"}, | 563 | {71, &SET_SYS::GetSleepSettings, "GetSleepSettings"}, |
| 259 | {72, nullptr, "SetSleepSettings"}, | 564 | {72, &SET_SYS::SetSleepSettings, "SetSleepSettings"}, |
| 260 | {73, nullptr, "GetWirelessLanEnableFlag"}, | 565 | {73, nullptr, "GetWirelessLanEnableFlag"}, |
| 261 | {74, nullptr, "SetWirelessLanEnableFlag"}, | 566 | {74, nullptr, "SetWirelessLanEnableFlag"}, |
| 262 | {75, nullptr, "GetInitialLaunchSettings"}, | 567 | {75, &SET_SYS::GetInitialLaunchSettings, "GetInitialLaunchSettings"}, |
| 263 | {76, nullptr, "SetInitialLaunchSettings"}, | 568 | {76, &SET_SYS::SetInitialLaunchSettings, "SetInitialLaunchSettings"}, |
| 264 | {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"}, | 569 | {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"}, |
| 265 | {78, nullptr, "SetDeviceNickName"}, | 570 | {78, &SET_SYS::SetDeviceNickName, "SetDeviceNickName"}, |
| 266 | {79, nullptr, "GetProductModel"}, | 571 | {79, &SET_SYS::GetProductModel, "GetProductModel"}, |
| 267 | {80, nullptr, "GetLdnChannel"}, | 572 | {80, nullptr, "GetLdnChannel"}, |
| 268 | {81, nullptr, "SetLdnChannel"}, | 573 | {81, nullptr, "SetLdnChannel"}, |
| 269 | {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, | 574 | {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, |
| @@ -274,16 +579,16 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 274 | {87, nullptr, "SetPtmFuelGaugeParameter"}, | 579 | {87, nullptr, "SetPtmFuelGaugeParameter"}, |
| 275 | {88, nullptr, "GetBluetoothEnableFlag"}, | 580 | {88, nullptr, "GetBluetoothEnableFlag"}, |
| 276 | {89, nullptr, "SetBluetoothEnableFlag"}, | 581 | {89, nullptr, "SetBluetoothEnableFlag"}, |
| 277 | {90, nullptr, "GetMiiAuthorId"}, | 582 | {90, &SET_SYS::GetMiiAuthorId, "GetMiiAuthorId"}, |
| 278 | {91, nullptr, "SetShutdownRtcValue"}, | 583 | {91, nullptr, "SetShutdownRtcValue"}, |
| 279 | {92, nullptr, "GetShutdownRtcValue"}, | 584 | {92, nullptr, "GetShutdownRtcValue"}, |
| 280 | {93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, | 585 | {93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, |
| 281 | {94, nullptr, "GetFatalDirtyFlags"}, | 586 | {94, nullptr, "GetFatalDirtyFlags"}, |
| 282 | {95, nullptr, "GetAutoUpdateEnableFlag"}, | 587 | {95, &SET_SYS::GetAutoUpdateEnableFlag, "GetAutoUpdateEnableFlag"}, |
| 283 | {96, nullptr, "SetAutoUpdateEnableFlag"}, | 588 | {96, nullptr, "SetAutoUpdateEnableFlag"}, |
| 284 | {97, nullptr, "GetNxControllerSettings"}, | 589 | {97, nullptr, "GetNxControllerSettings"}, |
| 285 | {98, nullptr, "SetNxControllerSettings"}, | 590 | {98, nullptr, "SetNxControllerSettings"}, |
| 286 | {99, nullptr, "GetBatteryPercentageFlag"}, | 591 | {99, &SET_SYS::GetBatteryPercentageFlag, "GetBatteryPercentageFlag"}, |
| 287 | {100, nullptr, "SetBatteryPercentageFlag"}, | 592 | {100, nullptr, "SetBatteryPercentageFlag"}, |
| 288 | {101, nullptr, "GetExternalRtcResetFlag"}, | 593 | {101, nullptr, "GetExternalRtcResetFlag"}, |
| 289 | {102, nullptr, "SetExternalRtcResetFlag"}, | 594 | {102, nullptr, "SetExternalRtcResetFlag"}, |
| @@ -308,10 +613,10 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 308 | {121, nullptr, "SetPushNotificationActivityModeOnSleep"}, | 613 | {121, nullptr, "SetPushNotificationActivityModeOnSleep"}, |
| 309 | {122, nullptr, "GetServiceDiscoveryControlSettings"}, | 614 | {122, nullptr, "GetServiceDiscoveryControlSettings"}, |
| 310 | {123, nullptr, "SetServiceDiscoveryControlSettings"}, | 615 | {123, nullptr, "SetServiceDiscoveryControlSettings"}, |
| 311 | {124, nullptr, "GetErrorReportSharePermission"}, | 616 | {124, &SET_SYS::GetErrorReportSharePermission, "GetErrorReportSharePermission"}, |
| 312 | {125, nullptr, "SetErrorReportSharePermission"}, | 617 | {125, nullptr, "SetErrorReportSharePermission"}, |
| 313 | {126, nullptr, "GetAppletLaunchFlags"}, | 618 | {126, &SET_SYS::GetAppletLaunchFlags, "GetAppletLaunchFlags"}, |
| 314 | {127, nullptr, "SetAppletLaunchFlags"}, | 619 | {127, &SET_SYS::SetAppletLaunchFlags, "SetAppletLaunchFlags"}, |
| 315 | {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, | 620 | {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, |
| 316 | {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, | 621 | {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, |
| 317 | {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, | 622 | {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, |
| @@ -320,7 +625,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 320 | {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, | 625 | {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, |
| 321 | {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, | 626 | {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, |
| 322 | {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, | 627 | {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, |
| 323 | {136, nullptr, "GetKeyboardLayout"}, | 628 | {136, &SET_SYS::GetKeyboardLayout, "GetKeyboardLayout"}, |
| 324 | {137, nullptr, "SetKeyboardLayout"}, | 629 | {137, nullptr, "SetKeyboardLayout"}, |
| 325 | {138, nullptr, "GetWebInspectorFlag"}, | 630 | {138, nullptr, "GetWebInspectorFlag"}, |
| 326 | {139, nullptr, "GetAllowedSslHosts"}, | 631 | {139, nullptr, "GetAllowedSslHosts"}, |
| @@ -354,7 +659,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 354 | {167, nullptr, "SetUsb30DeviceEnableFlag"}, | 659 | {167, nullptr, "SetUsb30DeviceEnableFlag"}, |
| 355 | {168, nullptr, "GetThemeId"}, | 660 | {168, nullptr, "GetThemeId"}, |
| 356 | {169, nullptr, "SetThemeId"}, | 661 | {169, nullptr, "SetThemeId"}, |
| 357 | {170, nullptr, "GetChineseTraditionalInputMethod"}, | 662 | {170, &SET_SYS::GetChineseTraditionalInputMethod, "GetChineseTraditionalInputMethod"}, |
| 358 | {171, nullptr, "SetChineseTraditionalInputMethod"}, | 663 | {171, nullptr, "SetChineseTraditionalInputMethod"}, |
| 359 | {172, nullptr, "GetPtmCycleCountReliability"}, | 664 | {172, nullptr, "GetPtmCycleCountReliability"}, |
| 360 | {173, nullptr, "SetPtmCycleCountReliability"}, | 665 | {173, nullptr, "SetPtmCycleCountReliability"}, |
| @@ -385,12 +690,16 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { | |||
| 385 | {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, | 690 | {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, |
| 386 | {199, nullptr, "GetButtonConfigRegisteredSettings"}, | 691 | {199, nullptr, "GetButtonConfigRegisteredSettings"}, |
| 387 | {200, nullptr, "SetButtonConfigRegisteredSettings"}, | 692 | {200, nullptr, "SetButtonConfigRegisteredSettings"}, |
| 388 | {201, nullptr, "GetFieldTestingFlag"}, | 693 | {201, &SET_SYS::GetFieldTestingFlag, "GetFieldTestingFlag"}, |
| 389 | {202, nullptr, "SetFieldTestingFlag"}, | 694 | {202, nullptr, "SetFieldTestingFlag"}, |
| 390 | {203, nullptr, "GetPanelCrcMode"}, | 695 | {203, nullptr, "GetPanelCrcMode"}, |
| 391 | {204, nullptr, "SetPanelCrcMode"}, | 696 | {204, nullptr, "SetPanelCrcMode"}, |
| 392 | {205, nullptr, "GetNxControllerSettingsEx"}, | 697 | {205, nullptr, "GetNxControllerSettingsEx"}, |
| 393 | {206, nullptr, "SetNxControllerSettingsEx"}, | 698 | {206, nullptr, "SetNxControllerSettingsEx"}, |
| 699 | {207, nullptr, "GetHearingProtectionSafeguardFlag"}, | ||
| 700 | {208, nullptr, "SetHearingProtectionSafeguardFlag"}, | ||
| 701 | {209, nullptr, "GetHearingProtectionSafeguardRemainingTime"}, | ||
| 702 | {210, nullptr, "SetHearingProtectionSafeguardRemainingTime"}, | ||
| 394 | }; | 703 | }; |
| 395 | // clang-format on | 704 | // clang-format on |
| 396 | 705 | ||
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h index 1efbcc97a..c7dba2a9e 100644 --- a/src/core/hle/service/set/set_sys.h +++ b/src/core/hle/service/set/set_sys.h | |||
| @@ -3,7 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "common/uuid.h" | ||
| 6 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 8 | #include "core/hle/service/time/clock_types.h" | ||
| 7 | 9 | ||
| 8 | namespace Core { | 10 | namespace Core { |
| 9 | class System; | 11 | class System; |
| @@ -23,15 +25,331 @@ private: | |||
| 23 | BasicBlack = 1, | 25 | BasicBlack = 1, |
| 24 | }; | 26 | }; |
| 25 | 27 | ||
| 26 | void GetSettingsItemValueSize(HLERequestContext& ctx); | 28 | /// Indicates the current console is a retail or kiosk unit |
| 27 | void GetSettingsItemValue(HLERequestContext& ctx); | 29 | enum class QuestFlag : u8 { |
| 30 | Retail = 0, | ||
| 31 | Kiosk = 1, | ||
| 32 | }; | ||
| 33 | |||
| 34 | /// This is nn::settings::system::TvResolution | ||
| 35 | enum class TvResolution : u32 { | ||
| 36 | Auto, | ||
| 37 | Resolution1080p, | ||
| 38 | Resolution720p, | ||
| 39 | Resolution480p, | ||
| 40 | }; | ||
| 41 | |||
| 42 | /// This is nn::settings::system::HdmiContentType | ||
| 43 | enum class HdmiContentType : u32 { | ||
| 44 | None, | ||
| 45 | Graphics, | ||
| 46 | Cinema, | ||
| 47 | Photo, | ||
| 48 | Game, | ||
| 49 | }; | ||
| 50 | |||
| 51 | /// This is nn::settings::system::RgbRange | ||
| 52 | enum class RgbRange : u32 { | ||
| 53 | Auto, | ||
| 54 | Full, | ||
| 55 | Limited, | ||
| 56 | }; | ||
| 57 | |||
| 58 | /// This is nn::settings::system::CmuMode | ||
| 59 | enum class CmuMode : u32 { | ||
| 60 | None, | ||
| 61 | ColorInvert, | ||
| 62 | HighContrast, | ||
| 63 | GrayScale, | ||
| 64 | }; | ||
| 65 | |||
| 66 | /// This is nn::settings::system::PrimaryAlbumStorage | ||
| 67 | enum class PrimaryAlbumStorage : u32 { | ||
| 68 | Nand, | ||
| 69 | SdCard, | ||
| 70 | }; | ||
| 71 | |||
| 72 | /// This is nn::settings::system::NotificationVolume | ||
| 73 | enum class NotificationVolume : u32 { | ||
| 74 | Mute, | ||
| 75 | Low, | ||
| 76 | High, | ||
| 77 | }; | ||
| 78 | |||
| 79 | /// This is nn::settings::system::ChineseTraditionalInputMethod | ||
| 80 | enum class ChineseTraditionalInputMethod : u32 { | ||
| 81 | Unknown0 = 0, | ||
| 82 | Unknown1 = 1, | ||
| 83 | Unknown2 = 2, | ||
| 84 | }; | ||
| 85 | |||
| 86 | /// This is nn::settings::system::ErrorReportSharePermission | ||
| 87 | enum class ErrorReportSharePermission : u32 { | ||
| 88 | NotConfirmed, | ||
| 89 | Granted, | ||
| 90 | Denied, | ||
| 91 | }; | ||
| 92 | |||
| 93 | /// This is nn::settings::system::FriendPresenceOverlayPermission | ||
| 94 | enum class FriendPresenceOverlayPermission : u8 { | ||
| 95 | NotConfirmed, | ||
| 96 | NoDisplay, | ||
| 97 | FavoriteFriends, | ||
| 98 | Friends, | ||
| 99 | }; | ||
| 100 | |||
| 101 | /// This is nn::settings::system::HandheldSleepPlan | ||
| 102 | enum class HandheldSleepPlan : u32 { | ||
| 103 | Sleep1Min, | ||
| 104 | Sleep3Min, | ||
| 105 | Sleep5Min, | ||
| 106 | Sleep10Min, | ||
| 107 | Sleep30Min, | ||
| 108 | Never, | ||
| 109 | }; | ||
| 110 | |||
| 111 | /// This is nn::settings::system::ConsoleSleepPlan | ||
| 112 | enum class ConsoleSleepPlan : u32 { | ||
| 113 | Sleep1Hour, | ||
| 114 | Sleep2Hour, | ||
| 115 | Sleep3Hour, | ||
| 116 | Sleep6Hour, | ||
| 117 | Sleep12Hour, | ||
| 118 | Never, | ||
| 119 | }; | ||
| 120 | |||
| 121 | /// This is nn::settings::system::RegionCode | ||
| 122 | enum class RegionCode : u32 { | ||
| 123 | Japan, | ||
| 124 | Usa, | ||
| 125 | Europe, | ||
| 126 | Australia, | ||
| 127 | HongKongTaiwanKorea, | ||
| 128 | China, | ||
| 129 | }; | ||
| 130 | |||
| 131 | /// This is nn::settings::system::EulaVersionClockType | ||
| 132 | enum class EulaVersionClockType : u32 { | ||
| 133 | NetworkSystemClock, | ||
| 134 | SteadyClock, | ||
| 135 | }; | ||
| 136 | |||
| 137 | /// This is nn::settings::system::SleepFlag | ||
| 138 | struct SleepFlag { | ||
| 139 | union { | ||
| 140 | u32 raw{}; | ||
| 141 | |||
| 142 | BitField<0, 1, u32> SleepsWhilePlayingMedia; | ||
| 143 | BitField<1, 1, u32> WakesAtPowerStateChange; | ||
| 144 | }; | ||
| 145 | }; | ||
| 146 | static_assert(sizeof(SleepFlag) == 4, "TvFlag is an invalid size"); | ||
| 147 | |||
| 148 | /// This is nn::settings::system::TvFlag | ||
| 149 | struct TvFlag { | ||
| 150 | union { | ||
| 151 | u32 raw{}; | ||
| 152 | |||
| 153 | BitField<0, 1, u32> Allows4k; | ||
| 154 | BitField<1, 1, u32> Allows3d; | ||
| 155 | BitField<2, 1, u32> AllowsCec; | ||
| 156 | BitField<3, 1, u32> PreventsScreenBurnIn; | ||
| 157 | }; | ||
| 158 | }; | ||
| 159 | static_assert(sizeof(TvFlag) == 4, "TvFlag is an invalid size"); | ||
| 160 | |||
| 161 | /// This is nn::settings::system::InitialLaunchFlag | ||
| 162 | struct InitialLaunchFlag { | ||
| 163 | union { | ||
| 164 | u32 raw{}; | ||
| 165 | |||
| 166 | BitField<0, 1, u32> InitialLaunchCompletionFlag; | ||
| 167 | BitField<8, 1, u32> InitialLaunchUserAdditionFlag; | ||
| 168 | BitField<16, 1, u32> InitialLaunchTimestampFlag; | ||
| 169 | }; | ||
| 170 | }; | ||
| 171 | static_assert(sizeof(InitialLaunchFlag) == 4, "InitialLaunchFlag is an invalid size"); | ||
| 172 | |||
| 173 | /// This is nn::settings::system::NotificationFlag | ||
| 174 | struct NotificationFlag { | ||
| 175 | union { | ||
| 176 | u32 raw{}; | ||
| 177 | |||
| 178 | BitField<0, 1, u32> RingtoneFlag; | ||
| 179 | BitField<1, 1, u32> DownloadCompletionFlag; | ||
| 180 | BitField<8, 1, u32> EnablesNews; | ||
| 181 | BitField<9, 1, u32> IncomingLampFlag; | ||
| 182 | }; | ||
| 183 | }; | ||
| 184 | static_assert(sizeof(NotificationFlag) == 4, "NotificationFlag is an invalid size"); | ||
| 185 | |||
| 186 | /// This is nn::settings::system::AccountNotificationFlag | ||
| 187 | struct AccountNotificationFlag { | ||
| 188 | union { | ||
| 189 | u32 raw{}; | ||
| 190 | |||
| 191 | BitField<0, 1, u32> FriendOnlineFlag; | ||
| 192 | BitField<1, 1, u32> FriendRequestFlag; | ||
| 193 | BitField<8, 1, u32> CoralInvitationFlag; | ||
| 194 | }; | ||
| 195 | }; | ||
| 196 | static_assert(sizeof(AccountNotificationFlag) == 4, | ||
| 197 | "AccountNotificationFlag is an invalid size"); | ||
| 198 | |||
| 199 | /// This is nn::settings::system::TvSettings | ||
| 200 | struct TvSettings { | ||
| 201 | TvFlag flags; | ||
| 202 | TvResolution tv_resolution; | ||
| 203 | HdmiContentType hdmi_content_type; | ||
| 204 | RgbRange rgb_range; | ||
| 205 | CmuMode cmu_mode; | ||
| 206 | u32 tv_underscan; | ||
| 207 | f32 tv_gama; | ||
| 208 | f32 constrast_ratio; | ||
| 209 | }; | ||
| 210 | static_assert(sizeof(TvSettings) == 0x20, "TvSettings is an invalid size"); | ||
| 211 | |||
| 212 | /// This is nn::settings::system::NotificationTime | ||
| 213 | struct NotificationTime { | ||
| 214 | u32 hour; | ||
| 215 | u32 minute; | ||
| 216 | }; | ||
| 217 | static_assert(sizeof(NotificationTime) == 0x8, "NotificationTime is an invalid size"); | ||
| 218 | |||
| 219 | /// This is nn::settings::system::NotificationSettings | ||
| 220 | struct NotificationSettings { | ||
| 221 | NotificationFlag flags; | ||
| 222 | NotificationVolume volume; | ||
| 223 | NotificationTime start_time; | ||
| 224 | NotificationTime stop_time; | ||
| 225 | }; | ||
| 226 | static_assert(sizeof(NotificationSettings) == 0x18, "NotificationSettings is an invalid size"); | ||
| 227 | |||
| 228 | /// This is nn::settings::system::AccountSettings | ||
| 229 | struct AccountSettings { | ||
| 230 | u32 flags; | ||
| 231 | }; | ||
| 232 | static_assert(sizeof(AccountSettings) == 0x4, "AccountSettings is an invalid size"); | ||
| 233 | |||
| 234 | /// This is nn::settings::system::AccountNotificationSettings | ||
| 235 | struct AccountNotificationSettings { | ||
| 236 | Common::UUID uid; | ||
| 237 | AccountNotificationFlag flags; | ||
| 238 | FriendPresenceOverlayPermission friend_presence_permission; | ||
| 239 | FriendPresenceOverlayPermission friend_invitation_permission; | ||
| 240 | INSERT_PADDING_BYTES(0x2); | ||
| 241 | }; | ||
| 242 | static_assert(sizeof(AccountNotificationSettings) == 0x18, | ||
| 243 | "AccountNotificationSettings is an invalid size"); | ||
| 244 | |||
| 245 | /// This is nn::settings::system::InitialLaunchSettings | ||
| 246 | struct SleepSettings { | ||
| 247 | SleepFlag flags; | ||
| 248 | HandheldSleepPlan handheld_sleep_plan; | ||
| 249 | ConsoleSleepPlan console_sleep_plan; | ||
| 250 | }; | ||
| 251 | static_assert(sizeof(SleepSettings) == 0xc, "SleepSettings is incorrect size"); | ||
| 252 | |||
| 253 | /// This is nn::settings::system::InitialLaunchSettings | ||
| 254 | struct InitialLaunchSettings { | ||
| 255 | InitialLaunchFlag flags; | ||
| 256 | INSERT_PADDING_BYTES(0x4); | ||
| 257 | Time::Clock::SteadyClockTimePoint timestamp; | ||
| 258 | }; | ||
| 259 | static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size"); | ||
| 260 | |||
| 261 | /// This is nn::settings::system::InitialLaunchSettings | ||
| 262 | struct EulaVersion { | ||
| 263 | u32 version; | ||
| 264 | RegionCode region_code; | ||
| 265 | EulaVersionClockType clock_type; | ||
| 266 | INSERT_PADDING_BYTES(0x4); | ||
| 267 | s64 posix_time; | ||
| 268 | Time::Clock::SteadyClockTimePoint timestamp; | ||
| 269 | }; | ||
| 270 | static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size"); | ||
| 271 | |||
| 272 | void SetLanguageCode(HLERequestContext& ctx); | ||
| 28 | void GetFirmwareVersion(HLERequestContext& ctx); | 273 | void GetFirmwareVersion(HLERequestContext& ctx); |
| 29 | void GetFirmwareVersion2(HLERequestContext& ctx); | 274 | void GetFirmwareVersion2(HLERequestContext& ctx); |
| 275 | void GetAccountSettings(HLERequestContext& ctx); | ||
| 276 | void SetAccountSettings(HLERequestContext& ctx); | ||
| 277 | void GetEulaVersions(HLERequestContext& ctx); | ||
| 278 | void SetEulaVersions(HLERequestContext& ctx); | ||
| 30 | void GetColorSetId(HLERequestContext& ctx); | 279 | void GetColorSetId(HLERequestContext& ctx); |
| 31 | void SetColorSetId(HLERequestContext& ctx); | 280 | void SetColorSetId(HLERequestContext& ctx); |
| 281 | void GetNotificationSettings(HLERequestContext& ctx); | ||
| 282 | void SetNotificationSettings(HLERequestContext& ctx); | ||
| 283 | void GetAccountNotificationSettings(HLERequestContext& ctx); | ||
| 284 | void SetAccountNotificationSettings(HLERequestContext& ctx); | ||
| 285 | void GetSettingsItemValueSize(HLERequestContext& ctx); | ||
| 286 | void GetSettingsItemValue(HLERequestContext& ctx); | ||
| 287 | void GetTvSettings(HLERequestContext& ctx); | ||
| 288 | void SetTvSettings(HLERequestContext& ctx); | ||
| 289 | void GetQuestFlag(HLERequestContext& ctx); | ||
| 290 | void SetRegionCode(HLERequestContext& ctx); | ||
| 291 | void GetPrimaryAlbumStorage(HLERequestContext& ctx); | ||
| 292 | void GetSleepSettings(HLERequestContext& ctx); | ||
| 293 | void SetSleepSettings(HLERequestContext& ctx); | ||
| 294 | void GetInitialLaunchSettings(HLERequestContext& ctx); | ||
| 295 | void SetInitialLaunchSettings(HLERequestContext& ctx); | ||
| 32 | void GetDeviceNickName(HLERequestContext& ctx); | 296 | void GetDeviceNickName(HLERequestContext& ctx); |
| 297 | void SetDeviceNickName(HLERequestContext& ctx); | ||
| 298 | void GetProductModel(HLERequestContext& ctx); | ||
| 299 | void GetMiiAuthorId(HLERequestContext& ctx); | ||
| 300 | void GetAutoUpdateEnableFlag(HLERequestContext& ctx); | ||
| 301 | void GetBatteryPercentageFlag(HLERequestContext& ctx); | ||
| 302 | void GetErrorReportSharePermission(HLERequestContext& ctx); | ||
| 303 | void GetAppletLaunchFlags(HLERequestContext& ctx); | ||
| 304 | void SetAppletLaunchFlags(HLERequestContext& ctx); | ||
| 305 | void GetKeyboardLayout(HLERequestContext& ctx); | ||
| 306 | void GetChineseTraditionalInputMethod(HLERequestContext& ctx); | ||
| 307 | void GetFieldTestingFlag(HLERequestContext& ctx); | ||
| 308 | |||
| 309 | AccountSettings account_settings{ | ||
| 310 | .flags = {}, | ||
| 311 | }; | ||
| 33 | 312 | ||
| 34 | ColorSet color_set = ColorSet::BasicWhite; | 313 | ColorSet color_set = ColorSet::BasicWhite; |
| 314 | |||
| 315 | NotificationSettings notification_settings{ | ||
| 316 | .flags = {0x300}, | ||
| 317 | .volume = NotificationVolume::High, | ||
| 318 | .start_time = {.hour = 9, .minute = 0}, | ||
| 319 | .stop_time = {.hour = 21, .minute = 0}, | ||
| 320 | }; | ||
| 321 | |||
| 322 | std::vector<AccountNotificationSettings> account_notifications{}; | ||
| 323 | |||
| 324 | TvSettings tv_settings{ | ||
| 325 | .flags = {0xc}, | ||
| 326 | .tv_resolution = TvResolution::Auto, | ||
| 327 | .hdmi_content_type = HdmiContentType::Game, | ||
| 328 | .rgb_range = RgbRange::Auto, | ||
| 329 | .cmu_mode = CmuMode::None, | ||
| 330 | .tv_underscan = {}, | ||
| 331 | .tv_gama = 1.0f, | ||
| 332 | .constrast_ratio = 0.5f, | ||
| 333 | }; | ||
| 334 | |||
| 335 | InitialLaunchSettings launch_settings{ | ||
| 336 | .flags = {0x10001}, | ||
| 337 | .timestamp = {}, | ||
| 338 | }; | ||
| 339 | |||
| 340 | SleepSettings sleep_settings{ | ||
| 341 | .flags = {0x3}, | ||
| 342 | .handheld_sleep_plan = HandheldSleepPlan::Sleep10Min, | ||
| 343 | .console_sleep_plan = ConsoleSleepPlan::Sleep1Hour, | ||
| 344 | }; | ||
| 345 | |||
| 346 | u32 applet_launch_flag{}; | ||
| 347 | |||
| 348 | std::vector<EulaVersion> eula_versions{}; | ||
| 349 | |||
| 350 | RegionCode region_code; | ||
| 351 | |||
| 352 | LanguageCode language_code_setting; | ||
| 35 | }; | 353 | }; |
| 36 | 354 | ||
| 37 | } // namespace Service::Set | 355 | } // namespace Service::Set |