X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fcdriso.c;h=d42132274b720b827fb70b4e8de5dc6649329334;hb=f4a0ef36c9f6e32a5d791dcee71a23b004378bfd;hp=974bafec174035ab64f7a5aa7c217993941c0bfd;hpb=58cb143834f29332a539e519e80d928bbb747225;p=pcsx_rearmed.git diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 974bafec..d4213227 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -942,6 +942,9 @@ fail_io: #ifdef HAVE_CHD static int handlechd(const char *isofile) { + int frame_offset = 150; + int file_offset = 0; + chd_img = calloc(1, sizeof(*chd_img)); if (chd_img == NULL) goto fail_io; @@ -964,8 +967,6 @@ static int handlechd(const char *isofile) { cddaBigEndian = TRUE; numtracks = 0; - int frame_offset = 0; - int file_offset = 0; memset(ti, 0, sizeof(ti)); while (1) @@ -993,25 +994,23 @@ static int handlechd(const char *isofile) { SysPrintf("chd: %s\n", meta); if (md.track == 1) { - md.pregap = 150; if (!strncmp(md.subtype, "RW", 2)) { subChanMixed = TRUE; if (!strcmp(md.subtype, "RW_RAW")) subChanRaw = TRUE; } } - else - sec2msf(msf2sec(ti[md.track-1].length) + md.pregap, ti[md.track-1].length); ti[md.track].type = !strncmp(md.type, "AUDIO", 5) ? CDDA : DATA; sec2msf(frame_offset + md.pregap, ti[md.track].start); sec2msf(md.frames, ti[md.track].length); - ti[md.track].start_offset = file_offset; + ti[md.track].start_offset = file_offset + md.pregap; - frame_offset += md.pregap + md.frames + md.postgap; - file_offset += md.frames + md.postgap; + // XXX: what about postgap? + frame_offset += md.frames; + file_offset += md.frames; numtracks++; } @@ -1813,7 +1812,7 @@ static boolean CALLBACK ISOreadTrack(unsigned char *time) { fseek(subHandle, sector * SUB_FRAMESIZE, SEEK_SET); if (fread(subbuffer, 1, SUB_FRAMESIZE, subHandle) != SUB_FRAMESIZE) /* Faulty subchannel data shouldn't cause a read failure */ - return 0; + return 1; if (subChanRaw) DecodeRawSubData(); } @@ -1824,7 +1823,7 @@ static boolean CALLBACK ISOreadTrack(unsigned char *time) { // plays cdda audio // sector: byte 0 - minute; byte 1 - second; byte 2 - frame // does NOT uses bcd format -static long CALLBACK ISOplay(void) { +static long CALLBACK ISOplay(unsigned char *time) { playing = TRUE; return 0; }