libctru  v2.4.1
Data Structures | Typedefs | Enumerations | Functions
apt.h File Reference

APT (Applet) service. More...

Go to the source code of this file.

Data Structures

struct  aptCaptureBufInfo
 APT capture buffer information. More...
 
struct  aptHookCookie
 APT hook cookie. More...
 

Typedefs

typedef u8 APT_AppletAttr
 
typedef void(* aptHookFn) (APT_HookType hook, void *param)
 APT hook function.
 
typedef void(* aptMessageCb) (void *user, NS_APPID sender, void *msg, size_t msgsize)
 APT message callback.
 

Enumerations

enum  NS_APPID {
  APPID_NONE = 0 ,
  APPID_HOMEMENU = 0x101 ,
  APPID_CAMERA = 0x110 ,
  APPID_FRIENDS_LIST = 0x112 ,
  APPID_GAME_NOTES = 0x113 ,
  APPID_WEB = 0x114 ,
  APPID_INSTRUCTION_MANUAL = 0x115 ,
  APPID_NOTIFICATIONS = 0x116 ,
  APPID_MIIVERSE = 0x117 ,
  APPID_MIIVERSE_POSTING = 0x118 ,
  APPID_AMIIBO_SETTINGS = 0x119 ,
  APPID_APPLICATION = 0x300 ,
  APPID_ESHOP = 0x301 ,
  APPID_SOFTWARE_KEYBOARD = 0x401 ,
  APPID_APPLETED = 0x402 ,
  APPID_PNOTE_AP = 0x404 ,
  APPID_SNOTE_AP = 0x405 ,
  APPID_ERROR = 0x406 ,
  APPID_MINT = 0x407 ,
  APPID_EXTRAPAD = 0x408 ,
  APPID_MEMOLIB = 0x409
}
 NS Application IDs. More...
 
enum  APT_AppletPos {
  APTPOS_NONE = -1 ,
  APTPOS_APP = 0 ,
  APTPOS_APPLIB = 1 ,
  APTPOS_SYS = 2 ,
  APTPOS_SYSLIB = 3 ,
  APTPOS_RESIDENT = 4
}
 APT applet position. More...
 
enum  APT_QueryReply {
  APTREPLY_REJECT = 0 ,
  APTREPLY_ACCEPT = 1 ,
  APTREPLY_LATER = 2
}
 APT query reply.
 
enum  APT_Signal {
  APTSIGNAL_NONE = 0 ,
  APTSIGNAL_HOMEBUTTON = 1 ,
  APTSIGNAL_HOMEBUTTON2 = 2 ,
  APTSIGNAL_SLEEP_QUERY = 3 ,
  APTSIGNAL_SLEEP_CANCEL = 4 ,
  APTSIGNAL_SLEEP_ENTER = 5 ,
  APTSIGNAL_SLEEP_WAKEUP = 6 ,
  APTSIGNAL_SHUTDOWN = 7 ,
  APTSIGNAL_POWERBUTTON = 8 ,
  APTSIGNAL_POWERBUTTON2 = 9 ,
  APTSIGNAL_TRY_SLEEP = 10 ,
  APTSIGNAL_ORDERTOCLOSE = 11
}
 APT signals. More...
 
enum  APT_Command {
  APTCMD_NONE = 0 ,
  APTCMD_WAKEUP = 1 ,
  APTCMD_REQUEST = 2 ,
  APTCMD_RESPONSE = 3 ,
  APTCMD_EXIT = 4 ,
  APTCMD_MESSAGE = 5 ,
  APTCMD_HOMEBUTTON_ONCE = 6 ,
  APTCMD_HOMEBUTTON_TWICE = 7 ,
  APTCMD_DSP_SLEEP = 8 ,
  APTCMD_DSP_WAKEUP = 9 ,
  APTCMD_WAKEUP_EXIT = 10 ,
  APTCMD_WAKEUP_PAUSE = 11 ,
  APTCMD_WAKEUP_CANCEL = 12 ,
  APTCMD_WAKEUP_CANCELALL = 13 ,
  APTCMD_WAKEUP_POWERBUTTON = 14 ,
  APTCMD_WAKEUP_JUMPTOHOME = 15 ,
  APTCMD_SYSAPPLET_REQUEST = 16 ,
  APTCMD_WAKEUP_LAUNCHAPP = 17
}
 APT commands. More...
 
