"""Build a binary appinfo.vdf (magic 0x07564429) for tests. The writer mirrors what Steam stores: a header, one entry per app (appid, size, 60 header bytes, binary key-values whose keys index a string table), a zero appid terminator, then the string table itself. """ from __future__ import annotations import struct MAGIC = 0x07564429 def _kv(data: dict, strings: dict[str, int]) -> bytes: out = bytearray() for key, value in data.items(): index = strings.setdefault(key, len(strings)) if isinstance(value, dict): out += b"\x00" + struct.pack(" bytes: """Serialize `{appid: appinfo-dict}`; each dict is wrapped in "appinfo".""" strings: dict[str, int] = {} body = bytearray() for appid, data in apps.items(): kv = _kv({"appinfo": data}, strings) header = struct.pack("