live_render.py connects to vpxlog.cpp's existing VPX_FIFOSOCK tee (the DOSBox-X C012 device), consumes the game's wire AS IT ARRIVES, and runs the firmware and the socket CONCURRENTLY -- pumping the socket whenever the firmware's receive point drains -- rendering each draw with the shared verified GPU raster. gpu_raster.py factors the M4c-raster renderer out of m4b_gpu so offline and live share ONE render path (the 6-edge fp64 raster + verified texel decode). feed_sock.py mimics vpxlog's FIFOSOCK server (streams a real capture in delayed chunks) so the live path is validated end-to-end WITHOUT the flaky live pod. Result: 12 frames streamed live at 2.3 fps; with --pin (equalized texture availability) the live frames are BIT-IDENTICAL to the offline reference (12/12 differ>24 = 0.000%) -- the seam is faithful. The default incremental texture model is more authentic (the board only has texels it has received); its divergence from offline is purely the M5-B tid%ntex placeholder, orthogonal. Live topology now closed end-to-end offline: game/capture -> C012 VPX_FIFOSOCK -> live_render -> firmware -> GPU -> frames. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Test double for vpxlog.cpp's VPX_FIFOSOCK: listen on 127.0.0.1:<port>, and on
|
|
connect stream a real .fifodump so live_render.py can be validated end-to-end
|
|
WITHOUT the live DOSBox pod. Matches the real topology (vpxlog listens, the
|
|
Python renderer connects). Streams in chunks with a small delay so the
|
|
concurrent firmware/socket path is genuinely exercised, then closes (EOF).
|
|
|
|
python feed_sock.py <capture.fifodump> <port> [chunk] [delay_ms]
|
|
"""
|
|
import sys, socket, time
|
|
|
|
SRC = sys.argv[1]
|
|
PORT = int(sys.argv[2])
|
|
CHUNK = int(sys.argv[3]) if len(sys.argv) > 3 else 64 << 10
|
|
DELAY = (int(sys.argv[4]) if len(sys.argv) > 4 else 5) / 1000.0
|
|
|
|
data = open(SRC, 'rb').read()
|
|
ls = socket.socket()
|
|
ls.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
ls.bind(('127.0.0.1', PORT))
|
|
ls.listen(1)
|
|
print("feed_sock listening on :%d (%d bytes)" % (PORT, len(data)), flush=True)
|
|
c, _ = ls.accept()
|
|
print("client connected; streaming", flush=True)
|
|
sent = 0
|
|
for i in range(0, len(data), CHUNK):
|
|
try:
|
|
c.sendall(data[i:i + CHUNK])
|
|
except OSError:
|
|
break
|
|
sent += min(CHUNK, len(data) - i)
|
|
if DELAY:
|
|
time.sleep(DELAY)
|
|
print("streamed %d bytes, closing (EOF)" % sent, flush=True)
|
|
c.shutdown(socket.SHUT_WR)
|
|
time.sleep(0.5)
|
|
c.close(); ls.close()
|