From 3eea7bb5dfe84f8c5b1afb28738f3cd8092ff103 Mon Sep 17 00:00:00 2001 From: morkt Date: Mon, 12 Sep 2016 01:27:29 +0400 Subject: [PATCH] implemented ScrPlayer 'pack' archives and IMG2 images. --- ArcFormats/ArcFormats.csproj | 7 + ArcFormats/ScrPlayer/ArcPAK.cs | 70 +++++ ArcFormats/ScrPlayer/ColorBitsTable1 | Bin 0 -> 2048 bytes ArcFormats/ScrPlayer/ColorBitsTable2 | Bin 0 -> 2048 bytes ArcFormats/ScrPlayer/ControlTable1 | Bin 0 -> 16384 bytes ArcFormats/ScrPlayer/ControlTable2 | Bin 0 -> 16384 bytes ArcFormats/ScrPlayer/ControlTable32 | Bin 0 -> 1024 bytes ArcFormats/ScrPlayer/ImageI.cs | 404 +++++++++++++++++++++++++++ 8 files changed, 481 insertions(+) create mode 100644 ArcFormats/ScrPlayer/ArcPAK.cs create mode 100644 ArcFormats/ScrPlayer/ColorBitsTable1 create mode 100644 ArcFormats/ScrPlayer/ColorBitsTable2 create mode 100644 ArcFormats/ScrPlayer/ControlTable1 create mode 100644 ArcFormats/ScrPlayer/ControlTable2 create mode 100644 ArcFormats/ScrPlayer/ControlTable32 create mode 100644 ArcFormats/ScrPlayer/ImageI.cs diff --git a/ArcFormats/ArcFormats.csproj b/ArcFormats/ArcFormats.csproj index eb8ea731..e7ec450d 100644 --- a/ArcFormats/ArcFormats.csproj +++ b/ArcFormats/ArcFormats.csproj @@ -195,6 +195,8 @@ + + @@ -594,6 +596,11 @@ + + + + + diff --git a/ArcFormats/ScrPlayer/ArcPAK.cs b/ArcFormats/ScrPlayer/ArcPAK.cs new file mode 100644 index 00000000..30d36e3a --- /dev/null +++ b/ArcFormats/ScrPlayer/ArcPAK.cs @@ -0,0 +1,70 @@ +//! \file ArcPAK.cs +//! \date Sat Sep 10 16:00:06 2016 +//! \brief ScrPlayer resource archive. +// +// Copyright (C) 2016 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.Collections.Generic; +using System.ComponentModel.Composition; + +namespace GameRes.Formats.ScrPlayer +{ + [Export(typeof(ArchiveFormat))] + public class PakOpener : ArchiveFormat + { + public override string Tag { get { return "PAK/ScrPlayer"; } } + public override string Description { get { return "ScrPlayer engine resource archive"; } } + public override uint Signature { get { return 0x6B636170; } } // 'pack' + public override bool IsHierarchic { get { return false; } } + public override bool CanCreate { get { return false; } } + + public override ArcFile TryOpen (ArcView file) + { + uint index_size = file.View.ReadUInt32 (4); + if (index_size < 0x10 || index_size >= file.MaxOffset) + return null; + + uint index_offset = 8; + uint index_end = index_offset + index_size; + var dir = new List(); + while (index_offset < index_end) + { + uint offset = file.View.ReadUInt32 (index_offset); + if (0 == offset) + break; + uint size = file.View.ReadUInt32 (index_offset+4); + byte name_length = file.View.ReadByte (index_offset+8); + var name = file.View.ReadString (index_offset+9, name_length); + index_offset += ((9u + name_length) & ~7u) + 8u; + if (index_offset > index_end) + return null; + var entry = FormatCatalog.Instance.Create (name); + entry.Offset = offset; + entry.Size = size; + dir.Add (entry); + } + if (0 == dir.Count) + return null; + return new ArcFile (file, this, dir); + } + } +} diff --git a/ArcFormats/ScrPlayer/ColorBitsTable1 b/ArcFormats/ScrPlayer/ColorBitsTable1 new file mode 100644 index 0000000000000000000000000000000000000000..33b25cd0398c2e1b562916a4930e1a41693ada7e GIT binary patch literal 2048 zcmdUu#}2|U5Cs!lHZi^T-h1!;|9=V)PQb_#k&F+VS5KqSXxR#58bpRQ!UQ8^(g0z^ zLI(EHD2*VKP>jhH83dkps{=VmKkmd&Y-B?Gz7HV-Qv6sU10tzO8Pb?@~*N)ErMwG7u@x=Le)8WPVpD})cuuG|Mx}q|C{~44f_9U`+phqFYWz*E#dvY4*Hk&{=fgWi(^}|=49zpX6J0J zSI@tBd0vS}a=GyMzrQis1nM%f4eD2svt~_u8C{?*FSJUk zoD-v}S(Dz8gHU&le1Q5S*#-4iV=278l+-rs$o%;GjRoWi)WyaTIFA`cP?s5Pp|<)P zg~ku4OIUmJoLoxu?*sK9y4pOa=i~iJJ*)pw(gx1ElHKtBQewdMt^U#btS;2WWDlIj z*n6nU=s>8g{^WptemYC`r>D%<)0fu#SFQQa#QXE#w7PjtKFaxNL%4qV{NJHYdwvpu ze%)k$G6SwZk!>|UFF9w;Ul8w4Ta)H+UX3@7&rjPyKRN$2r2lj{Ptu>?u+NY5-!A`m-hU6U>{?pSFt6Pv4}{pVgQ5pD#CGPnRX>f5_7R zCfyI8H=#dU2-kP0Ka0x#QhzE``iqtc{V!Vj)BpQNXCwVJ=U)tg`-%0>j{mW24cw1} z{%kwcF7eN{c*cKEmHy@Yvs;$_cK-Jv{gwQ)X3qF$JG|ka&CQH|UMD;Ld4I{DxNCl2 zD&n8LP3E5;hVPeC{vXT!srl!NCI4)aihnTz>90BeF8lwm9Q*%s&-kyz|3xh&{~eM3 zO8&(?XZ-Ui-taF*X2!pB{}+u?@h=`G^Y5+y^A3`KUQ@+?^g7aCbN=~h^M1Sa|37aK zaQ~lx^jGqqxBfpMOaFf%{g*#Y#lOP;S9$9HlO_KZ`2Sj@zvleA?Ejy0?Ekvw|4~SP zCI7z3|LeT=f6ep%ZOK1Z=l{`2f6e(9o89z((Kq1!KMv`yj|E}i$pGf~;`G3&!f6({;b8_tey6692>GAKI{2%WB?fJj5{eKIjzvliQ?*Co& z|9(jSVEMoE{O|Am|2w3==KQ<7|9_BU|JNt~tM~uUkp4>k!~K7S`QP9Be~$Fmoc}QY WyXybrk^V~l!~MUVf1W4L|NjM9`sb$r literal 0 HcmV?d00001 diff --git a/ArcFormats/ScrPlayer/ControlTable2 b/ArcFormats/ScrPlayer/ControlTable2 new file mode 100644 index 0000000000000000000000000000000000000000..d8315d66ed030ce80e750be5569f075cd029bb62 GIT binary patch literal 16384 zcmeHOWs~DD487}a1BPSVqaHIeGcz+YGcz+Y{Mc*abhC=JZqm%Axf^}#bQDRJpP!#) z^KDkYLaAY3v9mp@P-+}d?A18P|J~niS18%t#JOTm@3+f}L;U{-tN*PgXJVn`&b5YG z!<4-<0oq&b3ni-y->K}a-q4=!wuYC#KgJ$W@h@ⅆ3rM`*YkW%3fT9_EwWUx=>fg)X;h}$i7}}fj=X?G9C$oj-{MiEK-<=-y@714e3jO2tXRGl1-5JsR z`9T=Jmp|LcmMDAXM*VyFyH4nzAALc>cnU z;-Bw_@k9KJTUh;x|3mzVhj9GN_2+v6{O5=NC5+#ze60?YWn|lQ2(~q|94^h5&l1q)t~r3T>nV_!}()g z|FYu$1p5Czj6Wm(zgj2$*Yv-*r{`ad|HadA{uBSh@iWi=xcr}5|DQ?4|D^xppa14l z|66$dUT|Ni+$)&5V~^MCmkpZ|#d{{ZWk5&xg6 z6aSO`kMuuTF3-zNCauK)iT#-EY?r~be3{&R-+e{-q-ssFFmZ(aY%pE=Y2U*Y;;-v7kb z|J45{{qMd1z|a5a{(tlPm(=(Fss9h(AC>QaQvW~x`=6ZZf9n7H{1JWshUmZl^ZtKp z{r@)!`~NSo{tw;%3(r5P|DR<48~gk(rT&+%;-3G=_b~p9^gs3gN&g$(f6M1;{>= count; + m_cached_bits -= count; + return table[n + 1]; + } + + public int PeekBits (int count) + { + while (m_cached_bits < count) + { + int b = m_input.ReadByte(); + if (-1 == b) + return -1; + m_bits |= b << m_cached_bits; + m_cached_bits += 8; + } + return m_bits & ((1 << count) - 1); + } + } + + internal sealed class Img2Reader : IDisposable + { + Img2BitStream m_input; + byte[] m_output; + int m_width; + int m_height; + int m_stride; + bool m_has_alpha; + + public byte[] Data { get { return m_output; } } + public PixelFormat Format { get; private set; } + + public Img2Reader (Stream input, ImageMetaData info) + { + m_input = new Img2BitStream (input, true); + m_width = (int)info.Width; + m_height = (int)info.Height; + m_stride = m_width * 4; + m_output = new byte[m_stride * m_height]; + m_has_alpha = 32 == info.BPP; + Format = m_has_alpha ? PixelFormats.Bgra32 : PixelFormats.Bgr32; + } + + public void Unpack () + { + m_input.Input.Position = 0x20; + if (m_has_alpha) + Unpack32bpp(); + else + Unpack24bpp(); + } + + void Unpack24bpp () + { + var rows = new int[3]; + var offset_table = OffsetTable.Clone() as int[]; + for (int y = 0; y < m_height; ++y) + { + int dst = rows[0]; + for (int x = 0; x < m_width; ) + { + int ctl = m_input.GetBits (ControlTable1, 13); + if (0xB8 == ctl) + ctl += m_input.GetBits (ControlTable2, 13); + + int pos = m_input.GetBits (PosTable24, 6) * 2; + int x_offset = offset_table[pos]; + int y_offset = offset_table[pos + 1]; + if (pos > 0) + { + offset_table[pos] = offset_table[pos-2]; + offset_table[pos+1] = offset_table[pos-1]; + offset_table[pos-2] = x_offset; + offset_table[pos-1] = y_offset; + } + + int src = rows[y_offset] + (x + x_offset) * 4; + if (ctl >= 0xD8) + { + int count = ctl - 0xD6; + Binary.CopyOverlapped (m_output, src, dst, count * 4); + dst += count * 4; + x += count; + } + else + { + for (int j = 2; j >= 0; --j) + { + byte r = RgbBits[j,ctl]; + if (0xFD == r) + r = GetDelta (DeltaTable); + + m_output[dst+j] = (byte)(m_output[src+j] - r); + } + dst += 4; + ++x; + } + } + rows[2] = rows[1]; + rows[1] = rows[0]; + rows[0] += m_stride; + } + } + + void Unpack32bpp () + { + for (int i = 3; i < m_stride; i += 4) + m_output[i] = 0xFF; + var rows = new int[3]; + var offset_table = OffsetTable.Clone() as int[]; + for (int y = 0; y < m_height; ++y) + { + int dst = rows[0]; + for (int x = 0; x < m_width; ) + { + int ctl = m_input.GetBits (ControlTable1, 13); + if (0xB8 == ctl) + ctl += m_input.GetBits (ControlTable2, 13); + + int t = m_input.GetBits (ControlTable32, 9) * 2; + int pos = PosTable32[t] * 2; + bool diff_alpha = PosTable32[t + 1] != 0; + + int x_offset = offset_table[pos]; + int y_offset = offset_table[pos + 1]; + if (pos > 0) + { + offset_table[pos] = offset_table[pos-2]; + offset_table[pos+1] = offset_table[pos-1]; + offset_table[pos-2] = x_offset; + offset_table[pos-1] = y_offset; + } + + int src = rows[y_offset] + (x + x_offset) * 4; + if (ctl >= 0xD8) + { + int count = ctl - 0xD6; + Binary.CopyOverlapped (m_output, src, dst, count * 4); + dst += count * 4; + x += count; + } + else + { + for (int j = 2; j >= 0; --j) + { + byte r = RgbBits[j,ctl]; + if (0xFD == r) + r = GetDelta (DeltaTable); + + m_output[dst+j] = (byte)(m_output[src+j] - r); + } + byte alpha = 0; + if (diff_alpha) + alpha = GetDelta (AlphaTable); + + m_output[dst+3] = (byte)(m_output[src+3] - alpha); + dst += 4; + ++x; + } + } + rows[2] = rows[1]; + rows[1] = rows[0]; + rows[0] += m_stride; + } + } + + byte GetDelta (byte[] table) + { + int delta = m_input.GetBits (ColorBitsTable1, 10); + if (0x41 == delta) + delta += m_input.GetBits (ColorBitsTable2, 10); + return table[delta]; + } + + static byte[] LoadResource (string name) + { + var type = typeof(Img2Reader); + var assembly = type.Assembly; + using (var stream = assembly.GetManifestResourceStream (type.Namespace+'.'+name)) + { + if (null == stream) + return null; + var data = new byte[stream.Length]; + stream.Read (data, 0, data.Length); + return data; + } + } + + #region IDisposable Members + bool _disposed = false; + public void Dispose () + { + if (!_disposed) + { + m_input.Dispose(); + _disposed = true; + } + } + #endregion + + #region Bitmap tables + static readonly Lazy s_control_table1 = new Lazy (() => LoadResource ("ControlTable1")); + static readonly Lazy s_control_table2 = new Lazy (() => LoadResource ("ControlTable2")); + static readonly Lazy s_control_table32 = new Lazy (() => LoadResource ("ControlTable32")); + static readonly Lazy s_color_bits1 = new Lazy (() => LoadResource ("ColorBitsTable1")); + static readonly Lazy s_color_bits2 = new Lazy (() => LoadResource ("ColorBitsTable2")); + + static byte[] ControlTable1 { get { return s_control_table1.Value; } } + static byte[] ControlTable2 { get { return s_control_table2.Value; } } + static byte[] ControlTable32 { get { return s_control_table32.Value; } } + static byte[] ColorBitsTable1 { get { return s_color_bits1.Value; } } + static byte[] ColorBitsTable2 { get { return s_color_bits2.Value; } } + + static readonly byte[] PosTable24 = { + 0x01, 0x00, 0x06, 0x07, 0x01, 0x00, 0x06, 0x09, 0x01, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x02, + 0x01, 0x00, 0x04, 0x03, 0x01, 0x00, 0x04, 0x04, 0x01, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x02, + 0x01, 0x00, 0x05, 0x05, 0x01, 0x00, 0x05, 0x06, 0x01, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x02, + 0x01, 0x00, 0x04, 0x03, 0x01, 0x00, 0x04, 0x04, 0x01, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x02, + 0x01, 0x00, 0x06, 0x08, 0x01, 0x00, 0x06, 0x0A, 0x01, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x02, + 0x01, 0x00, 0x04, 0x03, 0x01, 0x00, 0x04, 0x04, 0x01, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x02, + 0x01, 0x00, 0x05, 0x05, 0x01, 0x00, 0x05, 0x06, 0x01, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x02, + 0x01, 0x00, 0x04, 0x03, 0x01, 0x00, 0x04, 0x04, 0x01, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x02, + }; + static readonly int[] PosTable32 = { + 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, + 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1 + }; + static readonly byte[] DeltaTable = { + 0x03, 0xFD, 0x04, 0xFC, 0x05, 0xFB, 0x06, 0xFA, 0x07, 0xF9, 0x08, 0xF8, 0x09, 0xF7, 0x0A, 0xF6, + 0x0B, 0xF5, 0x0C, 0xF4, 0x0D, 0xF3, 0x0E, 0xF2, 0x0F, 0xF1, 0x10, 0xF0, 0x11, 0xEF, 0x12, 0xEE, + 0x13, 0xED, 0x14, 0xEC, 0x15, 0xEB, 0x16, 0xEA, 0x17, 0xE9, 0x18, 0xE8, 0x19, 0xE7, 0x1A, 0xE6, + 0x1B, 0xE5, 0x1C, 0xE4, 0x1D, 0xE3, 0x1E, 0xE2, 0x1F, 0xE1, 0x20, 0xE0, 0x21, 0xDF, 0x22, 0xDE, + 0x23, 0xDD, 0x24, 0xDC, 0x25, 0xDB, 0x26, 0xDA, 0x27, 0xD9, 0x28, 0xD8, 0x29, 0xD7, 0x2A, 0xD6, + 0x2B, 0xD5, 0x2C, 0xD4, 0x2D, 0xD3, 0x2E, 0xD2, 0x2F, 0xD1, 0x30, 0xD0, 0x31, 0xCF, 0x32, 0xCE, + 0x33, 0xCD, 0x34, 0xCC, 0x35, 0xCB, 0x36, 0xCA, 0x37, 0xC9, 0x38, 0xC8, 0x39, 0xC7, 0x3A, 0xC6, + 0x3B, 0xC5, 0x3C, 0xC4, 0x3D, 0xC3, 0x3E, 0xC2, 0x3F, 0xC1, 0x40, 0xC0, 0x41, 0xBF, 0x42, 0xBE, + 0x43, 0xBD, 0x44, 0xBC, 0x45, 0xBB, 0x46, 0xBA, 0x47, 0xB9, 0x48, 0xB8, 0x49, 0xB7, 0x4A, 0xB6, + 0x4B, 0xB5, 0x4C, 0xB4, 0x4D, 0xB3, 0x4E, 0xB2, 0x4F, 0xB1, 0x50, 0xB0, 0x51, 0xAF, 0x52, 0xAE, + 0x53, 0xAD, 0x54, 0xAC, 0x55, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0xA8, 0x59, 0xA7, 0x5A, 0xA6, + 0x5B, 0xA5, 0x5C, 0xA4, 0x5D, 0xA3, 0x5E, 0xA2, 0x5F, 0xA1, 0x60, 0xA0, 0x61, 0x9F, 0x62, 0x9E, + 0x63, 0x9D, 0x64, 0x9C, 0x65, 0x9B, 0x66, 0x9A, 0x67, 0x99, 0x68, 0x98, 0x69, 0x97, 0x6A, 0x96, + 0x6B, 0x95, 0x6C, 0x94, 0x6D, 0x93, 0x6E, 0x92, 0x6F, 0x91, 0x70, 0x90, 0x71, 0x8F, 0x72, 0x8E, + 0x73, 0x8D, 0x74, 0x8C, 0x75, 0x8B, 0x76, 0x8A, 0x77, 0x89, 0x78, 0x88, 0x79, 0x87, 0x7A, 0x86, + 0x7B, 0x85, 0x7C, 0x84, 0x7D, 0x83, 0x7E, 0x82, 0x7F, 0x81, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + static readonly byte[] AlphaTable = { + 0x01, 0xFF, 0x02, 0xFE, 0x03, 0xFD, 0x04, 0xFC, 0x05, 0xFB, 0x06, 0xFA, 0x07, 0xF9, 0x08, 0xF8, + 0x09, 0xF7, 0x0A, 0xF6, 0x0B, 0xF5, 0x0C, 0xF4, 0x0D, 0xF3, 0x0E, 0xF2, 0x0F, 0xF1, 0x10, 0xF0, + 0x11, 0xEF, 0x12, 0xEE, 0x13, 0xED, 0x14, 0xEC, 0x15, 0xEB, 0x16, 0xEA, 0x17, 0xE9, 0x18, 0xE8, + 0x19, 0xE7, 0x1A, 0xE6, 0x1B, 0xE5, 0x1C, 0xE4, 0x1D, 0xE3, 0x1E, 0xE2, 0x1F, 0xE1, 0x20, 0xE0, + 0x21, 0xDF, 0x22, 0xDE,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 0x83, 0x7E, 0x82, 0x7F, 0x81, 0x80, 0x00, + }; + static readonly byte[,] RgbBits = { + { + 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, + 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, + 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, + 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, + 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, + 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, + 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, + 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, + 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, + 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, + 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, + 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, + 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, + 0x01, 0x02, 0xFD, 0xFE, 0xFF, 0x00, 0x01, 0x02, + }, + { + 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xFD, 0xFD, 0xFD, 0xFD, + 0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 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F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + } + }; + static readonly int[] OffsetTable = { + -1, 0, 0, 1, 1, 1, -1, 1, 2, 1, -2, 1, -2, 0, 0, 2, 1, 2, -1, 2, -3, 0, + }; + #endregion + } +}