"""Database of Vorbis setups used by the game's own WEMs (from all shipped WADs). Each entry: stripped Wwise setup (hex), its codebook hash, decode alloc sizes, and formats seen. Reusing a known setup guarantees hash/alloc values the game accepts. """ import json import os PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "known_setups.json") _DB = None def db(): global _DB if _DB is None: _DB = json.load(open(PATH)) return _DB def lookup_setup(ww_setup: bytes): h = ww_setup.hex() for e in db(): if e["setup"] == h: return e return None