From c4240692b6271cd3c8a93e8fa147df67df3e32fa Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 29 May 2016 17:55:34 +0200 Subject: [PATCH] SectorReader: Fix reading the last block of the disc. Regression from PR #3795. --- Source/Core/DiscIO/Blob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp index 19bd9faf7d..0b726c3ffb 100644 --- a/Source/Core/DiscIO/Blob.cpp +++ b/Source/Core/DiscIO/Blob.cpp @@ -141,7 +141,7 @@ u32 SectorReader::ReadChunk(u8* buffer, u64 chunk_num) // If we are reading the end of a disk, there may not be enough blocks to // read a whole chunk. We need to clamp down in that case. - u64 end_block = GetDataSize() / m_block_size; + u64 end_block = (GetDataSize() + m_block_size - 1) / m_block_size; if (end_block) cnt_blocks = static_cast(std::min(m_chunk_blocks, end_block - block_num));