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 }
u32 UnmountSd() { u32 pad_state; DebugClear(); Debug("Unmounting SD card..."); #ifdef USE_THEME LoadThemeGfx(GFX_UNMOUNT, false); #endif DeinitFS(); Debug("SD is unmounted, you may remove it now."); Debug("Put the SD card back in before pressing B!"); Debug(""); Debug("(B to return, START to reboot)"); while (true) { pad_state = InputWait(); if (((pad_state & BUTTON_B) && InitFS()) || (pad_state & BUTTON_START)) break; } return pad_state; }
u32 UnmountSd() { u32 pad_state; #ifdef USE_THEME LoadThemeGfx(GFX_UNMOUNT, false); DeinitFS(); #else DebugClear(); Debug("Desmonatando la tarjeta SD..."); DeinitFS(); Debug("La tarjeta SD ha sido desmontada, puedes removerla ahora."); Debug("¡Inserta la tarjeta SD antes de pulsar B!"); Debug(""); Debug("(B para volver, START para reiniciar)"); #endif while (true) { pad_state = InputWait(); if (((pad_state & BUTTON_B) && InitFS()) || (pad_state & BUTTON_START)) break; } return pad_state; }
u32 ProcessEntry(MenuEntry* entry) { bool emunand = entry->param & N_EMUNAND; bool nand_force = entry->param & N_FORCENAND; bool warning = entry->param & N_NANDWRITE; u32 pad_state; u32 res = 0; // unlock sequence for dangerous features /*if (warning) { u32 unlockSequenceEmu[] = { BUTTON_LEFT, BUTTON_RIGHT, BUTTON_DOWN, BUTTON_UP, BUTTON_A }; u32 unlockSequenceSys[] = { BUTTON_LEFT, BUTTON_UP, BUTTON_RIGHT, BUTTON_UP, BUTTON_A }; u32 unlockLvlMax = ((emunand) ? sizeof(unlockSequenceEmu) : sizeof(unlockSequenceSys)) / sizeof(u32); u32* unlockSequence = (emunand) ? unlockSequenceEmu : unlockSequenceSys; u32 unlockLvl = 0; #ifdef USE_THEME LoadThemeGfx((emunand) ? GFX_DANGER_E : GFX_DANGER_S, false); #endif DebugClear(); Debug("You selected \"%s\".", entry->name); Debug("This feature writes to the %s.", (emunand) ? "EmuNAND" : "SysNAND"); Debug("Doing this is potentially dangerous!"); Debug(""); Debug("If you wish to proceed, enter:"); Debug((emunand) ? "<Left>, <Right>, <Down>, <Up>, <A>" : "<Left>, <Up>, <Right>, <Up>, <A>"); Debug(""); Debug("(B to return, START to reboot)"); while (true) { ShowProgress(unlockLvl, unlockLvlMax); if (unlockLvl == unlockLvlMax) break; pad_state = InputWait(); if (!(pad_state & BUTTON_ANY)) continue; else if (pad_state & unlockSequence[unlockLvl]) unlockLvl++; else if (pad_state & (BUTTON_B | BUTTON_START)) break; else if (unlockLvl == 0 || !(pad_state & unlockSequence[unlockLvl-1])) unlockLvl = 0; } ShowProgress(0, 0); if (unlockLvl < unlockLvlMax) return pad_state; } */ // execute this entries function #ifdef USE_THEME LoadThemeGfx(GFX_PROGRESS, false); #endif DebugClear(); res = (SetNand(emunand, nand_force) == 0) ? (*(entry->function))(entry->param) : 1; Debug("%s: %s!", entry->name, (res == 0) ? "succeeded" : "failed"); Debug(""); Debug("Press B to return, START to reboot."); #ifdef USE_THEME LoadThemeGfx((res == 0) ? GFX_DONE : GFX_FAILED, false); #endif /* while(!((pad_state = InputWait()) & (BUTTON_B | BUTTON_START))) { if (pad_state & BUTTON_X) Screenshot(NULL); #ifdef LOG_FILE else if (pad_state & BUTTON_UP) { pad_state = ScrollOutput(); break; } #endif } */ PowerOff(); // returns the last known pad_state return pad_state; }
u32 ProcessEntry(MenuEntry* entry) { bool emunand = entry->param & N_EMUNAND; bool nand_force = entry->param & N_FORCEEMU; bool nand_write = entry->param & N_NANDWRITE; bool a9lh_write = (entry->param & N_A9LHWRITE) && ((*(u32*) 0x101401C0) == 0); u32 pad_state; u32 res = 0; // unlock sequence for dangerous features if (nand_write || a9lh_write) { const u32 unlockSequences[3][5] = { { BUTTON_LEFT , BUTTON_RIGHT, BUTTON_DOWN , BUTTON_UP , BUTTON_A }, // EmuNAND { BUTTON_LEFT , BUTTON_UP , BUTTON_RIGHT, BUTTON_UP , BUTTON_A }, // SysNAND { BUTTON_RIGHT, BUTTON_DOWN , BUTTON_LEFT , BUTTON_DOWN , BUTTON_A } // A9LH }; const u32 unlockLvlMax = 5; u32* unlockSequence = (u32*) &(unlockSequences[(emunand) ? 0 : (a9lh_write) ? 2 : 1]); u32 warnColor = (emunand) ? COLOR_YELLOW : COLOR_RED; u32 unlockLvl = 0; #ifdef USE_THEME LoadThemeGfx((emunand) ? GFX_DANGER_E : GFX_DANGER_S, false); #endif DebugClear(); Debug("You selected [%s].", entry->name); Debug(""); if (!a9lh_write) { DebugColor(warnColor, "This feature writes to the %s.", (emunand) ? "EmuNAND" : "SysNAND"); DebugColor(warnColor, "This may overwrite important data!"); } else { DebugColor(warnColor, "!!! THIS WILL OVERWRITE THE A9LH !!!"); DebugColor(warnColor, "!!! INSTALLATION IN YOUR SYSNAND !!!"); } Debug(""); Debug("If you wish to proceed, enter:"); Debug((emunand) ? "<Left>, <Right>, <Down>, <Up>, <A>" : (a9lh_write) ? "<Right>, <Down>, <Left>, <Down>, <A>" : "<Left>, <Up>, <Right>, <Up>, <A>"); Debug(""); Debug("(B to return, START to reboot)"); while (true) { ShowProgress(unlockLvl, unlockLvlMax); if (unlockLvl == unlockLvlMax) break; pad_state = InputWait(); if (!(pad_state & BUTTON_ANY)) continue; else if (pad_state & unlockSequence[unlockLvl]) unlockLvl++; else if (pad_state & (BUTTON_B | BUTTON_START)) break; else if (unlockLvl == 0 || !(pad_state & unlockSequence[unlockLvl-1])) unlockLvl = 0; } ShowProgress(0, 0); if (unlockLvl < unlockLvlMax) return pad_state; } // execute this entries function #ifdef USE_THEME LoadThemeGfx(GFX_PROGRESS, false); #endif DebugClear(); Debug("Selected: [%s]", entry->name); res = (SetNand(emunand, nand_force) == 0) ? (*(entry->function))(entry->param) : 1; DebugColor((res == 0) ? COLOR_GREEN : COLOR_RED, "%s: %s!", entry->name, (res == 0) ? "succeeded" : "failed"); Debug(""); Debug("Press B to return, START to reboot."); #ifdef USE_THEME LoadThemeGfx((res == 0) ? GFX_DONE : GFX_FAILED, false); #endif while(!((pad_state = InputWait()) & (BUTTON_B | BUTTON_START))) { if (pad_state & BUTTON_X) Screenshot(NULL); #ifdef LOG_FILE else if (pad_state & BUTTON_UP) { pad_state = ScrollOutput(); break; } #endif } // returns the last known pad_state return pad_state; }
u32 ProcessEntry(MenuEntry* entry) { bool emunand = entry->param & N_EMUNAND; bool nand_force = entry->param & N_FORCEEMU; bool nand_write = entry->param & N_NANDWRITE; bool a9lh_write = (entry->param & N_A9LHWRITE) && ((*(u32*) 0x101401C0) == 0); u32 pad_state; u32 res = 0; // unlock sequence for dangerous features if (nand_write || a9lh_write) { const u32 unlockSequences[3][5] = { { BUTTON_LEFT , BUTTON_RIGHT, BUTTON_DOWN , BUTTON_UP , BUTTON_A }, // EmuNAND { BUTTON_LEFT , BUTTON_UP , BUTTON_RIGHT, BUTTON_UP , BUTTON_A }, // SysNAND { BUTTON_RIGHT, BUTTON_DOWN , BUTTON_LEFT , BUTTON_DOWN , BUTTON_A } // A9LH }; const u32 unlockLvlMax = 5; u32* unlockSequence = (u32*) &(unlockSequences[(emunand) ? 0 : (a9lh_write) ? 2 : 1]); u32 warnColor = (emunand) ? COLOR_YELLOW : COLOR_RED; u32 unlockLvl = 0; #ifdef USE_THEME LoadThemeGfx((emunand) ? GFX_DANGER_E : GFX_DANGER_S, false); #endif DebugClear(); Debug("Has seleccionado [%s].", entry->name); Debug(""); if (!a9lh_write) { DebugColor(warnColor, "Esta operacion escribira datos en %s.", (emunand) ? "EmuNAND" : "SysNAND"); DebugColor(warnColor, "¡Esto puede sobreescribir datos importantes!"); } else { DebugColor(warnColor, "ESTO SOBREESCRIBIRA LA INSTALACION!!!"); DebugColor(warnColor, "DE A9LH EN TU SYSNAND!!!"); } Debug(""); Debug("Si decides continuar, presiona los siguientes botones:"); Debug((emunand) ? "<Izquierda>, <Derecha>, <Abajo>, <Arriba>, <A>" : (a9lh_write) ? "<Derecha>, <Abajo>, <Izquierda>, <Abajo>, <A>" : "<Izquierda>, <Arriba>, <Derecha>, <Arriba>, <A>"); Debug(""); Debug("(B para volver, START para reiniciar)"); while (true) { ShowProgress(unlockLvl, unlockLvlMax); if (unlockLvl == unlockLvlMax) break; pad_state = InputWait(); if (!(pad_state & BUTTON_ANY)) continue; else if (pad_state & unlockSequence[unlockLvl]) unlockLvl++; else if (pad_state & (BUTTON_B | BUTTON_START)) break; else if (unlockLvl == 0 || !(pad_state & unlockSequence[unlockLvl-1])) unlockLvl = 0; } ShowProgress(0, 0); if (unlockLvl < unlockLvlMax) return pad_state; } // execute this entries function #ifdef USE_THEME LoadThemeGfx(GFX_PROGRESS, false); #endif DebugClear(); Debug("Seleccionado: [%s]", entry->name); res = (SetNand(emunand, nand_force) == 0) ? (*(entry->function))(entry->param) : 1; DebugColor((res == 0) ? COLOR_GREEN : COLOR_RED, "%s: %s!", entry->name, (res == 0) ? "succeeded" : "failed"); Debug(""); Debug("B para volver, START para reiniciar."); #ifdef USE_THEME LoadThemeGfx((res == 0) ? GFX_DONE : GFX_FAILED, false); #endif while(!((pad_state = InputWait()) & (BUTTON_B | BUTTON_START))) { if (pad_state & BUTTON_X) Screenshot(NULL); #ifdef LOG_FILE else if (pad_state & BUTTON_UP) { pad_state = ScrollOutput(); break; } #endif } // returns the last known pad_state return pad_state; }
void LoadThemeGfxMenu(u32 index) { char filename[16]; snprintf(filename, 16, "menu%04lu.bin", index); LoadThemeGfx(filename, !LOGO_TOP); // this goes where the logo goes not }