From d8683ea18875134d9733784d22d0e9e6386e66a4 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 18 Dec 2018 20:07:29 -0500 Subject: [PATCH] Added appletHolderPopOutData and appletHolderPopInteractiveOutData. --- nx/include/switch/services/applet.h | 14 ++++++++++++++ nx/source/services/applet.c | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 7c6b83ec..013b6483 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -245,6 +245,13 @@ LibAppletExitReason appletHolderGetExitReason(AppletHolder *h); */ Result appletHolderPushInData(AppletHolder *h, AppletStorage *s); +/** + * @brief Pops a storage from LibraryApplet output. + * @param h AppletHolder object. + * @param s Storage object. + */ +Result appletHolderPopOutData(AppletHolder *h, AppletStorage *s); + /** * @brief Pushes a storage for LibraryApplet Extra storage input. * @note This uses \ref appletStorageClose automatically. @@ -261,6 +268,13 @@ Result appletHolderPushExtraStorage(AppletHolder *h, AppletStorage *s); */ Result appletHolderPushInteractiveInData(AppletHolder *h, AppletStorage *s); +/** + * @brief Pops a storage from LibraryApplet Interactive output. + * @param h AppletHolder object. + * @param s Storage object. + */ +Result appletHolderPopInteractiveOutData(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 3c0449a6..63017d1c 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -754,6 +754,11 @@ static Result _appletCmdInStorage(Service* srv, AppletStorage* s, u64 cmd_id) { return rc; } +static Result _appletCmdNoInOutStorage(Service* srv, AppletStorage* s, u64 cmd_id) { + memset(s, 0, sizeof(AppletStorage)); + return _appletGetSession(srv, &s->s, cmd_id); +} + // IWindowController static Result _appletGetAppletResourceUserId(u64 *out) { @@ -1637,6 +1642,10 @@ Result appletHolderPushInData(AppletHolder *h, AppletStorage *s) { return _appletCmdInStorage(&h->s, s, 100); } +Result appletHolderPopOutData(AppletHolder *h, AppletStorage *s) { + return _appletCmdNoInOutStorage(&h->s, s, 101); +} + Result appletHolderPushExtraStorage(AppletHolder *h, AppletStorage *s) { return _appletCmdInStorage(&h->s, s, 102); } @@ -1645,6 +1654,10 @@ Result appletHolderPushInteractiveInData(AppletHolder *h, AppletStorage *s) { return _appletCmdInStorage(&h->s, s, 103); } +Result appletHolderPopInteractiveOutData(AppletHolder *h, AppletStorage *s) { + return _appletCmdNoInOutStorage(&h->s, s, 104); +} + Result appletCreateStorage(AppletStorage *s, s64 size) { memset(s, 0, sizeof(AppletStorage));