Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #8947 from JosJuice/rvz-split-seed-read
RVZ: Fix split seed reads
  • Loading branch information
lioncash committed Jul 11, 2020
2 parents 5286fb2 + f7c32bc commit 41a570c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Source/Core/DiscIO/WIACompression.cpp
Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit 41a570c

Please sign in to comment.