From e38ee512f3a06a8ede3d8b32e5b2df6c5ebb29a3 Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 22 Oct 2021 00:36:51 +0200 Subject: [PATCH] Fix progress bar not starting from 0 when verifying the data track --- src/common/cd_image_hasher.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/common/cd_image_hasher.cpp b/src/common/cd_image_hasher.cpp index af652cf7a..69c6c6d95 100644 --- a/src/common/cd_image_hasher.cpp +++ b/src/common/cd_image_hasher.cpp @@ -46,15 +46,19 @@ static bool ReadTrack(CDImage* image, u8 track, MD5Digest* digest, ProgressCallb progress_callback->PushState(); - progress_callback->SetProgressRange(2); + const bool dataTrack = track == 1; + progress_callback->SetProgressRange(dataTrack ? 1 : 2); + + u8 progress = 0; for (u8 index = 0; index < INDICES_TO_READ; index++) { - progress_callback->SetProgressValue(index); + progress_callback->SetProgressValue(progress); // skip index 0 if data track - if (track == 1 && index == 0) + if (dataTrack && index == 0) continue; + progress++; progress_callback->PushState(); if (!ReadIndex(image, track, index, digest, progress_callback)) { @@ -66,7 +70,7 @@ static bool ReadTrack(CDImage* image, u8 track, MD5Digest* digest, ProgressCallb progress_callback->PopState(); } - progress_callback->SetProgressValue(INDICES_TO_READ); + progress_callback->SetProgressValue(progress); progress_callback->PopState(); return true; }