applet: Updated for using AccountUid and improved docs.

This commit is contained in:
yellows8 2019-10-08 21:05:00 -04:00
parent 3e5c129431
commit 3a1459cf4c
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 30 additions and 28 deletions

View File

@ -13,6 +13,7 @@
#include "../services/caps.h"
#include "../services/pm.h"
#include "../services/fs.h"
#include "../services/acc.h"
#include "../kernel/tmem.h"
#include "../kernel/event.h"
#include "../nacp.h"
@ -1423,13 +1424,13 @@ Result appletQueryApplicationPlayStatistics(PdmApplicationPlayStatistics *stats,
/**
* @brief Same as \ref appletQueryApplicationPlayStatistics except this gets playstats specific to the input userID.
* @note Only available with AppletType_*Application on [6.0.0+].
* @param userID userID
* @param stats Output \ref PdmApplicationPlayStatistics array.
* @param titleIDs Input titleIDs array.
* @param count Total entries in the input/output arrays.
* @param total_out Total output entries.
* @param[in] uid \ref AccountUid
* @param[out] stats Output \ref PdmApplicationPlayStatistics array.
* @param[in] titleIDs Input titleIDs array.
* @param[in] count Total entries in the input/output arrays.
* @param[out] total_out Total output entries.
*/
Result appletQueryApplicationPlayStatisticsByUid(u128 userID, PdmApplicationPlayStatistics *stats, const u64 *titleIDs, s32 count, s32 *total_out);
Result appletQueryApplicationPlayStatisticsByUid(AccountUid *uid, PdmApplicationPlayStatistics *stats, const u64 *titleIDs, s32 count, s32 *total_out);
/**
* @brief Launches Application title {current_titleID}+programIndex. This will enter an infinite-sleep-loop on success.
@ -1540,12 +1541,12 @@ Result appletGetHomeButtonWriterLockAccessor(AppletLockAccessor *a);
/**
* @brief PopRequestLaunchApplicationForDebug
* @note Only available with AppletType_SystemApplet on [6.0.0+].
* @param[out] userIDs Output array of userIDs.
* @param[out] userIDs Output array of \ref AccountUid.
* @param[in] count Size of the userID array in entries, must be at least the size stored in state.
* @param[out] titleID Output Application titleID.
* @param[out] total_out Total output userID entries.
*/
Result appletPopRequestLaunchApplicationForDebug(u128 *userIDs, s32 count, u64 *titleID, s32 *total_out);
Result appletPopRequestLaunchApplicationForDebug(AccountUid *userIDs, s32 count, u64 *titleID, s32 *total_out);
/**
* @brief Launches DevMenu and the dev Overlay-applet. This will enter an infinite-sleep-loop on success.
@ -1782,11 +1783,11 @@ Result appletApplicationGetApplicationLaunchRequestInfo(AppletApplication *a, Ap
* @brief SetUsers for the Application.
* @note Only available on [6.0.0+].
* @param a \ref AppletApplication
* @param[in] userIDs Input array of userIDs.
* @param[in] userIDs Input array of \ref AccountUid.
* @param[in] count Size of the userID array in entries, must be <=ACC_USER_LIST_SIZE.
* @param[in] flag When this flag is true, this just clears the users_available state flag to 0 and returns.
*/
Result appletApplicationSetUsers(AppletApplication *a, const u128 *userIDs, s32 count, bool flag);
Result appletApplicationSetUsers(AppletApplication *a, const AccountUid *userIDs, s32 count, bool flag);
/**
* @brief CheckRightsEnvironmentAvailable.
@ -1809,11 +1810,11 @@ Result appletApplicationGetNsRightsEnvironmentHandle(AppletApplication *a, u64 *
* @note Only available on [6.0.0+].
* @note qlaunch only uses 1 userID with this.
* @param a \ref AppletApplication
* @param[out] userIDs Output array of userIDs.
* @param[out] userIDs Output array of \ref AccountUid.
* @param[in] count Size of the userID array in entries, must be at least the size stored in state.
* @param[out] total_out Total output entries.
*/
Result appletApplicationGetDesirableUids(AppletApplication *a, u128 *userIDs, s32 count, s32 *total_out);
Result appletApplicationGetDesirableUids(AppletApplication *a, AccountUid *userIDs, s32 count, s32 *total_out);
/**
* @brief ReportApplicationExitTimeout.
@ -2037,12 +2038,12 @@ Result appletUnreserveResourceForMovieOperation(void);
/**
* @brief Gets an array of userIDs for the MainApplet AvailableUsers.
* @note Only available with AppletType_LibraryApplet on [6.0.0+].
* @param[out] userIDs Output array of userIDs.
* @param[out] userIDs Output array of \ref AccountUid.
* @param[in] count Size of the userID array in entries, must be at least ACC_USER_LIST_SIZE.
* @param[out] flag When true, this indicates that no users are available.
* @param[out] total_out Total output entries. This is -1 when flag is true.
*/
Result appletGetMainAppletAvailableUsers(u128 *userIDs, s32 count, bool *flag, s32 *total_out);
Result appletGetMainAppletAvailableUsers(AccountUid *userIDs, s32 count, bool *flag, s32 *total_out);
///@}
@ -2209,13 +2210,13 @@ Result appletInvalidateTransitionLayer(void);
* @brief Requests to launch the specified Application, with the specified users.
* @note Only available on [6.0.0+].
* @param[in] titleID Application titleID.
* @param[in] userIDs Input array of userIDs.
* @param[in] userIDs Input array of \ref AccountUid.
* @param[in] total_userIDs Total input userIDs, must be <=ACC_USER_LIST_SIZE.
* @param[in] flag Whether to use the specified buffer to create a storage which will be pushed for ::AppletLaunchParameterKind_UserChannel.
* @param[in] buffer Buffer containing the above storage data.
* @param[in] size Size of the storage buffer.
*/
Result appletRequestLaunchApplicationWithUserAndArgumentForDebug(u64 titleID, u128 *userIDs, size_t total_userIDs, bool flag, const void* buffer, size_t size);
Result appletRequestLaunchApplicationWithUserAndArgumentForDebug(u64 titleID, AccountUid *userIDs, size_t total_userIDs, bool flag, const void* buffer, size_t size);
/**
* @brief Gets the \ref AppletResourceUsageInfo.

View File

@ -9,6 +9,7 @@
#include "services/caps.h"
#include "services/pm.h"
#include "services/fs.h"
#include "services/acc.h"
#include "runtime/env.h"
#include "runtime/hosversion.h"
#include "nacp.h"
@ -2167,14 +2168,14 @@ Result appletQueryApplicationPlayStatistics(PdmApplicationPlayStatistics *stats,
);
}
Result appletQueryApplicationPlayStatisticsByUid(u128 userID, PdmApplicationPlayStatistics *stats, const u64 *titleIDs, s32 count, s32 *total_out) {
Result appletQueryApplicationPlayStatisticsByUid(AccountUid *uid, PdmApplicationPlayStatistics *stats, const u64 *titleIDs, s32 count, s32 *total_out) {
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication())
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
serviceAssumeDomain(&g_appletIFunctions);
return serviceDispatchInOut(&g_appletIFunctions, 111, userID, *total_out,
return serviceDispatchInOut(&g_appletIFunctions, 111, *uid, *total_out,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out,
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
@ -2256,7 +2257,7 @@ IPC_MAKE_CMD_IMPL_INITEXPR(Result appletPopFromGeneralChannel(AppletStorage *s),
IPC_MAKE_CMD_IMPL_INITEXPR(Result appletGetPopFromGeneralChannelEvent(Event *out_event), &g_appletIFunctions, 21, _appletGetEvent, __nx_applet_type != AppletType_SystemApplet, out_event, false)
IPC_MAKE_CMD_IMPL_INITEXPR(Result appletGetHomeButtonWriterLockAccessor(AppletLockAccessor *a), &g_appletIFunctions, 30, _appletGetHomeButtonRwLockAccessor, __nx_applet_type != AppletType_SystemApplet, a)
Result appletPopRequestLaunchApplicationForDebug(u128 *userIDs, s32 count, u64 *titleID, s32 *total_out) {
Result appletPopRequestLaunchApplicationForDebug(AccountUid *userIDs, s32 count, u64 *titleID, s32 *total_out) {
if (__nx_applet_type != AppletType_SystemApplet)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (hosversionBefore(6,0,0))
@ -2270,7 +2271,7 @@ Result appletPopRequestLaunchApplicationForDebug(u128 *userIDs, s32 count, u64 *
serviceAssumeDomain(&g_appletIFunctions);
Result rc = serviceDispatchOut(&g_appletIFunctions, 100, out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { userIDs, count*sizeof(u128) } },
.buffers = { { userIDs, count*sizeof(AccountUid) } },
);
if (R_SUCCEEDED(rc) && titleID) *titleID = out.titleID;
if (R_SUCCEEDED(rc) && total_out) *total_out = out.total_out;
@ -2436,7 +2437,7 @@ Result appletApplicationGetApplicationLaunchRequestInfo(AppletApplication *a, Ap
return serviceDispatchOut(&a->s, 124, *out);
}
Result appletApplicationSetUsers(AppletApplication *a, const u128 *userIDs, s32 count, bool flag) {
Result appletApplicationSetUsers(AppletApplication *a, const AccountUid *userIDs, s32 count, bool flag) {
if (!serviceIsActive(&a->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (hosversionBefore(6,0,0))
@ -2446,14 +2447,14 @@ Result appletApplicationSetUsers(AppletApplication *a, const u128 *userIDs, s32
serviceAssumeDomain(&a->s);
return serviceDispatchIn(&a->s, 130, tmp,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
.buffers = { { userIDs, count*sizeof(u128) } },
.buffers = { { userIDs, count*sizeof(AccountUid) } },
);
}
IPC_MAKE_CMD_IMPL_HOSVER(Result appletApplicationCheckRightsEnvironmentAvailable(AppletApplication *a, bool *out), &a->s, 131, _appletCmdNoInOutBool, (6,0,0), out)
IPC_MAKE_CMD_IMPL_HOSVER(Result appletApplicationGetNsRightsEnvironmentHandle(AppletApplication *a, u64 *handle), &a->s, 132, _appletCmdNoInOut64, (6,0,0), handle)
Result appletApplicationGetDesirableUids(AppletApplication *a, u128 *userIDs, s32 count, s32 *total_out) {
Result appletApplicationGetDesirableUids(AppletApplication *a, AccountUid *userIDs, s32 count, s32 *total_out) {
if (!serviceIsActive(&a->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (hosversionBefore(6,0,0))
@ -2462,7 +2463,7 @@ Result appletApplicationGetDesirableUids(AppletApplication *a, u128 *userIDs, s3
serviceAssumeDomain(&a->s);
return serviceDispatchOut(&a->s, 140, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { userIDs, count*sizeof(u128) } },
.buffers = { { userIDs, count*sizeof(AccountUid) } },
);
}
@ -2538,7 +2539,7 @@ IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletCreateGameMovieTrimmer(Service* s
IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletReserveResourceForMovieOperation(void), &g_appletILibraryAppletSelfAccessor, 101, _appletCmdNoIO, __nx_applet_type != AppletType_LibraryApplet, (5,0,0))
IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletUnreserveResourceForMovieOperation(void), &g_appletILibraryAppletSelfAccessor, 102, _appletCmdNoIO, __nx_applet_type != AppletType_LibraryApplet, (5,0,0))
Result appletGetMainAppletAvailableUsers(u128 *userIDs, s32 count, bool *flag, s32 *total_out) {
Result appletGetMainAppletAvailableUsers(AccountUid *userIDs, s32 count, bool *flag, s32 *total_out) {
if (__nx_applet_type != AppletType_LibraryApplet)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (hosversionBefore(6,0,0))
@ -2552,7 +2553,7 @@ Result appletGetMainAppletAvailableUsers(u128 *userIDs, s32 count, bool *flag, s
serviceAssumeDomain(&g_appletILibraryAppletSelfAccessor);
Result rc = serviceDispatchOut(&g_appletILibraryAppletSelfAccessor, 110, out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { userIDs, count*sizeof(u128) } },
.buffers = { { userIDs, count*sizeof(AccountUid) } },
);
if (R_SUCCEEDED(rc) && flag) *flag = out.flag!=0;
if (R_SUCCEEDED(rc) && total_out) *total_out = out.total_out;
@ -2650,7 +2651,7 @@ IPC_MAKE_CMD_IMPL(Result appletOpenMainApplication(AppletApplication *a),
IPC_MAKE_CMD_IMPL(Result appletPerformSystemButtonPressing(AppletSystemButtonType type), &g_appletIDebugFunctions, 10, _appletCmdInU32, type)
IPC_MAKE_CMD_IMPL(Result appletInvalidateTransitionLayer(void), &g_appletIDebugFunctions, 20, _appletCmdNoIO)
Result appletRequestLaunchApplicationWithUserAndArgumentForDebug(u64 titleID, u128 *userIDs, size_t total_userIDs, bool flag, const void* buffer, size_t size) {
Result appletRequestLaunchApplicationWithUserAndArgumentForDebug(u64 titleID, AccountUid *userIDs, size_t total_userIDs, bool flag, const void* buffer, size_t size) {
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -2666,7 +2667,7 @@ Result appletRequestLaunchApplicationWithUserAndArgumentForDebug(u64 titleID, u1
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
},
.buffers = {
{ userIDs, total_userIDs*sizeof(u128) },
{ userIDs, total_userIDs*sizeof(AccountUid) },
{ buffer, size },
},
);