From f314c2a4d9a0ab349c0357b692312c137e2e6ac6 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Mon, 17 Oct 2016 02:00:44 +0100 Subject: [PATCH] cdvdgigaherz: Simplify Q subchannel relative offset calculation That way there's no need to calculate the track length for each track. --- plugins/cdvdGigaherz/src/CDVD.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/plugins/cdvdGigaherz/src/CDVD.cpp b/plugins/cdvdGigaherz/src/CDVD.cpp index 4b2e591342..3d9fe1bc5b 100644 --- a/plugins/cdvdGigaherz/src/CDVD.cpp +++ b/plugins/cdvdGigaherz/src/CDVD.cpp @@ -352,15 +352,10 @@ s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ *subq) lsn_to_msf(&subq->discM, &subq->discS, &subq->discF, lsn + 150); u8 i = strack; - while (i <= etrack) { - if (lsn <= tracks[i].length) - break; - lsn -= tracks[i].length; - i++; - } + while (i < etrack && lsn < tracks[i + 1].start_lba) + ++i; - if (i > etrack) - i = etrack; + lsn -= tracks[i].start_lba; lsn_to_msf(&subq->trackM, &subq->trackS, &subq->trackF, lsn);