int main( int argc, char **argv) { consoleDemoInit(); if (fatInitDefault()) { runNdsFile("/BOOT.NDS", 0, NULL); } else { printf("FAT init failed!\n"); } while(1) swiWaitForVBlank(); }
//--------------------------------------------------------------------------------- int main(void) { //--------------------------------------------------------------------------------- struct stat st; // Enable VBlank for Vblank Interrupt Wait irqInit(); irqEnable(IRQ_VBLANK); videoSetMode(0); //not using the main screen // Subscreen as a console videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); vramSetBankH(VRAM_H_SUB_BG); SUB_BG0_CR = BG_MAP_BASE(15); BG_PALETTE_SUB[0]=0; BG_PALETTE_SUB[255]=0xffff; consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(15), (u16*)CHAR_BASE_BLOCK_SUB(0), 16); iprintf ("Init'ing FAT..."); if (fatInitDefault()) { iprintf ("okay\n"); } else { iprintf ("fail!\n"); stop(); } if (stat (DEFAULT_FILE, &st) >= 0) { iprintf ("Running %s\n", DEFAULT_FILE); runNdsFile (DEFAULT_FILE); } else { std::string filename = browseForFile (".nds"); iprintf ("Running %s\n", filename.c_str()); runNdsFile (filename.c_str()); } iprintf ("Start failed\n"); stop(); return 0; }
int main( int argc, char **argv) { // defaultExceptionHandler(); if (fatInitDefault()) { fifoWaitValue32(FIFO_USER_02); if (fifoGetValue32(FIFO_USER_01) == 0) { int size = 32; FILE* ResetData = fopen("sd:/hiya/ResetData.bin","rb"); fread((void*)0x02000300,1,size,ResetData); fclose(ResetData); fifoSendValue32(FIFO_USER_08, 1); for (int i = 0; i < 5; i++) { swiWaitForVBlank(); } } LoadSettings(); bool gotoSettings = false; if (access("sd:/hiya/settings.ini", F_OK)) { gotoSettings = true; } scanKeys(); if(keysHeld() & KEY_SELECT) gotoSettings = true; if(gotoSettings) { // Subscreen as a console videoSetMode(MODE_0_2D); vramSetBankG(VRAM_G_MAIN_BG); videoSetModeSub(MODE_0_2D); vramSetBankH(VRAM_H_SUB_BG); int pressed = 0; bool menuprinted = true; while(1) { if(menuprinted) { consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, true, true); consoleClear(); printf("HiyaCFW v1.0 configuration\n"); printf("Press A to select, START to save"); printf("\n"); if(cursorPosition == 0) printf(">"); else printf(" "); printf("Splash: "); if(splash) printf("Off( ), On(x)"); else printf("Off(x), On( )"); printf("\n\n"); if(cursorPosition == 1) printf(">"); else printf(" "); if(dsiSplash) printf("(x)"); else printf("( )"); printf(" DSi Splash/H&S screen"); consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true); consoleClear(); if(cursorPosition == 0) { printf("Enable splash screen."); } else if(cursorPosition == 1) { printf("Enable showing the DSi Splash/\n"); printf("Health & Safety screen."); } menuprinted = false; } do { scanKeys(); pressed = keysDownRepeat(); swiWaitForVBlank(); } while (!pressed); if (pressed & KEY_A) { switch(cursorPosition){ case 0: default: splash = !splash; break; case 1: dsiSplash = !dsiSplash; break; } menuprinted = true; } if (pressed & KEY_UP) { cursorPosition -= 1; menuprinted = true; } else if (pressed & KEY_DOWN) { cursorPosition += 1; menuprinted = true; } if (cursorPosition < 0) cursorPosition = 1; if (cursorPosition > 1) cursorPosition = 0; if (pressed & KEY_START) { SaveSettings(); break; } } } if(dsiSplash) fifoSendValue32(FIFO_USER_03, 1); if(splash) { BootSplashInit(); LoadScreen(); for (int i = 0; i < 60*3; i++) { swiWaitForVBlank(); } } runNdsFile("/BOOTLOADER.NDS", 0, NULL); } else { BootSplashInit(); // Display Error Screen swiDecompressLZSSVram ((void*)topErrorTiles, (void*)CHAR_BASE_BLOCK(2), 0, &decompressBiosCallback); swiDecompressLZSSVram ((void*)subErrorTiles, (void*)CHAR_BASE_BLOCK_SUB(2), 0, &decompressBiosCallback); vramcpy_ui (&BG_PALETTE[0], topErrorPal, topErrorPalLen); vramcpy_ui (&BG_PALETTE_SUB[0], subErrorPal, subErrorPalLen); } while(1) { swiWaitForVBlank(); } }