mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 07:34:00 +08:00
(BGI): detect file types manually instead of relying on AutoEntry.
This commit is contained in:
parent
01cd7d7675
commit
1e14ff627a
@ -122,13 +122,22 @@ namespace GameRes.Formats.BGI
|
|||||||
{
|
{
|
||||||
string name = file.View.ReadString (index_offset, 0x60);
|
string name = file.View.ReadString (index_offset, 0x60);
|
||||||
var offset = base_offset + file.View.ReadUInt32 (index_offset+0x60);
|
var offset = base_offset + file.View.ReadUInt32 (index_offset+0x60);
|
||||||
var entry = AutoEntry.Create (file, offset, name);
|
var entry = new Entry { Name = name, Offset = offset };
|
||||||
entry.Size = file.View.ReadUInt32 (index_offset+0x64);
|
entry.Size = file.View.ReadUInt32 (index_offset+0x64);
|
||||||
if (!entry.CheckPlacement (file.MaxOffset))
|
if (!entry.CheckPlacement (file.MaxOffset))
|
||||||
return null;
|
return null;
|
||||||
dir.Add (entry);
|
dir.Add (entry);
|
||||||
index_offset += 0x80;
|
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);
|
return new ArcFile (file, this, dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user