static _Noreturn void mainLoop() { uint32_t pad; while (true) { pad = InputWait(); if (pad & (BUTTON_DOWN | BUTTON_RIGHT | BUTTON_R1)) MenuNextSelection(); if (pad & (BUTTON_UP | BUTTON_LEFT | BUTTON_L1)) MenuPrevSelection(); if (pad & BUTTON_A) { OpenAnimation(); MenuSelect(); } if (pad & BUTTON_SELECT) { fadeOut(); ShutDown(); } MenuShow(); } }
int main(){ if (Initialize()) while (1); //7.X Keys stuff File KeyFile; const char *keyfile = "/slot0x25KeyX.bin"; if(FileOpen(&KeyFile, keyfile, 0)){ uint8_t keyX[16]; FileRead(&KeyFile, keyX, 16, 0); FileClose(&KeyFile); setup_aeskeyX(0x25, keyX); }else{ if (sysver < 7) { ConsoleInit(); ConsoleSetTitle(strings[STR_WARNING]); print(strings[STR_ERROR_OPENING], keyfile); print(strings[STR_WARNING_KEYFILE]); print(strings[STR_PRESS_BUTTON_ACTION], strings[STR_BUTTON_A], strings[STR_CONTINUE]); ConsoleShow(); WaitForButton(BUTTON_A); } } //That's the Main Menu initialization, easy and cool OpenAnimation(); MenuInit(&MainMenu); MenuShow(); while (true) { uint32_t pad_state = InputWait(); if (pad_state & (BUTTON_DOWN | BUTTON_RIGHT | BUTTON_R1)) MenuNextSelection(); //I try to support every theme style if (pad_state & (BUTTON_UP | BUTTON_LEFT | BUTTON_L1)) MenuPrevSelection(); if (pad_state & BUTTON_A) { OpenAnimation(); MenuSelect(); } if (pad_state & BUTTON_SELECT) { fadeOut(); ShutDown(); } if (pad_state & BUTTON_START) { fadeOut(); returnHomeMenu(); } TryScreenShot(); MenuShow(); } FSDeInit(); return 0; }
__attribute__((section(".text.start"), noreturn)) void _start() { static const TCHAR fontPath[] = _T("") SYS_PATH "/" FONT_NAME; void *fontBuf; UINT btr, br; int r; FIL f; // Enable TMIO IRQ *(volatile uint32_t *)0x10001000 = 0x00010000; preloadStringsA(); if (!FSInit()) { DrawString(BOT_SCREEN, strings[STR_FAILED], BOT_SCREEN_WIDTH / 2, SCREEN_HEIGHT - FONT_HEIGHT, RED, BLACK); while (1); } set_loglevel(ll_info); log(ll_info, "Initializing rxTools..."); setConsole(); fontIsLoaded = 0; r = f_open(&f, fontPath, FA_READ); if (r == FR_OK) { btr = f_size(&f); fontBuf = __builtin_alloca(btr); r = f_read(&f, fontBuf, btr, &br); if (r == FR_OK) fontIsLoaded = 1; f_close(&f); fontaddr = fontBuf; } if (fontIsLoaded) preloadStringsU(); else warn(L"Failed to load " FONT_NAME ": %d\n", r); if (getMpInfo() == MPINFO_KTR) { r = initN3DSKeys(); if (r != FR_OK) { warn(L"Failed to load keys for N3DS\n" " Code: %d\n" " RxMode will not boot. Please\n" " include key_0x16.bin and\n" " key_0x1B.bin at the root of your\n" " SD card.\n", r); InputWait(); goto postinstall; } } install(); postinstall: readCfg(); log(ll_info, "Done..."); r = loadStrings(); if (r) warn(L"Failed to load strings: %d\n", r); drawTop(); //Default boot check if (cfgs[CFG_DEFAULT].val.i && HID_STATE & BUTTON_L1) { if(cfgs[CFG_DEFAULT].val.i == 3) PastaMode(); else rxMode(cfgs[CFG_DEFAULT].val.i - 1); } if (sysver < 7) { r = initKeyX(); if (r != FR_OK) warn(L"Failed to load key X for slot 0x25\n" " Code: %d\n" " If your firmware version is less\n" " than 7.X, some titles decryption\n" " will fail, and some EmuNANDs\n" " will not boot.\n", r); } if (warned) { warn(strings[STR_PRESS_BUTTON_ACTION], strings[STR_BUTTON_A], strings[STR_CONTINUE]); WaitForButton(BUTTON_A); } OpenAnimation(); mainLoop(); }
__attribute__((section(".text.start"), noreturn)) void _start() { static const TCHAR fontPath[] = _T("") SYS_PATH "/" FONT_NAME; void *fontBuf; UINT btr, br; int r; FIL f; // Enable TMIO IRQ *(volatile uint32_t *)0x10001000 = 0x00010000; preloadStringsA(); if (!FSInit()) { DrawString(BOT_SCREEN, strings[STR_FAILED], BOT_SCREEN_WIDTH / 2, SCREEN_HEIGHT - FONT_HEIGHT, RED, BLACK); while (1); } /* set_loglevel(ll_info); log(ll_info, "Initializing rxTools..."); */ setConsole(); fontIsLoaded = 0; r = f_open(&f, fontPath, FA_READ); if (r == FR_OK) { btr = f_size(&f); fontBuf = __builtin_alloca(btr); r = f_read(&f, fontBuf, btr, &br); if (r == FR_OK) fontIsLoaded = 1; f_close(&f); fontaddr = fontBuf; } if (fontIsLoaded) preloadStringsU(); else warn(L"Failed to load " FONT_NAME ": %d\n", r); install(); readCfg(); r = loadStrings(); if (r) warn(L"Failed to load strings: %d\n", r); drawTop(); if (!cfgs[CFG_GUI].val.i && HID_STATE & BUTTON_L1) rxMode(cfgs[CFG_ABSYSN].val.i ? 0 : 1); if (sysver < 7) { r = initKeyX(); if (r != FR_OK) warn(L"Failed to load key X for slot 0x25\n" " Code: %d\n" " If your firmware version is less\n" " than 7.X, some titles decryption\n" " will fail, and some EmuNANDs\n" " will not boot.\n", r); } if (warned) { warn(strings[STR_PRESS_BUTTON_ACTION], strings[STR_BUTTON_A], strings[STR_CONTINUE]); WaitForButton(BUTTON_A); } OpenAnimation(); MenuInit(&MainMenu); MenuShow(); mainLoop(); }