void main(void) { unsigned short Val_Freq; // Valeur analogique de la frequence lue sur le potentiometre DebugClear(); // Initialisation des ports PPI_Init(); EXPORT_Init(); LED_Y_Init(); LED_R_Init(); // Initialisation de la memoire XHeap_init(); // Mise en marche du convertisseur AdcSet(ADC0,ADCDF_128); AdcOn(); while(1) { Val_Freq = AdcRead(); // Acquisition de la valeur // affichage des 8 MSB (sur 10) de la valeur de la tension sur les LEDS hautes en SPI LED_R(Val_Freq>>2); Send_1(MsgBox_1, Val_Freq); // Affichage de la mesure dans la fenêtre 'ON-The-Fly' du mode Débug DebugClear(); DebugPrint("\nValeur clignotement (0 à 1023) : "); DebugSHORT(Val_Freq,DEC); } }
u32 ProcessEntry(MenuEntry* entry) { u32 pad_state; u32 res = 0; // unlock sequence for dangerous features if (entry->dangerous) { 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 = 5; u32* unlockSequence = (entry->emunand) ? unlockSequenceEmu : unlockSequenceSys; u32 unlockLvl = 0; DebugClear(); Debug("You selected \"%s\".", entry->name); Debug("This feature writes to the %s.", (entry->emunand) ? "EmuNAND" : "SysNAND"); Debug("Doing this is potentially dangerous!"); Debug(""); Debug("If you wish to proceed, enter:"); Debug((entry->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 DebugClear(); res = (SetNand(entry->emunand) == 0) ? (*(entry->function))(entry->param) : 1; Debug("%s: %s!", entry->name, (res == 0) ? "succeeded" : "failed"); Debug(""); Debug("Press B to return, START to reboot."); while(!(pad_state = InputWait() & (BUTTON_B | BUTTON_START))); // returns the last known pad_state return pad_state; }
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 main(void) { unsigned short Val_Freq; // Valeur analogique de la frequence recuperee en Heap int led; int sens_led; int demi_periode; // Init des ports PPI_Init(); EXPORT_Init(); LED_Y_Init(); LED_R_Init(); // Init des variables led=0; sens_led=0; demi_periode=0; while(1) { Val_Freq = Receive_1(MsgBox_1); // Affichage de la valeur lue dans la fenêtre 'ON-The-Fly' du mode Débug DebugClear(); DebugPrint("\nValeur clignotement (0 à 1023) : "); DebugSHORT(Val_Freq,DEC); //demi_periode = 10 + (int)(1024/(Val_Freq+1)); demi_periode = 5 + (int)((1024-Val_Freq)/2); DebugPrint("\nValeur demi periode : "); DebugINT(demi_periode,DEC); // Attente correspondante (entre 11 et 1034 ms) Delay_ms(demi_periode); // Clignotement effectif // Gestion pour decaler (d'un cran) l'allumage des LEDS en chenillard LED_Y_Off(led); // extinction de la precedente LED if (sens_led==0) { led++; // incrementation - decalage droite if (led>7) { led=6; sens_led=1; } } else { led--; // decrementation - decalage gauche if (led<0) { led=1; sens_led=0; } } LED_Y_On(led); // allumage de la nouvelle LED } }
void MainWindow::on_countSlider_valueChanged(int value) { std::stringstream ss; ss << value; ui->countLabel->setText(ss.str().c_str()); DebugClear(); Count = value; glWidget->GenerateMeshFromLST(); }
u32 UnmountSd() { u32 pad_state; DebugClear(); Debug("Unmounting SD card..."); 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("Unmounting SD card..."); 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)"); #endif 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; }