Module ctr.apt
The apt module.
Used to manage the applets and application status.
Usage:
local apt = require("ctr.apt")
Functions
getMenuAppID () | Return the menu's AppID. |
setSleepAllowed (allowed) | Allow or not the system to enter sleep mode. |
isSleepAllowed () | Check if sleep mode is allowed. |
hook (callback) | Sets up an APT status hook. |
setMessageCallback (callback) | Sets the function to be called when an APT message from another applet is received. |
launchLibraryApplet (appId) | Launches a library applet. |
isNew3DS () | Checks whether the system is a New 3DS. |
Hook object
:unhook () | Removes the APT status hook. |
NS Applications IDs constants
APPID_NONE | |
APPID_HOMEMENU | Home Menu |
APPID_CAMERA | Camera applet |
APPID_FRIENDS_LIST | Friends List applet |
APPID_GAME_NOTES | Games 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 |
APT applet position constants
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 query reply constants
APTREPLY_REJECT | |
APTREPLY_ACCEPT | |
APTREPLY_LATER |
APT signals constants
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_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?) |
APT commands constants
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 hook types constants
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 |
Functions
- getMenuAppID ()
-
Return the menu's AppID.
Returns:
-
number
the AppID
- setSleepAllowed (allowed)
-
Allow or not the system to enter sleep mode.
Parameters:
- allowed
boolean
true
to allow,false
to disallow
- allowed
boolean
- isSleepAllowed ()
-
Check if sleep mode is allowed.
Returns:
-
boolean
true
is allowed, false if not. - hook (callback)
-
Sets up an APT status hook.
Parameters:
- callback function function to call when APT's status changes. The first argument is an APT hook type constant.
Returns:
-
Hook
Hook object
See also:
- setMessageCallback (callback)
-
Sets the function to be called when an APT message from another applet is received.
Parameters:
- callback function function. The first argument is the sender APPID, and the second argument is the message string.
- launchLibraryApplet (appId)
-
Launches a library applet.
Parameters:
- appId APPID application ID of the applet to launch
Returns:
-
boolean
whether the application should continue running after the library applet launch
- isNew3DS ()
-
Checks whether the system is a New 3DS.
Returns:
-
boolean
true
if it's a New3DS, false otherwise
Hook object
NS Applications IDs constants
- APPID_NONE
-
- APPID_NONE
- APPID_HOMEMENU
-
Home Menu
- APPID_HOMEMENU
- APPID_CAMERA
-
Camera applet
- APPID_CAMERA
- APPID_FRIENDS_LIST
-
Friends List applet
- APPID_FRIENDS_LIST
- APPID_GAME_NOTES
-
Games Notes applet
- APPID_GAME_NOTES
- APPID_WEB
-
Internet Browser
- APPID_WEB
- APPID_INSTRUCTION_MANUAL
-
Instruction Manual applet
- APPID_INSTRUCTION_MANUAL
- APPID_NOTIFICATIONS
-
Notifications applet
- APPID_NOTIFICATIONS
- APPID_MIIVERSE
-
Miiverse applet (olv)
- APPID_MIIVERSE
- APPID_MIIVERSE_POSTING
-
Miiverse posting applet (solv3)
- APPID_MIIVERSE_POSTING
- APPID_AMIIBO_SETTINGS
-
Amiibo settings applet (cabinet)
- APPID_AMIIBO_SETTINGS
- APPID_APPLICATION
-
Application
- APPID_APPLICATION
- APPID_ESHOP
-
eShop (tiger)
- APPID_ESHOP
- APPID_SOFTWARE_KEYBOARD
-
Software Keyboard
- APPID_SOFTWARE_KEYBOARD
- APPID_APPLETED
-
appletEd
- APPID_APPLETED
- APPID_PNOTE_AP
-
PNOTE_AP
- APPID_PNOTE_AP
- APPID_SNOTE_AP
-
SNOTE_AP
- APPID_SNOTE_AP
- APPID_ERROR
-
error
- APPID_ERROR
- APPID_MINT
-
mint
- APPID_MINT
- APPID_EXTRAPAD
-
extrapad
- APPID_EXTRAPAD
- APPID_MEMOLIB
-
memolib
- APPID_MEMOLIB
APT applet position constants
- APTPOS_NONE
-
No position specified
- APTPOS_NONE
- APTPOS_APP
-
Application
- APTPOS_APP
- APTPOS_APPLIB
-
Application library (?)
- APTPOS_APPLIB
- APTPOS_SYS
-
System applet
- APTPOS_SYS
- APTPOS_SYSLIB
-
System library (?)
- APTPOS_SYSLIB
- APTPOS_RESIDENT
-
Resident applet
- APTPOS_RESIDENT
APT query reply constants
APT signals constants
- APTSIGNAL_NONE
-
No signal received
- APTSIGNAL_NONE
- APTSIGNAL_HOMEBUTTON
-
HOME button pressed
- APTSIGNAL_HOMEBUTTON
- APTSIGNAL_HOMEBUTTON2
-
HOME button pressed (again?)
- APTSIGNAL_HOMEBUTTON2
- APTSIGNAL_SLEEP_QUERY
-
Prepare to enter sleep mode
- APTSIGNAL_SLEEP_QUERY
- APTSIGNAL_SLEEP_CANCEL
-
Triggered when ptm:s GetShellStatus() returns 5
- APTSIGNAL_SLEEP_CANCEL
- APTSIGNAL_SLEEP_ENTER
-
Enter sleep mode
- APTSIGNAL_SLEEP_ENTER
- APTSIGNAL_WAKEUP
-
Wake from sleep mode
- APTSIGNAL_WAKEUP
- APTSIGNAL_SHUTDOWN
-
Shutdown
- APTSIGNAL_SHUTDOWN
- APTSIGNAL_POWERBUTTON
-
POWER button pressed
- APTSIGNAL_POWERBUTTON
- APTSIGNAL_POWERBUTTON2
-
POWER button cleared (?)
- APTSIGNAL_POWERBUTTON2
- APTSIGNAL_TRY_SLEEP
-
System sleeping (?)
- APTSIGNAL_TRY_SLEEP
- APTSIGNAL_ORDERTOCLOSE
-
Order to close (such as when an error happens?)
- APTSIGNAL_ORDERTOCLOSE
APT commands constants
- APTCMD_NONE
-
No command received
- APTCMD_NONE
- APTCMD_WAKEUP
-
Applet should wake up
- APTCMD_WAKEUP
- APTCMD_REQUEST
-
Source applet sent us a parameter
- APTCMD_REQUEST
- APTCMD_RESPONSE
-
Target applet replied to our parameter
- APTCMD_RESPONSE
- APTCMD_EXIT
-
Exit (??)
- APTCMD_EXIT
- APTCMD_MESSAGE
-
Message (??)
- APTCMD_MESSAGE
- APTCMD_HOMEBUTTON_ONCE
-
HOME button pressed once
- APTCMD_HOMEBUTTON_ONCE
- APTCMD_HOMEBUTTON_TWICE
-
HOME button pressed twice (double-pressed)
- APTCMD_HOMEBUTTON_TWICE
- APTCMD_DSP_SLEEP
-
DSP should sleep (manual DSP rights related?)
- APTCMD_DSP_SLEEP
- APTCMD_DSP_WAKEUP
-
DSP should wake up (manual DSP rights related?)
- APTCMD_DSP_WAKEUP
- APTCMD_WAKEUP_EXIT
-
Applet wakes up due to a different applet exiting
- APTCMD_WAKEUP_EXIT
- APTCMD_WAKEUP_PAUSE
-
Applet wakes up after being paused through HOME menu
- APTCMD_WAKEUP_PAUSE
- APTCMD_WAKEUP_CANCEL
-
Applet wakes up due to being cancelled
- APTCMD_WAKEUP_CANCEL
- APTCMD_WAKEUP_CANCELALL
-
Applet wakes up due to all applets being cancelled
- APTCMD_WAKEUP_CANCELALL
- APTCMD_WAKEUP_POWERBUTTON
-
Applet wakes up due to POWER button being pressed (?)
- APTCMD_WAKEUP_POWERBUTTON
- APTCMD_WAKEUP_JUMPTOHOME
-
Applet wakes up and is instructed to jump to HOME menu (?)
- APTCMD_WAKEUP_JUMPTOHOME
- APTCMD_SYSAPPLET_REQUEST
-
Request for sysapplet (?)
- APTCMD_SYSAPPLET_REQUEST
- APTCMD_WAKEUP_LAUNCHAPP
-
Applet wakes up and is instructed to launch another applet (?)
- APTCMD_WAKEUP_LAUNCHAPP