public override void Read(EndianBinReader reader) { var pageNameOffset = _gt7 ? reader.ReadInt64() : reader.ReadUInt32(); var pairUnitCount = reader.ReadUInt32(); reader.ReadUInt32(); // Unk var pairUnitOffset = _gt7 ? reader.ReadInt64() : reader.ReadUInt32(); reader.BaseStream.Position = (int)pageNameOffset; Name = reader.ReadNullTerminatedString(); for (int i = 0; i < pairUnitCount; i++) { reader.BaseStream.Position = pairUnitOffset + (i * (_gt7 ? EntrySizeGT7 : EntrySize)); int id = reader.ReadInt32(); ushort labelLen = reader.ReadUInt16(); ushort valueLen = reader.ReadUInt16(); long labelOffset = _gt7 ? reader.ReadInt64() : reader.ReadUInt32(); long valueOffset = _gt7 ? reader.ReadInt64() : reader.ReadUInt32(); reader.BaseStream.Position = labelOffset; string label = ReadString(reader, labelLen); reader.BaseStream.Position = valueOffset; string value = ReadString(reader, valueLen); var pair = new RTextPairUnit(id, label, value); PairUnits.Add(label, pair); } }
private FileInfoBTree[] LoadFileInfoBTree(EndianBinReader reader, uint offset) { reader.BaseStream.Seek(offset, System.IO.SeekOrigin.Begin); byte childCount = reader.ReadByte(); uint childOffset = reader.Read3BytesUInt32(); uint nodeCount = reader.ReadUInt16(); uint dataOffset = offset + 4 + 2; var objects = new FileInfoBTree[0]; uint indexer = 0; for (int i = 0; i < nodeCount; i++) { uint keyCount = (ushort)(Util.ExtractTwelveBits(reader, dataOffset, 0) & 0x7FF); uint nextNodeDataOffset = (ushort)(Util.ExtractTwelveBits(reader, dataOffset, (ushort)(keyCount + 1))); Array.Resize(ref objects, (int)(objects.Length + keyCount)); for (int j = 0; j < keyCount; j++) { uint nodeOffset = Util.ExtractTwelveBits(reader, dataOffset, (uint)j + 1); var tmpOffset = (dataOffset + nodeOffset); objects[indexer] = new FileInfoBTree(reader, ref tmpOffset); indexer++; } dataOffset += nextNodeDataOffset; } return(objects); }
public static ushort ExtractTwelveBits(EndianBinReader reader, uint ptr_data, uint offset) { reader.BaseStream.Seek((int)(ptr_data + (offset * 16 - offset * 4) / 8), SeekOrigin.Begin); ushort result = reader.ReadUInt16(); if ((offset & 0x1) == 0) { result /= 16; } return((ushort)(result & 0xFFF)); }
public static ushort ExtractTwelveBits(EndianBinReader reader, uint offset) { reader.BaseStream.Position += ((offset * 16 - offset * 4) / 8); ushort result = reader.ReadUInt16(); if ((offset & 0x1) == 0) { result /= 16; } return((ushort)(result & 0xFFF)); }
private void LoadFileIDBTree(EndianBinReader reader, ref FileIDBTree[] objects, uint offset) { uint childOffset = 0; uint nodeCount = 0; uint ptrNodeData = 0; reader.BaseStream.Seek(offset, System.IO.SeekOrigin.Begin); byte childCount = reader.ReadByte(); childOffset = reader.Read3BytesUInt32() + offset; nodeCount = reader.ReadUInt16(); ptrNodeData = (uint)reader.BaseStream.Position; if (objects == null) { objects = new FileIDBTree[0]; } uint indexer = (uint)objects.Length; for (int i = 0; i < nodeCount; i++) { uint keyCount = (ushort)(Util.ExtractTwelveBits(reader, ptrNodeData, 0) & 0x7FF); uint nextNodeDataOffset = (ushort)(Util.ExtractTwelveBits(reader, ptrNodeData, (ushort)(keyCount + 1))); Array.Resize(ref objects, (int)(objects.Length + keyCount)); for (int j = 0; j < keyCount; j++) { uint nodeOffset = Util.ExtractTwelveBits(reader, ptrNodeData, (uint)j + 1); var tmpOffset = (ptrNodeData + nodeOffset); objects[indexer] = new FileIDBTree(reader, ref tmpOffset); indexer++; } ptrNodeData += nextNodeDataOffset; } }