mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
SectorReader: Fix reading the last block of the disc.
Regression from PR #3795.
This commit is contained in:
@ -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
|
// 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.
|
// 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)
|
if (end_block)
|
||||||
cnt_blocks = static_cast<u32>(std::min<u64>(m_chunk_blocks, end_block - block_num));
|
cnt_blocks = static_cast<u32>(std::min<u64>(m_chunk_blocks, end_block - block_num));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user