Beispiel #1
0
        public override void Load(byte[] buffer, uint offset = 0)
        {
            if (buffer.Length - offset <= 4)
            {
                return;
            }
            clut = new Cluts();
            MemoryStream ms;

            using (BinaryReader br = new BinaryReader(ms = new MemoryStream(buffer)))
            {
                ms.Seek(offset, SeekOrigin.Begin);//unknown
                Unknown = br.ReadBytes(4);
                foreach (byte i in Enumerable.Range(0, 16))
                {
                    Color[] colors = new Color[16];
                    foreach (byte c in Enumerable.Range(0, 16))
                    {
                        colors[c] = ABGR1555toRGBA32bit(br.ReadUInt16());
                    }
                    clut.Add(i, colors);
                }

                long size = ms.Length - ms.Position;
                height      = checked ((int)(size / 128));
                width       = checked ((int)(size / height));
                this.buffer = br.ReadBytes(checked ((int)size));
            }
        }
Beispiel #2
0
        public void Load(byte[] buffer, uint offset = 0)
        {
            if (buffer.Length - offset <= 4)
            {
                return;
            }
            _clut = new Cluts();
            MemoryStream ms;

            using (var br = new BinaryReader(ms = new MemoryStream(buffer)))
            {
                ms.Seek(offset, SeekOrigin.Begin);//unknown
                Unknown = br.ReadBytes(4);
                foreach (var i in Enumerable.Range(0, 16))
                {
                    var colors = Enumerable.Range(0, 16).Select(_ => (IColorData) new ColorABGR1555(br.ReadUInt16()))
                                 .ToArray();
                    _clut.Add((byte)i, colors);
                }

                var size = ms.Length - ms.Position;
                GetHeight = checked ((int)(size / 128));
                GetWidth  = checked ((int)(size / GetHeight));
                _buffer   = br.ReadBytes(checked ((int)size));
            }
        }