mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
RVZ: Fix split seed reads
This could cause read errors if chunks were laid out a certain way in the file and the whole chunk wasn't being read at once. Should fix https://bugs.dolphin-emu.org/issues/12184.
This commit is contained in:
@ -350,13 +350,11 @@ bool RVZPackDecompressor::Decompress(const DecompressionBuffer& in, Decompressio
|
|||||||
if (result)
|
if (result)
|
||||||
return *result;
|
return *result;
|
||||||
|
|
||||||
m_size = Common::swap32(m_decompressed.data.data() + m_decompressed_bytes_read);
|
const u32 size = Common::swap32(m_decompressed.data.data() + m_decompressed_bytes_read);
|
||||||
|
|
||||||
m_junk = m_size & 0x80000000;
|
m_junk = size & 0x80000000;
|
||||||
if (m_junk)
|
if (m_junk)
|
||||||
{
|
{
|
||||||
m_size &= 0x7FFFFFFF;
|
|
||||||
|
|
||||||
constexpr size_t SEED_SIZE = LaggedFibonacciGenerator::SEED_SIZE * sizeof(u32);
|
constexpr size_t SEED_SIZE = LaggedFibonacciGenerator::SEED_SIZE * sizeof(u32);
|
||||||
constexpr size_t BLOCK_SIZE = 0x8000;
|
constexpr size_t BLOCK_SIZE = 0x8000;
|
||||||
|
|
||||||
@ -372,6 +370,7 @@ bool RVZPackDecompressor::Decompress(const DecompressionBuffer& in, Decompressio
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_decompressed_bytes_read += sizeof(u32);
|
m_decompressed_bytes_read += sizeof(u32);
|
||||||
|
m_size = size & 0x7FFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t bytes_to_write = std::min<size_t>(m_size, out->data.size() - out->bytes_written);
|
size_t bytes_to_write = std::min<size_t>(m_size, out->data.size() - out->bytes_written);
|
||||||
|
Reference in New Issue
Block a user