int main() { pspDebugScreenInit(); int devkit = sceKernelDevkitVersion(), cursor = 0; if(devkit != 0x06060010) Exit("This program supports only 6.60!"); printf("USB Mod Flasher\n\n"); setcolor(RED); printf("This Mod is only for the TN-V8 eCFW for the PS Vita!"); setcolor(WHITE); printf("\n\n\n\n\n\n\n\n\n\n\n\nCredits:\nXMB Mod by The Z\nInstaller Port by KanadeEngel\n\nSpecial Thanks to:\nfrostegater"); while(1) { if(cursor > 2) cursor = 0; else if(cursor < 0) cursor = 2; if(cursor == 0) setbcolor(GRAY); printfc(3, 4, " Install XMB Mod. "); setbcolor(BLACK); if(cursor == 1) setbcolor(GRAY); printfc(3, 5, " Restore Original Files. "); setbcolor(BLACK); if(cursor == 2) setbcolor(GRAY); printfc(3, 6, " Exit. "); setbcolor(BLACK); int i; for(i = 0; i < 4; i++) printfc(1, 4 + i, " "); setcolor(BLUE); printfc(1, 4 + cursor, ">"); unsigned int Buttons = wait_press(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN); wait_release(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN); SceCtrlData pad; sceCtrlReadBufferPositive(&pad, 1); if(Buttons & PSP_CTRL_CROSS) { if(cursor != 2) { setc(0, 9); if(assign_flash_zero() < 0) Exit("\n Error in 'flash0:/' assign."); { if(cursor == 0)//Install Mod Module { flash_file("flash0:/vsh/resource/topmenu_icon.rco", _660_install_X_icon, size__660_install_X_icon); } else if(cursor == 1)//Restore Original Module flash_file("flash0:/vsh/resource/topmenu_icon.rco", _660_original_X_icon, size__660_original_X_icon); } } else Exit(""); break; } else if(Buttons & PSP_CTRL_UP) cursor--; else if(Buttons & PSP_CTRL_DOWN) cursor++; } Exit("Done."); sceKernelExitGame(); return 0; }
int main(void) { SNES_CIC_PAIR_REG->FIODIR = BV(SNES_CIC_PAIR_BIT); BITBAND(SNES_CIC_PAIR_REG->FIOSET, SNES_CIC_PAIR_BIT) = 1; /* LPC_GPIO2->FIODIR = BV(0) | BV(1) | BV(2); */ // LPC_GPIO0->FIODIR = BV(16); /* connect UART3 on P0[25:26] + SSP0 on P0[15:18] + MAT3.0 on P0[10] */ LPC_PINCON->PINSEL1 = BV(18) | BV(19) | BV(20) | BV(21) /* UART3 */ | BV(3) | BV(5); /* SSP0 (FPGA) except SS */ LPC_PINCON->PINSEL0 = BV(31); /* SSP0 */ /* | BV(13) | BV(15) | BV(17) | BV(19) SSP1 (SD) */ /* pull-down CIC data lines */ LPC_PINCON->PINMODE0 = BV(0) | BV(1) | BV(2) | BV(3); clock_disconnect(); power_init(); timer_init(); DBG_UART uart_init(); led_init(); readled(0); rdyled(1); writeled(0); /* do this last because the peripheral init()s change PCLK dividers */ clock_init(); // LPC_PINCON->PINSEL0 |= BV(20) | BV(21); /* MAT3.0 (FPGA clock) */ sdn_init(); DBG_BL printf("chksum=%08lx\n", *(uint32_t*)28); DBG_BL printf("\n\nsd2snes mk.2 bootloader\nver.: " VER "\ncpu clock: %ld Hz\n", CONFIG_CPU_FREQUENCY); DBG_BL printf("PCONP=%lx\n", LPC_SC->PCONP); /* setup timer (fpga clk) */ LPC_TIM3->CTCR=0; LPC_TIM3->EMR=EMC0TOGGLE; LPC_TIM3->MCR=MR0R; LPC_TIM3->MR0=1; LPC_TIM3->TCR=1; NVIC->ICER[0] = 0xffffffff; NVIC->ICER[1] = 0xffffffff; FLASH_RES res = flash_file((uint8_t*)"/sd2snes/firmware.img"); if(res == ERR_FLASHPREP || res == ERR_FLASHERASE || res == ERR_FLASH) { rdyled(0); writeled(1); } if(res == ERR_FILEHD || res == ERR_FILECHK) { rdyled(0); readled(1); } DBG_BL printf("flash result = %d\n", res); if(res != ERR_OK) { if((res = check_flash()) != ERR_OK) { DBG_BL printf("check_flash() failed with error %d, not booting.\n", res); while(1) { toggle_rdy_led(); delay_ms(500); } } } NVIC_DisableIRQ(RIT_IRQn); NVIC_DisableIRQ(UART_IRQ); SCB->VTOR=FW_START+0x00000100; chain = (void*)(*((uint32_t*)(FW_START+0x00000104))); uart_putc("0123456789abcdef"[((uint32_t)chain>>28)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>24)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>20)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>16)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>12)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>8)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>4)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain)&15]); uart_putc('\n'); chain(); while(1); }