#!/usr/bin/env python3 """Census: per PATCH, list the exact chunk sequence (vertex chunks 0x80-0x8A, face chunks 0x47/0x4d, specials 0x2037, material 0x2030) to learn how many dpl_GEOMETRY objects the 1995 loader creates for a PUNCH-tagged geogroup and in what list order. The i860 damageize handler (VREND.MNG @f040f6f8) writes the three vr_damage tokens into the FIRST THREE geometries' geometry_type -- so the punch triple only functions if the patch has >=3 geometry chunks.""" import struct, sys VSTRIDE = {0x80:12, 0x81:24, 0x82:28, 0x88:20, 0x89:32, 0x8A:36} CONTAINERS = {0x40,0x41,0x42,0x46,0x48,0x70,0x10,0x20,0x30,0x3} def census(path): d = open(path,"rb").read() out = [] def read_chunk(p, end): if p+2 > end: return None tw = struct.unpack_from(" end: return None if lw==1: ln = d[p+2] elif lw==2: ln = struct.unpack_from("