# mesen2-runner Mesen2 run headless as a closed-box referee, one runner with an adapter per console: the NES (and the Famicom Disk System), the SNES (and a SNES cartridge with the Cx4), and the PC Engine family. Version 0.4.0 (`CHANGELOG.md`). It speaks the family's tool contract, version 1 (`emu-tools/docs/contract.md`). Two pinned cores, one runner: Mesen2 (the default) and, from 0.4.0, MesenCE, Mesen2's continuation (`--core mesence`). Regrouped on 2026-11-23 from five copies of the same driver that the emulator repositories had each written (famicom-, snes-, pcengine-, huc6280- and hg51b-python) and parked here one folder per repository on 2026-11-22. The old file names stayed as thin shims over this tool (below); the three whose consumers had all moved to `run.py` were retired to `../../attic/` on 2026-11-24. ## What it measures Mesen2's pictures, its NES instruction trace (registers, CPU cycle, PPU line and dot), its NES sound (its WAV recorder, after its own mixer), the Cx4's instruction trace and the S-CPU's accesses to the Cx4 window, and whatever a Lua script reads through Mesen2's documented Lua API. **Every output is OBSERVED** (Mesen2 or MesenCE at its pin, via mesen2-runner 0.4.0): a closed-box measurement, never a hardware fact, overruled by any document or hardware measurement that disagrees. Mesen2 is an emulator with known differences from hardware; the patch below corrects five of them for the NES, and the consumers' documents list more. ## Upstream, licence and pin - **Mesen2** by Sour, , **GPL-3.0** (its LICENSE file), pinned at **`b9fa69ddc6d0a331fb103fdb5eef6904305703c2`** (2.1.1, the archived repository's last commit). Checked against `emulator-lineage/docs/sources.md`. - **This tool: GPL-3.0-or-later** (`../../LICENSE`). It declares Mesen2's exported C API for `ctypes` and links the library at run time, so it is part of Mesen2's GPL world. Most of its code was first published under MIT by alewman in the emulator repositories named above; each module says which, and that permission is kept for those parts (`../../notices/MIT-emulator-family.txt`). - **Patch** (`patches/mesen2-detector-fixes.patch`, GPL-3.0 like Mesen2: it carries Mesen2's context lines): from famicom-python, where a higher tier showed Mesen2 wrong. A taken branch holds an NMI edge seen in its operand cycle as it holds an IRQ; a DMC rate written in the timer's reload cycle is the one it reloads with; reads return the internal data bus and DMA reads drive only the external one; the Bandai FCG's ROM is selected at $8000 and the Datach reader's D3 is open bus without a reader; odd MINDKIDS submappers decode the outer registers at $5000. Only NES behaviour changes. - **MesenCE** by the NESdev community, , **GPL-3.0** (its LICENSE file), Mesen2's live continuation, pinned at **`4b8a196e299b3de297b204fd1208d2981562c89b`** (2026-10-07), the commit famicom-python's own build used for AccuracyCoin's MesenCE column (moved here on 2026-11-25, decisions page T2). Built as published: the patch above is Mesen2's and is not applied to it. Checked against `emulator-lineage/docs/sources.md`. **MesenCE bans AI contributions** (its community's rule): this tool runs it and never contributes to it; nothing found with it is posted there. - Neither upstream is committed here. If the tool is ever shared, its complete corresponding source goes with it: this folder, the patch, and each upstream at its pin. ## Build `./build.sh` clones Mesen2 into `upstream/Mesen2` (git-ignored), checks out the pin, applies `patches/*.patch` in order, and builds the core library without .NET (`make core` with GCC, no LTO, no static linking; `JOBS` sets the parallel jobs, 8 by default). It needs git, g++ with C++17, make, and SDL2's headers. `./build.sh --no-patch` builds the pin as published. It writes `upstream/build-info.json` (the commit and the patches applied), which the manifest quotes. It never deletes anything: a checkout with other changes stops it with a message. Built here in 12 minutes with eight jobs on a busy 32-core machine (2026-11-23); the library it built gave the same pictures as famicom-python's hand build in the checks below. `./build.sh --core mesence` does the same for MesenCE at its pin, into `upstream/MesenCE`, with no patch, and records it in `upstream/build-info-mesence.json`. Built here with two jobs (`JOBS=2`) on 2026-11-25. The runner finds the library through `--lib`, else `--core`'s own build (`--core mesence` runs `upstream/MesenCE`'s; `MESEN_CORE` does not override a core named this way), else `MESEN_CORE`, else this tool's own Mesen2 build. A library built elsewhere works too (famicom-python's documents built the same commit with the same patch); the manifest then says its commit and patches were not checked by the tool. ## Requirements Python 3.11 or later (CPython or PyPy) and, for any picture (`--frames-out`, `--frames-at`), **Pillow**, which writes the PNGs: install it for the interpreter that runs `run.py` (the consumers run it with the system's `python3 -I`, so the system's Pillow). Runs without pictures (traces, script logs, sound) need nothing beyond the standard library and the built Mesen2. ## Command line python3 -I run.py --machine MACHINE --rom PATH --out DIR [--frames N] [--until log:TEXT] [--frames-out] [--frames-at F,F,...] [--trace KIND[,KIND]] [--trace-window START:END] [--input FILE] [--lua FILE] [--reset-at N] [--power-on-ram zeros|ones|random] [--region ntsc|pal|dendy|auto] [--no-sprites] [--fds-bios PATH] [--audio-out] [--nes-apu on|off] [--nes-ppu-reset-at-power on|off] [--nes-oam-row-corruption on|off] [--hold-test] [--seed N] [--core mesen2|mesence] [--lib PATH] [--timeout S] python3 -I run.py --batch FILE [--core mesen2|mesence] [--lib PATH] python3 -I run.py --version `--frames` is the number of frames to run, 60 by default, counted as Mesen2's end-of-frame events from power-on (frame N is what runs up to the N-th end-of-frame event). A run may end earlier, at the end of a frame, when your script calls `emu.stop(code)` or logs the `--until` line (below, "Ending a run early"); `--frames` is then the most it runs. `--version` prints the tool, its version and both pinned commits. Exit status as the contract says: 0 a complete run, 1 a run that did not complete (a timeout, a lost frame; the manifest's `status` says which), 2 a usage error, 3 a missing ROM, BIOS or library. One run per process, or several in one process with `--batch` (below): the library cannot be started a second time in one process (OBSERVED: after its release a second start crashes), so a batch starts it once and keeps it between runs. Every option: - `--machine`, `--rom`, `--out`: which adapter, the program (a loose file the player gives), and the output directory (created). - `--frames N`: frames to run (default 60), the most with `--until` or `emu.stop`. - `--until log:TEXT` (with `--lua`; every machine): end the run at the end of the frame in which your script logs a line starting with TEXT (below). - `--frames-out`: write the last frame as a PNG (needs Pillow): frame `--frames`, or the frame the run ended at. - `--frames-at F,F,...` (`nes`, `snes`): also write these frames, each from 1 to `--frames` (`snes` from 0.3.0, with the same meaning as on `nes`: the picture at the end of each of those frames, the same picture a run of F frames with `--frames-out` gives). - `--trace KIND[,KIND]`: the traces in the machine table below. - `--trace-window START:END` (`snes-cx4`): the Cx4 trace runs from the end of frame START to the end of frame END, so it holds END minus START frames; END is excluded as Mesen2 numbers frames (below). - `--input FILE`: a controller script in the contract's format (below). - `--lua FILE`: a script of your own (below); its log goes to `script-log.txt`. - `--reset-at N` (`nes`, `snes`, `snes-cx4`): press the console's reset button at the end of frame N (from 1 to `--frames` minus 1); frames count on through the reset. Mesen2 takes the request at a frame boundary of its own, so the reset lands at the same emulated moment on every run (OBSERVED 2026-11-24: identical pictures and logs in repeated runs): on the SNES right after frame N's end-of-frame event, on the NES after frame N+1's (a script's reset callback sees N, or N+1, frames counted). Not on `pce`: there Mesen2's Lua reset left the emulator without another frame (OBSERVED 2026-11-24, on a two-instruction card), so the runner refuses it. - `--power-on-ram zeros|ones|random` (every machine): what the RAMs hold at power-on, **zeros by default**, recorded in the manifest (`power_on`). It is Mesen2's own setting for the console: on the NES work RAM, the cartridge's RAMs, CHR RAM, nametable RAM and OAM; on the SNES WRAM, VRAM, CGRAM, OAM, the sound RAM, the DSP's registers and the cartridge's RAMs (Mesen2 overrides it by name for six games, one of them always random); on the PC Engine work RAM, the card's RAM and the CD's RAMs. `random` is Mesen2's own generator, seeded by the host, not by `--seed`: such runs do not repeat. Mesen2's other power-on randomiser (the SNES PPU's and the PC Engine's registers) stays off. - `--region ntsc|pal|dendy|auto` (`nes`, `snes`, `snes-cx4`): the console's region, NTSC by default (`dendy` is NES only; `auto` lets Mesen2 choose from the dump). - `--no-sprites` (`pce`): Mesen2's sprite switch off (the VDC's sprites are not drawn), for a picture of the background alone; recorded in the manifest (`sprites`). - `--fds-bios PATH` (`nes`, a Famicom Disk System image): the player's Disk System BIOS (8 KiB, a loose file or a `.zip` holding one 8 KiB file). Without the option the runner reads the path from the environment variable **`FDS_BIOS`**. An FDS image (`.fds`, or a file starting with fwNES's header or a disk's signature) with neither is a missing input (exit 3). The runner copies the BIOS into the run's own Mesen2 home for the run and removes the copy afterwards; nothing of it is kept, committed or downloaded. The manifest records its SHA-1 and size (input role `bios`) and where it came from. Mesen2 does not change disks by itself, so a run sees the first side. - `--audio-out` (`nes`): record Mesen2's sound as `audio.wav` (its WAV recorder, after its own mixer and resampler), a run of its own: no pictures, traces, input, script, reset or `--until` with it. From 0.3.0 it ends exactly at `--frames`: the emulator is held at the end of frame `--frames` before the recorder is stopped, so every run gives the same file. It holds the sound Mesen2 had mixed by then, which is about 66 samples (1.4 ms, 0.08 frame) short of `--frames` x 48000 / 60.0988, because Mesen2 hands its mixer the sound in blocks (OBSERVED 2026-11-24 on an NTSC program: 732 samples for 1 frame, 23,894 for 30, 47,855 for 60, 479,147 for 600, each the same in repeated runs). In 0.2.0 the recording ran on while the runner polled, a few frames past `--frames` and different every run; a 0.3.0 recording is a prefix of those. - `--nes-apu on|off` (`nes --audio-out`): the APU's five channels in the recording, on by default; off leaves a cartridge's own sound alone. - `--nes-ppu-reset-at-power on|off` (`nes`): the PPU ignores its register writes until the first pre-render line, as the NES-001 does (default on; Mesen2's own default is off). - `--nes-oam-row-corruption on|off` (`nes`): Mesen2's OAM row corruption (default on; off for the Vs. System's RGB PPUs, which have none). - `--hold-test` (`snes-cx4`): hold pad 2's B from power-on (Mega Man X2 and X3 enter their Cx4 test). - `--seed N`: recorded in the manifest; with the default settings nothing is random. - `--core mesen2|mesence` (0.4.0): run that pinned core's own build (`build.sh --core NAME`); exit 3 naming the path when it is not built. Without it, `MESEN_CORE`, else Mesen2's build. - `--lib PATH`: the library (else `--core`'s build, else `MESEN_CORE`, else this tool's Mesen2 build). - `--timeout S`: wall-clock seconds, 300 by default; a run that has not finished by then is stopped and exits 1 with `status` `timeout`. - `--batch FILE`: several runs in this one process (below). Machines: | `--machine` | Settings | Traces | | --- | --- | --- | | `nes` | a 512-entry identity palette, RAM as `--power-on-ram` (zeros by default), a standard pad in each port and no input from Mesen2's game database, PPU register writes ignored until the first pre-render line (as on the NES-001), OAM row corruption on; NTSC unless `--region`; an FDS image with the player's BIOS (`--fds-bios`, `FDS_BIOS`) | `insn` | | `snes` | a standard pad in each port, NTSC unless `--region`, RAMs as `--power-on-ram` (zeros by default), every frame drawn (Mesen2's frame skipping off) | none yet | | `pce` | PC Engine, TurboGrafx-16 or SuperGrafx as Mesen2 chooses for the card; an RGB333 palette (index read as GGGRRRBBB: an assumption, checked against MAME by pcengine-python), RAM as `--power-on-ram` (zeros by default), no frame skipping, a pad only when `--input` is given, sprites off with `--no-sprites` | none yet | | `snes-cx4` | as `snes`, for a cartridge with the Cx4; `--hold-test` holds pad 2's B from power-on (Mega Man X2 and X3 enter their Cx4 test) | `cx4-text`, `host` | Every frame drawn: at maximum speed Mesen2's SNES draws a frame only when enough wall-clock time has passed since the last, unless told not to skip, so in 0.1.0 a SNES picture could be one drawn two or three frames earlier and differed between runs (OBSERVED 2026-11-24: krom's WaveHDMA gave three pictures in six runs while the CPU's state at every frame was identical). From 0.2.0 `snes` and `snes-cx4` turn the skipping off (the PC Engine adapter always did), and WaveHDMA gives one picture in every run. The old SNES shim keeps Mesen2's default (below). - `--input FILE`: a controller script in the contract's format (JSON Lines of frame, port and buttons). From the moment that many frames have completed, the port's buttons are exactly those listed (an empty list releases them), until its next record. Ports 1 and 2 (`snes-cx4`: port 1 only, since Lua's input call is ignored for port 2 in this build, OBSERVED by hg51b-python; `--hold-test` holds port 2's B). Buttons: NES a, b, select, start, up, down, left, right; SNES and Cx4 those plus x, y, l, r; PC Engine i, ii, select, run and the four directions. On `snes-cx4` a press set at frame F is read by the game's joypad registers in frame F+1 (OBSERVED 2026-11-24, the same as on `snes`). - `--lua FILE`: a script of your own, loaded after the runner's (it may read memory, log lines and set input through Mesen2's Lua API). **Every line it logs** goes to `script-log.txt`, in order, however many (Mesen2's own log keeps only its last 500 lines; from 0.2.0 the runner writes each line to a file as it is logged, through Lua's io library, which it allows for the run, so your script may use Lua's io and os libraries too). The log ends with the last frame: lines logged while the emulator is being stopped are not kept. The runner's own lines (pictures, markers) are tagged and left out, so your lines are kept whatever their format, even ones that look like the runner's (`DONE`, `L...`/`E...` frame lines). Your end-of-frame callbacks for the last frame run before the runner stops. Mesen2's own lines (the script loading, Lua errors) are kept apart, in the manifest's `script_messages` (from 0.3.0 only those logged before the end of the last frame: 0.2.0 also listed there the player's lines from the frames the SNES and PC Engine ran while being stopped). - `--trace-window START:END` (`snes-cx4`): the Cx4 trace starts at the end of frame START and stops at the end of frame END (frames counted as `--frames` counts them), so it holds END minus START frames: in this tool's numbering frames START+1 to END, and in the trace's own frame column (`F:`, Mesen2's counter, which starts at 0) START to END-1, so **END is excluded** as that column numbers frames (OBSERVED 2026-11-24 on Mega Man X2 with `120:122`: lines `F:120` and `F:121` only). The script holds the emulator at each edge while the trace logger starts or stops, so the edges are exact to the frame; a window reaching past the run's last frame stops there. A Cx4 game's test runs up to 200,000 instructions a frame (OBSERVED on Mega Man X2), so keep windows short. - ROMs and BIOS come only from paths the player gives (the consumers read them from `NO_INTRO_DIR` and their own variables). Cartridges need no BIOS; the Famicom Disk System needs the player's BIOS (`--fds-bios` or `FDS_BIOS`); PC Engine CD needs the player's System Card; Mesen2 carries its own SNES sound IPL. Loose ROM files only: this build's loader refuses a `.zip` (the FDS BIOS may be zipped: the runner reads it itself). ## Ending a run early (`emu.stop`, `--until`), from 0.3.0 A run ends at the end of frame `--frames`, or earlier, at the end of the frame in which either happens: - **your script calls `emu.stop(code)`** (Mesen2's Lua call; `code` defaults to 0). The runner replaces the call for the run: Mesen2's own stop would end emulation from another thread at a moment the host's timing picks, and drop the script log, so 0.2.0 reported such a run as `stopped (code)` (NES, exit 1) or `timeout` (SNES, PC Engine, Cx4), with no picture. Now the emulator finishes that frame (your other callbacks for it still run), and the run ends there like any other: its script log, trace, host stream and `--frames-out` picture end with that frame, the same as a run of that many frames gives. Mesen2 keeps the first non-zero code when `emu.stop` is called again, and so does the runner. - **your script logs a line starting with TEXT**, given as `--until log:TEXT` (with `--lua`; the line itself is kept in `script-log.txt`). TEXT may not start with the runner's tag (`@mesen2-runner`). For example famicom-python's blargg script logs the result text and calls `emu.stop(code)`, and AccuracyCoin's logs `DONE`: with `--until log:DONE` and `--frames 20000` a run stops when the results are in, not after 20,000 frames. The manifest then says how the run ended, in **`end`** (present only when the run ended early or `--until` was given; without it the run ran `--frames` frames, as in 0.2.0): - `{"by": "script-stop", "frame": F, "stop_code": C}`: your script called `emu.stop(C)` in frame F; - `{"by": "until", "frame": F, "until": "log:TEXT", "reached": true}`: the line came in frame F; - `{"by": "frames", "frame": N, "until": "log:TEXT", "reached": false}`: `--until` was given and the line never came in `--frames` (N) frames; - `frames_not_reached`: the `--frames-at` frames after F, which are not written. **The stop code does not change the exit status**: the run completed as your script asked, so it exits 0 with `status` `ok`, and a non-zero code is reported only as `end.stop_code` (contract section 1: 1 means a check of the tool's own failed). A consumer that gives the code a meaning (blargg's result: 0 passed) reads it from the manifest. The same holds for `--until` not reached: exit 0, `end.reached` false. `--frames-out` writes the picture of the frame the run ended at, named by its number (`frame-000005.png` for a stop in frame 5). ## Several runs in one process (`--batch`) `python3 -I run.py --batch FILE [--core mesen2|mesence] [--lib PATH]` runs every line of FILE as a run of its own, in order, in this one process, starting the library once. A line is a JSON object of options, named as on the command line without the dashes (an underscore may stand for a hyphen), with `true` for a switch and `false` or `null` to leave one out, for example a line naming machine `nes`, a ROM, an output directory, 600 frames and `frames-out` true. Each line has its own `out` and writes there exactly what the same run alone would (its manifest adds `batch`: the file's name and SHA-1 and the line number). Blank lines and lines starting with `#` are skipped; relative paths are relative to the working directory. The library is the batch's (`--lib`, `--core`'s build, `MESEN_CORE` or this tool's Mesen2 build): a line may not name `lib`, `core`, `batch` or `version`. Between runs the emulator is stopped (Mesen2 then drops the debugger and the scripts), each run gets its own Mesen2 home under its `out` (so no battery save or BIOS passes from one run to the next) and sets every setting it uses again (the NES adapter restores the settings the library started with first). One line of JSON per run goes to standard output, `{"batch_line": N, "out": ..., "exit": E}`, with E the exit status that run alone would have had (a bad line is 2 and the batch goes on). The batch exits 0 when every run exited 0, else 1; 3 when the file or the library is missing. A crash of the library ends the batch: the runs whose manifest exists completed. Mesen2 prints messages of its own to standard output too, so read the summary lines by their start. ## Outputs (in `--out`) - `manifest.json`: the contract's run manifest: tool, version, this repository's commit (`-dirty` when the tool's files differ from it), Mesen2's commit and licence, the patches (known only for this tool's own build), the library's SHA-1, the machine and its settings (`power_on`, `frame_skipping`, the NES `switches`, `reset_at`, `sprites`), the ROM's (and input script's and BIOS's) SHA-1 and size, the arguments, host, start time, outputs, how the script log was taken (`script_log`), how the run ended when it ended early or `--until` was given (`end`, above) and `"evidence": "OBSERVED"`. A library passed with `--lib` whose path names MesenCE is recorded as MesenCE, its commit unknown to the tool; this tool's own MesenCE build (`--core mesence`) is recorded as MesenCE with its pin. - `frame-NNNNNN.png` (`--frames-out`, and `--frames-at` on `nes` and `snes`): the last frame (and each frame asked for), NNNNNN its number. SNES and PC Engine: RGB as Mesen2's screen buffer gives it, overscan included (a SNES frame is 256x239, 512x478 in hi-res and interlace, and its row 7 is the first visible line; a PC Engine frame is as wide as the VCE's dot clock makes it, 292x242 for pcengine-python's CPU test). NES: 256x240, 16-bit grey, each pixel the palette index with the emphasis bits above it (index | emphasis x 64), since the identity palette makes that what Mesen2 reports. - `insn.jsonl.gz` (`nes`, `--trace insn`): the contract's trace/insn records, one per instruction before it executes: `t` the CPU cycle count from power-on (`clock` cpu), `pc`, `op` (the instruction's bytes), `regs` A, X, Y, S and P (the 6502's documented names), and three tool-specific fields, `line` and `dot` (the PPU's position as Mesen2 counts it) and `frame` (Mesen2's frame counter). The trace ends at the end of the last frame, exactly (the emulator is held there). Mesen2 does not list interrupt entries as instructions. - `cx4.trace.gz` (`snes-cx4`, `--trace cx4-text`): Mesen2's own Cx4 trace text, a tool-specific format kept as hg51b-python reads it: one line per Cx4 instruction before it executes, the ROM address of the cached word, the bytes, the disassembly, the registers in decimal and Mesen2's cycle and frame counters (its small, restarting cycle column is not a time stamp). - `host.txt.gz` (`snes-cx4`, `--trace host`): every S-CPU read and write of banks 00-3F and 80-BF, $6000-$7FFF, one line per frame: the frame number, then tokens of `r` or `w`, the 16-bit address, a colon and the values as hex pairs (consecutive addresses of one kind share a token; a repeated access of one value carries `*count`); a write to $7F47, $7F48 or $7F4F is a token of its own with `@` and the master clock. From 0.2.0 it holds exactly frames 1 to `--frames` (or to the frame the run ended at), every one (taken from the full script log, not polled). The runner prints one line about it, `host stream: R of F frames, complete: PATH` (or `..., N missing: [...]`, and then the manifest's `status` says so and the exit status is 1); up to 0.2.0 it printed `host stream: 0 frames` here whatever the stream held, a count from the adapter's polling that `run.py` does not use. - `script-log.txt` (`--lua`): every line your script logged, in order, up to the end of the last frame (`--frames`, or the frame the run ended at). - `audio.wav` (`nes --audio-out`): 48 kHz stereo 16-bit PCM, ending where the emulator was held at the end of frame `--frames` (above). - `work/`: Mesen2's home directory (settings, battery saves) and raw intermediates; not outputs. No copy of a BIOS is left there. Run-to-run variation. With the default settings, `run.py`'s outputs repeat run for run: the frames, traces, script log and host stream all end at the last frame, the SNES draws every frame, RAM powers on as zeros (0.2.0), and from 0.3.0 `audio.wav` ends at `--frames` too. The `.gz` files carry gzip's time stamp in their header, so compare their contents, not their bytes. What still varies: `--power-on-ram random`, the manifest's `started` and `tool_commit`, and the remaining old shims, which keep 0.1.0's behaviour on purpose (famicom-python's `mesen_run.py` polls Mesen2's log; its `mesen_audio.py` records as 0.2.0 did, then cuts the recording to `--frames` itself). ## The old entry points (shims) These files keep their names, command lines and outputs; each is a few lines that load `mesen2_runner/compat/` (`docs/consumer-migration.md` says how each consumer moves off them): | Shim | Consumer, through | Rebuilt as | | --- | --- | --- | | `$EMU_TOOLS_GPL/tools/famicom-python/mesen_audio.py` | famicom-python (run by path, with its venv) | `compat/famicom_audio.py` | | `$EMU_TOOLS_GPL/tools/famicom-python/mesen_run.py` | none left in code (famicom-python's scripts run `run.py` since 2026-11-24); `mesen_audio.py` uses its module | `compat/famicom_run.py` on the `nes` adapter | | `$EMU_TOOLS_GPL/tools/famicom-python/mesen2-detector-fixes.patch` | famicom-python's documents (applied by hand) | a link to `patches/` | | `$EMU_TOOLS_GPL/tools/huc6280-python/vanish_probe.py` | huc6280-python, `EMU_TOOLS_GPL` | `compat/huc6280_vanish.py` | **Finding the library** (from 0.3.0, so no variable is needed once `build.sh` has run): `mesen_run.py` and `mesen_audio.py` take `MESEN_LIB` if set, else `MESEN_CORE`, else the consumer checkout's hand build (`reference/build-mesen2/Mesen2/InteropDLL/obj.linux-x64/MesenCore.so` under `FAMICOM_PYTHON_ROOT`, else the working directory) if it exists, else this tool's own build (`upstream/Mesen2/InteropDLL/obj.linux-x64/MesenCore.so`, made by `build.sh`); with none of them present they stop with exit status 3 and name what to set. Up to 0.2.0 they read only `MESEN_LIB` and the hand build. `vanish_probe.py` takes `--mesen-core`, else `MESEN_CORE`, else this tool's own build (it had no fallback). The libraries they used before are still found first, so their outputs are unchanged. **Retired 2026-11-24** (moved to `../../attic/` with their compat modules, not deleted; no code in any family repository referenced them): `tools/snes-python/mesen_run.py` (snes-python and gsu-python run `run.py --machine snes`), `tools/pcengine-python/mesen_run.py` (pcengine-python runs `run.py --machine pce`) and `tools/hg51b-python/mesen_cx4_trace.py` (hg51b-python runs `run.py --machine snes-cx4`). `../../attic/README.md` lists them. ## Smoke test `python3 -I tests/smoke.py [--lib PATH]` needs no commercial ROM and no firmware. Without a library it checks the version line, the exit codes (including 0.2.0's usage errors and a missing batch file), the input reader, the frame decoder, the trace parser, a batch line's options, the FDS image check and the BIOS reader (loose and zipped, from the option and the variable; with an 8 KiB stand-in written by the test, not the real BIOS). With one it builds an endless-loop program for the NES, the PC Engine and the SNES and runs each for ten frames (manifest, picture, NES trace), then each 0.2.0 option: a 1000-line script log, complete and ending with the last frame; `--power-on-ram zeros` and `ones` read back from work RAM on the NES and the SNES; `--reset-at` on the NES and the SNES, one reset where Mesen2 takes it and the same result in two runs, and refused on the PC Engine; `--no-sprites`; an FDS image with the stand-in BIOS from `--fds-bios` and from `FDS_BIOS`, and exit 3 without; `--input` on a synthetic Cx4 cartridge, the press read in the joypad registers; and a batch of three runs whose outputs equal the same runs alone. And each 0.3.0 option: `emu.stop(3)` at frame 5 on the NES, the SNES and the PC Engine (exit 0, the code and frame in the manifest's `end`, the log and picture ending there, the NES picture equal to a 5-frame run's); `--until log:TEXT` reached and not reached, and refused without `--lua`; `snes --frames-at` (a frame equal to a run of that many frames'); and two `--audio-out` recordings, byte-identical.