# pcengine-python's GPL tools From the emulator family's pcengine-python repository: `scripts/psg_referees/` (the Mednafen parts) and `scripts/mesen_run.py`, parked on 2026-11-21 at pcengine-python's history reset (wave C) as they stood at `fc5bf9f` (old history). ## What it measures Mednafen's PSG output for register streams, and Mesen2's PC Engine pictures. OBSERVED (each at its pin). ## Who uses it pcengine-python, which finds this folder through `PCE_GPL_TOOLS`. `tests/test_psg_referees.py`, `scripts/detectors_compare.py` and `scripts/m2_refs.py`; `psg_referees/build_mednafen.py` builds the referee, with `PCENGINE_PYTHON_ROOT` naming the board's checkout (for the Mednafen tree). The MAME PSG referee (BSD-3) stays in pcengine-python. ## Contents - `psg_referees/mednafen_psg.cpp`, `psg_referees/mednafen_shim/`: Compiled together with Mednafen's PC Engine PSG into a referee that renders PSG register streams; the shim re-declares the few Mednafen headers the PSG needs. GPL-2.0-or-later, as their SPDX lines say. Upstream: Mednafen's `pce_psg.cpp` from pce-devel/mednafenPceDev, GPL-2.0-or-later, `55dba39`. - `psg_referees/build_mednafen.py`: Builds that referee. Upstream: the same. - `mesen_run.py`: A ctypes driver of Mesen2's exported C API for PC Engine ROMs. Upstream: Mesen2 (Sour), GPL-3.0, `b9fa69d`. On gathering here (2026-11-22) `mesen_run.py`'s second MesenCore location, a path on one machine, became `MESEN_CORE`; nothing else changed. As parked, it still imports `presses` from beside itself and takes its root from its own location (the refactor's job). ## Licence and notices Our code (alewman), first published in pcengine-python (`../../notices/MIT-emulator-family.txt`); GPL tools 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; `psg_referees/` is unchanged (the Mednafen group is a later wave). As parked, `mesen_run.py` stopped at import (it looked for `presses.py` beside itself); the shim runs, with the press spelling from the tool's `pce` adapter, and its default `--home` lies under `PCENGINE_PYTHON_ROOT` (else the working directory). ## 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.