Bring the graphics-dev collaborator's dpl3-revive into the repo as first-class
project code (they've handed it off; it's ours now). This is the proven
Division renderer that our in-process rt_draw has been trying to be.
What's here:
- parser/ B2Z/V2Z/SVT/SCN/SPL/BGF/BMF/BSL decoders (pure Python).
- spec/ reverse-engineered format + the definitive VelociRender wire
protocol (from the original DIVISION source, matches our live
VPX node/action tables exactly).
- source-ref/ read-only copies of the original DIVISION C (BIZREAD.C,
DPLTYPES.H, DPL.H) that define the formats.
- patha/ the "virtual VelociRender board": vrboard.py (24-action protocol
server), vrview.py (numpy software rasterizer, the reference),
vrview_gl.py (moderngl GPU backend, 832x512@60Hz), plus the
run/replay/regress tooling and evidence renders. Drives FLYK/BLADE/
Star Trek demos AND our btl4opt/rpl4opt game binaries.
- viewer/ WebGL archive generators (.py); prebuilt HTML/data regeneratable.
- samples/ small test models/textures.
- bt*.raw.bin real BTL4OPT arena wire captures (kept for offline renderer
testing/regression against OUR game).
.gitignore keeps the multi-hundred-MB demo capture dumps + debug logs +
regeneratable viewer bundles out of history (they stay on disk).
Phase 0 of the integration is validated: their board decodes our bt8 capture
with zero errors (3748 nodes, 507 instances, 4 mechs) and renders our arena
(terrain/dome/sky, correct Division DAC gamma). Plan + status in memory;
integration continues in emulator/RENDERER-COLLAB.md.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
119 lines
4.8 KiB
Python
119 lines
4.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
decode_anim2.py -- second-pass decode: 0x1d split by word1 (the real handle),
|
|
full DCS body dump (matrix + parent/sibling/child tree), zone/view bodies,
|
|
init argv, 0x1c hex, and ASCII strings on the wire.
|
|
"""
|
|
import sys, struct
|
|
from collections import defaultdict
|
|
from vrboard import Assembler, A
|
|
from decode_anim import find_framed_start, TYPE
|
|
|
|
def main():
|
|
path = sys.argv[1] if len(sys.argv) > 1 else "capture.raw.bin"
|
|
data = open(path, "rb").read()
|
|
asm = Assembler(); asm.feed(data[find_framed_start(data):])
|
|
|
|
types = {}
|
|
flushes = defaultdict(list)
|
|
anim = defaultdict(list) # w1 -> [(frame, w0, floats)]
|
|
op1c = []
|
|
init_argv = None
|
|
frame = 0
|
|
for m in asm:
|
|
if m.iserver: continue
|
|
a, p = m.action, m.payload
|
|
if a == A.init:
|
|
init_argv = p
|
|
elif a == A.create and len(p) >= 8:
|
|
typ, h = struct.unpack_from('<II', p, 0)
|
|
types[h] = typ
|
|
elif a == A.flush:
|
|
h = struct.unpack_from('<I', p, 0)[0]
|
|
flushes[h].append(p)
|
|
elif a == A.draw_scene:
|
|
frame += 1
|
|
elif a == 0x1d and len(p) >= 56:
|
|
w0, w1 = struct.unpack_from('<II', p, 0)
|
|
fl = struct.unpack_from('<12f', p, 8)
|
|
anim[w1].append((frame, w0, fl))
|
|
elif a == 0x1c:
|
|
op1c.append((frame, p))
|
|
|
|
tname = lambda h: TYPE.get(types.get(h), f'?{types.get(h)}')
|
|
|
|
print("=== init argv ===")
|
|
print(repr(init_argv))
|
|
|
|
print("\n=== 0x1d split by word1 (candidate handle) ===")
|
|
for w1, lst in sorted(anim.items()):
|
|
print(f" w1={w1:#x} ({tname(w1)}): {len(lst)} records")
|
|
# sample across the run
|
|
n = len(lst)
|
|
for i in (0, n//4, n//2, 3*n//4, n-1):
|
|
f, w0, fl = lst[i]
|
|
m = fl[:9]; t = fl[9:12]
|
|
print(f" frame {f:6} w0={w0}: t=({t[0]:9.3f},{t[1]:9.3f},{t[2]:9.3f}) "
|
|
f"m=({m[0]:5.2f},{m[1]:5.2f},{m[2]:5.2f} | {m[3]:5.2f},{m[4]:5.2f},{m[5]:5.2f} | "
|
|
f"{m[6]:5.2f},{m[7]:5.2f},{m[8]:5.2f})")
|
|
# does it ever change?
|
|
first = lst[0][2]; changed = sum(1 for _, _, fl in lst if fl != first)
|
|
print(f" records differing from first: {changed}/{n}")
|
|
|
|
print("\n=== DCS bodies (last flush) as annotated words ===")
|
|
for h in sorted(flushes):
|
|
if tname(h) != 'dcs': continue
|
|
body = flushes[h][-1]
|
|
nw = len(body)//4
|
|
wi = struct.unpack_from('<%dI' % nw, body, 0)
|
|
wf = struct.unpack_from('<%df' % nw, body, 0)
|
|
# find plausible 4x4 matrix start: scan for identity-ish diag or just dump both
|
|
print(f" dcs {h:#04x} ({len(body)}B, {nw}w):")
|
|
ints = []
|
|
for i, w in enumerate(wi):
|
|
if w in types: ints.append(f"[{i}]{w:#x}={tname(w)}")
|
|
elif 0 < w < 0x10000: ints.append(f"[{i}]{w:#x}")
|
|
print(" int-ish:", " ".join(ints))
|
|
print(" floats:", " ".join(f"{v:.2f}" if abs(v) < 1e6 and v == v else "." for v in wf))
|
|
|
|
print("\n=== zone bodies ===")
|
|
for h in sorted(flushes):
|
|
if tname(h) != 'zone': continue
|
|
body = flushes[h][-1]
|
|
wi = struct.unpack_from('<%dI' % (len(body)//4), body, 0)
|
|
annot = [f"{w:#x}" + (f"={tname(w)}" if w in types else "") for w in wi]
|
|
print(f" zone {h:#04x}: [{', '.join(annot)}]")
|
|
|
|
print("\n=== view body (last flush) ===")
|
|
for h in sorted(flushes):
|
|
if tname(h) != 'view': continue
|
|
for k, body in enumerate(flushes[h]):
|
|
wf = struct.unpack_from('<%df' % (len(body)//4), body, 0)
|
|
wi = struct.unpack_from('<%dI' % (len(body)//4), body, 0)
|
|
print(f" view {h:#04x} flush {k} ({len(body)}B):")
|
|
print(" floats:", [round(v, 3) if abs(v) < 1e7 and v == v else hex(wi[i]) for i, v in enumerate(wf)])
|
|
|
|
print("\n=== lmodel/material bodies ===")
|
|
for h in sorted(flushes):
|
|
if tname(h) not in ('lmodel', 'material'): continue
|
|
body = flushes[h][-1]
|
|
wf = struct.unpack_from('<%df' % (len(body)//4), body, 0)
|
|
wi = struct.unpack_from('<%dI' % (len(body)//4), body, 0)
|
|
print(f" {tname(h)} {h:#04x} ({len(body)}B):",
|
|
[round(v, 3) if abs(v) < 1e7 and v == v else hex(wi[i]) for i, v in enumerate(wf)])
|
|
|
|
print("\n=== 0x1c messages ===")
|
|
for f, p in op1c:
|
|
print(f" frame {f}: {len(p)}B")
|
|
wf = struct.unpack_from('<%df' % (len(p)//4), p, 0)
|
|
wi = struct.unpack_from('<%dI' % (len(p)//4), p, 0)
|
|
print(" ", [round(v, 4) if abs(v) < 1e7 and v == v else hex(wi[i]) for i, v in enumerate(wf)])
|
|
|
|
print("\n=== ASCII strings (>=6 chars) in framed region ===")
|
|
import re
|
|
for mt in re.finditer(rb'[ -~]{6,}', data[find_framed_start(data):]):
|
|
print(" ", mt.group().decode('latin1'))
|
|
|
|
if __name__ == '__main__':
|
|
main()
|