From 38c1018ab286c4a46fa59a70c65eec89b593c25a Mon Sep 17 00:00:00 2001 From: AXiX_Official Date: Sat, 14 Feb 2026 21:46:01 +0800 Subject: [PATCH 1/2] specific version check of header _uses_block_alignment --- UnityPy/files/BundleFile.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/UnityPy/files/BundleFile.py b/UnityPy/files/BundleFile.py index 8f6eb901..3867e23c 100644 --- a/UnityPy/files/BundleFile.py +++ b/UnityPy/files/BundleFile.py @@ -116,19 +116,15 @@ 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 From 3616e65e14156a4b78c4353a0775ea7d5096b084 Mon Sep 17 00:00:00 2001 From: AXiX_Official Date: Sat, 14 Feb 2026 21:51:54 +0800 Subject: [PATCH 2/2] format --- UnityPy/files/BundleFile.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/UnityPy/files/BundleFile.py b/UnityPy/files/BundleFile.py index 3867e23c..eb742c7e 100644 --- a/UnityPy/files/BundleFile.py +++ b/UnityPy/files/BundleFile.py @@ -119,10 +119,7 @@ def read_fs(self, reader: EndianBinaryReader): # 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)) - ): + if self.version >= 7 or (version[0] == 2019 and version >= (2019, 4, 15)): reader.align_stream(16) self._uses_block_alignment = True