diff options
| author | 2019-06-05 15:39:33 -0400 | |
|---|---|---|
| committer | 2019-06-05 15:39:33 -0400 | |
| commit | 2beaaa35c5002f762e82757b8db70a687e4faa7a (patch) | |
| tree | ee7d89a593226e207871fe320679980df327ef7c /src | |
| parent | Merge pull request #2527 from lioncash/index (diff) | |
| parent | Fix bitmask logic inversion (diff) | |
| download | yuzu-2beaaa35c5002f762e82757b8db70a687e4faa7a.tar.gz yuzu-2beaaa35c5002f762e82757b8db70a687e4faa7a.tar.xz yuzu-2beaaa35c5002f762e82757b8db70a687e4faa7a.zip | |
Merge pull request #2510 from SciresM/desired_language
Implement/Fix IApplicationFunctions::GetDesiredLanguage
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/core/file_sys/control_metadata.cpp | 4 | ||||
| -rw-r--r-- | src/core/file_sys/control_metadata.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 40 | ||||
| -rw-r--r-- | src/core/hle/service/ns/errors.h | 12 | ||||
| -rw-r--r-- | src/core/hle/service/ns/language.cpp | 392 | ||||
| -rw-r--r-- | src/core/hle/service/ns/language.h | 45 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.cpp | 862 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.h | 82 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns_language.h | 42 |
10 files changed, 1081 insertions, 402 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a56e526a6..6bf512e12 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -328,6 +328,9 @@ add_library(core STATIC | |||
| 328 | hle/service/nim/nim.h | 328 | hle/service/nim/nim.h |
| 329 | hle/service/npns/npns.cpp | 329 | hle/service/npns/npns.cpp |
| 330 | hle/service/npns/npns.h | 330 | hle/service/npns/npns.h |
| 331 | hle/service/ns/errors.h | ||
| 332 | hle/service/ns/language.cpp | ||
| 333 | hle/service/ns/language.h | ||
| 331 | hle/service/ns/ns.cpp | 334 | hle/service/ns/ns.cpp |
| 332 | hle/service/ns/ns.h | 335 | hle/service/ns/ns.h |
| 333 | hle/service/ns/pl_u.cpp | 336 | hle/service/ns/pl_u.cpp |
diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp index 60ea9ad12..04da30825 100644 --- a/src/core/file_sys/control_metadata.cpp +++ b/src/core/file_sys/control_metadata.cpp | |||
| @@ -87,6 +87,10 @@ u64 NACP::GetDefaultJournalSaveSize() const { | |||
| 87 | return raw.user_account_save_data_journal_size; | 87 | return raw.user_account_save_data_journal_size; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | u32 NACP::GetSupportedLanguages() const { | ||
| 91 | return raw.supported_languages; | ||
| 92 | } | ||
| 93 | |||
| 90 | std::vector<u8> NACP::GetRawBytes() const { | 94 | std::vector<u8> NACP::GetRawBytes() const { |
| 91 | std::vector<u8> out(sizeof(RawNACP)); | 95 | std::vector<u8> out(sizeof(RawNACP)); |
| 92 | std::memcpy(out.data(), &raw, sizeof(RawNACP)); | 96 | std::memcpy(out.data(), &raw, sizeof(RawNACP)); |
diff --git a/src/core/file_sys/control_metadata.h b/src/core/file_sys/control_metadata.h index 280710ddf..1be34ed55 100644 --- a/src/core/file_sys/control_metadata.h +++ b/src/core/file_sys/control_metadata.h | |||
| @@ -109,6 +109,7 @@ public: | |||
| 109 | std::string GetVersionString() const; | 109 | std::string GetVersionString() const; |
| 110 | u64 GetDefaultNormalSaveSize() const; | 110 | u64 GetDefaultNormalSaveSize() const; |
| 111 | u64 GetDefaultJournalSaveSize() const; | 111 | u64 GetDefaultJournalSaveSize() const; |
| 112 | u32 GetSupportedLanguages() const; | ||
| 112 | std::vector<u8> GetRawBytes() const; | 113 | std::vector<u8> GetRawBytes() const; |
| 113 | 114 | ||
| 114 | private: | 115 | private: |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 1a32a109f..3f201c821 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | #include <cstring> | 8 | #include <cstring> |
| 9 | #include "audio_core/audio_renderer.h" | 9 | #include "audio_core/audio_renderer.h" |
| 10 | #include "core/core.h" | 10 | #include "core/core.h" |
| 11 | #include "core/file_sys/control_metadata.h" | ||
| 12 | #include "core/file_sys/patch_manager.h" | ||
| 11 | #include "core/file_sys/savedata_factory.h" | 13 | #include "core/file_sys/savedata_factory.h" |
| 12 | #include "core/hle/ipc_helpers.h" | 14 | #include "core/hle/ipc_helpers.h" |
| 13 | #include "core/hle/kernel/kernel.h" | 15 | #include "core/hle/kernel/kernel.h" |
| @@ -29,9 +31,11 @@ | |||
| 29 | #include "core/hle/service/am/tcap.h" | 31 | #include "core/hle/service/am/tcap.h" |
| 30 | #include "core/hle/service/apm/apm.h" | 32 | #include "core/hle/service/apm/apm.h" |
| 31 | #include "core/hle/service/filesystem/filesystem.h" | 33 | #include "core/hle/service/filesystem/filesystem.h" |
| 34 | #include "core/hle/service/ns/ns.h" | ||
| 32 | #include "core/hle/service/nvflinger/nvflinger.h" | 35 | #include "core/hle/service/nvflinger/nvflinger.h" |
| 33 | #include "core/hle/service/pm/pm.h" | 36 | #include "core/hle/service/pm/pm.h" |
| 34 | #include "core/hle/service/set/set.h" | 37 | #include "core/hle/service/set/set.h" |
| 38 | #include "core/hle/service/sm/sm.h" | ||
| 35 | #include "core/hle/service/vi/vi.h" | 39 | #include "core/hle/service/vi/vi.h" |
| 36 | #include "core/settings.h" | 40 | #include "core/settings.h" |
| 37 | 41 | ||
| @@ -1100,10 +1104,42 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { | |||
| 1100 | // TODO(bunnei): This should be configurable | 1104 | // TODO(bunnei): This should be configurable |
| 1101 | LOG_DEBUG(Service_AM, "called"); | 1105 | LOG_DEBUG(Service_AM, "called"); |
| 1102 | 1106 | ||
| 1107 | // Get supported languages from NACP, if possible | ||
| 1108 | // Default to 0 (all languages supported) | ||
| 1109 | u32 supported_languages = 0; | ||
| 1110 | FileSys::PatchManager pm{Core::System::GetInstance().CurrentProcess()->GetTitleID()}; | ||
| 1111 | |||
| 1112 | const auto res = pm.GetControlMetadata(); | ||
| 1113 | if (res.first != nullptr) { | ||
| 1114 | supported_languages = res.first->GetSupportedLanguages(); | ||
| 1115 | } | ||
| 1116 | |||
| 1117 | // Call IApplicationManagerInterface implementation. | ||
| 1118 | auto& service_manager = Core::System::GetInstance().ServiceManager(); | ||
| 1119 | auto ns_am2 = service_manager.GetService<Service::NS::NS>("ns:am2"); | ||
| 1120 | auto app_man = ns_am2->GetApplicationManagerInterface(); | ||
| 1121 | |||
| 1122 | // Get desired application language | ||
| 1123 | const auto res_lang = app_man->GetApplicationDesiredLanguage(supported_languages); | ||
| 1124 | if (res_lang.Failed()) { | ||
| 1125 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1126 | rb.Push(res_lang.Code()); | ||
| 1127 | return; | ||
| 1128 | } | ||
| 1129 | |||
| 1130 | // Convert to settings language code. | ||
| 1131 | const auto res_code = app_man->ConvertApplicationLanguageToLanguageCode(*res_lang); | ||
| 1132 | if (res_code.Failed()) { | ||
| 1133 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1134 | rb.Push(res_code.Code()); | ||
| 1135 | return; | ||
| 1136 | } | ||
| 1137 | |||
| 1138 | LOG_DEBUG(Service_AM, "got desired_language={:016X}", *res_code); | ||
| 1139 | |||
| 1103 | IPC::ResponseBuilder rb{ctx, 4}; | 1140 | IPC::ResponseBuilder rb{ctx, 4}; |
| 1104 | rb.Push(RESULT_SUCCESS); | 1141 | rb.Push(RESULT_SUCCESS); |
| 1105 | rb.Push( | 1142 | rb.Push(*res_code); |
| 1106 | static_cast<u64>(Service::Set::GetLanguageCodeFromIndex(Settings::values.language_index))); | ||
| 1107 | } | 1143 | } |
| 1108 | 1144 | ||
| 1109 | void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) { | 1145 | void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/ns/errors.h b/src/core/hle/service/ns/errors.h new file mode 100644 index 000000000..f4aea8a65 --- /dev/null +++ b/src/core/hle/service/ns/errors.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/result.h" | ||
| 8 | |||
| 9 | namespace Service::NS { | ||
| 10 | |||
| 11 | constexpr ResultCode ERR_APPLICATION_LANGUAGE_NOT_FOUND{ErrorModule::NS, 300}; | ||
| 12 | } \ No newline at end of file | ||
diff --git a/src/core/hle/service/ns/language.cpp b/src/core/hle/service/ns/language.cpp new file mode 100644 index 000000000..29c4a820c --- /dev/null +++ b/src/core/hle/service/ns/language.cpp | |||
| @@ -0,0 +1,392 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/hle/service/ns/language.h" | ||
| 6 | #include "core/hle/service/set/set.h" | ||
| 7 | |||
| 8 | namespace Service::NS { | ||
| 9 | |||
| 10 | constexpr ApplicationLanguagePriorityList priority_list_american_english = {{ | ||
| 11 | ApplicationLanguage::AmericanEnglish, | ||
| 12 | ApplicationLanguage::BritishEnglish, | ||
| 13 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 14 | ApplicationLanguage::CanadianFrench, | ||
| 15 | ApplicationLanguage::French, | ||
| 16 | ApplicationLanguage::German, | ||
| 17 | ApplicationLanguage::Spanish, | ||
| 18 | ApplicationLanguage::Italian, | ||
| 19 | ApplicationLanguage::Dutch, | ||
| 20 | ApplicationLanguage::Portuguese, | ||
| 21 | ApplicationLanguage::Russian, | ||
| 22 | ApplicationLanguage::Japanese, | ||
| 23 | ApplicationLanguage::SimplifiedChinese, | ||
| 24 | ApplicationLanguage::TraditionalChinese, | ||
| 25 | ApplicationLanguage::Korean, | ||
| 26 | }}; | ||
| 27 | |||
| 28 | constexpr ApplicationLanguagePriorityList priority_list_british_english = {{ | ||
| 29 | ApplicationLanguage::BritishEnglish, | ||
| 30 | ApplicationLanguage::AmericanEnglish, | ||
| 31 | ApplicationLanguage::French, | ||
| 32 | ApplicationLanguage::German, | ||
| 33 | ApplicationLanguage::Spanish, | ||
| 34 | ApplicationLanguage::Italian, | ||
| 35 | ApplicationLanguage::Dutch, | ||
| 36 | ApplicationLanguage::Portuguese, | ||
| 37 | ApplicationLanguage::Russian, | ||
| 38 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 39 | ApplicationLanguage::CanadianFrench, | ||
| 40 | ApplicationLanguage::Japanese, | ||
| 41 | ApplicationLanguage::SimplifiedChinese, | ||
| 42 | ApplicationLanguage::TraditionalChinese, | ||
| 43 | ApplicationLanguage::Korean, | ||
| 44 | }}; | ||
| 45 | |||
| 46 | constexpr ApplicationLanguagePriorityList priority_list_japanese = {{ | ||
| 47 | ApplicationLanguage::Japanese, | ||
| 48 | ApplicationLanguage::AmericanEnglish, | ||
| 49 | ApplicationLanguage::BritishEnglish, | ||
| 50 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 51 | ApplicationLanguage::CanadianFrench, | ||
| 52 | ApplicationLanguage::French, | ||
| 53 | ApplicationLanguage::German, | ||
| 54 | ApplicationLanguage::Spanish, | ||
| 55 | ApplicationLanguage::Italian, | ||
| 56 | ApplicationLanguage::Dutch, | ||
| 57 | ApplicationLanguage::Portuguese, | ||
| 58 | ApplicationLanguage::Russian, | ||
| 59 | ApplicationLanguage::SimplifiedChinese, | ||
| 60 | ApplicationLanguage::TraditionalChinese, | ||
| 61 | ApplicationLanguage::Korean, | ||
| 62 | }}; | ||
| 63 | |||
| 64 | constexpr ApplicationLanguagePriorityList priority_list_french = {{ | ||
| 65 | ApplicationLanguage::French, | ||
| 66 | ApplicationLanguage::CanadianFrench, | ||
| 67 | ApplicationLanguage::BritishEnglish, | ||
| 68 | ApplicationLanguage::AmericanEnglish, | ||
| 69 | ApplicationLanguage::German, | ||
| 70 | ApplicationLanguage::Spanish, | ||
| 71 | ApplicationLanguage::Italian, | ||
| 72 | ApplicationLanguage::Dutch, | ||
| 73 | ApplicationLanguage::Portuguese, | ||
| 74 | ApplicationLanguage::Russian, | ||
| 75 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 76 | ApplicationLanguage::Japanese, | ||
| 77 | ApplicationLanguage::SimplifiedChinese, | ||
| 78 | ApplicationLanguage::TraditionalChinese, | ||
| 79 | ApplicationLanguage::Korean, | ||
| 80 | }}; | ||
| 81 | |||
| 82 | constexpr ApplicationLanguagePriorityList priority_list_german = {{ | ||
| 83 | ApplicationLanguage::German, | ||
| 84 | ApplicationLanguage::BritishEnglish, | ||
| 85 | ApplicationLanguage::AmericanEnglish, | ||
| 86 | ApplicationLanguage::French, | ||
| 87 | ApplicationLanguage::Spanish, | ||
| 88 | ApplicationLanguage::Italian, | ||
| 89 | ApplicationLanguage::Dutch, | ||
| 90 | ApplicationLanguage::Portuguese, | ||
| 91 | ApplicationLanguage::Russian, | ||
| 92 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 93 | ApplicationLanguage::CanadianFrench, | ||
| 94 | ApplicationLanguage::Japanese, | ||
| 95 | ApplicationLanguage::SimplifiedChinese, | ||
| 96 | ApplicationLanguage::TraditionalChinese, | ||
| 97 | ApplicationLanguage::Korean, | ||
| 98 | }}; | ||
| 99 | |||
| 100 | constexpr ApplicationLanguagePriorityList priority_list_latin_american_spanish = {{ | ||
| 101 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 102 | ApplicationLanguage::Spanish, | ||
| 103 | ApplicationLanguage::AmericanEnglish, | ||
| 104 | ApplicationLanguage::BritishEnglish, | ||
| 105 | ApplicationLanguage::Portuguese, | ||
| 106 | ApplicationLanguage::CanadianFrench, | ||
| 107 | ApplicationLanguage::French, | ||
| 108 | ApplicationLanguage::Italian, | ||
| 109 | ApplicationLanguage::German, | ||
| 110 | ApplicationLanguage::Dutch, | ||
| 111 | ApplicationLanguage::Russian, | ||
| 112 | ApplicationLanguage::Japanese, | ||
| 113 | ApplicationLanguage::SimplifiedChinese, | ||
| 114 | ApplicationLanguage::TraditionalChinese, | ||
| 115 | ApplicationLanguage::Korean, | ||
| 116 | }}; | ||
| 117 | |||
| 118 | constexpr ApplicationLanguagePriorityList priority_list_spanish = {{ | ||
| 119 | ApplicationLanguage::Spanish, | ||
| 120 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 121 | ApplicationLanguage::BritishEnglish, | ||
| 122 | ApplicationLanguage::AmericanEnglish, | ||
| 123 | ApplicationLanguage::French, | ||
| 124 | ApplicationLanguage::German, | ||
| 125 | ApplicationLanguage::Italian, | ||
| 126 | ApplicationLanguage::Dutch, | ||
| 127 | ApplicationLanguage::Portuguese, | ||
| 128 | ApplicationLanguage::Russian, | ||
| 129 | ApplicationLanguage::CanadianFrench, | ||
| 130 | ApplicationLanguage::Japanese, | ||
| 131 | ApplicationLanguage::SimplifiedChinese, | ||
| 132 | ApplicationLanguage::TraditionalChinese, | ||
| 133 | ApplicationLanguage::Korean, | ||
| 134 | }}; | ||
| 135 | |||
| 136 | constexpr ApplicationLanguagePriorityList priority_list_italian = {{ | ||
| 137 | ApplicationLanguage::Italian, | ||
| 138 | ApplicationLanguage::BritishEnglish, | ||
| 139 | ApplicationLanguage::AmericanEnglish, | ||
| 140 | ApplicationLanguage::French, | ||
| 141 | ApplicationLanguage::German, | ||
| 142 | ApplicationLanguage::Spanish, | ||
| 143 | ApplicationLanguage::Dutch, | ||
| 144 | ApplicationLanguage::Portuguese, | ||
| 145 | ApplicationLanguage::Russian, | ||
| 146 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 147 | ApplicationLanguage::CanadianFrench, | ||
| 148 | ApplicationLanguage::Japanese, | ||
| 149 | ApplicationLanguage::SimplifiedChinese, | ||
| 150 | ApplicationLanguage::TraditionalChinese, | ||
| 151 | ApplicationLanguage::Korean, | ||
| 152 | }}; | ||
| 153 | |||
| 154 | constexpr ApplicationLanguagePriorityList priority_list_dutch = {{ | ||
| 155 | ApplicationLanguage::Dutch, | ||
| 156 | ApplicationLanguage::BritishEnglish, | ||
| 157 | ApplicationLanguage::AmericanEnglish, | ||
| 158 | ApplicationLanguage::French, | ||
| 159 | ApplicationLanguage::German, | ||
| 160 | ApplicationLanguage::Spanish, | ||
| 161 | ApplicationLanguage::Italian, | ||
| 162 | ApplicationLanguage::Portuguese, | ||
| 163 | ApplicationLanguage::Russian, | ||
| 164 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 165 | ApplicationLanguage::CanadianFrench, | ||
| 166 | ApplicationLanguage::Japanese, | ||
| 167 | ApplicationLanguage::SimplifiedChinese, | ||
| 168 | ApplicationLanguage::TraditionalChinese, | ||
| 169 | ApplicationLanguage::Korean, | ||
| 170 | }}; | ||
| 171 | |||
| 172 | constexpr ApplicationLanguagePriorityList priority_list_canadian_french = {{ | ||
| 173 | ApplicationLanguage::CanadianFrench, | ||
| 174 | ApplicationLanguage::French, | ||
| 175 | ApplicationLanguage::AmericanEnglish, | ||
| 176 | ApplicationLanguage::BritishEnglish, | ||
| 177 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 178 | ApplicationLanguage::Spanish, | ||
| 179 | ApplicationLanguage::German, | ||
| 180 | ApplicationLanguage::Italian, | ||
| 181 | ApplicationLanguage::Dutch, | ||
| 182 | ApplicationLanguage::Portuguese, | ||
| 183 | ApplicationLanguage::Russian, | ||
| 184 | ApplicationLanguage::Japanese, | ||
| 185 | ApplicationLanguage::SimplifiedChinese, | ||
| 186 | ApplicationLanguage::TraditionalChinese, | ||
| 187 | ApplicationLanguage::Korean, | ||
| 188 | }}; | ||
| 189 | |||
| 190 | constexpr ApplicationLanguagePriorityList priority_list_portuguese = {{ | ||
| 191 | ApplicationLanguage::Portuguese, | ||
| 192 | ApplicationLanguage::BritishEnglish, | ||
| 193 | ApplicationLanguage::AmericanEnglish, | ||
| 194 | ApplicationLanguage::French, | ||
| 195 | ApplicationLanguage::German, | ||
| 196 | ApplicationLanguage::Spanish, | ||
| 197 | ApplicationLanguage::Italian, | ||
| 198 | ApplicationLanguage::Dutch, | ||
| 199 | ApplicationLanguage::Russian, | ||
| 200 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 201 | ApplicationLanguage::CanadianFrench, | ||
| 202 | ApplicationLanguage::Japanese, | ||
| 203 | ApplicationLanguage::SimplifiedChinese, | ||
| 204 | ApplicationLanguage::TraditionalChinese, | ||
| 205 | ApplicationLanguage::Korean, | ||
| 206 | }}; | ||
| 207 | |||
| 208 | constexpr ApplicationLanguagePriorityList priority_list_russian = {{ | ||
| 209 | ApplicationLanguage::Russian, | ||
| 210 | ApplicationLanguage::BritishEnglish, | ||
| 211 | ApplicationLanguage::AmericanEnglish, | ||
| 212 | ApplicationLanguage::French, | ||
| 213 | ApplicationLanguage::German, | ||
| 214 | ApplicationLanguage::Spanish, | ||
| 215 | ApplicationLanguage::Italian, | ||
| 216 | ApplicationLanguage::Dutch, | ||
| 217 | ApplicationLanguage::Portuguese, | ||
| 218 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 219 | ApplicationLanguage::CanadianFrench, | ||
| 220 | ApplicationLanguage::Japanese, | ||
| 221 | ApplicationLanguage::SimplifiedChinese, | ||
| 222 | ApplicationLanguage::TraditionalChinese, | ||
| 223 | ApplicationLanguage::Korean, | ||
| 224 | }}; | ||
| 225 | |||
| 226 | constexpr ApplicationLanguagePriorityList priority_list_korean = {{ | ||
| 227 | ApplicationLanguage::Korean, | ||
| 228 | ApplicationLanguage::AmericanEnglish, | ||
| 229 | ApplicationLanguage::BritishEnglish, | ||
| 230 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 231 | ApplicationLanguage::CanadianFrench, | ||
| 232 | ApplicationLanguage::French, | ||
| 233 | ApplicationLanguage::German, | ||
| 234 | ApplicationLanguage::Spanish, | ||
| 235 | ApplicationLanguage::Italian, | ||
| 236 | ApplicationLanguage::Dutch, | ||
| 237 | ApplicationLanguage::Portuguese, | ||
| 238 | ApplicationLanguage::Russian, | ||
| 239 | ApplicationLanguage::Japanese, | ||
| 240 | ApplicationLanguage::SimplifiedChinese, | ||
| 241 | ApplicationLanguage::TraditionalChinese, | ||
| 242 | }}; | ||
| 243 | |||
| 244 | constexpr ApplicationLanguagePriorityList priority_list_traditional_chinese = {{ | ||
| 245 | ApplicationLanguage::TraditionalChinese, | ||
| 246 | ApplicationLanguage::SimplifiedChinese, | ||
| 247 | ApplicationLanguage::AmericanEnglish, | ||
| 248 | ApplicationLanguage::BritishEnglish, | ||
| 249 | ApplicationLanguage::Japanese, | ||
| 250 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 251 | ApplicationLanguage::CanadianFrench, | ||
| 252 | ApplicationLanguage::French, | ||
| 253 | ApplicationLanguage::German, | ||
| 254 | ApplicationLanguage::Spanish, | ||
| 255 | ApplicationLanguage::Italian, | ||
| 256 | ApplicationLanguage::Dutch, | ||
| 257 | ApplicationLanguage::Portuguese, | ||
| 258 | ApplicationLanguage::Russian, | ||
| 259 | ApplicationLanguage::Korean, | ||
| 260 | }}; | ||
| 261 | |||
| 262 | constexpr ApplicationLanguagePriorityList priority_list_simplified_chinese = {{ | ||
| 263 | ApplicationLanguage::SimplifiedChinese, | ||
| 264 | ApplicationLanguage::TraditionalChinese, | ||
| 265 | ApplicationLanguage::AmericanEnglish, | ||
| 266 | ApplicationLanguage::BritishEnglish, | ||
| 267 | ApplicationLanguage::Japanese, | ||
| 268 | ApplicationLanguage::LatinAmericanSpanish, | ||
| 269 | ApplicationLanguage::CanadianFrench, | ||
| 270 | ApplicationLanguage::French, | ||
| 271 | ApplicationLanguage::German, | ||
| 272 | ApplicationLanguage::Spanish, | ||
| 273 | ApplicationLanguage::Italian, | ||
| 274 | ApplicationLanguage::Dutch, | ||
| 275 | ApplicationLanguage::Portuguese, | ||
| 276 | ApplicationLanguage::Russian, | ||
| 277 | ApplicationLanguage::Korean, | ||
| 278 | }}; | ||
| 279 | |||
| 280 | const ApplicationLanguagePriorityList* GetApplicationLanguagePriorityList( | ||
| 281 | const ApplicationLanguage lang) { | ||
| 282 | switch (lang) { | ||
| 283 | case ApplicationLanguage::AmericanEnglish: | ||
| 284 | return &priority_list_american_english; | ||
| 285 | case ApplicationLanguage::BritishEnglish: | ||
| 286 | return &priority_list_british_english; | ||
| 287 | case ApplicationLanguage::Japanese: | ||
| 288 | return &priority_list_japanese; | ||
| 289 | case ApplicationLanguage::French: | ||
| 290 | return &priority_list_french; | ||
| 291 | case ApplicationLanguage::German: | ||
| 292 | return &priority_list_german; | ||
| 293 | case ApplicationLanguage::LatinAmericanSpanish: | ||
| 294 | return &priority_list_latin_american_spanish; | ||
| 295 | case ApplicationLanguage::Spanish: | ||
| 296 | return &priority_list_spanish; | ||
| 297 | case ApplicationLanguage::Italian: | ||
| 298 | return &priority_list_italian; | ||
| 299 | case ApplicationLanguage::Dutch: | ||
| 300 | return &priority_list_dutch; | ||
| 301 | case ApplicationLanguage::CanadianFrench: | ||
| 302 | return &priority_list_canadian_french; | ||
| 303 | case ApplicationLanguage::Portuguese: | ||
| 304 | return &priority_list_portuguese; | ||
| 305 | case ApplicationLanguage::Russian: | ||
| 306 | return &priority_list_russian; | ||
| 307 | case ApplicationLanguage::Korean: | ||
| 308 | return &priority_list_korean; | ||
| 309 | case ApplicationLanguage::TraditionalChinese: | ||
| 310 | return &priority_list_traditional_chinese; | ||
| 311 | case ApplicationLanguage::SimplifiedChinese: | ||
| 312 | return &priority_list_simplified_chinese; | ||
| 313 | default: | ||
| 314 | return nullptr; | ||
| 315 | } | ||
| 316 | } | ||
| 317 | |||
| 318 | std::optional<ApplicationLanguage> ConvertToApplicationLanguage( | ||
| 319 | const Set::LanguageCode language_code) { | ||
| 320 | switch (language_code) { | ||
| 321 | case Set::LanguageCode::EN_US: | ||
| 322 | return ApplicationLanguage::AmericanEnglish; | ||
| 323 | case Set::LanguageCode::EN_GB: | ||
| 324 | return ApplicationLanguage::BritishEnglish; | ||
| 325 | case Set::LanguageCode::JA: | ||
| 326 | return ApplicationLanguage::Japanese; | ||
| 327 | case Set::LanguageCode::FR: | ||
| 328 | return ApplicationLanguage::French; | ||
| 329 | case Set::LanguageCode::DE: | ||
| 330 | return ApplicationLanguage::German; | ||
| 331 | case Set::LanguageCode::ES_419: | ||
| 332 | return ApplicationLanguage::LatinAmericanSpanish; | ||
| 333 | case Set::LanguageCode::ES: | ||
| 334 | return ApplicationLanguage::Spanish; | ||
| 335 | case Set::LanguageCode::IT: | ||
| 336 | return ApplicationLanguage::Italian; | ||
| 337 | case Set::LanguageCode::NL: | ||
| 338 | return ApplicationLanguage::Dutch; | ||
| 339 | case Set::LanguageCode::FR_CA: | ||
| 340 | return ApplicationLanguage::CanadianFrench; | ||
| 341 | case Set::LanguageCode::PT: | ||
| 342 | return ApplicationLanguage::Portuguese; | ||
| 343 | case Set::LanguageCode::RU: | ||
| 344 | return ApplicationLanguage::Russian; | ||
| 345 | case Set::LanguageCode::KO: | ||
| 346 | return ApplicationLanguage::Korean; | ||
| 347 | case Set::LanguageCode::ZH_HANT: | ||
| 348 | return ApplicationLanguage::TraditionalChinese; | ||
| 349 | case Set::LanguageCode::ZH_HANS: | ||
| 350 | return ApplicationLanguage::SimplifiedChinese; | ||
| 351 | default: | ||
| 352 | return std::nullopt; | ||
| 353 | } | ||
| 354 | } | ||
| 355 | |||
| 356 | std::optional<Set::LanguageCode> ConvertToLanguageCode(const ApplicationLanguage lang) { | ||
| 357 | switch (lang) { | ||
| 358 | case ApplicationLanguage::AmericanEnglish: | ||
| 359 | return Set::LanguageCode::EN_US; | ||
| 360 | case ApplicationLanguage::BritishEnglish: | ||
| 361 | return Set::LanguageCode::EN_GB; | ||
| 362 | case ApplicationLanguage::Japanese: | ||
| 363 | return Set::LanguageCode::JA; | ||
| 364 | case ApplicationLanguage::French: | ||
| 365 | return Set::LanguageCode::FR; | ||
| 366 | case ApplicationLanguage::German: | ||
| 367 | return Set::LanguageCode::DE; | ||
| 368 | case ApplicationLanguage::LatinAmericanSpanish: | ||
| 369 | return Set::LanguageCode::ES_419; | ||
| 370 | case ApplicationLanguage::Spanish: | ||
| 371 | return Set::LanguageCode::ES; | ||
| 372 | case ApplicationLanguage::Italian: | ||
| 373 | return Set::LanguageCode::IT; | ||
| 374 | case ApplicationLanguage::Dutch: | ||
| 375 | return Set::LanguageCode::NL; | ||
| 376 | case ApplicationLanguage::CanadianFrench: | ||
| 377 | return Set::LanguageCode::FR_CA; | ||
| 378 | case ApplicationLanguage::Portuguese: | ||
| 379 | return Set::LanguageCode::PT; | ||
| 380 | case ApplicationLanguage::Russian: | ||
| 381 | return Set::LanguageCode::RU; | ||
| 382 | case ApplicationLanguage::Korean: | ||
| 383 | return Set::LanguageCode::KO; | ||
| 384 | case ApplicationLanguage::TraditionalChinese: | ||
| 385 | return Set::LanguageCode::ZH_HANT; | ||
| 386 | case ApplicationLanguage::SimplifiedChinese: | ||
| 387 | return Set::LanguageCode::ZH_HANS; | ||
| 388 | default: | ||
| 389 | return std::nullopt; | ||
| 390 | } | ||
| 391 | } | ||
| 392 | } // namespace Service::NS \ No newline at end of file | ||
diff --git a/src/core/hle/service/ns/language.h b/src/core/hle/service/ns/language.h new file mode 100644 index 000000000..e9829f9d2 --- /dev/null +++ b/src/core/hle/service/ns/language.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <optional> | ||
| 8 | #include <string> | ||
| 9 | #include "common/common_types.h" | ||
| 10 | |||
| 11 | namespace Service::Set { | ||
| 12 | enum class LanguageCode : u64; | ||
| 13 | } | ||
| 14 | |||
| 15 | namespace Service::NS { | ||
| 16 | /// This is nn::ns::detail::ApplicationLanguage | ||
| 17 | enum class ApplicationLanguage : u8 { | ||
| 18 | AmericanEnglish = 0, | ||
| 19 | BritishEnglish, | ||
| 20 | Japanese, | ||
| 21 | French, | ||
| 22 | German, | ||
| 23 | LatinAmericanSpanish, | ||
| 24 | Spanish, | ||
| 25 | Italian, | ||
| 26 | Dutch, | ||
| 27 | CanadianFrench, | ||
| 28 | Portuguese, | ||
| 29 | Russian, | ||
| 30 | Korean, | ||
| 31 | TraditionalChinese, | ||
| 32 | SimplifiedChinese, | ||
| 33 | Count | ||
| 34 | }; | ||
| 35 | using ApplicationLanguagePriorityList = | ||
| 36 | const std::array<ApplicationLanguage, static_cast<std::size_t>(ApplicationLanguage::Count)>; | ||
| 37 | |||
| 38 | constexpr u32 GetSupportedLanguageFlag(const ApplicationLanguage lang) { | ||
| 39 | return 1U << static_cast<u32>(lang); | ||
| 40 | } | ||
| 41 | |||
| 42 | const ApplicationLanguagePriorityList* GetApplicationLanguagePriorityList(ApplicationLanguage lang); | ||
| 43 | std::optional<ApplicationLanguage> ConvertToApplicationLanguage(Set::LanguageCode language_code); | ||
| 44 | std::optional<Set::LanguageCode> ConvertToLanguageCode(ApplicationLanguage lang); | ||
| 45 | } // namespace Service::NS \ No newline at end of file | ||
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 0eb04037a..ce88a2941 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -7,445 +7,507 @@ | |||
| 7 | #include "core/file_sys/patch_manager.h" | 7 | #include "core/file_sys/patch_manager.h" |
| 8 | #include "core/hle/ipc_helpers.h" | 8 | #include "core/hle/ipc_helpers.h" |
| 9 | #include "core/hle/kernel/hle_ipc.h" | 9 | #include "core/hle/kernel/hle_ipc.h" |
| 10 | #include "core/hle/service/ns/errors.h" | ||
| 11 | #include "core/hle/service/ns/language.h" | ||
| 10 | #include "core/hle/service/ns/ns.h" | 12 | #include "core/hle/service/ns/ns.h" |
| 11 | #include "core/hle/service/ns/pl_u.h" | 13 | #include "core/hle/service/ns/pl_u.h" |
| 14 | #include "core/hle/service/set/set.h" | ||
| 15 | #include "core/settings.h" | ||
| 12 | 16 | ||
| 13 | namespace Service::NS { | 17 | namespace Service::NS { |
| 14 | 18 | ||
| 15 | class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> { | 19 | IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountProxyInterface"} { |
| 16 | public: | 20 | // clang-format off |
| 17 | explicit IAccountProxyInterface() : ServiceFramework{"IAccountProxyInterface"} { | 21 | static const FunctionInfo functions[] = { |
| 18 | // clang-format off | 22 | {0, nullptr, "CreateUserAccount"}, |
| 19 | static const FunctionInfo functions[] = { | 23 | }; |
| 20 | {0, nullptr, "CreateUserAccount"}, | 24 | // clang-format on |
| 21 | }; | ||
| 22 | // clang-format on | ||
| 23 | 25 | ||
| 24 | RegisterHandlers(functions); | 26 | RegisterHandlers(functions); |
| 25 | } | 27 | } |
| 26 | }; | ||
| 27 | 28 | ||
| 28 | class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> { | 29 | IAccountProxyInterface::~IAccountProxyInterface() = default; |
| 29 | public: | 30 | |
| 30 | explicit IApplicationManagerInterface() : ServiceFramework{"IApplicationManagerInterface"} { | 31 | IApplicationManagerInterface::IApplicationManagerInterface() |
| 31 | // clang-format off | 32 | : ServiceFramework{"IApplicationManagerInterface"} { |
| 32 | static const FunctionInfo functions[] = { | 33 | // clang-format off |
| 33 | {0, nullptr, "ListApplicationRecord"}, | 34 | static const FunctionInfo functions[] = { |
| 34 | {1, nullptr, "GenerateApplicationRecordCount"}, | 35 | {0, nullptr, "ListApplicationRecord"}, |
| 35 | {2, nullptr, "GetApplicationRecordUpdateSystemEvent"}, | 36 | {1, nullptr, "GenerateApplicationRecordCount"}, |
| 36 | {3, nullptr, "GetApplicationViewDeprecated"}, | 37 | {2, nullptr, "GetApplicationRecordUpdateSystemEvent"}, |
| 37 | {4, nullptr, "DeleteApplicationEntity"}, | 38 | {3, nullptr, "GetApplicationViewDeprecated"}, |
| 38 | {5, nullptr, "DeleteApplicationCompletely"}, | 39 | {4, nullptr, "DeleteApplicationEntity"}, |
| 39 | {6, nullptr, "IsAnyApplicationEntityRedundant"}, | 40 | {5, nullptr, "DeleteApplicationCompletely"}, |
| 40 | {7, nullptr, "DeleteRedundantApplicationEntity"}, | 41 | {6, nullptr, "IsAnyApplicationEntityRedundant"}, |
| 41 | {8, nullptr, "IsApplicationEntityMovable"}, | 42 | {7, nullptr, "DeleteRedundantApplicationEntity"}, |
| 42 | {9, nullptr, "MoveApplicationEntity"}, | 43 | {8, nullptr, "IsApplicationEntityMovable"}, |
| 43 | {11, nullptr, "CalculateApplicationOccupiedSize"}, | 44 | {9, nullptr, "MoveApplicationEntity"}, |
| 44 | {16, nullptr, "PushApplicationRecord"}, | 45 | {11, nullptr, "CalculateApplicationOccupiedSize"}, |
| 45 | {17, nullptr, "ListApplicationRecordContentMeta"}, | 46 | {16, nullptr, "PushApplicationRecord"}, |
| 46 | {19, nullptr, "LaunchApplicationOld"}, | 47 | {17, nullptr, "ListApplicationRecordContentMeta"}, |
| 47 | {21, nullptr, "GetApplicationContentPath"}, | 48 | {19, nullptr, "LaunchApplicationOld"}, |
| 48 | {22, nullptr, "TerminateApplication"}, | 49 | {21, nullptr, "GetApplicationContentPath"}, |
| 49 | {23, nullptr, "ResolveApplicationContentPath"}, | 50 | {22, nullptr, "TerminateApplication"}, |
| 50 | {26, nullptr, "BeginInstallApplication"}, | 51 | {23, nullptr, "ResolveApplicationContentPath"}, |
| 51 | {27, nullptr, "DeleteApplicationRecord"}, | 52 | {26, nullptr, "BeginInstallApplication"}, |
| 52 | {30, nullptr, "RequestApplicationUpdateInfo"}, | 53 | {27, nullptr, "DeleteApplicationRecord"}, |
| 53 | {32, nullptr, "CancelApplicationDownload"}, | 54 | {30, nullptr, "RequestApplicationUpdateInfo"}, |
| 54 | {33, nullptr, "ResumeApplicationDownload"}, | 55 | {32, nullptr, "CancelApplicationDownload"}, |
| 55 | {35, nullptr, "UpdateVersionList"}, | 56 | {33, nullptr, "ResumeApplicationDownload"}, |
| 56 | {36, nullptr, "PushLaunchVersion"}, | 57 | {35, nullptr, "UpdateVersionList"}, |
| 57 | {37, nullptr, "ListRequiredVersion"}, | 58 | {36, nullptr, "PushLaunchVersion"}, |
| 58 | {38, nullptr, "CheckApplicationLaunchVersion"}, | 59 | {37, nullptr, "ListRequiredVersion"}, |
| 59 | {39, nullptr, "CheckApplicationLaunchRights"}, | 60 | {38, nullptr, "CheckApplicationLaunchVersion"}, |
| 60 | {40, nullptr, "GetApplicationLogoData"}, | 61 | {39, nullptr, "CheckApplicationLaunchRights"}, |
| 61 | {41, nullptr, "CalculateApplicationDownloadRequiredSize"}, | 62 | {40, nullptr, "GetApplicationLogoData"}, |
| 62 | {42, nullptr, "CleanupSdCard"}, | 63 | {41, nullptr, "CalculateApplicationDownloadRequiredSize"}, |
| 63 | {43, nullptr, "CheckSdCardMountStatus"}, | 64 | {42, nullptr, "CleanupSdCard"}, |
| 64 | {44, nullptr, "GetSdCardMountStatusChangedEvent"}, | 65 | {43, nullptr, "CheckSdCardMountStatus"}, |
| 65 | {45, nullptr, "GetGameCardAttachmentEvent"}, | 66 | {44, nullptr, "GetSdCardMountStatusChangedEvent"}, |
| 66 | {46, nullptr, "GetGameCardAttachmentInfo"}, | 67 | {45, nullptr, "GetGameCardAttachmentEvent"}, |
| 67 | {47, nullptr, "GetTotalSpaceSize"}, | 68 | {46, nullptr, "GetGameCardAttachmentInfo"}, |
| 68 | {48, nullptr, "GetFreeSpaceSize"}, | 69 | {47, nullptr, "GetTotalSpaceSize"}, |
| 69 | {49, nullptr, "GetSdCardRemovedEvent"}, | 70 | {48, nullptr, "GetFreeSpaceSize"}, |
| 70 | {52, nullptr, "GetGameCardUpdateDetectionEvent"}, | 71 | {49, nullptr, "GetSdCardRemovedEvent"}, |
| 71 | {53, nullptr, "DisableApplicationAutoDelete"}, | 72 | {52, nullptr, "GetGameCardUpdateDetectionEvent"}, |
| 72 | {54, nullptr, "EnableApplicationAutoDelete"}, | 73 | {53, nullptr, "DisableApplicationAutoDelete"}, |
| 73 | {55, nullptr, "GetApplicationDesiredLanguage"}, | 74 | {54, nullptr, "EnableApplicationAutoDelete"}, |
| 74 | {56, nullptr, "SetApplicationTerminateResult"}, | 75 | {55, &IApplicationManagerInterface::GetApplicationDesiredLanguage, "GetApplicationDesiredLanguage"}, |
| 75 | {57, nullptr, "ClearApplicationTerminateResult"}, | 76 | {56, nullptr, "SetApplicationTerminateResult"}, |
| 76 | {58, nullptr, "GetLastSdCardMountUnexpectedResult"}, | 77 | {57, nullptr, "ClearApplicationTerminateResult"}, |
| 77 | {59, nullptr, "ConvertApplicationLanguageToLanguageCode"}, | 78 | {58, nullptr, "GetLastSdCardMountUnexpectedResult"}, |
| 78 | {60, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, | 79 | {59, &IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode, "ConvertApplicationLanguageToLanguageCode"}, |
| 79 | {61, nullptr, "GetBackgroundDownloadStressTaskInfo"}, | 80 | {60, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, |
| 80 | {62, nullptr, "GetGameCardStopper"}, | 81 | {61, nullptr, "GetBackgroundDownloadStressTaskInfo"}, |
| 81 | {63, nullptr, "IsSystemProgramInstalled"}, | 82 | {62, nullptr, "GetGameCardStopper"}, |
| 82 | {64, nullptr, "StartApplyDeltaTask"}, | 83 | {63, nullptr, "IsSystemProgramInstalled"}, |
| 83 | {65, nullptr, "GetRequestServerStopper"}, | 84 | {64, nullptr, "StartApplyDeltaTask"}, |
| 84 | {66, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, | 85 | {65, nullptr, "GetRequestServerStopper"}, |
| 85 | {67, nullptr, "CancelApplicationApplyDelta"}, | 86 | {66, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, |
| 86 | {68, nullptr, "ResumeApplicationApplyDelta"}, | 87 | {67, nullptr, "CancelApplicationApplyDelta"}, |
| 87 | {69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"}, | 88 | {68, nullptr, "ResumeApplicationApplyDelta"}, |
| 88 | {70, nullptr, "ResumeAll"}, | 89 | {69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"}, |
| 89 | {71, nullptr, "GetStorageSize"}, | 90 | {70, nullptr, "ResumeAll"}, |
| 90 | {80, nullptr, "RequestDownloadApplication"}, | 91 | {71, nullptr, "GetStorageSize"}, |
| 91 | {81, nullptr, "RequestDownloadAddOnContent"}, | 92 | {80, nullptr, "RequestDownloadApplication"}, |
| 92 | {82, nullptr, "DownloadApplication"}, | 93 | {81, nullptr, "RequestDownloadAddOnContent"}, |
| 93 | {83, nullptr, "CheckApplicationResumeRights"}, | 94 | {82, nullptr, "DownloadApplication"}, |
| 94 | {84, nullptr, "GetDynamicCommitEvent"}, | 95 | {83, nullptr, "CheckApplicationResumeRights"}, |
| 95 | {85, nullptr, "RequestUpdateApplication2"}, | 96 | {84, nullptr, "GetDynamicCommitEvent"}, |
| 96 | {86, nullptr, "EnableApplicationCrashReport"}, | 97 | {85, nullptr, "RequestUpdateApplication2"}, |
| 97 | {87, nullptr, "IsApplicationCrashReportEnabled"}, | 98 | {86, nullptr, "EnableApplicationCrashReport"}, |
| 98 | {90, nullptr, "BoostSystemMemoryResourceLimit"}, | 99 | {87, nullptr, "IsApplicationCrashReportEnabled"}, |
| 99 | {91, nullptr, "DeprecatedLaunchApplication"}, | 100 | {90, nullptr, "BoostSystemMemoryResourceLimit"}, |
| 100 | {92, nullptr, "GetRunningApplicationProgramId"}, | 101 | {91, nullptr, "DeprecatedLaunchApplication"}, |
| 101 | {93, nullptr, "GetMainApplicationProgramIndex"}, | 102 | {92, nullptr, "GetRunningApplicationProgramId"}, |
| 102 | {94, nullptr, "LaunchApplication"}, | 103 | {93, nullptr, "GetMainApplicationProgramIndex"}, |
| 103 | {95, nullptr, "GetApplicationLaunchInfo"}, | 104 | {94, nullptr, "LaunchApplication"}, |
| 104 | {96, nullptr, "AcquireApplicationLaunchInfo"}, | 105 | {95, nullptr, "GetApplicationLaunchInfo"}, |
| 105 | {97, nullptr, "GetMainApplicationProgramIndex2"}, | 106 | {96, nullptr, "AcquireApplicationLaunchInfo"}, |
| 106 | {98, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, | 107 | {97, nullptr, "GetMainApplicationProgramIndex2"}, |
| 107 | {100, nullptr, "ResetToFactorySettings"}, | 108 | {98, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, |
| 108 | {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, | 109 | {100, nullptr, "ResetToFactorySettings"}, |
| 109 | {102, nullptr, "ResetToFactorySettingsForRefurbishment"}, | 110 | {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, |
| 110 | {200, nullptr, "CalculateUserSaveDataStatistics"}, | 111 | {102, nullptr, "ResetToFactorySettingsForRefurbishment"}, |
| 111 | {201, nullptr, "DeleteUserSaveDataAll"}, | 112 | {200, nullptr, "CalculateUserSaveDataStatistics"}, |
| 112 | {210, nullptr, "DeleteUserSystemSaveData"}, | 113 | {201, nullptr, "DeleteUserSaveDataAll"}, |
| 113 | {211, nullptr, "DeleteSaveData"}, | 114 | {210, nullptr, "DeleteUserSystemSaveData"}, |
| 114 | {220, nullptr, "UnregisterNetworkServiceAccount"}, | 115 | {211, nullptr, "DeleteSaveData"}, |
| 115 | {221, nullptr, "UnregisterNetworkServiceAccountWithUserSaveDataDeletion"}, | 116 | {220, nullptr, "UnregisterNetworkServiceAccount"}, |
| 116 | {300, nullptr, "GetApplicationShellEvent"}, | 117 | {221, nullptr, "UnregisterNetworkServiceAccountWithUserSaveDataDeletion"}, |
| 117 | {301, nullptr, "PopApplicationShellEventInfo"}, | 118 | {300, nullptr, "GetApplicationShellEvent"}, |
| 118 | {302, nullptr, "LaunchLibraryApplet"}, | 119 | {301, nullptr, "PopApplicationShellEventInfo"}, |
| 119 | {303, nullptr, "TerminateLibraryApplet"}, | 120 | {302, nullptr, "LaunchLibraryApplet"}, |
| 120 | {304, nullptr, "LaunchSystemApplet"}, | 121 | {303, nullptr, "TerminateLibraryApplet"}, |
| 121 | {305, nullptr, "TerminateSystemApplet"}, | 122 | {304, nullptr, "LaunchSystemApplet"}, |
| 122 | {306, nullptr, "LaunchOverlayApplet"}, | 123 | {305, nullptr, "TerminateSystemApplet"}, |
| 123 | {307, nullptr, "TerminateOverlayApplet"}, | 124 | {306, nullptr, "LaunchOverlayApplet"}, |
| 124 | {400, &IApplicationManagerInterface::GetApplicationControlData, "GetApplicationControlData"}, | 125 | {307, nullptr, "TerminateOverlayApplet"}, |
| 125 | {401, nullptr, "InvalidateAllApplicationControlCache"}, | 126 | {400, &IApplicationManagerInterface::GetApplicationControlData, "GetApplicationControlData"}, |
| 126 | {402, nullptr, "RequestDownloadApplicationControlData"}, | 127 | {401, nullptr, "InvalidateAllApplicationControlCache"}, |
| 127 | {403, nullptr, "GetMaxApplicationControlCacheCount"}, | 128 | {402, nullptr, "RequestDownloadApplicationControlData"}, |
| 128 | {404, nullptr, "InvalidateApplicationControlCache"}, | 129 | {403, nullptr, "GetMaxApplicationControlCacheCount"}, |
| 129 | {405, nullptr, "ListApplicationControlCacheEntryInfo"}, | 130 | {404, nullptr, "InvalidateApplicationControlCache"}, |
| 130 | {406, nullptr, "GetApplicationControlProperty"}, | 131 | {405, nullptr, "ListApplicationControlCacheEntryInfo"}, |
| 131 | {502, nullptr, "RequestCheckGameCardRegistration"}, | 132 | {406, nullptr, "GetApplicationControlProperty"}, |
| 132 | {503, nullptr, "RequestGameCardRegistrationGoldPoint"}, | 133 | {502, nullptr, "RequestCheckGameCardRegistration"}, |
| 133 | {504, nullptr, "RequestRegisterGameCard"}, | 134 | {503, nullptr, "RequestGameCardRegistrationGoldPoint"}, |
| 134 | {505, nullptr, "GetGameCardMountFailureEvent"}, | 135 | {504, nullptr, "RequestRegisterGameCard"}, |
| 135 | {506, nullptr, "IsGameCardInserted"}, | 136 | {505, nullptr, "GetGameCardMountFailureEvent"}, |
| 136 | {507, nullptr, "EnsureGameCardAccess"}, | 137 | {506, nullptr, "IsGameCardInserted"}, |
| 137 | {508, nullptr, "GetLastGameCardMountFailureResult"}, | 138 | {507, nullptr, "EnsureGameCardAccess"}, |
| 138 | {509, nullptr, "ListApplicationIdOnGameCard"}, | 139 | {508, nullptr, "GetLastGameCardMountFailureResult"}, |
| 139 | {600, nullptr, "CountApplicationContentMeta"}, | 140 | {509, nullptr, "ListApplicationIdOnGameCard"}, |
| 140 | {601, nullptr, "ListApplicationContentMetaStatus"}, | 141 | {600, nullptr, "CountApplicationContentMeta"}, |
| 141 | {602, nullptr, "ListAvailableAddOnContent"}, | 142 | {601, nullptr, "ListApplicationContentMetaStatus"}, |
| 142 | {603, nullptr, "GetOwnedApplicationContentMetaStatus"}, | 143 | {602, nullptr, "ListAvailableAddOnContent"}, |
| 143 | {604, nullptr, "RegisterContentsExternalKey"}, | 144 | {603, nullptr, "GetOwnedApplicationContentMetaStatus"}, |
| 144 | {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, | 145 | {604, nullptr, "RegisterContentsExternalKey"}, |
| 145 | {606, nullptr, "GetContentMetaStorage"}, | 146 | {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, |
| 146 | {607, nullptr, "ListAvailableAddOnContent"}, | 147 | {606, nullptr, "GetContentMetaStorage"}, |
| 147 | {700, nullptr, "PushDownloadTaskList"}, | 148 | {607, nullptr, "ListAvailableAddOnContent"}, |
| 148 | {701, nullptr, "ClearTaskStatusList"}, | 149 | {700, nullptr, "PushDownloadTaskList"}, |
| 149 | {702, nullptr, "RequestDownloadTaskList"}, | 150 | {701, nullptr, "ClearTaskStatusList"}, |
| 150 | {703, nullptr, "RequestEnsureDownloadTask"}, | 151 | {702, nullptr, "RequestDownloadTaskList"}, |
| 151 | {704, nullptr, "ListDownloadTaskStatus"}, | 152 | {703, nullptr, "RequestEnsureDownloadTask"}, |
| 152 | {705, nullptr, "RequestDownloadTaskListData"}, | 153 | {704, nullptr, "ListDownloadTaskStatus"}, |
| 153 | {800, nullptr, "RequestVersionList"}, | 154 | {705, nullptr, "RequestDownloadTaskListData"}, |
| 154 | {801, nullptr, "ListVersionList"}, | 155 | {800, nullptr, "RequestVersionList"}, |
| 155 | {802, nullptr, "RequestVersionListData"}, | 156 | {801, nullptr, "ListVersionList"}, |
| 156 | {900, nullptr, "GetApplicationRecord"}, | 157 | {802, nullptr, "RequestVersionListData"}, |
| 157 | {901, nullptr, "GetApplicationRecordProperty"}, | 158 | {900, nullptr, "GetApplicationRecord"}, |
| 158 | {902, nullptr, "EnableApplicationAutoUpdate"}, | 159 | {901, nullptr, "GetApplicationRecordProperty"}, |
| 159 | {903, nullptr, "DisableApplicationAutoUpdate"}, | 160 | {902, nullptr, "EnableApplicationAutoUpdate"}, |
| 160 | {904, nullptr, "TouchApplication"}, | 161 | {903, nullptr, "DisableApplicationAutoUpdate"}, |
| 161 | {905, nullptr, "RequestApplicationUpdate"}, | 162 | {904, nullptr, "TouchApplication"}, |
| 162 | {906, nullptr, "IsApplicationUpdateRequested"}, | 163 | {905, nullptr, "RequestApplicationUpdate"}, |
| 163 | {907, nullptr, "WithdrawApplicationUpdateRequest"}, | 164 | {906, nullptr, "IsApplicationUpdateRequested"}, |
| 164 | {908, nullptr, "ListApplicationRecordInstalledContentMeta"}, | 165 | {907, nullptr, "WithdrawApplicationUpdateRequest"}, |
| 165 | {909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"}, | 166 | {908, nullptr, "ListApplicationRecordInstalledContentMeta"}, |
| 166 | {910, nullptr, "HasApplicationRecord"}, | 167 | {909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"}, |
| 167 | {911, nullptr, "SetPreInstalledApplication"}, | 168 | {910, nullptr, "HasApplicationRecord"}, |
| 168 | {912, nullptr, "ClearPreInstalledApplicationFlag"}, | 169 | {911, nullptr, "SetPreInstalledApplication"}, |
| 169 | {1000, nullptr, "RequestVerifyApplicationDeprecated"}, | 170 | {912, nullptr, "ClearPreInstalledApplicationFlag"}, |
| 170 | {1001, nullptr, "CorruptApplicationForDebug"}, | 171 | {1000, nullptr, "RequestVerifyApplicationDeprecated"}, |
| 171 | {1002, nullptr, "RequestVerifyAddOnContentsRights"}, | 172 | {1001, nullptr, "CorruptApplicationForDebug"}, |
| 172 | {1003, nullptr, "RequestVerifyApplication"}, | 173 | {1002, nullptr, "RequestVerifyAddOnContentsRights"}, |
| 173 | {1004, nullptr, "CorruptContentForDebug"}, | 174 | {1003, nullptr, "RequestVerifyApplication"}, |
| 174 | {1200, nullptr, "NeedsUpdateVulnerability"}, | 175 | {1004, nullptr, "CorruptContentForDebug"}, |
| 175 | {1300, nullptr, "IsAnyApplicationEntityInstalled"}, | 176 | {1200, nullptr, "NeedsUpdateVulnerability"}, |
| 176 | {1301, nullptr, "DeleteApplicationContentEntities"}, | 177 | {1300, nullptr, "IsAnyApplicationEntityInstalled"}, |
| 177 | {1302, nullptr, "CleanupUnrecordedApplicationEntity"}, | 178 | {1301, nullptr, "DeleteApplicationContentEntities"}, |
| 178 | {1303, nullptr, "CleanupAddOnContentsWithNoRights"}, | 179 | {1302, nullptr, "CleanupUnrecordedApplicationEntity"}, |
| 179 | {1304, nullptr, "DeleteApplicationContentEntity"}, | 180 | {1303, nullptr, "CleanupAddOnContentsWithNoRights"}, |
| 180 | {1305, nullptr, "TryDeleteRunningApplicationEntity"}, | 181 | {1304, nullptr, "DeleteApplicationContentEntity"}, |
| 181 | {1306, nullptr, "TryDeleteRunningApplicationCompletely"}, | 182 | {1305, nullptr, "TryDeleteRunningApplicationEntity"}, |
| 182 | {1307, nullptr, "TryDeleteRunningApplicationContentEntities"}, | 183 | {1306, nullptr, "TryDeleteRunningApplicationCompletely"}, |
| 183 | {1308, nullptr, "DeleteApplicationCompletelyForDebug"}, | 184 | {1307, nullptr, "TryDeleteRunningApplicationContentEntities"}, |
| 184 | {1309, nullptr, "CleanupUnavailableAddOnContents"}, | 185 | {1308, nullptr, "DeleteApplicationCompletelyForDebug"}, |
| 185 | {1400, nullptr, "PrepareShutdown"}, | 186 | {1309, nullptr, "CleanupUnavailableAddOnContents"}, |
| 186 | {1500, nullptr, "FormatSdCard"}, | 187 | {1400, nullptr, "PrepareShutdown"}, |
| 187 | {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, | 188 | {1500, nullptr, "FormatSdCard"}, |
| 188 | {1502, nullptr, "GetLastSdCardFormatUnexpectedResult"}, | 189 | {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, |
| 189 | {1504, nullptr, "InsertSdCard"}, | 190 | {1502, nullptr, "GetLastSdCardFormatUnexpectedResult"}, |
| 190 | {1505, nullptr, "RemoveSdCard"}, | 191 | {1504, nullptr, "InsertSdCard"}, |
| 191 | {1600, nullptr, "GetSystemSeedForPseudoDeviceId"}, | 192 | {1505, nullptr, "RemoveSdCard"}, |
| 192 | {1601, nullptr, "ResetSystemSeedForPseudoDeviceId"}, | 193 | {1600, nullptr, "GetSystemSeedForPseudoDeviceId"}, |
| 193 | {1700, nullptr, "ListApplicationDownloadingContentMeta"}, | 194 | {1601, nullptr, "ResetSystemSeedForPseudoDeviceId"}, |
| 194 | {1701, nullptr, "GetApplicationView"}, | 195 | {1700, nullptr, "ListApplicationDownloadingContentMeta"}, |
| 195 | {1702, nullptr, "GetApplicationDownloadTaskStatus"}, | 196 | {1701, nullptr, "GetApplicationView"}, |
| 196 | {1703, nullptr, "GetApplicationViewDownloadErrorContext"}, | 197 | {1702, nullptr, "GetApplicationDownloadTaskStatus"}, |
| 197 | {1800, nullptr, "IsNotificationSetupCompleted"}, | 198 | {1703, nullptr, "GetApplicationViewDownloadErrorContext"}, |
| 198 | {1801, nullptr, "GetLastNotificationInfoCount"}, | 199 | {1800, nullptr, "IsNotificationSetupCompleted"}, |
| 199 | {1802, nullptr, "ListLastNotificationInfo"}, | 200 | {1801, nullptr, "GetLastNotificationInfoCount"}, |
| 200 | {1803, nullptr, "ListNotificationTask"}, | 201 | {1802, nullptr, "ListLastNotificationInfo"}, |
| 201 | {1900, nullptr, "IsActiveAccount"}, | 202 | {1803, nullptr, "ListNotificationTask"}, |
| 202 | {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, | 203 | {1900, nullptr, "IsActiveAccount"}, |
| 203 | {1902, nullptr, "GetApplicationTicketInfo"}, | 204 | {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, |
| 204 | {2000, nullptr, "GetSystemDeliveryInfo"}, | 205 | {1902, nullptr, "GetApplicationTicketInfo"}, |
| 205 | {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, | 206 | {2000, nullptr, "GetSystemDeliveryInfo"}, |
| 206 | {2002, nullptr, "VerifyDeliveryProtocolVersion"}, | 207 | {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, |
| 207 | {2003, nullptr, "GetApplicationDeliveryInfo"}, | 208 | {2002, nullptr, "VerifyDeliveryProtocolVersion"}, |
| 208 | {2004, nullptr, "HasAllContentsToDeliver"}, | 209 | {2003, nullptr, "GetApplicationDeliveryInfo"}, |
| 209 | {2005, nullptr, "CompareApplicationDeliveryInfo"}, | 210 | {2004, nullptr, "HasAllContentsToDeliver"}, |
| 210 | {2006, nullptr, "CanDeliverApplication"}, | 211 | {2005, nullptr, "CompareApplicationDeliveryInfo"}, |
| 211 | {2007, nullptr, "ListContentMetaKeyToDeliverApplication"}, | 212 | {2006, nullptr, "CanDeliverApplication"}, |
| 212 | {2008, nullptr, "NeedsSystemUpdateToDeliverApplication"}, | 213 | {2007, nullptr, "ListContentMetaKeyToDeliverApplication"}, |
| 213 | {2009, nullptr, "EstimateRequiredSize"}, | 214 | {2008, nullptr, "NeedsSystemUpdateToDeliverApplication"}, |
| 214 | {2010, nullptr, "RequestReceiveApplication"}, | 215 | {2009, nullptr, "EstimateRequiredSize"}, |
| 215 | {2011, nullptr, "CommitReceiveApplication"}, | 216 | {2010, nullptr, "RequestReceiveApplication"}, |
| 216 | {2012, nullptr, "GetReceiveApplicationProgress"}, | 217 | {2011, nullptr, "CommitReceiveApplication"}, |
| 217 | {2013, nullptr, "RequestSendApplication"}, | 218 | {2012, nullptr, "GetReceiveApplicationProgress"}, |
| 218 | {2014, nullptr, "GetSendApplicationProgress"}, | 219 | {2013, nullptr, "RequestSendApplication"}, |
| 219 | {2015, nullptr, "CompareSystemDeliveryInfo"}, | 220 | {2014, nullptr, "GetSendApplicationProgress"}, |
| 220 | {2016, nullptr, "ListNotCommittedContentMeta"}, | 221 | {2015, nullptr, "CompareSystemDeliveryInfo"}, |
| 221 | {2017, nullptr, "CreateDownloadTask"}, | 222 | {2016, nullptr, "ListNotCommittedContentMeta"}, |
| 222 | {2018, nullptr, "GetApplicationDeliveryInfoHash"}, | 223 | {2017, nullptr, "CreateDownloadTask"}, |
| 223 | {2050, nullptr, "GetApplicationRightsOnClient"}, | 224 | {2018, nullptr, "GetApplicationDeliveryInfoHash"}, |
| 224 | {2100, nullptr, "GetApplicationTerminateResult"}, | 225 | {2050, nullptr, "GetApplicationRightsOnClient"}, |
| 225 | {2101, nullptr, "GetRawApplicationTerminateResult"}, | 226 | {2100, nullptr, "GetApplicationTerminateResult"}, |
| 226 | {2150, nullptr, "CreateRightsEnvironment"}, | 227 | {2101, nullptr, "GetRawApplicationTerminateResult"}, |
| 227 | {2151, nullptr, "DestroyRightsEnvironment"}, | 228 | {2150, nullptr, "CreateRightsEnvironment"}, |
| 228 | {2152, nullptr, "ActivateRightsEnvironment"}, | 229 | {2151, nullptr, "DestroyRightsEnvironment"}, |
| 229 | {2153, nullptr, "DeactivateRightsEnvironment"}, | 230 | {2152, nullptr, "ActivateRightsEnvironment"}, |
| 230 | {2154, nullptr, "ForceActivateRightsContextForExit"}, | 231 | {2153, nullptr, "DeactivateRightsEnvironment"}, |
| 231 | {2160, nullptr, "AddTargetApplicationToRightsEnvironment"}, | 232 | {2154, nullptr, "ForceActivateRightsContextForExit"}, |
| 232 | {2161, nullptr, "SetUsersToRightsEnvironment"}, | 233 | {2160, nullptr, "AddTargetApplicationToRightsEnvironment"}, |
| 233 | {2170, nullptr, "GetRightsEnvironmentStatus"}, | 234 | {2161, nullptr, "SetUsersToRightsEnvironment"}, |
| 234 | {2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"}, | 235 | {2170, nullptr, "GetRightsEnvironmentStatus"}, |
| 235 | {2180, nullptr, "RequestExtendRightsInRightsEnvironment"}, | 236 | {2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"}, |
| 236 | {2181, nullptr, "GetLastResultOfExtendRightsInRightsEnvironment"}, | 237 | {2180, nullptr, "RequestExtendRightsInRightsEnvironment"}, |
| 237 | {2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"}, | 238 | {2181, nullptr, "GetLastResultOfExtendRightsInRightsEnvironment"}, |
| 238 | {2190, nullptr, "GetRightsEnvironmentHandleForApplication"}, | 239 | {2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"}, |
| 239 | {2199, nullptr, "GetRightsEnvironmentCountForDebug"}, | 240 | {2190, nullptr, "GetRightsEnvironmentHandleForApplication"}, |
| 240 | {2200, nullptr, "GetGameCardApplicationCopyIdentifier"}, | 241 | {2199, nullptr, "GetRightsEnvironmentCountForDebug"}, |
| 241 | {2201, nullptr, "GetInstalledApplicationCopyIdentifier"}, | 242 | {2200, nullptr, "GetGameCardApplicationCopyIdentifier"}, |
| 242 | {2250, nullptr, "RequestReportActiveELicence"}, | 243 | {2201, nullptr, "GetInstalledApplicationCopyIdentifier"}, |
| 243 | {2300, nullptr, "ListEventLog"}, | 244 | {2250, nullptr, "RequestReportActiveELicence"}, |
| 244 | }; | 245 | {2300, nullptr, "ListEventLog"}, |
| 245 | // clang-format on | 246 | }; |
| 247 | // clang-format on | ||
| 248 | |||
| 249 | RegisterHandlers(functions); | ||
| 250 | } | ||
| 246 | 251 | ||
| 247 | RegisterHandlers(functions); | 252 | IApplicationManagerInterface::~IApplicationManagerInterface() = default; |
| 248 | } | 253 | |
| 254 | void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestContext& ctx) { | ||
| 255 | IPC::RequestParser rp{ctx}; | ||
| 256 | const auto flag = rp.PopRaw<u64>(); | ||
| 257 | LOG_DEBUG(Service_NS, "called with flag={:016X}", flag); | ||
| 249 | 258 | ||
| 250 | void GetApplicationControlData(Kernel::HLERequestContext& ctx) { | 259 | const auto title_id = rp.PopRaw<u64>(); |
| 251 | IPC::RequestParser rp{ctx}; | 260 | |
| 252 | const auto flag = rp.PopRaw<u64>(); | 261 | const auto size = ctx.GetWriteBufferSize(); |
| 253 | LOG_DEBUG(Service_NS, "called with flag={:016X}", flag); | 262 | |
| 254 | 263 | const FileSys::PatchManager pm{title_id}; | |
| 255 | const auto title_id = rp.PopRaw<u64>(); | 264 | const auto control = pm.GetControlMetadata(); |
| 256 | 265 | ||
| 257 | const auto size = ctx.GetWriteBufferSize(); | 266 | std::vector<u8> out; |
| 258 | 267 | ||
| 259 | const FileSys::PatchManager pm{title_id}; | 268 | if (control.first != nullptr) { |
| 260 | const auto control = pm.GetControlMetadata(); | 269 | if (size < 0x4000) { |
| 261 | 270 | LOG_ERROR(Service_NS, | |
| 262 | std::vector<u8> out; | 271 | "output buffer is too small! (actual={:016X}, expected_min=0x4000)", size); |
| 263 | 272 | IPC::ResponseBuilder rb{ctx, 2}; | |
| 264 | if (control.first != nullptr) { | 273 | // TODO(DarkLordZach): Find a better error code for this. |
| 265 | if (size < 0x4000) { | 274 | rb.Push(ResultCode(-1)); |
| 266 | LOG_ERROR(Service_NS, | 275 | return; |
| 267 | "output buffer is too small! (actual={:016X}, expected_min=0x4000)", | ||
| 268 | size); | ||
| 269 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 270 | // TODO(DarkLordZach): Find a better error code for this. | ||
| 271 | rb.Push(ResultCode(-1)); | ||
| 272 | return; | ||
| 273 | } | ||
| 274 | |||
| 275 | out.resize(0x4000); | ||
| 276 | const auto bytes = control.first->GetRawBytes(); | ||
| 277 | std::memcpy(out.data(), bytes.data(), bytes.size()); | ||
| 278 | } else { | ||
| 279 | LOG_WARNING(Service_NS, "missing NACP data for title_id={:016X}, defaulting to zeros.", | ||
| 280 | title_id); | ||
| 281 | out.resize(std::min<u64>(0x4000, size)); | ||
| 282 | } | 276 | } |
| 283 | 277 | ||
| 284 | if (control.second != nullptr) { | 278 | out.resize(0x4000); |
| 285 | if (size < 0x4000 + control.second->GetSize()) { | 279 | const auto bytes = control.first->GetRawBytes(); |
| 286 | LOG_ERROR(Service_NS, | 280 | std::memcpy(out.data(), bytes.data(), bytes.size()); |
| 287 | "output buffer is too small! (actual={:016X}, expected_min={:016X})", | 281 | } else { |
| 288 | size, 0x4000 + control.second->GetSize()); | 282 | LOG_WARNING(Service_NS, "missing NACP data for title_id={:016X}, defaulting to zeros.", |
| 289 | IPC::ResponseBuilder rb{ctx, 2}; | 283 | title_id); |
| 290 | // TODO(DarkLordZach): Find a better error code for this. | 284 | out.resize(std::min<u64>(0x4000, size)); |
| 291 | rb.Push(ResultCode(-1)); | 285 | } |
| 292 | return; | 286 | |
| 293 | } | 287 | if (control.second != nullptr) { |
| 294 | 288 | if (size < 0x4000 + control.second->GetSize()) { | |
| 295 | out.resize(0x4000 + control.second->GetSize()); | 289 | LOG_ERROR(Service_NS, |
| 296 | control.second->Read(out.data() + 0x4000, control.second->GetSize()); | 290 | "output buffer is too small! (actual={:016X}, expected_min={:016X})", size, |
| 297 | } else { | 291 | 0x4000 + control.second->GetSize()); |
| 298 | LOG_WARNING(Service_NS, "missing icon data for title_id={:016X}, defaulting to zeros.", | 292 | IPC::ResponseBuilder rb{ctx, 2}; |
| 299 | title_id); | 293 | // TODO(DarkLordZach): Find a better error code for this. |
| 294 | rb.Push(ResultCode(-1)); | ||
| 295 | return; | ||
| 300 | } | 296 | } |
| 301 | 297 | ||
| 302 | ctx.WriteBuffer(out); | 298 | out.resize(0x4000 + control.second->GetSize()); |
| 299 | control.second->Read(out.data() + 0x4000, control.second->GetSize()); | ||
| 300 | } else { | ||
| 301 | LOG_WARNING(Service_NS, "missing icon data for title_id={:016X}, defaulting to zeros.", | ||
| 302 | title_id); | ||
| 303 | } | ||
| 304 | |||
| 305 | ctx.WriteBuffer(out); | ||
| 306 | |||
| 307 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 308 | rb.Push(RESULT_SUCCESS); | ||
| 309 | rb.Push<u32>(static_cast<u32>(out.size())); | ||
| 310 | } | ||
| 311 | |||
| 312 | void IApplicationManagerInterface::GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx) { | ||
| 313 | IPC::RequestParser rp{ctx}; | ||
| 314 | const auto supported_languages = rp.Pop<u32>(); | ||
| 303 | 315 | ||
| 316 | const auto res = GetApplicationDesiredLanguage(supported_languages); | ||
| 317 | if (res.Succeeded()) { | ||
| 304 | IPC::ResponseBuilder rb{ctx, 3}; | 318 | IPC::ResponseBuilder rb{ctx, 3}; |
| 305 | rb.Push(RESULT_SUCCESS); | 319 | rb.Push(RESULT_SUCCESS); |
| 306 | rb.Push<u32>(static_cast<u32>(out.size())); | 320 | rb.Push<u32>(*res); |
| 321 | } else { | ||
| 322 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 323 | rb.Push(res.Code()); | ||
| 307 | } | 324 | } |
| 308 | }; | 325 | } |
| 309 | 326 | ||
| 310 | class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> { | 327 | ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage( |
| 311 | public: | 328 | const u32 supported_languages) { |
| 312 | explicit IApplicationVersionInterface() : ServiceFramework{"IApplicationVersionInterface"} { | 329 | LOG_DEBUG(Service_NS, "called with supported_languages={:08X}", supported_languages); |
| 313 | // clang-format off | ||
| 314 | static const FunctionInfo functions[] = { | ||
| 315 | {0, nullptr, "GetLaunchRequiredVersion"}, | ||
| 316 | {1, nullptr, "UpgradeLaunchRequiredVersion"}, | ||
| 317 | {35, nullptr, "UpdateVersionList"}, | ||
| 318 | {36, nullptr, "PushLaunchVersion"}, | ||
| 319 | {37, nullptr, "ListRequiredVersion"}, | ||
| 320 | {800, nullptr, "RequestVersionList"}, | ||
| 321 | {801, nullptr, "ListVersionList"}, | ||
| 322 | {802, nullptr, "RequestVersionListData"}, | ||
| 323 | {1000, nullptr, "PerformAutoUpdate"}, | ||
| 324 | }; | ||
| 325 | // clang-format on | ||
| 326 | 330 | ||
| 327 | RegisterHandlers(functions); | 331 | // Get language code from settings |
| 328 | } | 332 | const auto language_code = Set::GetLanguageCodeFromIndex(Settings::values.language_index); |
| 329 | }; | ||
| 330 | 333 | ||
| 331 | class IContentManagerInterface final : public ServiceFramework<IContentManagerInterface> { | 334 | // Convert to application language, get priority list |
| 332 | public: | 335 | const auto application_language = ConvertToApplicationLanguage(language_code); |
| 333 | explicit IContentManagerInterface() : ServiceFramework{"IContentManagerInterface"} { | 336 | if (application_language == std::nullopt) { |
| 334 | // clang-format off | 337 | return ERR_APPLICATION_LANGUAGE_NOT_FOUND; |
| 335 | static const FunctionInfo functions[] = { | 338 | } |
| 336 | {11, nullptr, "CalculateApplicationOccupiedSize"}, | 339 | const auto priority_list = GetApplicationLanguagePriorityList(*application_language); |
| 337 | {43, nullptr, "CheckSdCardMountStatus"}, | 340 | if (!priority_list) { |
| 338 | {47, nullptr, "GetTotalSpaceSize"}, | 341 | return ERR_APPLICATION_LANGUAGE_NOT_FOUND; |
| 339 | {48, nullptr, "GetFreeSpaceSize"}, | 342 | } |
| 340 | {600, nullptr, "CountApplicationContentMeta"}, | ||
| 341 | {601, nullptr, "ListApplicationContentMetaStatus"}, | ||
| 342 | {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, | ||
| 343 | {607, nullptr, "IsAnyApplicationRunning"}, | ||
| 344 | }; | ||
| 345 | // clang-format on | ||
| 346 | 343 | ||
| 347 | RegisterHandlers(functions); | 344 | // Try to find a valid language. |
| 345 | for (const auto lang : *priority_list) { | ||
| 346 | const auto supported_flag = GetSupportedLanguageFlag(lang); | ||
| 347 | if (supported_languages == 0 || (supported_languages & supported_flag) == supported_flag) { | ||
| 348 | return MakeResult(static_cast<u8>(lang)); | ||
| 349 | } | ||
| 348 | } | 350 | } |
| 349 | }; | ||
| 350 | 351 | ||
| 351 | class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { | 352 | return ERR_APPLICATION_LANGUAGE_NOT_FOUND; |
| 352 | public: | 353 | } |
| 353 | explicit IDocumentInterface() : ServiceFramework{"IDocumentInterface"} { | ||
| 354 | // clang-format off | ||
| 355 | static const FunctionInfo functions[] = { | ||
| 356 | {21, nullptr, "GetApplicationContentPath"}, | ||
| 357 | {23, nullptr, "ResolveApplicationContentPath"}, | ||
| 358 | {93, nullptr, "GetRunningApplicationProgramId"}, | ||
| 359 | }; | ||
| 360 | // clang-format on | ||
| 361 | 354 | ||
| 362 | RegisterHandlers(functions); | 355 | void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( |
| 363 | } | 356 | Kernel::HLERequestContext& ctx) { |
| 364 | }; | 357 | IPC::RequestParser rp{ctx}; |
| 358 | const auto application_language = rp.Pop<u8>(); | ||
| 365 | 359 | ||
| 366 | class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { | 360 | const auto res = ConvertApplicationLanguageToLanguageCode(application_language); |
| 367 | public: | 361 | if (res.Succeeded()) { |
| 368 | explicit IDownloadTaskInterface() : ServiceFramework{"IDownloadTaskInterface"} { | 362 | IPC::ResponseBuilder rb{ctx, 4}; |
| 369 | // clang-format off | 363 | rb.Push(RESULT_SUCCESS); |
| 370 | static const FunctionInfo functions[] = { | 364 | rb.Push(*res); |
| 371 | {701, nullptr, "ClearTaskStatusList"}, | 365 | } else { |
| 372 | {702, nullptr, "RequestDownloadTaskList"}, | 366 | IPC::ResponseBuilder rb{ctx, 2}; |
| 373 | {703, nullptr, "RequestEnsureDownloadTask"}, | 367 | rb.Push(res.Code()); |
| 374 | {704, nullptr, "ListDownloadTaskStatus"}, | 368 | } |
| 375 | {705, nullptr, "RequestDownloadTaskListData"}, | 369 | } |
| 376 | {706, nullptr, "TryCommitCurrentApplicationDownloadTask"}, | ||
| 377 | {707, nullptr, "EnableAutoCommit"}, | ||
| 378 | {708, nullptr, "DisableAutoCommit"}, | ||
| 379 | {709, nullptr, "TriggerDynamicCommitEvent"}, | ||
| 380 | }; | ||
| 381 | // clang-format on | ||
| 382 | 370 | ||
| 383 | RegisterHandlers(functions); | 371 | ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( |
| 372 | u8 application_language) { | ||
| 373 | const auto language_code = | ||
| 374 | ConvertToLanguageCode(static_cast<ApplicationLanguage>(application_language)); | ||
| 375 | if (language_code == std::nullopt) { | ||
| 376 | return ERR_APPLICATION_LANGUAGE_NOT_FOUND; | ||
| 384 | } | 377 | } |
| 385 | }; | ||
| 386 | 378 | ||
| 387 | class IECommerceInterface final : public ServiceFramework<IECommerceInterface> { | 379 | return MakeResult(static_cast<u64>(*language_code)); |
| 388 | public: | 380 | } |
| 389 | explicit IECommerceInterface() : ServiceFramework{"IECommerceInterface"} { | ||
| 390 | // clang-format off | ||
| 391 | static const FunctionInfo functions[] = { | ||
| 392 | {0, nullptr, "RequestLinkDevice"}, | ||
| 393 | {1, nullptr, "RequestCleanupAllPreInstalledApplications"}, | ||
| 394 | {2, nullptr, "RequestCleanupPreInstalledApplication"}, | ||
| 395 | {3, nullptr, "RequestSyncRights"}, | ||
| 396 | {4, nullptr, "RequestUnlinkDevice"}, | ||
| 397 | {5, nullptr, "RequestRevokeAllELicense"}, | ||
| 398 | }; | ||
| 399 | // clang-format on | ||
| 400 | 381 | ||
| 401 | RegisterHandlers(functions); | 382 | IApplicationVersionInterface::IApplicationVersionInterface() |
| 402 | } | 383 | : ServiceFramework{"IApplicationVersionInterface"} { |
| 403 | }; | 384 | // clang-format off |
| 385 | static const FunctionInfo functions[] = { | ||
| 386 | {0, nullptr, "GetLaunchRequiredVersion"}, | ||
| 387 | {1, nullptr, "UpgradeLaunchRequiredVersion"}, | ||
| 388 | {35, nullptr, "UpdateVersionList"}, | ||
| 389 | {36, nullptr, "PushLaunchVersion"}, | ||
| 390 | {37, nullptr, "ListRequiredVersion"}, | ||
| 391 | {800, nullptr, "RequestVersionList"}, | ||
| 392 | {801, nullptr, "ListVersionList"}, | ||
| 393 | {802, nullptr, "RequestVersionListData"}, | ||
| 394 | {1000, nullptr, "PerformAutoUpdate"}, | ||
| 395 | }; | ||
| 396 | // clang-format on | ||
| 397 | |||
| 398 | RegisterHandlers(functions); | ||
| 399 | } | ||
| 404 | 400 | ||
| 405 | class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> { | 401 | IApplicationVersionInterface::~IApplicationVersionInterface() = default; |
| 406 | public: | 402 | |
| 407 | explicit IFactoryResetInterface() : ServiceFramework{"IFactoryResetInterface"} { | 403 | IContentManagerInterface::IContentManagerInterface() |
| 408 | // clang-format off | 404 | : ServiceFramework{"IContentManagerInterface"} { |
| 405 | // clang-format off | ||
| 406 | static const FunctionInfo functions[] = { | ||
| 407 | {11, nullptr, "CalculateApplicationOccupiedSize"}, | ||
| 408 | {43, nullptr, "CheckSdCardMountStatus"}, | ||
| 409 | {47, nullptr, "GetTotalSpaceSize"}, | ||
| 410 | {48, nullptr, "GetFreeSpaceSize"}, | ||
| 411 | {600, nullptr, "CountApplicationContentMeta"}, | ||
| 412 | {601, nullptr, "ListApplicationContentMetaStatus"}, | ||
| 413 | {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, | ||
| 414 | {607, nullptr, "IsAnyApplicationRunning"}, | ||
| 415 | }; | ||
| 416 | // clang-format on | ||
| 417 | |||
| 418 | RegisterHandlers(functions); | ||
| 419 | } | ||
| 420 | |||
| 421 | IContentManagerInterface::~IContentManagerInterface() = default; | ||
| 422 | |||
| 423 | IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"} { | ||
| 424 | // clang-format off | ||
| 425 | static const FunctionInfo functions[] = { | ||
| 426 | {21, nullptr, "GetApplicationContentPath"}, | ||
| 427 | {23, nullptr, "ResolveApplicationContentPath"}, | ||
| 428 | {93, nullptr, "GetRunningApplicationProgramId"}, | ||
| 429 | }; | ||
| 430 | // clang-format on | ||
| 431 | |||
| 432 | RegisterHandlers(functions); | ||
| 433 | } | ||
| 434 | |||
| 435 | IDocumentInterface::~IDocumentInterface() = default; | ||
| 436 | |||
| 437 | IDownloadTaskInterface::IDownloadTaskInterface() : ServiceFramework{"IDownloadTaskInterface"} { | ||
| 438 | // clang-format off | ||
| 439 | static const FunctionInfo functions[] = { | ||
| 440 | {701, nullptr, "ClearTaskStatusList"}, | ||
| 441 | {702, nullptr, "RequestDownloadTaskList"}, | ||
| 442 | {703, nullptr, "RequestEnsureDownloadTask"}, | ||
| 443 | {704, nullptr, "ListDownloadTaskStatus"}, | ||
| 444 | {705, nullptr, "RequestDownloadTaskListData"}, | ||
| 445 | {706, nullptr, "TryCommitCurrentApplicationDownloadTask"}, | ||
| 446 | {707, nullptr, "EnableAutoCommit"}, | ||
| 447 | {708, nullptr, "DisableAutoCommit"}, | ||
| 448 | {709, nullptr, "TriggerDynamicCommitEvent"}, | ||
| 449 | }; | ||
| 450 | // clang-format on | ||
| 451 | |||
| 452 | RegisterHandlers(functions); | ||
| 453 | } | ||
| 454 | |||
| 455 | IDownloadTaskInterface::~IDownloadTaskInterface() = default; | ||
| 456 | |||
| 457 | IECommerceInterface::IECommerceInterface() : ServiceFramework{"IECommerceInterface"} { | ||
| 458 | // clang-format off | ||
| 459 | static const FunctionInfo functions[] = { | ||
| 460 | {0, nullptr, "RequestLinkDevice"}, | ||
| 461 | {1, nullptr, "RequestCleanupAllPreInstalledApplications"}, | ||
| 462 | {2, nullptr, "RequestCleanupPreInstalledApplication"}, | ||
| 463 | {3, nullptr, "RequestSyncRights"}, | ||
| 464 | {4, nullptr, "RequestUnlinkDevice"}, | ||
| 465 | {5, nullptr, "RequestRevokeAllELicense"}, | ||
| 466 | }; | ||
| 467 | // clang-format on | ||
| 468 | |||
| 469 | RegisterHandlers(functions); | ||
| 470 | } | ||
| 471 | |||
| 472 | IECommerceInterface::~IECommerceInterface() = default; | ||
| 473 | |||
| 474 | IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface() | ||
| 475 | : ServiceFramework{"IFactoryResetInterface"} { | ||
| 476 | // clang-format off | ||
| 409 | static const FunctionInfo functions[] = { | 477 | static const FunctionInfo functions[] = { |
| 410 | {100, nullptr, "ResetToFactorySettings"}, | 478 | {100, nullptr, "ResetToFactorySettings"}, |
| 411 | {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, | 479 | {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, |
| 412 | {102, nullptr, "ResetToFactorySettingsForRefurbishment"}, | 480 | {102, nullptr, "ResetToFactorySettingsForRefurbishment"}, |
| 413 | }; | 481 | }; |
| 414 | // clang-format on | 482 | // clang-format on |
| 415 | 483 | ||
| 416 | RegisterHandlers(functions); | 484 | RegisterHandlers(functions); |
| 417 | } | 485 | } |
| 418 | }; | ||
| 419 | |||
| 420 | class NS final : public ServiceFramework<NS> { | ||
| 421 | public: | ||
| 422 | explicit NS(const char* name) : ServiceFramework{name} { | ||
| 423 | // clang-format off | ||
| 424 | static const FunctionInfo functions[] = { | ||
| 425 | {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, | ||
| 426 | {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, | ||
| 427 | {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"}, | ||
| 428 | {7995, &NS::PushInterface<IAccountProxyInterface>, "GetAccountProxyInterface"}, | ||
| 429 | {7996, &NS::PushInterface<IApplicationManagerInterface>, "GetApplicationManagerInterface"}, | ||
| 430 | {7997, &NS::PushInterface<IDownloadTaskInterface>, "GetDownloadTaskInterface"}, | ||
| 431 | {7998, &NS::PushInterface<IContentManagerInterface>, "GetContentManagementInterface"}, | ||
| 432 | {7999, &NS::PushInterface<IDocumentInterface>, "GetDocumentInterface"}, | ||
| 433 | }; | ||
| 434 | // clang-format on | ||
| 435 | 486 | ||
| 436 | RegisterHandlers(functions); | 487 | IFactoryResetInterface::~IFactoryResetInterface() = default; |
| 437 | } | 488 | |
| 489 | NS::NS(const char* name) : ServiceFramework{name} { | ||
| 490 | // clang-format off | ||
| 491 | static const FunctionInfo functions[] = { | ||
| 492 | {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, | ||
| 493 | {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, | ||
| 494 | {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"}, | ||
| 495 | {7995, &NS::PushInterface<IAccountProxyInterface>, "GetAccountProxyInterface"}, | ||
| 496 | {7996, &NS::PushInterface<IApplicationManagerInterface>, "GetApplicationManagerInterface"}, | ||
| 497 | {7997, &NS::PushInterface<IDownloadTaskInterface>, "GetDownloadTaskInterface"}, | ||
| 498 | {7998, &NS::PushInterface<IContentManagerInterface>, "GetContentManagementInterface"}, | ||
| 499 | {7999, &NS::PushInterface<IDocumentInterface>, "GetDocumentInterface"}, | ||
| 500 | }; | ||
| 501 | // clang-format on | ||
| 502 | |||
| 503 | RegisterHandlers(functions); | ||
| 504 | } | ||
| 438 | 505 | ||
| 439 | private: | 506 | NS::~NS() = default; |
| 440 | template <typename T> | ||
| 441 | void PushInterface(Kernel::HLERequestContext& ctx) { | ||
| 442 | LOG_DEBUG(Service_NS, "called"); | ||
| 443 | 507 | ||
| 444 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 508 | std::shared_ptr<IApplicationManagerInterface> NS::GetApplicationManagerInterface() const { |
| 445 | rb.Push(RESULT_SUCCESS); | 509 | return GetInterface<IApplicationManagerInterface>(); |
| 446 | rb.PushIpcInterface<T>(); | 510 | } |
| 447 | } | ||
| 448 | }; | ||
| 449 | 511 | ||
| 450 | class NS_DEV final : public ServiceFramework<NS_DEV> { | 512 | class NS_DEV final : public ServiceFramework<NS_DEV> { |
| 451 | public: | 513 | public: |
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index b81ca8f1e..0f4bab4cb 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h | |||
| @@ -8,6 +8,88 @@ | |||
| 8 | 8 | ||
| 9 | namespace Service::NS { | 9 | namespace Service::NS { |
| 10 | 10 | ||
| 11 | class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> { | ||
| 12 | public: | ||
| 13 | explicit IAccountProxyInterface(); | ||
| 14 | ~IAccountProxyInterface(); | ||
| 15 | }; | ||
| 16 | |||
| 17 | class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> { | ||
| 18 | public: | ||
| 19 | explicit IApplicationManagerInterface(); | ||
| 20 | ~IApplicationManagerInterface(); | ||
| 21 | |||
| 22 | ResultVal<u8> GetApplicationDesiredLanguage(u32 supported_languages); | ||
| 23 | ResultVal<u64> ConvertApplicationLanguageToLanguageCode(u8 application_language); | ||
| 24 | |||
| 25 | private: | ||
| 26 | void GetApplicationControlData(Kernel::HLERequestContext& ctx); | ||
| 27 | void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx); | ||
| 28 | void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx); | ||
| 29 | }; | ||
| 30 | |||
| 31 | class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> { | ||
| 32 | public: | ||
| 33 | explicit IApplicationVersionInterface(); | ||
| 34 | ~IApplicationVersionInterface(); | ||
| 35 | }; | ||
| 36 | |||
| 37 | class IContentManagerInterface final : public ServiceFramework<IContentManagerInterface> { | ||
| 38 | public: | ||
| 39 | explicit IContentManagerInterface(); | ||
| 40 | ~IContentManagerInterface(); | ||
| 41 | }; | ||
| 42 | |||
| 43 | class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { | ||
| 44 | public: | ||
| 45 | explicit IDocumentInterface(); | ||
| 46 | ~IDocumentInterface(); | ||
| 47 | }; | ||
| 48 | |||
| 49 | class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { | ||
| 50 | public: | ||
| 51 | explicit IDownloadTaskInterface(); | ||
| 52 | ~IDownloadTaskInterface(); | ||
| 53 | }; | ||
| 54 | |||
| 55 | class IECommerceInterface final : public ServiceFramework<IECommerceInterface> { | ||
| 56 | public: | ||
| 57 | explicit IECommerceInterface(); | ||
| 58 | ~IECommerceInterface(); | ||
| 59 | }; | ||
| 60 | |||
| 61 | class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> { | ||
| 62 | public: | ||
| 63 | explicit IFactoryResetInterface(); | ||
| 64 | ~IFactoryResetInterface(); | ||
| 65 | }; | ||
| 66 | |||
| 67 | class NS final : public ServiceFramework<NS> { | ||
| 68 | public: | ||
| 69 | explicit NS(const char* name); | ||
| 70 | ~NS(); | ||
| 71 | |||
| 72 | std::shared_ptr<IApplicationManagerInterface> GetApplicationManagerInterface() const; | ||
| 73 | |||
| 74 | private: | ||
| 75 | template <typename T> | ||
| 76 | void PushInterface(Kernel::HLERequestContext& ctx) { | ||
| 77 | LOG_DEBUG(Service_NS, "called"); | ||
| 78 | |||
| 79 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 80 | rb.Push(RESULT_SUCCESS); | ||
| 81 | rb.PushIpcInterface<T>(); | ||
| 82 | } | ||
| 83 | |||
| 84 | template <typename T> | ||
| 85 | std::shared_ptr<T> GetInterface() const { | ||
| 86 | static_assert(std::is_base_of_v<Kernel::SessionRequestHandler, T>, | ||
| 87 | "Not a base of ServiceFrameworkBase"); | ||
| 88 | |||
| 89 | return std::make_shared<T>(); | ||
| 90 | } | ||
| 91 | }; | ||
| 92 | |||
| 11 | /// Registers all NS services with the specified service manager. | 93 | /// Registers all NS services with the specified service manager. |
| 12 | void InstallInterfaces(SM::ServiceManager& service_manager); | 94 | void InstallInterfaces(SM::ServiceManager& service_manager); |
| 13 | 95 | ||
diff --git a/src/core/hle/service/ns/ns_language.h b/src/core/hle/service/ns/ns_language.h new file mode 100644 index 000000000..59ac85a19 --- /dev/null +++ b/src/core/hle/service/ns/ns_language.h | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | #include <optional> | ||
| 7 | #include <string> | ||
| 8 | #include "common/common_types.h" | ||
| 9 | #include "core/hle/service/set/set.h" | ||
| 10 | |||
| 11 | namespace Service::NS { | ||
| 12 | /// This is nn::ns::detail::ApplicationLanguage | ||
| 13 | enum class ApplicationLanguage : u8 { | ||
| 14 | AmericanEnglish = 0, | ||
| 15 | BritishEnglish, | ||
| 16 | Japanese, | ||
| 17 | French, | ||
| 18 | German, | ||
| 19 | LatinAmericanSpanish, | ||
| 20 | Spanish, | ||
| 21 | Italian, | ||
| 22 | Dutch, | ||
| 23 | CanadianFrench, | ||
| 24 | Portuguese, | ||
| 25 | Russian, | ||
| 26 | Korean, | ||
| 27 | TraditionalChinese, | ||
| 28 | SimplifiedChinese, | ||
| 29 | Count | ||
| 30 | }; | ||
| 31 | using ApplicationLanguagePriorityList = | ||
| 32 | const std::array<ApplicationLanguage, static_cast<std::size_t>(ApplicationLanguage::Count)>; | ||
| 33 | |||
| 34 | constexpr u32 GetSupportedLanguageFlag(const ApplicationLanguage lang) { | ||
| 35 | return 1U << static_cast<u32>(lang); | ||
| 36 | } | ||
| 37 | |||
| 38 | const ApplicationLanguagePriorityList* GetApplicationLanguagePriorityList(ApplicationLanguage lang); | ||
| 39 | std::optional<ApplicationLanguage> ConvertToApplicationLanguage( | ||
| 40 | Service::Set::LanguageCode language_code); | ||
| 41 | std::optional<Service::Set::LanguageCode> ConvertToLanguageCode(ApplicationLanguage lang); | ||
| 42 | } // namespace Service::NS \ No newline at end of file | ||