Added appletHolderActive and appletHolderCheckFinished.

This commit is contained in:
yellows8 2019-01-04 11:46:36 -05:00
parent f589310ef2
commit 82e526c72f
2 changed files with 17 additions and 0 deletions

View File

@ -234,6 +234,9 @@ Result appletCreateLibraryAppletSelf(AppletHolder *h, AppletId id, LibAppletMode
/// Closes an AppletHolder object.
void appletHolderClose(AppletHolder *h);
/// Returns whether the AppletHolder object was initialized.
bool appletHolderActive(AppletHolder *h);
/**
* @brief Gets the IndirectLayerConsumerHandle loaded during \ref appletCreateLibraryApplet, on 2.0.0+.
* @note Only available when \ref LibAppletMode is \ref LibAppletMode_Unknown3.
@ -254,6 +257,12 @@ Result appletHolderStart(AppletHolder *h);
*/
void appletHolderJoin(AppletHolder *h);
/**
* @brief Waits on the LibraryApplet StateChangedEvent with timeout=0, and returns whether it was successful.
* @param h AppletHolder object.
*/
bool appletHolderCheckFinished(AppletHolder *h);
/**
* @brief Gets the \ref LibAppletExitReason set by \ref appletHolderJoin.
* @param h AppletHolder object.

View File

@ -1642,6 +1642,10 @@ void appletHolderClose(AppletHolder *h) {
memset(h, 0, sizeof(AppletHolder));
}
bool appletHolderActive(AppletHolder *h) {
return serviceIsActive(&h->s);
}
Result appletHolderGetIndirectLayerConsumerHandle(AppletHolder *h, u64 *out) {
if (!serviceIsActive(&h->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
@ -1690,6 +1694,10 @@ void appletHolderJoin(AppletHolder *h) {
h->exitreason = res;
}
bool appletHolderCheckFinished(AppletHolder *h) {
return R_SUCCEEDED(eventWait(&h->StateChangedEvent, 0));
}
u32 appletHolderGetExitReason(AppletHolder *h) {
return h->exitreason;
}