From 6f358ebf8fc79fb944a12d8e5c8bcc151502f7c6 Mon Sep 17 00:00:00 2001 From: "Christoph \"baka0815\" Schwerdtfeger" Date: Tue, 30 Oct 2018 20:38:19 +0100 Subject: [PATCH] CHD: Only pad when version >= 5 --- core/imgread/chd.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/imgread/chd.cpp b/core/imgread/chd.cpp index 47e176c0c..f8fa8ee6f 100644 --- a/core/imgread/chd.cpp +++ b/core/imgread/chd.cpp @@ -158,8 +158,11 @@ bool CHDDisc::TryOpen(const wchar* file) t.ADDR = 0; t.CTRL = strcmp(type,"AUDIO") == 0 ? 0 : 4; t.file = new CHDTrack(this, t.StartFAD, total_hunks, strcmp(type,"MODE1") ? 2352 : 2048, extraframes); - int padded = (frames + CD_TRACK_PADDING - 1) / CD_TRACK_PADDING; - extraframes += (padded * CD_TRACK_PADDING) - frames; + if (head->version >= 5) + { + int padded = (frames + CD_TRACK_PADDING - 1) / CD_TRACK_PADDING; + extraframes += (padded * CD_TRACK_PADDING) - frames; + } total_hunks += frames / sph; if (frames % sph)