int module_start(SceSize args, void* argp) { char keypath[128]; int ret; SceIoStat stat; psp_fw_version = sceKernelDevkitVersion(); setup_patch_offset_table(psp_fw_version); psp_model = sceKernelGetModel(); memset(&conf, 0, sizeof(conf)); sctrlSEGetConfig(&conf); printk_init("ms0:/popcorn.txt"); printk("Popcorn: init_file = %s psp_fw_version = 0x%08X psp_model = %d\n", sceKernelInitFileName(), (uint)psp_fw_version, (int)psp_model); get_keypath(keypath, sizeof(keypath)); ret = sceIoGetstat(keypath, &stat); g_keys_bin_found = 0; if(ret == 0) { ret = load_key(keypath, g_keys, sizeof(g_keys)); if(ret == 0) { g_keys_bin_found = 1; printk("keys.bin found\n"); } } g_is_custom_ps1 = is_custom_ps1(); g_icon0_status = get_icon0_status(); if(g_is_custom_ps1) { setup_psx_fw_version(psp_fw_version); } g_previous = sctrlHENSetStartModuleHandler(&popcorn_patch_chain); patch_scePops_Manager(); sync_cache(); return 0; }
int main_thread(SceSize size, void *argp) { int thid; u32 psp_model; thid = get_thread_id("SCE_VSH_GRAPHICS"); if(thid < 0) { no_vsh = 1; } sctrlSEGetConfig(&g_config); vpl_init(); suspend_vsh_thread(); proDebugScreenInit(); psp_model = kuKernelGetModel(); fontlist_init(&g_font_list); get_fontlist(&g_font_list, fontpath); get_fontlist(&g_font_list, fontgopath); load_recovery_font_select(); if(g_cur_font_select[0] != '\0') { proDebugScreenSetFontFile(g_cur_font_select, 1); } if(zenkaku!=0){ fontlist_init(&g_font_list); get_fontlist(&g_font_list, kanji); get_fontlist(&g_font_list, kanjigo); } proDebugScreenClearLineDisable(); get_confirm_button(); main_menu(); recovery_exit(); return 0; }
int vpbp_loadexec(char * file, struct SceKernelLoadExecVSHParam * param) { int ret; SEConfig config; VirtualPBP *vpbp; int apitype; const char *loadexec_file; lock(); vpbp = get_vpbp_by_path(file); if (vpbp == NULL) { printk("%s: Unknown file %s in vpbp list\n", __func__, file); unlock(); return -31; } sctrlSEGetConfig(&config); if(config.chn_iso) { get_ISO_shortname(vpbp->name, sizeof(vpbp->name), vpbp->name); } //set iso file for reboot sctrlSESetUmdFile(vpbp->name); //set iso mode for reboot sctrlSESetBootConfFileIndex(config.umdmode); sctrlSESetDiscType(PSP_UMD_TYPE_GAME); //enable high memory on demand if(config.retail_high_memory) sctrlHENSetMemory(55, 0); printk("%s: ISO %s, UMD mode %d\n", __func__, vpbp->name, config.umdmode); //reset and configure reboot parameter memset(param, 0, sizeof(param)); param->size = sizeof(param); if (has_prometheus_module(vpbp)) { printk("%s: prometheus module detected, use EBOOT.OLD\n", __func__); param->argp = "disc0:/PSP_GAME/SYSDIR/EBOOT.OLD"; } else { param->argp = "disc0:/PSP_GAME/SYSDIR/EBOOT.BIN"; } param->args = strlen(param->argp) + 1; if (psp_model == PSP_GO) { char devicename[20]; ret = get_device_name(devicename, sizeof(devicename), vpbp->name); if(ret == 0 && 0 == stricmp(devicename, "ef0:")) { apitype = 0x125; } else { apitype = 0x123; } param->key = "umdemu"; loadexec_file = vpbp->name; } else { if(config.umdmode == MODE_MARCH33) { param->key = "game"; } else { param->key = "umdemu"; } apitype = 0x120; loadexec_file = param->argp; } //start game image return sctrlKernelLoadExecVSHWithApitype(apitype, loadexec_file, param); unlock(); return ret; }
// 0x00000340 int module_start(SceSize args, void* argp) { SceModule2 *pMod; int fd, key_config; SEConfig config; psp_model = sceKernelGetModel(); psp_fw_version = sceKernelDevkitVersion(); setup_patch_offset_table(psp_fw_version); printk_init("ms0:/LOG_GALAXY.TXT"); printk("PROGalaxyController started: 0x%08X\n", (uint)psp_fw_version); key_config = sceKernelApplicationType(); sctrlSEGetConfig(&config); if(config.iso_cache && psp_model != PSP_1000 && key_config == PSP_INIT_KEYCONFIG_GAME) { int bufsize; bufsize = config.iso_cache_total_size * 1024 * 1024 / config.iso_cache_num; if((bufsize % 512) != 0) { bufsize &= ~(512-1); } if(bufsize == 0) { bufsize = 512; } infernoCacheSetPolicy(config.iso_cache_policy); infernoCacheInit(bufsize, config.iso_cache_num); } g_iso_fn = sctrlSEGetUmdFile(); pMod = (SceModule2*)sceKernelFindModuleByName("sceThreadManager"); if(pMod != NULL) { // sceKernelCreateThread export _sw((u32)&myKernelCreateThread, pMod->text_addr + g_offs->sceKernelCreateThread); // sceKernelStartThread export _sw((u32)&myKernelStartThread, pMod->text_addr + g_offs->sceKernelStartThread); } else { printk("sceThreadManager cannot be found?!\n"); } clear_cache(); while( 1 ) { fd = sceIoOpen(g_iso_fn, PSP_O_RDONLY, 0); if(fd >= 0) { break; } sceKernelDelayThread(10000); } sceIoClose(fd); printk("%s: finished\n", __func__); return 0; }