diff --git a/ArcFormats/Resources/Formats.dat b/ArcFormats/Resources/Formats.dat index cf88c0cca..5dbd59aeb 100644 Binary files a/ArcFormats/Resources/Formats.dat and b/ArcFormats/Resources/Formats.dat differ diff --git a/ArcFormats/ShiinaRio/WarcEncryption.cs b/ArcFormats/ShiinaRio/WarcEncryption.cs index 382f4af9c..8c407a4fe 100644 --- a/ArcFormats/ShiinaRio/WarcEncryption.cs +++ b/ArcFormats/ShiinaRio/WarcEncryption.cs @@ -1311,4 +1311,43 @@ unsafe void DoCrypt (byte[] data, int index, uint length) } } } + + [Serializable] + public class Ushimitsu2Crypt : IDecryptExtra + { + public void Decrypt(byte[] data, int index, uint length, uint flags) + { + byte[] key = new byte[] + { + 0x4B, 0x4D, 0x36, 0x35, 0x33, 0x32, 0x20, 0x43, + 0x50, 0x55, 0x20, 0x63, 0x6F, 0x72, 0x65, 0x20, + 0x65, 0x6D, 0x75, 0x6C, 0x61, 0x74, 0x69, 0x6F, + 0x6E, 0x20, 0x3A, 0x20, 0x43, 0x6F, 0x70, 0x79, + 0x72, 0x69, 0x67, 0x68, 0x74, 0x28, 0x43, 0x29, + 0x20, 0x32, 0x30, 0x30, 0x35, 0x2C, 0x36, 0x20, + 0x59, 0x2E, 0x59, 0x61, 0x6D, 0x61, 0x64, 0x61, + 0x2F, 0x53, 0x54, 0x55, 0x44, 0x49, 0x4F, 0x20, + 0x82, 0xE6, 0x82, 0xB5, 0x82, 0xAD, 0x82, 0xF1 + }; + + if (length >= 0x200) + { + if ((flags & 0x202) == 0x202) + { + for (int i = 0; i < ((length & 0x7E) | 1); i++) + { + data[index + i] ^= key[i % 0x40]; + } + var value = MemoryMarshal.Read(data.AsSpan(index + 0x100)); + value ^= length; + MemoryMarshal.Write(data.AsSpan(index + 0x100), ref value); + } + } + } + + public void Encrypt(byte[] data, int index, uint length, uint flags) + { + throw new NotImplementedException(); + } + } }