Updated LibAppletMode enum and added appletHolderSetOutOfFocusApplicationSuspendingEnabled.

This commit is contained in:
yellows8 2019-07-30 17:34:05 -04:00
parent b3dd512253
commit 2257e3ccf4
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
3 changed files with 24 additions and 8 deletions

View File

@ -109,10 +109,11 @@ typedef enum {
/// LibraryAppletMode
typedef enum {
LibAppletMode_AllForeground = 0, ///< Foreground
LibAppletMode_Background = 1, ///< Background
LibAppletMode_Unknown2 = 2, ///< Unknown
LibAppletMode_Unknown3 = 3, ///< Unknown
LibAppletMode_AllForeground = 0, ///< Foreground.
LibAppletMode_Background = 1, ///< Background.
LibAppletMode_NoUi = 2, ///< No UI.
LibAppletMode_BackgroundIndirect = 3, ///< Background with indirect display, see \ref appletHolderGetIndirectLayerConsumerHandle.
LibAppletMode_AllForegroundInitiallyHidden = 4, ///< Foreground except initially hidden.
} LibAppletMode;
/// LibraryAppletExitReason
@ -669,7 +670,7 @@ bool appletHolderActive(AppletHolder *h);
/**
* @brief Gets the IndirectLayerConsumerHandle loaded during \ref appletCreateLibraryApplet, on 2.0.0+.
* @note Only available when \ref LibAppletMode is ::LibAppletMode_Unknown3.
* @note Only available when \ref LibAppletMode is ::LibAppletMode_BackgroundIndirect.
* @param h AppletHolder object.
* @param out Output IndirectLayerConsumerHandle.
*/
@ -705,6 +706,14 @@ bool appletHolderCheckFinished(AppletHolder *h);
*/
LibAppletExitReason appletHolderGetExitReason(AppletHolder *h);
/**
* @brief Sets OutOfFocusApplicationSuspendingEnabled.
* @note Only available with AppletType_*Application.
* @param h AppletHolder object.
* @param[in] flag Flag
*/
Result appletHolderSetOutOfFocusApplicationSuspendingEnabled(AppletHolder *h, bool flag);
/**
* @brief Waits for the PopInteractiveOutDataEvent and StateChangedEvent.
* @return false for error / when StateChangedEvent was signaled, and true when PopInteractiveOutDataEvent was signaled.

View File

@ -493,7 +493,7 @@ static Result _swkbdInlineLaunch(SwkbdInline* s, SwkbdInitializeArg *initArg) {
memcpy(&s->calcArg.initArg, initArg, sizeof(*initArg));
s->calcArg.flags |= 0x1;
rc = appletCreateLibraryApplet(&s->holder, AppletId_swkbd, s->calcArg.initArg.mode!=SwkbdInlineMode_UserDisplay ? LibAppletMode_Background : LibAppletMode_Unknown3);
rc = appletCreateLibraryApplet(&s->holder, AppletId_swkbd, s->calcArg.initArg.mode!=SwkbdInlineMode_UserDisplay ? LibAppletMode_Background : LibAppletMode_BackgroundIndirect);
if (R_FAILED(rc)) return rc;
LibAppletArgs commonargs;

View File

@ -2147,7 +2147,7 @@ static Result _appletHolderCreate(AppletHolder *h, AppletId id, LibAppletMode mo
if (R_SUCCEEDED(rc)) rc = _appletGetEvent(&h->s, &h->StateChangedEvent, 0, false);//GetAppletStateChangedEvent
if (R_SUCCEEDED(rc) && hosversionAtLeast(2,0,0) && h->mode == LibAppletMode_Unknown3) rc = _appletGetIndirectLayerConsumerHandle(&h->s, &h->layer_handle);
if (R_SUCCEEDED(rc) && hosversionAtLeast(2,0,0) && h->mode == LibAppletMode_BackgroundIndirect) rc = _appletGetIndirectLayerConsumerHandle(&h->s, &h->layer_handle);
return rc;
}
@ -2175,7 +2175,7 @@ bool appletHolderActive(AppletHolder *h) {
Result appletHolderGetIndirectLayerConsumerHandle(AppletHolder *h, u64 *out) {
if (!serviceIsActive(&h->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (h->mode!=LibAppletMode_Unknown3)
if (h->mode!=LibAppletMode_BackgroundIndirect)
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -2239,6 +2239,13 @@ u32 appletHolderGetExitReason(AppletHolder *h) {
return h->exitreason;
}
Result appletHolderSetOutOfFocusApplicationSuspendingEnabled(AppletHolder *h, bool flag) {
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication())
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _appletCmdInBool(&h->s, flag, 50);
}
static Result _appletHolderGetPopInteractiveOutDataEvent(AppletHolder *h) {
Result rc=0;