mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-05 16:09:24 +02:00
ns: Added nsGetReadOnlyApplicationControlDataInterface. Use IReadOnlyApplicationControlDataInterface with nsGetApplicationControlData when needed.
This commit is contained in:
parent
fdb6aa1f15
commit
7822accc22
@ -244,6 +244,10 @@ Service* nsGetServiceSession_GetterInterface(void);
|
|||||||
/// Gets the Service object for IApplicationManagerInterface.
|
/// Gets the Service object for IApplicationManagerInterface.
|
||||||
Service* nsGetServiceSession_ApplicationManagerInterface(void);
|
Service* nsGetServiceSession_ApplicationManagerInterface(void);
|
||||||
|
|
||||||
|
/// Gets the Service object for IReadOnlyApplicationControlDataInterface via the cmd for that.
|
||||||
|
/// Only available on [5.1.0+].
|
||||||
|
Result nsGetReadOnlyApplicationControlDataInterface(Service* srv_out);
|
||||||
|
|
||||||
/// Gets the Service object for IECommerceInterface via the cmd for that.
|
/// Gets the Service object for IECommerceInterface via the cmd for that.
|
||||||
/// Only available on [4.0.0+].
|
/// Only available on [4.0.0+].
|
||||||
Result nsGetECommerceInterface(Service* srv_out);
|
Result nsGetECommerceInterface(Service* srv_out);
|
||||||
@ -262,6 +266,22 @@ Result nsGetContentManagementInterface(Service* srv_out);
|
|||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
|
///@name IReadOnlyApplicationControlDataInterface
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the \ref NsApplicationControlData for the specified application.
|
||||||
|
* @note Uses \ref nsGetReadOnlyApplicationControlDataInterface on [5.1.0+], otherwise IApplicationManagerInterface is used.
|
||||||
|
* @param[in] source Source, official sw uses ::NsApplicationControlSource_Storage.
|
||||||
|
* @param[in] application_id ApplicationId.
|
||||||
|
* @param[out] buffer \ref NsApplicationControlData
|
||||||
|
* @param[in] size Size of the buffer.
|
||||||
|
* @param[out] actual_size Actual output size.
|
||||||
|
*/
|
||||||
|
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size);
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
///@name IECommerceInterface
|
///@name IECommerceInterface
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
@ -560,16 +580,6 @@ Result nsUnregisterNetworkServiceAccount(AccountUid uid);
|
|||||||
*/
|
*/
|
||||||
Result nsUnregisterNetworkServiceAccountWithUserSaveDataDeletion(AccountUid uid);
|
Result nsUnregisterNetworkServiceAccountWithUserSaveDataDeletion(AccountUid uid);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the \ref NsApplicationControlData for the specified application.
|
|
||||||
* @param[in] source Source, official sw uses ::NsApplicationControlSource_Storage.
|
|
||||||
* @param[in] application_id ApplicationId.
|
|
||||||
* @param[out] buffer \ref NsApplicationControlData
|
|
||||||
* @param[in] size Size of the buffer.
|
|
||||||
* @param[out] actual_size Actual output size.
|
|
||||||
*/
|
|
||||||
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RequestDownloadApplicationControlData
|
* @brief RequestDownloadApplicationControlData
|
||||||
* @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.
|
||||||
|
@ -46,6 +46,13 @@ Service* nsGetServiceSession_ApplicationManagerInterface(void) {
|
|||||||
return &g_nsAppManSrv;
|
return &g_nsAppManSrv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result nsGetReadOnlyApplicationControlDataInterface(Service* srv_out) {
|
||||||
|
if (hosversionBefore(5,1,0))
|
||||||
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
|
return _nsGetSession(&g_nsGetterSrv, srv_out, 7989);
|
||||||
|
}
|
||||||
|
|
||||||
Result nsGetECommerceInterface(Service* srv_out) {
|
Result nsGetECommerceInterface(Service* srv_out) {
|
||||||
if (hosversionBefore(4,0,0))
|
if (hosversionBefore(4,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
@ -278,6 +285,37 @@ static Result _nsCheckNifm(void) {
|
|||||||
return nifmIsAnyInternetRequestAccepted(nifmGetClientId()) ? 0 : MAKERESULT(16, 340);
|
return nifmIsAnyInternetRequestAccepted(nifmGetClientId()) ? 0 : MAKERESULT(16, 340);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IReadOnlyApplicationControlDataInterface
|
||||||
|
|
||||||
|
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size) {
|
||||||
|
Service srv={0}, *srv_ptr = &srv;
|
||||||
|
Result rc=0;
|
||||||
|
u32 cmd_id = 400;
|
||||||
|
if (hosversionAtLeast(5,1,0)) {
|
||||||
|
rc = nsGetReadOnlyApplicationControlDataInterface(&srv);
|
||||||
|
cmd_id = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
srv_ptr = &g_nsAppManSrv;
|
||||||
|
|
||||||
|
const struct {
|
||||||
|
u8 source;
|
||||||
|
u8 pad[7];
|
||||||
|
u64 application_id;
|
||||||
|
} in = { source, {0}, application_id };
|
||||||
|
|
||||||
|
u32 tmp=0;
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) rc = serviceDispatchInOut(srv_ptr, cmd_id, in, tmp,
|
||||||
|
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||||
|
.buffers = { { buffer, size } },
|
||||||
|
);
|
||||||
|
if (R_SUCCEEDED(rc) && actual_size) *actual_size = tmp;
|
||||||
|
|
||||||
|
serviceClose(&srv);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
// IECommerceInterface
|
// IECommerceInterface
|
||||||
|
|
||||||
Result nsRequestLinkDevice(AsyncResult *a, AccountUid uid) {
|
Result nsRequestLinkDevice(AsyncResult *a, AccountUid uid) {
|
||||||
@ -611,23 +649,6 @@ Result nsUnregisterNetworkServiceAccountWithUserSaveDataDeletion(AccountUid uid)
|
|||||||
return _nsCmdInUidNoOut(&g_nsAppManSrv, uid, 221);
|
return _nsCmdInUidNoOut(&g_nsAppManSrv, uid, 221);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size) {
|
|
||||||
const struct {
|
|
||||||
u8 source;
|
|
||||||
u8 pad[7];
|
|
||||||
u64 application_id;
|
|
||||||
} in = { source, {0}, application_id };
|
|
||||||
|
|
||||||
u32 tmp=0;
|
|
||||||
|
|
||||||
Result rc = serviceDispatchInOut(&g_nsAppManSrv, 400, in, tmp,
|
|
||||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
|
||||||
.buffers = { { buffer, size } },
|
|
||||||
);
|
|
||||||
if (R_SUCCEEDED(rc) && actual_size) *actual_size = tmp;
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result nsRequestDownloadApplicationControlData(AsyncResult *a, u64 application_id) {
|
Result nsRequestDownloadApplicationControlData(AsyncResult *a, u64 application_id) {
|
||||||
Result rc = _nsCheckNifm();
|
Result rc = _nsCheckNifm();
|
||||||
if (R_FAILED(rc)) return rc;
|
if (R_FAILED(rc)) return rc;
|
||||||
|
Loading…
Reference in New Issue
Block a user