# hg51b-mesen-harness `mesen_cx4_trace.py` runs a Cx4 cartridge on Mesen2 2.1.1 (`b9fa69dd`, GPL-3.0) headless through Mesen2's C API (ctypes), for hg51b-python's closed-box measurements: the Cx4 test screen, per-instruction Cx4 traces, the probe cartridges (`hg51b-python/scripts/cx4_probe.py`) and the recorded windows (`hg51b-python/scripts/record_mesen_windows.py`). hg51b-python runs it as a separate program, through the environment variable `MESEN_CX4_TRACE` (the path to this file), and reads only what it writes. **Licence: GPL-3.0-or-later** (`LICENSE`). The ctypes declarations follow Mesen2's headers (the API's structures and entry points), and the script drives Mesen2 as a linked library, so the tool is treated as part of Mesen2's GPL world (family charter, "Licences and provenance", rule 6). Code flows one way: never copy from here into an MIT project. Local only. Moved out of the MIT repository hg51b-python on 2026-11-19 (provenance wave 2, the charter session's decision on the "ctypes layouts from Mesen2's headers" question). It was in hg51b-python's history (local, never pushed) until that date. If it is ever shared, its complete source and Mesen2 at the pinned commit go with it.