pdm: Updated for [10.0.0+].

This commit is contained in:
yellows8 2020-04-17 14:17:30 -04:00
parent 4b7921a221
commit b1b80f5493
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 91 additions and 21 deletions

View File

@ -32,9 +32,10 @@ typedef enum {
/// PlayLogPolicy
typedef enum {
PdmPlayLogPolicy_All = 0, ///< All pdm:qry commands which require ::PdmPlayEventType_Applet and AppletId = Application will only return the entry when PlayLogPolicy matches this value.
PdmPlayLogPolicy_LogOnly = 1, ///< The above commands will filter out the entry with this.
PdmPlayLogPolicy_None = 2, ///< The pdm:ntfy commands which handle ::PdmPlayEventType_Applet logging will immediately return 0 when the input param matches this value.
PdmPlayLogPolicy_All = 0, ///< All pdm:qry commands which require ::PdmPlayEventType_Applet and AppletId = Application will only return the entry when PlayLogPolicy matches this value.
PdmPlayLogPolicy_LogOnly = 1, ///< The above commands will filter out the entry with this.
PdmPlayLogPolicy_None = 2, ///< The pdm:ntfy commands which handle ::PdmPlayEventType_Applet logging will immediately return 0 when the input param matches this value.
PdmPlayLogPolicy_Unknown3 = 3, ///< [10.0.0+] The cmds which require ::PdmPlayLogPolicy_All, now also allow value 3 if the cmd input flag is set.
} PdmPlayLogPolicy;
/// AppletEvent.
@ -172,35 +173,39 @@ Service* pdmqryGetServiceSession(void);
/**
* @brief Gets a list of \ref PdmAppletEvent.
* @param[in] entry_index Start entry index.
* @param[in] flag [10.0.0+] Whether to additionally allow using entries with ::PdmPlayLogPolicy_Unknown3.
* @param[out] events Output \ref PdmAppletEvent array.
* @param[in] count Max entries in the output array.
* @param[out] total_out Total output entries.
*/
Result pdmqryQueryAppletEvent(s32 entry_index, PdmAppletEvent *events, s32 count, s32 *total_out);
Result pdmqryQueryAppletEvent(s32 entry_index, bool flag, PdmAppletEvent *events, s32 count, s32 *total_out);
/**
* @brief Gets \ref PdmPlayStatistics for the specified ApplicationId.
* @param[in] application_id ApplicationId
* @param[in] flag [10.0.0+] Whether to additionally allow using entries with ::PdmPlayLogPolicy_Unknown3.
* @param[out] stats \ref PdmPlayStatistics
*/
Result pdmqryQueryPlayStatisticsByApplicationId(u64 application_id, PdmPlayStatistics *stats);
Result pdmqryQueryPlayStatisticsByApplicationId(u64 application_id, bool flag, PdmPlayStatistics *stats);
/**
* @brief Gets \ref PdmPlayStatistics for the specified ApplicationId and account userId.
* @param[in] application_id ApplicationId
* @param[in] uid \ref AccountUid
* @param[in] flag [10.0.0+] Whether to additionally allow using entries with ::PdmPlayLogPolicy_Unknown3.
* @param[out] stats \ref PdmPlayStatistics
*/
Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(u64 application_id, AccountUid uid, PdmPlayStatistics *stats);
Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(u64 application_id, AccountUid uid, bool flag, PdmPlayStatistics *stats);
/**
* @brief Gets \ref PdmLastPlayTime for the specified applications.
* @param[in] flag [10.0.0+] Whether to additionally allow using entries with ::PdmPlayLogPolicy_Unknown3.
* @param[out] playtimes Output \ref PdmLastPlayTime array.
* @param[in] application_ids Input ApplicationIds array.
* @param[in] count Total entries in the input/output arrays.
* @param[out] total_out Total output entries.
*/
Result pdmqryQueryLastPlayTime(PdmLastPlayTime *playtimes, const u64 *application_ids, s32 count, s32 *total_out);
Result pdmqryQueryLastPlayTime(bool flag, PdmLastPlayTime *playtimes, const u64 *application_ids, s32 count, s32 *total_out);
/**
* @brief Gets a list of \ref PdmPlayEvent.
@ -252,11 +257,12 @@ Result pdmqryGetAvailableAccountPlayEventRange(AccountUid uid, s32 *total_entrie
* @brief Gets a list of applications played by the specified user.
* @note Only available with [6.0.0+].
* @param[in] uid \ref AccountUid
* @param[in] flag [10.0.0+] Whether to additionally allow using entries with ::PdmPlayLogPolicy_Unknown3.
* @param[out] application_ids Output ApplicationIds array.
* @param[in] count Max entries in the output array.
* @param[out] total_out Total output entries.
*/
Result pdmqryQueryRecentlyPlayedApplication(AccountUid uid, u64 *application_ids, s32 count, s32 *total_out);
Result pdmqryQueryRecentlyPlayedApplication(AccountUid uid, bool flag, u64 *application_ids, 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.

View File

@ -40,25 +40,76 @@ static Result _pdmqryQueryEvent(s32 entry_index, void* events, size_t entrysize,
);
}
Result pdmqryQueryAppletEvent(s32 entry_index, PdmAppletEvent *events, s32 count, s32 *total_out) {
return _pdmqryQueryEvent(entry_index, events, sizeof(PdmAppletEvent), count, total_out, 0);
}
Result pdmqryQueryAppletEvent(s32 entry_index, bool flag, PdmAppletEvent *events, s32 count, s32 *total_out) {
if (hosversionBefore(10,0,0)) {
return serviceDispatchInOut(&g_pdmqrySrv, 0, entry_index, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { events, count*sizeof(PdmAppletEvent) } },
);
}
Result pdmqryQueryPlayStatisticsByApplicationId(u64 application_id, PdmPlayStatistics *stats) {
return serviceDispatchInOut(&g_pdmqrySrv, 4, application_id, *stats);
}
Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(u64 application_id, AccountUid uid, PdmPlayStatistics *stats) {
const struct {
u8 flag;
u8 pad[3];
s32 entry_index;
} in = { flag!=0, {0}, entry_index };
return serviceDispatchInOut(&g_pdmqrySrv, 0, in, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { events, count*sizeof(PdmAppletEvent) } },
);
}
Result pdmqryQueryPlayStatisticsByApplicationId(u64 application_id, bool flag, PdmPlayStatistics *stats) {
if (hosversionBefore(10,0,0)) {
return serviceDispatchInOut(&g_pdmqrySrv, 4, application_id, *stats);
}
const struct {
u8 flag;
u8 pad[7];
u64 application_id;
} in = { flag!=0, {0}, application_id };
return serviceDispatchInOut(&g_pdmqrySrv, 4, in, *stats);
}
Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(u64 application_id, AccountUid uid, bool flag, PdmPlayStatistics *stats) {
if (hosversionBefore(10,0,0)) {
const struct {
u64 application_id;
AccountUid uid;
} in = { application_id, uid };
return serviceDispatchInOut(&g_pdmqrySrv, 5, in, *stats);
}
const struct {
u8 flag;
u8 pad[7];
u64 application_id;
AccountUid uid;
} in = { application_id, uid };
} in = { flag!=0, {0}, application_id, uid };
return serviceDispatchInOut(&g_pdmqrySrv, 5, in, *stats);
}
Result pdmqryQueryLastPlayTime(PdmLastPlayTime *playtimes, const u64 *application_ids, s32 count, s32 *total_out) {
return serviceDispatchOut(&g_pdmqrySrv, 7, *total_out,
Result pdmqryQueryLastPlayTime(bool flag, PdmLastPlayTime *playtimes, const u64 *application_ids, s32 count, s32 *total_out) {
if (hosversionBefore(10,0,0)) {
return serviceDispatchOut(&g_pdmqrySrv, 7, *total_out,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out,
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
},
.buffers = {
{ playtimes, count*sizeof(PdmLastPlayTime) },
{ application_ids, count*sizeof(u64) },
},
);
}
const u8 in = flag!=0;
return serviceDispatchInOut(&g_pdmqrySrv, 17, in, *total_out,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out,
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
@ -129,11 +180,24 @@ Result pdmqryGetAvailableAccountPlayEventRange(AccountUid uid, s32 *total_entrie
return rc;
}
Result pdmqryQueryRecentlyPlayedApplication(AccountUid uid, u64 *application_ids, s32 count, s32 *total_out) {
Result pdmqryQueryRecentlyPlayedApplication(AccountUid uid, bool flag, u64 *application_ids, s32 count, s32 *total_out) {
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchInOut(&g_pdmqrySrv, 14, uid, *total_out,
if (hosversionBefore(10,0,0)) {
return serviceDispatchInOut(&g_pdmqrySrv, 14, uid, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { application_ids, count*sizeof(u64) } },
);
}
const struct {
u8 flag;
u8 pad[7];
AccountUid uid;
} in = { flag!=0, {0}, uid };
return serviceDispatchInOut(&g_pdmqrySrv, 14, in, *total_out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { application_ids, count*sizeof(u64) } },
);