diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -39,6 +39,36 @@ Requires a truecolor-capable terminal (`COLORTERM=truecolor`) at least Since terminals don't report key-release, buttons are held for a few frames after each keypress (relying on the terminal's key-repeat for sustained holds). +### External control channel (FIFO) + +Start with `--fifo [path]` (default `/tmp/gbc.fifo`) to open a named pipe that +accepts button commands from any process. Unlike the terminal keyboard, this +can send true key-**release** events, so it gives deterministic input for +scripting and automated testing. + +```sh +./build/gbc rom.gb --fifo /tmp/gbc.fifo & +echo 'a' > /tmp/gbc.fifo # momentary tap of A +echo 'start' > /tmp/gbc.fifo # tap Start +echo '+left' > /tmp/gbc.fifo # press and HOLD Left +echo 'a b' > /tmp/gbc.fifo # tap A and B together (Left still held) +echo '-left' > /tmp/gbc.fifo # release Left +echo 'release' > /tmp/gbc.fifo # release everything held +echo 'a:30' > /tmp/gbc.fifo # tap A, held for 30 frames +``` + +Commands (one line, space/comma separated tokens, case-insensitive): + +| Token | Effect | +|----------------|-----------------------------------------| +| `a b start select up down left right` | momentary tap | +| `name:N` | tap held for N frames | +| `+name` | press and hold until released | +| `-name` | release a held button | +| `release` | release all held buttons | + +Set `GBC_INPUT_DEBUG=1` to trace resulting joypad state to stderr. + ## Architecture | File | Responsibility | |
