Added storage pushing for AppletHolder. Verify that the input storage is initialized in _appletCmdInStorage().

This commit is contained in:
yellows8 2018-12-18 19:37:07 -05:00
parent 5874a272d0
commit a6e1413712
2 changed files with 43 additions and 1 deletions

View File

@ -237,6 +237,30 @@ void appletHolderJoin(AppletHolder *h);
*/ */
LibAppletExitReason appletHolderGetExitReason(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. * @brief Creates a storage.
* @param s Storage object. * @param s Storage object.

View File

@ -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) { 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); appletStorageClose(s);
return rc; return rc;
} }
@ -1627,6 +1633,18 @@ u32 appletHolderGetExitReason(AppletHolder *h) {
return h->exitreason; 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) { Result appletCreateStorage(AppletStorage *s, s64 size) {
memset(s, 0, sizeof(AppletStorage)); memset(s, 0, sizeof(AppletStorage));