46 typedef u8 APT_AppletAttr;
53 return (pos&7) | (manualGpuRights ?
BIT(3) : 0) | (manualDspRights ?
BIT(4) : 0);
129 typedef struct tag_aptHookCookie
131 struct tag_aptHookCookie*
next;
APT_QueryReply
APT query reply.
Definition: apt.h:57
void aptSetChainloaderToCaller(void)
Configures the chainloader to launch the previous application.
Result APT_PrepareToCloseApplication(bool cancelPreload)
Prepares to close the application.
Result APT_SendCaptureBufferInfo(const aptCaptureBufInfo *captureBuf)
Sends capture buffer information.
Result APT_AppletUtility(int id, void *out, size_t outSize, const void *in, size_t inSize)
Calls an applet utility function.
Result APT_GetProgramID(u64 *pProgramID)
Gets the current application's program ID.
Result APT_GetSharedFont(Handle *fontHandle, u32 *mapAddr)
Retrieves the shared system font.
APT_Signal
APT signals.
Definition: apt.h:64
@ APTSIGNAL_SLEEP_QUERY
Prepare to enter sleep mode.
Definition: apt.h:68
@ APTSIGNAL_POWERBUTTON
POWER button pressed.
Definition: apt.h:73
@ APTSIGNAL_SLEEP_WAKEUP
Wake from sleep mode.
Definition: apt.h:71
@ APTSIGNAL_POWERBUTTON2
POWER button cleared (?).
Definition: apt.h:74
@ APTSIGNAL_ORDERTOCLOSE
Order to close (such as when an error happens?).
Definition: apt.h:76
@ APTSIGNAL_SHUTDOWN
Shutdown.
Definition: apt.h:72
@ APTSIGNAL_TRY_SLEEP
System sleeping (?).
Definition: apt.h:75
@ APTSIGNAL_NONE
No signal received.
Definition: apt.h:65
@ APTSIGNAL_HOMEBUTTON2
HOME button pressed (again?).
Definition: apt.h:67
@ APTSIGNAL_SLEEP_ENTER
Enter sleep mode.
Definition: apt.h:70
@ APTSIGNAL_HOMEBUTTON
HOME button pressed.
Definition: apt.h:66
@ APTSIGNAL_SLEEP_CANCEL
Triggered when ptm:s GetShellStatus() returns 5.
Definition: apt.h:69
Result APT_UnlockTransition(u32 transition)
Unlocks a transition (?).
Result APT_JumpToHomeMenu(const void *param, size_t paramSize, Handle handle)
Jumps to the home menu.
Result APT_SleepIfShellClosed(void)
Sleeps if shell is closed (?).
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.
void aptExit(void)
Exits APT.
Result APT_SleepSystem(const struct PtmWakeEvents *wakeEvents)
Requests to enter sleep mode, and later sets wake events if allowed to.
Result APT_CancelParameter(NS_APPID source, NS_APPID dest, bool *success)
Cancels a parameter which matches the specified source and dest AppIDs.
Result APT_Finalize(NS_APPID appId)
Terminates an application's registration with APT.
Result APT_GetAppletInfo(NS_APPID appID, u64 *pProgramID, u8 *pMediaType, bool *pRegistered, bool *pLoadState, APT_AppletAttr *pAttributes)
Gets an applet's information.
void aptSetSleepAllowed(bool allowed)
Configures whether the system can enter sleep mode while the application is active.
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) app...
Result APT_GetLockHandle(u16 flags, Handle *lockHandle)
Gets an APT lock handle.
static APT_AppletAttr aptMakeAppletAttr(APT_AppletPos pos, bool manualGpuRights, bool manualDspRights)
Create an APT_AppletAttr bitfield from its components.
Definition: apt.h:51
bool aptShouldJumpToHome(void)
Returns true if the system requires the application to jump back to the HOME menu.
Result APT_PrepareToJumpToHomeMenu(void)
Prepares to jump to the home menu.
static CTR_DEPRECATED bool aptIsHomePressed(void)
Definition: apt.h:179
void aptUnhook(aptHookCookie *cookie)
Removes an APT status hook.
APT_HookType
APT hook types.
Definition: apt.h:115
@ APTHOOK_ONEXIT
App exiting.
Definition: apt.h:120
@ APTHOOK_ONSUSPEND
App suspended.
Definition: apt.h:116
@ APTHOOK_ONSLEEP
App sleeping.
Definition: apt.h:118
@ APTHOOK_ONWAKEUP
App waking up.
Definition: apt.h:119
@ APTHOOK_ONRESTORE
App restored.
Definition: apt.h:117
@ APTHOOK_COUNT
Number of APT hook types.
Definition: apt.h:122
Result APT_InquireNotification(u32 appID, APT_Signal *signalType)
Inquires as to whether a signal has been received.
Result APT_LockTransition(u32 transition, bool flag)
Locks a transition (?).
Result APT_DoApplicationJump(const void *param, size_t paramSize, const void *hmac)
Performs an application jump.
bool aptMainLoop(void)
Main function which handles sleep mode and HOME/power buttons - call this at the beginning of every f...
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.
APT_Command
APT commands.
Definition: apt.h:80
@ APTCMD_WAKEUP_CANCEL
Applet wakes up due to being cancelled.
Definition: apt.h:93
@ APTCMD_WAKEUP_EXIT
Applet wakes up due to a different applet exiting.
Definition: apt.h:91
@ APTCMD_MESSAGE
Message (??)
Definition: apt.h:86
@ APTCMD_SYSAPPLET_REQUEST
Request for sysapplet (?).
Definition: apt.h:97
@ APTCMD_WAKEUP_POWERBUTTON
Applet wakes up due to POWER button being pressed (?).
Definition: apt.h:95
@ APTCMD_NONE
No command received.
Definition: apt.h:81
@ APTCMD_WAKEUP_JUMPTOHOME
Applet wakes up and is instructed to jump to HOME menu (?).
Definition: apt.h:96
@ APTCMD_RESPONSE
Target applet replied to our parameter.
Definition: apt.h:84
@ APTCMD_DSP_WAKEUP
DSP should wake up (manual DSP rights related?).
Definition: apt.h:90
@ APTCMD_WAKEUP
Applet should wake up.
Definition: apt.h:82
@ APTCMD_HOMEBUTTON_TWICE
HOME button pressed twice (double-pressed).
Definition: apt.h:88
@ APTCMD_DSP_SLEEP
DSP should sleep (manual DSP rights related?).
Definition: apt.h:89
@ APTCMD_WAKEUP_PAUSE
Applet wakes up after being paused through HOME menu.
Definition: apt.h:92
@ APTCMD_HOMEBUTTON_ONCE
HOME button pressed once.
Definition: apt.h:87
@ APTCMD_REQUEST
Source applet sent us a parameter.
Definition: apt.h:83
@ APTCMD_WAKEUP_LAUNCHAPP
Applet wakes up and is instructed to launch another applet (?).
Definition: apt.h:98
@ APTCMD_WAKEUP_CANCELALL
Applet wakes up due to all applets being cancelled.
Definition: apt.h:94
@ APTCMD_EXIT
Exit (??)
Definition: apt.h:85
static NS_APPID aptGetMenuAppID(void)
Gets the menu's app ID.
Definition: apt.h:301
Result APT_JumpToApplication(const void *param, size_t paramSize, Handle handle)
Jumps to an application.
Result APT_HardwareResetAsync(void)
Asynchronously resets the hardware.
NS_APPID
NS Application IDs.
Definition: apt.h:12
@ APPID_WEB
Internet Browser.
Definition: apt.h:18
@ APPID_INSTRUCTION_MANUAL
Instruction Manual applet.
Definition: apt.h:19
@ APPID_PNOTE_AP
PNOTE_AP.
Definition: apt.h:28
@ APPID_MIIVERSE_POSTING
Miiverse posting applet (solv3)
Definition: apt.h:22
@ APPID_APPLICATION
Application.
Definition: apt.h:24
@ APPID_EXTRAPAD
extrapad
Definition: apt.h:32
@ APPID_MIIVERSE
Miiverse applet (olv)
Definition: apt.h:21
@ APPID_APPLETED
appletEd
Definition: apt.h:27
@ APPID_AMIIBO_SETTINGS
Amiibo settings applet (cabinet)
Definition: apt.h:23
@ APPID_MEMOLIB
memolib
Definition: apt.h:33
@ APPID_CAMERA
Camera applet.
Definition: apt.h:15
@ APPID_HOMEMENU
Home Menu.
Definition: apt.h:14
@ APPID_FRIENDS_LIST
Friends List applet.
Definition: apt.h:16
@ APPID_SOFTWARE_KEYBOARD
Software Keyboard.
Definition: apt.h:26
@ APPID_NOTIFICATIONS
Notifications applet.
Definition: apt.h:20
@ APPID_MINT
mint
Definition: apt.h:31
@ APPID_ESHOP
eShop (tiger)
Definition: apt.h:25
@ APPID_SNOTE_AP
SNOTE_AP.
Definition: apt.h:29
@ APPID_GAME_NOTES
Game Notes applet.
Definition: apt.h:17
@ APPID_ERROR
error
Definition: apt.h:30
Result APT_PrepareToStartSystemApplet(NS_APPID appID)
Prepares to start a system applet.
Result aptInit(void)
Initializes APT.
void(* aptMessageCb)(void *user, NS_APPID sender, void *msg, size_t msgsize)
APT message callback.
Definition: apt.h:137
Result APT_SendParameter(NS_APPID source, NS_APPID dest, APT_Command command, const void *buffer, u32 bufferSize, Handle parameter)
Sends a parameter.
APT_AppletPos
APT applet position.
Definition: apt.h:37
@ APTPOS_NONE
No position specified.
Definition: apt.h:38
@ APTPOS_SYSLIB
System library (?).
Definition: apt.h:42
@ APTPOS_RESIDENT
Resident applet.
Definition: apt.h:43
@ APTPOS_APP
Application.
Definition: apt.h:39
@ APTPOS_SYS
System applet.
Definition: apt.h:41
@ APTPOS_APPLIB
Application library (?).
Definition: apt.h:40
bool aptCheckHomePressRejected(void)
Returns true if there is an incoming HOME button press rejected by the policy set by aptSetHomeAllowe...
Result APT_ReceiveDeliverArg(void *param, size_t paramSize, void *hmac, u64 *sender, bool *received)
Receives the deliver (launch) argument.
Result APT_IsRegistered(NS_APPID appID, bool *out)
Gets whether an application is registered.
Result APT_NotifyToWait(NS_APPID appID)
Notifies an application to wait.
Result APT_ReplySleepNotificationComplete(NS_APPID appID)
Replies that a sleep notification has been completed.
Result APT_Initialize(NS_APPID appId, APT_AppletAttr attr, Handle *signalEvent, Handle *resumeEvent)
Initializes an application's registration with APT.
Result APT_SetAppCpuTimeLimit(u32 percent)
Sets the application's CPU time limit.
Result APT_TryLockTransition(u32 transition, bool *succeeded)
Tries to lock a transition (?).
void aptSetHomeAllowed(bool allowed)
Configures whether the user can press the HOME button to jump back to the HOME menu while the applica...
void aptHook(aptHookCookie *cookie, aptHookFn callback, void *param)
Sets up an APT status hook.
Result APT_PrepareToDoApplicationJump(u8 flags, u64 programID, u8 mediatype)
Prepares for an applicaton jump.
void(* aptHookFn)(APT_HookType hook, void *param)
APT hook function.
Definition: apt.h:126
bool aptIsActive(void)
Returns true if the application is currently in the foreground.
Result APT_StartLibraryApplet(NS_APPID appID, const void *param, size_t paramSize, Handle handle)
Starts a library applet.
Result APT_CloseApplication(const void *param, size_t paramSize, Handle handle)
Closes the application.
void aptHandleSleep(void)
Handles incoming sleep mode requests.
Result APT_Enable(APT_AppletAttr attr)
Enables APT.
bool aptIsSleepAllowed(void)
Returns true if the system can enter sleep mode while the application is active.
static void aptHandleJumpToHome(void)
Handles incoming jump-to-HOME requests.
Definition: apt.h:188
Result aptSendCommand(u32 *aptcmdbuf)
Sends an APT command through IPC, taking care of locking, opening and closing an APT session.
Result APT_GetAppCpuTimeLimit(u32 *percent)
Gets the application's CPU time limit.
Result APT_StartSystemApplet(NS_APPID appID, const void *param, size_t paramSize, Handle handle)
Starts a system applet.
Result APT_CheckNew3DS(bool *out)
Checks whether the system is a New 3DS.
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.
void aptJumpToHomeMenu(void)
Jumps back to the HOME menu.
void aptSetChainloader(u64 programID, u8 mediatype)
Configures the chainloader to launch a specific application.
Result APT_ReplySleepQuery(NS_APPID appID, APT_QueryReply reply)
Replies to a sleep query.
void aptLaunchLibraryApplet(NS_APPID appId, void *buf, size_t bufsize, Handle handle)
Launches a library applet.
Result APT_GetAppletProgramInfo(u32 id, u32 flags, u16 *titleversion)
Gets an applet's program information.
void aptSetMessageCallback(aptMessageCb callback, void *user)
Sets the function to be called when an APT message from another applet is received.
bool aptIsHomeAllowed(void)
Returns true if the user can press the HOME button to jump back to the HOME menu while the applicatio...
bool aptShouldClose(void)
Returns true if the system has told the application to close.
Result APT_PrepareToJumpToApplication(bool exiting)
Prepares to jump to an application.
Result APT_PrepareToStartLibraryApplet(NS_APPID appID)
Prepares to start a library applet.
void aptClearChainloader(void)
Clears the chainloader state.
PDN wake events and MCU interrupts to select, combined with those of other processes.
Definition: ptmsysm.h:10
APT capture buffer information.
Definition: apt.h:103
APT hook cookie.
Definition: apt.h:130
void * param
Callback parameter.
Definition: apt.h:133
struct tag_aptHookCookie * next
Next cookie.
Definition: apt.h:131
aptHookFn callback
Hook callback.
Definition: apt.h:132
#define CTR_DEPRECATED
Flags a function as deprecated.
Definition: types.h:56
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:47
uint64_t u64
64-bit unsigned integer
Definition: types.h:24
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
u32 Handle
Resource handle.
Definition: types.h:41
s32 Result
Function result.
Definition: types.h:42
uint16_t u16
16-bit unsigned integer
Definition: types.h:22
uint32_t u32
32-bit unsigned integer
Definition: types.h:23