Added NsApplicationControlSource for use with nsGetApplicationControlData. Fixed actual_size handling for nsGetApplicationControlData.

This commit is contained in:
yellows8 2019-09-26 18:42:47 -04:00
parent 653a1a6b9a
commit e483dc87a0
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 16 additions and 5 deletions

View File

@ -22,6 +22,13 @@ typedef enum {
NsShellEvent_Debug = 4, ///< Debug NsShellEvent_Debug = 4, ///< Debug
} NsShellEvent; } NsShellEvent;
/// ApplicationControlSource
typedef enum {
NsApplicationControlSource_CacheOnly = 0, ///< Returns data from cache.
NsApplicationControlSource_Storage = 1, ///< Returns data from storage if not present in cache.
NsApplicationControlSource_StorageOnly = 2, ///< Returns data from storage without using cache.
} NsApplicationControlSource;
/// BackgroundNetworkUpdateState /// BackgroundNetworkUpdateState
typedef enum { typedef enum {
NsBackgroundNetworkUpdateState_None = 0, ///< No sysupdate task exists. NsBackgroundNetworkUpdateState_None = 0, ///< No sysupdate task exists.
@ -140,7 +147,7 @@ Result nsListApplicationContentMetaStatus(u64 titleID, s32 index, NsApplicationC
* @param[in] size Size of the buffer. * @param[in] size Size of the buffer.
* @param[out] actual_size Actual output size. * @param[out] actual_size Actual output size.
*/ */
Result nsGetApplicationControlData(u8 flag, u64 titleID, NsApplicationControlData* buffer, size_t size, u64* actual_size); Result nsGetApplicationControlData(NsApplicationControlSource source, u64 titleID, NsApplicationControlData* buffer, size_t size, u64* actual_size);
/** /**
* @brief Returns the total storage capacity (used + free) from content manager services. * @brief Returns the total storage capacity (used + free) from content manager services.

View File

@ -186,16 +186,20 @@ Result nsListApplicationContentMetaStatus(u64 titleID, s32 index, NsApplicationC
); );
} }
Result nsGetApplicationControlData(u8 flag, u64 titleID, NsApplicationControlData* buffer, size_t size, u64* actual_size) { Result nsGetApplicationControlData(NsApplicationControlSource source, u64 titleID, NsApplicationControlData* buffer, size_t size, u64* actual_size) {
const struct { const struct {
u8 flag; u8 source;
u64 titleID; u64 titleID;
} in = { flag, titleID }; } in = { source, titleID };
return serviceDispatchInOut(&g_nsAppManSrv, 400, in, *actual_size, u32 tmp=0;
Result rc = serviceDispatchInOut(&g_nsAppManSrv, 400, in, tmp,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { buffer, size } }, .buffers = { { buffer, size } },
); );
if (R_SUCCEEDED(rc) && actual_size) *actual_size = tmp;
return rc;
} }
Result nsGetTotalSpaceSize(FsStorageId storage_id, u64 *size) { Result nsGetTotalSpaceSize(FsStorageId storage_id, u64 *size) {