moviemin

command
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Command moviemin shrinks an .fm2 movie to the shortest version that still passes a given Go test, using that test as the pass/fail oracle.

A recorded movie carries a lot of slack: a human holds each button far longer than the ROM needs and pauses between presses, so a faithful recording is mostly wasted frames. moviemin removes that slack automatically.

It groups the movie into runs of identical input (a held button, an idle gap), then binary-searches each run's length down to the fewest frames for which the test still passes, adding a small margin back so the result is not balanced on a knife's edge. Because the oracle is a real `go test` run, moviemin needs no knowledge of how the test decides success (screen text, a $6000 result byte, a RAM location, anything): the test announces it by passing or failing, and the test reads the very movie file moviemin is rewriting.

Usage:

go run ./tools/moviemin -test <TestName> -movie <path.fm2> [-pkg ./test/] [-margin 2]

Example (run from the repo root):

go run ./tools/moviemin -test TestReadJoy_Buttons_MovieDriven \
    -movie test/test_buttons.fm2

moviemin overwrites -movie in place as it searches and leaves the minimized movie there on success; recover the original from git if you need it. It assumes monotonicity: if a run length passes, any longer length also passes. That holds for timing-gated input (hold until the press is detected, release past the debounce) but not for ROMs that require an exact frame count, which are not candidates for this tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL