(EAGLS): detect non-encrypted archives.

This commit is contained in:
morkt 2020-03-30 17:26:15 +04:00
parent 1dfa1482b9
commit 15da067676

View File

@ -107,7 +107,8 @@ namespace GameRes.Formats.Eagls
if (dir[0].Name.HasExtension ("gr")) // CG archive
{
var rng = DetectEncryptionScheme (file, dir[0]);
return new EaglsArchive (file, this, dir, new CgEncryption (rng));
if (rng != null)
return new EaglsArchive (file, this, dir, new CgEncryption (rng));
}
else if (has_scripts)
{
@ -155,6 +156,8 @@ namespace GameRes.Formats.Eagls
IRandomGenerator DetectEncryptionScheme (ArcView file, Entry first_entry)
{
int signature = (file.View.ReadInt32 (first_entry.Offset) >> 8) & 0xFFFF;
if (0x4D42 == signature) // 'BM'
return null;
byte seed = file.View.ReadByte (first_entry.Offset+first_entry.Size-1);
IRandomGenerator[] rng_list = {
new LehmerRandomGenerator(),