enum  APT_HookType {
  APTHOOK_ONSUSPEND = 0 ,
  APTHOOK_ONRESTORE ,
  APTHOOK_ONSLEEP ,
  APTHOOK_ONWAKEUP ,
  APTHOOK_ONEXIT ,
  APTHOOK_COUNT
}
 APT hook types. More...
 

Functions

static APT_AppletAttr aptMakeAppletAttr (APT_AppletPos pos, bool manualGpuRights, bool manualDspRights)
 Create an APT_AppletAttr bitfield from its components.
 
Result aptInit (void)
 Initializes APT.
 
void aptExit (void)
 Exits APT.
 
Result aptSendCommand (u32 *aptcmdbuf)
 Sends an APT command through IPC, taking care of locking, opening and closing an APT session. More...
 
bool aptIsActive (void)
 Returns true if the application is currently in the foreground.
 
bool aptShouldClose (void)
 Returns true if the system has told the application to close.
 
bool aptIsSleepAllowed (void)
 Returns true if the system can enter sleep mode while the application is active.
 
void aptSetSleepAllowed (bool allowed)
 Configures whether the system can enter sleep mode while the application is active.
 
void aptHandleSleep (void)
 Handles incoming sleep mode requests.
 
bool aptIsHomeAllowed (void)
 Returns true if the user can press the HOME button to jump back to the HOME menu while the application is active.
 
void aptSetHomeAllowed (bool allowed)
 Configures whether the user can press the HOME button to jump back to the HOME menu while the application is active.
 
bool aptShouldJumpToHome (void)
 Returns true if the system requires the application to jump back to the HOME menu.
 
bool aptCheckHomePressRejected (void)
 Returns true if there is an incoming HOME button press rejected by the policy set by aptSetHomeAllowed (use this to show a "no HOME allowed" icon).
 
static CTR_DEPRECATED bool aptIsHomePressed (void)
 
void aptJumpToHomeMenu (void)
 Jumps back to the HOME menu.
 
static void aptHandleJumpToHome (void)
 Handles incoming jump-to-HOME requests.
 
bool aptMainLoop (void)
 Main function which handles sleep mode and HOME/power buttons - call this at the beginning of every frame. More...
 
void aptHook (aptHookCookie *cookie, aptHookFn callback, void *param)
 Sets up an APT status hook. More...
 
void aptUnhook (aptHookCookie *cookie)
 Removes an APT status hook. More...
 
void aptSetMessageCallback (aptMessageCb callback, void *user)
 Sets the function to be called when an APT message from another applet is received. More...
 
void aptLaunchLibraryApplet (NS_APPID appId, void *buf, size_t bufsize, Handle handle)
 Launches a library applet. More...
 
void aptClearChainloader (void)
 Clears the chainloader state.
 
void aptSetChainloader (u64 programID, u8 mediatype)
 Configures the chainloader to launch a specific application. More...
 
void aptSetChainloaderToCaller (void)
 Configures the chainloader to launch the previous application.
 
void aptSetChainloaderToSelf (void)
 Configures the chainloader to relaunch the current application (i.e. soft-reset)
 
void aptSetChainloaderArgs (const void *deliverArg, size_t deliverArgSize, const void *hmac)
 Sets the "deliver arg" and HMAC for the chainloader, which will be passed to the target 3DS/DS(i) application. More...
 
Result APT_GetLockHandle (u16 flags, Handle *lockHandle)
 Gets an APT lock handle. More...
 
Result APT_Initialize (NS_APPID appId, APT_AppletAttr attr, Handle *signalEvent, Handle *resumeEvent)
 Initializes an application's registration with APT. More...
 
Result APT_Finalize (NS_APPID appId)
 Terminates an application's registration with APT. More...
 
Result APT_HardwareResetAsync (void)
 Asynchronously resets the hardware.
 
Result APT_Enable (APT_AppletAttr attr)
 Enables APT. More...
 
Result APT_GetAppletManInfo (APT_AppletPos inpos, APT_AppletPos *outpos, NS_APPID *req_appid, NS_APPID *menu_appid, NS_APPID *active_appid)
 Gets applet management info. More...
 
