#!/usr/bin/env python3 """Play a captured BTL4OPT VelociRender stream back through the friend's board + software renderer in a REAL on-screen window (chase cam follows a mech). Loops forever; close the window to stop. py playback.py [capture.raw.bin] [WxH] [chase] """ import os, sys, time sys.path.insert(0, r'C:\VWE\TeslaRel410\dpl3-revive\patha') # real window: do NOT set SDL_VIDEODRIVER=dummy cap = sys.argv[1] if len(sys.argv) > 1 else r'C:\VWE\TeslaRel410\dpl3-revive\patha\bt8.raw.bin' size = sys.argv[2] if len(sys.argv) > 2 else '640x400' os.environ['VRVIEW_CHASE'] = sys.argv[3] if len(sys.argv) > 3 else '2' W, H = (int(x) for x in size.lower().split('x')) import numpy as np from vrboard import VirtualBoard, Assembler, A from decode_anim import find_framed_start from vrview import Renderer data = open(cap, 'rb').read() start = find_framed_start(data) r = Renderer(w=W, h=H, title='VWE pod - Division render (dpl3-revive board) - our BTL4OPT arena') r.fps = 30 print(f'playing {cap} ({len(data)} bytes) in a {W}x{H} window; close it to stop') try: while True: # loop the capture board = VirtualBoard(); board._view = r asm = Assembler(); asm.feed(data[start:]) drew = 0 for m in asm: try: board.handle(m) except Exception: pass if (not m.iserver) and m.action == A.draw_scene: r.draw(board) # renders (chase cam) + paces to fps drew += 1 print(f' looped: {drew} frames drawn, restarting') except KeyboardInterrupt: print('window closed')