- [Core] fix bug with parsing bundles [SR]

This commit is contained in:
Razmoth
2023-09-19 18:32:16 +04:00
parent 4fcc549f99
commit 2e3dcdc5d9
4 changed files with 8 additions and 4 deletions

View File

@@ -441,6 +441,7 @@ namespace AssetStudio
var subReader = new FileReader(dummyPath, stream, true); var subReader = new FileReader(dummyPath, stream, true);
switch (subReader.FileType) switch (subReader.FileType)
{ {
case FileType.ENCRFile:
case FileType.BundleFile: case FileType.BundleFile:
LoadBundleFile(subReader, reader.FullPath, offset, false); LoadBundleFile(subReader, reader.FullPath, offset, false);
break; break;

View File

@@ -38,7 +38,6 @@ namespace AssetStudio
Logger.Verbose($"Parsed signature is {signature}"); Logger.Verbose($"Parsed signature is {signature}");
switch (signature) switch (signature)
{ {
case "ENCR":
case "UnityWeb": case "UnityWeb":
case "UnityRaw": case "UnityRaw":
case "UnityArchive": case "UnityArchive":
@@ -48,6 +47,8 @@ namespace AssetStudio
return FileType.WebFile; return FileType.WebFile;
case "blk": case "blk":
return FileType.BlkFile; return FileType.BlkFile;
case "ENCR":
return FileType.ENCRFile;
default: default:
{ {
Logger.Verbose("signature does not match any of the supported string signatures, attempting to check bytes signatures"); Logger.Verbose("signature does not match any of the supported string signatures, attempting to check bytes signatures");
@@ -201,7 +202,7 @@ namespace AssetStudio
break; break;
} }
} }
if (reader.FileType == FileType.BundleFile && game.Type.IsBlockFile() || reader.FileType == FileType.BlbFile) if (reader.FileType == FileType.BundleFile && game.Type.IsBlockFile() || reader.FileType == FileType.ENCRFile || reader.FileType == FileType.BlbFile)
{ {
Logger.Verbose("File might have multiple bundles !!"); Logger.Verbose("File might have multiple bundles !!");
try try
@@ -211,9 +212,9 @@ namespace AssetStudio
reader.ReadStringToNull(); reader.ReadStringToNull();
reader.ReadStringToNull(); reader.ReadStringToNull();
var size = reader.ReadInt64(); var size = reader.ReadInt64();
if (!(signature == "UnityFS" && size == reader.BaseStream.Length)) if (size != reader.BaseStream.Length)
{ {
Logger.Verbose($"Found signature UnityFS, expected bundle size is 0x{size:X8}, found 0x{reader.BaseStream.Length} instead !!"); Logger.Verbose($"Found signature {signature}, expected bundle size is 0x{size:X8}, found 0x{reader.BaseStream.Length} instead !!");
Logger.Verbose("Loading as block file !!"); Logger.Verbose("Loading as block file !!");
reader.FileType = FileType.BlockFile; reader.FileType = FileType.BlockFile;
} }

View File

@@ -18,6 +18,7 @@ namespace AssetStudio
BlkFile, BlkFile,
Mhy0File, Mhy0File,
BlbFile, BlbFile,
ENCRFile,
BlockFile BlockFile
} }
} }

View File

@@ -86,6 +86,7 @@ namespace AssetStudio
FileType.BundleFile => "UnityFS\x00", FileType.BundleFile => "UnityFS\x00",
FileType.BlbFile => "Blb\x02", FileType.BlbFile => "Blb\x02",
FileType.Mhy0File => "mhy0", FileType.Mhy0File => "mhy0",
FileType.ENCRFile => "ENCR\x00",
_ => throw new InvalidOperationException() _ => throw new InvalidOperationException()
}; };