static NS_APPID aptGetMenuAppID (void)
 Gets the menu's app ID. More...
 
Result APT_GetAppletInfo (NS_APPID appID, u64 *pProgramID, u8 *pMediaType, bool *pRegistered, bool *pLoadState, APT_AppletAttr *pAttributes)
 Gets an applet's information. More...
 
Result APT_GetAppletProgramInfo (u32 id, u32 flags, u16 *titleversion)
 Gets an applet's program information. More...
 
Result APT_GetProgramID (u64 *pProgramID)
 Gets the current application's program ID. More...
 
Result APT_PrepareToJumpToHomeMenu (void)
 Prepares to jump to the home menu.
 
Result APT_JumpToHomeMenu (const void *param, size_t paramSize, Handle handle)
 Jumps to the home menu. More...
 
Result APT_PrepareToJumpToApplication (bool exiting)
 Prepares to jump to an application. More...
 
Result APT_JumpToApplication (const void *param, size_t paramSize, Handle handle)
 Jumps to an application. More...
 
Result APT_IsRegistered (NS_APPID appID, bool *out)
 Gets whether an application is registered. More...
 
Result APT_InquireNotification (u32 appID, APT_Signal *signalType)
 Inquires as to whether a signal has been received. More...
 
Result APT_SleepSystem (const struct PtmWakeEvents *wakeEvents)
 Requests to enter sleep mode, and later sets wake events if allowed to. More...
 
Result APT_NotifyToWait (NS_APPID appID)
 Notifies an application to wait. More...
 
Result APT_AppletUtility (int id, void *out, size_t outSize, const void *in, size_t inSize)
 Calls an applet utility function. More...
 
Result APT_SleepIfShellClosed (void)
 Sleeps if shell is closed (?).
 
Result APT_LockTransition (u32 transition, bool flag)
 Locks a transition (?). More...
 
Result APT_TryLockTransition (u32 transition, bool *succeeded)
 Tries to lock a transition (?). More...
 
Result APT_UnlockTransition (u32 transition)
 Unlocks a transition (?). More...
 
Result APT_GlanceParameter (NS_APPID appID, void *buffer, size_t bufferSize, NS_APPID *sender, APT_Command *command, size_t *actualSize, Handle *parameter)
 Glances at a receieved parameter without removing it from the queue. More...
 
Result APT_ReceiveParameter (NS_APPID appID, void *buffer, size_t bufferSize, NS_APPID *sender, APT_Command *command, size_t *actualSize, Handle *parameter)
 Receives a parameter. More...
 
Result APT_SendParameter (NS_APPID source, NS_APPID dest, APT_Command command, const void *buffer, u32 bufferSize, Handle parameter)
 Sends a parameter. More...
 
Result APT_CancelParameter (NS_APPID source, NS_APPID dest, bool *success)
 Cancels a parameter which matches the specified source and dest AppIDs. More...
 
Result APT_SendCaptureBufferInfo (const aptCaptureBufInfo *captureBuf)
 Sends capture buffer information. More...
 
Result APT_ReplySleepQuery (NS_APPID appID, APT_QueryReply reply)
 Replies to a sleep query. More...
 
Result APT_ReplySleepNotificationComplete (NS_APPID appID)
 Replies that a sleep notification has been completed. More...
 
Result APT_PrepareToCloseApplication (bool cancelPreload)
 Prepares to close the application. More...
 
Result APT_CloseApplication (const void *param, size_t paramSize, Handle handle)
 Closes the application. More...
 
Result APT_SetAppCpuTimeLimit (u32 percent)
 Sets the application's CPU time limit. More...
 
Result APT_GetAppCpuTimeLimit (u32 *percent)
 Gets the application's CPU time limit. More...
 
Result APT_CheckNew3DS (bool *out)
 Checks whether the system is a New 3DS. More...
 
Result APT_PrepareToDoApplicationJump (u8 flags, u64 programID, u8 mediatype)
 Prepares for an applicaton jump. More...
 
Result APT_DoApplicationJump (const void *param, size_t paramSize, const void *hmac)
 Performs an application jump. More...
 
Result APT_PrepareToStartLibraryApplet (NS_APPID appID)
 Prepares to start a library applet. More...
 
