- [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);
switch (subReader.FileType)
{
case FileType.ENCRFile:
case FileType.BundleFile:
LoadBundleFile(subReader, reader.FullPath, offset, false);
break;

View File

@@ -38,7 +38,6 @@ namespace AssetStudio
Logger.Verbose($"Parsed signature is {signature}");
switch (signature)
{
case "ENCR":
case "UnityWeb":
case "UnityRaw":
case "UnityArchive":
@@ -48,6 +47,8 @@ namespace AssetStudio
return FileType.WebFile;
case "blk":
return FileType.BlkFile;
case "ENCR":
return FileType.ENCRFile;
default:
{
Logger.Verbose("signature does not match any of the supported string signatures, attempting to check bytes signatures");
@@ -201,7 +202,7 @@ namespace AssetStudio
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 !!");
try
@@ -211,9 +212,9 @@ namespace AssetStudio
reader.ReadStringToNull();
reader.ReadStringToNull();
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 !!");
reader.FileType = FileType.BlockFile;
}

View File

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

View File

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