# snes-python's GPL tools From the emulator family's snes-python repository: `scripts/mesen_run.py`, parked on 2026-11-22 at snes-python's history rewrite (wave E) as it stood at `4931b0f` (old history); and `scripts/dsp_referee/spc_dump.cpp`, moved out the same day (wave G) as it stood at `2c560d7` (wave E's history; `35cae0e` after the second rewrite, without it). ## What it measures Mesen2's pictures and Lua-traced writes for SNES test ROMs, and the S-DSP's samples and registers. OBSERVED (Mesen2 b9fa69d; snes_spc 0.9.0). ## Who uses it snes-python, which finds this folder through `SNES_GPL_TOOLS`. `scripts/gpl_tools.py` puts this folder on the module path for `suite_run.py` (which imports `mesen_run`) and gives its path to `mesen_frames.py` and `detectors_compare.py`; `scripts/dsp_build_referees.py` compiles `spc_dump.cpp`. gsu-python's `scripts/mesen_krom.py` loads `mesen_run.py` from here too. ## Contents - `mesen_run.py`: A ctypes driver of Mesen2's exported C API (MesenCore): loads a SNES ROM headless, runs a number of frames, saves the frame as a PNG, optionally with a Lua script. Its SNES settings offsets were measured against Mesen2's settings header. It finds the snes-python checkout through `SNES_PYTHON_ROOT` (set by `gpl_tools.py`), else the working directory, and a MesenCore library through `MESEN_CORE` or that checkout's build. Upstream: Mesen2 (Sour), GPL-3.0, `b9fa69d`. - `spc_dump.cpp`: Plays an .spc file in blargg's snes_spc 0.9.0, through only the C functions the library's documentation describes, and writes every 32 kHz output sample, unfiltered, as little-endian 16-bit left and right pairs; optionally the 128 DSP registers after every sample, and the final state as an .spc file. Upstream: snes_spc 0.9.0 (blargg), LGPL-2.1-or-later, the archive of 2007-04-17 by SHA-256 `dbad8273...83aed`. ## Licence and notices Our code (alewman), first published under MIT in snes-python (`../../notices/MIT-emulator-family.txt`). `mesen_run.py` carries no SPDX line: treat it as GPL-3.0-or-later. `spc_dump.cpp` says MIT and is an LGPL-2.1-or-later combined work as built. 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 Mesen2 tools are on the shared contract through `../mesen2`; the others here are not yet (`emu-tools/docs/contract.md`). ## 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`. Only `mesen_run.py` moved then. On 2026-11-24 `spc_dump.cpp` moved to `../snes-spc` (`git mv`), the tool that now fetches the pinned snes_spc archive and builds `$EMU_TOOLS_GPL/tools/snes-spc/build/spc_dump` itself; `spc_dump.cpp` here is a relative link to `../snes-spc/spc_dump.cpp`, so the consumer's build keeps working (`../snes-spc/README.md`, "For consumers"). ## Retired (2026-11-24) The Mesen2 shim that was here (`mesen_run.py`) and its compat module were moved to `../../attic/` with `git mv`: no code in any family repository used it any more (its consumer runs `$EMU_TOOLS_GPL/tools/mesen2/run.py`; `../../attic/README.md` has the search and the details). The sections above describe it as it was.