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