- Joined
- Jul 7, 2010
- Messages
- 3,882
- Trophies
- 2
- Location
- /dev/random
- Website
- www.gudenau.net
- XP
- 5,417
- Country
I am attempting to launch the web browser from an installed title, but when it "returns" to the home menu it crashes. Any ideas?
Code:
#include <3ds.h>
#include <stdio.h>
#define WHITE_ERRORS
static PrintConsole errorScreen;
static PrintConsole logScreen;
void printError(const char* message, Result result);
extern NS_APPID currentAppId;
int main(int argc, char **argv){
Result result;
u8 temp = 0;
gfxInitDefault();
// Setup the consoles, make the error one red
consoleInit(GFX_TOP, &logScreen);
consoleInit(GFX_BOTTOM, &errorScreen);
#ifdef WHITE_ERRORS
printError("Errors:", 0);
#else
printError("\x1b[31mErrors:", 0);
#endif
aptOpenSession();
printError("APT_ReplySleepQuery", APT_ReplySleepQuery(currentAppId, 0));
aptCloseSession();
aptOpenSession();
printError("APT_PrepareToStartSystemApplet", APT_PrepareToStartSystemApplet(APPID_WEB));
aptCloseSession();
u8 buffer[16];
aptOpenSession();
printError("APT_StartSystemApplet", APT_StartSystemApplet(APPID_WEB, /* buffer size */ 0, CUR_PROCESS_HANDLE, buffer));
aptCloseSession();
for(;;){
aptOpenSession();
result = APT_IsRegistered(APPID_WEB, &temp);
aptCloseSession();
if(R_FAILED(result)){
goto error;
}
if(temp != 0){
break;
}
}
GSPGPU_ReleaseRight();
goto noerror;
//return 0;
error:
printf("There was an error, aborting operations.\n");
noerror:
while (aptMainLoop()){
hidScanInput();
if(hidKeysDown() & KEY_START){
break;
}
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}
gfxExit();
return 0;
}
void printError(const char* message, Result result){
consoleSelect(&errorScreen);
printf("%s\n", message);
if(result){
printf("%08lx\n", result);
}
consoleSelect(&logScreen);
}