コード例 #1
0
        public IList <DdrPs2FileDataTableEntry> Decode(DdrPs2FileDataTableChunk chunk)
        {
            var data        = chunk.Data;
            var result      = new List <DdrPs2FileDataTableEntry>();
            var stream      = new MemoryStream(data);
            var offsets     = MemoryMarshal.Cast <byte, int>(data.AsSpan(0, data.Length / 4 * 4));
            var offsetCount = offsets.Length;

            for (var i = 0; i < offsetCount; i++)
            {
                var newCount = offsets[i] / 4;
                if (newCount < offsetCount)
                {
                    offsetCount = newCount;
                }
            }

            for (var i = 0; i < offsetCount; i++)
            {
                stream.Position = offsets[i] + (chunk.HasHeaders ? 0xC : 0x0);

                result.Add(new DdrPs2FileDataTableEntry
                {
                    Index = i,
                    Data  = _bemaniLzDecoder.Decode(stream)
                });
            }

            return(result);
        }
コード例 #2
0
        public IList <DdrPs2FileDataTableEntry> Decode(DdrPs2FileDataTableChunk chunk)
        {
            var data    = chunk.Data;
            var result  = new List <DdrPs2FileDataTableEntry>();
            var stream  = new MemoryStream(data);
            var offsets = MemoryMarshal.Cast <byte, int>(data.AsSpan(0, data.Length / 4 * 4));
            var count   = offsets[0];

            for (var i = 0; i < count; i++)
            {
                var offset = offsets[i + 1];
                var length = offsets[i + 1 + count];
                stream.Position = offset;
                result.Add(new DdrPs2FileDataTableEntry
                {
                    Index = i,
                    Data  = _bemaniLzDecoder.Decode(stream)
                });
            }

            return(result);
        }