mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
(GrpOpener): use AutoEntry.DetectFileType
This commit is contained in:
parent
c5dd52bc2d
commit
e89574e4ea
@ -81,7 +81,7 @@ namespace GameRes.Formats.Ankh
|
||||
return new ArcFile (file, this, dir);
|
||||
}
|
||||
|
||||
void DetectFileTypes (ArcView file, List<Entry> dir)
|
||||
internal void DetectFileTypes (ArcView file, List<Entry> dir)
|
||||
{
|
||||
var header = new byte[16];
|
||||
foreach (PackedEntry entry in dir)
|
||||
@ -128,23 +128,15 @@ namespace GameRes.Formats.Ankh
|
||||
entry.UnpackedSize = header.ToUInt32 (0);
|
||||
entry.IsPacked = true;
|
||||
}
|
||||
else if (header.AsciiEqual ("BM"))
|
||||
else
|
||||
{
|
||||
entry.ChangeType (ImageFormat.Bmp);
|
||||
}
|
||||
else if (header.AsciiEqual ("RIFF"))
|
||||
uint signature = header.ToUInt32 (0);
|
||||
var res = AutoEntry.DetectFileType (signature);
|
||||
if (res != null)
|
||||
{
|
||||
entry.ChangeType (AudioFormat.Wav);
|
||||
entry.ChangeType (res);
|
||||
}
|
||||
else if (header.AsciiEqual ("\x89PNG"))
|
||||
{
|
||||
entry.ChangeType (ImageFormat.Png);
|
||||
}
|
||||
else if (header.ToUInt32 (0) == 0xE0FFD8FF)
|
||||
{
|
||||
entry.ChangeType (ImageFormat.Jpeg);
|
||||
}
|
||||
else if (header.ToUInt16 (0) == 0xFBFF)
|
||||
else if ((signature & 0xFFFF) == 0xFBFF)
|
||||
{
|
||||
entry.ChangeType (Mp3Format.Value);
|
||||
}
|
||||
@ -154,6 +146,7 @@ namespace GameRes.Formats.Ankh
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static ResourceInstance<AudioFormat> Mp3Format = new ResourceInstance<AudioFormat> ("MP3");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user