u32 InitializeD9() { u32 errorlevel = 0; // 0 -> none, 1 -> autopause, 2 -> critical ClearScreenFull(true, true); DebugClear(); #ifndef BUILD_NAME Debug("-- Decrypt9 --"); #else Debug("-- %s --", BUILD_NAME); #endif // a little bit of information about the current menu if (sizeof(menu)) { u32 n_submenus = 0; u32 n_features = 0; for (u32 m = 0; menu[m].n_entries; m++) { n_submenus = m; for (u32 e = 0; e < menu[m].n_entries; e++) n_features += (menu[m].entries[e].function) ? 1 : 0; } Debug("Counting %u submenus and %u features", n_submenus, n_features); } Debug("Initializing, hold L+R to pause"); Debug(""); if (InitFS()) { Debug("Initializing SD card... success"); FileGetData("d9logo.bin", BOT_SCREEN0, 320 * 240 * 3, 0); memcpy(BOT_SCREEN1, BOT_SCREEN0, 320 * 240 * 3); if (SetupTwlKey0x03() != 0) // TWL KeyX / KeyY errorlevel = 2; if ((GetUnitPlatform() == PLATFORM_N3DS) && (LoadKeyFromFile(0x05, 'Y', NULL) != 0)) errorlevel = (((*(vu32*) 0x101401C0) == 0) || (errorlevel > 1)) ? 2 : 1; // N3DS CTRNAND KeyY if (LoadKeyFromFile(0x25, 'X', NULL)) // NCCH 7x KeyX errorlevel = (errorlevel < 1) ? 1 : errorlevel; if (LoadKeyFromFile(0x18, 'X', NULL)) // NCCH Secure3 KeyX errorlevel = (errorlevel < 1) ? 1 : errorlevel; if (LoadKeyFromFile(0x1B, 'X', NULL)) // NCCH Secure4 KeyX errorlevel = (errorlevel < 1) ? 1 : errorlevel; Debug("Finalizing Initialization..."); RemainingStorageSpace(); } else { Debug("Initializing SD card... failed"); errorlevel = 2; } Debug(""); Debug("Initialization: %s", (errorlevel == 0) ? "success!" : (errorlevel == 1) ? "partially failed" : "failed!"); if (((~HID_STATE & BUTTON_L1) && (~HID_STATE & BUTTON_R1)) || (errorlevel > 1)) { Debug("(A to %s)", (errorlevel > 1) ? "exit" : "continue"); while (!(InputWait() & BUTTON_A)); } return errorlevel; }
void DrawMenu(MenuInfo* currMenu, u32 index, bool fullDraw, bool subMenu) { u32 emunand_state = CheckEmuNand(); bool top_screen = true; u32 menublock_x0 = (top_screen) ? 76 : 36; u32 menublock_x1 = (top_screen) ? 52 : 12; u32 menublock_y0 = 40; u32 menublock_y1 = menublock_y0 + currMenu->n_entries * 10; if (fullDraw) { // draw full menu ClearScreenFull(true, !top_screen); DrawStringF(menublock_x0, menublock_y0 - 20, top_screen, "%s", currMenu->name); DrawStringF(menublock_x0, menublock_y0 - 10, top_screen, "=============================="); DrawStringF(menublock_x0, menublock_y1 + 0, top_screen, "=============================="); DrawStringF(menublock_x0, menublock_y1 + 10, top_screen, (subMenu) ? "A: Choose B: Return" : "A: Choose"); DrawStringF(menublock_x0, menublock_y1 + 20, top_screen, "SELECT: Unmount SD"); DrawStringF(menublock_x0, menublock_y1 + 30, top_screen, "START: Reboot"); DrawStringF(menublock_x1, SCREEN_HEIGHT - 20, top_screen, "SD card: %lluMB/%lluMB & %s", RemainingStorageSpace() / 1024 / 1024, TotalStorageSpace() / 1024 / 1024, (emunand_state == EMUNAND_READY) ? "EmuNAND ready" : (emunand_state == EMUNAND_GATEWAY) ? "GW EmuNAND" : (emunand_state == EMUNAND_REDNAND) ? "RedNAND" : (emunand_state > 3) ? "MultiNAND" : "no EmuNAND"); DrawStringF(menublock_x1, SCREEN_HEIGHT - 30, top_screen, "Game directory: %s", GAME_DIR); if (DirOpen(WORK_DIR)) { DrawStringF(menublock_x1, SCREEN_HEIGHT - 40, top_screen, "Work directory: %s", WORK_DIR); DirClose(); } } if (!top_screen) DrawStringF(10, 10, true, "Selected: %-*.*s", 32, 32, currMenu->entries[index].name); for (u32 i = 0; i < currMenu->n_entries; i++) { // draw menu entries / selection [] char* name = currMenu->entries[i].name; DrawStringF(menublock_x0, menublock_y0 + (i*10), top_screen, (i == index) ? "[%s]" : " %s ", name); } }
void DrawMenu(MenuInfo* currMenu, u32 index, bool fullDraw, bool subMenu) { u32 emunand_state = CheckEmuNand(); bool top_screen = true; u32 menublock_x0 = (((top_screen) ? SCREEN_WIDTH_TOP : SCREEN_WIDTH_BOT) - 30 * FONT_WIDTH_EXT) / 2; u32 menublock_x1 = menublock_x0 - FONT_WIDTH_EXT; u32 menublock_y0 = 40; u32 menublock_y1 = menublock_y0 + currMenu->n_entries * 10; if (fullDraw) { // draw full menu ClearScreenFull(true, !top_screen); DrawStringF(menublock_x0, menublock_y0 - 20, top_screen, "%s", currMenu->name); DrawStringF(menublock_x0, menublock_y0 - 10, top_screen, "=============================="); DrawStringF(menublock_x0, menublock_y1 + 0, top_screen, "=============================="); DrawStringF(menublock_x0, menublock_y1 + 10, top_screen, (subMenu) ? "A: Choose B: Return" : "A: Choose"); DrawStringF(menublock_x0, menublock_y1 + 20, top_screen, "SELECT: Unmount SD Card"); DrawStringF(menublock_x0, menublock_y1 + 30, top_screen, "START: Reboot / [+\x1B] Poweroff"); DrawStringF(menublock_x1, SCREEN_HEIGHT - 20, top_screen, "SD card: %lluMB/%lluMB & %s", RemainingStorageSpace() / 1024 / 1024, TotalStorageSpace() / 1024 / 1024, (emunand_state == EMUNAND_READY) ? "EmuNAND ready" : (emunand_state == EMUNAND_GATEWAY) ? "GW EmuNAND" : (emunand_state == EMUNAND_REDNAND) ? "RedNAND" : (emunand_state > 3) ? "MultiNAND" : "no EmuNAND"); DrawStringF(menublock_x1, SCREEN_HEIGHT - 30, top_screen, "Game directory: %s", (GetGameDir()) ? GetGameDir() : "(not available)"); DrawStringF(menublock_x1, SCREEN_HEIGHT - 40, top_screen, "Work directory: %s", GetWorkDir()); } if (!top_screen) DrawStringF(10, 10, true, "Selected: %-*.*s", 32, 32, currMenu->entries[index].name); for (u32 i = 0; i < currMenu->n_entries; i++) { // draw menu entries / selection [] char* name = currMenu->entries[i].name; DrawStringF(menublock_x0, menublock_y0 + (i*10), top_screen, (i == index) ? "[%s]" : " %s ", name); } }
void DrawMenu(MenuInfo* currMenu, u32 index, bool fullDraw, bool subMenu) { u32 emunand_state = CheckEmuNand(); bool top_screen = true; u32 menublock_x0 = (top_screen) ? 76 : 36; u32 menublock_x1 = (top_screen) ? 52 : 12; u32 menublock_y0 = 40; u32 menublock_y1 = menublock_y0 + currMenu->n_entries * 10; if (fullDraw) { // draw full menu ClearScreenFull(true, !top_screen); DrawStringF(menublock_x0, menublock_y0 - 20, top_screen, "%s", currMenu->name); DrawStringF(menublock_x0, menublock_y0 - 10, top_screen, "=============================="); DrawStringF(menublock_x0, menublock_y1 + 0, top_screen, "=============================="); DrawStringF(menublock_x0, menublock_y1 + 10, top_screen, (subMenu) ? "A: Elegir B: Volver" : "A: Elegir"); DrawStringF(menublock_x0, menublock_y1 + 20, top_screen, "SELECT: Desmontar la tarjeta SD"); DrawStringF(menublock_x0, menublock_y1 + 30, top_screen, "START: Reiniciar / [+\x1B] Apagar"); DrawStringF(menublock_x1, SCREEN_HEIGHT - 20, top_screen, "Tarjeta SD: %lluMB/%lluMB & %s", RemainingStorageSpace() / 1024 / 1024, TotalStorageSpace() / 1024 / 1024, (emunand_state == EMUNAND_READY) ? "EmuNAND lista" : (emunand_state == EMUNAND_GATEWAY) ? "GW EmuNAND" : (emunand_state == EMUNAND_REDNAND) ? "RedNAND" : (emunand_state > 3) ? "MultiNAND" : "no EmuNAND"); DrawStringF(menublock_x1, SCREEN_HEIGHT - 30, top_screen, "Directorio de juego: %s", GAME_DIR); if (DirOpen(WORK_DIR)) { DrawStringF(menublock_x1, SCREEN_HEIGHT - 40, top_screen, "Directorio de trabajo: %s", WORK_DIR); DirClose(); } } if (!top_screen) DrawStringF(10, 10, true, "Selected: %-*.*s", 32, 32, currMenu->entries[index].name); for (u32 i = 0; i < currMenu->n_entries; i++) { // draw menu entries / selection [] char* name = currMenu->entries[i].name; DrawStringF(menublock_x0, menublock_y0 + (i*10), top_screen, (i == index) ? "[%s]" : " %s ", name); } }
void LoadThemeGfxLogo(void) { LoadThemeGfx(GFX_LOGO, LOGO_TOP); #if defined LOGO_TEXT_X && defined LOGO_TEXT_Y u32 emunand_state = CheckEmuNand(); DrawStringF(LOGO_TEXT_X, LOGO_TEXT_Y - 0, LOGO_TOP, "SD card: %lluMB/%lluMB & %s", RemainingStorageSpace() / 1024 / 1024, TotalStorageSpace() / 1024 / 1024, (emunand_state == EMUNAND_READY) ? "EmuNAND ready" : (emunand_state == EMUNAND_GATEWAY) ? "GW EmuNAND" : (emunand_state == EMUNAND_REDNAND) ? "RedNAND" : (emunand_state > 3) ? "MultiNAND" : "no EmuNAND"); DrawStringF(LOGO_TEXT_X, LOGO_TEXT_Y - 10, LOGO_TOP, "Game directory: %s", (GetGameDir()) ? GetGameDir() : "(not available)"); DrawStringF(LOGO_TEXT_X, LOGO_TEXT_Y - 20, LOGO_TOP, "Work directory: %s", GetWorkDir()); #endif }
void DrawMenu(MenuInfo* currMenu, u32 index, bool fullDraw, bool subMenu) { bool top_screen = true; u32 menublock_x0 = (top_screen) ? 76 : 36; u32 menublock_x1 = (top_screen) ? 50 : 10; u32 menublock_y0 = 40; u32 menublock_y1 = menublock_y0 + currMenu->n_entries * 10; if (fullDraw) { // draw full menu ClearScreenFull(true, !top_screen); DrawStringF(menublock_x0, menublock_y0 - 20, top_screen, "%s", currMenu->name); DrawStringF(menublock_x0, menublock_y0 - 10, top_screen, "=============================="); DrawStringF(menublock_x0, menublock_y1 + 0, top_screen, "=============================="); DrawStringF(menublock_x0, menublock_y1 + 10, top_screen, (subMenu) ? "A: Choose B: Return" : "A: Choose"); DrawStringF(menublock_x0, menublock_y1 + 20, top_screen, "SELECT: Unmount SD"); DrawStringF(menublock_x0, menublock_y1 + 30, top_screen, "START: Reboot"); DrawStringF(menublock_x1, SCREEN_HEIGHT - 20, top_screen, "Remaining SD storage space: %llu MiB", RemainingStorageSpace() / 1024 / 1024); DrawStringF(menublock_x1, SCREEN_HEIGHT - 30, top_screen, "Game directory: %s", GAME_DIR); if (DirOpen(WORK_DIR)) { DrawStringF(menublock_x1, SCREEN_HEIGHT - 40, top_screen, "Work directory: %s", WORK_DIR); DirClose(); } } if (!top_screen) DrawStringF(10, 10, true, "Selected: %-*.*s", 32, 32, currMenu->entries[index].name); for (u32 i = 0; i < currMenu->n_entries; i++) { // draw menu entries / selection [] char* name = currMenu->entries[i].name; DrawStringF(menublock_x0, menublock_y0 + (i*10), top_screen, (i == index) ? "[%s]" : " %s ", name); } }