libctru  v2.4.1
libapplet_launch/source/main.c
#include <3ds.h>
#include <stdio.h>
#include <string.h>
static bool allowed = false;
// If you define this function, you can monitor/debug APT events
void _aptDebug(int a, int b)
{
if (allowed)
printf("_aptDebug(%d,%x)\n", a, b);
}
int main()
{
allowed = true;
u32 aptbuf[0x400/4];
printf("Press A to launch extrapad\n");
printf("Press B to launch error\n");
printf("Press X to launch appleted (Mii Editor)\n");
printf("Press Y to launch memolib\n");
printf("Press L to launch Photo Selector\n");
printf("Press R to launch Sound Selector\n");
printf("Press ^ to launch mint (eShop)\n");
printf("Press < to launch software keyboard\n");
// Main loop
while (aptMainLoop())
{
u32 kDown = hidKeysDown();
if (kDown & KEY_START)
break; // break in order to return to hbmenu
if (kDown)
{
NS_APPID appId;
if (kDown & KEY_A) appId = APPID_EXTRAPAD;
else if (kDown & KEY_B) appId = APPID_ERROR;
else if (kDown & KEY_X) appId = APPID_APPLETED;
else if (kDown & KEY_Y) appId = APPID_MEMOLIB;
else if (kDown & KEY_L) appId = APPID_PNOTE_AP;
else if (kDown & KEY_R) appId = APPID_SNOTE_AP;
else if (kDown & KEY_UP) appId = APPID_MINT;
else if (kDown & KEY_LEFT) appId = APPID_SOFTWARE_KEYBOARD;
else continue;
memset(aptbuf, 0, sizeof(aptbuf));
aptLaunchLibraryApplet(appId, aptbuf, sizeof(aptbuf), 0);
printf("Library applet exited\n");
}
}
// Exit services
allowed = false;
return 0;
}
Central 3DS header.
bool aptMainLoop(void)
Main function which handles sleep mode and HOME/power buttons - call this at the beginning of every f...
NS_APPID
NS Application IDs.
Definition: apt.h:12
@ APPID_PNOTE_AP
PNOTE_AP.
Definition: apt.h:28
@ APPID_EXTRAPAD
extrapad
Definition: apt.h:32
@ APPID_APPLETED
appletEd
Definition: apt.h:27
@ APPID_MEMOLIB
memolib
Definition: apt.h:33
@ APPID_SOFTWARE_KEYBOARD
Software Keyboard.
Definition: apt.h:26
@ APPID_MINT
mint
Definition: apt.h:31
@ APPID_SNOTE_AP
SNOTE_AP.
Definition: apt.h:29
@ APPID_ERROR
error
Definition: apt.h:30
void aptLaunchLibraryApplet(NS_APPID appId, void *buf, size_t bufsize, Handle handle)
Launches a library applet.
PrintConsole * consoleInit(gfxScreen_t screen, PrintConsole *console)
Initialise the console.
void gfxSwapBuffers(void)
Updates the configuration of both screens.
void gfxInitDefault(void)
Initializes the LCD framebuffers with default parameters This is equivalent to calling:
@ GFX_TOP
Top screen.
Definition: gfx.h:26
void gfxExit(void)
Deinitializes and frees the LCD framebuffers.
void gfxFlushBuffers(void)
Flushes the data cache for the current framebuffers.
#define gspWaitForVBlank()
Waits for VBlank.
Definition: gspgpu.h:151
@ KEY_UP
D-Pad Up or Circle Pad Up.
Definition: hid.h:37
@ KEY_B
B.
Definition: hid.h:13
@ KEY_X
X.
Definition: hid.h:22
@ KEY_Y
Y.
Definition: hid.h:23
@ KEY_LEFT
D-Pad Left or Circle Pad Left.
Definition: hid.h:39
@ KEY_START
Start.
Definition: hid.h:15
@ KEY_R
R.
Definition: hid.h:20
@ KEY_A
A.
Definition: hid.h:12
@ KEY_L
L.
Definition: hid.h:21
u32 hidKeysDown(void)
Returns a bitmask of newly pressed buttons, this frame.
void hidScanInput(void)
Scans HID for input data.
uint32_t u32
32-bit unsigned integer
Definition: types.h:23