Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions UnityPy/files/BundleFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,12 @@ def read_fs(self, reader: EndianBinaryReader):
if self.dataflags & self.dataflags.UsesAssetBundleEncryption:
self.decryptor = ArchiveStorageManager.ArchiveStorageDecryptor(reader)

# check if we need to align the reader
# - align to 16 bytes and check if all are 0
# - if not, reset the reader to the previous position
if self.version >= 7:
# if header version is 7 or later we need to align the reader
# for 2019.4.15 and later, version should be 7 and aligned
# but some games in these versions somehow has version 6 while aligned
if self.version >= 7 or (version[0] == 2019 and version >= (2019, 4, 15)):
reader.align_stream(16)
self._uses_block_alignment = True
elif version >= (2019, 4):
pre_align = reader.Position
align_data = reader.read((16 - pre_align % 16) % 16)
if any(align_data):
reader.Position = pre_align
else:
self._uses_block_alignment = True

start = reader.Position
if self.dataflags & ArchiveFlags.BlocksInfoAtTheEnd: # kArchiveBlocksInfoAtTheEnd
Expand Down
Loading