# Running, recording and driving it headless ## The executable ``` bin\burnout3.exe [--headless] [--record out.mp4] [--seconds N] [path\to\default.xbe] ``` Run it from the repo folder. It reads the disc from `Burnout 3 Takedown\` and keeps the emulated hard disk (profile, cache partitions) in the save folder, see [Saves, backups and crash reports](#saves-backups-and-crash-reports). Delete its `UDATA` to go through first boot again. - Windowed by default. The title bar reads `Burnout 3: Takedown | FPS: 14 | draws: 212`. The title comes from the XBE certificate; draws are the draw calls in the last frame. - `--build-shaders` compiles the shaders ahead of time by playing two scenes headless; optional, see [shader-prebuild.md](shader-prebuild.md). - `--bug-report [--out ]` writes a bug report archive and exits, without starting the game; see [Reporting a bug](#reporting-a-bug). - `--headless` opens no window. Use it for scripts, CI, and over RDP, where a window would land on whatever screen the remote session is showing. - `--record out.mp4` writes every presented frame as a BMP into `%TEMP%\bo3rec_\`. When the run ends, after `--seconds N` or on Ctrl+C, it encodes them with `ffmpeg` at 30 fps. If ffmpeg is missing or fails, the frames stay where they are and the path is printed. The frames go to disk because at a few fps streaming gains nothing, and an encoder that fails cannot lose the run. The fps is real frames per wall-clock second. The title steps its simulation a fixed amount per frame, so at 3 fps a race plays in slow motion but correctly, and a recording played back at 30 fps looks close to full speed. ## Quitting The main menu has a QUIT line below Driver Details (BO-301, `src/game/mainquit.c`). It closes the game the way the window's close button does: the host's quit request, then `SDL_QUIT`, so the saves in flight finish, the pads stop and the GPU and the audio device are taken down in order. The log has `[MENU] main menu: QUIT listed` when the menu was built and `[MENU] main menu: QUIT chosen` then `[QUIT] asked for` when it was used. `TAKEDAWN_QUIT_MENU=0` leaves the menu as the title has it, and a headless run has no window to close and does not list it (`TAKEDAWN_QUIT_MENU=1` lists it there too, for the scene). Settings > Quit game (on every page) and Alt+F4 are still there. `tools/headless/mainquit_scene.sh` (WINDOW=1) drives it. ## Saves, backups and crash reports The save folder is per user: | Host | Save folder | |---|---| | macOS | `~/Library/Application Support/Takedawn` | | Linux, Steam Deck | `$XDG_DATA_HOME/takedawn`, else `~/.local/share/takedawn` | | Windows | `%APPDATA%\Takedawn` | | Android | `takedawn/` in the app's folder, `Android/data/io.github.xenophobentx.takedawn/files` | Portable mode (Windows and Linux, BO-263): an empty `portable.txt`, or a `data` folder, beside `Takedawn.exe` (on Linux beside the `.AppImage` file, from `$APPIMAGE`; in a build run from a checkout, beside the executable) puts the saves in `data/Saves`, the game data in `data/Game` and the shader cache in `data/cache`. Without the marker the folders above are used. The log has a `[SAVE] portable mode` line. `RECOMP_SAVE_DIR` still wins for the saves. A folder of the port's earlier name (`Burnout3`, `burnout3`) is moved to the new name once, at the first start ([installer.md](installer.md)). `RECOMP_SAVE_DIR=` uses another one; the headless scripts in `tools/headless/` set it to the checkout's `saves/`, so a test run never touches your profile. The first start of a build with the per-user folder copies an existing `./saves` there once (the partition images are remade, not copied) and leaves a `MOVED.txt` in the old folder. What is in it: - `UDATA/4541005b//` the profile (`Profile 1`, `SaveMeta.xbx`) and `TDATA/4541005b/` the title's own data, as plain files. - `Partition*.img` the HDD partitions the title mounts as devices. They are sparse: gigabytes on paper, kilobytes on disk. - `backup//` a copy of `UDATA` and `TDATA` taken at start, before the game can write, whenever they changed since the last backup. The newest five are kept (`RECOMP_SAVE_BACKUPS=`, `0` none). To go back, quit the game and copy a backup's `UDATA` and `TDATA` over the save folder's. - `logs/` the output of this run and of the three before it: `run.log` (the first 64 KB: the start, with the device, the display and the settings) and `run.tail.log` / `run.tail.old.log` (what came after, at most 768 KB); `prev1.*` to `prev3.*` are the earlier runs. Written as the game runs, so they are there after a crash or a kill. - `reports/` the bug report archives, see [Reporting a bug](#reporting-a-bug). - `crash/-/` a report per crash (`crash`), guest bugcheck (`bugcheck`) or hang (`hang`): `report.txt` (host backtrace, guest registers, the guest call stack as `tools/stackwalk.py` prints it, and its raw `GS` lines), `log.txt` (the last 500 lines of output), `settings.txt` (command line, paths, `enhance.toml`, every `RECOMP_*` value) and, on Windows, `minidump.dmp`. A hang is no flip for `RECOMP_HANG_WATCHDOG` seconds (default 15, 60 before the first frame, `0` off); the game is left running. Moving a profile between machines (Mac and Deck): quit the game on both, then copy the `UDATA` folder from one save folder to the other, for example `scp -r ~/Library/Application\ Support/Takedawn/UDATA @:.local/share/takedawn/`. `RECOMP_DEBUG=crash_test=segv:10` (or `=hang:10`) faults (or hangs) the game's main thread ten seconds in, to see a report being made. ## Updating The game never looks for updates by itself and sends nothing at start. To check, open the settings (Back+Start on a pad, F1, Cmd+, on a Mac), go to the System page, under the version line, and choose Check for updates. That makes one anonymous HTTPS request to GitHub's latest-release record for this port (`https://api.github.com/repos/xenophobentx/takedawn/releases/latest`, with a `Takedawn/` User-Agent), off the main thread, giving up after ten seconds. The row then says one of: you have the latest version; version X is out, with the first lines of its release notes and Open the download page (it opens the release page in your browser, nothing is downloaded or installed); no release is published yet; or why it could not check (offline, timed out). On macOS and Windows the system's own networking does the request; on Linux the system's `curl` is started. Android has no such row. ## Reporting a bug The game can pack what a bug report needs into one zip file. Nothing is sent anywhere. The file is written to your disk, you can open it and read it, and you attach it to the issue yourself. How to make one: - In the game: open the settings (Back+Start on a pad, F1, Cmd+, on a Mac), go to the System page and choose Create bug report, or Create bug report with a screenshot to add the picture that is behind the menu. The line under the menu then says where the file is. - When the game does not start, or without starting it: `burnout3 --bug-report` (`bin\burnout3.exe --bug-report` on Windows) from the game's folder. It prints the file's path. `--out ` writes it somewhere else. - Android: the same entry in the in-game settings; and the page the app shows when it cannot start the game (no game data, no usable graphics driver) has a Create bug report button (Y on a pad), with Save a copy to Downloads and Share on the page after it. Where it goes: `reports/takedawn-report--