diff --git a/ArcFormats/Cmvs/ArcCPZ.cs b/ArcFormats/Cmvs/ArcCPZ.cs index d30e0c5d..2d7aeb3f 100644 --- a/ArcFormats/Cmvs/ArcCPZ.cs +++ b/ArcFormats/Cmvs/ArcCPZ.cs @@ -290,13 +290,7 @@ namespace GameRes.Formats.Purple for (int i = 0; i < secret_length; ++i) secret_key[i] = secret[i] - key; - uint shift = key; - shift = (shift >> 8) ^ key; - shift = (shift >> 8) ^ key; - shift = (shift >> 8) ^ key; - shift = (shift >> 8) ^ key; - shift = ((shift ^ 0xB) & 0xF) + 7; - + int shift = (int)(((key >> 24) ^ (key >> 16) ^ (key >> 8) ^ key ^ 0xB) & 0xF) + 7; unsafe { fixed (byte* raw = data) @@ -305,7 +299,7 @@ namespace GameRes.Formats.Purple int i = 5; for (int n = data.Length / 4; n > 0; --n) { - *data32 = Binary.RotR ((secret_key[i] ^ *data32) + scheme.IndexAddend, (int)shift) + 0x01010101; + *data32 = Binary.RotR ((secret_key[i] ^ *data32) + scheme.IndexAddend, shift) + 0x01010101; ++data32; i = (i + 1) % 24; } diff --git a/ArcFormats/Cmvs/CmvsMD5.cs b/ArcFormats/Cmvs/CmvsMD5.cs index e9958952..dc07dbf7 100644 --- a/ArcFormats/Cmvs/CmvsMD5.cs +++ b/ArcFormats/Cmvs/CmvsMD5.cs @@ -27,7 +27,7 @@ using GameRes.Utility; namespace GameRes.Formats.Cmvs { - public enum Md5Variant { A, B, Chrono } + public enum Md5Variant { A, B, Chrono, Memoria } public abstract class MD5 : Cryptography.MD5Base { @@ -43,6 +43,7 @@ namespace GameRes.Formats.Cmvs case Md5Variant.A: return new Md5VariantA(); case Md5Variant.B: return new Md5VariantB(); case Md5Variant.Chrono: return new Md5Chrono(); + case Md5Variant.Memoria: return new Md5Memoria(); default: throw new System.ArgumentException ("Unknown MD5 variant", "variant"); } } @@ -111,4 +112,23 @@ namespace GameRes.Formats.Cmvs data[3] = m_state[0] + 0x1D0638AD; } } + + public class Md5Memoria : MD5 + { + protected override void InitState () + { + m_state[0] = 0xA79463F9; + m_state[1] = 0xB6E755C5; + m_state[2] = 0xC696AF21; + m_state[3] = 0x6983E978; + } + + protected override void SetResult (uint[] data) + { + data[0] = m_state[1]; + data[1] = m_state[2]; + data[2] = m_state[3]; + data[3] = m_state[0]; + } + } } diff --git a/supported.html b/supported.html index 3767a560..e4b07182 100644 --- a/supported.html +++ b/supported.html @@ -768,6 +768,7 @@ Favorite Sweet!
Nanapuri
Sabae no Ou Scenario II
Soushinjutsu 3
+Temaribana
Wakan Kazoku
*.spdSPDC
SPD8No @@ -864,6 +865,7 @@ Gakuen Saimin Reido
Chrono Clock
Hapymaher
Haruiro Ouse
+Memoria
*.pb3PB3BNo *.g2
*.stx-NoGLib2