ns: Actually check the required sysver for nsListApplicationContentMetaStatus. Updated param types for nsGetTotalSpaceSize/nsGetFreeSpaceSize + minor other improvements. Added support for the following:

* NsRequestServerStopper/nsRequestServerStopperClose().
* nsGetApplicationRecordUpdateSystemEvent, nsDeleteApplicationEntity, nsDeleteApplicationCompletely, nsDeleteRedundantApplicationEntity, nsIsApplicationEntityMovable, nsMoveApplicationEntity, nsCancelApplicationDownload, nsResumeApplicationDownload, nsCheckApplicationLaunchVersion, nsCalculateApplicationDownloadRequiredSize, nsCleanupSdCard, nsGetSdCardMountStatusChangedEvent, nsGetGameCardUpdateDetectionEvent, nsDisableApplicationAutoDelete, nsEnableApplicationAutoDelete, nsSetApplicationTerminateResult, nsClearApplicationTerminateResult, nsGetLastSdCardMountUnexpectedResult.
* nsGetRequestServerStopper, nsCancelApplicationApplyDelta, nsResumeApplicationApplyDelta, nsCalculateApplicationApplyDeltaRequiredSize, nsResumeAll, nsGetStorageSize, nsDeleteUserSystemSaveData, nsDeleteSaveData, nsUnregisterNetworkServiceAccount, nsUnregisterNetworkServiceAccountWithUserSaveDataDeletion, nsGetGameCardMountFailureEvent, nsIsGameCardInserted, nsEnsureGameCardAccess, nsGetLastGameCardMountFailureResult, nsListApplicationIdOnGameCard, nsTouchApplication, nsIsApplicationUpdateRequested, nsWithdrawApplicationUpdateRequest, nsIsAnyApplicationEntityInstalled, nsCleanupUnavailableAddOnContents, nsFormatSdCard, nsNeedsSystemUpdateToFormatSdCard, nsGetLastSdCardFormatUnexpectedResult, nsGetApplicationTerminateResult.
This commit is contained in:
yellows8 2020-02-10 12:14:40 -05:00
parent 52a892ca31
commit 68d6260d72
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 643 additions and 8 deletions

View File

