ns: Added support for nsDeleteUserSaveDataAll()/NsProgressMonitorForDeleteUserSaveDataAll. Added struct NsProgressForDeleteUserSaveDataAll.

This commit is contained in:
yellows8 2020-02-25 15:07:47 -05:00
parent 524e910268
commit 4a493775b4
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 106 additions and 0 deletions

View File

@ -51,6 +51,11 @@ typedef struct {
Service s; ///< IRequestServerStopper Service s; ///< IRequestServerStopper
} NsRequestServerStopper; } NsRequestServerStopper;
/// ProgressMonitorForDeleteUserSaveDataAll
typedef struct {
Service s; ///< IProgressMonitorForDeleteUserSaveDataAll
} NsProgressMonitorForDeleteUserSaveDataAll;
/// ProgressAsyncResult /// ProgressAsyncResult
typedef struct { typedef struct {
Service s; ///< IProgressAsyncResult Service s; ///< IProgressAsyncResult
@ -89,6 +94,11 @@ typedef struct {
u8 unk_x11[7]; ///< Unknown. u8 unk_x11[7]; ///< Unknown.
} NsApplicationRecord; } NsApplicationRecord;
/// ProgressForDeleteUserSaveDataAll
typedef struct {
u8 unk_x0[0x28]; ///< Unknown.
} NsProgressForDeleteUserSaveDataAll;
/// ApplicationViewDeprecated. The below comments are for the \ref NsApplicationView to NsApplicationViewDeprecated conversion done by \ref nsGetApplicationViewDeprecated on newer system-versions. /// ApplicationViewDeprecated. The below comments are for the \ref NsApplicationView to NsApplicationViewDeprecated conversion done by \ref nsGetApplicationViewDeprecated on newer system-versions.
typedef struct { typedef struct {
u64 application_id; ///< Same as NsApplicationView::application_id. u64 application_id; ///< Same as NsApplicationView::application_id.
@ -432,6 +442,13 @@ Result nsGetStorageSize(NcmStorageId storage_id, s64 *total_space_size, s64 *fre
*/ */
Result nsRequestUpdateApplication2(AsyncResult *a, u64 application_id); Result nsRequestUpdateApplication2(AsyncResult *a, u64 application_id);
/**
* @brief DeleteUserSaveDataAll
* @param[in] p \ref NsProgressMonitorForDeleteUserSaveDataAll
* @param[in] uid \ref AccountUid
*/
Result nsDeleteUserSaveDataAll(NsProgressMonitorForDeleteUserSaveDataAll *p, AccountUid uid);
/** /**
* @brief DeleteUserSystemSaveData * @brief DeleteUserSystemSaveData
* @param[in] uid \ref AccountUid * @param[in] uid \ref AccountUid
@ -932,6 +949,45 @@ void nsRequestServerStopperClose(NsRequestServerStopper *r);
///@} ///@}
///@name IProgressMonitorForDeleteUserSaveDataAll
///@{
/**
* @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).
* @note Cancelling the operation before it's finished is not supported by \ref NsProgressMonitorForDeleteUserSaveDataAll.
* @param p \ref NsProgressMonitorForDeleteUserSaveDataAll
*/
Result nsProgressMonitorForDeleteUserSaveDataAllClose(NsProgressMonitorForDeleteUserSaveDataAll *p);
/**
* @brief GetSystemEvent
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=false.
*/
Result nsProgressMonitorForDeleteUserSaveDataAllGetSystemEvent(NsProgressMonitorForDeleteUserSaveDataAll *p, Event* out_event);
/**
* @brief IsFinished
* @param p \ref NsProgressMonitorForDeleteUserSaveDataAll
* @param[out] out Whether the operation finished.
*/
Result nsProgressMonitorForDeleteUserSaveDataAllIsFinished(NsProgressMonitorForDeleteUserSaveDataAll *p, bool *out);
/**
* @brief GetResult
* @param p \ref NsProgressMonitorForDeleteUserSaveDataAll
*/
Result nsProgressMonitorForDeleteUserSaveDataAllGetResult(NsProgressMonitorForDeleteUserSaveDataAll *p);
/**
* @brief GetProgress
* @param p \ref NsProgressMonitorForDeleteUserSaveDataAll
* @param[out] progress Output \ref NsProgressForDeleteUserSaveDataAll.
*/
Result nsProgressMonitorForDeleteUserSaveDataAllGetProgress(NsProgressMonitorForDeleteUserSaveDataAll *p, NsProgressForDeleteUserSaveDataAll *progress);
///@}
///@name IProgressAsyncResult ///@name IProgressAsyncResult
///@{ ///@{

View File

@ -419,6 +419,13 @@ Result nsRequestUpdateApplication2(AsyncResult *a, u64 application_id) {
return _nsCmdInU64OutAsyncResult(&g_nsAppManSrv, a, application_id, 85); return _nsCmdInU64OutAsyncResult(&g_nsAppManSrv, a, application_id, 85);
} }
Result nsDeleteUserSaveDataAll(NsProgressMonitorForDeleteUserSaveDataAll *p, AccountUid uid) {
return serviceDispatchIn(&g_nsAppManSrv, 201, uid,
.out_num_objects = 1,
.out_objects = &p->s,
);
}
Result nsDeleteUserSystemSaveData(AccountUid uid, u64 system_save_data_id) { Result nsDeleteUserSystemSaveData(AccountUid uid, u64 system_save_data_id) {
const struct { const struct {
AccountUid uid; AccountUid uid;
@ -1191,6 +1198,49 @@ void nsRequestServerStopperClose(NsRequestServerStopper *r) {
serviceClose(&r->s); serviceClose(&r->s);
} }
// IProgressMonitorForDeleteUserSaveDataAll
Result nsProgressMonitorForDeleteUserSaveDataAllClose(NsProgressMonitorForDeleteUserSaveDataAll *p) {
Result rc=0;
if (serviceIsActive(&p->s)) {
bool finished=0;
rc = nsProgressMonitorForDeleteUserSaveDataAllIsFinished(p, &finished);
if (R_SUCCEEDED(rc) && !finished) rc = MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen);
}
if (R_SUCCEEDED(rc)) serviceClose(&p->s);
return rc;
}
Result nsProgressMonitorForDeleteUserSaveDataAllGetSystemEvent(NsProgressMonitorForDeleteUserSaveDataAll *p, Event* out_event) {
if (!serviceIsActive(&p->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nsCmdGetEvent(&p->s, out_event, false, 0);
}
Result nsProgressMonitorForDeleteUserSaveDataAllIsFinished(NsProgressMonitorForDeleteUserSaveDataAll *p, bool *out) {
if (!serviceIsActive(&p->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nsCmdNoInOutBool(&p->s, out, 1);
}
Result nsProgressMonitorForDeleteUserSaveDataAllGetResult(NsProgressMonitorForDeleteUserSaveDataAll *p) {
if (!serviceIsActive(&p->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nsCmdNoIO(&p->s, 2);
}
Result nsProgressMonitorForDeleteUserSaveDataAllGetProgress(NsProgressMonitorForDeleteUserSaveDataAll *p, NsProgressForDeleteUserSaveDataAll *progress) {
if (!serviceIsActive(&p->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return serviceDispatchOut(&p->s, 10, *progress);
}
// IProgressAsyncResult // IProgressAsyncResult
void nsProgressAsyncResultClose(NsProgressAsyncResult *a) { void nsProgressAsyncResultClose(NsProgressAsyncResult *a) {