From 853ed0eaa8dbb6d6f8dc4de2a0d9ed09399f3210 Mon Sep 17 00:00:00 2001 From: morkt Date: Mon, 7 Dec 2015 00:29:45 +0400 Subject: [PATCH] (ICrypt.ObfuscatedIndex): new virtual property. --- ArcFormats/KiriKiri/ArcXP3.cs | 11 +++++++++-- ArcFormats/KiriKiri/KiriKiriCx.cs | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ArcFormats/KiriKiri/ArcXP3.cs b/ArcFormats/KiriKiri/ArcXP3.cs index 36cca0bd..1f5874a9 100644 --- a/ArcFormats/KiriKiri/ArcXP3.cs +++ b/ArcFormats/KiriKiri/ArcXP3.cs @@ -198,7 +198,7 @@ namespace GameRes.Formats.KiriKiri entry.IsEncrypted = entry.Cipher != NoCryptAlgorithm; 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; } @@ -245,7 +245,7 @@ namespace GameRes.Formats.KiriKiri } if (!string.IsNullOrEmpty (entry.Name) && entry.Segments.Any()) { - if (entry.Cipher is ZecchouCrypt) + if (entry.Cipher.ObfuscatedIndex) { DeobfuscateEntry (entry); } @@ -764,6 +764,13 @@ NextEntry: /// public virtual bool HashAfterCrypt { get { return false; } } + /// + /// whether XP3 index is obfuscated: + /// - duplicate entries + /// - entries have additional dummy segments + /// + public virtual bool ObfuscatedIndex { get { return false; } } + public virtual byte Decrypt (Xp3Entry entry, long offset, byte value) { byte[] buffer = new byte[1] { value }; diff --git a/ArcFormats/KiriKiri/KiriKiriCx.cs b/ArcFormats/KiriKiri/KiriKiriCx.cs index 01a33002..aae78e44 100644 --- a/ArcFormats/KiriKiri/KiriKiriCx.cs +++ b/ArcFormats/KiriKiri/KiriKiriCx.cs @@ -520,6 +520,8 @@ namespace GameRes.Formats.KiriKiri public ZecchouCrypt (CxScheme scheme) : base (scheme) { } + + public override bool ObfuscatedIndex { get { return true; } } } /* CxEncryption base branch order