mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 14:05:57 +00:00
Skip stored padding in raw NCZBLOCK blocks
This commit is contained in:
1 parent
afae80c908
commit
4ef0e2bd4a
2 files changed
+35
-1
No files matched your search
+3
-1
@@ -126,7 +126,9 @@ def blocks(f, pos, end, total):
|
||||
for i, length in enumerate(stored):
|
||||
plain = min(1 << exponent, size - (i << exponent))
|
||||
require(pos + length <= end, 'Truncated NCZ block')
|
||||
data = read_at(f, pos, length)
|
||||
# nsz's BlockDecompressorReader.py __decompressBlock skips padding in a raw block: only plain bytes belong
|
||||
# to the NCA, while the full stored length locates the next block.
|
||||
data = read_at(f, pos, min(length, plain))
|
||||
pos += length
|
||||
yield zstd.decompress(data) if length < plain else data
|
||||
|
||||
|
||||
Reference in new issue
Block a user