Skip to content

Commit 5aa855a

Browse files
fix align check for 2019.4.x (#364)
* specific version check of header _uses_block_alignment
1 parent f364583 commit 5aa855a

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

UnityPy/files/BundleFile.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,12 @@ def read_fs(self, reader: EndianBinaryReader):
123123
if self.dataflags & self.dataflags.UsesAssetBundleEncryption:
124124
self.decryptor = ArchiveStorageManager.ArchiveStorageDecryptor(reader)
125125

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

140133
start = reader.Position
141134
if self.dataflags & ArchiveFlags.BlocksInfoAtTheEnd: # kArchiveBlocksInfoAtTheEnd

0 commit comments

Comments
 (0)