@ -10,6 +10,8 @@
#include "../sf/service.h" #include "../sf/service.h"
#include "../services/ncm_types.h" #include "../services/ncm_types.h"
#include "../services/async.h" #include "../services/async.h"
#include "../services/acc.h"
#include "../services/fs.h"
#include "../kernel/event.h" #include "../kernel/event.h"
#include "../kernel/tmem.h" #include "../kernel/tmem.h"
@ -43,6 +45,11 @@ typedef enum {
NsLatestSystemUpdate_Unknown2 = 2, ///< Unknown. NsLatestSystemUpdate_Unknown2 = 2, ///< Unknown.
} NsLatestSystemUpdate; } NsLatestSystemUpdate;
/// RequestServerStopper
typedef struct {
Service s; ///< IRequestServerStopper
} NsRequestServerStopper;
/// SystemUpdateControl /// SystemUpdateControl
typedef struct { typedef struct {
Service s; ///< ISystemUpdateControl Service s; ///< ISystemUpdateControl
@ -163,19 +170,206 @@ Service* nsGetServiceSession_ApplicationManagerInterface(void);
*/ */
Result nsListApplicationRecord(NsApplicationRecord* records, s32 count, s32 entry_offset, s32* out_entrycount); Result nsListApplicationRecord(NsApplicationRecord* records, s32 count, s32 entry_offset, s32* out_entrycount);
/**
* @brief GetApplicationRecordUpdateSystemEvent
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=true.
*/
Result nsGetApplicationRecordUpdateSystemEvent(Event* out_event);
/**
* @brief DeleteApplicationEntity
* @param[in] application_id ApplicationId.
*/
Result nsDeleteApplicationEntity(u64 application_id);
/**
* @brief DeleteApplicationCompletely
* @param[in] application_id ApplicationId.
*/
Result nsDeleteApplicationCompletely(u64 application_id);
/**
* @brief DeleteRedundantApplicationEntity
*/
Result nsDeleteRedundantApplicationEntity(void);
/**
* @brief IsApplicationEntityMovable
* @param[in] application_id ApplicationId.
* @param[in] storage_id \ref NcmStorageId
* @param[out] out Output flag.
*/
Result nsIsApplicationEntityMovable(u64 application_id, NcmStorageId storage_id, bool *out);
/**
* @brief MoveApplicationEntity
* @param[in] application_id ApplicationId.
* @param[in] storage_id \ref NcmStorageId
*/
Result nsMoveApplicationEntity(u64 application_id, NcmStorageId storage_id);
/**
* @brief CancelApplicationDownload
* @param[in] application_id ApplicationId.
*/
Result nsCancelApplicationDownload(u64 application_id);
/**
* @brief ResumeApplicationDownload
* @param[in] application_id ApplicationId.
*/
Result nsResumeApplicationDownload(u64 application_id);
/**
* @brief CheckApplicationLaunchVersion
* @param[in] application_id ApplicationId.
*/
Result nsCheckApplicationLaunchVersion(u64 application_id);
/**
* @brief CalculateApplicationApplyDeltaRequiredSize
* @param[in] application_id ApplicationId.
* @param[out] storage_id Output \ref NcmStorageId.
* @param[out] size Output size.
*/
Result nsCalculateApplicationDownloadRequiredSize(u64 application_id, NcmStorageId *storage_id, s64 *size);
/**
* @brief CleanupSdCard
*/
Result nsCleanupSdCard(void);
/**
* @brief GetSdCardMountStatusChangedEvent
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=false.
*/
Result nsGetSdCardMountStatusChangedEvent(Event* out_event);
/** /**
* @brief Returns the total storage capacity (used + free) from content manager services. * @brief Returns the total storage capacity (used + free) from content manager services.
* @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard. * @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
* @param[out] size Pointer to output the total storage size to. * @param[out] size Pointer to output the total storage size to.
*/ */
Result nsGetTotalSpaceSize(NcmStorageId storage_id, u64 *size); Result nsGetTotalSpaceSize(NcmStorageId storage_id, s64 *size);
/** /**
* @brief Returns the available storage capacity from content manager services. * @brief Returns the available storage capacity from content manager services.
* @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard. * @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
* @param[out] size Pointer to output the free storage size to. * @param[out] size Pointer to output the free storage size to.
*/ */
Result nsGetFreeSpaceSize(NcmStorageId storage_id, u64 *size); Result nsGetFreeSpaceSize(NcmStorageId storage_id, s64 *size);
/**
* @brief GetGameCardUpdateDetectionEvent
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=false.
*/
Result nsGetGameCardUpdateDetectionEvent(Event* out_event);
/**
* @brief DisableApplicationAutoDelete
* @param[in] application_id ApplicationId.
*/
Result nsDisableApplicationAutoDelete(u64 application_id);
/**
* @brief EnableApplicationAutoDelete
* @param[in] application_id ApplicationId.
*/
Result nsEnableApplicationAutoDelete(u64 application_id);
/**
* @brief SetApplicationTerminateResult
* @param[in] application_id ApplicationId.
* @param[in] res Result.
*/
Result nsSetApplicationTerminateResult(u64 application_id, Result res);
/**
* @brief ClearApplicationTerminateResult
* @param[in] application_id ApplicationId.
*/
Result nsClearApplicationTerminateResult(u64 application_id);
/**
* @brief GetLastSdCardMountUnexpectedResult
*/
Result nsGetLastSdCardMountUnexpectedResult(void);
/**
* @brief Opens a \ref NsRequestServerStopper.
* @note Only available on [2.0.0+].
* @param[out] r \ref NsRequestServerStopper
*/
Result nsGetRequestServerStopper(NsRequestServerStopper *r);
/**
* @brief CancelApplicationApplyDelta
* @note Only available on [3.0.0+].
* @param[in] application_id ApplicationId.
*/
Result nsCancelApplicationApplyDelta(u64 application_id);
/**
* @brief ResumeApplicationApplyDelta
* @note Only available on [3.0.0+].
* @param[in] application_id ApplicationId.
*/
Result nsResumeApplicationApplyDelta(u64 application_id);
/**
* @brief CalculateApplicationApplyDeltaRequiredSize
* @note Only available on [3.0.0+].
* @param[in] application_id ApplicationId.
* @param[out] storage_id Output \ref NcmStorageId.
* @param[out] size Output size.
*/
Result nsCalculateApplicationApplyDeltaRequiredSize(u64 application_id, NcmStorageId *storage_id, s64 *size);
/**
* @brief ResumeAll
* @note Only available on [3.0.0+].
*/
Result nsResumeAll(void);
/**
* @brief Temporarily mounts the specified fs ContentStorage, then uses fs GetTotalSpaceSize/GetFreeSpaceSize with that mounted ContentStorage.
* @note Only available on [3.0.0+].
* @param[in] storage_id \ref NcmStorageId, must be ::NcmStorageId_BuiltInUser or ::NcmStorageId_SdCard.
* @param[out] total_space_size Output from GetTotalSpaceSize.
* @param[out] free_space_size Output from GetFreeSpaceSize.
*/
Result nsGetStorageSize(NcmStorageId storage_id, s64 *total_space_size, s64 *free_space_size);
/**
* @brief DeleteUserSystemSaveData
* @param[in] uid \ref AccountUid
* @param[in] system_save_data_id SystemSaveDataId
*/
Result nsDeleteUserSystemSaveData(AccountUid uid, u64 system_save_data_id);
/**
* @brief DeleteSaveData
* @note Only available on [6.0.0+].
* @param[in] save_data_space_id \ref FsSaveDataSpaceId
* @param[in] save_data_id SaveDataId
*/
Result nsDeleteSaveData(FsSaveDataSpaceId save_data_space_id, u64 save_data_id);
/**
* @brief UnregisterNetworkServiceAccount
* @param[in] uid \ref AccountUid
*/
Result nsUnregisterNetworkServiceAccount(AccountUid uid);
/**
* @brief UnregisterNetworkServiceAccountWithUserSaveDataDeletion
* @note Only available on [6.0.0+].
* @param[in] uid \ref AccountUid
*/
Result nsUnregisterNetworkServiceAccountWithUserSaveDataDeletion(AccountUid uid);
/** /**
* @brief Gets the \ref NsApplicationControlData for the specified application. * @brief Gets the \ref NsApplicationControlData for the specified application.
@ -187,8 +381,45 @@ Result nsGetFreeSpaceSize(NcmStorageId storage_id, u64 *size);
*/ */
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size); Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size);
/**
* @brief GetGameCardMountFailureEvent
* @note The Event must be closed by the user once finished with it.
* @note Only available on [3.0.0+].
* @param[out] out_event Output Event with autoclear=false.
*/
Result nsGetGameCardMountFailureEvent(Event* out_event);
/**
* @brief IsGameCardInserted
* @note Only available on [3.0.0+].
* @param[out] out Output flag.
*/
Result nsIsGameCardInserted(bool *out);
/**
* @brief EnsureGameCardAccess
* @note Only available on [3.0.0+].
*/
Result nsEnsureGameCardAccess(void);
/**
* @brief GetLastGameCardMountFailureResult
* @note Only available on [3.0.0+].
*/
Result nsGetLastGameCardMountFailureResult(void);
/**
* @brief ListApplicationIdOnGameCard
* @note Only available on [5.0.0+].
* @param[out] application_ids Output array of ApplicationIds.
* @param[in] count Size of the application_ids array in entries.
* @param[out] total_out Total output entries.
*/
Result nsListApplicationIdOnGameCard(u64 *application_ids, s32 count, s32 *total_out);
/** /**
* @brief Gets an listing of \ref NsApplicationContentMetaStatus. * @brief Gets an listing of \ref NsApplicationContentMetaStatus.
* @note Only available on [2.0.0+].
* @param[in] application_id ApplicationId. * @param[in] application_id ApplicationId.
* @param[in] index Starting entry index. * @param[in] index Starting entry index.
* @param[out] list Output array of \ref NsApplicationContentMetaStatus. * @param[out] list Output array of \ref NsApplicationContentMetaStatus.
@ -197,6 +428,64 @@ Result nsGetApplicationControlData(NsApplicationControlSource source, u64 applic
*/ */
Result nsListApplicationContentMetaStatus(u64 application_id, s32 index, NsApplicationContentMetaStatus* list, s32 count, s32* out_entrycount); Result nsListApplicationContentMetaStatus(u64 application_id, s32 index, NsApplicationContentMetaStatus* list, s32 count, s32* out_entrycount);
/**
* @brief TouchApplication
* @note Only available on [2.0.0+].
* @param[in] application_id ApplicationId.
*/
Result nsTouchApplication(u64 application_id);
/**
* @brief IsApplicationUpdateRequested
* @note Only available on [2.0.0+].
* @param[in] application_id ApplicationId.
* @param[out] flag Output flag, indicating whether out is valid.
* @param[out] out Output value.
*/
Result nsIsApplicationUpdateRequested(u64 application_id, bool *flag, u32 *out);
/**
* @brief WithdrawApplicationUpdateRequest
* @note Only available on [2.0.0+].
* @param[in] application_id ApplicationId.
*/
Result nsWithdrawApplicationUpdateRequest(u64 application_id);
/**
* @brief IsAnyApplicationEntityInstalled
* @note Only available on [2.0.0+].
* @param[in] application_id ApplicationId.
* @param[out] out Output flag.
*/
Result nsIsAnyApplicationEntityInstalled(u64 application_id, bool *out);
/**
* @brief CleanupUnavailableAddOnContents
* @note Only available on [6.0.0+].
* @param[in] application_id ApplicationId.
* @param[in] uid \ref AccountUid
*/
Result nsCleanupUnavailableAddOnContents(u64 application_id, AccountUid uid);
/**
* @brief FormatSdCard
* @note Only available on [2.0.0+].
*/
Result nsFormatSdCard(void);
/**
* @brief NeedsSystemUpdateToFormatSdCard
* @note Only available on [2.0.0+].
* @param[out] out Output flag.
*/
Result nsNeedsSystemUpdateToFormatSdCard(bool *out);
/**
* @brief GetLastSdCardFormatUnexpectedResult
* @note Only available on [2.0.0+].
*/
Result nsGetLastSdCardFormatUnexpectedResult(void);
/** /**
* @brief Generates a \ref NsSystemDeliveryInfo using the currently installed SystemUpdate meta. * @brief Generates a \ref NsSystemDeliveryInfo using the currently installed SystemUpdate meta.
* @note Only available on [4.0.0+]. * @note Only available on [4.0.0+].
@ -376,6 +665,25 @@ Result nsListNotCommittedContentMeta(NcmContentMetaKey *meta, s32 count, u64 app
*/ */
Result nsGetApplicationDeliveryInfoHash(const NsApplicationDeliveryInfo *info, s32 count, u8 *out_hash); Result nsGetApplicationDeliveryInfoHash(const NsApplicationDeliveryInfo *info, s32 count, u8 *out_hash);
/**
* @brief GetApplicationTerminateResult
* @note Only available on [6.0.0+].
* @param[in] application_id ApplicationId.
* @param[out] res Output Result.
*/
Result nsGetApplicationTerminateResult(u64 application_id, Result *res);
///@}
///@name IRequestServerStopper
///@{
/**
* @brief Close a \ref NsRequestServerStopper.
* @param r \ref NsRequestServerStopper
*/
void nsRequestServerStopperClose(NsRequestServerStopper *r);
///@} ///@}
///@name ns:vm ///@name ns:vm

