def read(bd, row, recHeader): assert(recHeader.recordSize == 80) row.append(bd.read3F32()) # pos row.append(bd.read3F32()) # scl row.append(bd.read4F32()) # quat row.append(bd.read3F32()) # unk1? bboxMax? row.append(bd.readU32()) #unk2 expectValue(row[-1], 0, "format 0x0f has non-zero unk1") pass
def read(bd, row, recHeader): assert(recHeader.recordSize == 72) row.append(Key(bd)) # key - all .02c ? row.append(bd.read3F32()) # pos row.append(bd.read3F32()) # scl row.append(bd.read4F32()) # quat expectValue(row[1].typeId, 0x02c, "format 0x0c references {} instead .02c".format(row[1])) pass
def read(bd, row, recHeader): assert(recHeader.recordSize == 88) row.append(Key(bd)) # key - all .00d ? row.append(bd.read3F32()) # pos row.append(bd.read3F32()) # scl row.append(bd.read4F32()) # quat for i in range(4): row.append(bd.readU32()) # expectValue(row[-1], 0, "format 0x0d has non-zero at the end") expectValue(row[1].typeId, 0x00d, "format 0x0d references {} instead .00d".format(row[1])) pass
def read(bd, row, recHeader): assert(recHeader.recordSize >= 88) valuesCount = bd.readU32() assert(valuesCount >= 1) row.append(valuesCount) row.append(bd.readU32()) # unk1 expectValue(row[-1], 0, "format 0a") row.append(bd.readU32()) # unk2 expectValue(row[-1], 24, "format 0a") valuesSize1 = bd.readU32() valuesSize2 = bd.readU32() expectValue(valuesSize1, valuesSize2, "format 0a, unexpected sizes") row.append(valuesSize1) row.append(valuesSize2) row.append(bd.readU32()) # unk3 expectValue(row[-1], 1, "format 0a") # values = row values = [] for i in range(valuesCount): value = [] value.append(bd.read4F32()) # quat value.append(bd.read3F32()) # pos value.append(bd.read3F32()) # scl? always positive? values.append(value) row.append(values)
def read(bd, row, recHeader): assert(recHeader.recordSize == 96) columnCount = 96 // 4 # def, keyMdl, keyMtl, scl?, pos, quat, unk_4u32 row.append(Key(bd)) # keyRef00c row.append(Key(bd)) # keyRef01a row.append(bd.read3F32()) # pos row.append(bd.read3F32()) # scl row.append(bd.read4F32()) # quat row.extend(bd.read4U32()) # unk 4 u32 expectValue(row[1].typeId, 0x00c, "format 0x02 or 0x08 references {} instead .00c".format(row[1])) expectValue(row[2].typeId, 0x01a, "format 0x0c or 0x08 references {} instead .01a".format(row[2]))
def readRecords0BC_format_12(bd, context): print('readRecords0BC_format_12') tab = [] for i in range(context.header.countRecords): row = [] row.append(bd.readHex(16)) row.append(Key(bd)) expectValue(row[-1].typeId, 0x055, "format 0x12 references {} instead .055".format(row[-1])) tab.append(row) print(tabulate(tab, floatfmt='.6')) pass
def read(bd, row, recHeader): assert(recHeader.recordSize == 88) # placements of scripts/voice lines/localization closed captions? for i in range(4): row.append(bd.readF32()) # unk0 row.append(bd.read3F32()) # pos row.append(bd.readU32()) # unk1 expectValue(row[-1], 0, "format 07, unk1") row.append(Key(bd)) # key1, reference .0a9 row.append(Key(bd)) # key2, reference .0aa row.append(Key(bd)) # key3, reference .008 row.append(bd.readF32()) # unk2 row.append(bd.readU32()) # unk3 expectValue(row[-1], 0, "format 07, unk3")
def read(bd, row, recHeader): assert(recHeader.recordSize >= 120) row.append(Key(bd)) # key - all .003? expectValue(row[-1].typeId, 0x003, "format 0x0B references {} instead .003".format(row[1])) row.append(bd.read3F32()) # pos row.append(bd.read3F32()) # scl row.append(bd.read4F32()) # quat row.append(bd.readU32()) # extraCount extraCount = row[-1] assert(extraCount >= 0) if bd.tell() - recHeader.recordStartOffset != 76: print(bd.tell() - recHeader.recordStartOffset) print(tabulate([row])) assert((bd.tell() - recHeader.recordStartOffset) == 76) for i in range(0, 11): row.append(bd.readU32()) # unk for i in range(extraCount): row.append(bd.readU32()) # unk1 row.append(bd.readU32()) # unk2 pass
def read(bd, row, recHeader): assert(recHeader.recordSize == 192) row.append(bd.read3F32()) # pos row.append(bd.read3F32()) # scl row.append(bd.read4F32()) # quat row.append(bd.read3F32()) # pos2? row.append(bd.read3F32()) # scl2? row.append(bd.read4F32()) # quat2? row.append(bd.read3F32()) # unk, bboxMax? row.append(bd.readU32()) # unk2 expectValue(row[-1], 0, "format 04, unk2") row.append(Key(bd)) # key1, reference .004 expectValue(row[-1].typeId, 0x004, "format 04 key1 reference to {}".format(row[-1])) row.append(Key(bd)) # key2, referemce .004 expectValue(row[-1].typeId, 0x004, "format 04 key2 reference to {}".format(row[-1])) row.append(bd.readU32()) # unk3 row.append(bd.readU32()) # unk4 for i in range(7): row.append(bd.readF32()) # unk5 for i in range(5): row.append(bd.readI32()) # unk6
def read(bd, row, recHeader): def r(lf): # return tuple(round(f,4) for f in lf) return lf assert(recHeader.recordSize >= 160) recordEndOffset = recHeader.recordStartOffset + recHeader.recordSize print('recordStartOffset =', recHeader.recordStartOffset) print('recordEndOffset =', recordEndOffset) tmp = [] row.append(Key(bd)) # keyRef00c, reference to .00c row.append(bd.readU32()) # groupsCount groupsCount = row[-1] row.append(bd.readU32()) # totalGroupRecordsCount totalGroupRecordsCount = row[-1] row.append(bd.readHex(4)) # unk bitmask row.append(bd.read2F32()) # unkFloats1, big range row.append(bd.readU32()) # unk expectValue(row[-1], 0, 'Format_01 unk is not zero') # 56 # print(bd.tell() - recHeader.recordStartOffset) groupRecordsCountSoFar = 0 def readGroupObjectRecord(bd, records): rec = [] rec.append(r(bd.read3F32())) # pos rec.append(r(bd.read3F32())) # scl rec.append(r(bd.read4F32())) # quat for i in range(7): rec.append(bd.readHex(4)) # unkBitmask # for i in range(7): rec.append(bd.readF32()) # unkBitmask for i in range(5): rec.append(bd.readI32()) # unkInts records.append(rec) def readGroup(bd): group = [] groupStartOffset = bd.tell() group.append(Key(bd)) # keyRef01a reference to .01a group.append(bd.readU32()) # groupSizeBytes groupSizeBytes = group[-1] group.append(bd.readU32()) # groupRecordsCount groupRecordsCount = group[-1] nonlocal groupRecordsCountSoFar assert(groupRecordsCountSoFar <= totalGroupRecordsCount) assert(groupRecordsCountSoFar + groupRecordsCount <= totalGroupRecordsCount) groupRecordsCountSoFar += groupRecordsCount records = [] for i in range(groupRecordsCount): readGroupObjectRecord(bd, records) assert(bd.tell() == groupStartOffset + groupSizeBytes) print(tabulate([group,], floatfmt='.6')) print(tabulate(records, floatfmt='.6')) group.append(records) return group print(tabulate([row,], floatfmt='.6')) groups = [] for i in range(groupsCount): group = readGroup(bd) groups.append(group) row.append(groups) # print('groupRecordsCountSoFar =', groupRecordsCountSoFar) # print('after groups =', bd.tell()) assert(groupRecordsCountSoFar == totalGroupRecordsCount) assert(bd.tell() == recordEndOffset) bd.seekSet(recordEndOffset) pass