diff --git a/docs/agent-reports/play-integration.md b/docs/agent-reports/play-integration.md new file mode 100644 index 0000000..2cee6e2 --- /dev/null +++ b/docs/agent-reports/play-integration.md @@ -0,0 +1,97 @@ +# play-integration + +Goal: make the launcher usable end to end. Play starts games through `summit run`, with an Enhance toggle, +a per-game profile editor, clip settings, a global save-clip key on Linux, and verification on the GPU VM. + +## What changed + +**summit-core** +- `display`: `Output`/`Mode`, parsers for `xrandr --query`, `kscreen-doctor -j` and `wlr-randr --json`, + `outputs()` (runs the session's tool), `restore_profile()` (the mode in use now, to put back afterwards) and + `plan_for()` (on X11, asks for a custom mode such as `1920x1080_120.00` by its name; xrandr matches + `--mode` by name). +- `launch::plan(entry, cli, enhance)`: Steam and Lutris now also go through `summit run` (with `--detached`). + Steam with Enhance adds `--enhance --window class:steam_app_ --wait 120`. Custom entries: + `summit run [--enhance] -- `. Without the summit binary, Steam/Lutris fall back to the bare + client command (and Enhance is unavailable). +- `engine::supervise(.., detached)`: when the launcher command returns at once (`steam steam://…`), it waits + for the engine alone, which ends when the game's window closes. +- `profile.enhance` (serde default, so old files load with it off). `hotkey::status()` gives the settings + page one line saying whether a global key exists in this session (X11, or the portal on Wayland via `gdbus introspect`). + +**summit (CLI)** +- `summit run`: prints each display step it runs, reads the current mode first and puts it back when the + game ends (or, detached + enhance, when the engine ends). `--detached`. Steam ids and detached runs are not + tracked (their own launcher keeps playtime). +- `summit profile set --enhance true|false`. `summit doctor` lists the outputs. + +**summit-gui** +- The game page has Play, an **Enhance on/off** toggle (key E), Pin, **Profile**, and Change artwork (still Soon). + Enhance is disabled, with the reason shown, for Lutris, Heroic, disk finds, games that aren't installed, and + non-X11 sessions. +- Profile editor overlay: Monitor (real outputs), Resolution and Refresh (that output's real modes and rates), + Fullscreen, Focus, Upscaler, Frame generation, Target rate. Every change is saved through `profile::save`. + Rows are built by pure functions in `data.rs` (`edit_rows`, `edit_apply`), which are unit tested. +- Play's output goes to `~/.cache/summit/last-run.log`. +- Settings → Clips shows the global-key status. Layout, theme, size and animation were already persisted to + `ui.toml` (no change needed). Clip lengths were already passed as `--replay/--clip-length`. + +**engine** +- `framegen/globalkeys.py`: + - X11: `XGrabKey` on the root window via ctypes libX11, with NumLock/CapsLock variants and auto-repeat + debounce. A key another client holds is reported as taken (BadAccess caught). + - Wayland: xdg-desktop-portal GlobalShortcuts via the optional `jeepney` package. + - Otherwise it reports itself unavailable. + - `replay.Recorder` uses it on Linux for Ctrl+Alt+R / Ctrl+Alt+B; Windows keeps `RegisterHotKey`. + +## Verified, and how + +- `cargo test --workspace`: 89 tests pass (new: output parsers incl. a custom xrandr mode, restore plan, + launch plans with enhance/detached, detached supervise, profile compat, editor rows). +- `engine/tests/test_globalkeys.py` (5 tests) passes locally under Xvfb. Ctrl+Alt+R/B were injected with XTest: + they fired, a bare `r` did not, and a second grab was reported as taken. It also passes on the VM's real KDE X11 + desktop, but only with the screen unlocked (see "Not done"). +- On the GPU VM (KDE neon X11, RTX 3090, software OpenGL), release build in `/home/user/summit-play`, engine + copy in `/home/user/engine-play`: + - **Display plan really runs**: profile set to `Virtual-1` 1280x800 @ 74.99. `summit run custom:voidrunner` + logged `display: ran xrandr --output Virtual-1 --mode 1280x800 --rate 74.99`. xrandr showed + `1280x800 74.99*` during the run and the game reported a 1280x800 display. After the game was killed: + `display: ran xrandr --output Virtual-1 --mode 1920x1080_120.00 --rate 119.93`, and xrandr was back to + `1920x1080_120.00 119.93*`. + - **Plain Play from the GUI**: started `summit run custom:voidrunner -- …/top_down_shooter`. + - **Clip settings page**: arrow keys in the real window set 3 min / 3 min, and `ui.toml` then held + `replay_seconds = 180`, `clip_seconds = 180`. + - **GUI path with Enhance** (`gui-*.png` in docs/media/live): + 1. Enhance toggled on (profile got `enhance = true`). + 2. The editor opened and listed `Virtual-1`'s modes. + 3. Play ran `summit run custom:voidrunner --enhance -- …`. The engine got + `--source window --window pid: --scaler fsr --display --hz 60 --fullscreen --window-wait 60 --replay 180 --clip-length 180 --no-graph` + (the last flag from `SUMMIT_ENGINE_ARGS`, because the GPU is short of memory). + 4. The engine printed `[keys] global keys (x11): ctrl+alt+r, ctrl+alt+b`. Ctrl+Alt+R (XTest, game focused) + gave `[replay] saved 30.3 s -> /home/user/Videos/SmoovPlay/SmoovPlay 2026-11-24 08-38-36.mp4`. + ffprobe: 30.29 s, 1280x720. + 5. Killing the game printed "the game exited; the engine was stopped" and the session was tracked. + - VM state was put back afterwards: Voidrunner profile restored from backup, temporary `data/settings.cfg` + (720p window) deleted, `~/.config/summit/ui.toml` removed (it did not exist before), no processes left. + The saved test clip is still in `~/Videos/SmoovPlay/`. + +## NOT done / not verified + +- **Steam path untested**: no Steam on either machine. It's also unknown whether native (non-Proton) Steam games + have a `steam_app_` window class; if they don't, Enhance waits 120 s and gives up. +- **Lutris** via `summit run --detached`: untested. Enhance is not offered for Lutris. +- **Wayland, all of it**: + - `kscreen-doctor` / `wlr-randr` output parsing is tested only against sample JSON. + - The GlobalShortcuts portal backend has never run. + - Live window capture is still X11-only, so Enhance is disabled on Wayland. +- **Focus** is stored only (nothing raises the game window). +- **Fullscreen** affects only the engine's output, not the game's own window mode. +- **Display restore gaps**: a detached launch without Enhance (Steam) does not restore the mode, because + Summit can't see when the game ends. If `summit run` itself is killed, nothing is restored either. +- **Lock screen**: the global X11 key does not fire while the KDE lock screen holds the keyboard. That is expected + X behaviour, but it confused the first VM test. +- **Engine toast quirk** (inherited from SmoovPlay, not touched): the toast shows the clip path with Windows + backslashes (`Videos\SmoovPlay\…`). The file itself is fine. +- 90/120 Hz output and RTX VSR are still untested, as the UI labels say. +- **Build machine disk**: the root volume was 100% full during this task (only root-reserved blocks left), from + things outside this worktree. I only deleted this worktree's own `target/debug/incremental`.