libnx  v4.6.0
Data Structures | Functions
libapplet.h File Reference

LibraryApplet wrapper. More...

#include "../types.h"
#include "../services/applet.h"
#include "../services/acc.h"

Go to the source code of this file.

Data Structures

struct  LibAppletArgs
 CommonArguments. More...
 

Functions

void libappletArgsCreate (LibAppletArgs *a, u32 version)
 Creates a LibAppletArgs struct. More...
 
void libappletArgsSetPlayStartupSound (LibAppletArgs *a, bool flag)
 Sets the PlayStartupSound field in LibAppletArgs. More...
 
Result libappletCreateWriteStorage (AppletStorage *s, const void *buffer, size_t size)
 Creates an AppletStorage with the specified size and writes the buffer contents to that storage at offset 0. More...
 
Result libappletReadStorage (AppletStorage *s, void *buffer, size_t size, size_t *transfer_size)
 Reads data from offset 0 from the specified storage into the buffer. More...
 
Result libappletArgsPush (LibAppletArgs *a, AppletHolder *h)
 Sets the tick field in LibAppletArgs, then creates a storage with it which is pushed to the AppletHolder via appletHolderPushInData. More...
 
Result libappletArgsPop (LibAppletArgs *a)
 Uses appletPopInData and reads it to the specified LibAppletArgs. More...
 
Result libappletPushInData (AppletHolder *h, const void *buffer, size_t size)
 Creates a storage using the input buffer which is pushed to the AppletHolder via appletHolderPushInData. More...
 
Result libappletPopOutData (AppletHolder *h, void *buffer, size_t size, size_t *transfer_size)
 Pops a storage via appletHolderPopOutData, uses libappletReadStorage, then closes the storage. More...
 
void libappletSetJumpFlag (bool flag)
 Sets whether libappletStart uses appletHolderJump. More...
 
Result libappletStart (AppletHolder *h)
 If the flag from libappletSetJumpFlag is set, this just uses appletHolderJump. More...
 
Result libappletLaunch (AppletId id, LibAppletArgs *commonargs, const void *arg, size_t arg_size, void *reply, size_t reply_size, size_t *out_reply_size)
 Creates a LibraryApplet with the specified input storage data, uses libappletStart, and reads the output storage reply data via libappletPopOutData. More...
 
Result libappletRequestHomeMenu (void)
 Wrapper for appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this. More...
 
Result libappletRequestJumpToSystemUpdate (void)
 Wrapper for appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this. More...
 
Result libappletRequestToLaunchApplication (u64 application_id, AccountUid uid, const void *buffer, size_t size, u32 sender)
 Wrapper for appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this. More...
 
Result libappletRequestJumpToStory (AccountUid uid, u64 application_id)
 Wrapper for appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this. More...
 

Detailed Description

LibraryApplet wrapper.

Author
yellows8

Function Documentation

◆ libappletArgsCreate()

void libappletArgsCreate ( LibAppletArgs a,
u32  version 
)

Creates a LibAppletArgs struct.

Parameters
aLibAppletArgs struct.
versionLaVersion for LibAppletArgs.

◆ libappletArgsPop()

Result libappletArgsPop ( LibAppletArgs a)

Uses appletPopInData and reads it to the specified LibAppletArgs.

The LibAppletArgs is validated, an error is thrown when invalid.

Parameters
[out]aLibAppletArgs struct.

◆ libappletArgsPush()

Result libappletArgsPush ( LibAppletArgs a,
AppletHolder h 
)

Sets the tick field in LibAppletArgs, then creates a storage with it which is pushed to the AppletHolder via appletHolderPushInData.

Parameters
aLibAppletArgs struct.
hAppletHolder object.

◆ libappletArgsSetPlayStartupSound()

void libappletArgsSetPlayStartupSound ( LibAppletArgs a,
bool  flag 
)

Sets the PlayStartupSound field in LibAppletArgs.

