mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-25 12:24:12 +08:00
(MblOpener): tweaked file type detection.
This commit is contained in:
parent
7fdaf03521
commit
2b59a488c4
@ -98,17 +98,18 @@ namespace GameRes.Formats.Marble
|
|||||||
name = name.ToLowerInvariant();
|
name = name.ToLowerInvariant();
|
||||||
index_offset += (uint)filename_len;
|
index_offset += (uint)filename_len;
|
||||||
uint offset = file.View.ReadUInt32 (index_offset);
|
uint offset = file.View.ReadUInt32 (index_offset);
|
||||||
Entry entry;
|
string type = null;
|
||||||
if (name.EndsWith (".s"))
|
if (name.EndsWith (".s"))
|
||||||
{
|
{
|
||||||
entry = new Entry { Name = name, Type = "script" };
|
type = "script";
|
||||||
contains_scripts = true;
|
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, () => {
|
entry = new AutoEntry (name, () => {
|
||||||
uint signature = file.View.ReadUInt32 (offset);
|
uint signature = file.View.ReadUInt32 (offset);
|
||||||
@ -117,6 +118,10 @@ namespace GameRes.Formats.Marble
|
|||||||
return FormatCatalog.Instance.LookupSignature (signature).FirstOrDefault();
|
return FormatCatalog.Instance.LookupSignature (signature).FirstOrDefault();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry = new Entry { Name = name, Type = type };
|
||||||
|
}
|
||||||
entry.Offset = offset;
|
entry.Offset = offset;
|
||||||
entry.Size = file.View.ReadUInt32 (index_offset+4);
|
entry.Size = file.View.ReadUInt32 (index_offset+4);
|
||||||
if (offset < index_size || !entry.CheckPlacement (file.MaxOffset))
|
if (offset < index_size || !entry.CheckPlacement (file.MaxOffset))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user