libctru/examples/get_system_language/source/main.c

49 lines
909 B
C
Raw Normal View History

#include <stdio.h>
#include <string.h>
#include <3ds.h>
int main(int argc, char** argv)
{
// Initialize services
gfxInit();
initCfgu();
u8 language = 0;
2014-12-26 02:46:38 +01:00
Result res;
// Init console for text output
consoleInit(GFX_BOTTOM, NULL);
// Read the language field from the config savegame.
// See here for more block IDs:
// http://3dbrew.org/wiki/Config_Savegame#Configuration_blocks
2014-12-26 02:46:38 +01:00
res = CFGU_GetConfigInfoBlk2(1, 0xA0002, &language);
// Main loop
while (aptMainLoop())
{
hidScanInput();
2014-12-26 02:46:38 +01:00
// Print return value and language code
2014-12-26 03:03:40 +01:00
printf("\x1b[0;0Hresult: 0x%x", (int)res);
printf("\x1b[1;0HLanguage code: %d", (int)language);
u32 kDown = hidKeysDown();
if (kDown & KEY_START)
break; // break in order to return to hbmenu
// Flush and swap framebuffers
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}
// Exit services
exitCfgu();
gfxExit();
return 0;
}