mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-27 15:22:40 +02:00
Added appletHolderJoin and appletHolderGetExitReason.
This commit is contained in:
parent
bca797afc2
commit
5874a272d0
@ -87,6 +87,14 @@ typedef enum {
|
|||||||
LibAppletMode_Unknown3 = 3,
|
LibAppletMode_Unknown3 = 3,
|
||||||
} LibAppletMode;
|
} LibAppletMode;
|
||||||
|
|
||||||
|
/// LibraryAppletExitReason
|
||||||
|
typedef enum {
|
||||||
|
LibAppletExitReason_Normal = 0,
|
||||||
|
LibAppletExitReason_Canceled = 1,
|
||||||
|
LibAppletExitReason_Abnormal = 2,
|
||||||
|
LibAppletExitReason_Unexpected = 10,
|
||||||
|
} LibAppletExitReason;
|
||||||
|
|
||||||
/// applet hook function.
|
/// applet hook function.
|
||||||
typedef void (*AppletHookFn)(AppletHookType hook, void* param);
|
typedef void (*AppletHookFn)(AppletHookType hook, void* param);
|
||||||
|
|
||||||
@ -113,6 +121,7 @@ typedef struct {
|
|||||||
LibAppletMode mode; ///< See ref \ref LibAppletMode.
|
LibAppletMode mode; ///< See ref \ref LibAppletMode.
|
||||||
u64 layer_handle; ///< Output from GetIndirectLayerConsumerHandle on 2.0.0+.
|
u64 layer_handle; ///< Output from GetIndirectLayerConsumerHandle on 2.0.0+.
|
||||||
bool creating_self; ///< When set, indicates that the LibraryApplet title is creating itself.
|
bool creating_self; ///< When set, indicates that the LibraryApplet title is creating itself.
|
||||||
|
LibAppletExitReason exitreason; ///< Set by \ref appletHolderJoin using the output from cmd GetResult, see \ref LibAppletExitReason.
|
||||||
} AppletHolder;
|
} AppletHolder;
|
||||||
|
|
||||||
Result appletInitialize(void);
|
Result appletInitialize(void);
|
||||||
@ -216,6 +225,18 @@ Result appletHolderGetIndirectLayerConsumerHandle(AppletHolder *h, u64 *out);
|
|||||||
*/
|
*/
|
||||||
Result appletHolderStart(AppletHolder *h);
|
Result appletHolderStart(AppletHolder *h);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Waits for the LibraryApplet to exit.
|
||||||
|
* @param h AppletHolder object.
|
||||||
|
*/
|
||||||
|
void appletHolderJoin(AppletHolder *h);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the \ref LibAppletExitReason set by \ref appletHolderJoin.
|
||||||
|
* @param h AppletHolder object.
|
||||||
|
*/
|
||||||
|
LibAppletExitReason appletHolderGetExitReason(AppletHolder *h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a storage.
|
* @brief Creates a storage.
|
||||||
* @param s Storage object.
|
* @param s Storage object.
|
||||||
|
@ -1602,6 +1602,31 @@ Result appletHolderStart(AppletHolder *h) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appletHolderJoin(AppletHolder *h) {
|
||||||
|
Result rc=0;
|
||||||
|
LibAppletExitReason res = LibAppletExitReason_Normal;
|
||||||
|
u32 desc=0;
|
||||||
|
eventWait(&h->StateChangedEvent, U64_MAX);
|
||||||
|
rc = _appletCmdNoIO(&h->s, 30);//GetResult
|
||||||
|
|
||||||
|
if (R_FAILED(rc)) {
|
||||||
|
res = LibAppletExitReason_Unexpected;
|
||||||
|
if (R_MODULE(rc) == 128) {
|
||||||
|
desc = R_DESCRIPTION(rc);
|
||||||
|
if (desc == 22) res = LibAppletExitReason_Canceled;
|
||||||
|
else {
|
||||||
|
if (desc >= 0x14 && desc < 0x32)res = LibAppletExitReason_Abnormal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h->exitreason = res;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 appletHolderGetExitReason(AppletHolder *h) {
|
||||||
|
return h->exitreason;
|
||||||
|
}
|
||||||
|
|
||||||
Result appletCreateStorage(AppletStorage *s, s64 size) {
|
Result appletCreateStorage(AppletStorage *s, s64 size) {
|
||||||
memset(s, 0, sizeof(AppletStorage));
|
memset(s, 0, sizeof(AppletStorage));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user