Esempio n. 1
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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
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));
        }
Esempio n. 6
0
        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));
        }