Parameters
aLibAppletArgs struct.
flagValue for LibAppletArgs PlayStartupSound.

◆ libappletCreateWriteStorage()

Result libappletCreateWriteStorage ( AppletStorage s,
const void *  buffer,
size_t  size 
)

Creates an AppletStorage with the specified size and writes the buffer contents to that storage at offset 0.

Parameters
[out]sStorage object.
bufferInput buffer.
sizeSize to write.

◆ libappletLaunch()

Result libappletLaunch ( AppletId  id,
LibAppletArgs commonargs,
const void *  arg,
size_t  arg_size,
void *  reply,
size_t  reply_size,
size_t *  out_reply_size 
)

Creates a LibraryApplet with the specified input storage data, uses libappletStart, and reads the output storage reply data via libappletPopOutData.

Parameters
idAppletId
commonargsLibAppletArgs struct.
argInput storage data buffer. Optional, can be NULL.
arg_sizeSize of the arg buffer.
replyOutput storage data buffer. Optional, can be NULL.
reply_sizeSize to read for the reply buffer.
out_reply_sizeActual read reply data size, see libappletPopOutData.

◆ libappletPopOutData()

Result libappletPopOutData ( AppletHolder h,
void *  buffer,
size_t  size,
size_t *  transfer_size 
)

Pops a storage via appletHolderPopOutData, uses libappletReadStorage, then closes the storage.

Parameters
hAppletHolder object.
bufferOutput buffer.
sizeSize to read.
transfer_sizeOptional output size field for the actual size used for the read, can be NULL.

◆ libappletPushInData()

Result libappletPushInData ( AppletHolder h,
const void *  buffer,
size_t  size 
)

Creates a storage using the input buffer which is pushed to the AppletHolder via appletHolderPushInData.

Parameters
hAppletHolder object.
bufferInput data buffer.
sizeInput data size.

◆ libappletReadStorage()

Result libappletReadStorage ( AppletStorage s,
void *  buffer,
size_t  size,
size_t *  transfer_size 
)

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.

Parameters
sStorage object.
bufferOutput buffer.
sizeSize to read.
transfer_sizeOptional output size field for the actual size used for the read, can be NULL.

◆ libappletRequestHomeMenu()

Result libappletRequestHomeMenu ( void  )

Wrapper for appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this.

Returns to the main Home Menu, equivalent to pressing the HOME button.

◆ libappletRequestJumpToStory()

Result libappletRequestJumpToStory ( AccountUid  uid,
u64  application_id 
)

Wrapper for appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this.

Note
Only available on [11.0.0+].
Parameters
[in]uidAccountUid
[in]application_idOptional ApplicationId, can be 0.

◆ libappletRequestJumpToSystemUpdate()

Result libappletRequestJumpToSystemUpdate ( void  )

Wrapper for appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this.

Equivalent to entering "System Update" under System Settings. When leaving this, it returns to the main Home Menu.

◆ libappletRequestToLaunchApplication()

Result libappletRequestToLaunchApplication ( u64  application_id,
AccountUid  uid,
const void *  buffer,
size_t  size,
u32  sender 
)

Wrapper for appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this.

Note
Only available on [11.0.0+].
Parameters
[in]application_idApplicationId
[in]uidAccountUid
[in]bufferInput buffer.
[in]sizeInput buffer size.
[in]senderLaunchApplicationRequestSender

◆ libappletSetJumpFlag()

void libappletSetJumpFlag ( bool  flag)

Sets whether libappletStart uses appletHolderJump.

Parameters
flagFlag. Value true should not be used unless running as AppletType_LibraryApplet.

◆ libappletStart()

Result libappletStart ( AppletHolder h)

If the flag from libappletSetJumpFlag is set, this just uses appletHolderJump.

Otherwise, starts the applet and waits for it to finish, then checks the LibAppletExitReason.

Note
Uses appletHolderStart and appletHolderJoin.
Parameters
hAppletHolder object.