@@ -135,14 +135,36 @@ public static int ExtractFile(string fileName, string savePath)
135
135
private static int ExtractBundleFile ( FileReader reader , string savePath )
136
136
{
137
137
Logger . Info ( $ "Decompressing { reader . FileName } ...") ;
138
- var bundleFile = new BundleFile ( reader , assetsManager . ZstdEnabled , assetsManager . SpecifyUnityVersion ) ;
139
- reader . Dispose ( ) ;
138
+
139
+ Logger . Debug ( $ "Bundle offset: { reader . Position } ") ;
140
+ var count = 0 ;
141
+ var bundleStream = new OffsetStream ( reader ) ;
142
+ var bundleReader = new FileReader ( reader . FullPath , bundleStream ) ;
143
+ var bundleFile = new BundleFile ( bundleReader , assetsManager . ZstdEnabled , assetsManager . SpecifyUnityVersion ) ;
144
+ var extractPath = Path . Combine ( savePath , reader . FileName + "_unpacked" ) ;
140
145
if ( bundleFile . fileList . Length > 0 )
141
146
{
142
- var extractPath = Path . Combine ( savePath , reader . FileName + "_unpacked" ) ;
143
- return ExtractStreamFile ( extractPath , bundleFile . fileList ) ;
147
+ count += ExtractStreamFile ( extractPath , bundleFile . fileList ) ;
144
148
}
145
- return 0 ;
149
+ while ( bundleFile . IsMultiBundle )
150
+ {
151
+ bundleStream . Offset = reader . Position ;
152
+ bundleReader = new FileReader ( $ "{ reader . FullPath } _0x{ bundleStream . Offset : X} ", bundleStream ) ;
153
+ if ( bundleReader . Position > 0 )
154
+ {
155
+ bundleStream . Offset += bundleReader . Position ;
156
+ bundleReader . FullPath = $ "{ reader . FullPath } _0x{ bundleStream . Offset : X} ";
157
+ bundleReader . FileName = $ "{ reader . FileName } _0x{ bundleStream . Offset : X} ";
158
+ }
159
+ Logger . Info ( $ "[MultiBundle] Decompressing \" { reader . FileName } \" from offset: 0x{ bundleStream . Offset : X} ..") ;
160
+ bundleFile = new BundleFile ( bundleReader , assetsManager . ZstdEnabled , assetsManager . SpecifyUnityVersion ) ;
161
+ if ( bundleFile . fileList . Length > 0 )
162
+ {
163
+ count += ExtractStreamFile ( extractPath , bundleFile . fileList ) ;
164
+ }
165
+ }
166
+ bundleStream . Dispose ( ) ;
167
+ return count ;
146
168
}
147
169
148
170
private static int ExtractWebDataFile ( FileReader reader , string savePath )
0 commit comments