My Project
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
apt.h
Go to the documentation of this file.
1 #pragma once
2 
3 // TODO : find a better place to put this
4 #define RUNFLAG_APTWORKAROUND (BIT(0))
5 
6 typedef enum{
7  APPID_HOMEMENU = 0x101, // Home Menu
8  APPID_CAMERA = 0x110, // Camera applet
9  APPID_WEB = 0x114, // Internet Browser
10  APPID_APPLICATION = 0x300, // Application
11 }NS_APPID; // cf http://3dbrew.org/wiki/NS#AppIDs
12 
13 typedef enum{
23 }APP_STATUS;
24 
25 enum {
27  // 2: sleep-mode related?
29  // 4: triggered when ptm:s GetShellStatus() returns 5.
37 };
38 
39 
40 extern Handle aptEvents[3];
41 
42 Result aptInit();
43 void aptExit();
44 void aptOpenSession();
45 void aptCloseSession();
46 void aptSetStatus(APP_STATUS status);
48 u32 aptGetStatusPower();//This can be used when the status is APP_SUSPEND* to check how the return-to-menu was triggered: 0 = home-button, 1 = power-button.
49 void aptSetStatusPower(u32 status);
50 void aptReturnToMenu();//This should be called by the user application when aptGetStatus() returns APP_SUSPENDING, not calling this will result in return-to-menu being disabled with the status left at APP_SUSPENDING. This function will not return until the system returns to the application, or when the status was changed to APP_EXITING.
51 void aptWaitStatusEvent();
54 bool aptMainLoop(); // Use like this in your main(): while (aptMainLoop()) { your code here... }
55 
56 Result APT_GetLockHandle(Handle* handle, u16 flags, Handle* lockHandle);
57 Result APT_Initialize(Handle* handle, NS_APPID appId, Handle* eventHandle1, Handle* eventHandle2);
59 Result APT_Enable(Handle* handle, u32 a);
60 Result APT_GetAppletManInfo(Handle* handle, u8 inval, u8 *outval8, u32 *outval32, NS_APPID *menu_appid, NS_APPID *active_appid);
62 Result APT_JumpToHomeMenu(Handle* handle, u32 a, u32 b, u32 c);
63 Result APT_IsRegistered(Handle* handle, NS_APPID appID, u8* out);
64 Result APT_InquireNotification(Handle* handle, u32 appID, u8* signalType);
65 Result APT_NotifyToWait(Handle* handle, NS_APPID appID);
66 Result APT_AppletUtility(Handle* handle, u32* out, u32 a, u32 size1, u8* buf1, u32 size2, u8* buf2);
67 Result APT_GlanceParameter(Handle* handle, NS_APPID appID, u32 bufferSize, u32* buffer, u32* actualSize, u8* signalType);
68 Result APT_ReceiveParameter(Handle* handle, NS_APPID appID, u32 bufferSize, u32* buffer, u32* actualSize, u8* signalType);
69 Result APT_SendParameter(Handle* handle, NS_APPID src_appID, NS_APPID dst_appID, u32 bufferSize, u32* buffer, Handle paramhandle, u8 signalType);
70 Result APT_SendCaptureBufferInfo(Handle* handle, u32 bufferSize, u32* buffer);
71 Result APT_ReplySleepQuery(Handle* handle, NS_APPID appID, u32 a);
74 Result APT_CloseApplication(Handle* handle, u32 a, u32 b, u32 c);
75 Result APT_SetAppCpuTimeLimit(Handle* handle, u32 percent);
76 Result APT_GetAppCpuTimeLimit(Handle* handle, u32 *percent);
77 Result APT_CheckNew3DS_Application(Handle* handle, u8 *out);//*Application and *System use APT commands 0x01010000 and 0x01020000. Using APT_CheckNew3DS() is recommended, this determines which of those two funcs to use automatically. When this is first called(this calls aptOpenSession/aptCloseSession internally), this initializes an internal flag, which is then used for the out val for all future calls.
78 Result APT_CheckNew3DS_System(Handle* handle, u8 *out);
79 Result APT_CheckNew3DS(Handle* handle, u8 *out);
80 Result APT_PrepareToDoAppJump(Handle* handle, u8 flags, u64 programID, u8 mediatype);
81 Result APT_DoAppJump(Handle* handle, u32 NSbuf0Size, u32 NSbuf1Size, u8 *NSbuf0Ptr, u8 *NSbuf1Ptr);
83 Result APT_StartLibraryApplet(Handle* handle, NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize);
84 Result APT_LaunchLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize);//This should be used for launching library applets, this uses the above APT_StartLibraryApplet/APT_PrepareToStartLibraryApplet funcs + apt*Session(). parambuf is used for APT params input, when the applet closes the output param block is copied here. This is not usable from the homebrew launcher.
85 
u32 aptGetStatusPower()
Definition: apt.c:554
Result APT_PrepareToCloseApplication(Handle *handle, u8 a)
Definition: apt.c:867
Result APT_CheckNew3DS_System(Handle *handle, u8 *out)
Definition: apt.c:950
s32 Result
Definition: types.h:42
Result APT_PrepareToJumpToHomeMenu(Handle *handle)
Definition: apt.c:694
Result APT_GetAppletManInfo(Handle *handle, u8 inval, u8 *outval8, u32 *outval32, NS_APPID *menu_appid, NS_APPID *active_appid)
Definition: apt.c:646
Result APT_HardwareResetAsync(Handle *handle)
Definition: apt.c:621
uint16_t u16
Definition: types.h:22
Result APT_CheckNew3DS(Handle *handle, u8 *out)
Definition: apt.c:969
void aptReturnToMenu()
Definition: apt.c:148
void aptWaitStatusEvent()
Definition: apt.c:100
void aptSignalReadyForSleep()
Definition: apt.c:584
Result APT_SendParameter(Handle *handle, NS_APPID src_appID, NS_APPID dst_appID, u32 bufferSize, u32 *buffer, Handle paramhandle, u8 signalType)
Definition: apt.c:797
u32 Handle
Definition: types.h:41
Result APT_CheckNew3DS_Application(Handle *handle, u8 *out)
Definition: apt.c:931
uint8_t u8
Definition: types.h:21
void aptOpenSession()
Definition: apt.c:570
Result APT_DoAppJump(Handle *handle, u32 NSbuf0Size, u32 NSbuf1Size, u8 *NSbuf0Ptr, u8 *NSbuf1Ptr)
Definition: apt.c:1013
Result APT_CloseApplication(Handle *handle, u32 a, u32 b, u32 c)
Definition: apt.c:881
uint64_t u64
Definition: types.h:24
void aptCloseSession()
Definition: apt.c:578
Result APT_PrepareToDoAppJump(Handle *handle, u8 flags, u64 programID, u8 mediatype)
Definition: apt.c:996
Result APT_AppletUtility(Handle *handle, u32 *out, u32 a, u32 size1, u8 *buf1, u32 size2, u8 *buf2)
Definition: apt.c:735
uint32_t u32
Definition: types.h:23
Handle aptEvents[3]
Definition: apt.c:25
NS_APPID aptGetMenuAppID()
Definition: apt.c:137
Result APT_PrepareToStartLibraryApplet(Handle *handle, NS_APPID appID)
Definition: apt.c:1032
Result APT_Initialize(Handle *handle, NS_APPID appId, Handle *eventHandle1, Handle *eventHandle2)
Definition: apt.c:604
Result APT_IsRegistered(Handle *handle, NS_APPID appID, u8 *out)
Definition: apt.c:664
void aptSetStatusPower(u32 status)
Definition: apt.c:563
void aptExit()
Definition: apt.c:437
Result APT_Enable(Handle *handle, u32 a)
Definition: apt.c:633
Result APT_SendCaptureBufferInfo(Handle *handle, u32 bufferSize, u32 *buffer)
Definition: apt.c:821
Result APT_GetAppCpuTimeLimit(Handle *handle, u32 *percent)
Definition: apt.c:915
Result APT_JumpToHomeMenu(Handle *handle, u32 a, u32 b, u32 c)
Definition: apt.c:706
Result APT_StartLibraryApplet(Handle *handle, NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize)
Definition: apt.c:1046
void aptSetStatus(APP_STATUS status)
Definition: apt.c:539
Result APT_GetLockHandle(Handle *handle, u16 flags, Handle *lockHandle)
Definition: apt.c:589
APP_STATUS aptGetStatus()
Definition: apt.c:530
NS_APPID
Definition: apt.h:6
bool aptMainLoop()
Definition: apt.c:467
Result APT_InquireNotification(Handle *handle, u32 appID, u8 *signalType)
Definition: apt.c:679
APP_STATUS
Definition: apt.h:13
Result APT_ReplySleepNotificationComplete(Handle *handle, NS_APPID appID)
Definition: apt.c:853
Result APT_SetAppCpuTimeLimit(Handle *handle, u32 percent)
Definition: apt.c:900
Result APT_GlanceParameter(Handle *handle, NS_APPID appID, u32 bufferSize, u32 *buffer, u32 *actualSize, u8 *signalType)
Definition: apt.c:757
Definition: apt.h:9
Result APT_LaunchLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize)
Definition: apt.c:1065
Result APT_ReceiveParameter(Handle *handle, NS_APPID appID, u32 bufferSize, u32 *buffer, u32 *actualSize, u8 *signalType)
Definition: apt.c:777
Result APT_ReplySleepQuery(Handle *handle, NS_APPID appID, u32 a)
Definition: apt.c:838
Result APT_NotifyToWait(Handle *handle, NS_APPID appID)
Definition: apt.c:722
Result aptInit()
Definition: apt.c:399