Added appletTerminateAllLibraryApplets/appletAreAnyLibraryAppletsLeft and appletApplicationTerminateAllLibraryApplets/appletApplicationAreAnyLibraryAppletsLeft.

This commit is contained in:
yellows8 2019-08-20 14:33:56 -04:00
parent e069da4320
commit 487aed9a59
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 45 additions and 0 deletions

View File

@ -946,6 +946,18 @@ Result appletCreateLibraryApplet(AppletHolder *h, AppletId id, LibAppletMode mod
*/ */
Result appletCreateLibraryAppletSelf(AppletHolder *h, AppletId id, LibAppletMode mode); Result appletCreateLibraryAppletSelf(AppletHolder *h, AppletId id, LibAppletMode mode);
/**
* @brief TerminateAllLibraryApplets which were created by the current applet.
* @note Normally LibraryApplet cleanup should be handled via \ref AppletHolder.
*/
Result appletTerminateAllLibraryApplets(void);
/**
* @brief AreAnyLibraryAppletsLeft which were created by the current applet.
* @param[out] out Output flag.
*/
Result appletAreAnyLibraryAppletsLeft(bool *out);
/// Closes an AppletHolder object. /// Closes an AppletHolder object.
void appletHolderClose(AppletHolder *h); void appletHolderClose(AppletHolder *h);
@ -1548,6 +1560,17 @@ AppletApplicationExitReason appletApplicationGetExitReason(AppletApplication *a)
*/ */
Result appletApplicationRequestForApplicationToGetForeground(AppletApplication *a); Result appletApplicationRequestForApplicationToGetForeground(AppletApplication *a);
/**
* @brief TerminateAllLibraryApplets which were created by the Application.
*/
Result appletApplicationTerminateAllLibraryApplets(AppletApplication *a);
/**
* @brief AreAnyLibraryAppletsLeft which were created by the Application.
* @param[out] out Output flag.
*/
Result appletApplicationAreAnyLibraryAppletsLeft(AppletApplication *a, bool *out);
/** /**
* @brief Calls the same func as \ref appletHolderRequestExitOrTerminate with the output IAppletAccessor from the GetCurrentLibraryApplet cmd. * @brief Calls the same func as \ref appletHolderRequestExitOrTerminate with the output IAppletAccessor from the GetCurrentLibraryApplet cmd.
* @param a \ref AppletApplication * @param a \ref AppletApplication

View File

@ -2924,6 +2924,14 @@ Result appletCreateLibraryAppletSelf(AppletHolder *h, AppletId id, LibAppletMode
return _appletHolderCreate(h, id, mode, true); return _appletHolderCreate(h, id, mode, true);
} }
Result appletTerminateAllLibraryApplets(void) {
return _appletCmdNoIO(&g_appletILibraryAppletCreator, 1);
}
Result appletAreAnyLibraryAppletsLeft(bool *out) {
return _appletCmdNoInOutBool(&g_appletILibraryAppletCreator, out, 2);
}
void appletHolderClose(AppletHolder *h) { void appletHolderClose(AppletHolder *h) {
eventClose(&h->PopInteractiveOutDataEvent); eventClose(&h->PopInteractiveOutDataEvent);
@ -4569,6 +4577,20 @@ Result appletApplicationRequestForApplicationToGetForeground(AppletApplication *
return rc; return rc;
} }
Result appletApplicationTerminateAllLibraryApplets(AppletApplication *a) {
if (!serviceIsActive(&a->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _appletCmdNoIO(&a->s, 110);
}
Result appletApplicationAreAnyLibraryAppletsLeft(AppletApplication *a, bool *out) {
if (!serviceIsActive(&a->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _appletCmdNoInOutBool(&a->s, out, 111);
}
Result appletApplicationRequestExitLibraryAppletOrTerminate(AppletApplication *a, u64 timeout) { Result appletApplicationRequestExitLibraryAppletOrTerminate(AppletApplication *a, u64 timeout) {
Result rc=0; Result rc=0;
Service srv={0}; Service srv={0};