"""Inject-BridgeRecords.py - append SYNTHETIC records to a test client's Decal-bridge ring. For testing the engine half of the bridge while no server is available: it writes the same records the bridge would (BridgeProtocol.cs layout) into Local\\RynthCore.DecalBridge.p. Only use it on a test client whose bridge is idle (pre-login), or the two writers race. """ import mmap import struct import sys # BridgeProtocol.cs version 2: header, 64 KB command ring, then the event ring. HEADER, CMD, RING = 4096, 64 * 1024, 16 * 1024 * 1024 RING_BASE = HEADER + CMD OFF_WRITE, OFF_READ, OFF_RECORDS = 16, 24, 40 K_CHAT, K_CHATBAR, K_CREATE, K_RELEASE, K_CHANGE, K_SERVER = 2, 3, 4, 5, 6, 7 def main(): pid = int(sys.argv[1]) m = mmap.mmap(-1, RING_BASE + RING, tagname=f"Local\\RynthCore.DecalBridge.p{pid}") magic, version = struct.unpack_from("= rec and RING - (w - r) > rec base = RING_BASE + pos struct.pack_into("