Result APT_StartLibraryApplet (NS_APPID appID, const void *param, size_t paramSize, Handle handle)
 Starts a library applet. More...
 
Result APT_PrepareToStartSystemApplet (NS_APPID appID)
 Prepares to start a system applet. More...
 
Result APT_StartSystemApplet (NS_APPID appID, const void *param, size_t paramSize, Handle handle)
 Starts a system applet. More...
 
Result APT_GetSharedFont (Handle *fontHandle, u32 *mapAddr)
 Retrieves the shared system font. More...
 
Result APT_ReceiveDeliverArg (void *param, size_t paramSize, void *hmac, u64 *sender, bool *received)
 Receives the deliver (launch) argument. More...
 

Detailed Description

APT (Applet) service.

Enumeration Type Documentation

◆ APT_AppletPos

APT applet position.

Enumerator
APTPOS_NONE 

No position specified.

APTPOS_APP 

Application.

APTPOS_APPLIB 

Application library (?).

APTPOS_SYS 

System applet.

APTPOS_SYSLIB 

System library (?).

APTPOS_RESIDENT 

Resident applet.

◆ APT_Command

APT commands.

Enumerator
APTCMD_NONE 

No command received.

APTCMD_WAKEUP 

Applet should wake up.

APTCMD_REQUEST 

Source applet sent us a parameter.

APTCMD_RESPONSE 

Target applet replied to our parameter.

APTCMD_EXIT 

Exit (??)

APTCMD_MESSAGE 

Message (??)

APTCMD_HOMEBUTTON_ONCE 

HOME button pressed once.

APTCMD_HOMEBUTTON_TWICE 

HOME button pressed twice (double-pressed).

APTCMD_DSP_SLEEP 

DSP should sleep (manual DSP rights related?).

APTCMD_DSP_WAKEUP 

DSP should wake up (manual DSP rights related?).

APTCMD_WAKEUP_EXIT 

Applet wakes up due to a different applet exiting.

APTCMD_WAKEUP_PAUSE 

Applet wakes up after being paused through HOME menu.

APTCMD_WAKEUP_CANCEL 

Applet wakes up due to being cancelled.

APTCMD_WAKEUP_CANCELALL 

Applet wakes up due to all applets being cancelled.

APTCMD_WAKEUP_POWERBUTTON 

Applet wakes up due to POWER button being pressed (?).

APTCMD_WAKEUP_JUMPTOHOME 

Applet wakes up and is instructed to jump to HOME menu (?).

APTCMD_SYSAPPLET_REQUEST 

Request for sysapplet (?).

APTCMD_WAKEUP_LAUNCHAPP 

Applet wakes up and is instructed to launch another applet (?).

◆ APT_HookType

APT hook types.

Enumerator
APTHOOK_ONSUSPEND 

App suspended.

APTHOOK_ONRESTORE 

App restored.

APTHOOK_ONSLEEP 

App sleeping.

APTHOOK_ONWAKEUP 

App waking up.

APTHOOK_ONEXIT 

App exiting.

APTHOOK_COUNT 

Number of APT hook types.

◆ APT_Signal

enum APT_Signal

APT signals.

Enumerator
APTSIGNAL_NONE 

No signal received.

APTSIGNAL_HOMEBUTTON 

HOME button pressed.

APTSIGNAL_HOMEBUTTON2 

HOME button pressed (again?).

APTSIGNAL_SLEEP_QUERY 

Prepare to enter sleep mode.

APTSIGNAL_SLEEP_CANCEL 

Triggered when ptm:s GetShellStatus() returns 5.

APTSIGNAL_SLEEP_ENTER 

Enter sleep mode.

APTSIGNAL_SLEEP_WAKEUP 

Wake from sleep mode.

APTSIGNAL_SHUTDOWN 

Shutdown.

APTSIGNAL_POWERBUTTON 

POWER button pressed.

APTSIGNAL_POWERBUTTON2 

POWER button cleared (?).

APTSIGNAL_TRY_SLEEP 

System sleeping (?).

APTSIGNAL_ORDERTOCLOSE 

Order to close (such as when an error happens?).

◆ NS_APPID

enum NS_APPID

NS Application IDs.

