# famicom-python's Mesen2 tools From the emulator family's famicom-python repository: `scripts/mesen_run.py`, `scripts/mesen_audio.py` and `scripts/mesen2-detector-fixes.patch`, parked on 2026-11-21 at famicom-python's history rewrite (wave D) as they stood at `e34855b` (old history). ## What it measures Mesen2's NES pictures, traces and sound beside famicom-python's board. OBSERVED (Mesen2 b9fa69d, patched as above). ## Who uses it famicom-python, which finds this folder through `FAMICOM_GPL_TOOLS`. `scripts/gpl_tools.py` puts this folder on the module path, so the MIT scripts that run Mesen2 as a closed box (`mesen_frames.py`, `mesen_lockstep.py`, `mesen_accuracycoin.py`, `compat_sweep.py`, `provenance_probes.py`, `vs_judge.py`) find `mesen_run`. Run `mesen_audio.py` from the famicom-python checkout with its venv. ## Contents - `mesen_run.py`: A ctypes driver of Mesen2's exported C API (MesenCore) for NES ROMs, with NES settings offsets measured against Mesen2's settings header. Its root is `FAMICOM_PYTHON_ROOT` (set by `gpl_tools.py`), else the working directory. Upstream: Mesen2 (Sour), GPL-3.0, `b9fa69d`. - `mesen_audio.py`: The board's sound against Mesen2's WAV recorder; it declares more of the same API, so it moved with the driver (a provisional call of the history session). Upstream: the same. - `mesen2-detector-fixes.patch`: A patch to Mesen2 with Mesen2's context lines (so GPL-3.0 like it); apply it to the Mesen2 build before lockstep (famicom-python's docs/validation.md). Upstream: the same. ## Licence and notices Our code (alewman), first published in famicom-python (`../../notices/MIT-emulator-family.txt`); as GPL tools they are GPL-3.0-or-later here. The patch carries Mesen2's lines and is GPL-3.0. Upstream code is not committed here, except where a file above says it carries upstream lines; each tool fetches and builds its upstream at the pin from the consuming repository. This repository is GPL-3.0-or-later (`../../LICENSE`). ## Outputs Every value these tools give is a closed-box measurement: tag it OBSERVED with the upstream and its pin, and let any document or hardware measurement overrule it (`emu-tools/docs/wall.md`). The tool behind them, `../mesen2`, speaks the shared contract (`emu-tools/docs/contract.md`); the shims keep the old formats. ## Now shims (2026-11-23) The Mesen2 files here are now thin shims over the Mesen2 tool, `../mesen2` (mesen2-runner 0.1.0): the same file names, command lines, module names and outputs, gated before and after the regrouping with this consumer's own commands (`../mesen2/README.md`). The code they ran is in `../mesen2/mesen2_runner/compat/`; how the consumer moves to the tool's own command line is in `../../docs/consumer-migration.md`. `mesen2-detector-fixes.patch` is a link to `../mesen2/patches/` (the same lines, under an SPDX preamble that `git apply` and `patch` skip).