Clean up libapplet_launch example
This commit is contained in:
parent
1ff4bb5e92
commit
c46562d54b
@ -1,43 +1,45 @@
|
|||||||
#include <3ds.h>
|
#include <3ds.h>
|
||||||
|
#include <stdio.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()
|
int main()
|
||||||
{
|
{
|
||||||
u32 val, i;
|
|
||||||
|
|
||||||
gfxInitDefault();
|
gfxInitDefault();
|
||||||
//gfxSet3D(true); // uncomment if using stereoscopic 3D
|
consoleInit(GFX_TOP, NULL);
|
||||||
|
allowed = true;
|
||||||
|
|
||||||
val = 0x22447899;
|
printf("Press B to launch applet\n");
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
while (aptMainLoop())
|
while (aptMainLoop())
|
||||||
{
|
{
|
||||||
gspWaitForVBlank();
|
gspWaitForVBlank();
|
||||||
|
gfxSwapBuffers();
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
|
|
||||||
// Your code goes here
|
|
||||||
|
|
||||||
u32 kDown = hidKeysDown();
|
u32 kDown = hidKeysDown();
|
||||||
if (kDown & KEY_START)
|
if (kDown & KEY_START)
|
||||||
break; // break in order to return to hbmenu
|
break; // break in order to return to hbmenu
|
||||||
|
|
||||||
if (kDown & KEY_B)APT_LaunchLibraryApplet(0x408, 0, NULL, 0);//Launch the extrapad library applet when button B is pressed.
|
|
||||||
|
|
||||||
// Example rendering code that displays a white pixel
|
|
||||||
// Please note that the 3DS screens are sideways (thus 240x400 and 240x320)
|
|
||||||
u32* fb = (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
|
|
||||||
|
|
||||||
for(i=0; i<(0x46500>>2); i++)fb[i] = val;
|
|
||||||
|
|
||||||
val+= 0x44;
|
|
||||||
|
|
||||||
// Flush and swap framebuffers
|
|
||||||
gfxFlushBuffers();
|
gfxFlushBuffers();
|
||||||
gfxSwapBuffers();
|
|
||||||
|
// Launch the extrapad library applet when button B is pressed.
|
||||||
|
if (kDown & KEY_B)
|
||||||
|
{
|
||||||
|
Result rc = APT_LaunchLibraryApplet(APPID_EXTRAPAD, 0, NULL, 0);
|
||||||
|
if (rc) printf("APT_LaunchLibraryApplet: %08lX\n", rc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit services
|
// Exit services
|
||||||
gfxExit();
|
gfxExit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user