diff options
| author | JosJuice <josjuice@gmail.com> | 2020-01-25 19:41:58 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2020-01-25 20:21:12 +0100 |
| commit | de26fec0af2d3bfebc45691ddab639d99757b0a8 (patch) | |
| tree | 8fe5dafb8b738d70f3cb0b81d0c87b23d14c6947 /Source/Core/DiscIO/VolumeVerifier.cpp | |
| parent | ea9b96370df89b446ed25fca5452f0eef33682a9 (diff) | |
VolumeVerifier: Report read errors to the user
Diffstat (limited to 'Source/Core/DiscIO/VolumeVerifier.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeVerifier.cpp | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index b6b7ea4901..b868861fd1 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -1114,36 +1114,38 @@ void VolumeVerifier::Process() const bool is_data_needed = m_calculating_any_hash || content_read || block_read; const bool read_succeeded = is_data_needed && ReadChunkAndWaitForAsyncOperations(bytes_to_read); + if (!read_succeeded) + { + ERROR_LOG(DISCIO, "Read failed at 0x%" PRIx64 " to 0x%" PRIx64, m_progress, + m_progress + bytes_to_read); + + m_read_errors_occurred = true; + m_calculating_any_hash = false; + } + if (m_calculating_any_hash) { - if (!read_succeeded) + if (m_hashes_to_calculate.crc32) { - m_calculating_any_hash = false; + m_crc32_future = std::async(std::launch::async, [this] { + // It would be nice to use crc32_z here instead of crc32, but it isn't available on Android + m_crc32_context = + crc32(m_crc32_context, m_data.data(), static_cast<unsigned int>(m_data.size())); + }); } - else - { - if (m_hashes_to_calculate.crc32) - { - m_crc32_future = std::async(std::launch::async, [this] { - // Would be nice to use crc32_z here instead of crc32, but it isn't available on Android - m_crc32_context = - crc32(m_crc32_context, m_data.data(), static_cast<unsigned int>(m_data.size())); - }); - } - if (m_hashes_to_calculate.md5) - { - m_md5_future = std::async(std::launch::async, [this] { - mbedtls_md5_update_ret(&m_md5_context, m_data.data(), m_data.size()); - }); - } + if (m_hashes_to_calculate.md5) + { + m_md5_future = std::async(std::launch::async, [this] { + mbedtls_md5_update_ret(&m_md5_context, m_data.data(), m_data.size()); + }); + } - if (m_hashes_to_calculate.sha1) - { - m_sha1_future = std::async(std::launch::async, [this] { - mbedtls_sha1_update_ret(&m_sha1_context, m_data.data(), m_data.size()); - }); - } + if (m_hashes_to_calculate.sha1) + { + m_sha1_future = std::async(std::launch::async, [this] { + mbedtls_sha1_update_ret(&m_sha1_context, m_data.data(), m_data.size()); + }); } } @@ -1262,6 +1264,9 @@ void VolumeVerifier::Finish() } } + if (m_read_errors_occurred) + AddProblem(Severity::Medium, Common::GetStringT("Some of the data could not be read.")); + if (IsDisc(m_volume.GetVolumeType()) && (m_volume.IsSizeAccurate() || m_volume.SupportsIntegrityCheck())) { |
