From 0d281538cf04106abbdd1efd838060e1b94b9a8c Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 2 Jan 2021 01:33:11 +1000 Subject: [PATCH] CDImageCue: Disable implicit pregap insertion for audio CDs Fixes supplementary disc detection in Dancing Stage featuring DREAMS COME TRUE. --- src/common/cd_image_cue.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/cd_image_cue.cpp b/src/common/cd_image_cue.cpp index a893bc4ec..4f12d5be2 100644 --- a/src/common/cd_image_cue.cpp +++ b/src/common/cd_image_cue.cpp @@ -153,11 +153,13 @@ bool CDImageCueSheet::OpenAndParse(const char* filename) // 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. + // specified. If this is an audio CD (likely when track 1 is not data), we don't add these pregaps, and rely on the + // cuesheet. If we did add them, it causes issues in some games (e.g. Dancing Stage featuring DREAMS COME TRUE). long pregap_frames = track_get_zero_pre(track); const bool pregap_in_file = pregap_frames > 0 && track_start >= pregap_frames; 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) + const bool likely_audio_cd = static_cast(track_get_mode(cd_get_track(m_cd, 1))) == TrackMode::Audio; + if ((track_num == 1 || is_multi_track_bin) && pregap_frames < 0 && (track_num == 1 || !likely_audio_cd)) pregap_frames = 2 * FRAMES_PER_SECOND; // create the index for the pregap