ns: Added NsApplicationRightsOnClient/nsGetApplicationRightsOnClient().

This commit is contained in:
yellows8 2020-02-17 15:46:02 -05:00
parent d8d931fe25
commit c570cd0a2f
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 38 additions and 0 deletions

View File

@ -143,6 +143,15 @@ typedef struct {
u8 hmac[0x20]; ///< HMAC-SHA256 over the above data. u8 hmac[0x20]; ///< HMAC-SHA256 over the above data.
} NsApplicationDeliveryInfo; } NsApplicationDeliveryInfo;
/// NsApplicationRightsOnClient
typedef struct {
u64 application_id; ///< ApplicationId.
AccountUid uid; ///< \ref AccountUid
u8 flags_x18; ///< qlaunch uses bit0-bit4 and bit7 from here.
u8 flags_x19; ///< qlaunch uses bit0 from here.
u8 unk_x1a[0x6]; ///< Unknown.
} NsApplicationRightsOnClient;
/// Default size for \ref nssuControlSetupCardUpdate / \ref nssuControlSetupCardUpdateViaSystemUpdater. This is the size used by qlaunch for SetupCardUpdate. /// Default size for \ref nssuControlSetupCardUpdate / \ref nssuControlSetupCardUpdateViaSystemUpdater. This is the size used by qlaunch for SetupCardUpdate.
#define NSSU_CARDUPDATE_TMEM_SIZE_DEFAULT 0x100000 #define NSSU_CARDUPDATE_TMEM_SIZE_DEFAULT 0x100000
@ -737,6 +746,18 @@ Result nsGetApplicationDeliveryInfoHash(const NsApplicationDeliveryInfo *info, s
*/ */
Result nsGetApplicationTerminateResult(u64 application_id, Result *res); Result nsGetApplicationTerminateResult(u64 application_id, Result *res);
/**
* @brief GetApplicationRightsOnClient
* @note Only available on [6.0.0+].
* @param[out] rights Output array of \ref NsApplicationRightsOnClient.
* @param[in] count Size of the rights array in entries. qlaunch uses value 3 for this.
* @param[in] application_id ApplicationId
* @param[in] uid \ref AccountUid, can optionally be all-zero.
* @param[in] flags Flags. Official sw hard-codes this to value 0x3.
* @param[out] total_out Total output entries.
*/
Result nsGetApplicationRightsOnClient(NsApplicationRightsOnClient *rights, s32 count, u64 application_id, AccountUid uid, u32 flags, s32 *total_out);
/** /**
* @brief RequestNoDownloadRightsErrorResolution * @brief RequestNoDownloadRightsErrorResolution
* @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. * @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.

View File

@ -940,6 +940,23 @@ Result nsGetApplicationTerminateResult(u64 application_id, Result *res) {
return serviceDispatchInOut(&g_nsAppManSrv, 2100, application_id, *res); return serviceDispatchInOut(&g_nsAppManSrv, 2100, application_id, *res);
} }
Result nsGetApplicationRightsOnClient(NsApplicationRightsOnClient *rights, s32 count, u64 application_id, AccountUid uid, u32 flags, s32 *total_out) {
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u32 flags;
u32 pad;
u64 application_id;
AccountUid uid;
} in = { flags, 0, application_id, uid };
return serviceDispatchInOut(&g_nsAppManSrv, 2050, in, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { rights, count*sizeof(NsApplicationRightsOnClient) } },
);
}
Result nsRequestNoDownloadRightsErrorResolution(AsyncValue *a, u64 application_id) { Result nsRequestNoDownloadRightsErrorResolution(AsyncValue *a, u64 application_id) {
if (hosversionBefore(9,0,0)) if (hosversionBefore(9,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);