Merge pull request #8947 from JosJuice/rvz-split-seed-read

RVZ: Fix split seed reads
This commit is contained in:
LC 2020-07-11 11:53:47 -04:00 committed by GitHub
commit 41a570c74e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -350,13 +350,11 @@ bool RVZPackDecompressor::Decompress(const DecompressionBuffer& in, Decompressio
if (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)
{
m_size &= 0x7FFFFFFF;
constexpr size_t SEED_SIZE = LaggedFibonacciGenerator::SEED_SIZE * sizeof(u32);
constexpr size_t BLOCK_SIZE = 0x8000;
@ -372,6 +370,7 @@ bool RVZPackDecompressor::Decompress(const DecompressionBuffer& in, Decompressio
}
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);