void Save::loadFromNitroFs(){ nitroOk = nitroFSInit(); if (nitroOk) nitro_file = fopen("midicontrol.cfg", "r"); load(); fclose(nitro_file); nitro_file = NULL; }
/* DS_SysInit Initializes DS specific system hardware and interrupts. */ LOCALPROC DS_SysInit(void) { defaultExceptionHandler(); powerOn(POWER_ALL_2D); lcdMainOnTop(); irqSet(IRQ_VBLANK, DS_VBlank_IRQ); irqSet(IRQ_HBLANK, DS_HBlank_IRQ); irqSet(IRQ_TIMER1, DS_Timer1_IRQ); irqEnable(IRQ_VBLANK); irqEnable(IRQ_HBLANK); irqEnable(IRQ_TIMER1); /* This sets up 2 timers as a milisecond counter. TIMER0_DATA Will overflow roughly every 1 msec into TIMER1_DATA. When TIMER1_DATA overflows an interrupt will be generated and DS_Timer1_IRQ will be called. */ TIMER0_DATA = 32768; TIMER0_CR = TIMER_DIV_1 | TIMER_ENABLE; TIMER1_DATA = 0; TIMER1_CR = TIMER_ENABLE | TIMER_CASCADE | TIMER_IRQ_REQ; /* Testing. */ consoleDemoInit(); consoleDebugInit(DebugDevice_NOCASH); /* Use the default keyboard until I design a (good) UI... */ DSKeyboard = keyboardDemoInit(); keyboardShow(); /* Drop back to a read only filesystem embedded in the Mini vMac binary if we cannot open a media device. */ if (! fatInitDefault()) { nitroFSInit(); } }
int main(int argc, char* argv[]) { consoleDemoInit(); InstallSoundSys(); iprintf("\n\n\tSSEQ player PoC v1\n"); iprintf("\tfincs.drunkencoders.com\n"); iprintf("\tgithub.com/fincs"); if (argc < 4) { if (!nitroFSInit()) { error("Can't initialize NitroFS!"); anykey(); return 0; } if (defaultLoad(&g_sseqData, &g_sbnkData, g_swarData) != 0) { anykey(); return 0; } }else { if (!fatInitDefault()) { error("Can't initialize FAT!"); anykey(); return 0; } if (argvLoad(argc-1, argv+1, &g_sseqData, &g_sbnkData, g_swarData) != 0) { anykey(); return 0; } } PlaySeq(g_sseqData, g_sbnkData, g_swarData); for(;;) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_START) break; if (keysDown() & KEY_B) StopSeq(); } return 0; }
//--------------------------------------------------------------------------------- int main(int argc, char **argv) { //--------------------------------------------------------------------------------- // Initialise the console, required for printf consoleDemoInit(); if (nitroFSInit()) { dirlist("/"); } else { iprintf("nitroFSInit failure: terminating\n"); } while(1) { swiWaitForVBlank(); } return 0; }
int main(void) { int i; defaultExceptionHandler(); irqEnable(IRQ_VBLANK); irqEnable(IRQ_HBLANK); irqSet(IRQ_VBLANK, vblank_idle); fifoSetValue32Handler(FIFO_USER_02, arm7print, NULL); fifoSetValue32Handler(FIFO_USER_03, sleepMode, NULL); //vramSetBankA(VRAM_A_LCD); videoSetMode(MODE_0_2D); // map some VRAM // bank C to ARM7, bank H for subscreen graphics *(vu8*)0x04000242 = 0x82; *(vu8*)0x04000248 = 0x81; videoSetModeSub(MODE_0_2D); consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, false, true); *(vu16*)0x0400100A = 0x0300; setBackdropColorSub(0x7C00); // configure BLDCNT so that backdrop becomes black *(vu16*)0x04001050 = 0x00E0; *(vu8*)0x04001054 = 16; // enable window 0 and disable color effects inside it *(vu16*)0x04001000 |= 0x2000; *(vu16*)0x04001048 = 0x001F; *(vu16*)0x0400104A = 0x003F; toggleConsole(false); #ifdef NITROFS_ROM if (!nitroFSInit()) #else if (!fatInitDefault()) #endif { toggleConsole(true); iprintf("FAT init failed\n"); return -1; } makeROMList(); makeMenu(); iprintf("lolSnes " VERSION " -- by Mega-Mario\n"); for (;;) { if (keypress != 0x03FF) { if (!(keypress & 0x0040)) // up { menusel--; if (menusel < 0) menusel = 0; if (menusel < menuscroll) menuscroll = menusel; makeMenu(); } else if (!(keypress & 0x0080)) // down { menusel++; if (menusel > nfiles-1) menusel = nfiles-1; if (menusel-21 > menuscroll) menuscroll = menusel-21; makeMenu(); } else if ((keypress & 0x0003) != 0x0003) // A/B { strncpy(fullpath, "snes/", 5); strncpy(fullpath + 5, &filelist[menusel << 8], 256); if (!Mem_LoadROM(fullpath)) { iprintf("ROM loading failed\n"); continue; } *(vu16*)0x04001000 &= 0xDFFF; toggleConsole(true); iprintf("ROM loaded, running\n"); CPU_Reset(); fifoSendValue32(FIFO_USER_01, 1); swiWaitForVBlank(); fifoSendValue32(FIFO_USER_01, 2); irqSet(IRQ_VBLANK, vblank); irqSet(IRQ_HBLANK, PPU_HBlank); swiWaitForVBlank(); CPU_Run(); } keypress = 0x03FF; } swiWaitForVBlank(); } return 0; }