diff options
| author | JosJuice <josjuice@gmail.com> | 2017-01-21 21:50:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-21 21:50:56 +0100 |
| commit | c4710ec7fae26d38ab56398cbeadca608095fd42 (patch) | |
| tree | e51c2f7595797d8ed94c6a9b2940852fa391b078 /Source/Core/DiscIO/CompressedBlob.cpp | |
| parent | 9fb01ecc730a9fdf9d053b270ac4bd17ed937446 (diff) | |
| parent | 07d1f18f5398d08149ded6a89028ce7953749bd3 (diff) | |
Merge pull request #4702 from BhaaLseN/fix-compress
Fix GCZ compression missing the header
Diffstat (limited to 'Source/Core/DiscIO/CompressedBlob.cpp')
| -rw-r--r-- | Source/Core/DiscIO/CompressedBlob.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index 0cf8dbc5b3..7c89121278 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -216,6 +216,8 @@ bool CompressFileToBlob(const std::string& infile_path, const std::string& outfi outfile.Seek(sizeof(CompressedBlobHeader), SEEK_CUR); // seek past the offset and hash tables (we will write them at the end) outfile.Seek((sizeof(u64) + sizeof(u32)) * header.num_blocks, SEEK_CUR); + // seek to the start of the input file to make sure we get everything + infile.Seek(0, SEEK_SET); // Now we are ready to write compressed data! u64 position = 0; @@ -405,13 +407,18 @@ bool DecompressBlobToFile(const std::string& infile_path, const std::string& out outfile.Resize(header.data_size); } - return true; + return success; } bool IsGCZBlob(File::IOFile& file) { + const u64 position = file.Tell(); + if (!file.Seek(0, SEEK_SET)) + return false; CompressedBlobHeader header; - return file.Seek(0, SEEK_SET) && file.ReadArray(&header, 1) && header.magic_cookie == GCZ_MAGIC; + bool is_gcz = file.ReadArray(&header, 1) && header.magic_cookie == GCZ_MAGIC; + file.Seek(position, SEEK_SET); + return is_gcz; } } // namespace |
