libctru
v2.4.1
|
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. | |
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... | |
APT (Applet) service.
enum APT_AppletPos |
enum APT_Command |
APT commands.
enum APT_HookType |
enum APT_Signal |
APT signals.
enum NS_APPID |
NS Application IDs.
Retrieved from http://3dbrew.org/wiki/NS_and_APT_Services#AppIDs
Result APT_AppletUtility | ( | int | id, |
void * | out, | ||
size_t | outSize, | ||
const void * | in, | ||
size_t | inSize | ||
) |
Calls an applet utility function.
id | Utility function to call. |
out | Pointer to write output data to. |
outSize | Size of the output buffer. |
in | Pointer to the input data. |
inSize | Size of the input buffer. |
Cancels a parameter which matches the specified source and dest AppIDs.
source | AppID of the source application (use APPID_NONE to disable the check). |
dest | AppID of the destination application (use APPID_NONE to disable the check). |
success | Pointer to output true if a parameter was cancelled, or false otherwise. |
Result APT_CheckNew3DS | ( | bool * | out | ) |
Checks whether the system is a New 3DS.
out | Pointer to write the New 3DS flag to. |
Closes the application.
param | Parameters to close with. |
paramSize | Size of param. |
handle | Handle to pass. |
Result APT_DoApplicationJump | ( | const void * | param, |
size_t | paramSize, | ||
const void * | hmac | ||
) |
Performs an application jump.
param | Parameter buffer. |
paramSize | Size of parameter buffer. |
hmac | HMAC buffer (should be 0x20 bytes long). |
Result APT_Enable | ( | APT_AppletAttr | attr | ) |
Enables APT.
attr | Attributes of the application. |
Terminates an application's registration with APT.
appID | ID of the application. |
Gets the application's CPU time limit.
percent | Pointer to output the CPU time limit percentage to. |
Result APT_GetAppletInfo | ( | NS_APPID | appID, |
u64 * | pProgramID, | ||
u8 * | pMediaType, | ||
bool * | pRegistered, | ||
bool * | pLoadState, | ||
APT_AppletAttr * | pAttributes | ||
) |
Gets an applet's information.
appID | AppID of the applet. |
pProgramID | Pointer to output the program ID to. |
pMediaType | Pointer to output the media type to. |
pRegistered | Pointer to output the registration status to. |
pLoadState | Pointer to output the load state to. |
pAttributes | Pointer to output the applet atrributes to. |
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.
inpos | Requested applet position. |
outpos | Pointer to output the position of the current applet to. |
req_appid | Pointer to output the AppID of the applet at the requested position to. |
menu_appid | Pointer to output the HOME menu AppID to. |
active_appid | Pointer to output the AppID of the currently active applet to. |
Gets an applet's program information.
id | ID of the applet. |
flags | Flags to use when retreiving the information. |
titleversion | Pointer to output the applet's title version to. |
Flags:
Gets an APT lock handle.
flags | Flags to use. |
lockHandle | Pointer to output the lock handle to. |
Gets the current application's program ID.
pProgramID | Pointer to output the program ID to. |
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.
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.
appID | AppID of the application. |
buffer | Buffer to receive to. |
bufferSize | Size of the buffer. |
sender | Pointer to output the sender's AppID to. |
command | Pointer to output the command ID to. |
actualSize | Pointer to output the actual received data size to. |
parameter | Pointer to output the parameter handle to. |
Result APT_Initialize | ( | NS_APPID | appId, |
APT_AppletAttr | attr, | ||
Handle * | signalEvent, | ||
Handle * | resumeEvent | ||
) |
Initializes an application's registration with APT.
appId | ID of the application. |
attr | Attributes of the application. |
signalEvent | Pointer to output the signal event handle to. |
resumeEvent | Pointer to output the resume event handle to. |
Result APT_InquireNotification | ( | u32 | appID, |
APT_Signal * | signalType | ||
) |
Inquires as to whether a signal has been received.
appID | ID of the application. |
signalType | Pointer to output the signal type to. |
Gets whether an application is registered.
appID | ID of the application. |
out | Pointer to output the registration state to. |
Jumps to an application.
param | Parameters to jump with. |
Size | of the parameter buffer. |
handle | Handle to pass. |
Jumps to the home menu.
param | Parameters to jump with. |
Size | of the parameter buffer. |
handle | Handle to pass. |
Locks a transition (?).
transition | Transition ID. |
flag | Flag (?) |
Notifies an application to wait.
appID | ID of the application. |
Result APT_PrepareToCloseApplication | ( | bool | cancelPreload | ) |
Prepares to close the application.
cancelPreload | Whether applet preloads should be cancelled. |
Prepares for an applicaton jump.
flags | Flags to use. |
programID | ID of the program to jump to. |
mediatype | Media type of the program to jump to. |
Result APT_PrepareToJumpToApplication | ( | bool | exiting | ) |
Prepares to jump to an application.
exiting | Specifies whether the applet is exiting. |
Prepares to start a library applet.
appID | AppID of the applet to start. |
Prepares to start a system applet.
appID | AppID of the applet to start. |
Result APT_ReceiveDeliverArg | ( | void * | param, |
size_t | paramSize, | ||
void * | hmac, | ||
u64 * | sender, | ||
bool * | received | ||
) |
Receives the deliver (launch) argument.
param | Parameter buffer. |
paramSize | Size of parameter buffer. |
hmac | HMAC buffer (should be 0x20 bytes long). |
sender | Pointer to output the sender's AppID to. |
received | Pointer to output whether an argument was received to. |
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.
appID | AppID of the application. |
buffer | Buffer to receive to. |
bufferSize | Size of the buffer. |
sender | Pointer to output the sender's AppID to. |
command | Pointer to output the command ID to. |
actualSize | Pointer to output the actual received data size to. |
parameter | Pointer to output the parameter handle to. |
Replies that a sleep notification has been completed.
appID | ID of the application. |
Result APT_ReplySleepQuery | ( | NS_APPID | appID, |
APT_QueryReply | reply | ||
) |
Replies to a sleep query.
appID | ID of the application. |
reply | Query reply value. |
Result APT_SendCaptureBufferInfo | ( | const aptCaptureBufInfo * | captureBuf | ) |
Sends capture buffer information.
captureBuf | Capture buffer information to send. |
Result APT_SendParameter | ( | NS_APPID | source, |
NS_APPID | dest, | ||
APT_Command | command, | ||
const void * | buffer, | ||
u32 | bufferSize, | ||
Handle | parameter | ||
) |
Sends a parameter.
source | AppID of the source application. |
dest | AppID of the destination application. |
command | Command to send. |
buffer | Buffer to send. |
bufferSize | Size of the buffer. |
parameter | Parameter handle to pass. |
Sets the application's CPU time limit.
percent | CPU time limit percentage to set. |
Result APT_SleepSystem | ( | const struct PtmWakeEvents * | wakeEvents | ) |
Requests to enter sleep mode, and later sets wake events if allowed to.
wakeEvents | The 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. |
Result APT_StartLibraryApplet | ( | NS_APPID | appID, |
const void * | param, | ||
size_t | paramSize, | ||
Handle | handle | ||
) |
Starts a library applet.
appID | AppID of the applet to launch. |
param | Buffer containing applet parameters. |
paramsize | Size of the buffer. |
handle | Handle to pass to the applet. |
Result APT_StartSystemApplet | ( | NS_APPID | appID, |
const void * | param, | ||
size_t | paramSize, | ||
Handle | handle | ||
) |
Starts a system applet.
appID | AppID of the applet to launch. |
param | Buffer containing applet parameters. |
paramSize | Size of the parameter buffer. |
handle | Handle to pass to the applet. |
Tries to lock a transition (?).
transition | Transition ID. |
succeeded | Pointer to output whether the lock was successfully applied. |
Unlocks a transition (?).
transition | Transition ID. |
|
inlinestatic |
Gets the menu's app ID.
void aptHook | ( | aptHookCookie * | cookie, |
aptHookFn | callback, | ||
void * | param | ||
) |
Sets up an APT status hook.
cookie | Hook cookie to use. |
callback | Function to call when APT's status changes. |
param | User-defined parameter to pass to the callback. |
|
inlinestatic |
Launches a library applet.
appId | ID of the applet to launch. |
buf | Input/output buffer that contains launch parameters on entry and result data on exit. |
bufsize | Size of the buffer. |
handle | Handle to pass to the library applet. |
bool aptMainLoop | ( | void | ) |
Main function which handles sleep mode and HOME/power buttons - call this at the beginning of every frame.
Sends an APT command through IPC, taking care of locking, opening and closing an APT session.
aptcmdbuf | Pointer to command buffer (should have capacity for at least 16 words). |
Configures the chainloader to launch a specific application.
programID | ID of the program to chainload to. |
mediatype | Media type of the program to chainload to. |
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.
deliverArg | Deliver arg to pass to the target application. |
deliverArgSize | Size of the deliver arg, maximum 0x300 bytes. |
hmac | HMAC buffer, 32 bytes. Use NULL to pass an all-zero dummy HMAC. |
void aptSetMessageCallback | ( | aptMessageCb | callback, |
void * | user | ||
) |
Sets the function to be called when an APT message from another applet is received.
callback | Callback function. |
user | User-defined data to be passed to the callback. |
void aptUnhook | ( | aptHookCookie * | cookie | ) |
Removes an APT status hook.
cookie | Hook cookie to remove. |