From: Toni Wilen Date: Sat, 23 Aug 2025 17:45:31 +0000 (+0300) Subject: Support broken cue files with "TRACK 0" instead of "TRACK 01". X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=8f84c46be35a8be1029b1b6050a7306690d0deec;p=francis%2Fwinuae.git Support broken cue files with "TRACK 0" instead of "TRACK 01". --- diff --git a/blkdev_cdimage.cpp b/blkdev_cdimage.cpp index 9facba50..76aa985a 100644 --- a/blkdev_cdimage.cpp +++ b/blkdev_cdimage.cpp @@ -1738,7 +1738,13 @@ static int parsecue (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img, c index0 = -1; lastpregap = 0; lastpostgap = 0; + skipspace(&p); + TCHAR *pt = p; tracknum = _tstoi (nextstring (&p)); + // fix broken "TRACK 0" + if (tracknum == 0 && pt[0] == '0' && pt[1] == 0 && cdu->tracks == 0) { + tracknum = 1; + } tracktype = nextstring (&p); if (!tracktype) break; @@ -1765,7 +1771,9 @@ static int parsecue (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img, c if (tracknum > 1 && newfile) { t--; - secoffset += (int)(t->filesize / t->size); + if (t->size) { + secoffset += (int)(t->filesize / t->size); + } t++; }