From 16efffa403118ff72cef095d2aaf02e59eb5613b Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 23 May 2021 20:42:49 +1000 Subject: [PATCH] CueParser: Ignore pregap when index 0 is specified Also corrects the previous track length when index 0 is specified. --- src/common/cue_parser.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/cue_parser.cpp b/src/common/cue_parser.cpp index 7bea694b0..acfa2faef 100644 --- a/src/common/cue_parser.cpp +++ b/src/common/cue_parser.cpp @@ -452,7 +452,12 @@ bool File::SetTrackLengths(u32 line_number, Common::Error* error) return false; } - previous_track->length = MSF::FromLBA(track.start.ToLBA() - previous_track->start.ToLBA()); + // Use index 0, otherwise index 1. + const MSF* start_index = track.GetIndex(0); + if (!start_index) + start_index = track.GetIndex(1); + + previous_track->length = MSF::FromLBA(start_index->ToLBA() - previous_track->start.ToLBA()); } } }