(ICrypt.ObfuscatedIndex): new virtual property.

This commit is contained in:
morkt 2015-12-07 00:29:45 +04:00
parent bec2977429
commit 853ed0eaa8
2 changed files with 11 additions and 2 deletions

View File

@ -198,7 +198,7 @@ namespace GameRes.Formats.KiriKiri
entry.IsEncrypted = entry.Cipher != NoCryptAlgorithm; entry.IsEncrypted = entry.Cipher != NoCryptAlgorithm;
var name = new string (header.ReadChars (name_size)); var name = new string (header.ReadChars (name_size));
if (entry.Cipher is ZecchouCrypt && ObfuscatedPathRe.IsMatch (name)) if (entry.Cipher.ObfuscatedIndex && ObfuscatedPathRe.IsMatch (name))
{ {
goto NextEntry; goto NextEntry;
} }
@ -245,7 +245,7 @@ namespace GameRes.Formats.KiriKiri
} }
if (!string.IsNullOrEmpty (entry.Name) && entry.Segments.Any()) if (!string.IsNullOrEmpty (entry.Name) && entry.Segments.Any())
{ {
if (entry.Cipher is ZecchouCrypt) if (entry.Cipher.ObfuscatedIndex)
{ {
DeobfuscateEntry (entry); DeobfuscateEntry (entry);
} }
@ -764,6 +764,13 @@ NextEntry:
/// </summary> /// </summary>
public virtual bool HashAfterCrypt { get { return false; } } public virtual bool HashAfterCrypt { get { return false; } }
/// <summary>
/// whether XP3 index is obfuscated:
/// - duplicate entries
/// - entries have additional dummy segments
/// </summary>
public virtual bool ObfuscatedIndex { get { return false; } }
public virtual byte Decrypt (Xp3Entry entry, long offset, byte value) public virtual byte Decrypt (Xp3Entry entry, long offset, byte value)
{ {
byte[] buffer = new byte[1] { value }; byte[] buffer = new byte[1] { value };

View File

@ -520,6 +520,8 @@ namespace GameRes.Formats.KiriKiri
public ZecchouCrypt (CxScheme scheme) : base (scheme) public ZecchouCrypt (CxScheme scheme) : base (scheme)
{ {
} }
public override bool ObfuscatedIndex { get { return true; } }
} }
/* CxEncryption base branch order /* CxEncryption base branch order