diff --git a/ArcFormats/ArcFormats.csproj b/ArcFormats/ArcFormats.csproj
index d12363f1..94d6e08c 100644
--- a/ArcFormats/ArcFormats.csproj
+++ b/ArcFormats/ArcFormats.csproj
@@ -9,7 +9,7 @@
Properties
GameRes.Formats
ArcFormats
- v4.6
+ v4.6.1
512
..\
@@ -49,40 +49,49 @@
MinimumRecommendedRules.ruleset
-
- ..\packages\SharpZipLib.1.3.1\lib\net45\ICSharpCode.SharpZipLib.dll
+
+ ..\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll
..\packages\NAudio.1.7.3\lib\net35\NAudio.dll
-
- ..\packages\NVorbis.0.10.1\lib\net45\NVorbis.dll
+
+ ..\packages\NVorbis.0.10.4\lib\net45\NVorbis.dll
- ..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll
+ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+ ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll
+
+
+ ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll
+
- ..\packages\System.Memory.4.5.4\lib\netstandard1.1\System.Memory.dll
+ ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll
-
- ..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll
+
+ ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
-
- ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net46\System.Security.Cryptography.Algorithms.dll
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll
..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll
- ..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll
+ ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll
@@ -215,6 +224,8 @@
+
+
@@ -787,6 +798,7 @@
+
@@ -804,7 +816,6 @@
-
diff --git a/ArcFormats/Astronauts/ArcGXP.cs b/ArcFormats/Astronauts/ArcGXP.cs
index 0baba6f8..2464d4d5 100644
--- a/ArcFormats/Astronauts/ArcGXP.cs
+++ b/ArcFormats/Astronauts/ArcGXP.cs
@@ -41,19 +41,39 @@ namespace GameRes.Formats.Astronauts
public override bool IsHierarchic { get { return true; } }
public override bool CanWrite { get { return false; } }
+ private bool UseNameAsKey = false;
+
static readonly byte[] KnownKey = {
0x40, 0x21, 0x28, 0x38, 0xA6, 0x6E, 0x43, 0xA5, 0x40, 0x21, 0x28, 0x38, 0xA6, 0x43, 0xA5, 0x64,
0x3E, 0x65, 0x24, 0x20, 0x46, 0x6E, 0x74,
};
- public override ArcFile TryOpen (ArcView file)
+ public override ArcFile TryOpen(ArcView file)
+ {
+ UseNameAsKey = false;
+ ArcFile arc = TryOpenGxpFile(file);
+ if(null == arc)
+ {
+ UseNameAsKey = true; //try use arc name as key
+ arc = TryOpenGxpFile(file);
+ }
+ return arc;
+ }
+
+ private ArcFile TryOpenGxpFile (ArcView file)
{
int count = file.View.ReadInt32 (0x18);
if (!IsSaneCount (count))
- return null;
-
+ return null;
+ string arcname = Path.GetFileName(file.Name);
+ byte[] arcname_bytes = Encoding.ASCII.GetBytes(arcname);
long base_offset = file.View.ReadInt64 (0x28);
- uint entry_key = KnownKey[0] | (1u^KnownKey[1]) << 8 | (2u^KnownKey[2]) << 16 | (3u^KnownKey[3]) << 24;
+ uint entry_key = KnownKey[0] | (1u ^ KnownKey[1]) << 8 | (2u ^ KnownKey[2]) << 16 | (3u ^ KnownKey[3]) << 24;
+ if (UseNameAsKey)
+ {
+ uint arcname_key = (uint)(arcname_bytes[0] | (arcname_bytes[1 % arcname_bytes.Length]) << 8 | (arcname_bytes[2 % arcname_bytes.Length]) << 16 | (arcname_bytes[3 % arcname_bytes.Length]) << 24);
+ entry_key ^= arcname_key;
+ }
uint index_offset = 0x30;
var entry_buffer = new byte[0x100];
var dir = new List (count);
@@ -66,7 +86,10 @@ namespace GameRes.Formats.Astronauts
entry_buffer = new byte[entry_length];
if (entry_length != file.View.Read (index_offset, entry_buffer, 0, entry_length))
return null;
- Decrypt (entry_buffer, entry_length);
+ if (UseNameAsKey)
+ Decrypt(entry_buffer, entry_length, arcname_bytes);
+ else
+ Decrypt(entry_buffer, entry_length);
int name_length = LittleEndian.ToInt32 (entry_buffer, 0xC) * 2; // length in characters
if (name_length >= entry_length)
return null;
@@ -85,15 +108,25 @@ namespace GameRes.Formats.Astronauts
public override Stream OpenEntry (ArcFile arc, Entry entry)
{
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
- Decrypt (data, entry.Size);
+ if (UseNameAsKey)
+ {
+ string arcname = Path.GetFileName(arc.File.Name);
+ byte[] arcname_bytes = Encoding.ASCII.GetBytes(arcname);
+ Decrypt(data, entry.Size, arcname_bytes);
+ }
+ else
+ Decrypt(data, entry.Size);
return new BinMemoryStream (data, entry.Name);
}
- static void Decrypt (byte[] data, uint length)
+ static void Decrypt (byte[] data, uint length, byte[] key=null)
{
for (uint i = 0; i < length; ++i)
{
- data[i] ^= (byte)(i ^ KnownKey[i % KnownKey.Length]);
+ byte xorkey = (byte)(i ^ KnownKey[i % KnownKey.Length]);
+ if(null != key)
+ xorkey ^= key[i % key.Length];
+ data[i] ^= xorkey;
}
}
}
diff --git a/ArcFormats/Kaguya/ArcLINK.cs b/ArcFormats/Kaguya/ArcLINK.cs
index 0514d70e..ec0f5294 100644
--- a/ArcFormats/Kaguya/ArcLINK.cs
+++ b/ArcFormats/Kaguya/ArcLINK.cs
@@ -648,7 +648,10 @@ namespace GameRes.Formats.Kaguya
if (anm_encrypted)
{
table.Add (new Tuple ("AN00", (a, e) => DecryptAn00 (a, e)));
+ table.Add (new Tuple ("AN20", (a, e) => DecryptAn20 (a, e)));
table.Add (new Tuple ("AN21", (a, e) => DecryptAn21 (a, e)));
+ table.Add (new Tuple ("PL00", (a, e) => DecryptPL00 (a, e)));
+ table.Add (new Tuple ("PL10", (a, e) => DecryptPL10 (a, e)));
}
m_type_table = table.ToArray();
}
@@ -688,6 +691,42 @@ namespace GameRes.Formats.Kaguya
frame_offset += size + 8;
}
return new BinMemoryStream (data, entry.Name);
+ }
+
+ Stream DecryptAn20(LinkArchive arc, LinkEntry entry)
+ {
+ var data = arc.File.View.ReadBytes(entry.Offset, entry.Size);
+ int count = data.ToUInt16(4);
+ int offset = 8;
+ for (int i = 0; i < count; ++i)
+ {
+ switch (data[offset++])
+ {
+ case 0: break;
+ case 1: offset += 8; break;
+ case 2:
+ case 3:
+ case 4:
+ case 5: offset += 4; break;
+ default: return new BinMemoryStream(data, entry.Name);
+ }
+ }
+ count = data.ToUInt16(offset);
+ offset += 2 + count * 8;
+ int frame_count = data.ToInt16(offset);
+ offset += 18;
+ for(int i = 0; i < frame_count; ++i)
+ {
+ offset += 8;
+ int w = data.ToInt32(offset);
+ int h = data.ToInt32(offset + 4);
+ int channels = data.ToInt32(offset + 8);
+ int frame_size = channels * w * h;
+ offset += 12;
+ DecryptData(data, offset, frame_size);
+ offset += frame_size;
+ }
+ return new BinMemoryStream(data, entry.Name);
}
Stream DecryptAn21 (LinkArchive arc, LinkEntry entry)
@@ -716,6 +755,37 @@ namespace GameRes.Formats.Kaguya
offset += 12;
DecryptData (data, offset, channels * w * h);
return new BinMemoryStream (data, entry.Name);
+ }
+
+ Stream DecryptPL00(LinkArchive arc, LinkEntry entry)
+ {
+ var data = arc.File.View.ReadBytes(entry.Offset, entry.Size);
+ int count = data.ToUInt16(4);
+ int offset = 22;
+ for(int i = 0; i < count; ++i)
+ {
+ offset += 8;
+ int w = data.ToInt32(offset);
+ int h = data.ToInt32(offset + 4);
+ int channels = data.ToInt32(offset + 8);
+ int size = channels * w * h;
+ offset += 12;
+ DecryptData(data, offset, size);
+ offset += size;
+ }
+ return new BinMemoryStream(data, entry.Name);
+ }
+
+ Stream DecryptPL10(LinkArchive arc, LinkEntry entry)
+ {
+ var data = arc.File.View.ReadBytes(entry.Offset, entry.Size);
+ int offset = 30;
+ int w = data.ToInt32(offset);
+ int h = data.ToInt32(offset + 4);
+ int channels = data.ToInt32(offset + 8);
+ offset += 12;
+ DecryptData(data, offset, channels * w * h);
+ return new BinMemoryStream(data, entry.Name);
}
void DecryptData (byte[] data, int index, int length)
diff --git a/ArcFormats/Kaguya/ArcPL00.cs b/ArcFormats/Kaguya/ArcPL00.cs
new file mode 100644
index 00000000..e35e5bce
--- /dev/null
+++ b/ArcFormats/Kaguya/ArcPL00.cs
@@ -0,0 +1,126 @@
+//! \file ArcAN21.cs
+//! \date Sun Apr 30 21:04:25 2017
+//! \brief KaGuYa script engine animation resource.
+//
+// Copyright (C) 2017 by morkt
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.IO;
+using System.Linq;
+using System.Windows.Media;
+
+namespace GameRes.Formats.Kaguya
+{
+ class PL00Entry : PackedEntry
+ {
+ public int FrameIndex;
+ public ImageMetaData ImageInfo;
+ }
+
+ [Export(typeof(ArchiveFormat))]
+ public class PL00Opener : ArchiveFormat
+ {
+ public override string Tag { get { return "PL00/KAGUYA"; } }
+ public override string Description { get { return "KaGuYa script engine animation resource"; } }
+ public override uint Signature { get { return 0x30304C50; } } // 'PL00'
+ public override bool IsHierarchic { get { return false; } }
+ public override bool CanWrite { get { return false; } }
+
+ public PL00Opener()
+ {
+ Extensions = new string[] { "plt" };
+ }
+
+ public override ArcFile TryOpen(ArcView file)
+ {
+ uint current_offset = 4;
+ int frame_count = file.View.ReadUInt16(current_offset);
+ if (!IsSaneCount(frame_count))
+ return null;
+ current_offset += 2;
+ string base_name = Path.GetFileNameWithoutExtension(file.Name);
+ var dir = new List(frame_count);
+ var info = new ImageMetaData
+ {
+ OffsetX = file.View.ReadInt32(current_offset),
+ OffsetY = file.View.ReadInt32(current_offset + 4),
+ Width = file.View.ReadUInt32(current_offset + 8),
+ Height = file.View.ReadUInt32(current_offset + 12),
+ };
+ int channels = file.View.ReadInt32(38);
+ info.BPP = channels * 8;
+ current_offset += 16;
+ for (int i = 0; i < frame_count; ++i)
+ {
+ int offsetx = file.View.ReadInt32(current_offset);
+ int offsety = file.View.ReadInt32(current_offset + 4);
+ uint width = file.View.ReadUInt32(current_offset + 8);
+ uint height = file.View.ReadUInt32(current_offset + 12);
+ channels = file.View.ReadInt32(current_offset + 16);
+ uint size = (uint)(width * height * channels);
+ current_offset += 20;
+ var entry = new PL00Entry
+ {
+ FrameIndex = i,
+ Name = string.Format("{0}#{1:D2}", base_name, i),
+ Type = "image",
+ Offset = current_offset,
+ Size = size,
+ IsPacked = false,
+ ImageInfo = new ImageMetaData
+ {
+ OffsetX = offsetx,
+ OffsetY = offsety,
+ Width = width,
+ Height = height,
+ BPP = channels * 8,
+ }
+ };
+ dir.Add(entry);
+ current_offset += size;
+ }
+ return new PL00Archive(file, this, dir, info);
+ }
+
+ public override IImageDecoder OpenImage(ArcFile arc, Entry entry)
+ {
+ var anent = (PL00Entry)entry;
+ var input = arc.File.CreateStream(entry.Offset, entry.Size);
+ var pixels = input.ReadBytes((int)anent.Size);
+ return new BitmapDecoder(pixels, anent.ImageInfo);
+ }
+ }
+
+ class PL00Archive : ArcFile
+ {
+ public readonly ImageMetaData ImageInfo;
+
+ public PL00Archive(ArcView arc, ArchiveFormat impl, ICollection dir, ImageMetaData base_info)
+ : base(arc, impl, dir)
+ {
+ ImageInfo = base_info;
+ }
+ }
+
+}
diff --git a/ArcFormats/Kaguya/ArcPL10.cs b/ArcFormats/Kaguya/ArcPL10.cs
new file mode 100644
index 00000000..5b70bc4b
--- /dev/null
+++ b/ArcFormats/Kaguya/ArcPL10.cs
@@ -0,0 +1,207 @@
+//! \file ArcAN21.cs
+//! \date Sun Apr 30 21:04:25 2017
+//! \brief KaGuYa script engine animation resource.
+//
+// Copyright (C) 2017 by morkt
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.IO;
+using System.Linq;
+using System.Windows.Media;
+
+namespace GameRes.Formats.Kaguya
+{
+ class PL10Entry : PackedEntry
+ {
+ public int FrameIndex;
+ public int RleStep;
+ }
+
+ [Export(typeof(ArchiveFormat))]
+ public class PL10Opener : ArchiveFormat
+ {
+ public override string Tag { get { return "PL10/KAGUYA"; } }
+ public override string Description { get { return "KaGuYa script engine animation resource"; } }
+ public override uint Signature { get { return 0x30314C50; } } // 'PL10'
+ public override bool IsHierarchic { get { return false; } }
+ public override bool CanWrite { get { return false; } }
+
+ public PL10Opener()
+ {
+ Extensions = new string[] { "plt" };
+ }
+
+ public override ArcFile TryOpen(ArcView file)
+ {
+ uint current_offset = 4;
+ int frame_count = file.View.ReadUInt16(current_offset);
+ if (!IsSaneCount(frame_count))
+ return null;
+ current_offset += 0x12;
+ string base_name = Path.GetFileNameWithoutExtension(file.Name);
+ var dir = new List(frame_count);
+ var info = new ImageMetaData
+ {
+ OffsetX = file.View.ReadInt32(current_offset),
+ OffsetY = file.View.ReadInt32(current_offset + 4),
+ Width = file.View.ReadUInt32(current_offset + 8),
+ Height = file.View.ReadUInt32(current_offset + 12),
+ };
+ int channels = file.View.ReadInt32(current_offset + 0x10);
+ info.BPP = channels * 8;
+ current_offset += 0x14;
+ var entry = new PL10Entry
+ {
+ FrameIndex = 0,
+ Name = string.Format("{0}#{1:D2}", base_name, 0),
+ Type = "image",
+ Offset = current_offset,
+ Size = (uint)channels * info.Width * info.Height,
+ IsPacked = false,
+ };
+ dir.Add(entry);
+ current_offset += entry.Size;
+ for (int i = 1; i < frame_count; ++i)
+ {
+ int step = file.View.ReadByte(current_offset++);
+ if (0 == step)
+ return null;
+ uint packed_size = file.View.ReadUInt32(current_offset);
+ uint unpacked_size = (uint)(channels * (info.OffsetX + (int)info.Width)
+ * (info.OffsetY + (int)info.Height));
+ current_offset += 4;
+ entry = new PL10Entry
+ {
+ FrameIndex = i,
+ Name = string.Format("{0}#{1:D2}", base_name, i),
+ Type = "image",
+ Offset = current_offset,
+ Size = packed_size,
+ UnpackedSize = unpacked_size,
+ IsPacked = true,
+ RleStep = step,
+ };
+ dir.Add(entry);
+ current_offset += packed_size;
+ }
+ return new PL10Archive(file, this, dir, info);
+ }
+
+ public override Stream OpenEntry(ArcFile arc, Entry entry)
+ {
+ var anent = entry as PL10Entry;
+ var input = arc.File.CreateStream(entry.Offset, entry.Size);
+ if (null == anent || !anent.IsPacked)
+ return input;
+ using (input)
+ {
+ var data = DecompressRLE(input, anent.UnpackedSize, anent.RleStep);
+ return new BinMemoryStream(data);
+ }
+ }
+
+ public override IImageDecoder OpenImage(ArcFile arc, Entry entry)
+ {
+ var anarc = (PL10Archive)arc;
+ var anent = (PL10Entry)entry;
+ var pixels = anarc.GetFrame(anent.FrameIndex);
+ return new BitmapDecoder(pixels, anarc.ImageInfo);
+ }
+
+ internal static byte[] DecompressRLE(IBinaryStream input, uint unpacked_size, int rle_step)
+ {
+ var output = new byte[unpacked_size];
+ for (int i = 0; i < rle_step; ++i)
+ {
+ byte v1 = input.ReadUInt8();
+ output[i] = v1;
+ int dst = i + rle_step;
+ while (dst < output.Length)
+ {
+ byte v2 = input.ReadUInt8();
+ output[dst] = v2;
+ dst += rle_step;
+ if (v2 == v1)
+ {
+ int count = input.ReadUInt8();
+ if (0 != (count & 0x80))
+ count = input.ReadUInt8() + ((count & 0x7F) << 8) + 128;
+ while (count-- > 0 && dst < output.Length)
+ {
+ output[dst] = v2;
+ dst += rle_step;
+ }
+ if (dst < output.Length)
+ {
+ v2 = input.ReadUInt8();
+ output[dst] = v2;
+ dst += rle_step;
+ }
+ }
+ v1 = v2;
+ }
+ }
+ return output;
+ }
+ }
+
+ class PL10Archive : ArcFile
+ {
+ byte[][] Frames;
+
+ public readonly ImageMetaData ImageInfo;
+
+ public PL10Archive(ArcView arc, ArchiveFormat impl, ICollection dir, ImageMetaData base_info)
+ : base(arc, impl, dir)
+ {
+ Frames = new byte[dir.Count][];
+ ImageInfo = base_info;
+ }
+
+ public byte[] GetFrame(int index)
+ {
+ if (index >= Frames.Length)
+ throw new ArgumentException("index");
+ if (null != Frames[index])
+ return Frames[index];
+
+ var entry = Dir.ElementAt(index);
+ byte[] pixels;
+ using (var stream = OpenEntry(entry))
+ {
+ pixels = new byte[stream.Length];
+ stream.Read(pixels, 0, pixels.Length);
+ }
+ if (index > 0)
+ {
+ var prev_frame = GetFrame(index - 1);
+ for (int i = 0; i < pixels.Length; ++i)
+ pixels[i] += prev_frame[i];
+ }
+ Frames[index] = pixels;
+ return pixels;
+ }
+ }
+
+}
diff --git a/ArcFormats/KiriKiri/CryptAlgorithms.cs b/ArcFormats/KiriKiri/CryptAlgorithms.cs
index 8e1149ad..a94e8262 100644
--- a/ArcFormats/KiriKiri/CryptAlgorithms.cs
+++ b/ArcFormats/KiriKiri/CryptAlgorithms.cs
@@ -1406,4 +1406,91 @@ namespace GameRes.Formats.KiriKiri
return key;
}
}
+
+ [Serializable]
+ public class NinkiSeiyuuCrypt : ICrypt
+ {
+ ulong m_key1;
+ ulong m_key2;
+ ulong m_key3;
+
+ byte[] m_tbl2;
+ byte[] m_tbl3;
+
+ public NinkiSeiyuuCrypt(ulong key1, ulong key2, ulong key3)
+ {
+ m_key1 = key1;
+ m_key2 = key2;
+ m_key3 = key3;
+
+ m_tbl2 = GetTable2(3080);
+ m_tbl3 = GetTable3(3080, m_key1, m_key2, m_key3);
+ }
+
+ static byte[] GetTable1(uint seed)
+ {
+ var key = new byte[32];
+
+ uint v48 = seed & 0x7FFFFFFF;
+
+ for (var i = 0; i < 31; i++)
+ {
+ key[i] = (byte)v48;
+ v48 = (v48 >> 8) | (uint)((byte)v48 << 23);
+ }
+
+ return key;
+ }
+
+ static byte[] GetTable2(uint seed)
+ {
+ var key = new byte[64];
+
+ uint v51 = seed & 0xFFF;
+ ulong v52 = (ulong)(v51 | (v51 << 13)) | ((ulong)(v51 >> 19) << 32);
+ uint v53 = v51 | ((uint)v52 << 13);
+ uint v54 = (uint)((ulong)(((uint)v52 << 7) & 0x1FFFFFFF) | (v52 >> 19));
+
+ for (int i = 0; i < 61; i++)
+ {
+ var v56 = (byte)v53;
+ key[i] = (byte)v53;
+ v53 = (uint)((((ulong)v54 << 32) | v53) >> 8);
+ v54 = (v54 >> 8) | (uint)(v56 << 21);
+ }
+
+ return key;
+ }
+
+ static byte[] GetTable3(uint seed, ulong key1, ulong key2, ulong key3)
+ {
+ var key = new byte[64];
+
+ uint v88 = seed & 0xFFF;
+ ulong v89 = (ulong)(v88 | (v88 << 13)) | ((ulong)(v88 >> 19) << 32);
+ uint v90 = (uint)((key1 + key2) ^ (ulong)(v88 | ((uint)v89 << 13)));
+ uint v91 = (uint)((ulong)(((key1 + ((key3 & 0xFFFFFFFF00000000) | (key2 & 0xFFFFFFFF))) >> 32) & 0x1FFFFFFF) ^ ((ulong)(((uint)v89 << 7) & 0x1FFFFFFF) | (v89 >> 19)));
+
+ for (int i = 0; i < 61; i++)
+ {
+ var v93 = (byte)v90;
+ key[i] = (byte)v90;
+ v90 = (uint)((((ulong)v91 << 32) | v90) >> 8);
+ v91 = (v91 >> 8) | (uint)(v93 << 21);
+ }
+
+ return key;
+ }
+
+ public override void Decrypt(Xp3Entry entry, long offset, byte[] buffer, int pos, int count)
+ {
+ var tbl1 = GetTable1(entry.Hash);
+
+ for (var i = 0; i < count; i++)
+ {
+ buffer[pos + i] ^= tbl1[(offset + i) % 0x1F];
+ buffer[pos + i] += (byte)(m_tbl2[(offset + i) % 0x3D] ^ m_tbl3[(offset + i) % 0x3D]);
+ }
+ }
+ }
}
diff --git a/ArcFormats/Properties/Settings.Designer.cs b/ArcFormats/Properties/Settings.Designer.cs
index c3674968..e45f2062 100644
--- a/ArcFormats/Properties/Settings.Designer.cs
+++ b/ArcFormats/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace GameRes.Formats.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/ArcFormats/Resources/Formats.dat b/ArcFormats/Resources/Formats.dat
index 908e3936..64830f2f 100644
Binary files a/ArcFormats/Resources/Formats.dat and b/ArcFormats/Resources/Formats.dat differ
diff --git a/ArcFormats/Strings/arcStrings.Designer.cs b/ArcFormats/Strings/arcStrings.Designer.cs
index be107284..c42b4340 100644
--- a/ArcFormats/Strings/arcStrings.Designer.cs
+++ b/ArcFormats/Strings/arcStrings.Designer.cs
@@ -19,7 +19,7 @@ namespace GameRes.Formats.Strings {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class arcStrings {
diff --git a/ArcFormats/app.config b/ArcFormats/app.config
index 04d8e6c9..1b59f64c 100644
--- a/ArcFormats/app.config
+++ b/ArcFormats/app.config
@@ -201,7 +201,7 @@
-
+
@@ -226,7 +226,7 @@
-
+
diff --git a/ArcFormats/packages.config b/ArcFormats/packages.config
index bd176038..d5d65c41 100644
--- a/ArcFormats/packages.config
+++ b/ArcFormats/packages.config
@@ -1,13 +1,14 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Console/App.config b/Console/App.config
index deaa9e27..45437954 100644
--- a/Console/App.config
+++ b/Console/App.config
@@ -1,6 +1,6 @@
-
+
diff --git a/Console/GARbro.Console.csproj b/Console/GARbro.Console.csproj
index d645b9c8..e493e538 100644
--- a/Console/GARbro.Console.csproj
+++ b/Console/GARbro.Console.csproj
@@ -9,7 +9,7 @@
Properties
GARbro
GARbro.Console
- v4.6
+ v4.6.1
512
publish\
true
diff --git a/Experimental/Experimental.csproj b/Experimental/Experimental.csproj
index 82b6461f..297177f6 100644
--- a/Experimental/Experimental.csproj
+++ b/Experimental/Experimental.csproj
@@ -9,7 +9,7 @@
Properties
GameRes.Extra
ArcExtra
- v4.6
+ v4.6.1
512
@@ -49,16 +49,16 @@
MinimumRecommendedRules.ruleset
-
+
..\packages\Concentus.1.1.7\lib\portable-net45+win+wpa81+wp80\Concentus.dll
..\packages\Concentus.Oggfile.1.0.4\lib\net45\Concentus.Oggfile.dll
-
+
..\packages\MSFTCompressionCab.1.0.0\lib\Microsoft.Deployment.Compression.dll
-
+
..\packages\MSFTCompressionCab.1.0.0\lib\Microsoft.Deployment.Compression.Cab.dll
@@ -74,8 +74,8 @@
..\packages\System.Console.4.3.1\lib\net46\System.Console.dll
-
- ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net46\System.Data.SQLite.dll
+
+ ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.5\lib\net46\System.Data.SQLite.dll
@@ -105,8 +105,8 @@
..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll
-
- ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net46\System.Security.Cryptography.Algorithms.dll
+
+ ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll
..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll
@@ -114,8 +114,8 @@
..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll
-
- ..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net46\System.Security.Cryptography.X509Certificates.dll
+
+ ..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll
@@ -216,13 +216,15 @@ exit 0
-
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+
+
+