summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2020-07-11 17:27:19 +0200
committerJosJuice <josjuice@gmail.com>2020-07-11 17:45:16 +0200
commitf7c32bc04e2a410447fdf431ea838b7bfa84ff4f (patch)
tree6da1fd29253a51f7c26b0d02f2a24d825f0555be /Source/Core/DiscIO
parent5286fb26575d2153089ba54f1765dd39d8a4b6d2 (diff)
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.
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/WIACompression.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/Core/DiscIO/WIACompression.cpp b/Source/Core/DiscIO/WIACompression.cpp
index d6d3acae2b..20d19c4877 100644
--- a/Source/Core/DiscIO/WIACompression.cpp
+++ b/Source/Core/DiscIO/WIACompression.cpp
@@ -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);