Retrieved from http://3dbrew.org/wiki/NS_and_APT_Services#AppIDs

Enumerator
APPID_HOMEMENU 

Home Menu.

APPID_CAMERA 

Camera applet.

APPID_FRIENDS_LIST 

Friends List applet.

APPID_GAME_NOTES 

Game Notes applet.

APPID_WEB 

Internet Browser.

APPID_INSTRUCTION_MANUAL 

Instruction Manual applet.

APPID_NOTIFICATIONS 

Notifications applet.

APPID_MIIVERSE 

Miiverse applet (olv)

APPID_MIIVERSE_POSTING 

Miiverse posting applet (solv3)

APPID_AMIIBO_SETTINGS 

Amiibo settings applet (cabinet)

APPID_APPLICATION 

Application.

APPID_ESHOP 

eShop (tiger)

APPID_SOFTWARE_KEYBOARD 

Software Keyboard.

APPID_APPLETED 

appletEd

APPID_PNOTE_AP 

PNOTE_AP.

APPID_SNOTE_AP 

SNOTE_AP.

APPID_ERROR 

error

APPID_MINT 

mint

APPID_EXTRAPAD 

extrapad

APPID_MEMOLIB 

memolib

Function Documentation

◆ APT_AppletUtility()

Result APT_AppletUtility ( int  id,
void *  out,
size_t  outSize,
const void *  in,
size_t  inSize 
)

Calls an applet utility function.

Parameters
idUtility function to call.
outPointer to write output data to.
outSizeSize of the output buffer.
inPointer to the input data.
inSizeSize of the input buffer.

◆ APT_CancelParameter()

Result APT_CancelParameter ( NS_APPID  source,
NS_APPID  dest,
bool *  success 
)

Cancels a parameter which matches the specified source and dest AppIDs.

Parameters
sourceAppID of the source application (use APPID_NONE to disable the check).
destAppID of the destination application (use APPID_NONE to disable the check).
successPointer to output true if a parameter was cancelled, or false otherwise.

◆ APT_CheckNew3DS()

Result APT_CheckNew3DS ( bool *  out)

Checks whether the system is a New 3DS.

Parameters
outPointer to write the New 3DS flag to.

◆ APT_CloseApplication()

Result APT_CloseApplication ( const void *  param,
size_t  paramSize,
Handle  handle 
)

Closes the application.

Parameters
paramParameters to close with.
paramSizeSize of param.
handleHandle to pass.

◆ APT_DoApplicationJump()

Result APT_DoApplicationJump ( const void *  param,
size_t  paramSize,
const void *  hmac 
)

Performs an application jump.

Parameters
paramParameter buffer.
paramSizeSize of parameter buffer.
hmacHMAC buffer (should be 0x20 bytes long).

◆ APT_Enable()

Result APT_Enable ( APT_AppletAttr  attr)

Enables APT.

Parameters
attrAttributes of the application.

◆ APT_Finalize()

Result APT_Finalize ( NS_APPID  appId)

Terminates an application's registration with APT.

Parameters
appIDID of the application.

◆ APT_GetAppCpuTimeLimit()

Result APT_GetAppCpuTimeLimit ( u32 percent)

Gets the application's CPU time limit.

Parameters
percentPointer to output the CPU time limit percentage to.

◆ APT_GetAppletInfo()

Result APT_GetAppletInfo ( NS_APPID  appID,
u64 pProgramID,
u8 pMediaType,
bool *  pRegistered,
bool *  pLoadState,
APT_AppletAttr *  pAttributes 
)

Gets an applet's information.

Parameters
appIDAppID of the applet.
pProgramIDPointer to output the program ID to.
pMediaTypePointer to output the media type to.
pRegisteredPointer to output the registration status to.
pLoadStatePointer to output the load state to.
pAttributesPointer to output the applet atrributes to.

◆ APT_GetAppletManInfo()

Result APT_GetAppletManInfo ( APT_AppletPos  inpos,
APT_AppletPos outpos,
NS_APPID req_appid,
NS_APPID menu_appid,
NS_APPID active_appid 
)

Gets applet management info.

Parameters
inposRequested applet position.
outposPointer to output the position of the current applet to.
req_appidPointer to output the AppID of the applet at the requested position to.
menu_appidPointer to output the HOME menu AppID to.
active_appidPointer to output the AppID of the currently active applet to.

