Merge branch 'master' of github.com:smealum/ctrulib
This commit is contained in:
commit
9d1181ef50
@ -6,37 +6,47 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
srvInit();
|
srvInit(); // Needed
|
||||||
aptInit();
|
aptInit(); // Needed
|
||||||
gfxInit();
|
gfxInit(); // Init graphic stuff
|
||||||
hidInit(NULL);
|
hidInit(NULL); // For input (buttons, touchscreen...)
|
||||||
|
|
||||||
|
|
||||||
|
// We need these 2 buffers for APT_DoAppJump() later. They can be smaller too
|
||||||
u8 buf0[0x300];
|
u8 buf0[0x300];
|
||||||
u8 buf1[0x20];
|
u8 buf1[0x20];
|
||||||
|
|
||||||
|
|
||||||
|
// Loop as long as the status is not exit
|
||||||
while(aptMainLoop())
|
while(aptMainLoop())
|
||||||
{
|
{
|
||||||
|
// Scan hid shared memory for input events
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
|
|
||||||
if(hidKeysDown() & KEY_A)
|
if(hidKeysDown() & KEY_A) // If the A button got pressed, start the app launch
|
||||||
{
|
{
|
||||||
|
// Clear both buffers
|
||||||
memset(buf0, 0, 0x300);
|
memset(buf0, 0, 0x300);
|
||||||
memset(buf1, 0, 0x20);
|
memset(buf1, 0, 0x20);
|
||||||
|
|
||||||
|
// Open an APT session so we can talk to the APT service
|
||||||
aptOpenSession();
|
aptOpenSession();
|
||||||
APT_PrepareToDoAppJump(NULL, 0, 0x0004001000022400LL, 0); // *EUR* camera app
|
// Prepare for the app launch
|
||||||
APT_DoAppJump(NULL, 0x300, 0x20, buf0, buf1);
|
APT_PrepareToDoAppJump(NULL, 0, 0x0004001000022400LL, 0); // *EUR* camera app title ID
|
||||||
|
// Tell APT to trigger the app launch and set the status of this app to exit
|
||||||
|
APT_DoAppJump(NULL, 0x300 /* size of buf0 */, 0x20 /* size of buf1 */, buf0, buf1);
|
||||||
|
// Close the APT session because we don't need APT anymore
|
||||||
aptCloseSession();
|
aptCloseSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flush + swap framebuffers and wait for VBlank. Not really needed in this example
|
||||||
gfxFlushBuffers();
|
gfxFlushBuffers();
|
||||||
gfxSwapBuffers();
|
gfxSwapBuffers();
|
||||||
gspWaitForVBlank();
|
gspWaitForVBlank();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Deinit everything before the app process get's terminated
|
||||||
hidExit();
|
hidExit();
|
||||||
gfxExit();
|
gfxExit();
|
||||||
aptExit();
|
aptExit();
|
||||||
|
@ -3,3 +3,5 @@
|
|||||||
Result SOC_Initialize(u32 *context_addr, u32 context_size);//Example context_size: 0x48000. The specified context buffer can no longer be accessed by the process which called this function, since the userland permissions for this block are set to no-access.
|
Result SOC_Initialize(u32 *context_addr, u32 context_size);//Example context_size: 0x48000. The specified context buffer can no longer be accessed by the process which called this function, since the userland permissions for this block are set to no-access.
|
||||||
Result SOC_Shutdown();
|
Result SOC_Shutdown();
|
||||||
int SOC_GetErrno();
|
int SOC_GetErrno();
|
||||||
|
|
||||||
|
long gethostid();
|
||||||
|
Loading…
Reference in New Issue
Block a user