Skip to content

Commit 3ee1a54

Browse files
committed
specific version check of header _uses_block_alignment
1 parent 2e8a79c commit 3ee1a54

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

UnityPy/files/BundleFile.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,13 @@ def read_fs(self, reader: EndianBinaryReader):
116116
if self.dataflags & self.dataflags.UsesAssetBundleEncryption:
117117
self.decryptor = ArchiveStorageManager.ArchiveStorageDecryptor(reader)
118118

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

133127
start = reader.Position
134128
if self.dataflags & ArchiveFlags.BlocksInfoAtTheEnd: # kArchiveBlocksInfoAtTheEnd

0 commit comments

Comments
 (0)