◆ APT_GetAppletProgramInfo()

Result APT_GetAppletProgramInfo ( u32  id,
u32  flags,
u16 titleversion 
)

Gets an applet's program information.

Parameters
idID of the applet.
flagsFlags to use when retreiving the information.
titleversionPointer to output the applet's title version to.

Flags:

  • 0x01: Use AM_ListTitles with NAND media type.
  • 0x02: Use AM_ListTitles with SDMC media type.
  • 0x04: Use AM_ListTitles with GAMECARD media type.
  • 0x10: Input ID is an app ID. Must be set if 0x20 is not.
  • 0x20: Input ID is a program ID. Must be set if 0x10 is not.
  • 0x100: Sets program ID high to 0x00040000, else it is 0x00040010. Only used when 0x20 is set.

◆ APT_GetLockHandle()

Result APT_GetLockHandle ( u16  flags,
Handle lockHandle 
)

Gets an APT lock handle.

Parameters
flagsFlags to use.
lockHandlePointer to output the lock handle to.

◆ APT_GetProgramID()

Result APT_GetProgramID ( u64 pProgramID)

Gets the current application's program ID.

Parameters
pProgramIDPointer to output the program ID to.

◆ APT_GetSharedFont()

Result APT_GetSharedFont ( Handle fontHandle,
u32 mapAddr 
)

Retrieves the shared system font.

fontHandle Pointer to write the handle of the system font memory block to.

mapAddr Pointer to write the mapping address of the system font memory block to.

◆ APT_GlanceParameter()

Result APT_GlanceParameter ( NS_APPID  appID,
void *  buffer,
size_t  bufferSize,
NS_APPID sender,
APT_Command command,
size_t *  actualSize,
Handle parameter 
)

Glances at a receieved parameter without removing it from the queue.

Parameters
appIDAppID of the application.
bufferBuffer to receive to.
bufferSizeSize of the buffer.
senderPointer to output the sender's AppID to.
commandPointer to output the command ID to.
actualSizePointer to output the actual received data size to.
parameterPointer to output the parameter handle to.

◆ APT_Initialize()

Result APT_Initialize ( NS_APPID  appId,
APT_AppletAttr  attr,
Handle signalEvent,
Handle resumeEvent 
)

Initializes an application's registration with APT.

Parameters
appIdID of the application.
attrAttributes of the application.
signalEventPointer to output the signal event handle to.
resumeEventPointer to output the resume event handle to.

◆ APT_InquireNotification()

Result APT_InquireNotification ( u32  appID,
APT_Signal signalType 
)

Inquires as to whether a signal has been received.

Parameters
appIDID of the application.
signalTypePointer to output the signal type to.

◆ APT_IsRegistered()

Result APT_IsRegistered ( NS_APPID  appID,
bool *  out 
)

Gets whether an application is registered.

Parameters
appIDID of the application.
outPointer to output the registration state to.

◆ APT_JumpToApplication()

Result APT_JumpToApplication ( const void *  param,
size_t  paramSize,
Handle  handle 
)

Jumps to an application.

Parameters
paramParameters to jump with.
Sizeof the parameter buffer.
handleHandle to pass.

◆ APT_JumpToHomeMenu()

Result APT_JumpToHomeMenu ( const void *  param,
size_t  paramSize,
Handle  handle 
)

Jumps to the home menu.

Parameters
paramParameters to jump with.
Sizeof the parameter buffer.
handleHandle to pass.

◆ APT_LockTransition()

Result APT_LockTransition ( u32  transition,
bool  flag 
)

Locks a transition (?).

Parameters
transitionTransition ID.
flagFlag (?)

◆ APT_NotifyToWait()

Result APT_NotifyToWait ( NS_APPID  appID)

Notifies an application to wait.

Parameters
appIDID of the application.

◆ APT_PrepareToCloseApplication()

Result APT_PrepareToCloseApplication ( bool  cancelPreload)

Prepares to close the application.

Parameters
cancelPreloadWhether applet preloads should be cancelled.

◆ APT_PrepareToDoApplicationJump()

Result APT_PrepareToDoApplicationJump ( u8  flags,
u64  programID,
u8  mediatype 
)

