#!/usr/bin/env python3 """ decode_anim.py -- full decode of the live animation stream (action 0x1d) plus the scene-graph edges, from a framed capture of a FLYK.EXE run. Answers, from capture.raw.bin: 1. exact 0x1d record layout + which handles it animates 2. the scene-graph edges (dcs_link/list_add/dcs_nest) -> who is the VIEW's DCS 3. creates in wire order (to map handles -> SHARKS.SCN entities by order) 4. per-frame trajectories of the animated handles (draw_scene = frame boundary) python decode_anim.py [capture.raw.bin] """ import sys, struct from collections import Counter, defaultdict from vrboard import Assembler, A TYPE = {2:'zone',3:'view',4:'instance',5:'dcs',6:'lmodel',7:'light',8:'object', 9:'lod',10:'geogroup',11:'geometry',12:'material',13:'texmap',14:'texture',15:'ramp'} def find_framed_start(data): for i in range(80000, len(data)-8): w = struct.unpack_from(' 1 else "capture.raw.bin" data = open(path, "rb").read() start = find_framed_start(data) asm = Assembler(); asm.feed(data[start:]) creates = [] # (handle, type) in wire order flushes = defaultdict(list) # handle -> [body bytes] edges = [] # (op, a, b) in wire order anim = [] # (frame, handle, w1, 12 floats) for 0x1d op1c = [] frame = 0 for m in asm: if m.iserver: continue a, p = m.action, m.payload if a == A.create and len(p) >= 8: typ, h = struct.unpack_from('= 56: h, w1 = struct.unpack_from(' 1: print(f" handle {h:#06x} ({tname(h)}): {len(lst)} flushes") if __name__ == '__main__': main()