From 2b59a488c4461d85cd833300d57227b09bab7fe6 Mon Sep 17 00:00:00 2001 From: morkt Date: Wed, 15 Jul 2015 14:10:14 +0400 Subject: [PATCH] (MblOpener): tweaked file type detection. --- ArcFormats/ArcMBL.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ArcFormats/ArcMBL.cs b/ArcFormats/ArcMBL.cs index 80b9c50d..d8dede81 100644 --- a/ArcFormats/ArcMBL.cs +++ b/ArcFormats/ArcMBL.cs @@ -98,17 +98,18 @@ namespace GameRes.Formats.Marble name = name.ToLowerInvariant(); index_offset += (uint)filename_len; uint offset = file.View.ReadUInt32 (index_offset); - Entry entry; + string type = null; if (name.EndsWith (".s")) { - entry = new Entry { Name = name, Type = "script" }; + type = "script"; contains_scripts = true; } - else if (name.EndsWith (".prs")) + else if (4 == Path.GetExtension (name).Length) { - entry = new Entry { Name = name, Type = "image" }; + type = FormatCatalog.Instance.GetTypeFromName (name); } - else + Entry entry; + if (string.IsNullOrEmpty (type)) { entry = new AutoEntry (name, () => { uint signature = file.View.ReadUInt32 (offset); @@ -117,6 +118,10 @@ namespace GameRes.Formats.Marble return FormatCatalog.Instance.LookupSignature (signature).FirstOrDefault(); }); } + else + { + entry = new Entry { Name = name, Type = type }; + } entry.Offset = offset; entry.Size = file.View.ReadUInt32 (index_offset+4); if (offset < index_size || !entry.CheckPlacement (file.MaxOffset))