Prepares for an applicaton jump.

Parameters
flagsFlags to use.
programIDID of the program to jump to.
mediatypeMedia type of the program to jump to.

◆ APT_PrepareToJumpToApplication()

Result APT_PrepareToJumpToApplication ( bool  exiting)

Prepares to jump to an application.

Parameters
exitingSpecifies whether the applet is exiting.

◆ APT_PrepareToStartLibraryApplet()

Result APT_PrepareToStartLibraryApplet ( NS_APPID  appID)

Prepares to start a library applet.

Parameters
appIDAppID of the applet to start.

◆ APT_PrepareToStartSystemApplet()

Result APT_PrepareToStartSystemApplet ( NS_APPID  appID)

Prepares to start a system applet.

Parameters
appIDAppID of the applet to start.

◆ APT_ReceiveDeliverArg()

Result APT_ReceiveDeliverArg ( void *  param,
size_t  paramSize,
void *  hmac,
u64 sender,
bool *  received 
)

Receives the deliver (launch) argument.

Parameters
paramParameter buffer.
paramSizeSize of parameter buffer.
hmacHMAC buffer (should be 0x20 bytes long).
senderPointer to output the sender's AppID to.
receivedPointer to output whether an argument was received to.

◆ APT_ReceiveParameter()

Result APT_ReceiveParameter ( NS_APPID  appID,
void *  buffer,
size_t  bufferSize,
NS_APPID sender,
APT_Command command,
size_t *  actualSize,
Handle parameter 
)

Receives a parameter.

Parameters
appIDAppID of the application.
bufferBuffer to receive to.
bufferSizeSize of the buffer.
senderPointer to output the sender's AppID to.
commandPointer to output the command ID to.
actualSizePointer to output the actual received data size to.
parameterPointer to output the parameter handle to.

◆ APT_ReplySleepNotificationComplete()

Result APT_ReplySleepNotificationComplete ( NS_APPID  appID)

Replies that a sleep notification has been completed.

Parameters
appIDID of the application.

◆ APT_ReplySleepQuery()

Result APT_ReplySleepQuery ( NS_APPID  appID,
APT_QueryReply  reply 
)

Replies to a sleep query.

Parameters
appIDID of the application.
replyQuery reply value.

◆ APT_SendCaptureBufferInfo()

Result APT_SendCaptureBufferInfo ( const aptCaptureBufInfo captureBuf)

Sends capture buffer information.

Parameters
captureBufCapture buffer information to send.

◆ APT_SendParameter()

Result APT_SendParameter ( NS_APPID  source,
NS_APPID  dest,
APT_Command  command,
const void *  buffer,
u32  bufferSize,
Handle  parameter 
)

Sends a parameter.

Parameters
sourceAppID of the source application.
destAppID of the destination application.
commandCommand to send.
bufferBuffer to send.
bufferSizeSize of the buffer.
parameterParameter handle to pass.

◆ APT_SetAppCpuTimeLimit()

Result APT_SetAppCpuTimeLimit ( u32  percent)

Sets the application's CPU time limit.

Parameters
percentCPU time limit percentage to set.

◆ APT_SleepSystem()

Result APT_SleepSystem ( const struct PtmWakeEvents wakeEvents)

Requests to enter sleep mode, and later sets wake events if allowed to.

Parameters
wakeEventsThe wake events. Limited to "shell" (bit 1) for the PDN wake events part and "shell opened", "shell closed" and "HOME button pressed" for the MCU interrupts part.

◆ APT_StartLibraryApplet()

Result APT_StartLibraryApplet ( NS_APPID  appID,
const void *  param,
size_t  paramSize,
Handle  handle 
)

Starts a library applet.

Parameters
appIDAppID of the applet to launch.
paramBuffer containing applet parameters.
paramsizeSize of the buffer.
handleHandle to pass to the applet.

◆ APT_StartSystemApplet()

Result APT_StartSystemApplet ( NS_APPID  appID,
const void *  param,
size_t  paramSize,
Handle  handle 
)

Starts a system applet.

Parameters
appIDAppID of the applet to launch.
paramBuffer containing applet parameters.
paramSizeSize of the parameter buffer.
handleHandle to pass to the applet.

