pdm: Renamed PdmApplicationEvent to PdmAppletEvent, and renamed pdmqryQueryApplicationEvent to pdmqryQueryAppletEvent. Renamed *entryindex fields in various structs to *entry_index. Updated param types and minor param name adjustments.

This commit is contained in:
yellows8 2019-10-18 16:52:13 -04:00
parent 3c610fb2cb
commit 5f5d4c9785
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 64 additions and 64 deletions

View File

@ -42,24 +42,24 @@ typedef enum {
/// See \ref pdmPlayTimestampToPosix. /// See \ref pdmPlayTimestampToPosix.
typedef struct { typedef struct {
u64 titleID; ///< Application titleID. u64 titleID; ///< Application titleID.
u32 entryindex; ///< Entry index. u32 entry_index; ///< Entry index.
u32 timestampUser; ///< See PdmPlayEvent::timestampUser, with the above timestamp format. u32 timestampUser; ///< See PdmPlayEvent::timestampUser, with the above timestamp format.
u32 timestampNetwork; ///< See PdmPlayEvent::timestampNetwork, with the above timestamp format. u32 timestampNetwork; ///< See PdmPlayEvent::timestampNetwork, with the above timestamp format.
u8 eventType; ///< \ref PdmAppletEventType u8 eventType; ///< \ref PdmAppletEventType
u8 pad[3]; ///< Padding. u8 pad[3]; ///< Padding.
} PdmApplicationEvent; } PdmAppletEvent;
/// PlayStatistics /// PlayStatistics
typedef struct { typedef struct {
u64 titleID; ///< Application titleID. u64 titleID; ///< Application titleID.
u32 first_entryindex; ///< Entry index for the first time the title was played. u32 first_entry_index; ///< Entry index for the first time the title was played.
u32 first_timestampUser; ///< See PdmApplicationEvent::timestampUser. This is for the first time the title was played. u32 first_timestampUser; ///< See PdmAppletEvent::timestampUser. This is for the first time the title was played.
u32 first_timestampNetwork; ///< See PdmApplicationEvent::timestampNetwork. This is for the first time the title was played. u32 first_timestampNetwork; ///< See PdmAppletEvent::timestampNetwork. This is for the first time the title was played.
u32 last_entryindex; ///< Entry index for the last time the title was played. u32 last_entry_index; ///< Entry index for the last time the title was played.
u32 last_timestampUser; ///< See PdmApplicationEvent::timestampUser. This is for the last time the title was played. u32 last_timestampUser; ///< See PdmAppletEvent::timestampUser. This is for the last time the title was played.
u32 last_timestampNetwork; ///< See PdmApplicationEvent::timestampNetwork. This is for the last time the title was played. u32 last_timestampNetwork; ///< See PdmAppletEvent::timestampNetwork. This is for the last time the title was played.
u32 playtimeMinutes; ///< Total play-time in minutes. u32 playtimeMinutes; ///< Total play-time in minutes.
u32 totalLaunches; ///< Total times the application title was launched. u32 totalLaunches; ///< Total times the application title was launched.
@ -69,8 +69,8 @@ typedef struct {
/// This contains data from the last time the title was played. /// This contains data from the last time the title was played.
typedef struct { typedef struct {
u64 titleID; ///< Application titleID. u64 titleID; ///< Application titleID.
u32 timestampUser; ///< See PdmApplicationEvent::timestampUser. u32 timestampUser; ///< See PdmAppletEvent::timestampUser.
u32 timestampNetwork; ///< See PdmApplicationEvent::timestampNetwork. u32 timestampNetwork; ///< See PdmAppletEvent::timestampNetwork.
u32 lastPlayedMinutes; ///< Total minutes since the title was last played. u32 lastPlayedMinutes; ///< Total minutes since the title was last played.
u8 flag; ///< Flag indicating whether the above field is set. u8 flag; ///< Flag indicating whether the above field is set.
u8 pad[3]; ///< Padding. u8 pad[3]; ///< Padding.
@ -133,8 +133,8 @@ typedef struct {
/// AccountEvent /// AccountEvent
typedef struct { typedef struct {
AccountUid userID; ///< \ref AccountUid AccountUid uid; ///< \ref AccountUid
u32 entryindex; ///< Entry index. u32 entry_index; ///< Entry index.
u8 pad[4]; ///< Padding. u8 pad[4]; ///< Padding.
u64 timestampUser; ///< See PdmPlayEvent::timestampUser. u64 timestampUser; ///< See PdmPlayEvent::timestampUser.
u64 timestampNetwork; ///< See PdmPlayEvent::timestampNetwork. u64 timestampNetwork; ///< See PdmPlayEvent::timestampNetwork.
@ -165,13 +165,13 @@ void pdmqryExit(void);
Service* pdmqryGetServiceSession(void); Service* pdmqryGetServiceSession(void);
/** /**
* @brief Gets a list of \ref PdmApplicationEvent. * @brief Gets a list of \ref PdmAppletEvent.
* @param[in] entryindex Start entry index. * @param[in] entry_index Start entry index.
* @param[out] events Output \ref PdmApplicationEvent array. * @param[out] events Output \ref PdmAppletEvent array.
* @param[in] count Max entries in the output array. * @param[in] count Max entries in the output array.
* @param[out] total_out Total output entries. * @param[out] total_out Total output entries.
*/ */
Result pdmqryQueryApplicationEvent(u32 entryindex, PdmApplicationEvent *events, s32 count, s32 *total_out); Result pdmqryQueryAppletEvent(s32 entry_index, PdmAppletEvent *events, s32 count, s32 *total_out);
/** /**
* @brief Gets \ref PdmPlayStatistics for the specified titleID. * @brief Gets \ref PdmPlayStatistics for the specified titleID.
@ -183,10 +183,10 @@ Result pdmqryQueryPlayStatisticsByApplicationId(u64 titleID, PdmPlayStatistics *
/** /**
* @brief Gets \ref PdmPlayStatistics for the specified titleID and account userID. * @brief Gets \ref PdmPlayStatistics for the specified titleID and account userID.
* @param[in] titleID Application titleID. * @param[in] titleID Application titleID.
* @param[in] userID \ref AccountUid * @param[in] uid \ref AccountUid
* @param[out] stats \ref PdmPlayStatistics * @param[out] stats \ref PdmPlayStatistics
*/ */
Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(u64 titleID, AccountUid *userID, PdmPlayStatistics *stats); Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(u64 titleID, AccountUid *uid, PdmPlayStatistics *stats);
/** /**
* @brief Gets \ref PdmLastPlayTime for the specified titles. * @brief Gets \ref PdmLastPlayTime for the specified titles.
@ -199,59 +199,59 @@ Result pdmqryQueryLastPlayTime(PdmLastPlayTime *playtimes, const u64 *titleIDs,
/** /**
* @brief Gets a list of \ref PdmPlayEvent. * @brief Gets a list of \ref PdmPlayEvent.
* @param[in] entryindex Start entry index. * @param[in] entry_index Start entry index.
* @param[out] events Output \ref PdmPlayEvent array. * @param[out] events Output \ref PdmPlayEvent array.
* @param[in] count Max entries in the output array. * @param[in] count Max entries in the output array.
* @param[out] total_out Total output entries. * @param[out] total_out Total output entries.
*/ */
Result pdmqryQueryPlayEvent(u32 entryindex, PdmPlayEvent *events, s32 count, s32 *total_out); Result pdmqryQueryPlayEvent(s32 entry_index, PdmPlayEvent *events, s32 count, s32 *total_out);
/** /**
* @brief Gets range fields which can then be used with the other pdmqry funcs, except for \ref pdmqryQueryAccountPlayEvent. * @brief Gets range fields which can then be used with the other pdmqry funcs, except for \ref pdmqryQueryAccountPlayEvent.
* @param[out] total_entries Total entries. * @param[out] total_entries Total entries.
* @param[out] start_entryindex Start entry index. * @param[out] start_entry_index Start entry index.
* @param[out] end_entryindex End entry index. * @param[out] end_entry_index End entry index.
*/ */
Result pdmqryGetAvailablePlayEventRange(u32 *total_entries, u32 *start_entryindex, u32 *end_entryindex); Result pdmqryGetAvailablePlayEventRange(s32 *total_entries, s32 *start_entry_index, s32 *end_entry_index);
/** /**
* @brief Gets a list of \ref PdmAccountEvent. * @brief Gets a list of \ref PdmAccountEvent.
* @param[in] entryindex Start entry index. * @param[in] entry_index Start entry index.
* @param[out] events Output \ref PdmAccountEvent array. * @param[out] events Output \ref PdmAccountEvent array.
* @param[in] count Max entries in the output array. * @param[in] count Max entries in the output array.
* @param[out] total_out Total output entries. * @param[out] total_out Total output entries.
*/ */
Result pdmqryQueryAccountEvent(u32 entryindex, PdmAccountEvent *events, s32 count, s32 *total_out); Result pdmqryQueryAccountEvent(s32 entry_index, PdmAccountEvent *events, s32 count, s32 *total_out);
/** /**
* @brief Gets a list of \ref PdmAccountPlayEvent. * @brief Gets a list of \ref PdmAccountPlayEvent.
* @note Only available with [4.0.0+]. * @note Only available with [4.0.0+].
* @param[in] entryindex Start entry index. * @param[in] entry_index Start entry index.
* @param[in] userID \ref AccountUid * @param[in] uid \ref AccountUid
* @param[out] events Output \ref PdmAccountPlayEvent array. * @param[out] events Output \ref PdmAccountPlayEvent array.
* @param[in] count Max entries in the output array. * @param[in] count Max entries in the output array.
* @param[out] total_out Total output entries. * @param[out] total_out Total output entries.
*/ */
Result pdmqryQueryAccountPlayEvent(u32 entryindex, AccountUid *userID, PdmAccountPlayEvent *events, s32 count, s32 *total_out); Result pdmqryQueryAccountPlayEvent(s32 entry_index, AccountUid *uid, PdmAccountPlayEvent *events, s32 count, s32 *total_out);
/** /**
* @brief Gets range fields which can then be used with \ref pdmqryQueryAccountPlayEvent. * @brief Gets range fields which can then be used with \ref pdmqryQueryAccountPlayEvent.
* @param[in] userID \ref AccountUid * @param[in] uid \ref AccountUid
* @param[out] total_entries Total entries. * @param[out] total_entries Total entries.
* @param[out] start_entryindex Start entry index. * @param[out] start_entry_index Start entry index.
* @param[out] end_entryindex End entry index. * @param[out] end_entry_index End entry index.
*/ */
Result pdmqryGetAvailableAccountPlayEventRange(AccountUid *userID, u32 *total_entries, u32 *start_entryindex, u32 *end_entryindex); Result pdmqryGetAvailableAccountPlayEventRange(AccountUid *uid, s32 *total_entries, s32 *start_entry_index, s32 *end_entry_index);
/** /**
* @brief Gets a list of titles played by the specified user. * @brief Gets a list of titles played by the specified user.
* @note Only available with [6.0.0+]. * @note Only available with [6.0.0+].
* @param[in] userID \ref AccountUid * @param[in] uid \ref AccountUid
* @param[out] titleIDs Output titleID array. * @param[out] titleIDs Output titleID array.
* @param[in] count Max entries in the output array. * @param[in] count Max entries in the output array.
* @param[out] total_out Total output entries. * @param[out] total_out Total output entries.
*/ */
Result pdmqryQueryRecentlyPlayedApplication(AccountUid *userID, u64 *titleIDs, size_t count, u32 *total_out); Result pdmqryQueryRecentlyPlayedApplication(AccountUid *uid, u64 *titleIDs, s32 count, s32 *total_out);
/** /**
* @brief Gets an Event which is signaled when logging a new \ref PdmPlayEvent which would be available via \ref pdmqryQueryAccountEvent, where PdmPlayEvent::eventData::account::type is 0. * @brief Gets an Event which is signaled when logging a new \ref PdmPlayEvent which would be available via \ref pdmqryQueryAccountEvent, where PdmPlayEvent::eventData::account::type is 0.

View File

@ -35,26 +35,26 @@ static Result _pdmCmdGetEvent(Service* srv, Event* out_event, bool autoclear, u3
return rc; return rc;
} }
static Result _pdmqryQueryEvent(u32 cmd_id, u32 entryindex, void* events, size_t entrysize, s32 count, s32 *total_out) { static Result _pdmqryQueryEvent(s32 entry_index, void* events, size_t entrysize, s32 count, s32 *total_out, u32 cmd_id) {
return serviceDispatchInOut(&g_pdmqrySrv, cmd_id, entryindex, *total_out, return serviceDispatchInOut(&g_pdmqrySrv, cmd_id, entry_index, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { events, count*entrysize } }, .buffers = { { events, count*entrysize } },
); );
} }
Result pdmqryQueryApplicationEvent(u32 entryindex, PdmApplicationEvent *events, s32 count, s32 *total_out) { Result pdmqryQueryAppletEvent(s32 entry_index, PdmAppletEvent *events, s32 count, s32 *total_out) {
return _pdmqryQueryEvent(0, entryindex, events, sizeof(PdmApplicationEvent), count, total_out); return _pdmqryQueryEvent(entry_index, events, sizeof(PdmAppletEvent), count, total_out, 0);
} }
Result pdmqryQueryPlayStatisticsByApplicationId(u64 titleID, PdmPlayStatistics *stats) { Result pdmqryQueryPlayStatisticsByApplicationId(u64 titleID, PdmPlayStatistics *stats) {
return serviceDispatchInOut(&g_pdmqrySrv, 4, titleID, *stats); return serviceDispatchInOut(&g_pdmqrySrv, 4, titleID, *stats);
} }
Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(u64 titleID, AccountUid *userID, PdmPlayStatistics *stats) { Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(u64 titleID, AccountUid *uid, PdmPlayStatistics *stats) {
const struct { const struct {
u64 titleID; u64 titleID;
AccountUid userID; AccountUid uid;
} in = { titleID, *userID }; } in = { titleID, *uid };
return serviceDispatchInOut(&g_pdmqrySrv, 5, in, *stats); return serviceDispatchInOut(&g_pdmqrySrv, 5, in, *stats);
} }
@ -72,38 +72,38 @@ Result pdmqryQueryLastPlayTime(PdmLastPlayTime *playtimes, const u64 *titleIDs,
); );
} }
Result pdmqryQueryPlayEvent(u32 entryindex, PdmPlayEvent *events, s32 count, s32 *total_out) { Result pdmqryQueryPlayEvent(s32 entry_index, PdmPlayEvent *events, s32 count, s32 *total_out) {
return _pdmqryQueryEvent(8, entryindex, events, sizeof(PdmPlayEvent), count, total_out); return _pdmqryQueryEvent(entry_index, events, sizeof(PdmPlayEvent), count, total_out, 8);
} }
Result pdmqryGetAvailablePlayEventRange(u32 *total_entries, u32 *start_entryindex, u32 *end_entryindex) { Result pdmqryGetAvailablePlayEventRange(s32 *total_entries, s32 *start_entry_index, s32 *end_entry_index) {
struct { struct {
u32 total_entries; s32 total_entries;
u32 start_entryindex; s32 start_entry_index;
u32 end_entryindex; s32 end_entry_index;
} out; } out;
Result rc = serviceDispatchOut(&g_pdmqrySrv, 9, out); Result rc = serviceDispatchOut(&g_pdmqrySrv, 9, out);
if (R_SUCCEEDED(rc)) { if (R_SUCCEEDED(rc)) {
if (total_entries) *total_entries = out.total_entries; if (total_entries) *total_entries = out.total_entries;
if (start_entryindex) *start_entryindex = out.start_entryindex; if (start_entry_index) *start_entry_index = out.start_entry_index;
if (end_entryindex) *end_entryindex = out.end_entryindex; if (end_entry_index) *end_entry_index = out.end_entry_index;
} }
return rc; return rc;
} }
Result pdmqryQueryAccountEvent(u32 entryindex, PdmAccountEvent *events, s32 count, s32 *total_out) { Result pdmqryQueryAccountEvent(s32 entry_index, PdmAccountEvent *events, s32 count, s32 *total_out) {
return _pdmqryQueryEvent(10, entryindex, events, sizeof(PdmAccountEvent), count, total_out); return _pdmqryQueryEvent(entry_index, events, sizeof(PdmAccountEvent), count, total_out, 10);
} }
Result pdmqryQueryAccountPlayEvent(u32 entryindex, AccountUid *userID, PdmAccountPlayEvent *events, s32 count, s32 *total_out) { Result pdmqryQueryAccountPlayEvent(s32 entry_index, AccountUid *uid, PdmAccountPlayEvent *events, s32 count, s32 *total_out) {
if (hosversionBefore(4,0,0)) if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct { const struct {
u32 entryindex; s32 entry_index;
AccountUid userID; AccountUid uid;
} in = { entryindex, *userID }; } in = { entry_index, *uid };
return serviceDispatchInOut(&g_pdmqrySrv, 11, in, *total_out, return serviceDispatchInOut(&g_pdmqrySrv, 11, in, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
@ -111,30 +111,30 @@ Result pdmqryQueryAccountPlayEvent(u32 entryindex, AccountUid *userID, PdmAccoun
); );
} }
Result pdmqryGetAvailableAccountPlayEventRange(AccountUid *userID, u32 *total_entries, u32 *start_entryindex, u32 *end_entryindex) { Result pdmqryGetAvailableAccountPlayEventRange(AccountUid *uid, s32 *total_entries, s32 *start_entry_index, s32 *end_entry_index) {
if (hosversionBefore(4,0,0)) if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
struct { struct {
u32 total_entries; s32 total_entries;
u32 start_entryindex; s32 start_entry_index;
u32 end_entryindex; s32 end_entry_index;
} out; } out;
Result rc = serviceDispatchInOut(&g_pdmqrySrv, 12, *userID, out); Result rc = serviceDispatchInOut(&g_pdmqrySrv, 12, *uid, out);
if (R_SUCCEEDED(rc)) { if (R_SUCCEEDED(rc)) {
if (total_entries) *total_entries = out.total_entries; if (total_entries) *total_entries = out.total_entries;
if (start_entryindex) *start_entryindex = out.start_entryindex; if (start_entry_index) *start_entry_index = out.start_entry_index;
if (end_entryindex) *end_entryindex = out.end_entryindex; if (end_entry_index) *end_entry_index = out.end_entry_index;
} }
return rc; return rc;
} }
Result pdmqryQueryRecentlyPlayedApplication(AccountUid *userID, u64 *titleIDs, size_t count, u32 *total_out) { Result pdmqryQueryRecentlyPlayedApplication(AccountUid *uid, u64 *titleIDs, s32 count, s32 *total_out) {
if (hosversionBefore(6,0,0)) if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchInOut(&g_pdmqrySrv, 14, *userID, *total_out, return serviceDispatchInOut(&g_pdmqrySrv, 14, *uid, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { titleIDs, count*sizeof(u64) } }, .buffers = { { titleIDs, count*sizeof(u64) } },
); );