From a90d3ee9b0b54fe7dcd09683ae7094382ea8a0b3 Mon Sep 17 00:00:00 2001 From: morkt Date: Sun, 28 Jan 2018 10:15:34 +0400 Subject: [PATCH] (Unity): fixed compressed segments detection. better recognize image entries. --- ArcFormats/Unity/ArcASSET.cs | 2 ++ ArcFormats/Unity/ArcUnityFS.cs | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ArcFormats/Unity/ArcASSET.cs b/ArcFormats/Unity/ArcASSET.cs index 07df3c33..81d924bd 100644 --- a/ArcFormats/Unity/ArcASSET.cs +++ b/ArcFormats/Unity/ArcASSET.cs @@ -203,6 +203,8 @@ namespace GameRes.Formats.Unity Offset = input.Position, Size = size, }; + if (name.HasAnyOfExtensions ("jpg", "png")) + entry.Type = "image"; break; } case 128: // Font diff --git a/ArcFormats/Unity/ArcUnityFS.cs b/ArcFormats/Unity/ArcUnityFS.cs index 33f2778a..3e57bc19 100644 --- a/ArcFormats/Unity/ArcUnityFS.cs +++ b/ArcFormats/Unity/ArcUnityFS.cs @@ -45,7 +45,7 @@ namespace GameRes.Formats.Unity public UnityFSOpener () { - Extensions = new string[] { "" }; + Extensions = new string[] { "", "unity3d" }; } public override ArcFile TryOpen (ArcView file) @@ -180,7 +180,7 @@ namespace GameRes.Formats.Unity public uint UnpackedSize; public int Compression; - public bool IsCompressed { get { return Compression != 0; } } + public bool IsCompressed { get { return (Compression & 0x3F) != 0; } } } internal class AssetDeserializer @@ -373,6 +373,11 @@ namespace GameRes.Formats.Unity uint signature = reader.ReadUInt32(); if (0x0D15F641 == signature) entry.Type = "image"; + else if (0x474E5089 == signature) + { + entry.Type = "image"; + entry.IsEncrypted = false; + } } return entry; }