Skip to content

Commit e764864

Browse files
committed
docs: document headless mode and golden-frame workflow
Adds a Headless mode section under Usage covering the new CLI flags and the workflow for adding new golden ROMs to the CI regression suite.
1 parent d71feba commit e764864

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,50 @@ cmake .. -DENABLE_REWIND=OFF
185185

186186
Save files (`<rom>.sav`) and save states (`<rom>.ss<N>`) are written next to the ROM.
187187

188+
### Headless mode
189+
190+
Run the emulator without an SDL window or audio output, writing one
191+
FNV-1a hash of the 240×160 framebuffer per frame:
192+
193+
```bash
194+
./gba_emulator <rom.gba> --headless --frames 240 --hash-out hashes.txt
195+
```
196+
197+
| Flag | Meaning |
198+
|------|---------|
199+
| `--headless` | Skip SDL, audio, link cable, X-Ray, and rewind. |
200+
| `--frames <n>` | Run exactly `n` frames then exit. Required with `--headless`. |
201+
| `--hash-out <file>` | Write per-frame `<N> <FNV1a-hex>` lines. Defaults to stdout. |
202+
203+
Headless mode is incompatible with `--link-master` / `--link-client`
204+
(they would block the dispatch waiting for a peer).
205+
206+
#### Golden-frame regression testing
207+
208+
The CI job `golden-frame` (in `.github/workflows/ci.yml`) re-runs the
209+
emulator on the pinned [jsmolka/gba-tests](https://github.com/jsmolka/gba-tests)
210+
ROMs and diffs the per-frame hash output against
211+
`tests/golden/<rom>.hash`. Any change that alters rendering output
212+
fails the workflow.
213+
214+
**To add a new golden ROM:**
215+
216+
1. Place or fetch the ROM somewhere local (e.g. `tools/fetch_test_roms.sh /tmp/gba-test-roms`).
217+
2. Bake the golden hash from a clean Release build:
218+
```bash
219+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
220+
cmake --build build --target gba_emulator
221+
build/gba_emulator path/to/rom.gba \
222+
--headless --frames 240 --hash-out tests/golden/<name>.hash
223+
```
224+
3. Manually verify the ROM actually renders correctly — interactive mode
225+
is the simplest way (`./gba_emulator path/to/rom.gba`).
226+
4. Add a new step in `.github/workflows/ci.yml`'s `golden-frame` job
227+
calling `tools/check_golden.sh build/gba_emulator
228+
/tmp/gba-test-roms/<rom>.gba tests/golden/<name>.hash`.
229+
5. Commit the new `.hash` file and CI step together so they land in the
230+
same change.
231+
188232
## Link Cable
189233

190234
Two emulator instances on the same machine can connect over a UNIX domain socket and exchange GBA SIO multiplayer-mode packets — enough for Pokemon trade and battle between local windows.

0 commit comments

Comments
 (0)