From 1e14ff627a18f09dfb4e0881eb1160eb89a9b57d Mon Sep 17 00:00:00 2001 From: morkt Date: Fri, 3 Mar 2017 17:45:00 +0400 Subject: [PATCH] (BGI): detect file types manually instead of relying on AutoEntry. --- ArcFormats/Ethornell/ArcBGI.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ArcFormats/Ethornell/ArcBGI.cs b/ArcFormats/Ethornell/ArcBGI.cs index 951e6ec2..3a066fcc 100644 --- a/ArcFormats/Ethornell/ArcBGI.cs +++ b/ArcFormats/Ethornell/ArcBGI.cs @@ -122,13 +122,22 @@ namespace GameRes.Formats.BGI { string name = file.View.ReadString (index_offset, 0x60); var offset = base_offset + file.View.ReadUInt32 (index_offset+0x60); - var entry = AutoEntry.Create (file, offset, name); - entry.Size = file.View.ReadUInt32 (index_offset+0x64); + var entry = new Entry { Name = name, Offset = offset }; + entry.Size = file.View.ReadUInt32 (index_offset+0x64); if (!entry.CheckPlacement (file.MaxOffset)) return null; dir.Add (entry); index_offset += 0x80; } + foreach (var entry in dir) + { + uint signature = file.View.ReadUInt32 (entry.Offset); + var res = AutoEntry.DetectFileType (signature); + if (res != null) + entry.Type = res.Type; + else if (file.View.AsciiEqual (entry.Offset+4, "bw ")) + entry.Type = "audio"; + } return new ArcFile (file, this, dir); } }