mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
CDImageCue: Work around broken (old) dumps with missing pregap
Some people have broken (older) dumps where a two second pregap was implicit but not specified in the cuesheet. The problem is we can't tell between a missing implicit two second pregap and a zero second pregap.
This commit is contained in:
parent
fb5e7cc8b1
commit
2219b9aa66
|
@ -129,10 +129,15 @@ bool CDImageCueSheet::OpenAndParse(const char* filename)
|
||||||
track_length = file_size - track_start;
|
track_length = file_size - track_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
// two seconds pregap for track 1 is assumed if not specified
|
// Two seconds pregap for track 1 is assumed if not specified.
|
||||||
|
// Some people have broken (older) dumps where a two second pregap was implicit but not specified in the cuesheet.
|
||||||
|
// The problem is we can't tell between a missing implicit two second pregap and a zero second pregap. Most of these
|
||||||
|
// seem to be a single bin file for all tracks. So if this is the case, we add the two seconds in if it's not
|
||||||
|
// specified.
|
||||||
long pregap_frames = track_get_zero_pre(track);
|
long pregap_frames = track_get_zero_pre(track);
|
||||||
bool pregap_in_file = pregap_frames > 0 && track_start >= pregap_frames;
|
const bool pregap_in_file = pregap_frames > 0 && track_start >= pregap_frames;
|
||||||
if (track_num == 1 && pregap_frames < 0)
|
const bool is_multi_track_bin = (track_num > 1 && track_file_index == m_indices[0].file_index);
|
||||||
|
if ((track_num == 1 || is_multi_track_bin) && pregap_frames < 0)
|
||||||
pregap_frames = 2 * FRAMES_PER_SECOND;
|
pregap_frames = 2 * FRAMES_PER_SECOND;
|
||||||
|
|
||||||
// create the index for the pregap
|
// create the index for the pregap
|
||||||
|
|
Loading…
Reference in a new issue