int stopUsbHost() { int ret = sceUsbDeactivate( HOSTFSDRIVER_PID ); if ( ret != 0 ) { log( "Error Deactivate driver %08x (0x%08X)\n", HOSTFSDRIVER_PID, ret ); //return -1; } ret = sceUsbStop( HOSTFSDRIVER_NAME, 0, 0 ); if ( ret != 0 ) { log( "Error stopping USB Host driver (0x%08X)\n", ret ); //return -1; } if ( fw_version < FW_500 || sceKernelInitKeyConfig() == PSP_INIT_KEYCONFIG_GAME ) { sceUsbStop(PSP_USBBUS_DRIVERNAME, 0, 0); if ( ret != 0 ) { log( "Error stopping USB Bus driver (0x%08X)\n", ret ); //return -1; } } killModule( "USBHostFS" ); return 0; }
int main_thread(SceSize args, void *argp) { int exit = 0, init_key = 0, model = 0, light = 0; SceCtrlData pad; sceCtrlPeekBufferPositive(&pad, 1); if(pad.Buttons & PSP_CTRL_LTRIGGER) { exit = 1; } else if(pad.Buttons & PSP_CTRL_RTRIGGER) { light = 1; } if(!exit) { init_key = sceKernelInitKeyConfig(); if(init_key == PSP_INIT_KEYCONFIG_VSH) // VSH MODE SPOTTED { loadStartModuleWithArgs("ms0:/seplugins/cfe/cfe_vsh.prx", 1, 0, NULL); } else { model = sceKernelGetModel(); if(model == PSP_MODEL_SLIM_AND_LITE) // PSP SLIM SPOTTED { if(sceKernelInitApitype() == PSP_INIT_APITYPE_DISC) { if(!light) loadStartModuleWithArgs("ms0:/seplugins/cfe/cfe_game.prx", 8, 0, NULL); else loadStartModuleWithArgs("ms0:/seplugins/cfe/cfe_light.prx", 1, 0, NULL); } else { loadStartModuleWithArgs("ms0:/seplugins/cfe/cfe_light.prx", 1, 0, NULL); } } else // PSP FAT SPOTTED { loadStartModuleWithArgs("ms0:/seplugins/cfe/cfe_light.prx", 1, 0, NULL); } } } sceKernelStopUnloadSelfModule(0, NULL, NULL, NULL); return 0; }
int startUsbHost() { tSceModule * pMod = ( tSceModule * )sceKernelFindModuleByName( "USBHostFS" ); if ( !pMod ) { if ( loadStartModule( USBHOSTFS_PRX, 0, NULL ) < 0 ) { log( "Error starting usbhostfs.prx\n" ); return -1; } } int ret; if ( fw_version < FW_500 || sceKernelInitKeyConfig() == PSP_INIT_KEYCONFIG_GAME ) { ret = sceUsbStart( PSP_USBBUS_DRIVERNAME, 0, 0 ); if ( ret != 0 ) { log( "Error starting USB Bus driver (0x%08X)\n", ret ); return -1; } } else { ret = sceUsbStart( PSP_USBBUS_DRIVERNAME, 0, 0 ); if ( ret != 0 ) { log( "Error starting USB Bus driver (0x%08X)\n", ret ); return -1; } } ret = sceUsbStart( HOSTFSDRIVER_NAME, 0, 0 ); if ( ret != 0 ) { log( "Error starting USB Host driver (0x%08X)\n", ret ); return -1; } ret = sceUsbActivate( HOSTFSDRIVER_PID ); sceKernelDelayThread( 2000000 ); return ret; }
int sceKernelStartModulePatched(SceUID modid, SceSize argsize, void *argp, int *status, SceKernelSMOption *option) { SceModule2 *mod = sceKernelFindModuleByUID660(modid); if(mod) { if(!plugins_started) { if(strcmp(mod->modname, "sceMediaSync") == 0) { plugins_started = 1; SceUID fd = -1; char path[64]; int type = sceKernelInitKeyConfig(); if(type == PSP_INIT_KEYCONFIG_GAME) { sprintf(path, "%s/GAME.TXT", rebootex_config.savedata_path); fd = sceIoOpen(path, PSP_O_RDONLY, 0); } else if(type == PSP_INIT_KEYCONFIG_POPS) { sprintf(path, "%s/POPCORN.PRX", rebootex_config.savedata_path); LoadStartModule(path); sprintf(path, "%s/POPS.TXT", rebootex_config.savedata_path); fd = sceIoOpen(path, PSP_O_RDONLY, 0); } if(fd >= 0) { SceUID fpl = sceKernelCreateFpl("", PSP_MEMORY_PARTITION_KERNEL, 0, 1024, 1, NULL); if(fpl >= 0) { char *buffer; sceKernelAllocateFpl(fpl, (void *)&buffer, NULL); int size = sceIoRead(fd, buffer, 1024); char *p = buffer; int res = 0; char plugin[64]; do { int activated = 0; memset(plugin, 0, sizeof(plugin)); res = GetPlugin(p, size, plugin, &activated); if(res > 0) { if(activated) LoadStartModule(plugin); size -= res; p += res; } } while(res > 0); sceIoClose(fd); if(buffer) { sceKernelFreeFpl(fpl, buffer); sceKernelDeleteFpl(fpl); } } } } } } return sceKernelStartModule660(modid, argsize, argp, status, option); }