mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 04:22:50 +02:00
Added struct LibAppletInfo. Added appletHolderGetLibraryAppletInfo and appletGetLibraryAppletInfo.
This commit is contained in:
parent
64783b7cc2
commit
f49e8cb217
@ -196,6 +196,12 @@ typedef struct {
|
||||
LibAppletExitReason exitreason; ///< Set by \ref appletHolderJoin using the output from cmd GetResult, see \ref LibAppletExitReason.
|
||||
} AppletHolder;
|
||||
|
||||
/// LibraryAppletInfo
|
||||
typedef struct {
|
||||
AppletId appletId; ///< \ref AppletId
|
||||
LibAppletMode mode; ///< \ref LibAppletMode
|
||||
} LibAppletInfo;
|
||||
|
||||
/// IdentityInfo
|
||||
typedef struct {
|
||||
AppletId appletId; ///< \ref AppletId
|
||||
@ -759,6 +765,13 @@ Result appletHolderPushInteractiveInData(AppletHolder *h, AppletStorage *s);
|
||||
*/
|
||||
Result appletHolderPopInteractiveOutData(AppletHolder *h, AppletStorage *s);
|
||||
|
||||
/**
|
||||
* @brief Gets the \ref LibAppletInfo for the specified LibraryApplet.
|
||||
* @param h AppletHolder object.
|
||||
* @param[out] info \ref LibAppletInfo
|
||||
*/
|
||||
Result appletHolderGetLibraryAppletInfo(AppletHolder *h, LibAppletInfo *info);
|
||||
|
||||
// (ILibraryAppletCreator ->) IStorage
|
||||
|
||||
/**
|
||||
@ -1014,6 +1027,13 @@ Result appletGetGpuErrorDetectedSystemEvent(Event *out_event);
|
||||
|
||||
// ILibraryAppletSelfAccessor
|
||||
|
||||
/**
|
||||
* @brief Gets the \ref LibAppletInfo for the current LibraryApplet.
|
||||
* @note Only available with AppletType_LibraryApplet.
|
||||
* @param[out] info \ref LibAppletInfo
|
||||
*/
|
||||
Result appletGetLibraryAppletInfo(LibAppletInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Gets the \ref AppletIdentityInfo for the MainApplet.
|
||||
* @note Only available with AppletType_LibraryApplet.
|
||||
|
@ -990,6 +990,41 @@ static Result _appletCmdNoInOutStorage(Service* srv, AppletStorage* s, u64 cmd_i
|
||||
return _appletGetSession(srv, &s->s, cmd_id);
|
||||
}
|
||||
|
||||
static Result _appletGetLibraryAppletInfo(Service* srv, LibAppletInfo *info, u64 cmd_id) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
} *raw;
|
||||
|
||||
raw = serviceIpcPrepareHeader(srv, &c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = cmd_id;
|
||||
|
||||
Result rc = serviceIpcDispatch(srv);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
LibAppletInfo info;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(srv, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc) && info) memcpy(info, &resp->info, sizeof(LibAppletInfo));
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _appletGetIdentityInfo(Service* srv, AppletIdentityInfo *info, u64 cmd_id) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
@ -2289,6 +2324,10 @@ Result appletHolderPopInteractiveOutData(AppletHolder *h, AppletStorage *s) {
|
||||
return _appletCmdNoInOutStorage(&h->s, s, 104);
|
||||
}
|
||||
|
||||
Result appletHolderGetLibraryAppletInfo(AppletHolder *h, LibAppletInfo *info) {
|
||||
return _appletGetLibraryAppletInfo(&h->s, info, 120);
|
||||
}
|
||||
|
||||
// (ILibraryAppletCreator ->) IStorage
|
||||
|
||||
Result appletCreateStorage(AppletStorage *s, s64 size) {
|
||||
@ -3399,6 +3438,13 @@ static Result _appletExitProcessAndReturn(void) {
|
||||
return _appletCmdNoIO(&g_appletILibraryAppletSelfAccessor, 10);
|
||||
}
|
||||
|
||||
Result appletGetLibraryAppletInfo(LibAppletInfo *info) {
|
||||
if (__nx_applet_type != AppletType_LibraryApplet)
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
return _appletGetLibraryAppletInfo(&g_appletILibraryAppletSelfAccessor, info, 11);
|
||||
}
|
||||
|
||||
Result appletGetMainAppletIdentityInfo(AppletIdentityInfo *info) {
|
||||
if (__nx_applet_type != AppletType_LibraryApplet)
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
Loading…
Reference in New Issue
Block a user