diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 60171f5e..7c6b83ec 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -237,6 +237,30 @@ void appletHolderJoin(AppletHolder *h); */ LibAppletExitReason appletHolderGetExitReason(AppletHolder *h); +/** + * @brief Pushes a storage for LibraryApplet input. + * @note This uses \ref appletStorageClose automatically. + * @param h AppletHolder object. + * @param s Storage object. + */ +Result appletHolderPushInData(AppletHolder *h, AppletStorage *s); + +/** + * @brief Pushes a storage for LibraryApplet Extra storage input. + * @note This uses \ref appletStorageClose automatically. + * @param h AppletHolder object. + * @param s Storage object. + */ +Result appletHolderPushExtraStorage(AppletHolder *h, AppletStorage *s); + +/** + * @brief Pushes a storage for LibraryApplet Interactive input. + * @note This uses \ref appletStorageClose automatically. + * @param h AppletHolder object. + * @param s Storage object. + */ +Result appletHolderPushInteractiveInData(AppletHolder *h, AppletStorage *s); + /** * @brief Creates a storage. * @param s Storage object. diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index c518a92f..3c0449a6 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -743,7 +743,13 @@ static Result _appletCmdInSession(Service* srv, Service* srv_in, u64 cmd_id) { } static Result _appletCmdInStorage(Service* srv, AppletStorage* s, u64 cmd_id) { - Result rc = _appletCmdInSession(srv, &s->s, cmd_id); + Result rc=0; + + if (!serviceIsActive(&s->s)) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + + rc =_appletCmdInSession(srv, &s->s, cmd_id); + appletStorageClose(s); return rc; } @@ -1627,6 +1633,18 @@ u32 appletHolderGetExitReason(AppletHolder *h) { return h->exitreason; } +Result appletHolderPushInData(AppletHolder *h, AppletStorage *s) { + return _appletCmdInStorage(&h->s, s, 100); +} + +Result appletHolderPushExtraStorage(AppletHolder *h, AppletStorage *s) { + return _appletCmdInStorage(&h->s, s, 102); +} + +Result appletHolderPushInteractiveInData(AppletHolder *h, AppletStorage *s) { + return _appletCmdInStorage(&h->s, s, 103); +} + Result appletCreateStorage(AppletStorage *s, s64 size) { memset(s, 0, sizeof(AppletStorage));