From a324366be91fb9f7dc1f2b19a2f92183a6641b63 Mon Sep 17 00:00:00 2001 From: Perfare Date: Sat, 21 May 2022 17:24:54 +0800 Subject: [PATCH] BundleFile fix --- AssetStudio/BundleFile.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AssetStudio/BundleFile.cs b/AssetStudio/BundleFile.cs index 3352ea7..48c85d2 100644 --- a/AssetStudio/BundleFile.cs +++ b/AssetStudio/BundleFile.cs @@ -208,6 +208,7 @@ namespace AssetStudio { reader.AlignStream(16); } + var start = reader.Position; if ((m_Header.flags & 0x80) != 0) //kArchiveBlocksInfoAtTheEnd { var position = reader.Position; @@ -279,6 +280,10 @@ namespace AssetStudio }; } } + //https://issuetracker.unity3d.com/issues/files-within-assetbundles-do-not-start-on-aligned-boundaries-breaking-patching-on-nintendo-switch + var blockSize = m_BlocksInfo.Sum(x => x.compressedSize); + var padding = reader.BaseStream.Length - start - m_Header.compressedBlocksInfoSize - blockSize; + reader.Position += padding; } private void ReadBlocks(EndianBinaryReader reader, Stream blocksStream)