View File

@ -109,6 +109,35 @@ static Result _nsCmdNoInOutU64(Service* srv, u64 *out, u32 cmd_id) {
return serviceDispatchOut(srv, cmd_id, *out); return serviceDispatchOut(srv, cmd_id, *out);
} }
static Result _nsCmdInU8U64NoOut(Service* srv, u8 in8, u64 in64, u32 cmd_id) {
const struct {
u8 in8;
u8 pad[7];
u64 in64;
} in = { in8, {0}, in64 };
return serviceDispatchIn(srv, cmd_id, in);
}
static Result _nsCmdInU64OutStorageIdS64(Service* srv, u64 inval, NcmStorageId *storage_id, s64 *outval, u32 cmd_id) {
struct {
u8 storage_id;
u8 pad[7];
s64 outval;
} out;
Result rc = serviceDispatchInOut(srv, cmd_id, inval, out);
if (R_SUCCEEDED(rc)) {
if (storage_id) *storage_id = out.storage_id;
if (outval) *outval = out.outval;
}
return rc;
}
static Result _nsCmdInUidNoOut(Service* srv, AccountUid uid, u32 cmd_id) {
return serviceDispatchIn(srv, cmd_id, uid);
}
static Result _nsCmdNoInOutSystemUpdateProgress(Service* srv, NsSystemUpdateProgress *out, u32 cmd_id) { static Result _nsCmdNoInOutSystemUpdateProgress(Service* srv, NsSystemUpdateProgress *out, u32 cmd_id) {
return serviceDispatchOut(srv, cmd_id, *out); return serviceDispatchOut(srv, cmd_id, *out);
} }
@ -175,19 +204,187 @@ Result nsListApplicationRecord(NsApplicationRecord* records, s32 count, s32 entr
); );
} }
Result nsGetTotalSpaceSize(NcmStorageId storage_id, u64 *size) { Result nsGetApplicationRecordUpdateSystemEvent(Event* out_event) {
return _nsCmdInU64OutU64(&g_nsAppManSrv, storage_id, size, 47); return _nsCmdGetEvent(&g_nsAppManSrv, out_event, true, 2);
} }
Result nsGetFreeSpaceSize(NcmStorageId storage_id, u64 *size) { Result nsDeleteApplicationEntity(u64 application_id) {
return _nsCmdInU64OutU64(&g_nsAppManSrv, storage_id, size, 48); return _nsCmdInU64(&g_nsAppManSrv, application_id, 4);
}
Result nsDeleteApplicationCompletely(u64 application_id) {
return _nsCmdInU64(&g_nsAppManSrv, application_id, 5);
}
Result nsDeleteRedundantApplicationEntity(void) {
return _nsCmdNoIO(&g_nsAppManSrv, 7);
}
Result nsIsApplicationEntityMovable(u64 application_id, NcmStorageId storage_id, bool *out) {
const struct {
u8 storage_id;
u8 pad[7];
u64 application_id;
} in = { storage_id, {0}, application_id };
u8 tmp=0;
Result rc = serviceDispatchInOut(&g_nsAppManSrv, 8, in, tmp);
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
return rc;
}
Result nsMoveApplicationEntity(u64 application_id, NcmStorageId storage_id) {
return _nsCmdInU8U64NoOut(&g_nsAppManSrv, storage_id, application_id, 9);
}
Result nsCancelApplicationDownload(u64 application_id) {
return _nsCmdInU64(&g_nsAppManSrv, application_id, 32);
}
Result nsResumeApplicationDownload(u64 application_id) {
return _nsCmdInU64(&g_nsAppManSrv, application_id, 33);
}
Result nsCheckApplicationLaunchVersion(u64 application_id) {
return _nsCmdInU64(&g_nsAppManSrv, application_id, 38);
}
Result nsCalculateApplicationDownloadRequiredSize(u64 application_id, NcmStorageId *storage_id, s64 *size) {
return _nsCmdInU64OutStorageIdS64(&g_nsAppManSrv, application_id, storage_id, size, 41);
}
Result nsCleanupSdCard(void) {
return _nsCmdNoIO(&g_nsAppManSrv, 42);
}
Result nsGetSdCardMountStatusChangedEvent(Event* out_event) {
return _nsCmdGetEvent(&g_nsAppManSrv, out_event, false, 44);
}
Result nsGetTotalSpaceSize(NcmStorageId storage_id, s64 *size) {
return _nsCmdInU64OutU64(&g_nsAppManSrv, storage_id, (u64*)size, 47);
}
Result nsGetFreeSpaceSize(NcmStorageId storage_id, s64 *size) {
return _nsCmdInU64OutU64(&g_nsAppManSrv, storage_id, (u64*)size, 48);
}
Result nsGetGameCardUpdateDetectionEvent(Event* out_event) {
return _nsCmdGetEvent(&g_nsAppManSrv, out_event, false, 52);
}
Result nsDisableApplicationAutoDelete(u64 application_id) {
return _nsCmdInU64(&g_nsAppManSrv, application_id, 53);
}
Result nsEnableApplicationAutoDelete(u64 application_id) {
return _nsCmdInU64(&g_nsAppManSrv, application_id, 54);
}
Result nsSetApplicationTerminateResult(u64 application_id, Result res) {
const struct {
Result res;
u32 pad;
u64 application_id;
} in = { res, 0, application_id };
return serviceDispatchIn(&g_nsAppManSrv, 56, in);
}
Result nsClearApplicationTerminateResult(u64 application_id) {
return _nsCmdInU64(&g_nsAppManSrv, application_id, 57);
}
Result nsGetLastSdCardMountUnexpectedResult(void) {
return _nsCmdNoIO(&g_nsAppManSrv, 58);
}
Result nsGetRequestServerStopper(NsRequestServerStopper *r) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsGetSession(&g_nsAppManSrv, &r->s, 65);
}
Result nsCancelApplicationApplyDelta(u64 application_id) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdInU64(&g_nsAppManSrv, application_id, 67);
}
Result nsResumeApplicationApplyDelta(u64 application_id) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdInU64(&g_nsAppManSrv, application_id, 68);
}
Result nsCalculateApplicationApplyDeltaRequiredSize(u64 application_id, NcmStorageId *storage_id, s64 *size) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdInU64OutStorageIdS64(&g_nsAppManSrv, application_id, storage_id, size, 69);
}
Result nsResumeAll(void) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdNoIO(&g_nsAppManSrv, 70);
}
Result nsGetStorageSize(NcmStorageId storage_id, s64 *total_space_size, s64 *free_space_size) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
struct {
s64 total_space_size;
s64 free_space_size;
} out;
u8 tmp = storage_id;
Result rc = serviceDispatchInOut(&g_nsAppManSrv, 71, tmp, out);
if (R_SUCCEEDED(rc)) {
if (total_space_size) *total_space_size = out.total_space_size;
if (free_space_size) *free_space_size = out.free_space_size;
}
return rc;
}
Result nsDeleteUserSystemSaveData(AccountUid uid, u64 system_save_data_id) {
const struct {
AccountUid uid;
u64 system_save_data_id;
} in = { uid, system_save_data_id };
return serviceDispatchIn(&g_nsAppManSrv, 210, in);
}
Result nsDeleteSaveData(FsSaveDataSpaceId save_data_space_id, u64 save_data_id) {
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdInU8U64NoOut(&g_nsAppManSrv, save_data_space_id, save_data_id, 211);
}
Result nsUnregisterNetworkServiceAccount(AccountUid uid) {
return _nsCmdInUidNoOut(&g_nsAppManSrv, uid, 220);
}
Result nsUnregisterNetworkServiceAccountWithUserSaveDataDeletion(AccountUid uid) {
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdInUidNoOut(&g_nsAppManSrv, uid, 221);
} }
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size) { Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size) {
const struct { const struct {
u8 source; u8 source;
u8 pad[7];
u64 application_id; u64 application_id;
} in = { source, application_id }; } in = { source, {0}, application_id };
u32 tmp=0; u32 tmp=0;
@ -199,11 +396,53 @@ Result nsGetApplicationControlData(NsApplicationControlSource source, u64 applic
return rc; return rc;
} }
Result nsGetGameCardMountFailureEvent(Event* out_event) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdGetEvent(&g_nsAppManSrv, out_event, false, 505);
}
Result nsIsGameCardInserted(bool *out) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdNoInOutBool(&g_nsAppManSrv, out, 506);
}
Result nsEnsureGameCardAccess(void) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdNoIO(&g_nsAppManSrv, 507);
}
Result nsGetLastGameCardMountFailureResult(void) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdNoIO(&g_nsAppManSrv, 508);
}
Result nsListApplicationIdOnGameCard(u64 *application_ids, s32 count, s32 *total_out) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchOut(&g_nsAppManSrv, 509, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { application_ids, count*sizeof(u64) } },
);
}
Result nsListApplicationContentMetaStatus(u64 application_id, s32 index, NsApplicationContentMetaStatus* list, s32 count, s32* out_entrycount) { Result nsListApplicationContentMetaStatus(u64 application_id, s32 index, NsApplicationContentMetaStatus* list, s32 count, s32* out_entrycount) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct { const struct {
s32 index; s32 index;
u32 pad;
u64 application_id; u64 application_id;
} in = { index, application_id }; } in = { index, 0, application_id };
return serviceDispatchInOut(&g_nsAppManSrv, 601, in, *out_entrycount, return serviceDispatchInOut(&g_nsAppManSrv, 601, in, *out_entrycount,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
@ -211,6 +450,81 @@ Result nsListApplicationContentMetaStatus(u64 application_id, s32 index, NsAppli
); );
} }
Result nsTouchApplication(u64 application_id) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdInU64(&g_nsAppManSrv, application_id, 904);
}
Result nsIsApplicationUpdateRequested(u64 application_id, bool *flag, u32 *out) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
struct {
u8 flag;
u8 pad[3];
u32 out;
} tmpout;
Result rc = serviceDispatchInOut(&g_nsAppManSrv, 906, application_id, tmpout);
if (R_SUCCEEDED(rc)) {
if (flag) *flag = tmpout.flag & 1;
if (out) *out = tmpout.out;
}
return rc;
}
Result nsWithdrawApplicationUpdateRequest(u64 application_id) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdInU64(&g_nsAppManSrv, application_id, 907);
}
Result nsIsAnyApplicationEntityInstalled(u64 application_id, bool *out) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u8 tmp=0;
Result rc = serviceDispatchInOut(&g_nsAppManSrv, 1300, application_id, tmp);
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
return rc;
}
Result nsCleanupUnavailableAddOnContents(u64 application_id, AccountUid uid) {
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u64 application_id;
AccountUid uid;
} in = { application_id, uid };
return serviceDispatchIn(&g_nsAppManSrv, 1309, in);
}
Result nsFormatSdCard(void) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdNoIO(&g_nsAppManSrv, 1500);
}
Result nsNeedsSystemUpdateToFormatSdCard(bool *out) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdNoInOutBool(&g_nsAppManSrv, out, 1501);
}
Result nsGetLastSdCardFormatUnexpectedResult(void) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdNoIO(&g_nsAppManSrv, 1502);
}
Result nsGetSystemDeliveryInfo(NsSystemDeliveryInfo *info) { Result nsGetSystemDeliveryInfo(NsSystemDeliveryInfo *info) {
if (hosversionBefore(4,0,0)) if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -482,6 +796,19 @@ Result nsGetApplicationDeliveryInfoHash(const NsApplicationDeliveryInfo *info, s
return rc; return rc;
} }
Result nsGetApplicationTerminateResult(u64 application_id, Result *res) {
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchInOut(&g_nsAppManSrv, 2100, application_id, *res);
}
// IRequestServerStopper
void nsRequestServerStopperClose(NsRequestServerStopper *r) {
serviceClose(&r->s);
}
// ns:vm // ns:vm
NX_GENERATE_SERVICE_GUARD(nsvm); NX_GENERATE_SERVICE_GUARD(nsvm);