void patch_partitions(void) { MemPart p2, p9; int max_user_part_size; // shut up gcc warning (void)display_meminfo; p2.meminfo = get_partition(2); p9.meminfo = get_partition(9); if(g_p2_size == 24 && g_p9_size == 24) { p2.size = MAX_HIGH_MEMSIZE; p9.size = 0; } else { p2.size = g_p2_size; p9.size = g_p9_size; } if(get_partition(11) != NULL) { max_user_part_size = 56 - 4 - g_p8_size; } else { max_user_part_size = 56 - g_p8_size; } if (p2.size + p9.size > max_user_part_size) { // reserved 4MB for P11 int reserved_len; reserved_len = p2.size + p9.size - max_user_part_size; if(p9.size > reserved_len) { p9.size -= reserved_len; } else { p2.size -= reserved_len - p9.size; p9.size = 0; } } printk("%s: p2/p9 %d/%d\n", __func__, p2.size, p9.size); //reset partition length for next reboot sctrlHENSetMemory(24, 24); p2.offset = 0; modify_partition(&p2); p9.offset = p2.size; modify_partition(&p9); g_high_memory_enabled = 1; display_meminfo(); unlock_high_memory(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; }