Fix progress bar not starting from 0 when verifying the data track

This commit is contained in:
Silent 2021-10-22 00:36:51 +02:00
parent 764c6e4a72
commit e38ee512f3
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1

View file

@ -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;
}