mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
(RPM): additional sanity check.
This commit is contained in:
parent
b7897b0d62
commit
2d3464535b
@ -59,6 +59,7 @@ namespace GameRes.Formats.Rpm
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Export(typeof(ArchiveFormat))]
|
[Export(typeof(ArchiveFormat))]
|
||||||
|
[ExportMetadata("Priority", -2)]
|
||||||
public class ArcOpener : ArchiveFormat
|
public class ArcOpener : ArchiveFormat
|
||||||
{
|
{
|
||||||
public override string Tag { get { return "ARC/RPM"; } }
|
public override string Tag { get { return "ARC/RPM"; } }
|
||||||
@ -94,9 +95,14 @@ namespace GameRes.Formats.Rpm
|
|||||||
|
|
||||||
var index_reader = new ArcIndexReader (file, count, is_compressed != 0);
|
var index_reader = new ArcIndexReader (file, count, is_compressed != 0);
|
||||||
var scheme = index_reader.GuessScheme (8, new int[] { 0x20, 0x18 });
|
var scheme = index_reader.GuessScheme (8, new int[] { 0x20, 0x18 });
|
||||||
// additional filename extension check avoids dialog popup on false positives
|
// additional checks to avoid dialog popup on false positives
|
||||||
if (null == scheme && KnownSchemes.Count > 0 && file.Name.HasExtension (".arc"))
|
if (null == scheme && KnownSchemes.Count > 0 && file.Name.HasExtension (".arc"))
|
||||||
|
{
|
||||||
|
var first_entry = file.View.ReadBytes (8, 0x20);
|
||||||
|
if (-1 == Array.FindIndex (first_entry, x => x != 0))
|
||||||
|
return null;
|
||||||
scheme = QueryScheme();
|
scheme = QueryScheme();
|
||||||
|
}
|
||||||
if (null == scheme)
|
if (null == scheme)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user