◆ APT_TryLockTransition()

Result APT_TryLockTransition ( u32  transition,
bool *  succeeded 
)

Tries to lock a transition (?).

Parameters
transitionTransition ID.
succeededPointer to output whether the lock was successfully applied.

◆ APT_UnlockTransition()

Result APT_UnlockTransition ( u32  transition)

Unlocks a transition (?).

Parameters
transitionTransition ID.

◆ aptGetMenuAppID()

static NS_APPID aptGetMenuAppID ( void  )
inlinestatic

Gets the menu's app ID.

Returns
The menu's app ID.

◆ aptHook()

void aptHook ( aptHookCookie cookie,
aptHookFn  callback,
void *  param 
)

Sets up an APT status hook.

Parameters
cookieHook cookie to use.
callbackFunction to call when APT's status changes.
paramUser-defined parameter to pass to the callback.

◆ aptIsHomePressed()

static CTR_DEPRECATED bool aptIsHomePressed ( void  )
inlinestatic

◆ aptLaunchLibraryApplet()

void aptLaunchLibraryApplet ( NS_APPID  appId,
void *  buf,
size_t  bufsize,
Handle  handle 
)

Launches a library applet.

Parameters
appIdID of the applet to launch.
bufInput/output buffer that contains launch parameters on entry and result data on exit.
bufsizeSize of the buffer.
handleHandle to pass to the library applet.
Examples
libapplet_launch/source/main.c.

◆ aptMainLoop()

bool aptMainLoop ( void  )

Main function which handles sleep mode and HOME/power buttons - call this at the beginning of every frame.

Returns
true if the application should keep running, false otherwise (see aptShouldClose).
Examples
app_launch/source/main.c, audio/filters/source/main.c, audio/mic/source/main.c, audio/streaming/source/main.c, camera/image/source/main.c, camera/video/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/both_screens/source/main.c, graphics/gpu/fragment_light/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/gpusprites/source/main.c, graphics/gpu/immediate/source/main.c, graphics/gpu/lenny/source/main.c, graphics/gpu/loop_subdivision/source/main.c, graphics/gpu/mipmap_fog/source/main.c, graphics/gpu/particles/source/main.c, graphics/gpu/proctex/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/gpu/toon_shading/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, graphics/printing/system-font/source/main.c, input/read-controls/source/main.c, input/software-keyboard/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, network/boss/source/main.c, network/http/source/main.c, network/http_post/source/main.c, network/sockets/source/sockets.c, network/sslc/source/ssl.c, network/uds/source/uds.c, nfc/source/main.c, romfs/source/main.c, sdmc/source/main.c, threads/event/source/main.c, threads/thread-basic/source/main.c, and time/rtc/source/main.c.

◆ aptSendCommand()

Result aptSendCommand ( u32 aptcmdbuf)

Sends an APT command through IPC, taking care of locking, opening and closing an APT session.

Parameters
aptcmdbufPointer to command buffer (should have capacity for at least 16 words).

◆ aptSetChainloader()

void aptSetChainloader ( u64  programID,
u8  mediatype 
)

Configures the chainloader to launch a specific application.

Parameters
programIDID of the program to chainload to.
mediatypeMedia type of the program to chainload to.
Examples
app_launch/source/main.c.

◆ aptSetChainloaderArgs()

void aptSetChainloaderArgs ( const void *  deliverArg,
size_t  deliverArgSize,
const void *  hmac 
)

Sets the "deliver arg" and HMAC for the chainloader, which will be passed to the target 3DS/DS(i) application.

The meaning of each parameter varies on a per-application basis.

Parameters
deliverArgDeliver arg to pass to the target application.
deliverArgSizeSize of the deliver arg, maximum 0x300 bytes.
hmacHMAC buffer, 32 bytes. Use NULL to pass an all-zero dummy HMAC.

◆ aptSetMessageCallback()

void aptSetMessageCallback ( aptMessageCb  callback,
void *  user 
)

Sets the function to be called when an APT message from another applet is received.

Parameters
callbackCallback function.
userUser-defined data to be passed to the callback.

◆ aptUnhook()

void aptUnhook ( aptHookCookie cookie)

Removes an APT status hook.

Parameters
cookieHook cookie to remove.