Beispiel #1
0
u8 *load_file_from_ISO(const char *iso, char *name, int *size)
{
	int ret;
	u32 lba;
	u8 *buf;

	ret = isoOpen(iso);
	if (ret < 0) {
		return NULL;
	}

	ret = isoGetFileInfo(name, (u32*)size, &lba);
	if (ret < 0) {
		isoClose();
		return NULL;
	}

	buf = malloc(*size);
	if (buf == NULL) {
		isoClose();
		return NULL;
	}

	ret = isoRead(buf, lba, 0, *size);
	if (ret < 0) {
		isoClose();
		return NULL;
	}

	isoClose();
	return buf;
}
Beispiel #2
0
static int has_file(char *file)
{
	int ret;
	u32 size, lba;
	
	ret = isoGetFileInfo(file, &size, &lba);
	ret = (ret >= 0) ? 1 : 0;

	return ret;
}
Beispiel #3
0
static int has_prometheus_module(VirtualPBP *vpbp)
{
    int ret;
    u32 size, lba;

    ret = isoOpen(vpbp->name);

    if (ret < 0) {
        return 0;
    }

    ret = isoGetFileInfo("/PSP_GAME/SYSDIR/EBOOT.OLD", &size, &lba);
    ret = (ret >= 0) ? 1 : 0;

    isoClose();

    return ret;
}
Beispiel #4
0
static int build_vpbp(VirtualPBP *vpbp)
{
    int ret, i;
    u32 off;

    printk("Need to build vpbp %s\n", vpbp->name);
    memset(vpbp->header, 0, sizeof(vpbp->header));
    memset(vpbp->sects, 0, sizeof(vpbp->sects));
    vpbp->enabled = 1;
    vpbp->file_pointer = 0;
    vpbp->header[0] = 0x50425000; // PBP magic
    vpbp->header[1] = 0x10000; // version

    // fill vpbp offsets
    off = 0x28;

    ret = isoOpen(vpbp->name);

    if (ret < 0) {
        printk("%s: isoOpen -> %d\n", __func__, ret);
        ret = add_cache(vpbp);

        return ret;
    }

    for(i=0; i<NELEMS(pbp_entries); ++i) {
        vpbp->header[i+2] = off;

        if (pbp_entries[i].enabled) {
            PBPSection *sec = &vpbp->sects[i];

            ret = isoGetFileInfo(pbp_entries[i].name, &sec->size, &sec->lba);

            if (ret < 0) {
                if (i == 0) {
                    // no PARAM.SFO?
                    // then it's a bad ISO
                    isoClose();

                    return -36;
                } else {
                    continue;
                }
            }

            if (i == 0) {
                off += sizeof(virtualsfo);
            } else {
                off += sec->size;
            }
        }
    }

    vpbp->pbp_total_size = vpbp->header[9];
    get_iso_file_size(vpbp->name, &vpbp->iso_total_size);
    ret = add_cache(vpbp);
    printk("%s: add_cache -> %d\n", __func__, ret);
    isoClose();

    return ret;
}