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()
{
gfxInitDefault();
consoleInit(GFX_TOP, NULL);
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())
{
gspWaitForVBlank();
gfxSwapBuffers();
hidScanInput();
u32 kDown = hidKeysDown();
if (kDown & KEY_START)
break; // break in order to return to hbmenu
gfxFlushBuffers();
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;
gfxExit();
return 0;
}
3ds.h
Central 3DS header.
aptMainLoop
bool aptMainLoop(void)
Main function which handles sleep mode and HOME/power buttons - call this at the beginning of every f...
NS_APPID
NS_APPID
NS Application IDs.
Definition: apt.h:12
APPID_PNOTE_AP
@ APPID_PNOTE_AP
PNOTE_AP.
Definition: apt.h:28
APPID_EXTRAPAD
@ APPID_EXTRAPAD
extrapad
Definition: apt.h:32
APPID_APPLETED
@ APPID_APPLETED
appletEd
Definition: apt.h:27
APPID_MEMOLIB
@ APPID_MEMOLIB
memolib
Definition: apt.h:33
APPID_SOFTWARE_KEYBOARD
@ APPID_SOFTWARE_KEYBOARD
Software Keyboard.
Definition: apt.h:26
APPID_MINT
@ APPID_MINT
mint
Definition: apt.h:31
APPID_SNOTE_AP
@ APPID_SNOTE_AP
SNOTE_AP.
Definition: apt.h:29
APPID_ERROR
@ APPID_ERROR
error
Definition: apt.h:30
aptLaunchLibraryApplet
void aptLaunchLibraryApplet(NS_APPID appId, void *buf, size_t bufsize, Handle handle)
Launches a library applet.
consoleInit
PrintConsole * consoleInit(gfxScreen_t screen, PrintConsole *console)
Initialise the console.
gfxSwapBuffers
void gfxSwapBuffers(void)
Updates the configuration of both screens.
gfxInitDefault
void gfxInitDefault(void)
Initializes the LCD framebuffers with default parameters This is equivalent to calling:
GFX_TOP
@ GFX_TOP
Top screen.
Definition: gfx.h:26
gfxExit
void gfxExit(void)
Deinitializes and frees the LCD framebuffers.
gfxFlushBuffers
void gfxFlushBuffers(void)
Flushes the data cache for the current framebuffers.
gspWaitForVBlank
#define gspWaitForVBlank()
Waits for VBlank.
Definition: gspgpu.h:151
KEY_UP
@ KEY_UP
D-Pad Up or Circle Pad Up.
Definition: hid.h:37
KEY_B
@ KEY_B
B.
Definition: hid.h:13
KEY_X
@ KEY_X
X.
Definition: hid.h:22
KEY_Y
@ KEY_Y
Y.
Definition: hid.h:23
KEY_LEFT
@ KEY_LEFT
D-Pad Left or Circle Pad Left.
Definition: hid.h:39
KEY_START
@ KEY_START
Start.
Definition: hid.h:15
KEY_R
@ KEY_R
R.
Definition: hid.h:20
KEY_A
@ KEY_A
A.
Definition: hid.h:12
KEY_L
@ KEY_L
L.
Definition: hid.h:21
hidKeysDown
u32 hidKeysDown(void)
Returns a bitmask of newly pressed buttons, this frame.
hidScanInput
void hidScanInput(void)
Scans HID for input data.
u32
uint32_t u32
32-bit unsigned integer
Definition: types.h:23