public void prepare(byte[] data) { UInt16 skipTbl = ByteHelper.READ_UINT16_LE(data); UInt16 txtData = ByteHelper.READ_UINT16_LE(data, 2); int ofs = 4; while (ofs < skipTbl) { blocksizes.Add(ByteHelper.READ_UINT16_LE(data, ofs)); ofs += 2; } ofs = skipTbl; for (int i = 0; i < blocksizes.Count + 1; i++) { int bc = 32; if (i == blocksizes.Count) { lastblksz = txtData - ofs; bc = lastblksz; } for (int j = 0; j < bc; j++) { // UInt16 b = data[ofs]; ofs++; // if ((b & 0x80) != 0) // { // b &= 0x7F; // b <<= 3; // } // skipBytes.Add(b); } } }
public FileHeader(byte[] bts) { buf = new byte[22]; Array.Copy(bts, buf, 22); flags = ByteHelper.READ_UINT16_LE(bts); x = ByteHelper.READ_UINT16_LE(bts, 2); y = ByteHelper.READ_UINT16_LE(bts, 4); width = ByteHelper.READ_UINT16_LE(bts, 6); height = ByteHelper.READ_UINT16_LE(bts, 8); sp_size = ByteHelper.READ_UINT16_LE(bts, 10); tot_size = ByteHelper.READ_UINT16_LE(bts, 12); n_sprites = ByteHelper.READ_UINT16_LE(bts, 14); offset_x = ByteHelper.READ_UINT16_LE(bts, 16); offset_y = ByteHelper.READ_UINT16_LE(bts, 18); compressed_size = ByteHelper.READ_UINT16_LE(bts, 20); }
private void normalizeBuf(byte bits) { while (bits > this.bitpos) { ushort num = 0; if ((this.pos + 1) == this.buf.Length) { num = this.buf[this.buf.Length - 1]; } else if (this.pos < this.buf.Length) { num = ByteHelper.READ_UINT16_LE(this.buf, this.pos); } this.pos += 2; this.bitbuf |= (uint)(num << this.bitpos); this.bitpos += 0x10; } }