From d90893c56655fd939209b5d6927d7c3502fd35f7 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 19 Feb 2019 21:46:53 -0500 Subject: [PATCH] Expose libappletCreateWriteStorage. --- nx/include/switch/applets/libapplet.h | 8 ++++++++ nx/source/applets/libapplet.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/nx/include/switch/applets/libapplet.h b/nx/include/switch/applets/libapplet.h index e3342f72..c17f3f4d 100644 --- a/nx/include/switch/applets/libapplet.h +++ b/nx/include/switch/applets/libapplet.h @@ -34,6 +34,14 @@ void libappletArgsCreate(LibAppletArgs* a, u32 version); */ void libappletArgsSetPlayStartupSound(LibAppletArgs* a, bool flag); +/** + * @brief Creates an AppletStorage with the specified size and writes the buffer contents to that storage at offset 0. + * @param[out] s Storage object. + * @param buffer Input buffer. + * @param size Size to write. + */ +Result libappletCreateWriteStorage(AppletStorage* s, const void* buffer, size_t size); + /** * @brief Reads data from offset 0 from the specified storage into the buffer. If the storage-size is smaller than the size param, the storage-size is used instead. * @param s Storage object. diff --git a/nx/source/applets/libapplet.c b/nx/source/applets/libapplet.c index 5daf914d..374bdce3 100644 --- a/nx/source/applets/libapplet.c +++ b/nx/source/applets/libapplet.c @@ -19,7 +19,7 @@ void libappletArgsSetPlayStartupSound(LibAppletArgs* a, bool flag) { a->PlayStartupSound = flag!=0; } -static Result _libappletCreateWriteStorage(AppletStorage* s, const void* buffer, size_t size) { +Result libappletCreateWriteStorage(AppletStorage* s, const void* buffer, size_t size) { Result rc=0; rc = appletCreateStorage(s, size); @@ -54,7 +54,7 @@ static Result _libappletPushInData(AppletHolder *h, const void* buffer, size_t s Result rc=0; AppletStorage storage; - rc = _libappletCreateWriteStorage(&storage, buffer, size); + rc = libappletCreateWriteStorage(&storage, buffer, size); if (R_FAILED(rc)) return rc; return appletHolderPushInData(h, &storage); @@ -73,7 +73,7 @@ static Result _libappletQlaunchRequest(u8* buf, size_t size) { Result rc=0; AppletStorage storage; - rc = _libappletCreateWriteStorage(&storage, buf, size); + rc = libappletCreateWriteStorage(&storage, buf, size); if (R_FAILED(rc)) return rc; return appletPushToGeneralChannel(&storage);