summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Liam2024-02-17 14:22:15 -0500
committerGravatar Liam2024-02-18 10:35:39 -0500
commit2e96921f9cbd7e8eab6c6b8e94bdbe1a5ccd7237 (patch)
treea0e730535f063c5154c5eeac4e329fefc053d4dd /src
parentns: move IDevelopInterface (diff)
downloadyuzu-2e96921f9cbd7e8eab6c6b8e94bdbe1a5ccd7237.tar.gz
yuzu-2e96921f9cbd7e8eab6c6b8e94bdbe1a5ccd7237.tar.xz
yuzu-2e96921f9cbd7e8eab6c6b8e94bdbe1a5ccd7237.zip
ns: rewrite IApplicationManagerInterface
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/hle/service/am/service/application_functions.cpp3
-rw-r--r--src/core/hle/service/am/service/library_applet_self_accessor.cpp3
-rw-r--r--src/core/hle/service/ns/application_manager_interface.cpp518
-rw-r--r--src/core/hle/service/ns/application_manager_interface.h62
-rw-r--r--src/core/hle/service/ns/content_management_interface.h2
-rw-r--r--src/core/hle/service/ns/ns.cpp465
-rw-r--r--src/core/hle/service/ns/ns.h49
-rw-r--r--src/core/hle/service/ns/ns_types.h9
-rw-r--r--src/core/hle/service/ns/read_only_application_control_data_interface.cpp4
-rw-r--r--src/core/hle/service/ns/read_only_application_control_data_interface.h5
11 files changed, 633 insertions, 489 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 4ec9a1548..43d377913 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -741,6 +741,8 @@ add_library(core STATIC
741 hle/service/npns/npns.h 741 hle/service/npns/npns.h
742 hle/service/ns/account_proxy_interface.cpp 742 hle/service/ns/account_proxy_interface.cpp
743 hle/service/ns/account_proxy_interface.h 743 hle/service/ns/account_proxy_interface.h
744 hle/service/ns/application_manager_interface.cpp
745 hle/service/ns/application_manager_interface.h
744 hle/service/ns/application_version_interface.cpp 746 hle/service/ns/application_version_interface.cpp
745 hle/service/ns/application_version_interface.h 747 hle/service/ns/application_version_interface.h
746 hle/service/ns/content_management_interface.cpp 748 hle/service/ns/content_management_interface.cpp
diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp
index 63dd12a47..a40789c01 100644
--- a/src/core/hle/service/am/service/application_functions.cpp
+++ b/src/core/hle/service/am/service/application_functions.cpp
@@ -16,6 +16,7 @@
16#include "core/hle/service/filesystem/filesystem.h" 16#include "core/hle/service/filesystem/filesystem.h"
17#include "core/hle/service/filesystem/save_data_controller.h" 17#include "core/hle/service/filesystem/save_data_controller.h"
18#include "core/hle/service/glue/glue_manager.h" 18#include "core/hle/service/glue/glue_manager.h"
19#include "core/hle/service/ns/application_manager_interface.h"
19#include "core/hle/service/ns/ns.h" 20#include "core/hle/service/ns/ns.h"
20#include "core/hle/service/sm/sm.h" 21#include "core/hle/service/sm/sm.h"
21 22
@@ -167,7 +168,7 @@ Result IApplicationFunctions::GetDesiredLanguage(Out<u64> out_language_code) {
167 auto app_man = ns_am2->GetApplicationManagerInterface(); 168 auto app_man = ns_am2->GetApplicationManagerInterface();
168 169
169 // Get desired application language 170 // Get desired application language
170 u8 desired_language{}; 171 NS::ApplicationLanguage desired_language{};
171 R_TRY(app_man->GetApplicationDesiredLanguage(&desired_language, supported_languages)); 172 R_TRY(app_man->GetApplicationDesiredLanguage(&desired_language, supported_languages));
172 173
173 // Convert to settings language code. 174 // Convert to settings language code.
diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.cpp b/src/core/hle/service/am/service/library_applet_self_accessor.cpp
index 7a3a86e88..932e354e0 100644
--- a/src/core/hle/service/am/service/library_applet_self_accessor.cpp
+++ b/src/core/hle/service/am/service/library_applet_self_accessor.cpp
@@ -14,6 +14,7 @@
14#include "core/hle/service/cmif_serialization.h" 14#include "core/hle/service/cmif_serialization.h"
15#include "core/hle/service/filesystem/filesystem.h" 15#include "core/hle/service/filesystem/filesystem.h"
16#include "core/hle/service/glue/glue_manager.h" 16#include "core/hle/service/glue/glue_manager.h"
17#include "core/hle/service/ns/application_manager_interface.h"
17#include "core/hle/service/ns/ns.h" 18#include "core/hle/service/ns/ns.h"
18#include "core/hle/service/sm/sm.h" 19#include "core/hle/service/sm/sm.h"
19 20
@@ -260,7 +261,7 @@ Result ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage(
260 auto app_man = ns_am2->GetApplicationManagerInterface(); 261 auto app_man = ns_am2->GetApplicationManagerInterface();
261 262
262 // Get desired application language 263 // Get desired application language
263 u8 desired_language{}; 264 NS::ApplicationLanguage desired_language{};
264 R_TRY(app_man->GetApplicationDesiredLanguage(&desired_language, supported_languages)); 265 R_TRY(app_man->GetApplicationDesiredLanguage(&desired_language, supported_languages));
265 266
266 // Convert to settings language code. 267 // Convert to settings language code.
diff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cpp
new file mode 100644
index 000000000..9c7975b77
--- /dev/null
+++ b/src/core/hle/service/ns/application_manager_interface.cpp
@@ -0,0 +1,518 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "core/file_sys/nca_metadata.h"
5#include "core/file_sys/registered_cache.h"
6#include "core/hle/service/cmif_serialization.h"
7#include "core/hle/service/filesystem/filesystem.h"
8#include "core/hle/service/ns/application_manager_interface.h"
9#include "core/hle/service/ns/content_management_interface.h"
10#include "core/hle/service/ns/read_only_application_control_data_interface.h"
11
12namespace Service::NS {
13
14IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_)
15 : ServiceFramework{system_, "IApplicationManagerInterface"},
16 service_context{system, "IApplicationManagerInterface"},
17 record_update_system_event{service_context}, sd_card_mount_status_event{service_context},
18 gamecard_update_detection_event{service_context},
19 gamecard_mount_status_event{service_context}, gamecard_mount_failure_event{service_context} {
20 // clang-format off
21 static const FunctionInfo functions[] = {
22 {0, D<&IApplicationManagerInterface::ListApplicationRecord>, "ListApplicationRecord"},
23 {1, nullptr, "GenerateApplicationRecordCount"},
24 {2, D<&IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent>, "GetApplicationRecordUpdateSystemEvent"},
25 {3, nullptr, "GetApplicationViewDeprecated"},
26 {4, nullptr, "DeleteApplicationEntity"},
27 {5, nullptr, "DeleteApplicationCompletely"},
28 {6, nullptr, "IsAnyApplicationEntityRedundant"},
29 {7, nullptr, "DeleteRedundantApplicationEntity"},
30 {8, nullptr, "IsApplicationEntityMovable"},
31 {9, nullptr, "MoveApplicationEntity"},
32 {11, nullptr, "CalculateApplicationOccupiedSize"},
33 {16, nullptr, "PushApplicationRecord"},
34 {17, nullptr, "ListApplicationRecordContentMeta"},
35 {19, nullptr, "LaunchApplicationOld"},
36 {21, nullptr, "GetApplicationContentPath"},
37 {22, nullptr, "TerminateApplication"},
38 {23, nullptr, "ResolveApplicationContentPath"},
39 {26, nullptr, "BeginInstallApplication"},
40 {27, nullptr, "DeleteApplicationRecord"},
41 {30, nullptr, "RequestApplicationUpdateInfo"},
42 {31, nullptr, "Unknown31"},
43 {32, nullptr, "CancelApplicationDownload"},
44 {33, nullptr, "ResumeApplicationDownload"},
45 {35, nullptr, "UpdateVersionList"},
46 {36, nullptr, "PushLaunchVersion"},
47 {37, nullptr, "ListRequiredVersion"},
48 {38, D<&IApplicationManagerInterface::CheckApplicationLaunchVersion>, "CheckApplicationLaunchVersion"},
49 {39, nullptr, "CheckApplicationLaunchRights"},
50 {40, nullptr, "GetApplicationLogoData"},
51 {41, nullptr, "CalculateApplicationDownloadRequiredSize"},
52 {42, nullptr, "CleanupSdCard"},
53 {43, D<&IApplicationManagerInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"},
54 {44, D<&IApplicationManagerInterface::GetSdCardMountStatusChangedEvent>, "GetSdCardMountStatusChangedEvent"},
55 {45, nullptr, "GetGameCardAttachmentEvent"},
56 {46, nullptr, "GetGameCardAttachmentInfo"},
57 {47, nullptr, "GetTotalSpaceSize"},
58 {48, D<&IApplicationManagerInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"},
59 {49, nullptr, "GetSdCardRemovedEvent"},
60 {52, D<&IApplicationManagerInterface::GetGameCardUpdateDetectionEvent>, "GetGameCardUpdateDetectionEvent"},
61 {53, nullptr, "DisableApplicationAutoDelete"},
62 {54, nullptr, "EnableApplicationAutoDelete"},
63 {55, D<&IApplicationManagerInterface::GetApplicationDesiredLanguage>, "GetApplicationDesiredLanguage"},
64 {56, nullptr, "SetApplicationTerminateResult"},
65 {57, nullptr, "ClearApplicationTerminateResult"},
66 {58, nullptr, "GetLastSdCardMountUnexpectedResult"},
67 {59, D<&IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode>, "ConvertApplicationLanguageToLanguageCode"},
68 {60, nullptr, "ConvertLanguageCodeToApplicationLanguage"},
69 {61, nullptr, "GetBackgroundDownloadStressTaskInfo"},
70 {62, nullptr, "GetGameCardStopper"},
71 {63, nullptr, "IsSystemProgramInstalled"},
72 {64, nullptr, "StartApplyDeltaTask"},
73 {65, nullptr, "GetRequestServerStopper"},
74 {66, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"},
75 {67, nullptr, "CancelApplicationApplyDelta"},
76 {68, nullptr, "ResumeApplicationApplyDelta"},
77 {69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"},
78 {70, D<&IApplicationManagerInterface::ResumeAll>, "ResumeAll"},
79 {71, D<&IApplicationManagerInterface::GetStorageSize>, "GetStorageSize"},
80 {80, nullptr, "RequestDownloadApplication"},
81 {81, nullptr, "RequestDownloadAddOnContent"},
82 {82, nullptr, "DownloadApplication"},
83 {83, nullptr, "CheckApplicationResumeRights"},
84 {84, nullptr, "GetDynamicCommitEvent"},
85 {85, nullptr, "RequestUpdateApplication2"},
86 {86, nullptr, "EnableApplicationCrashReport"},
87 {87, nullptr, "IsApplicationCrashReportEnabled"},
88 {90, nullptr, "BoostSystemMemoryResourceLimit"},
89 {91, nullptr, "DeprecatedLaunchApplication"},
90 {92, nullptr, "GetRunningApplicationProgramId"},
91 {93, nullptr, "GetMainApplicationProgramIndex"},
92 {94, nullptr, "LaunchApplication"},
93 {95, nullptr, "GetApplicationLaunchInfo"},
94 {96, nullptr, "AcquireApplicationLaunchInfo"},
95 {97, nullptr, "GetMainApplicationProgramIndexByApplicationLaunchInfo"},
96 {98, nullptr, "EnableApplicationAllThreadDumpOnCrash"},
97 {99, nullptr, "LaunchDevMenu"},
98 {100, nullptr, "ResetToFactorySettings"},
99 {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"},
100 {102, nullptr, "ResetToFactorySettingsForRefurbishment"},
101 {103, nullptr, "ResetToFactorySettingsWithPlatformRegion"},
102 {104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"},
103 {105, nullptr, "RequestResetToFactorySettingsSecurely"},
104 {106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"},
105 {200, nullptr, "CalculateUserSaveDataStatistics"},
106 {201, nullptr, "DeleteUserSaveDataAll"},
107 {210, nullptr, "DeleteUserSystemSaveData"},
108 {211, nullptr, "DeleteSaveData"},
109 {220, nullptr, "UnregisterNetworkServiceAccount"},
110 {221, nullptr, "UnregisterNetworkServiceAccountWithUserSaveDataDeletion"},
111 {300, nullptr, "GetApplicationShellEvent"},
112 {301, nullptr, "PopApplicationShellEventInfo"},
113 {302, nullptr, "LaunchLibraryApplet"},
114 {303, nullptr, "TerminateLibraryApplet"},
115 {304, nullptr, "LaunchSystemApplet"},
116 {305, nullptr, "TerminateSystemApplet"},
117 {306, nullptr, "LaunchOverlayApplet"},
118 {307, nullptr, "TerminateOverlayApplet"},
119 {400, D<&IApplicationManagerInterface::GetApplicationControlData>, "GetApplicationControlData"},
120 {401, nullptr, "InvalidateAllApplicationControlCache"},
121 {402, nullptr, "RequestDownloadApplicationControlData"},
122 {403, nullptr, "GetMaxApplicationControlCacheCount"},
123 {404, nullptr, "InvalidateApplicationControlCache"},
124 {405, nullptr, "ListApplicationControlCacheEntryInfo"},
125 {406, nullptr, "GetApplicationControlProperty"},
126 {407, nullptr, "ListApplicationTitle"},
127 {408, nullptr, "ListApplicationIcon"},
128 {502, nullptr, "RequestCheckGameCardRegistration"},
129 {503, nullptr, "RequestGameCardRegistrationGoldPoint"},
130 {504, nullptr, "RequestRegisterGameCard"},
131 {505, D<&IApplicationManagerInterface::GetGameCardMountFailureEvent>, "GetGameCardMountFailureEvent"},
132 {506, nullptr, "IsGameCardInserted"},
133 {507, nullptr, "EnsureGameCardAccess"},
134 {508, nullptr, "GetLastGameCardMountFailureResult"},
135 {509, nullptr, "ListApplicationIdOnGameCard"},
136 {510, nullptr, "GetGameCardPlatformRegion"},
137 {600, nullptr, "CountApplicationContentMeta"},
138 {601, nullptr, "ListApplicationContentMetaStatus"},
139 {602, nullptr, "ListAvailableAddOnContent"},
140 {603, nullptr, "GetOwnedApplicationContentMetaStatus"},
141 {604, nullptr, "RegisterContentsExternalKey"},
142 {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"},
143 {606, nullptr, "GetContentMetaStorage"},
144 {607, nullptr, "ListAvailableAddOnContent"},
145 {609, nullptr, "ListAvailabilityAssuredAddOnContent"},
146 {610, nullptr, "GetInstalledContentMetaStorage"},
147 {611, nullptr, "PrepareAddOnContent"},
148 {700, nullptr, "PushDownloadTaskList"},
149 {701, nullptr, "ClearTaskStatusList"},
150 {702, nullptr, "RequestDownloadTaskList"},
151 {703, nullptr, "RequestEnsureDownloadTask"},
152 {704, nullptr, "ListDownloadTaskStatus"},
153 {705, nullptr, "RequestDownloadTaskListData"},
154 {800, nullptr, "RequestVersionList"},
155 {801, nullptr, "ListVersionList"},
156 {802, nullptr, "RequestVersionListData"},
157 {900, nullptr, "GetApplicationRecord"},
158 {901, nullptr, "GetApplicationRecordProperty"},
159 {902, nullptr, "EnableApplicationAutoUpdate"},
160 {903, nullptr, "DisableApplicationAutoUpdate"},
161 {904, nullptr, "TouchApplication"},
162 {905, nullptr, "RequestApplicationUpdate"},
163 {906, D<&IApplicationManagerInterface::IsApplicationUpdateRequested>, "IsApplicationUpdateRequested"},
164 {907, nullptr, "WithdrawApplicationUpdateRequest"},
165 {908, nullptr, "ListApplicationRecordInstalledContentMeta"},
166 {909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"},
167 {910, nullptr, "HasApplicationRecord"},
168 {911, nullptr, "SetPreInstalledApplication"},
169 {912, nullptr, "ClearPreInstalledApplicationFlag"},
170 {913, nullptr, "ListAllApplicationRecord"},
171 {914, nullptr, "HideApplicationRecord"},
172 {915, nullptr, "ShowApplicationRecord"},
173 {916, nullptr, "IsApplicationAutoDeleteDisabled"},
174 {1000, nullptr, "RequestVerifyApplicationDeprecated"},
175 {1001, nullptr, "CorruptApplicationForDebug"},
176 {1002, nullptr, "RequestVerifyAddOnContentsRights"},
177 {1003, nullptr, "RequestVerifyApplication"},
178 {1004, nullptr, "CorruptContentForDebug"},
179 {1200, nullptr, "NeedsUpdateVulnerability"},
180 {1300, D<&IApplicationManagerInterface::IsAnyApplicationEntityInstalled>, "IsAnyApplicationEntityInstalled"},
181 {1301, nullptr, "DeleteApplicationContentEntities"},
182 {1302, nullptr, "CleanupUnrecordedApplicationEntity"},
183 {1303, nullptr, "CleanupAddOnContentsWithNoRights"},
184 {1304, nullptr, "DeleteApplicationContentEntity"},
185 {1305, nullptr, "TryDeleteRunningApplicationEntity"},
186 {1306, nullptr, "TryDeleteRunningApplicationCompletely"},
187 {1307, nullptr, "TryDeleteRunningApplicationContentEntities"},
188 {1308, nullptr, "DeleteApplicationCompletelyForDebug"},
189 {1309, nullptr, "CleanupUnavailableAddOnContents"},
190 {1310, nullptr, "RequestMoveApplicationEntity"},
191 {1311, nullptr, "EstimateSizeToMove"},
192 {1312, nullptr, "HasMovableEntity"},
193 {1313, nullptr, "CleanupOrphanContents"},
194 {1314, nullptr, "CheckPreconditionSatisfiedToMove"},
195 {1400, nullptr, "PrepareShutdown"},
196 {1500, nullptr, "FormatSdCard"},
197 {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"},
198 {1502, nullptr, "GetLastSdCardFormatUnexpectedResult"},
199 {1504, nullptr, "InsertSdCard"},
200 {1505, nullptr, "RemoveSdCard"},
201 {1506, nullptr, "GetSdCardStartupStatus"},
202 {1600, nullptr, "GetSystemSeedForPseudoDeviceId"},
203 {1601, nullptr, "ResetSystemSeedForPseudoDeviceId"},
204 {1700, nullptr, "ListApplicationDownloadingContentMeta"},
205 {1701, D<&IApplicationManagerInterface::GetApplicationView>, "GetApplicationView"},
206 {1702, nullptr, "GetApplicationDownloadTaskStatus"},
207 {1703, nullptr, "GetApplicationViewDownloadErrorContext"},
208 {1704, D<&IApplicationManagerInterface::GetApplicationViewWithPromotionInfo>, "GetApplicationViewWithPromotionInfo"},
209 {1705, nullptr, "IsPatchAutoDeletableApplication"},
210 {1800, nullptr, "IsNotificationSetupCompleted"},
211 {1801, nullptr, "GetLastNotificationInfoCount"},
212 {1802, nullptr, "ListLastNotificationInfo"},
213 {1803, nullptr, "ListNotificationTask"},
214 {1900, nullptr, "IsActiveAccount"},
215 {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"},
216 {1902, nullptr, "GetApplicationTicketInfo"},
217 {1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"},
218 {2000, nullptr, "GetSystemDeliveryInfo"},
219 {2001, nullptr, "SelectLatestSystemDeliveryInfo"},
220 {2002, nullptr, "VerifyDeliveryProtocolVersion"},
221 {2003, nullptr, "GetApplicationDeliveryInfo"},
222 {2004, nullptr, "HasAllContentsToDeliver"},
223 {2005, nullptr, "CompareApplicationDeliveryInfo"},
224 {2006, nullptr, "CanDeliverApplication"},
225 {2007, nullptr, "ListContentMetaKeyToDeliverApplication"},
226 {2008, nullptr, "NeedsSystemUpdateToDeliverApplication"},
227 {2009, nullptr, "EstimateRequiredSize"},
228 {2010, nullptr, "RequestReceiveApplication"},
229 {2011, nullptr, "CommitReceiveApplication"},
230 {2012, nullptr, "GetReceiveApplicationProgress"},
231 {2013, nullptr, "RequestSendApplication"},
232 {2014, nullptr, "GetSendApplicationProgress"},
233 {2015, nullptr, "CompareSystemDeliveryInfo"},
234 {2016, nullptr, "ListNotCommittedContentMeta"},
235 {2017, nullptr, "CreateDownloadTask"},
236 {2018, nullptr, "GetApplicationDeliveryInfoHash"},
237 {2050, D<&IApplicationManagerInterface::GetApplicationRightsOnClient>, "GetApplicationRightsOnClient"},
238 {2051, nullptr, "InvalidateRightsIdCache"},
239 {2100, D<&IApplicationManagerInterface::GetApplicationTerminateResult>, "GetApplicationTerminateResult"},
240 {2101, nullptr, "GetRawApplicationTerminateResult"},
241 {2150, nullptr, "CreateRightsEnvironment"},
242 {2151, nullptr, "DestroyRightsEnvironment"},
243 {2152, nullptr, "ActivateRightsEnvironment"},
244 {2153, nullptr, "DeactivateRightsEnvironment"},
245 {2154, nullptr, "ForceActivateRightsContextForExit"},
246 {2155, nullptr, "UpdateRightsEnvironmentStatus"},
247 {2156, nullptr, "CreateRightsEnvironmentForMicroApplication"},
248 {2160, nullptr, "AddTargetApplicationToRightsEnvironment"},
249 {2161, nullptr, "SetUsersToRightsEnvironment"},
250 {2170, nullptr, "GetRightsEnvironmentStatus"},
251 {2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"},
252 {2180, nullptr, "RequestExtendRightsInRightsEnvironment"},
253 {2181, nullptr, "GetResultOfExtendRightsInRightsEnvironment"},
254 {2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"},
255 {2190, nullptr, "GetRightsEnvironmentHandleForApplication"},
256 {2199, nullptr, "GetRightsEnvironmentCountForDebug"},
257 {2200, nullptr, "GetGameCardApplicationCopyIdentifier"},
258 {2201, nullptr, "GetInstalledApplicationCopyIdentifier"},
259 {2250, nullptr, "RequestReportActiveELicence"},
260 {2300, nullptr, "ListEventLog"},
261 {2350, nullptr, "PerformAutoUpdateByApplicationId"},
262 {2351, nullptr, "RequestNoDownloadRightsErrorResolution"},
263 {2352, nullptr, "RequestResolveNoDownloadRightsError"},
264 {2353, nullptr, "GetApplicationDownloadTaskInfo"},
265 {2354, nullptr, "PrioritizeApplicationBackgroundTask"},
266 {2355, nullptr, "PreferStorageEfficientUpdate"},
267 {2356, nullptr, "RequestStorageEfficientUpdatePreferable"},
268 {2357, nullptr, "EnableMultiCoreDownload"},
269 {2358, nullptr, "DisableMultiCoreDownload"},
270 {2359, nullptr, "IsMultiCoreDownloadEnabled"},
271 {2400, nullptr, "GetPromotionInfo"},
272 {2401, nullptr, "CountPromotionInfo"},
273 {2402, nullptr, "ListPromotionInfo"},
274 {2403, nullptr, "ImportPromotionJsonForDebug"},
275 {2404, nullptr, "ClearPromotionInfoForDebug"},
276 {2500, nullptr, "ConfirmAvailableTime"},
277 {2510, nullptr, "CreateApplicationResource"},
278 {2511, nullptr, "GetApplicationResource"},
279 {2513, nullptr, "LaunchMicroApplication"},
280 {2514, nullptr, "ClearTaskOfAsyncTaskManager"},
281 {2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"},
282 {2516, nullptr, "EnsureApplicationCertificate"},
283 {2517, nullptr, "CreateApplicationInstance"},
284 {2518, nullptr, "UpdateQualificationForDebug"},
285 {2519, nullptr, "IsQualificationTransitionSupported"},
286 {2520, nullptr, "IsQualificationTransitionSupportedByProcessId"},
287 {2521, nullptr, "GetRightsUserChangedEvent"},
288 {2522, nullptr, "IsRomRedirectionAvailable"},
289 {2800, nullptr, "GetApplicationIdOfPreomia"},
290 {3000, nullptr, "RegisterDeviceLockKey"},
291 {3001, nullptr, "UnregisterDeviceLockKey"},
292 {3002, nullptr, "VerifyDeviceLockKey"},
293 {3003, nullptr, "HideApplicationIcon"},
294 {3004, nullptr, "ShowApplicationIcon"},
295 {3005, nullptr, "HideApplicationTitle"},
296 {3006, nullptr, "ShowApplicationTitle"},
297 {3007, nullptr, "EnableGameCard"},
298 {3008, nullptr, "DisableGameCard"},
299 {3009, nullptr, "EnableLocalContentShare"},
300 {3010, nullptr, "DisableLocalContentShare"},
301 {3011, nullptr, "IsApplicationIconHidden"},
302 {3012, nullptr, "IsApplicationTitleHidden"},
303 {3013, nullptr, "IsGameCardEnabled"},
304 {3014, nullptr, "IsLocalContentShareEnabled"},
305 {3050, nullptr, "ListAssignELicenseTaskResult"},
306 {9999, nullptr, "GetApplicationCertificate"},
307 };
308 // clang-format on
309
310 RegisterHandlers(functions);
311}
312
313IApplicationManagerInterface::~IApplicationManagerInterface() = default;
314
315Result IApplicationManagerInterface::GetApplicationControlData(
316 OutBuffer<BufferAttr_HipcMapAlias> out_buffer, Out<u32> out_actual_size,
317 ApplicationControlSource application_control_source, u64 application_id) {
318 LOG_DEBUG(Service_NS, "called");
319 R_RETURN(IReadOnlyApplicationControlDataInterface(system).GetApplicationControlData(
320 out_buffer, out_actual_size, application_control_source, application_id));
321}
322
323Result IApplicationManagerInterface::GetApplicationDesiredLanguage(
324 Out<ApplicationLanguage> out_desired_language, u32 supported_languages) {
325 LOG_DEBUG(Service_NS, "called");
326 R_RETURN(IReadOnlyApplicationControlDataInterface(system).GetApplicationDesiredLanguage(
327 out_desired_language, supported_languages));
328}
329
330Result IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
331 Out<u64> out_language_code, ApplicationLanguage application_language) {
332 LOG_DEBUG(Service_NS, "called");
333 R_RETURN(
334 IReadOnlyApplicationControlDataInterface(system).ConvertApplicationLanguageToLanguageCode(
335 out_language_code, application_language));
336}
337
338Result IApplicationManagerInterface::ListApplicationRecord(
339 OutArray<ApplicationRecord, BufferAttr_HipcMapAlias> out_records, Out<s32> out_count,
340 s32 offset) {
341 const auto limit = out_records.size();
342
343 LOG_WARNING(Service_NS, "(STUBBED) called");
344 const auto& cache = system.GetContentProviderUnion();
345 const auto installed_games = cache.ListEntriesFilterOrigin(
346 std::nullopt, FileSys::TitleType::Application, FileSys::ContentRecordType::Program);
347
348 size_t i = 0;
349 u8 ii = 24;
350
351 for (const auto& [slot, game] : installed_games) {
352 if (i >= limit) {
353 break;
354 }
355 if (game.title_id == 0 || game.title_id < 0x0100000000001FFFull) {
356 continue;
357 }
358 if (offset > 0) {
359 offset--;
360 continue;
361 }
362
363 ApplicationRecord record{};
364 record.application_id = game.title_id;
365 record.type = ApplicationRecordType::Installed;
366 record.unknown = 0; // 2 = needs update
367 record.unknown2 = ii++;
368
369 out_records[i++] = record;
370 }
371
372 *out_count = static_cast<s32>(i);
373 R_SUCCEED();
374}
375
376Result IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent(
377 OutCopyHandle<Kernel::KReadableEvent> out_event) {
378 LOG_WARNING(Service_NS, "(STUBBED) called");
379
380 record_update_system_event.Signal();
381 *out_event = record_update_system_event.GetHandle();
382
383 R_SUCCEED();
384}
385
386Result IApplicationManagerInterface::GetGameCardMountFailureEvent(
387 OutCopyHandle<Kernel::KReadableEvent> out_event) {
388 LOG_WARNING(Service_NS, "(STUBBED) called");
389 *out_event = gamecard_mount_failure_event.GetHandle();
390 R_SUCCEED();
391}
392
393Result IApplicationManagerInterface::IsAnyApplicationEntityInstalled(
394 Out<bool> out_is_any_application_entity_installed) {
395 LOG_WARNING(Service_NS, "(STUBBED) called");
396 *out_is_any_application_entity_installed = true;
397 R_SUCCEED();
398}
399
400Result IApplicationManagerInterface::GetApplicationView(
401 OutArray<ApplicationView, BufferAttr_HipcMapAlias> out_application_views,
402 InArray<u64, BufferAttr_HipcMapAlias> application_ids) {
403 const auto size = std::min(out_application_views.size(), application_ids.size());
404 LOG_WARNING(Service_NS, "(STUBBED) called, size={}", application_ids.size());
405
406 for (size_t i = 0; i < size; i++) {
407 ApplicationView view{};
408 view.application_id = application_ids[i];
409 view.unk = 0x70000;
410 view.flags = 0x401f17;
411
412 out_application_views[i] = view;
413 }
414
415 R_SUCCEED();
416}
417
418Result IApplicationManagerInterface::GetApplicationViewWithPromotionInfo(
419 OutArray<ApplicationViewWithPromotionInfo, BufferAttr_HipcMapAlias> out_application_views,
420 InArray<u64, BufferAttr_HipcMapAlias> application_ids) {
421 const auto size = std::min(out_application_views.size(), application_ids.size());
422 LOG_WARNING(Service_NS, "(STUBBED) called, size={}", application_ids.size());
423
424 for (size_t i = 0; i < size; i++) {
425 ApplicationViewWithPromotionInfo view{};
426 view.view.application_id = application_ids[i];
427 view.view.unk = 0x70000;
428 view.view.flags = 0x401f17;
429 view.promotion = {};
430
431 out_application_views[i] = view;
432 }
433
434 R_SUCCEED();
435}
436
437Result IApplicationManagerInterface::GetApplicationRightsOnClient(
438 OutArray<ApplicationRightsOnClient, BufferAttr_HipcMapAlias> out_rights, Out<u32> out_count,
439 Common::UUID account_id, u32 flags, u64 application_id) {
440 LOG_WARNING(Service_NS, "(STUBBED) called, flags={}, application_id={:016X}, account_id={}",
441 flags, application_id, account_id.FormattedString());
442
443 if (!out_rights.empty()) {
444 out_rights[0] = {
445 .application_id = application_id,
446 .uid = account_id,
447 .flags = 0,
448 .flags2 = 0,
449 };
450 *out_count = 1;
451 } else {
452 *out_count = 0;
453 }
454
455 R_SUCCEED();
456}
457
458Result IApplicationManagerInterface::CheckSdCardMountStatus() {
459 LOG_DEBUG(Service_NS, "called");
460 R_RETURN(IContentManagementInterface(system).CheckSdCardMountStatus());
461}
462
463Result IApplicationManagerInterface::GetSdCardMountStatusChangedEvent(
464 OutCopyHandle<Kernel::KReadableEvent> out_event) {
465 LOG_WARNING(Service_NS, "(STUBBED) called");
466 *out_event = sd_card_mount_status_event.GetHandle();
467 R_SUCCEED();
468}
469
470Result IApplicationManagerInterface::GetFreeSpaceSize(Out<s64> out_free_space_size,
471 FileSys::StorageId storage_id) {
472 LOG_DEBUG(Service_NS, "called");
473 R_RETURN(IContentManagementInterface(system).GetFreeSpaceSize(out_free_space_size, storage_id));
474}
475
476Result IApplicationManagerInterface::GetGameCardUpdateDetectionEvent(
477 OutCopyHandle<Kernel::KReadableEvent> out_event) {
478 LOG_WARNING(Service_NS, "(STUBBED) called");
479 *out_event = gamecard_update_detection_event.GetHandle();
480 R_SUCCEED();
481}
482
483Result IApplicationManagerInterface::ResumeAll() {
484 LOG_WARNING(Service_NS, "(STUBBED) called");
485 R_SUCCEED();
486}
487
488Result IApplicationManagerInterface::GetStorageSize(Out<s64> out_total_space_size,
489 Out<s64> out_free_space_size,
490 FileSys::StorageId storage_id) {
491 LOG_INFO(Service_NS, "called, storage_id={}", storage_id);
492 *out_total_space_size = system.GetFileSystemController().GetTotalSpaceSize(storage_id);
493 *out_free_space_size = system.GetFileSystemController().GetFreeSpaceSize(storage_id);
494 R_SUCCEED();
495}
496
497Result IApplicationManagerInterface::IsApplicationUpdateRequested(Out<bool> out_update_required,
498 Out<u32> out_update_version,
499 u64 application_id) {
500 LOG_WARNING(Service_NS, "(STUBBED) called. application_id={:016X}", application_id);
501 *out_update_required = false;
502 *out_update_version = 0;
503 R_SUCCEED();
504}
505
506Result IApplicationManagerInterface::CheckApplicationLaunchVersion(u64 application_id) {
507 LOG_WARNING(Service_NS, "(STUBBED) called. application_id={:016X}", application_id);
508 R_SUCCEED();
509}
510
511Result IApplicationManagerInterface::GetApplicationTerminateResult(Out<Result> out_result,
512 u64 application_id) {
513 LOG_WARNING(Service_NS, "(STUBBED) called. application_id={:016X}", application_id);
514 *out_result = ResultSuccess;
515 R_SUCCEED();
516}
517
518} // namespace Service::NS
diff --git a/src/core/hle/service/ns/application_manager_interface.h b/src/core/hle/service/ns/application_manager_interface.h
new file mode 100644
index 000000000..350ec37ce
--- /dev/null
+++ b/src/core/hle/service/ns/application_manager_interface.h
@@ -0,0 +1,62 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include "core/hle/service/cmif_types.h"
7#include "core/hle/service/ns/language.h"
8#include "core/hle/service/ns/ns_types.h"
9#include "core/hle/service/os/event.h"
10#include "core/hle/service/service.h"
11
12namespace Service::NS {
13
14class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> {
15public:
16 explicit IApplicationManagerInterface(Core::System& system_);
17 ~IApplicationManagerInterface() override;
18
19 Result GetApplicationControlData(OutBuffer<BufferAttr_HipcMapAlias> out_buffer,
20 Out<u32> out_actual_size,
21 ApplicationControlSource application_control_source,
22 u64 application_id);
23 Result GetApplicationDesiredLanguage(Out<ApplicationLanguage> out_desired_language,
24 u32 supported_languages);
25 Result ConvertApplicationLanguageToLanguageCode(Out<u64> out_language_code,
26 ApplicationLanguage application_language);
27 Result ListApplicationRecord(OutArray<ApplicationRecord, BufferAttr_HipcMapAlias> out_records,
28 Out<s32> out_count, s32 offset);
29 Result GetApplicationRecordUpdateSystemEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
30 Result GetGameCardMountFailureEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
31 Result IsAnyApplicationEntityInstalled(Out<bool> out_is_any_application_entity_installed);
32 Result GetApplicationView(
33 OutArray<ApplicationView, BufferAttr_HipcMapAlias> out_application_views,
34 InArray<u64, BufferAttr_HipcMapAlias> application_ids);
35 Result GetApplicationViewWithPromotionInfo(
36 OutArray<ApplicationViewWithPromotionInfo, BufferAttr_HipcMapAlias> out_application_views,
37 InArray<u64, BufferAttr_HipcMapAlias> application_ids);
38 Result GetApplicationRightsOnClient(
39 OutArray<ApplicationRightsOnClient, BufferAttr_HipcMapAlias> out_rights, Out<u32> out_count,
40 Common::UUID account_id, u32 flags, u64 application_id);
41 Result CheckSdCardMountStatus();
42 Result GetSdCardMountStatusChangedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
43 Result GetFreeSpaceSize(Out<s64> out_free_space_size, FileSys::StorageId storage_id);
44 Result GetGameCardUpdateDetectionEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
45 Result ResumeAll();
46 Result GetStorageSize(Out<s64> out_total_space_size, Out<s64> out_free_space_size,
47 FileSys::StorageId storage_id);
48 Result IsApplicationUpdateRequested(Out<bool> out_update_required, Out<u32> out_update_version,
49 u64 application_id);
50 Result CheckApplicationLaunchVersion(u64 application_id);
51 Result GetApplicationTerminateResult(Out<Result> out_result, u64 application_id);
52
53private:
54 KernelHelpers::ServiceContext service_context;
55 Event record_update_system_event;
56 Event sd_card_mount_status_event;
57 Event gamecard_update_detection_event;
58 Event gamecard_mount_status_event;
59 Event gamecard_mount_failure_event;
60};
61
62} // namespace Service::NS
diff --git a/src/core/hle/service/ns/content_management_interface.h b/src/core/hle/service/ns/content_management_interface.h
index b2242be2b..2894628e5 100644
--- a/src/core/hle/service/ns/content_management_interface.h
+++ b/src/core/hle/service/ns/content_management_interface.h
@@ -14,7 +14,7 @@ public:
14 explicit IContentManagementInterface(Core::System& system_); 14 explicit IContentManagementInterface(Core::System& system_);
15 ~IContentManagementInterface() override; 15 ~IContentManagementInterface() override;
16 16
17private: 17public:
18 Result CalculateApplicationOccupiedSize(Out<ApplicationOccupiedSize> out_size, 18 Result CalculateApplicationOccupiedSize(Out<ApplicationOccupiedSize> out_size,
19 u64 application_id); 19 u64 application_id);
20 Result CheckSdCardMountStatus(); 20 Result CheckSdCardMountStatus();
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index 5b05c40d5..9937e7bb7 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -12,6 +12,7 @@
12#include "core/hle/service/glue/glue_manager.h" 12#include "core/hle/service/glue/glue_manager.h"
13#include "core/hle/service/ipc_helpers.h" 13#include "core/hle/service/ipc_helpers.h"
14#include "core/hle/service/ns/account_proxy_interface.h" 14#include "core/hle/service/ns/account_proxy_interface.h"
15#include "core/hle/service/ns/application_manager_interface.h"
15#include "core/hle/service/ns/application_version_interface.h" 16#include "core/hle/service/ns/application_version_interface.h"
16#include "core/hle/service/ns/content_management_interface.h" 17#include "core/hle/service/ns/content_management_interface.h"
17#include "core/hle/service/ns/develop_interface.h" 18#include "core/hle/service/ns/develop_interface.h"
@@ -35,445 +36,6 @@
35 36
36namespace Service::NS { 37namespace Service::NS {
37 38
38IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_)
39 : ServiceFramework{system_, "IApplicationManagerInterface"} {
40 // clang-format off
41 static const FunctionInfo functions[] = {
42 {0, nullptr, "ListApplicationRecord"},
43 {1, nullptr, "GenerateApplicationRecordCount"},
44 {2, nullptr, "GetApplicationRecordUpdateSystemEvent"},
45 {3, nullptr, "GetApplicationViewDeprecated"},
46 {4, nullptr, "DeleteApplicationEntity"},
47 {5, nullptr, "DeleteApplicationCompletely"},
48 {6, nullptr, "IsAnyApplicationEntityRedundant"},
49 {7, nullptr, "DeleteRedundantApplicationEntity"},
50 {8, nullptr, "IsApplicationEntityMovable"},
51 {9, nullptr, "MoveApplicationEntity"},
52 {11, nullptr, "CalculateApplicationOccupiedSize"},
53 {16, nullptr, "PushApplicationRecord"},
54 {17, nullptr, "ListApplicationRecordContentMeta"},
55 {19, nullptr, "LaunchApplicationOld"},
56 {21, nullptr, "GetApplicationContentPath"},
57 {22, nullptr, "TerminateApplication"},
58 {23, nullptr, "ResolveApplicationContentPath"},
59 {26, nullptr, "BeginInstallApplication"},
60 {27, nullptr, "DeleteApplicationRecord"},
61 {30, nullptr, "RequestApplicationUpdateInfo"},
62 {31, nullptr, "Unknown31"},
63 {32, nullptr, "CancelApplicationDownload"},
64 {33, nullptr, "ResumeApplicationDownload"},
65 {35, nullptr, "UpdateVersionList"},
66 {36, nullptr, "PushLaunchVersion"},
67 {37, nullptr, "ListRequiredVersion"},
68 {38, nullptr, "CheckApplicationLaunchVersion"},
69 {39, nullptr, "CheckApplicationLaunchRights"},
70 {40, nullptr, "GetApplicationLogoData"},
71 {41, nullptr, "CalculateApplicationDownloadRequiredSize"},
72 {42, nullptr, "CleanupSdCard"},
73 {43, nullptr, "CheckSdCardMountStatus"},
74 {44, nullptr, "GetSdCardMountStatusChangedEvent"},
75 {45, nullptr, "GetGameCardAttachmentEvent"},
76 {46, nullptr, "GetGameCardAttachmentInfo"},
77 {47, nullptr, "GetTotalSpaceSize"},
78 {48, nullptr, "GetFreeSpaceSize"},
79 {49, nullptr, "GetSdCardRemovedEvent"},
80 {52, nullptr, "GetGameCardUpdateDetectionEvent"},
81 {53, nullptr, "DisableApplicationAutoDelete"},
82 {54, nullptr, "EnableApplicationAutoDelete"},
83 {55, &IApplicationManagerInterface::GetApplicationDesiredLanguage, "GetApplicationDesiredLanguage"},
84 {56, nullptr, "SetApplicationTerminateResult"},
85 {57, nullptr, "ClearApplicationTerminateResult"},
86 {58, nullptr, "GetLastSdCardMountUnexpectedResult"},
87 {59, &IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode, "ConvertApplicationLanguageToLanguageCode"},
88 {60, nullptr, "ConvertLanguageCodeToApplicationLanguage"},
89 {61, nullptr, "GetBackgroundDownloadStressTaskInfo"},
90 {62, nullptr, "GetGameCardStopper"},
91 {63, nullptr, "IsSystemProgramInstalled"},
92 {64, nullptr, "StartApplyDeltaTask"},
93 {65, nullptr, "GetRequestServerStopper"},
94 {66, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"},
95 {67, nullptr, "CancelApplicationApplyDelta"},
96 {68, nullptr, "ResumeApplicationApplyDelta"},
97 {69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"},
98 {70, nullptr, "ResumeAll"},
99 {71, nullptr, "GetStorageSize"},
100 {80, nullptr, "RequestDownloadApplication"},
101 {81, nullptr, "RequestDownloadAddOnContent"},
102 {82, nullptr, "DownloadApplication"},
103 {83, nullptr, "CheckApplicationResumeRights"},
104 {84, nullptr, "GetDynamicCommitEvent"},
105 {85, nullptr, "RequestUpdateApplication2"},
106 {86, nullptr, "EnableApplicationCrashReport"},
107 {87, nullptr, "IsApplicationCrashReportEnabled"},
108 {90, nullptr, "BoostSystemMemoryResourceLimit"},
109 {91, nullptr, "DeprecatedLaunchApplication"},
110 {92, nullptr, "GetRunningApplicationProgramId"},
111 {93, nullptr, "GetMainApplicationProgramIndex"},
112 {94, nullptr, "LaunchApplication"},
113 {95, nullptr, "GetApplicationLaunchInfo"},
114 {96, nullptr, "AcquireApplicationLaunchInfo"},
115 {97, nullptr, "GetMainApplicationProgramIndexByApplicationLaunchInfo"},
116 {98, nullptr, "EnableApplicationAllThreadDumpOnCrash"},
117 {99, nullptr, "LaunchDevMenu"},
118 {100, nullptr, "ResetToFactorySettings"},
119 {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"},
120 {102, nullptr, "ResetToFactorySettingsForRefurbishment"},
121 {103, nullptr, "ResetToFactorySettingsWithPlatformRegion"},
122 {104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"},
123 {105, nullptr, "RequestResetToFactorySettingsSecurely"},
124 {106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"},
125 {200, nullptr, "CalculateUserSaveDataStatistics"},
126 {201, nullptr, "DeleteUserSaveDataAll"},
127 {210, nullptr, "DeleteUserSystemSaveData"},
128 {211, nullptr, "DeleteSaveData"},
129 {220, nullptr, "UnregisterNetworkServiceAccount"},
130 {221, nullptr, "UnregisterNetworkServiceAccountWithUserSaveDataDeletion"},
131 {300, nullptr, "GetApplicationShellEvent"},
132 {301, nullptr, "PopApplicationShellEventInfo"},
133 {302, nullptr, "LaunchLibraryApplet"},
134 {303, nullptr, "TerminateLibraryApplet"},
135 {304, nullptr, "LaunchSystemApplet"},
136 {305, nullptr, "TerminateSystemApplet"},
137 {306, nullptr, "LaunchOverlayApplet"},
138 {307, nullptr, "TerminateOverlayApplet"},
139 {400, &IApplicationManagerInterface::GetApplicationControlData, "GetApplicationControlData"},
140 {401, nullptr, "InvalidateAllApplicationControlCache"},
141 {402, nullptr, "RequestDownloadApplicationControlData"},
142 {403, nullptr, "GetMaxApplicationControlCacheCount"},
143 {404, nullptr, "InvalidateApplicationControlCache"},
144 {405, nullptr, "ListApplicationControlCacheEntryInfo"},
145 {406, nullptr, "GetApplicationControlProperty"},
146 {407, nullptr, "ListApplicationTitle"},
147 {408, nullptr, "ListApplicationIcon"},
148 {502, nullptr, "RequestCheckGameCardRegistration"},
149 {503, nullptr, "RequestGameCardRegistrationGoldPoint"},
150 {504, nullptr, "RequestRegisterGameCard"},
151 {505, nullptr, "GetGameCardMountFailureEvent"},
152 {506, nullptr, "IsGameCardInserted"},
153 {507, nullptr, "EnsureGameCardAccess"},
154 {508, nullptr, "GetLastGameCardMountFailureResult"},
155 {509, nullptr, "ListApplicationIdOnGameCard"},
156 {510, nullptr, "GetGameCardPlatformRegion"},
157 {600, nullptr, "CountApplicationContentMeta"},
158 {601, nullptr, "ListApplicationContentMetaStatus"},
159 {602, nullptr, "ListAvailableAddOnContent"},
160 {603, nullptr, "GetOwnedApplicationContentMetaStatus"},
161 {604, nullptr, "RegisterContentsExternalKey"},
162 {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"},
163 {606, nullptr, "GetContentMetaStorage"},
164 {607, nullptr, "ListAvailableAddOnContent"},
165 {609, nullptr, "ListAvailabilityAssuredAddOnContent"},
166 {610, nullptr, "GetInstalledContentMetaStorage"},
167 {611, nullptr, "PrepareAddOnContent"},
168 {700, nullptr, "PushDownloadTaskList"},
169 {701, nullptr, "ClearTaskStatusList"},
170 {702, nullptr, "RequestDownloadTaskList"},
171 {703, nullptr, "RequestEnsureDownloadTask"},
172 {704, nullptr, "ListDownloadTaskStatus"},
173 {705, nullptr, "RequestDownloadTaskListData"},
174 {800, nullptr, "RequestVersionList"},
175 {801, nullptr, "ListVersionList"},
176 {802, nullptr, "RequestVersionListData"},
177 {900, nullptr, "GetApplicationRecord"},
178 {901, nullptr, "GetApplicationRecordProperty"},
179 {902, nullptr, "EnableApplicationAutoUpdate"},
180 {903, nullptr, "DisableApplicationAutoUpdate"},
181 {904, nullptr, "TouchApplication"},
182 {905, nullptr, "RequestApplicationUpdate"},
183 {906, nullptr, "IsApplicationUpdateRequested"},
184 {907, nullptr, "WithdrawApplicationUpdateRequest"},
185 {908, nullptr, "ListApplicationRecordInstalledContentMeta"},
186 {909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"},
187 {910, nullptr, "HasApplicationRecord"},
188 {911, nullptr, "SetPreInstalledApplication"},
189 {912, nullptr, "ClearPreInstalledApplicationFlag"},
190 {913, nullptr, "ListAllApplicationRecord"},
191 {914, nullptr, "HideApplicationRecord"},
192 {915, nullptr, "ShowApplicationRecord"},
193 {916, nullptr, "IsApplicationAutoDeleteDisabled"},
194 {1000, nullptr, "RequestVerifyApplicationDeprecated"},
195 {1001, nullptr, "CorruptApplicationForDebug"},
196 {1002, nullptr, "RequestVerifyAddOnContentsRights"},
197 {1003, nullptr, "RequestVerifyApplication"},
198 {1004, nullptr, "CorruptContentForDebug"},
199 {1200, nullptr, "NeedsUpdateVulnerability"},
200 {1300, nullptr, "IsAnyApplicationEntityInstalled"},
201 {1301, nullptr, "DeleteApplicationContentEntities"},
202 {1302, nullptr, "CleanupUnrecordedApplicationEntity"},
203 {1303, nullptr, "CleanupAddOnContentsWithNoRights"},
204 {1304, nullptr, "DeleteApplicationContentEntity"},
205 {1305, nullptr, "TryDeleteRunningApplicationEntity"},
206 {1306, nullptr, "TryDeleteRunningApplicationCompletely"},
207 {1307, nullptr, "TryDeleteRunningApplicationContentEntities"},
208 {1308, nullptr, "DeleteApplicationCompletelyForDebug"},
209 {1309, nullptr, "CleanupUnavailableAddOnContents"},
210 {1310, nullptr, "RequestMoveApplicationEntity"},
211 {1311, nullptr, "EstimateSizeToMove"},
212 {1312, nullptr, "HasMovableEntity"},
213 {1313, nullptr, "CleanupOrphanContents"},
214 {1314, nullptr, "CheckPreconditionSatisfiedToMove"},
215 {1400, nullptr, "PrepareShutdown"},
216 {1500, nullptr, "FormatSdCard"},
217 {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"},
218 {1502, nullptr, "GetLastSdCardFormatUnexpectedResult"},
219 {1504, nullptr, "InsertSdCard"},
220 {1505, nullptr, "RemoveSdCard"},
221 {1506, nullptr, "GetSdCardStartupStatus"},
222 {1600, nullptr, "GetSystemSeedForPseudoDeviceId"},
223 {1601, nullptr, "ResetSystemSeedForPseudoDeviceId"},
224 {1700, nullptr, "ListApplicationDownloadingContentMeta"},
225 {1701, nullptr, "GetApplicationView"},
226 {1702, nullptr, "GetApplicationDownloadTaskStatus"},
227 {1703, nullptr, "GetApplicationViewDownloadErrorContext"},
228 {1704, nullptr, "GetApplicationViewWithPromotionInfo"},
229 {1705, nullptr, "IsPatchAutoDeletableApplication"},
230 {1800, nullptr, "IsNotificationSetupCompleted"},
231 {1801, nullptr, "GetLastNotificationInfoCount"},
232 {1802, nullptr, "ListLastNotificationInfo"},
233 {1803, nullptr, "ListNotificationTask"},
234 {1900, nullptr, "IsActiveAccount"},
235 {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"},
236 {1902, nullptr, "GetApplicationTicketInfo"},
237 {1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"},
238 {2000, nullptr, "GetSystemDeliveryInfo"},
239 {2001, nullptr, "SelectLatestSystemDeliveryInfo"},
240 {2002, nullptr, "VerifyDeliveryProtocolVersion"},
241 {2003, nullptr, "GetApplicationDeliveryInfo"},
242 {2004, nullptr, "HasAllContentsToDeliver"},
243 {2005, nullptr, "CompareApplicationDeliveryInfo"},
244 {2006, nullptr, "CanDeliverApplication"},
245 {2007, nullptr, "ListContentMetaKeyToDeliverApplication"},
246 {2008, nullptr, "NeedsSystemUpdateToDeliverApplication"},
247 {2009, nullptr, "EstimateRequiredSize"},
248 {2010, nullptr, "RequestReceiveApplication"},
249 {2011, nullptr, "CommitReceiveApplication"},
250 {2012, nullptr, "GetReceiveApplicationProgress"},
251 {2013, nullptr, "RequestSendApplication"},
252 {2014, nullptr, "GetSendApplicationProgress"},
253 {2015, nullptr, "CompareSystemDeliveryInfo"},
254 {2016, nullptr, "ListNotCommittedContentMeta"},
255 {2017, nullptr, "CreateDownloadTask"},
256 {2018, nullptr, "GetApplicationDeliveryInfoHash"},
257 {2050, nullptr, "GetApplicationRightsOnClient"},
258 {2051, nullptr, "InvalidateRightsIdCache"},
259 {2100, nullptr, "GetApplicationTerminateResult"},
260 {2101, nullptr, "GetRawApplicationTerminateResult"},
261 {2150, nullptr, "CreateRightsEnvironment"},
262 {2151, nullptr, "DestroyRightsEnvironment"},
263 {2152, nullptr, "ActivateRightsEnvironment"},
264 {2153, nullptr, "DeactivateRightsEnvironment"},
265 {2154, nullptr, "ForceActivateRightsContextForExit"},
266 {2155, nullptr, "UpdateRightsEnvironmentStatus"},
267 {2156, nullptr, "CreateRightsEnvironmentForMicroApplication"},
268 {2160, nullptr, "AddTargetApplicationToRightsEnvironment"},
269 {2161, nullptr, "SetUsersToRightsEnvironment"},
270 {2170, nullptr, "GetRightsEnvironmentStatus"},
271 {2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"},
272 {2180, nullptr, "RequestExtendRightsInRightsEnvironment"},
273 {2181, nullptr, "GetResultOfExtendRightsInRightsEnvironment"},
274 {2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"},
275 {2190, nullptr, "GetRightsEnvironmentHandleForApplication"},
276 {2199, nullptr, "GetRightsEnvironmentCountForDebug"},
277 {2200, nullptr, "GetGameCardApplicationCopyIdentifier"},
278 {2201, nullptr, "GetInstalledApplicationCopyIdentifier"},
279 {2250, nullptr, "RequestReportActiveELicence"},
280 {2300, nullptr, "ListEventLog"},
281 {2350, nullptr, "PerformAutoUpdateByApplicationId"},
282 {2351, nullptr, "RequestNoDownloadRightsErrorResolution"},
283 {2352, nullptr, "RequestResolveNoDownloadRightsError"},
284 {2353, nullptr, "GetApplicationDownloadTaskInfo"},
285 {2354, nullptr, "PrioritizeApplicationBackgroundTask"},
286 {2355, nullptr, "PreferStorageEfficientUpdate"},
287 {2356, nullptr, "RequestStorageEfficientUpdatePreferable"},
288 {2357, nullptr, "EnableMultiCoreDownload"},
289 {2358, nullptr, "DisableMultiCoreDownload"},
290 {2359, nullptr, "IsMultiCoreDownloadEnabled"},
291 {2400, nullptr, "GetPromotionInfo"},
292 {2401, nullptr, "CountPromotionInfo"},
293 {2402, nullptr, "ListPromotionInfo"},
294 {2403, nullptr, "ImportPromotionJsonForDebug"},
295 {2404, nullptr, "ClearPromotionInfoForDebug"},
296 {2500, nullptr, "ConfirmAvailableTime"},
297 {2510, nullptr, "CreateApplicationResource"},
298 {2511, nullptr, "GetApplicationResource"},
299 {2513, nullptr, "LaunchMicroApplication"},
300 {2514, nullptr, "ClearTaskOfAsyncTaskManager"},
301 {2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"},
302 {2516, nullptr, "EnsureApplicationCertificate"},
303 {2517, nullptr, "CreateApplicationInstance"},
304 {2518, nullptr, "UpdateQualificationForDebug"},
305 {2519, nullptr, "IsQualificationTransitionSupported"},
306 {2520, nullptr, "IsQualificationTransitionSupportedByProcessId"},
307 {2521, nullptr, "GetRightsUserChangedEvent"},
308 {2522, nullptr, "IsRomRedirectionAvailable"},
309 {2800, nullptr, "GetApplicationIdOfPreomia"},
310 {3000, nullptr, "RegisterDeviceLockKey"},
311 {3001, nullptr, "UnregisterDeviceLockKey"},
312 {3002, nullptr, "VerifyDeviceLockKey"},
313 {3003, nullptr, "HideApplicationIcon"},
314 {3004, nullptr, "ShowApplicationIcon"},
315 {3005, nullptr, "HideApplicationTitle"},
316 {3006, nullptr, "ShowApplicationTitle"},
317 {3007, nullptr, "EnableGameCard"},
318 {3008, nullptr, "DisableGameCard"},
319 {3009, nullptr, "EnableLocalContentShare"},
320 {3010, nullptr, "DisableLocalContentShare"},
321 {3011, nullptr, "IsApplicationIconHidden"},
322 {3012, nullptr, "IsApplicationTitleHidden"},
323 {3013, nullptr, "IsGameCardEnabled"},
324 {3014, nullptr, "IsLocalContentShareEnabled"},
325 {3050, nullptr, "ListAssignELicenseTaskResult"},
326 {9999, nullptr, "GetApplicationCertificate"},
327 };
328 // clang-format on
329
330 RegisterHandlers(functions);
331}
332
333IApplicationManagerInterface::~IApplicationManagerInterface() = default;
334
335void IApplicationManagerInterface::GetApplicationControlData(HLERequestContext& ctx) {
336 IPC::RequestParser rp{ctx};
337 const auto flag = rp.PopRaw<u64>();
338 LOG_DEBUG(Service_NS, "called with flag={:016X}", flag);
339
340 const auto title_id = rp.PopRaw<u64>();
341
342 const auto size = ctx.GetWriteBufferSize();
343
344 const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
345 system.GetContentProvider()};
346 const auto control = pm.GetControlMetadata();
347
348 std::vector<u8> out;
349
350 if (control.first != nullptr) {
351 if (size < 0x4000) {
352 LOG_ERROR(Service_NS,
353 "output buffer is too small! (actual={:016X}, expected_min=0x4000)", size);
354 IPC::ResponseBuilder rb{ctx, 2};
355 // TODO(DarkLordZach): Find a better error code for this.
356 rb.Push(ResultUnknown);
357 return;
358 }
359
360 out.resize(0x4000);
361 const auto bytes = control.first->GetRawBytes();
362 std::memcpy(out.data(), bytes.data(), bytes.size());
363 } else {
364 LOG_WARNING(Service_NS, "missing NACP data for title_id={:016X}, defaulting to zeros.",
365 title_id);
366 out.resize(std::min<u64>(0x4000, size));
367 }
368
369 if (control.second != nullptr) {
370 if (size < 0x4000 + control.second->GetSize()) {
371 LOG_ERROR(Service_NS,
372 "output buffer is too small! (actual={:016X}, expected_min={:016X})", size,
373 0x4000 + control.second->GetSize());
374 IPC::ResponseBuilder rb{ctx, 2};
375 // TODO(DarkLordZach): Find a better error code for this.
376 rb.Push(ResultUnknown);
377 return;
378 }
379
380 out.resize(0x4000 + control.second->GetSize());
381 control.second->Read(out.data() + 0x4000, control.second->GetSize());
382 } else {
383 LOG_WARNING(Service_NS, "missing icon data for title_id={:016X}, defaulting to zeros.",
384 title_id);
385 }
386
387 ctx.WriteBuffer(out);
388
389 IPC::ResponseBuilder rb{ctx, 3};
390 rb.Push(ResultSuccess);
391 rb.Push<u32>(static_cast<u32>(out.size()));
392}
393
394void IApplicationManagerInterface::GetApplicationDesiredLanguage(HLERequestContext& ctx) {
395 IPC::RequestParser rp{ctx};
396 const auto supported_languages = rp.Pop<u32>();
397
398 u8 desired_language{};
399 const auto res = GetApplicationDesiredLanguage(&desired_language, supported_languages);
400 if (res == ResultSuccess) {
401 IPC::ResponseBuilder rb{ctx, 3};
402 rb.Push(ResultSuccess);
403 rb.Push<u32>(desired_language);
404 } else {
405 IPC::ResponseBuilder rb{ctx, 2};
406 rb.Push(res);
407 }
408}
409
410Result IApplicationManagerInterface::GetApplicationDesiredLanguage(u8* out_desired_language,
411 const u32 supported_languages) {
412 LOG_DEBUG(Service_NS, "called with supported_languages={:08X}", supported_languages);
413
414 // Get language code from settings
415 const auto language_code =
416 Set::GetLanguageCodeFromIndex(static_cast<s32>(Settings::values.language_index.GetValue()));
417
418 // Convert to application language, get priority list
419 const auto application_language = ConvertToApplicationLanguage(language_code);
420 if (application_language == std::nullopt) {
421 LOG_ERROR(Service_NS, "Could not convert application language! language_code={}",
422 language_code);
423 return Service::NS::ResultApplicationLanguageNotFound;
424 }
425 const auto priority_list = GetApplicationLanguagePriorityList(*application_language);
426 if (!priority_list) {
427 LOG_ERROR(Service_NS,
428 "Could not find application language priorities! application_language={}",
429 *application_language);
430 return Service::NS::ResultApplicationLanguageNotFound;
431 }
432
433 // Try to find a valid language.
434 for (const auto lang : *priority_list) {
435 const auto supported_flag = GetSupportedLanguageFlag(lang);
436 if (supported_languages == 0 || (supported_languages & supported_flag) == supported_flag) {
437 *out_desired_language = static_cast<u8>(lang);
438 return ResultSuccess;
439 }
440 }
441
442 LOG_ERROR(Service_NS, "Could not find a valid language! supported_languages={:08X}",
443 supported_languages);
444 return Service::NS::ResultApplicationLanguageNotFound;
445}
446
447void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
448 HLERequestContext& ctx) {
449 IPC::RequestParser rp{ctx};
450 const auto application_language = rp.Pop<u8>();
451
452 u64 language_code{};
453 const auto res = ConvertApplicationLanguageToLanguageCode(&language_code, application_language);
454 if (res == ResultSuccess) {
455 IPC::ResponseBuilder rb{ctx, 4};
456 rb.Push(ResultSuccess);
457 rb.Push(language_code);
458 } else {
459 IPC::ResponseBuilder rb{ctx, 2};
460 rb.Push(res);
461 }
462}
463
464Result IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
465 u64* out_language_code, u8 application_language) {
466 const auto language_code =
467 ConvertToLanguageCode(static_cast<ApplicationLanguage>(application_language));
468 if (language_code == std::nullopt) {
469 LOG_ERROR(Service_NS, "Language not found! application_language={}", application_language);
470 return Service::NS::ResultApplicationLanguageNotFound;
471 }
472
473 *out_language_code = static_cast<u64>(*language_code);
474 return ResultSuccess;
475}
476
477NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} { 39NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} {
478 // clang-format off 40 // clang-format off
479 static const FunctionInfo functions[] = { 41 static const FunctionInfo functions[] = {
@@ -500,6 +62,31 @@ std::shared_ptr<IApplicationManagerInterface> NS::GetApplicationManagerInterface
500 return GetInterface<IApplicationManagerInterface>(system); 62 return GetInterface<IApplicationManagerInterface>(system);
501} 63}
502 64
65template <typename T, typename... Args>
66void NS::PushInterface(HLERequestContext& ctx) {
67 LOG_DEBUG(Service_NS, "called");
68
69 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
70 rb.Push(ResultSuccess);
71 rb.PushIpcInterface<T>(system);
72}
73
74void NS::PushIApplicationManagerInterface(HLERequestContext& ctx) {
75 LOG_DEBUG(Service_NS, "called");
76
77 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
78 rb.Push(ResultSuccess);
79 rb.PushIpcInterface<IApplicationManagerInterface>(system);
80}
81
82template <typename T, typename... Args>
83std::shared_ptr<T> NS::GetInterface(Args&&... args) const {
84 static_assert(std::is_base_of_v<SessionRequestHandler, T>,
85 "Not a base of ServiceFrameworkBase");
86
87 return std::make_shared<T>(std::forward<Args>(args)...);
88}
89
503void LoopProcess(Core::System& system) { 90void LoopProcess(Core::System& system) {
504 auto server_manager = std::make_unique<ServerManager>(system); 91 auto server_manager = std::make_unique<ServerManager>(system);
505 92
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h
index 39a6b6f21..ef5c575da 100644
--- a/src/core/hle/service/ns/ns.h
+++ b/src/core/hle/service/ns/ns.h
@@ -9,28 +9,9 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Service { 12namespace Service::NS {
13 13
14namespace FileSystem { 14class IApplicationManagerInterface;
15class FileSystemController;
16} // namespace FileSystem
17
18namespace NS {
19
20class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> {
21public:
22 explicit IApplicationManagerInterface(Core::System& system_);
23 ~IApplicationManagerInterface() override;
24
25 Result GetApplicationDesiredLanguage(u8* out_desired_language, u32 supported_languages);
26 Result ConvertApplicationLanguageToLanguageCode(u64* out_language_code,
27 u8 application_language);
28
29private:
30 void GetApplicationControlData(HLERequestContext& ctx);
31 void GetApplicationDesiredLanguage(HLERequestContext& ctx);
32 void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx);
33};
34 15
35class NS final : public ServiceFramework<NS> { 16class NS final : public ServiceFramework<NS> {
36public: 17public:
@@ -41,32 +22,14 @@ public:
41 22
42private: 23private:
43 template <typename T, typename... Args> 24 template <typename T, typename... Args>
44 void PushInterface(HLERequestContext& ctx) { 25 void PushInterface(HLERequestContext& ctx);
45 LOG_DEBUG(Service_NS, "called");
46
47 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
48 rb.Push(ResultSuccess);
49 rb.PushIpcInterface<T>(system);
50 }
51 26
52 void PushIApplicationManagerInterface(HLERequestContext& ctx) { 27 void PushIApplicationManagerInterface(HLERequestContext& ctx);
53 LOG_DEBUG(Service_NS, "called");
54
55 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
56 rb.Push(ResultSuccess);
57 rb.PushIpcInterface<IApplicationManagerInterface>(system);
58 }
59 28
60 template <typename T, typename... Args> 29 template <typename T, typename... Args>
61 std::shared_ptr<T> GetInterface(Args&&... args) const { 30 std::shared_ptr<T> GetInterface(Args&&... args) const;
62 static_assert(std::is_base_of_v<SessionRequestHandler, T>,
63 "Not a base of ServiceFrameworkBase");
64
65 return std::make_shared<T>(std::forward<Args>(args)...);
66 }
67}; 31};
68 32
69void LoopProcess(Core::System& system); 33void LoopProcess(Core::System& system);
70 34
71} // namespace NS 35} // namespace Service::NS
72} // namespace Service
diff --git a/src/core/hle/service/ns/ns_types.h b/src/core/hle/service/ns/ns_types.h
index 9b6b3aa2d..37ff078bd 100644
--- a/src/core/hle/service/ns/ns_types.h
+++ b/src/core/hle/service/ns/ns_types.h
@@ -4,6 +4,7 @@
4#pragma once 4#pragma once
5 5
6#include "common/common_funcs.h" 6#include "common/common_funcs.h"
7#include "common/uuid.h"
7#include "core/file_sys/romfs_factory.h" 8#include "core/file_sys/romfs_factory.h"
8 9
9namespace Service::NS { 10namespace Service::NS {
@@ -54,6 +55,14 @@ struct ApplicationView {
54 u8 unk_x45[0xb]; ///< Unknown. 55 u8 unk_x45[0xb]; ///< Unknown.
55}; 56};
56 57
58struct ApplicationRightsOnClient {
59 u64 application_id;
60 Common::UUID uid;
61 u8 flags;
62 u8 flags2;
63 INSERT_PADDING_BYTES(0x6);
64};
65
57/// NsPromotionInfo 66/// NsPromotionInfo
58struct PromotionInfo { 67struct PromotionInfo {
59 u64 start_timestamp; ///< POSIX timestamp for the promotion start. 68 u64 start_timestamp; ///< POSIX timestamp for the promotion start.
diff --git a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp
index 6b4751596..1587aed44 100644
--- a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp
+++ b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp
@@ -71,7 +71,7 @@ Result IReadOnlyApplicationControlDataInterface::GetApplicationControlData(
71} 71}
72 72
73Result IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage( 73Result IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage(
74 Out<u8> out_desired_language, u32 supported_languages) { 74 Out<ApplicationLanguage> out_desired_language, u32 supported_languages) {
75 LOG_INFO(Service_NS, "called with supported_languages={:08X}", supported_languages); 75 LOG_INFO(Service_NS, "called with supported_languages={:08X}", supported_languages);
76 76
77 // Get language code from settings 77 // Get language code from settings
@@ -97,7 +97,7 @@ Result IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage(
97 for (const auto lang : *priority_list) { 97 for (const auto lang : *priority_list) {
98 const auto supported_flag = GetSupportedLanguageFlag(lang); 98 const auto supported_flag = GetSupportedLanguageFlag(lang);
99 if (supported_languages == 0 || (supported_languages & supported_flag) == supported_flag) { 99 if (supported_languages == 0 || (supported_languages & supported_flag) == supported_flag) {
100 *out_desired_language = static_cast<u8>(lang); 100 *out_desired_language = lang;
101 R_SUCCEED(); 101 R_SUCCEED();
102 } 102 }
103 } 103 }
diff --git a/src/core/hle/service/ns/read_only_application_control_data_interface.h b/src/core/hle/service/ns/read_only_application_control_data_interface.h
index 7d470c432..ac099435a 100644
--- a/src/core/hle/service/ns/read_only_application_control_data_interface.h
+++ b/src/core/hle/service/ns/read_only_application_control_data_interface.h
@@ -16,12 +16,13 @@ public:
16 explicit IReadOnlyApplicationControlDataInterface(Core::System& system_); 16 explicit IReadOnlyApplicationControlDataInterface(Core::System& system_);
17 ~IReadOnlyApplicationControlDataInterface() override; 17 ~IReadOnlyApplicationControlDataInterface() override;
18 18
19private: 19public:
20 Result GetApplicationControlData(OutBuffer<BufferAttr_HipcMapAlias> out_buffer, 20 Result GetApplicationControlData(OutBuffer<BufferAttr_HipcMapAlias> out_buffer,
21 Out<u32> out_actual_size, 21 Out<u32> out_actual_size,
22 ApplicationControlSource application_control_source, 22 ApplicationControlSource application_control_source,
23 u64 application_id); 23 u64 application_id);
24 Result GetApplicationDesiredLanguage(Out<u8> out_desired_language, u32 supported_languages); 24 Result GetApplicationDesiredLanguage(Out<ApplicationLanguage> out_desired_language,
25 u32 supported_languages);
25 Result ConvertApplicationLanguageToLanguageCode(Out<u64> out_language_code, 26 Result ConvertApplicationLanguageToLanguageCode(Out<u64> out_language_code,
26 ApplicationLanguage application_language); 27 ApplicationLanguage application_language);
27}; 28};