- psar_sig[8] = 0;
- if (strcmp(psar_sig, "PSISOIMG") != 0) {
- fprintf(stderr, "bad psar_sig: %s\n", psar_sig);
+ psar_sig[10] = 0;
+ if (strcmp(psar_sig, "PSTITLEIMG") == 0) {
+ // multidisk image?
+ ret = fseek(cdHandle, pbp_hdr.psar_offs + 0x200, SEEK_SET);
+ if (ret != 0) {
+ SysPrintf("failed to seek to %x\n", pbp_hdr.psar_offs + 0x200);
+ goto fail_io;
+ }
+
+ if (fread(&offsettab, 1, sizeof(offsettab), cdHandle) != sizeof(offsettab)) {
+ SysPrintf("failed to read offsettab\n");
+ goto fail_io;
+ }
+
+ for (i = 0; i < sizeof(offsettab) / sizeof(offsettab[0]); i++) {
+ if (offsettab[i] == 0)
+ break;
+ }
+ cdrIsoMultidiskCount = i;
+ if (cdrIsoMultidiskCount == 0) {
+ SysPrintf("multidisk eboot has 0 images?\n");
+ goto fail_io;
+ }
+
+ if (cdrIsoMultidiskSelect >= cdrIsoMultidiskCount)
+ cdrIsoMultidiskSelect = 0;
+
+ psisoimg_offs += offsettab[cdrIsoMultidiskSelect];
+
+ ret = fseek(cdHandle, psisoimg_offs, SEEK_SET);
+ if (ret != 0) {
+ SysPrintf("failed to seek to %x\n", psisoimg_offs);
+ goto fail_io;
+ }
+
+ fread(psar_sig, 1, sizeof(psar_sig), cdHandle);
+ psar_sig[10] = 0;
+ }
+
+ if (strcmp(psar_sig, "PSISOIMG00") != 0) {
+ SysPrintf("bad psar_sig: %s\n", psar_sig);