libnx v4.9.0
Loading...
Searching...
No Matches
ns.h
Go to the documentation of this file.
1/**
2 * @file ns.h
3 * @brief NS services IPC wrapper.
4 * @author yellows8
5 * @copyright libnx Authors
6 */
7#pragma once
8#include "../types.h"
9#include "../nacp.h"
10#include "../sf/service.h"
11#include "../services/ncm_types.h"
12#include "../services/async.h"
13#include "../services/acc.h"
14#include "../services/fs.h"
15#include "../applets/error.h"
16#include "../kernel/event.h"
17#include "../kernel/tmem.h"
18
19/// ShellEvent
20typedef enum {
21 NsShellEvent_None = 0, ///< None
22 NsShellEvent_Exit = 1, ///< Exit
23 NsShellEvent_Start = 2, ///< Start
24 NsShellEvent_Crash = 3, ///< Crash
25 NsShellEvent_Debug = 4, ///< Debug
27
28/// ApplicationControlSource
29typedef enum {
30 NsApplicationControlSource_CacheOnly = 0, ///< Returns data from cache.
31 NsApplicationControlSource_Storage = 1, ///< Returns data from storage if not present in cache.
32 NsApplicationControlSource_StorageOnly = 2, ///< Returns data from storage without using cache.
34
35/// BackgroundNetworkUpdateState
36typedef enum {
37 NsBackgroundNetworkUpdateState_None = 0, ///< No sysupdate task exists.
38 NsBackgroundNetworkUpdateState_Downloading = 1, ///< Sysupdate download in progress.
39 NsBackgroundNetworkUpdateState_Ready = 2, ///< Sysupdate ready, pending install.
41
42/// LatestSystemUpdate
43typedef enum {
48
49/// RequestServerStopper
50typedef struct {
51 Service s; ///< IRequestServerStopper
53
54/// ProgressMonitorForDeleteUserSaveDataAll
55typedef struct {
56 Service s; ///< IProgressMonitorForDeleteUserSaveDataAll
58
59/// ProgressAsyncResult
60typedef struct {
61 Service s; ///< IProgressAsyncResult
62 Event event; ///< Event with autoclear=false.
64
65/// SystemUpdateControl
66typedef struct {
67 Service s; ///< ISystemUpdateControl
68 TransferMemory tmem; ///< TransferMemory for SetupCardUpdate/SetupCardUpdateViaSystemUpdater.
70
71/// ApplicationControlData
72typedef struct {
73 NacpStruct nacp; ///< \ref NacpStruct
74 u8 icon[0x20000]; ///< JPEG
76
77/// ApplicationOccupiedSize
78typedef struct {
79 u8 unk_x0[0x80]; ///< Unknown.
81
82/// NsApplicationContentMetaStatus
83typedef struct {
84 u8 meta_type; ///< \ref NcmContentMetaType
85 u8 storageID; ///< \ref NcmStorageId
86 u8 unk_x02; ///< Unknown.
87 u8 padding; ///< Padding.
88 u32 version; ///< Application version.
89 u64 application_id; ///< ApplicationId.
91
92/// ApplicationRecord
93typedef struct {
94 u64 application_id; ///< ApplicationId.
95 u8 type; ///< Type.
96 u8 unk_x09; ///< Unknown.
97 u8 unk_x0a[6]; ///< Unknown.
98 u8 unk_x10; ///< Unknown.
99 u8 unk_x11[7]; ///< Unknown.
101
102/// ProgressForDeleteUserSaveDataAll
103typedef struct {
104 u8 unk_x0[0x28]; ///< Unknown.
106
107/// ApplicationViewDeprecated. The below comments are for the \ref NsApplicationView to NsApplicationViewDeprecated conversion done by \ref nsGetApplicationViewDeprecated on newer system-versions.
108typedef struct {
109 u64 application_id; ///< Same as NsApplicationView::application_id.
110 u8 unk_x8[0x4]; ///< Same as NsApplicationView::unk_x8.
111 u32 flags; ///< Same as NsApplicationView::flags.
112 u8 unk_x10[0x10]; ///< Same as NsApplicationView::unk_x10.
113 u32 unk_x20; ///< Same as NsApplicationView::unk_x20.
114 u16 unk_x24; ///< Same as NsApplicationView::unk_x24.
115 u8 unk_x26[0x2]; ///< Cleared to zero.
116 u8 unk_x28[0x10]; ///< Same as NsApplicationView::unk_x30.
117 u32 unk_x38; ///< Same as NsApplicationView::unk_x40.
118 u8 unk_x3c; ///< Same as NsApplicationView::unk_x44.
119 u8 unk_x3d[3]; ///< Cleared to zero.
121
122/// ApplicationView
123typedef struct {
124 u64 application_id; ///< ApplicationId.
125 u8 unk_x8[0x4]; ///< Unknown.
126 u32 flags; ///< Flags.
127 u8 unk_x10[0x10]; ///< Unknown.
128 u32 unk_x20; ///< Unknown.
129 u16 unk_x24; ///< Unknown.
130 u8 unk_x26[0x2]; ///< Unknown.
131 u8 unk_x28[0x8]; ///< Unknown.
132 u8 unk_x30[0x10]; ///< Unknown.
133 u32 unk_x40; ///< Unknown.
134 u8 unk_x44; ///< Unknown.
135 u8 unk_x45[0xb]; ///< Unknown.
137
138/// NsPromotionInfo
139typedef struct {
140 u64 start_timestamp; ///< POSIX timestamp for the promotion start.
141 u64 end_timestamp; ///< POSIX timestamp for the promotion end.
142 s64 remaining_time; ///< Remaining time until the promotion ends, in nanoseconds ({end_timestamp - current_time} converted to nanoseconds).
143 u8 unk_x18[0x4]; ///< Not set, left at zero.
144 u8 flags; ///< Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear: remaining_time is set.
145 u8 pad[3]; ///< Padding.
147
148/// NsApplicationViewWithPromotionInfo
149typedef struct {
150 NsApplicationView view; ///< \ref NsApplicationView
151 NsPromotionInfo promotion; ///< \ref NsPromotionInfo
153
154/// LaunchProperties
155typedef struct {
156 u64 program_id; ///< program_id.
157 u32 version; ///< Program version.
158 u8 storageID; ///< \ref NcmStorageId
159 u8 index; ///< Index.
160 u8 is_application; ///< Whether this is an Application.
162
163/// ShellEventInfo
164typedef struct {
165 NsShellEvent event; ///< \ref NsShellEvent
166 u64 process_id; ///< processID.
168
169/// SystemUpdateProgress. Commands which have this as output will return 0 with the output cleared, when no task is available.
170typedef struct {
171 s64 current_size; ///< Current size. This value can be larger than total_size when the async operation is finishing. When total_size is <=0, this current_size field may contain a progress value for when the total_size is not yet determined.
172 s64 total_size; ///< Total size, this field is only valid when >0.
174
175/// ReceiveApplicationProgress. Same as \ref NsSystemUpdateProgress, except cmds which return this will return actual errors on failure, instead of returning 0 with a cleared struct.
177
178/// SendApplicationProgress. Same as \ref NsSystemUpdateProgress, except cmds which return this will return actual errors on failure, instead of returning 0 with a cleared struct.
180
181/// EulaDataPath
182typedef struct {
183 char path[0x100]; ///< Path.
185
186/// SystemDeliveryInfo
187typedef struct {
188 struct {
189 u32 system_delivery_protocol_version; ///< Must match a system-setting.
190 u32 application_delivery_protocol_version; ///< Loaded from a system-setting. Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
191 u32 includes_exfat; ///< Whether ExFat is included. Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
192 u32 system_update_meta_version; ///< SystemUpdate meta version.
193 u64 system_update_meta_id; ///< SystemUpdate meta Id.
194 u8 unk_x18; ///< Copied into state by \ref nssuRequestSendSystemUpdate.
195 u8 unk_x19; ///< Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
196 u8 unk_x1a; ///< Unknown.
197 u8 unk_x1b[0xc5]; ///< Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
198 } data; ///< Data used with the below hmac.
199 u8 hmac[0x20]; ///< HMAC-SHA256 over the above data.
201
202/// ApplicationDeliveryInfo
203typedef struct {
204 struct {
205 u8 unk_x0[0x10]; ///< Unknown.
206 u32 application_version; ///< Application version.
207 u32 unk_x14; ///< Unknown.
208 u32 required_system_version; ///< Required system version, see NsSystemDeliveryInfo::system_update_meta_version.
209 u32 unk_x1c; ///< Unknown.
210 u8 unk_x20[0xc0]; ///< Unknown.
211 } data; ///< Data used with the below hmac.
212 u8 hmac[0x20]; ///< HMAC-SHA256 over the above data.
214
215/// NsApplicationRightsOnClient
216typedef struct {
217 u64 application_id; ///< ApplicationId.
218 AccountUid uid; ///< \ref AccountUid
219 u8 flags_x18; ///< qlaunch uses bit0-bit4 and bit7 from here.
220 u8 flags_x19; ///< qlaunch uses bit0 from here.
221 u8 unk_x1a[0x6]; ///< Unknown.
223
224/// DownloadTaskStatus
225typedef struct {
226 u8 unk_x0[0x20]; ///< Unknown.
228
229/// Default size for \ref nssuControlSetupCardUpdate / \ref nssuControlSetupCardUpdateViaSystemUpdater. This is the size used by qlaunch for SetupCardUpdate.
230#define NSSU_CARDUPDATE_TMEM_SIZE_DEFAULT 0x100000
231
232///@name ns
233///@{
234
235/// Initialize ns services. Uses ns:am on pre-3.0.0, ns:am2 on [3.0.0+].
237
238/// Exit ns services.
239void nsExit(void);
240
241/// Gets the Service object for the actual ns:* service session. Only initialized on [3.0.0+], on pre-3.0.0 see \ref nsGetServiceSession_ApplicationManagerInterface.
243
244/// Gets the Service object for IApplicationManagerInterface. Only initialized on pre-3.0.0, on [3.0.0+] use \ref nsGetApplicationManagerInterface.
246
247/// Gets the Service object for IDynamicRightsInterface via the cmd for that.
248/// Only available on [6.0.0+].
250
251/// Gets the Service object for IReadOnlyApplicationControlDataInterface via the cmd for that.
252/// Only available on [5.1.0+].
254
255/// Gets the Service object for IReadOnlyApplicationRecordInterface via the cmd for that.
256/// Only available on [5.0.0+].
258
259/// Gets the Service object for IECommerceInterface via the cmd for that.
260/// Only available on [4.0.0+].
262
263/// Gets the Service object for IApplicationVersionInterface via the cmd for that.
264/// Only available on [4.0.0+].
266
267/// Gets the Service object for IFactoryResetInterface via the cmd for that.
268/// Only available on [3.0.0+].
270
271/// Gets the Service object for IAccountProxyInterface via the cmd for that.
272/// Only available on [3.0.0+].
274
275/// Gets the Service object for IApplicationManagerInterface via the cmd for that.
276/// Only available on [3.0.0+], on prior sysvers use \ref nsGetServiceSession_ApplicationManagerInterface.
278
279/// Gets the Service object for IDownloadTaskInterface via the cmd for that.
280/// Only available on [3.0.0+].
282
283/// Gets the Service object for IContentManagementInterface via the cmd for that.
284/// Only available on [3.0.0+].
286
287/// Gets the Service object for IDocumentInterface via the cmd for that.
288/// Only available on [3.0.0+].
290
291///@}
292
293///@name IReadOnlyApplicationControlDataInterface
294///@{
295
296/**
297 * @brief Gets the \ref NsApplicationControlData for the specified application.
298 * @note Uses \ref nsGetReadOnlyApplicationControlDataInterface on [5.1.0+], otherwise IApplicationManagerInterface is used.
299 * @param[in] source Source, official sw uses ::NsApplicationControlSource_Storage.
300 * @param[in] application_id ApplicationId.
301 * @param[out] buffer \ref NsApplicationControlData
302 * @param[in] size Size of the buffer.
303 * @param[out] actual_size Actual output size.
304 */
305Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size);
306
307/**
308 * @brief GetApplicationDesiredLanguage. Selects a \ref NacpLanguageEntry to use from the specified \ref NacpStruct.
309 * @note Uses \ref nsGetReadOnlyApplicationControlDataInterface on [5.1.0+], otherwise IApplicationManagerInterface is used.
310 * @param[in] nacp \ref NacpStruct
311 * @param[out] langentry \ref NacpLanguageEntry
312 */
314
315///@}
316
317///@name IECommerceInterface
318///@{
319
320/**
321 * @brief RequestLinkDevice
322 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
323 * @note Only available on [4.0.0+].
324 * @param[out] a \ref AsyncResult
325 * @param[in] uid \ref AccountUid
326 */
328
329/**
330 * @brief RequestSyncRights
331 * @note Only available on [6.0.0+].
332 * @param[out] a \ref AsyncResult
333 */
335
336/**
337 * @brief RequestUnlinkDevice
338 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
339 * @note Only available on [6.0.0+].
340 * @param[out] a \ref AsyncResult
341 * @param[in] uid \ref AccountUid
342 */
344
345///@}
346
347///@name IFactoryResetInterface
348///@{
349
350/**
351 * @brief ResetToFactorySettings
352 * @note Uses \ref nsGetFactoryResetInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
353 */
355
356/**
357 * @brief ResetToFactorySettingsWithoutUserSaveData
358 * @note Uses \ref nsGetFactoryResetInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
359 */
361
362/**
363 * @brief ResetToFactorySettingsForRefurbishment
364 * @note Uses \ref nsGetFactoryResetInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
365 * @note Only available on [2.0.0+].
366 */
368
369/**
370 * @brief ResetToFactorySettingsWithPlatformRegion
371 * @note Only available on [9.1.0+].
372 */
374
375/**
376 * @brief ResetToFactorySettingsWithPlatformRegionAuthentication
377 * @note Only available on [9.1.0+].
378 */
380
381///@}
382
383///@name IApplicationManagerInterface
384///@{
385
386/**
387 * @brief Gets an listing of \ref NsApplicationRecord.
388 * @param[out] records Output array of \ref NsApplicationRecord.
389 * @param[in] count Size of the records array in entries.
390 * @param[in] entry_offset Starting entry offset.
391 * @param[out] out_entrycount Total output entries.
392 */
393Result nsListApplicationRecord(NsApplicationRecord* records, s32 count, s32 entry_offset, s32* out_entrycount);
394
395/**
396 * @brief GetApplicationRecordUpdateSystemEvent
397 * @note The Event must be closed by the user once finished with it.
398 * @param[out] out_event Output Event with autoclear=true.
399 */
401
402/**
403 * @brief GetApplicationViewDeprecated
404 * @note On [3.0.0+] you should generally use \ref nsGetApplicationView instead.
405 * @param[out] out Output array of \ref NsApplicationViewDeprecated.
406 * @param[in] application_ids Input array of ApplicationIds.
407 * @param[in] count Size of the input/output arrays in entries.
408 */
410
411/**
412 * @brief DeleteApplicationEntity
413 * @param[in] application_id ApplicationId.
414 */
416
417/**
418 * @brief DeleteApplicationCompletely
419 * @param[in] application_id ApplicationId.
420 */
422
423/**
424 * @brief DeleteRedundantApplicationEntity
425 */
427
428/**
429 * @brief IsApplicationEntityMovable
430 * @param[in] application_id ApplicationId.
431 * @param[in] storage_id \ref NcmStorageId
432 * @param[out] out Output flag.
433 */
434Result nsIsApplicationEntityMovable(u64 application_id, NcmStorageId storage_id, bool *out);
435
436/**
437 * @brief MoveApplicationEntity
438 * @note Only available on [1.0.0-9.2.0].
439 * @param[in] application_id ApplicationId.
440 * @param[in] storage_id \ref NcmStorageId
441 */
442Result nsMoveApplicationEntity(u64 application_id, NcmStorageId storage_id);
443
444/**
445 * @brief RequestApplicationUpdateInfo
446 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
447 * @param[out] a \ref AsyncValue. The data that can be read from this is u8 ApplicationUpdateInfo. qlaunch just checks whether this is 0.
448 * @param application_id ApplicationId.
449 */
451
452/**
453 * @brief CancelApplicationDownload
454 * @param[in] application_id ApplicationId.
455 */
457
458/**
459 * @brief ResumeApplicationDownload
460 * @param[in] application_id ApplicationId.
461 */
463
464/**
465 * @brief CheckApplicationLaunchVersion
466 * @param[in] application_id ApplicationId.
467 */
469
470/**
471 * @brief CalculateApplicationApplyDeltaRequiredSize
472 * @param[in] application_id ApplicationId.
473 * @param[out] storage_id Output \ref NcmStorageId.
474 * @param[out] size Output size.
475 */
477
478/**
479 * @brief CleanupSdCard
480 */
482
483/**
484 * @brief GetSdCardMountStatusChangedEvent
485 * @note The Event must be closed by the user once finished with it.
486 * @param[out] out_event Output Event with autoclear=false.
487 */
489
490/**
491 * @brief GetGameCardUpdateDetectionEvent
492 * @note The Event must be closed by the user once finished with it.
493 * @param[out] out_event Output Event with autoclear=false.
494 */
496
497/**
498 * @brief DisableApplicationAutoDelete
499 * @param[in] application_id ApplicationId.
500 */
502
503/**
504 * @brief EnableApplicationAutoDelete
505 * @param[in] application_id ApplicationId.
506 */
508
509/**
510 * @brief SetApplicationTerminateResult
511 * @param[in] application_id ApplicationId.
512 * @param[in] res Result.
513 */
515
516/**
517 * @brief ClearApplicationTerminateResult
518 * @param[in] application_id ApplicationId.
519 */
521
522/**
523 * @brief GetLastSdCardMountUnexpectedResult
524 */
526
527/**
528 * @brief Opens a \ref NsRequestServerStopper.
529 * @note Only available on [2.0.0+].
530 * @param[out] r \ref NsRequestServerStopper
531 */
533
534/**
535 * @brief CancelApplicationApplyDelta
536 * @note Only available on [3.0.0+].
537 * @param[in] application_id ApplicationId.
538 */
540
541/**
542 * @brief ResumeApplicationApplyDelta
543 * @note Only available on [3.0.0+].
544 * @param[in] application_id ApplicationId.
545 */
547
548/**
549 * @brief CalculateApplicationApplyDeltaRequiredSize
550 * @note Only available on [3.0.0+].
551 * @param[in] application_id ApplicationId.
552 * @param[out] storage_id Output \ref NcmStorageId.
553 * @param[out] size Output size.
554 */
556
557/**
558 * @brief ResumeAll
559 * @note Only available on [3.0.0+].
560 */
562
563/**
564 * @brief Temporarily mounts the specified fs ContentStorage, then uses fs GetTotalSpaceSize/GetFreeSpaceSize with that mounted ContentStorage.
565 * @note Only available on [3.0.0+].
566 * @param[in] storage_id \ref NcmStorageId, must be ::NcmStorageId_BuiltInUser or ::NcmStorageId_SdCard.
567 * @param[out] total_space_size Output from GetTotalSpaceSize.
568 * @param[out] free_space_size Output from GetFreeSpaceSize.
569 */
570Result nsGetStorageSize(NcmStorageId storage_id, s64 *total_space_size, s64 *free_space_size);
571
572/**
573 * @brief RequestUpdateApplication2
574 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
575 * @note Only available on [4.0.0+].
576 * @param[out] a \ref AsyncResult
577 * @param[in] application_id ApplicationId.
578 */
580
581/**
582 * @brief DeleteUserSaveDataAll
583 * @param[in] p \ref NsProgressMonitorForDeleteUserSaveDataAll
584 * @param[in] uid \ref AccountUid
585 */
587
588/**
589 * @brief DeleteUserSystemSaveData
590 * @param[in] uid \ref AccountUid
591 * @param[in] system_save_data_id SystemSaveDataId
592 */
594
595/**
596 * @brief DeleteSaveData
597 * @note Only available on [6.0.0+].
598 * @param[in] save_data_space_id \ref FsSaveDataSpaceId
599 * @param[in] save_data_id SaveDataId
600 */
601Result nsDeleteSaveData(FsSaveDataSpaceId save_data_space_id, u64 save_data_id);
602
603/**
604 * @brief UnregisterNetworkServiceAccount
605 * @param[in] uid \ref AccountUid
606 */
608
609/**
610 * @brief UnregisterNetworkServiceAccountWithUserSaveDataDeletion
611 * @note Only available on [6.0.0+].
612 * @param[in] uid \ref AccountUid
613 */
615
616/**
617 * @brief RequestDownloadApplicationControlData
618 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
619 * @param[out] a \ref AsyncResult
620 * @param[in] application_id ApplicationId.
621 */
623
624/**
625 * @brief ListApplicationTitle
626 * @note The data available with \ref asyncValueGet is a s32 for the offset within the buffer where the output data is located, \ref asyncValueGetSize returns the total byte-size of the data located here. The data located here is the \ref NacpLanguageEntry for each specified ApplicationId.
627 * @note Only available on [8.0.0+].
628 * @param[out] a \ref AsyncValue
629 * @param[in] source Source, qlaunch uses ::NsApplicationControlSource_Storage.
630 * @param[in] application_ids Input array of ApplicationIds.
631 * @param[in] count Size of the application_ids array in entries.
632 * @param buffer 0x1000-byte aligned buffer for TransferMemory. This buffer must not be accessed until the async operation finishes.
633 * @param[in] size 0x1000-byte aligned buffer size for TransferMemory. This must be at least: count*sizeof(\ref NacpLanguageEntry) + count*sizeof(u64) + count*sizeof(\ref NsApplicationControlData).
634 */
635Result nsListApplicationTitle(AsyncValue *a, NsApplicationControlSource source, const u64 *application_ids, s32 count, void* buffer, size_t size);
636
637/**
638 * @brief ListApplicationIcon
639 * @note The data available with \ref asyncValueGet is a s32 for the offset within the buffer where the output data is located, \ref asyncValueGetSize returns the total byte-size of the data located here. This data is: an u64 for total entries, an array of u64s for each icon size, then the icon JPEGs for the specified ApplicationIds.
640 * @note Only available on [8.0.0+].
641 * @param[out] a \ref AsyncValue
642 * @param[in] source Source.
643 * @param[in] application_ids Input array of ApplicationIds.
644 * @param[in] count Size of the application_ids array in entries.
645 * @param buffer 0x1000-byte aligned buffer for TransferMemory. This buffer must not be accessed until the async operation finishes.
646 * @param[in] size 0x1000-byte aligned buffer size for TransferMemory. This must be at least: 0x4 + count*sizeof(u64) + count*sizeof(\ref NsApplicationControlData::icon) + count*sizeof(u64) + sizeof(\ref NsApplicationControlData).
647 */
648Result nsListApplicationIcon(AsyncValue *a, NsApplicationControlSource source, const u64 *application_ids, s32 count, void* buffer, size_t size);
649
650/**
651 * @brief RequestCheckGameCardRegistration
652 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
653 * @note Only available on [2.0.0+].
654 * @param[out] a \ref AsyncResult
655 * @param[in] application_id ApplicationId.
656 */
658
659/**
660 * @brief RequestGameCardRegistrationGoldPoint
661 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
662 * @note Only available on [2.0.0+].
663 * @param[out] a \ref AsyncValue. The data that can be read from this is 4-bytes.
664 * @param[in] uid \ref AccountUid
665 * @param[in] application_id ApplicationId.
666 */
668
669/**
670 * @brief RequestRegisterGameCard
671 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
672 * @note Only available on [2.0.0+].
673 * @param[out] a \ref AsyncResult
674 * @param[in] uid \ref AccountUid
675 * @param[in] application_id ApplicationId.
676 * @param[in] inval Input value.
677 */
679
680/**
681 * @brief GetGameCardMountFailureEvent
682 * @note The Event must be closed by the user once finished with it.
683 * @note Only available on [3.0.0+].
684 * @param[out] out_event Output Event with autoclear=false.
685 */
687
688/**
689 * @brief IsGameCardInserted
690 * @note Only available on [3.0.0+].
691 * @param[out] out Output flag.
692 */
694
695/**
696 * @brief EnsureGameCardAccess
697 * @note Only available on [3.0.0+].
698 */
700
701/**
702 * @brief GetLastGameCardMountFailureResult
703 * @note Only available on [3.0.0+].
704 */
706
707/**
708 * @brief ListApplicationIdOnGameCard
709 * @note Only available on [5.0.0+].
710 * @param[out] application_ids Output array of ApplicationIds.
711 * @param[in] count Size of the application_ids array in entries.
712 * @param[out] total_out Total output entries.
713 */
714Result nsListApplicationIdOnGameCard(u64 *application_ids, s32 count, s32 *total_out);
715
716/**
717 * @brief TouchApplication
718 * @note Only available on [2.0.0+].
719 * @param[in] application_id ApplicationId.
720 */
722
723/**
724 * @brief IsApplicationUpdateRequested
725 * @note Only available on [2.0.0+].
726 * @param[in] application_id ApplicationId.
727 * @param[out] flag Output flag, indicating whether out is valid.
728 * @param[out] out Output value.
729 */
730Result nsIsApplicationUpdateRequested(u64 application_id, bool *flag, u32 *out);
731
732/**
733 * @brief WithdrawApplicationUpdateRequest
734 * @note Only available on [2.0.0+].
735 * @param[in] application_id ApplicationId.
736 */
738
739/**
740 * @brief RequestVerifyAddOnContentsRights
741 * @note Only available on [3.0.0-9.2.0].
742 * @param[out] a \ref NsProgressAsyncResult
743 * @param[in] application_id ApplicationId.
744 */
746
747/**
748 * @brief RequestVerifyApplication
749 * @note On pre-5.0.0 this uses cmd RequestVerifyApplicationDeprecated, otherwise cmd RequestVerifyApplication is used.
750 * @param[out] a \ref NsProgressAsyncResult. The data available with \ref nsProgressAsyncResultGetProgress is basically the same as \ref NsSystemUpdateProgress.
751 * @param[in] application_id ApplicationId.
752 * @param[in] unk Unknown. A default value of 0x7 can be used (which is what qlaunch uses). Only used on [5.0.0+].
753 * @param buffer 0x1000-byte aligned buffer for TransferMemory. This buffer must not be accessed until the async operation finishes.
754 * @param[in] size 0x1000-byte aligned buffer size for TransferMemory. qlaunch uses size 0x100000.
755 */
756Result nsRequestVerifyApplication(NsProgressAsyncResult *a, u64 application_id, u32 unk, void* buffer, size_t size);
757
758/**
759 * @brief IsAnyApplicationEntityInstalled
760 * @note Only available on [2.0.0+].
761 * @param[in] application_id ApplicationId.
762 * @param[out] out Output flag.
763 */
765
766/**
767 * @brief CleanupUnavailableAddOnContents
768 * @note Only available on [6.0.0+].
769 * @param[in] application_id ApplicationId.
770 * @param[in] uid \ref AccountUid
771 */
773
774/**
775 * @brief EstimateSizeToMove
776 * @note Only available on [10.0.0+].
777 * @param[in] storage_ids Array of u8 \ref NcmStorageId.
778 * @param[in] count Size of the storage_ids array in entries.
779 * @param[in] storage_id storage_id \ref NcmStorageId
780 * @param[in] flags Flags
781 * @param[in] application_id ApplicationId.
782 * @param[out] Out Output value.
783 */
784Result nsEstimateSizeToMove(u8 *storage_ids, s32 count, NcmStorageId storage_id, u32 flags, u64 application_id, s64 *out);
785
786/**
787 * @brief FormatSdCard
788 * @note Only available on [2.0.0+].
789 */
791
792/**
793 * @brief NeedsSystemUpdateToFormatSdCard
794 * @note Only available on [2.0.0+].
795 * @param[out] out Output flag.
796 */
798
799/**
800 * @brief GetLastSdCardFormatUnexpectedResult
801 * @note Only available on [2.0.0+].
802 */
804
805/**
806 * @brief GetApplicationView
807 * @note Only available on [3.0.0+], on prior system-versions use \ref nsGetApplicationViewDeprecated instead.
808 * @param[out] out Output array of \ref NsApplicationView.
809 * @param[in] application_ids Input array of ApplicationIds.
810 * @param[in] count Size of the input/output arrays in entries.
811 */
812Result nsGetApplicationView(NsApplicationView *views, const u64 *application_ids, s32 count);
813
814/**
815 * @brief GetApplicationViewDownloadErrorContext
816 * @note Only available on [4.0.0+].
817 * @param[in] application_id ApplicationId
818 * @param[out] context \ref ErrorContext
819 */
821
822/**
823 * @brief GetApplicationViewWithPromotionInfo
824 * @note Only available on [8.0.0+].
825 * @param[out] out Output array of \ref NsApplicationViewWithPromotionInfo.
826 * @param[in] application_ids Input array of ApplicationIds.
827 * @param[in] count Size of the input/output arrays in entries.
828 */
830
831/**
832 * @brief RequestDownloadApplicationPrepurchasedRights
833 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
834 * @note Only available on [4.0.0+].
835 * @param[out] a \ref AsyncResult
836 * @param[in] application_id ApplicationId.
837 */
839
840/**
841 * @brief Generates a \ref NsSystemDeliveryInfo using the currently installed SystemUpdate meta.
842 * @note Only available on [4.0.0+].
843 * @param[out] info \ref NsSystemDeliveryInfo
844 */
846
847/**
848 * @brief SelectLatestSystemDeliveryInfo
849 * @note This selects the \ref NsSystemDeliveryInfo with the latest version from sys_list, using minimum versions determined from app_list/state and base_info. This also does various validation, etc.
850 * @note Only available on [4.0.0+].
851 * @param[in] sys_list Input array of \ref NsSystemDeliveryInfo.
852 * @param[in] sys_count Size of the sys_list array in entries.
853 * @param[in] base_info \ref NsSystemDeliveryInfo
854 * @param[in] app_list Input array of \ref NsApplicationDeliveryInfo. This can be NULL.
855 * @param[in] app_count Size of the app_list array in entries. This can be 0.
856 * @param[out] index Output index for the selected entry in sys_list, -1 if none found.
857 */
858Result nsSelectLatestSystemDeliveryInfo(const NsSystemDeliveryInfo *sys_list, s32 sys_count, const NsSystemDeliveryInfo *base_info, const NsApplicationDeliveryInfo *app_list, s32 app_count, s32 *index);
859
860/**
861 * @brief VerifyDeliveryProtocolVersion
862 * @note Only available on [4.0.0+].
863 * @param[in] info \ref NsSystemDeliveryInfo
864 */
866
867/**
868 * @brief Generates \ref NsApplicationDeliveryInfo for the specified ApplicationId.
869 * @note Only available on [4.0.0+].
870 * @param[out] info Output array of \ref NsApplicationDeliveryInfo.
871 * @param[in] count Size of the array in entries.
872 * @param[in] application_id ApplicationId
873 * @param[in] attr ApplicationDeliveryAttributeTag bitmask.
874 * @param[out] total_out Total output entries.
875 */
876Result nsGetApplicationDeliveryInfo(NsApplicationDeliveryInfo *info, s32 count, u64 application_id, u32 attr, s32 *total_out);
877
878/**
879 * @brief HasAllContentsToDeliver
880 * @note Only available on [4.0.0+].
881 * @param[in] info Input array of \ref NsApplicationDeliveryInfo.
882 * @param[in] count Size of the array in entries. Must be value 1.
883 * @param[out] out Output flag.
884 */
886
887/**
888 * @brief Both \ref NsApplicationDeliveryInfo are validated, then the application_version in the first/second \ref NsApplicationDeliveryInfo are compared.
889 * @note Only available on [4.0.0+].
890 * @param[in] info0 First input array of \ref NsApplicationDeliveryInfo.
891 * @param[in] count0 Size of the info0 array in entries. Must be value 1.
892 * @param[in] info1 Second input array of \ref NsApplicationDeliveryInfo.
893 * @param[in] count1 Size of the info1 array in entries. Must be value 1.
894 * @param[out] out Comparison result: -1 for less than, 0 for equal, and 1 for higher than.
895 */
897
898/**
899 * @brief CanDeliverApplication
900 * @note Only available on [4.0.0+].
901 * @param[in] info0 First input array of \ref NsApplicationDeliveryInfo.
902 * @param[in] count0 Size of the info0 array in entries. Must be value <=1, when 0 this will return 0 with out set to 0.
903 * @param[in] info1 Second input array of \ref NsApplicationDeliveryInfo.
904 * @param[in] count1 Size of the info1 array in entries. Must be value 1.
905 * @param[out] out Output flag.
906 */
907Result nsCanDeliverApplication(const NsApplicationDeliveryInfo *info0, s32 count0, const NsApplicationDeliveryInfo *info1, s32 count1, bool *out);
908
909/**
910 * @brief ListContentMetaKeyToDeliverApplication
911 * @note Only available on [4.0.0+].
912 * @param[out] meta Output array of \ref NcmContentMetaKey.
913 * @param[in] meta_count Size of the meta array in entries. Must be at least 1, only 1 entry will be returned.
914 * @param[in] meta_index Meta entry index. An output \ref NcmContentMetaKey will not be returned when this value is larger than 0.
915 * @param[in] info Input array of \ref NsApplicationDeliveryInfo.
916 * @param[in] info_count Size of the info array in entries. Must be value 1.
917 * @param[out] total_out Total output entries.
918 */
919Result nsListContentMetaKeyToDeliverApplication(NcmContentMetaKey *meta, s32 meta_count, s32 meta_index, const NsApplicationDeliveryInfo *info, s32 info_count, s32 *total_out);
920
921/**
922 * @brief After validation etc, this sets the output bool by comparing system-version fields in the \ref NsSystemDeliveryInfo / info-array and with a state field.
923 * @note Only available on [4.0.0+].
924 * @param[in] info Input array of \ref NsApplicationDeliveryInfo.
925 * @param[in] count Size of the info array in entries. Must be value 1.
926 * @param[in] sys_info \ref NsSystemDeliveryInfo
927 * @param[out] out Output flag.
928 */
930
931/**
932 * @brief EstimateRequiredSize
933 * @note Only available on [4.0.0+].
934 * @param[in] meta Input array of \ref NcmContentMetaKey.
935 * @param[in] count Size of the meta array in entries. When less than 1, this will return 0 with out set to 0.
936 * @param[out] out Output size.
937 */
939
940/**
941 * @brief RequestReceiveApplication
942 * @note This is the Application version of \ref nssuControlRequestReceiveSystemUpdate, see the notes for that.
943 * @note Only available on [4.0.0+].
944 * @param[out] a \ref AsyncResult
945 * @param[in] addr Server IPv4 address.
946 * @param[in] port Socket port. qlaunch uses value 55556.
947 * @param[in] application_id ApplicationId
948 * @param[in] meta Input array of \ref NcmContentMetaKey. The ::NcmContentMetaType must match ::NcmContentMetaType_Patch.
949 * @param[in] count Size of the meta array in entries.
950 * @param[in] storage_id \ref NcmStorageId. qlaunch uses ::NcmStorageId_Any.
951 */
952Result nsRequestReceiveApplication(AsyncResult *a, u32 addr, u16 port, u64 application_id, const NcmContentMetaKey *meta, s32 count, NcmStorageId storage_id);
953
954/**
955 * @brief CommitReceiveApplication
956 * @note Only available on [4.0.0+].
957 * @param[in] application_id ApplicationId
958 */
960
961/**
962 * @brief GetReceiveApplicationProgress
963 * @note Only available on [4.0.0+].
964 * @param[in] application_id ApplicationId
965 * @param[out] out \ref NsReceiveApplicationProgress
966 */
968
969/**
970 * @brief RequestSendApplication
971 * @note This is the Application version of \ref nssuRequestSendSystemUpdate, see the notes for that.
972 * @note Only available on [4.0.0+].
973 * @param[out] a \ref AsyncResult
974 * @param[in] addr Client IPv4 address.
975 * @param[in] port Socket port. qlaunch uses value 55556.
976 * @param[in] application_id ApplicationId
977 * @param[in] meta Input array of \ref NcmContentMetaKey. The ::NcmContentMetaType must match ::NcmContentMetaType_Patch.
978 * @param[in] count Size of the meta array in entries.
979 */
980Result nsRequestSendApplication(AsyncResult *a, u32 addr, u16 port, u64 application_id, const NcmContentMetaKey *meta, s32 count);
981
982/**
983 * @brief GetSendApplicationProgress
984 * @note Only available on [4.0.0+].
985 * @param[in] application_id ApplicationId
986 * @param[out] out \ref NsSendApplicationProgress
987 */
989
990/**
991 * @brief Both \ref NsSystemDeliveryInfo are validated, then the system_update_meta_version in the first/second \ref NsSystemDeliveryInfo are compared.
992 * @note Only available on [4.0.0+].
993 * @param[in] info0 First \ref NsSystemDeliveryInfo.
994 * @param[in] info1 Second \ref NsSystemDeliveryInfo.
995 * @param[out] out Comparison result: -1 for less than, 0 for equal, and 1 for higher than.
996 */
998
999/**
1000 * @brief ListNotCommittedContentMeta
1001 * @note Only available on [4.0.0+].
1002 * @param[out] meta Output array of \ref NcmContentMetaKey.
1003 * @param[in] count Size of the meta array in entries.
1004 * @param[in] application_id ApplicationId
1005 * @param[in] unk Unknown.
1006 * @param[out] total_out Total output entries.
1007 */
1008Result nsListNotCommittedContentMeta(NcmContentMetaKey *meta, s32 count, u64 application_id, s32 unk, s32 *total_out);
1009
1010/**
1011 * @brief This extracts data from the input array for hashing with SHA256, with validation being done when handling each entry.
1012 * @note Only available on [5.0.0+].
1013 * @param[in] info Input array of \ref NsApplicationDeliveryInfo.
1014 * @param[in] count Size of the array in entries.
1015 * @param[out] out_hash Output 0x20-byte SHA256 hash.
1016 */
1018
1019/**
1020 * @brief GetApplicationTerminateResult
1021 * @note Only available on [6.0.0+].
1022 * @param[in] application_id ApplicationId.
1023 * @param[out] res Output Result.
1024 */
1026
1027/**
1028 * @brief GetApplicationRightsOnClient
1029 * @note Only available on [6.0.0+].
1030 * @param[out] rights Output array of \ref NsApplicationRightsOnClient.
1031 * @param[in] count Size of the rights array in entries. qlaunch uses value 3 for this.
1032 * @param[in] application_id ApplicationId
1033 * @param[in] uid \ref AccountUid, can optionally be all-zero.
1034 * @param[in] flags Flags. Official sw hard-codes this to value 0x3.
1035 * @param[out] total_out Total output entries.
1036 */
1037Result nsGetApplicationRightsOnClient(NsApplicationRightsOnClient *rights, s32 count, u64 application_id, AccountUid uid, u32 flags, s32 *total_out);
1038
1039/**
1040 * @brief RequestNoDownloadRightsErrorResolution
1041 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
1042 * @note Only available on [9.0.0+].
1043 * @param[out] a \ref AsyncValue. The data that can be read from this is u8 NoDownloadRightsErrorResolution.
1044 * @param application_id ApplicationId.
1045 */
1047
1048/**
1049 * @brief RequestResolveNoDownloadRightsError
1050 * @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
1051 * @note Only available on [9.0.0+].
1052 * @param[out] a \ref AsyncValue. The data that can be read from this is u8 NoDownloadRightsErrorResolution.
1053 * @param application_id ApplicationId.
1054 */
1056
1057/**
1058 * @brief GetPromotionInfo
1059 * @note Only available on [8.0.0+].
1060 * @param[out] promotion \ref NsPromotionInfo
1061 * @param application_id ApplicationId.
1062 * @param[in] uid \ref AccountUid
1063 */
1064Result nsGetPromotionInfo(NsPromotionInfo *promotion, u64 application_id, AccountUid uid);
1065
1066///@}
1067
1068///@name IDownloadTaskInterface
1069///@{
1070
1071/**
1072 * @brief ClearTaskStatusList
1073 * @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1074 * @note Only available on [2.0.0+].
1075 */
1077
1078/**
1079 * @brief RequestDownloadTaskList
1080 * @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1081 * @note Only available on [2.0.0+].
1082 */
1084
1085/**
1086 * @brief RequestEnsureDownloadTask
1087 * @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1088 * @note Only available on [2.0.0+].
1089 * @param[out] a \ref AsyncResult
1090 */
1092
1093/**
1094 * @brief ListDownloadTaskStatus
1095 * @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1096 * @note Only available on [2.0.0+].
1097 * @param[out] tasks Output array of \ref NsDownloadTaskStatus.
1098 * @param[in] count Size of the tasks array in entries. A maximum of 0x100 tasks can be stored in state.
1099 * @param[out] total_out Total output entries.
1100 */
1102
1103/**
1104 * @brief RequestDownloadTaskListData
1105 * @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1106 * @note Only available on [2.0.0+].
1107 * @param[out] a \ref AsyncValue
1108 */
1110
1111/**
1112 * @brief TryCommitCurrentApplicationDownloadTask
1113 * @note Only available on [4.0.0+].
1114 */
1116
1117/**
1118 * @brief EnableAutoCommit
1119 * @note Only available on [4.0.0+].
1120 */
1122
1123/**
1124 * @brief DisableAutoCommit
1125 * @note Only available on [4.0.0+].
1126 */
1128
1129/**
1130 * @brief TriggerDynamicCommitEvent
1131 * @note Only available on [4.0.0+].
1132 */
1134
1135///@}
1136
1137///@name IContentManagementInterface
1138///@{
1139
1140/**
1141 * @brief CalculateApplicationOccupiedSize
1142 * @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1143 * @param[in] application_id ApplicationId.
1144 * @param[out] out \ref NsApplicationOccupiedSize
1145 */
1147
1148/**
1149 * @brief CheckSdCardMountStatus
1150 * @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1151 */
1153
1154/**
1155 * @brief Returns the total storage capacity (used + free) from content manager services.
1156 * @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1157 * @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
1158 * @param[out] size Pointer to output the total storage size to.
1159 */
1161
1162/**
1163 * @brief Returns the available storage capacity from content manager services.
1164 * @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1165 * @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
1166 * @param[out] size Pointer to output the free storage size to.
1167 */
1169
1170/**
1171 * @brief CountApplicationContentMeta
1172 * @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1173 * @note Only available on [2.0.0+].
1174 * @param[in] application_id ApplicationId.
1175 * @param[out] out Output count.
1176 */
1178
1179/**
1180 * @brief Gets an listing of \ref NsApplicationContentMetaStatus.
1181 * @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
1182 * @note Only available on [2.0.0+].
1183 * @param[in] application_id ApplicationId.
1184 * @param[in] index Starting entry index.
1185 * @param[out] list Output array of \ref NsApplicationContentMetaStatus.
1186 * @param[in] count Size of the list array in entries.
1187 * @param[out] out_entrycount Total output entries.
1188 */
1189Result nsListApplicationContentMetaStatus(u64 application_id, s32 index, NsApplicationContentMetaStatus* list, s32 count, s32* out_entrycount);
1190
1191/**
1192 * @brief IsAnyApplicationRunning
1193 * @note Only available on [3.0.0+].
1194 * @param[out] out Output flag.
1195 */
1197
1198///@}
1199
1200///@name IRequestServerStopper
1201///@{
1202
1203/**
1204 * @brief Close a \ref NsRequestServerStopper.
1205 * @param r \ref NsRequestServerStopper
1206 */
1208
1209///@}
1210
1211///@name IProgressMonitorForDeleteUserSaveDataAll
1212///@{
1213
1214/**
1215 * @brief Close a \ref NsProgressMonitorForDeleteUserSaveDataAll. When initialized this will use \ref nsProgressMonitorForDeleteUserSaveDataAllIsFinished, throwing errors on failure / when the operation isn't finished (without closing the object).
1216 * @note Cancelling the operation before it's finished is not supported by \ref NsProgressMonitorForDeleteUserSaveDataAll.
1217 * @param p \ref NsProgressMonitorForDeleteUserSaveDataAll
1218 */
1220
1221/**
1222 * @brief GetSystemEvent
1223 * @note The Event must be closed by the user once finished with it.
1224 * @param[out] out_event Output Event with autoclear=false.
1225 */
1227
1228/**
1229 * @brief IsFinished
1230 * @param p \ref NsProgressMonitorForDeleteUserSaveDataAll
1231 * @param[out] out Whether the operation finished.
1232 */
1234
1235/**
1236 * @brief GetResult
1237 * @param p \ref NsProgressMonitorForDeleteUserSaveDataAll
1238 */
1240
1241/**
1242 * @brief GetProgress
1243 * @param p \ref NsProgressMonitorForDeleteUserSaveDataAll
1244 * @param[out] progress Output \ref NsProgressForDeleteUserSaveDataAll.
1245 */
1247
1248///@}
1249
1250///@name IProgressAsyncResult
1251///@{
1252
1253/**
1254 * @brief Close a \ref NsProgressAsyncResult.
1255 * @note When the object is initialized, this uses \ref nsProgressAsyncResultCancel then \ref nsProgressAsyncResultWait with timeout=UINT64_MAX.
1256 * @param a \ref NsProgressAsyncResult
1257 */
1259
1260/**
1261 * @brief Waits for the async operation to finish using the specified timeout.
1262 * @param a \ref NsProgressAsyncResult
1263 * @param[in] timeout Timeout in nanoseconds. UINT64_MAX for no timeout.
1264 */
1266
1267/**
1268 * @brief Gets the Result.
1269 * @note Prior to using the cmd, this uses \ref nsProgressAsyncResultWait with timeout=UINT64_MAX.
1270 * @param a \ref NsProgressAsyncResult
1271 */
1273
1274/**
1275 * @brief Cancels the async operation.
1276 * @note Used automatically by \ref nsProgressAsyncResultClose.
1277 * @param a \ref NsProgressAsyncResult
1278 */
1280
1281/**
1282 * @brief Gets the progress.
1283 * @param a \ref NsProgressAsyncResult
1284 * @param[out] buffer Output buffer.
1285 * @param[in] size Output buffer size.
1286 */
1288
1289/**
1290 * @brief GetDetailResult
1291 * @param a \ref NsProgressAsyncResult
1292 */
1294
1295/**
1296 * @brief Gets the \ref ErrorContext.
1297 * @note Only available on [4.0.0+].
1298 * @param a \ref NsProgressAsyncResult
1299 * @param[out] context \ref ErrorContext
1300 */
1302
1303///@}
1304
1305///@name ns:vm
1306///@{
1307
1308/// Initialize ns:vm. On pre-3.0.0 this must be used with \ref nsInitialize.
1310
1311/// Exit ns:vm.
1312void nsvmExit(void);
1313
1314/// Gets the Service object for ns:vm. This is only initialized on [3.0.0+].
1316
1317Result nsvmNeedsUpdateVulnerability(bool *out);
1319
1320///@}
1321
1322///@name ns:dev
1323///@{
1324
1325/// Initialize ns:dev.
1327
1328/// Initialize ns:dev.
1329void nsdevExit(void);
1330
1331/// Gets the Service object for ns:dev.
1333
1334Result nsdevLaunchProgram(u64* out_pid, const NsLaunchProperties* properties, u32 flags); ///< [1.0.0-9.2.0]
1335Result nsdevTerminateProcess(u64 pid);
1336Result nsdevTerminateProgram(u64 tid); ///< [1.0.0-9.2.0]
1337Result nsdevGetShellEvent(Event* out_event); ///< Autoclear for nsdevShellEvent is always true. [1.0.0-9.2.0]
1339Result nsdevTerminateApplication(void);
1340Result nsdevPrepareLaunchProgramFromHost(NsLaunchProperties* out, const char* path, size_t path_len); ///< [1.0.0-9.2.0]
1341Result nsdevLaunchApplicationForDevelop(u64* out_pid, u64 application_id, u32 flags); ///< [1.0.0-9.2.0]
1342Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t path_len, u32 flags); ///< [10.0.0-17.0.1]
1343Result nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id); ///< [1.0.0-17.0.1]
1347
1348///@}
1349
1350///@name ns:su
1351///@{
1352
1353/// Initialize ns:su.
1355
1356/// Exit ns:su.
1357void nssuExit(void);
1358
1359/// Gets the Service object for ns:su.
1361
1362/**
1363 * @brief Gets the \ref NsBackgroundNetworkUpdateState.
1364 * @note Internally this uses nim commands ListSystemUpdateTask and GetSystemUpdateTaskInfo to determine the output state.
1365 * @param[out] out \ref NsBackgroundNetworkUpdateState
1366 */
1368
1369/**
1370 * @brief Opens a \ref NsSystemUpdateControl.
1371 * @note Only 1 \ref NsSystemUpdateControl can be open at a time.
1372 * @param[out] c \ref NsSystemUpdateControl
1373 */
1375
1376/**
1377 * @brief Uses nim ListSystemUpdateTask, then uses the task with DestroySystemUpdateTask if it exists. Then this runs ExFat handling, updates state, and sets the same state flag as \ref nssuRequestBackgroundNetworkUpdate.
1378 * @note Only usable when a \ref NsSystemUpdateControl isn't open.
1379 */
1381
1382/**
1383 * @brief ClearExFatDriverStatusForDebug
1384 */
1386
1387/**
1388 * @brief RequestBackgroundNetworkUpdate
1389 * @note Only usable when a \ref NsSystemUpdateControl isn't open.
1390 */
1392
1393/**
1394 * @brief This checks whether a sysupdate is needed with the input \ref NcmContentMetaKey using NCM commands, if not this will just return 0. Otherwise, this will then run code which is identical to \ref nssuRequestBackgroundNetworkUpdate.
1395 * @note Only usable when a \ref NsSystemUpdateControl isn't open.
1396 * @param[in] key \ref NcmContentMetaKey
1397 */
1399
1400/**
1401 * @brief NotifyExFatDriverDownloadedForDebug
1402 */
1404
1405/**
1406 * @brief Gets an Event which can be signaled by \ref nssuNotifySystemUpdateForContentDelivery.
1407 * @note The Event must be closed by the user once finished with it.
1408 * @param[out] out_event Output Event with autoclear=false.
1409 */
1411
1412/**
1413 * @brief Signals the event returned by \ref nssuGetSystemUpdateNotificationEventForContentDelivery.
1414 */
1416
1417/**
1418 * @brief This does shutdown preparation.
1419 * @note This is used by am-sysmodule, so generally there's no need to use this.
1420 * @note Only available on [3.0.0+].
1421 */
1423
1424/**
1425 * @brief This uses nim ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
1426 * @note Only available on [4.0.0+].
1427 */
1429
1430/**
1431 * @brief RequestSendSystemUpdate
1432 * @note The system will use the input addr/port with bind(), the input addr will eventually be validated with the addr from accept(). addr/port are little-endian.
1433 * @note After the system accepts a connection etc, an error will be thrown if the system is Internet-connected.
1434 * @note Only available on [4.0.0+].
1435 * @param[out] a \ref AsyncResult
1436 * @param[in] addr Client IPv4 address. qlaunch uses a local-WLAN addr.
1437 * @param[in] port Socket port. qlaunch uses value 55556.
1438 * @param[in] info \ref NsSystemDeliveryInfo
1439 */
1441
1442/**
1443 * @brief GetSendSystemUpdateProgress
1444 * @note Only available on [4.0.0+].
1445 * @param[out] out \ref NsSystemUpdateProgress
1446 */
1448
1449///@}
1450
1451///@name ISystemUpdateControl
1452///@{
1453
1454/**
1455 * @brief Close a \ref NsSystemUpdateControl.
1456 * @param c \ref NsSystemUpdateControl
1457 */
1459
1460/**
1461 * @brief Gets whether a network sysupdate was downloaded, with install pending.
1462 * @param c \ref NsSystemUpdateControl
1463 * @param[out] out Output flag.
1464 */
1466
1467/**
1468 * @brief RequestCheckLatestUpdate
1469 * @param c \ref NsSystemUpdateControl
1470 * @param[out] a \ref AsyncValue. The data that can be read from this is u8 \ref NsLatestSystemUpdate.
1471 */
1473
1474/**
1475 * @brief RequestDownloadLatestUpdate
1476 * @param c \ref NsSystemUpdateControl
1477 * @param[out] a \ref AsyncResult
1478 */
1480
1481/**
1482 * @brief GetDownloadProgress
1483 * @param c \ref NsSystemUpdateControl
1484 * @param[out] out \ref NsSystemUpdateProgress
1485 */
1487
1488/**
1489 * @brief ApplyDownloadedUpdate
1490 * @param c \ref NsSystemUpdateControl
1491 */
1493
1494/**
1495 * @brief RequestPrepareCardUpdate
1496 * @param c \ref NsSystemUpdateControl
1497 * @param[out] a \ref AsyncResult
1498 */
1500
1501/**
1502 * @brief GetPrepareCardUpdateProgress
1503 * @note \ref nssuControlSetupCardUpdate / \ref nssuControlSetupCardUpdateViaSystemUpdater must have been used at some point prior to using this.
1504 * @param c \ref NsSystemUpdateControl
1505 * @param[out] out \ref NsSystemUpdateProgress
1506 */
1508
1509/**
1510 * @brief HasPreparedCardUpdate
1511 * @note \ref nssuControlSetupCardUpdate / \ref nssuControlSetupCardUpdateViaSystemUpdater must have been used at some point prior to using this.
1512 * @param c \ref NsSystemUpdateControl
1513 * @param[out] out Output flag.
1514 */
1516
1517/**
1518 * @brief ApplyCardUpdate
1519 * @note \ref nssuControlSetupCardUpdate / \ref nssuControlSetupCardUpdateViaSystemUpdater must have been used at some point prior to using this.
1520 * @param c \ref NsSystemUpdateControl
1521 */
1523
1524/**
1525 * @brief Gets the filesize for the specified DownloadedEulaData.
1526 * @note This mounts the Eula SystemData, then uses the file "<mountname>:/<input path>".
1527 * @param c \ref NsSystemUpdateControl
1528 * @param[in] path EulaData path.
1529 * @param[out] filesize Output filesize.
1530 */
1532
1533/**
1534 * @brief Gets the specified DownloadedEulaData.
1535 * @note See the note for \ref nssuControlGetDownloadedEulaDataSize.
1536 * @param c \ref NsSystemUpdateControl
1537 * @param[in] path EulaData path.
1538 * @param[out] buffer Output buffer.
1539 * @param[in] size Size of the output buffer, must be at least the output size from \ref nssuControlGetDownloadedEulaDataSize.
1540 * @param[out] filesize Output filesize.
1541 */
1542Result nssuControlGetDownloadedEulaData(NsSystemUpdateControl *c, const char* path, void* buffer, size_t size, u64 *filesize);
1543
1544/**
1545 * @brief SetupCardUpdate
1546 * @param c \ref NsSystemUpdateControl
1547 * @param[in] buffer TransferMemory buffer, when NULL this is automatically allocated.
1548 * @param[in] size TransferMemory buffer size, see \ref NSSU_CARDUPDATE_TMEM_SIZE_DEFAULT.
1549 */
1551
1552/**
1553 * @brief Gets the filesize for the specified PreparedCardUpdateEulaData.
1554 * @note See the note for \ref nssuControlGetDownloadedEulaDataSize.
1555 * @param c \ref NsSystemUpdateControl
1556 * @param[in] path EulaData path.
1557 * @param[out] filesize Output filesize.
1558 */
1560
1561/**
1562 * @brief Gets the specified PreparedCardUpdateEulaData.
1563 * @note See the note for \ref nssuControlGetDownloadedEulaDataSize.
1564 * @param c \ref NsSystemUpdateControl
1565 * @param[in] path EulaData path.
1566 * @param[out] buffer Output buffer.
1567 * @param[in] size Size of the output buffer, must be at least the output size from \ref nssuControlGetPreparedCardUpdateEulaDataSize.
1568 * @param[out] filesize Output filesize.
1569 */
1570Result nssuControlGetPreparedCardUpdateEulaData(NsSystemUpdateControl *c, const char* path, void* buffer, size_t size, u64 *filesize);
1571
1572/**
1573 * @brief SetupCardUpdateViaSystemUpdater
1574 * @note Same as \ref nssuControlSetupCardUpdate, except this doesn't run the code for fs cmds GetGameCardHandle/GetGameCardUpdatePartitionInfo, and uses fs OpenRegisteredUpdatePartition instead of OpenGameCardFileSystem.
1575 * @note Only available on [4.0.0+].
1576 * @param c \ref NsSystemUpdateControl
1577 * @param[in] buffer TransferMemory buffer, when NULL this is automatically allocated.
1578 * @param[in] size TransferMemory buffer size, see \ref NSSU_CARDUPDATE_TMEM_SIZE_DEFAULT.
1579 */
1581
1582/**
1583 * @brief HasReceived
1584 * @note Only available on [4.0.0+].
1585 * @param c \ref NsSystemUpdateControl
1586 * @param[out] out Output flag.
1587 */
1589
1590/**
1591 * @brief RequestReceiveSystemUpdate
1592 * @note The system will use the input addr/port with connect(). addr/port are little-endian.
1593 * @note Only available on [4.0.0+].
1594 * @param c \ref NsSystemUpdateControl
1595 * @param[out] a \ref AsyncResult
1596 * @param[in] addr Server IPv4 address. qlaunch uses a local-WLAN addr, however this can be any addr.
1597 * @param[in] port Socket port. qlaunch uses value 55556.
1598 * @param[in] info \ref NsSystemDeliveryInfo
1599 */
1601
1602/**
1603 * @brief GetReceiveProgress
1604 * @note Only available on [4.0.0+].
1605 * @param c \ref NsSystemUpdateControl
1606 * @param[out] out \ref NsSystemUpdateProgress
1607 */
1609
1610/**
1611 * @brief ApplyReceivedUpdate
1612 * @note Only available on [4.0.0+].
1613 * @param c \ref NsSystemUpdateControl
1614 */
1616
1617/**
1618 * @brief Gets the filesize for the specified ReceivedEulaData.
1619 * @note See the note for \ref nssuControlGetDownloadedEulaDataSize.
1620 * @note Only available on [4.0.0+].
1621 * @param c \ref NsSystemUpdateControl
1622 * @param[in] path EulaData path.
1623 * @param[out] filesize Output filesize.
1624 */
1626
1627/**
1628 * @brief Gets the specified ReceivedEulaData.
1629 * @note See the note for \ref nssuControlGetDownloadedEulaDataSize.
1630 * @note Only available on [4.0.0+].
1631 * @param c \ref NsSystemUpdateControl
1632 * @param[in] path EulaData path.
1633 * @param[out] buffer Output buffer.
1634 * @param[in] size Size of the output buffer, must be at least the output size from \ref nssuControlGetReceivedEulaDataSize.
1635 * @param[out] filesize Output filesize.
1636 */
1637Result nssuControlGetReceivedEulaData(NsSystemUpdateControl *c, const char* path, void* buffer, size_t size, u64 *filesize);
1638
1639/**
1640 * @brief Does setup for ReceiveSystemUpdate by using the same nim cmds as \ref nssuDestroySystemUpdateTask.
1641 * @note qlaunch uses this before \ref nssuControlRequestReceiveSystemUpdate.
1642 * @note Only available on [4.0.0+].
1643 * @param c \ref NsSystemUpdateControl
1644 */
1646
1647/**
1648 * @brief RequestCheckLatestUpdateIncludesRebootlessUpdate
1649 * @note Only available on [6.0.0+].
1650 * @param c \ref NsSystemUpdateControl
1651 * @param[out] a \ref AsyncValue
1652 */
1654
1655///@}
1656
FsSaveDataSpaceId
SaveDataSpaceId.
Definition fs.h:205
NcmStorageId
StorageId.
Definition ncm_types.h:12
Result nsResetToFactorySettingsWithPlatformRegionAuthentication(void)
ResetToFactorySettingsWithPlatformRegionAuthentication.
Result nssuControlGetPrepareCardUpdateProgress(NsSystemUpdateControl *c, NsSystemUpdateProgress *out)
GetPrepareCardUpdateProgress.
void nsdevExit(void)
Initialize ns:dev.
Result nsGetApplicationView(NsApplicationView *views, const u64 *application_ids, s32 count)
GetApplicationView.
Result nsRequestVerifyAddOnContentsRights(NsProgressAsyncResult *a, u64 application_id)
RequestVerifyAddOnContentsRights.
Result nsdevLaunchApplicationWithStorageIdForDevelop(u64 *out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id)
[1.0.0-17.0.1]
Result nsEnsureGameCardAccess(void)
EnsureGameCardAccess.
Result nsIsApplicationUpdateRequested(u64 application_id, bool *flag, u32 *out)
IsApplicationUpdateRequested.
Result nssuControlGetDownloadProgress(NsSystemUpdateControl *c, NsSystemUpdateProgress *out)
GetDownloadProgress.
Result nsGetStorageSize(NcmStorageId storage_id, s64 *total_space_size, s64 *free_space_size)
Temporarily mounts the specified fs ContentStorage, then uses fs GetTotalSpaceSize/GetFreeSpaceSize w...
Result nssuInitialize(void)
Initialize ns:su.
void nssuControlClose(NsSystemUpdateControl *c)
Close a NsSystemUpdateControl.
Result nsIsAnyApplicationRunning(bool *out)
IsAnyApplicationRunning.
Result nssuControlSetupToReceiveSystemUpdate(NsSystemUpdateControl *c)
Does setup for ReceiveSystemUpdate by using the same nim cmds as nssuDestroySystemUpdateTask.
Result nssuControlApplyDownloadedUpdate(NsSystemUpdateControl *c)
ApplyDownloadedUpdate.
Service * nsGetServiceSession_GetterInterface(void)
Gets the Service object for the actual ns:* service session. Only initialized on [3....
Result nssuGetSendSystemUpdateProgress(NsSystemUpdateProgress *out)
GetSendSystemUpdateProgress.
Result nsRequestDownloadTaskList(void)
RequestDownloadTaskList.
Result nsGetReceiveApplicationProgress(u64 application_id, NsReceiveApplicationProgress *out)
GetReceiveApplicationProgress.
Result nsRequestVerifyApplication(NsProgressAsyncResult *a, u64 application_id, u32 unk, void *buffer, size_t size)
RequestVerifyApplication.
Result nsGetSendApplicationProgress(u64 application_id, NsSendApplicationProgress *out)
GetSendApplicationProgress.
Result nsGetReadOnlyApplicationRecordInterface(Service *srv_out)
Gets the Service object for IReadOnlyApplicationRecordInterface via the cmd for that.
Result nssuControlGetReceivedEulaData(NsSystemUpdateControl *c, const char *path, void *buffer, size_t size, u64 *filesize)
Gets the specified ReceivedEulaData.
Result nsRequestRegisterGameCard(AsyncResult *a, AccountUid uid, u64 application_id, s32 inval)
RequestRegisterGameCard.
Result nsdevGetShellEventInfo(NsShellEventInfo *out)
[1.0.0-9.2.0]
Result nsCleanupUnavailableAddOnContents(u64 application_id, AccountUid uid)
CleanupUnavailableAddOnContents.
Result nsGetSystemDeliveryInfo(NsSystemDeliveryInfo *info)
Generates a NsSystemDeliveryInfo using the currently installed SystemUpdate meta.
Result nsListApplicationIcon(AsyncValue *a, NsApplicationControlSource source, const u64 *application_ids, s32 count, void *buffer, size_t size)
ListApplicationIcon.
NsSystemUpdateProgress NsReceiveApplicationProgress
ReceiveApplicationProgress. Same as NsSystemUpdateProgress, except cmds which return this will return...
Definition ns.h:176
Result nsGetApplicationDeliveryInfo(NsApplicationDeliveryInfo *info, s32 count, u64 application_id, u32 attr, s32 *total_out)
Generates NsApplicationDeliveryInfo for the specified ApplicationId.
Result nsClearTaskStatusList(void)
ClearTaskStatusList.
Result nsRequestLinkDevice(AsyncResult *a, AccountUid uid)
RequestLinkDevice.
Result nsResetToFactorySettingsWithPlatformRegion(void)
ResetToFactorySettingsWithPlatformRegion.
Result nsCompareSystemDeliveryInfo(const NsSystemDeliveryInfo *info0, const NsSystemDeliveryInfo *info1, s32 *out)
Both NsSystemDeliveryInfo are validated, then the system_update_meta_version in the first/second NsSy...
Result nssuControlGetPreparedCardUpdateEulaData(NsSystemUpdateControl *c, const char *path, void *buffer, size_t size, u64 *filesize)
Gets the specified PreparedCardUpdateEulaData.
Result nsResumeAll(void)
ResumeAll.
Result nsCountApplicationContentMeta(u64 application_id, s32 *out)
CountApplicationContentMeta.
Result nssuControlRequestCheckLatestUpdate(NsSystemUpdateControl *c, AsyncValue *a)
RequestCheckLatestUpdate.
Result nsMoveApplicationEntity(u64 application_id, NcmStorageId storage_id)
MoveApplicationEntity.
Result nsResumeApplicationDownload(u64 application_id)
ResumeApplicationDownload.
Result nssuNotifySystemUpdateForContentDelivery(void)
Signals the event returned by nssuGetSystemUpdateNotificationEventForContentDelivery.
Result nsdevTerminateProgram(u64 tid)
[1.0.0-9.2.0]
Result nsGetGameCardUpdateDetectionEvent(Event *out_event)
GetGameCardUpdateDetectionEvent.
Result nsRequestNoDownloadRightsErrorResolution(AsyncValue *a, u64 application_id)
RequestNoDownloadRightsErrorResolution.
Result nsIsAnyApplicationEntityInstalled(u64 application_id, bool *out)
IsAnyApplicationEntityInstalled.
Result nsDeleteSaveData(FsSaveDataSpaceId save_data_space_id, u64 save_data_id)
DeleteSaveData.
Result nsCleanupSdCard(void)
CleanupSdCard.
Result nsGetApplicationManagerInterface(Service *srv_out)
Gets the Service object for IApplicationManagerInterface via the cmd for that.
Result nsProgressAsyncResultCancel(NsProgressAsyncResult *a)
Cancels the async operation.
Result nsCheckSdCardMountStatus(void)
CheckSdCardMountStatus.
Result nsUnregisterNetworkServiceAccountWithUserSaveDataDeletion(AccountUid uid)
UnregisterNetworkServiceAccountWithUserSaveDataDeletion.
Service * nssuGetServiceSession(void)
Gets the Service object for ns:su.
Result nsCalculateApplicationOccupiedSize(u64 application_id, NsApplicationOccupiedSize *out)
CalculateApplicationOccupiedSize.
void nsProgressAsyncResultClose(NsProgressAsyncResult *a)
Close a NsProgressAsyncResult.
Result nsGetApplicationRecordUpdateSystemEvent(Event *out_event)
GetApplicationRecordUpdateSystemEvent.
Result nssuControlApplyReceivedUpdate(NsSystemUpdateControl *c)
ApplyReceivedUpdate.
void nsExit(void)
Exit ns services.
Result nsGetLastSdCardMountUnexpectedResult(void)
GetLastSdCardMountUnexpectedResult.
Result nsdevGetRunningApplicationProcessIdForDevelop(u64 *out_pid)
[6.0.0+]
NsApplicationControlSource
ApplicationControlSource.
Definition ns.h:29
@ NsApplicationControlSource_Storage
Returns data from storage if not present in cache.
Definition ns.h:31
@ NsApplicationControlSource_CacheOnly
Returns data from cache.
Definition ns.h:30
@ NsApplicationControlSource_StorageOnly
Returns data from storage without using cache.
Definition ns.h:32
Result nsProgressAsyncResultGet(NsProgressAsyncResult *a)
Gets the Result.
Result nssuDestroySystemUpdateTask(void)
This uses nim ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask...
Result nsdevSetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop(bool can_be_active)
[6.0.0+]
Result nsDeleteRedundantApplicationEntity(void)
DeleteRedundantApplicationEntity.
Result nssuControlRequestPrepareCardUpdate(NsSystemUpdateControl *c, AsyncResult *a)
RequestPrepareCardUpdate.
Result nsProgressAsyncResultGetProgress(NsProgressAsyncResult *a, void *buffer, size_t size)
Gets the progress.
Result nsDeleteUserSaveDataAll(NsProgressMonitorForDeleteUserSaveDataAll *p, AccountUid uid)
DeleteUserSaveDataAll.
Result nsGetApplicationDesiredLanguage(NacpStruct *nacp, NacpLanguageEntry **langentry)
GetApplicationDesiredLanguage.
NsBackgroundNetworkUpdateState
BackgroundNetworkUpdateState.
Definition ns.h:36
@ NsBackgroundNetworkUpdateState_None
No sysupdate task exists.
Definition ns.h:37
@ NsBackgroundNetworkUpdateState_Downloading
Sysupdate download in progress.
Definition ns.h:38
@ NsBackgroundNetworkUpdateState_Ready
Sysupdate ready, pending install.
Definition ns.h:39
Result nssuControlGetReceiveProgress(NsSystemUpdateControl *c, NsSystemUpdateProgress *out)
GetReceiveProgress.
Result nsIsApplicationEntityMovable(u64 application_id, NcmStorageId storage_id, bool *out)
IsApplicationEntityMovable.
Result nsGetApplicationViewDeprecated(NsApplicationViewDeprecated *views, const u64 *application_ids, s32 count)
GetApplicationViewDeprecated.
Result nsvmInitialize(void)
Initialize ns:vm. On pre-3.0.0 this must be used with nsInitialize.
Result nsSelectLatestSystemDeliveryInfo(const NsSystemDeliveryInfo *sys_list, s32 sys_count, const NsSystemDeliveryInfo *base_info, const NsApplicationDeliveryInfo *app_list, s32 app_count, s32 *index)
SelectLatestSystemDeliveryInfo.
Result nsProgressMonitorForDeleteUserSaveDataAllGetResult(NsProgressMonitorForDeleteUserSaveDataAll *p)
GetResult.
Result nsProgressAsyncResultGetErrorContext(NsProgressAsyncResult *a, ErrorContext *context)
Gets the ErrorContext.
Result nsListDownloadTaskStatus(NsDownloadTaskStatus *tasks, s32 count, s32 *total_out)
ListDownloadTaskStatus.
Result nsNeedsSystemUpdateToDeliverApplication(const NsApplicationDeliveryInfo *info, s32 count, const NsSystemDeliveryInfo *sys_info, bool *out)
After validation etc, this sets the output bool by comparing system-version fields in the NsSystemDel...
Result nssuControlSetupCardUpdate(NsSystemUpdateControl *c, void *buffer, size_t size)
SetupCardUpdate.
Result nsListNotCommittedContentMeta(NcmContentMetaKey *meta, s32 count, u64 application_id, s32 unk, s32 *total_out)
ListNotCommittedContentMeta.
Result nsProgressMonitorForDeleteUserSaveDataAllGetProgress(NsProgressMonitorForDeleteUserSaveDataAll *p, NsProgressForDeleteUserSaveDataAll *progress)
GetProgress.
Result nsCanDeliverApplication(const NsApplicationDeliveryInfo *info0, s32 count0, const NsApplicationDeliveryInfo *info1, s32 count1, bool *out)
CanDeliverApplication.
Result nssuControlHasReceived(NsSystemUpdateControl *c, bool *out)
HasReceived.
Result nsCancelApplicationDownload(u64 application_id)
CancelApplicationDownload.
Result nsGetLastGameCardMountFailureResult(void)
GetLastGameCardMountFailureResult.
NsShellEvent
ShellEvent.
Definition ns.h:20
@ NsShellEvent_Debug
Debug.
Definition ns.h:25
@ NsShellEvent_Crash
Crash.
Definition ns.h:24
@ NsShellEvent_Exit
Exit.
Definition ns.h:22
@ NsShellEvent_Start
Start.
Definition ns.h:23
@ NsShellEvent_None
None.
Definition ns.h:21
Result nsRequestGameCardRegistrationGoldPoint(AsyncValue *a, AccountUid uid, u64 application_id)
RequestGameCardRegistrationGoldPoint.
Result nssuControlRequestCheckLatestUpdateIncludesRebootlessUpdate(NsSystemUpdateControl *c, AsyncValue *a)
RequestCheckLatestUpdateIncludesRebootlessUpdate.
Result nsGetReadOnlyApplicationControlDataInterface(Service *srv_out)
Gets the Service object for IReadOnlyApplicationControlDataInterface via the cmd for that.
Result nsResetToFactorySettingsWithoutUserSaveData(void)
ResetToFactorySettingsWithoutUserSaveData.
Result nsHasAllContentsToDeliver(const NsApplicationDeliveryInfo *info, s32 count, bool *out)
HasAllContentsToDeliver.
NsSystemUpdateProgress NsSendApplicationProgress
SendApplicationProgress. Same as NsSystemUpdateProgress, except cmds which return this will return ac...
Definition ns.h:179
Result nsClearApplicationTerminateResult(u64 application_id)
ClearApplicationTerminateResult.
Result nsGetDocumentInterface(Service *srv_out)
Gets the Service object for IDocumentInterface via the cmd for that.
Result nsGetApplicationDeliveryInfoHash(const NsApplicationDeliveryInfo *info, s32 count, u8 *out_hash)
This extracts data from the input array for hashing with SHA256, with validation being done when hand...
Result nsGetApplicationVersionInterface(Service *srv_out)
Gets the Service object for IApplicationVersionInterface via the cmd for that.
Result nssuNotifyBackgroundNetworkUpdate(const NcmContentMetaKey *key)
This checks whether a sysupdate is needed with the input NcmContentMetaKey using NCM commands,...
Result nsRequestEnsureDownloadTask(AsyncResult *a)
RequestEnsureDownloadTask.
Result nsGetFreeSpaceSize(NcmStorageId storage_id, s64 *size)
Returns the available storage capacity from content manager services.
Result nsdevLaunchProgram(u64 *out_pid, const NsLaunchProperties *properties, u32 flags)
[1.0.0-9.2.0]
Result nssuControlGetPreparedCardUpdateEulaDataSize(NsSystemUpdateControl *c, const char *path, u64 *filesize)
Gets the filesize for the specified PreparedCardUpdateEulaData.
Result nssuControlGetReceivedEulaDataSize(NsSystemUpdateControl *c, const char *path, u64 *filesize)
Gets the filesize for the specified ReceivedEulaData.
Service * nsdevGetServiceSession(void)
Gets the Service object for ns:dev.
Result nsGetFactoryResetInterface(Service *srv_out)
Gets the Service object for IFactoryResetInterface via the cmd for that.
Result nsGetLastSdCardFormatUnexpectedResult(void)
GetLastSdCardFormatUnexpectedResult.
Result nsGetECommerceInterface(Service *srv_out)
Gets the Service object for IECommerceInterface via the cmd for that.
Result nsListApplicationRecord(NsApplicationRecord *records, s32 count, s32 entry_offset, s32 *out_entrycount)
Gets an listing of NsApplicationRecord.
Result nsGetTotalSpaceSize(NcmStorageId storage_id, s64 *size)
Returns the total storage capacity (used + free) from content manager services.
Result nsCalculateApplicationDownloadRequiredSize(u64 application_id, NcmStorageId *storage_id, s64 *size)
CalculateApplicationApplyDeltaRequiredSize.
Result nsvmGetSafeSystemVersion(NcmContentMetaKey *out)
[4.0.0+]
Result nsRequestCheckGameCardRegistration(AsyncResult *a, u64 application_id)
RequestCheckGameCardRegistration.
Result nsEnableAutoCommit(void)
EnableAutoCommit.
Result nsRequestUnlinkDevice(AsyncResult *a, AccountUid uid)
RequestUnlinkDevice.
Result nsGetDownloadTaskInterface(Service *srv_out)
Gets the Service object for IDownloadTaskInterface via the cmd for that.
Result nsRequestDownloadApplicationControlData(AsyncResult *a, u64 application_id)
RequestDownloadApplicationControlData.
Result nsDeleteApplicationCompletely(u64 application_id)
DeleteApplicationCompletely.
Service * nsGetServiceSession_ApplicationManagerInterface(void)
Gets the Service object for IApplicationManagerInterface. Only initialized on pre-3....
Result nsDisableAutoCommit(void)
DisableAutoCommit.
Result nsListContentMetaKeyToDeliverApplication(NcmContentMetaKey *meta, s32 meta_count, s32 meta_index, const NsApplicationDeliveryInfo *info, s32 info_count, s32 *total_out)
ListContentMetaKeyToDeliverApplication.
Result nsProgressMonitorForDeleteUserSaveDataAllClose(NsProgressMonitorForDeleteUserSaveDataAll *p)
Close a NsProgressMonitorForDeleteUserSaveDataAll.
Result nsResetToFactorySettings(void)
ResetToFactorySettings.
Result nssuControlRequestReceiveSystemUpdate(NsSystemUpdateControl *c, AsyncResult *a, u32 addr, u16 port, NsSystemDeliveryInfo *info)
RequestReceiveSystemUpdate.
Result nssuOpenSystemUpdateControl(NsSystemUpdateControl *c)
Opens a NsSystemUpdateControl.
Result nssuControlSetupCardUpdateViaSystemUpdater(NsSystemUpdateControl *c, void *buffer, size_t size)
SetupCardUpdateViaSystemUpdater.
Result nsResetToFactorySettingsForRefurbishment(void)
ResetToFactorySettingsForRefurbishment.
Result nsListApplicationTitle(AsyncValue *a, NsApplicationControlSource source, const u64 *application_ids, s32 count, void *buffer, size_t size)
ListApplicationTitle.
Result nsDeleteApplicationEntity(u64 application_id)
DeleteApplicationEntity.
Result nsGetAccountProxyInterface(Service *srv_out)
Gets the Service object for IAccountProxyInterface via the cmd for that.
Result nsEnableApplicationAutoDelete(u64 application_id)
EnableApplicationAutoDelete.
Result nsDisableApplicationAutoDelete(u64 application_id)
DisableApplicationAutoDelete.
Result nssuRequestBackgroundNetworkUpdate(void)
RequestBackgroundNetworkUpdate.
Result nsRequestDownloadTaskListData(AsyncValue *a)
RequestDownloadTaskListData.
void nsvmExit(void)
Exit ns:vm.
Result nssuRequestSendSystemUpdate(AsyncResult *a, u32 addr, u16 port, NsSystemDeliveryInfo *info)
RequestSendSystemUpdate.
Result nsCompareApplicationDeliveryInfo(const NsApplicationDeliveryInfo *info0, s32 count0, const NsApplicationDeliveryInfo *info1, s32 count1, s32 *out)
Both NsApplicationDeliveryInfo are validated, then the application_version in the first/second NsAppl...
Result nsResumeApplicationApplyDelta(u64 application_id)
ResumeApplicationApplyDelta.
Result nsRequestApplicationUpdateInfo(AsyncValue *a, u64 application_id)
RequestApplicationUpdateInfo.
Result nsRequestDownloadApplicationPrepurchasedRights(AsyncResult *a, u64 application_id)
RequestDownloadApplicationPrepurchasedRights.
Result nsGetSdCardMountStatusChangedEvent(Event *out_event)
GetSdCardMountStatusChangedEvent.
Result nsFormatSdCard(void)
FormatSdCard.
Result nssuPrepareShutdown(void)
This does shutdown preparation.
Result nsGetGameCardMountFailureEvent(Event *out_event)
GetGameCardMountFailureEvent.
Result nsDeleteUserSystemSaveData(AccountUid uid, u64 system_save_data_id)
DeleteUserSystemSaveData.
Result nsdevIsSystemMemoryResourceLimitBoosted(bool *out)
[6.0.0-8.1.0]
Result nsCommitReceiveApplication(u64 application_id)
CommitReceiveApplication.
Result nssuControlGetDownloadedEulaDataSize(NsSystemUpdateControl *c, const char *path, u64 *filesize)
Gets the filesize for the specified DownloadedEulaData.
void nsRequestServerStopperClose(NsRequestServerStopper *r)
Close a NsRequestServerStopper.
Result nsInitialize(void)
Initialize ns services. Uses ns:am on pre-3.0.0, ns:am2 on [3.0.0+].
Result nsListApplicationIdOnGameCard(u64 *application_ids, s32 count, s32 *total_out)
ListApplicationIdOnGameCard.
Result nsGetPromotionInfo(NsPromotionInfo *promotion, u64 application_id, AccountUid uid)
GetPromotionInfo.
Result nsCancelApplicationApplyDelta(u64 application_id)
CancelApplicationApplyDelta.
Result nssuControlHasDownloaded(NsSystemUpdateControl *c, bool *out)
Gets whether a network sysupdate was downloaded, with install pending.
Result nsTouchApplication(u64 application_id)
TouchApplication.
Result nsRequestReceiveApplication(AsyncResult *a, u32 addr, u16 port, u64 application_id, const NcmContentMetaKey *meta, s32 count, NcmStorageId storage_id)
RequestReceiveApplication.
Result nssuControlRequestDownloadLatestUpdate(NsSystemUpdateControl *c, AsyncResult *a)
RequestDownloadLatestUpdate.
Result nssuNotifyExFatDriverDownloadedForDebug(void)
NotifyExFatDriverDownloadedForDebug.
Result nssuControlApplyCardUpdate(NsSystemUpdateControl *c)
ApplyCardUpdate.
Result nsSetApplicationTerminateResult(u64 application_id, Result res)
SetApplicationTerminateResult.
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData *buffer, size_t size, u64 *actual_size)
Gets the NsApplicationControlData for the specified application.
Result nsEstimateSizeToMove(u8 *storage_ids, s32 count, NcmStorageId storage_id, u32 flags, u64 application_id, s64 *out)
EstimateSizeToMove.
Result nssuNotifyExFatDriverRequired(void)
Uses nim ListSystemUpdateTask, then uses the task with DestroySystemUpdateTask if it exists.
Result nssuControlHasPreparedCardUpdate(NsSystemUpdateControl *c, bool *out)
HasPreparedCardUpdate.
Result nsProgressAsyncResultGetDetailResult(NsProgressAsyncResult *a)
GetDetailResult.
Result nsdevLaunchApplicationForDevelop(u64 *out_pid, u64 application_id, u32 flags)
[1.0.0-9.2.0]
Result nsEstimateRequiredSize(const NcmContentMetaKey *meta, s32 count, s64 *out)
EstimateRequiredSize.
Result nsTryCommitCurrentApplicationDownloadTask(void)
TryCommitCurrentApplicationDownloadTask.
Result nsTriggerDynamicCommitEvent(void)
TriggerDynamicCommitEvent.
Result nsdevGetShellEvent(Event *out_event)
Autoclear for nsdevShellEvent is always true. [1.0.0-9.2.0].
Result nsWithdrawApplicationUpdateRequest(u64 application_id)
WithdrawApplicationUpdateRequest.
Result nsUnregisterNetworkServiceAccount(AccountUid uid)
UnregisterNetworkServiceAccount.
NsLatestSystemUpdate
LatestSystemUpdate.
Definition ns.h:43
@ NsLatestSystemUpdate_Unknown2
Unknown.
Definition ns.h:46
@ NsLatestSystemUpdate_Unknown0
Unknown.
Definition ns.h:44
@ NsLatestSystemUpdate_Unknown1
Unknown.
Definition ns.h:45
Result nsGetApplicationViewDownloadErrorContext(u64 application_id, ErrorContext *context)
GetApplicationViewDownloadErrorContext.
Result nsIsGameCardInserted(bool *out)
IsGameCardInserted.
Result nsListApplicationContentMetaStatus(u64 application_id, s32 index, NsApplicationContentMetaStatus *list, s32 count, s32 *out_entrycount)
Gets an listing of NsApplicationContentMetaStatus.
Result nsProgressAsyncResultWait(NsProgressAsyncResult *a, u64 timeout)
Waits for the async operation to finish using the specified timeout.
Result nsGetApplicationViewWithPromotionInfo(NsApplicationViewWithPromotionInfo *out, const u64 *application_ids, s32 count)
GetApplicationViewWithPromotionInfo.
Result nsProgressMonitorForDeleteUserSaveDataAllIsFinished(NsProgressMonitorForDeleteUserSaveDataAll *p, bool *out)
IsFinished.
Result nsGetApplicationTerminateResult(u64 application_id, Result *res)
GetApplicationTerminateResult.
Result nssuGetBackgroundNetworkUpdateState(NsBackgroundNetworkUpdateState *out)
Gets the NsBackgroundNetworkUpdateState.
Result nsRequestResolveNoDownloadRightsError(AsyncValue *a, u64 application_id)
RequestResolveNoDownloadRightsError.
Result nsRequestSendApplication(AsyncResult *a, u32 addr, u16 port, u64 application_id, const NcmContentMetaKey *meta, s32 count)
RequestSendApplication.
Service * nsvmGetServiceSession(void)
Gets the Service object for ns:vm. This is only initialized on [3.0.0+].
Result nsdevInitialize(void)
Initialize ns:dev.
Result nsNeedsSystemUpdateToFormatSdCard(bool *out)
NeedsSystemUpdateToFormatSdCard.
Result nsGetContentManagementInterface(Service *srv_out)
Gets the Service object for IContentManagementInterface via the cmd for that.
Result nsRequestUpdateApplication2(AsyncResult *a, u64 application_id)
RequestUpdateApplication2.
void nssuExit(void)
Exit ns:su.
Result nsCalculateApplicationApplyDeltaRequiredSize(u64 application_id, NcmStorageId *storage_id, s64 *size)
CalculateApplicationApplyDeltaRequiredSize.
Result nsGetRequestServerStopper(NsRequestServerStopper *r)
Opens a NsRequestServerStopper.
Result nssuControlGetDownloadedEulaData(NsSystemUpdateControl *c, const char *path, void *buffer, size_t size, u64 *filesize)
Gets the specified DownloadedEulaData.
Result nssuGetSystemUpdateNotificationEventForContentDelivery(Event *out_event)
Gets an Event which can be signaled by nssuNotifySystemUpdateForContentDelivery.
Result nsRequestSyncRights(AsyncResult *a)
RequestSyncRights.
Result nsCheckApplicationLaunchVersion(u64 application_id)
CheckApplicationLaunchVersion.
Result nsdevPrepareLaunchProgramFromHost(NsLaunchProperties *out, const char *path, size_t path_len)
[1.0.0-9.2.0]
Result nsProgressMonitorForDeleteUserSaveDataAllGetSystemEvent(NsProgressMonitorForDeleteUserSaveDataAll *p, Event *out_event)
GetSystemEvent.
Result nsVerifyDeliveryProtocolVersion(const NsSystemDeliveryInfo *info)
VerifyDeliveryProtocolVersion.
Result nsGetApplicationRightsOnClient(NsApplicationRightsOnClient *rights, s32 count, u64 application_id, AccountUid uid, u32 flags, s32 *total_out)
GetApplicationRightsOnClient.
Result nssuClearExFatDriverStatusForDebug(void)
ClearExFatDriverStatusForDebug.
Result nsdevLaunchApplicationFromHost(u64 *out_pid, const char *path, size_t path_len, u32 flags)
[10.0.0-17.0.1]
Result nsGetDynamicRightsInterface(Service *srv_out)
Gets the Service object for IDynamicRightsInterface via the cmd for that.
Account UserId.
Definition acc.h:25
AsyncResult.
Definition async.h:20
AsyncValue.
Definition async.h:14
Error context.
Definition error.h:38
Kernel-mode event structure.
Definition event.h:13
Language entry. These strings are UTF-8.
Definition nacp.h:10
ns ApplicationControlProperty
Definition nacp.h:34
ContentMetaKey.
Definition ncm_types.h:79
NsApplicationContentMetaStatus.
Definition ns.h:83
u8 padding
Padding.
Definition ns.h:87
u8 storageID
NcmStorageId
Definition ns.h:85
u64 application_id
ApplicationId.
Definition ns.h:89
u8 unk_x02
Unknown.
Definition ns.h:86
u32 version
Application version.
Definition ns.h:88
u8 meta_type
NcmContentMetaType
Definition ns.h:84
ApplicationControlData.
Definition ns.h:72
NacpStruct nacp
NacpStruct
Definition ns.h:73
ApplicationDeliveryInfo.
Definition ns.h:203
u32 required_system_version
Required system version, see NsSystemDeliveryInfo::system_update_meta_version.
Definition ns.h:208
u32 unk_x14
Unknown.
Definition ns.h:207
u32 application_version
Application version.
Definition ns.h:206
u32 unk_x1c
Unknown.
Definition ns.h:209
ApplicationOccupiedSize.
Definition ns.h:78
ApplicationRecord.
Definition ns.h:93
u8 type
Type.
Definition ns.h:95
u8 unk_x09
Unknown.
Definition ns.h:96
u8 unk_x10
Unknown.
Definition ns.h:98
u64 application_id
ApplicationId.
Definition ns.h:94
NsApplicationRightsOnClient.
Definition ns.h:216
AccountUid uid
AccountUid
Definition ns.h:218
u64 application_id
ApplicationId.
Definition ns.h:217
u8 flags_x18
qlaunch uses bit0-bit4 and bit7 from here.
Definition ns.h:219
u8 flags_x19
qlaunch uses bit0 from here.
Definition ns.h:220
ApplicationViewDeprecated. The below comments are for the NsApplicationView to NsApplicationViewDepre...
Definition ns.h:108
u16 unk_x24
Same as NsApplicationView::unk_x24.
Definition ns.h:114
u32 unk_x38
Same as NsApplicationView::unk_x40.
Definition ns.h:117
u32 flags
Same as NsApplicationView::flags.
Definition ns.h:111
u64 application_id
Same as NsApplicationView::application_id.
Definition ns.h:109
u32 unk_x20
Same as NsApplicationView::unk_x20.
Definition ns.h:113
u8 unk_x3c
Same as NsApplicationView::unk_x44.
Definition ns.h:118
NsApplicationViewWithPromotionInfo.
Definition ns.h:149
NsApplicationView view
NsApplicationView
Definition ns.h:150
NsPromotionInfo promotion
NsPromotionInfo
Definition ns.h:151
ApplicationView.
Definition ns.h:123
u16 unk_x24
Unknown.
Definition ns.h:129
u8 unk_x44
Unknown.
Definition ns.h:134
u32 unk_x20
Unknown.
Definition ns.h:128
u64 application_id
ApplicationId.
Definition ns.h:124
u32 flags
Flags.
Definition ns.h:126
u32 unk_x40
Unknown.
Definition ns.h:133
DownloadTaskStatus.
Definition ns.h:225
EulaDataPath.
Definition ns.h:182
LaunchProperties.
Definition ns.h:155
u8 storageID
NcmStorageId
Definition ns.h:158
u32 version
Program version.
Definition ns.h:157
u8 index
Index.
Definition ns.h:159
u64 program_id
program_id.
Definition ns.h:156
u8 is_application
Whether this is an Application.
Definition ns.h:160
ProgressAsyncResult.
Definition ns.h:60
Event event
Event with autoclear=false.
Definition ns.h:62
Service s
IProgressAsyncResult.
Definition ns.h:61
ProgressForDeleteUserSaveDataAll.
Definition ns.h:103
ProgressMonitorForDeleteUserSaveDataAll.
Definition ns.h:55
Service s
IProgressMonitorForDeleteUserSaveDataAll.
Definition ns.h:56
NsPromotionInfo.
Definition ns.h:139
u64 end_timestamp
POSIX timestamp for the promotion end.
Definition ns.h:141
u64 start_timestamp
POSIX timestamp for the promotion start.
Definition ns.h:140
s64 remaining_time
Remaining time until the promotion ends, in nanoseconds ({end_timestamp - current_time} converted to ...
Definition ns.h:142
u8 flags
Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear: remaining_time is set.
Definition ns.h:144
RequestServerStopper.
Definition ns.h:50
Service s
IRequestServerStopper.
Definition ns.h:51
ShellEventInfo.
Definition ns.h:164
u64 process_id
processID.
Definition ns.h:166
NsShellEvent event
NsShellEvent
Definition ns.h:165
SystemDeliveryInfo.
Definition ns.h:187
u8 unk_x18
Copied into state by nssuRequestSendSystemUpdate.
Definition ns.h:194
u8 unk_x19
Unused by nssuRequestSendSystemUpdate / nssuControlRequestReceiveSystemUpdate, besides HMAC validatio...
Definition ns.h:195
u32 includes_exfat
Whether ExFat is included. Unused by nssuRequestSendSystemUpdate / nssuControlRequestReceiveSystemUpd...
Definition ns.h:191
u32 system_update_meta_version
SystemUpdate meta version.
Definition ns.h:192
u32 application_delivery_protocol_version
Loaded from a system-setting. Unused by nssuRequestSendSystemUpdate / nssuControlRequestReceiveSystem...
Definition ns.h:190
u64 system_update_meta_id
SystemUpdate meta Id.
Definition ns.h:193
u8 unk_x1a
Unknown.
Definition ns.h:196
u32 system_delivery_protocol_version
Must match a system-setting.
Definition ns.h:189
SystemUpdateControl.
Definition ns.h:66
TransferMemory tmem
TransferMemory for SetupCardUpdate/SetupCardUpdateViaSystemUpdater.
Definition ns.h:68
Service s
ISystemUpdateControl.
Definition ns.h:67
SystemUpdateProgress. Commands which have this as output will return 0 with the output cleared,...
Definition ns.h:170
s64 total_size
Total size, this field is only valid when >0.
Definition ns.h:172
s64 current_size
Current size. This value can be larger than total_size when the async operation is finishing....
Definition ns.h:171
Service object structure.
Definition service.h:14
Transfer memory information structure.
Definition tmem.h:13
int64_t s64
64-bit signed integer.
Definition types.h:28
uint64_t u64
64-bit unsigned integer.
Definition types.h:22
uint8_t u8
8-bit unsigned integer.
Definition types.h:19
uint16_t u16
16-bit unsigned integer.
Definition types.h:20
u32 Result
Function error code result type.
Definition types.h:44
int32_t s32
32-bit signed integer.
Definition types.h:27
uint32_t u32
32-bit unsigned integer.
Definition types.h:21