コード例 #1
0
ファイル: ArcLINK.cs プロジェクト: zxc120/GARbro
        Stream DecryptAn21(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 + 0x21;
            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));
        }
コード例 #2
0
ファイル: ArcLINK.cs プロジェクト: zxc120/GARbro
        Stream DecryptImage(LinkArchive arc, LinkEntry entry, uint data_offset)
        {
            var    header = arc.File.View.ReadBytes(entry.Offset, data_offset);
            Stream body   = arc.File.CreateStream(entry.Offset + data_offset, entry.Size - data_offset);

            body = new ByteStringEncryptedStream(body, m_key);
            return(new PrefixStream(header, body));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
ファイル: ArcLINK.cs プロジェクト: zxc120/GARbro
        public Stream DecryptEntry(LinkArchive arc, LinkEntry entry)
        {
            var header = arc.File.View.ReadBytes(entry.Offset, 4);

            foreach (var type in m_type_table)
            {
                if (header.AsciiEqual(type.Item1))
                {
                    return(type.Item2(arc, entry));
                }
            }
            return(arc.File.CreateStream(entry.Offset, entry.Size));
        }
コード例 #5
0
        Stream DecryptAnm(LinkArchive arc, LinkEntry entry, IAnmReader reader)
        {
            var data  = arc.File.View.ReadBytes(entry.Offset, entry.Size);
            var input = new BinMemoryStream(data, entry.Name);
            var dir   = reader.GetFramesList(input);

            if (dir != null)
            {
                foreach (AnmEntry frame in dir)
                {
                    DecryptData(data, (int)frame.ImageDataOffset, (int)frame.ImageDataSize);
                }
            }
            input.Position = 0;
            return(input);
        }
コード例 #6
0
ファイル: ArcLINK.cs プロジェクト: zxc120/GARbro
        Stream DecryptAn00(LinkArchive arc, LinkEntry entry)
        {
            var data         = arc.File.View.ReadBytes(entry.Offset, entry.Size);
            int frame_offset = 0x18 + data.ToUInt16(0x14) * 4;
            int count        = data.ToUInt16(frame_offset);

            frame_offset += 10;
            for (int i = 0; i < count; ++i)
            {
                int w    = data.ToInt32(frame_offset);
                int h    = data.ToInt32(frame_offset + 4);
                int size = 4 * w * h;
                frame_offset += 8;
                DecryptData(data, frame_offset, size);
                frame_offset += size + 8;
            }
            return(new BinMemoryStream(data, entry.Name));
        }
コード例 #7
0
        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));
        }