feat(vk): headless shots draw the mods' UI as a window does #2837

Merged
HumanBean merged 2 commits from HumanBean/Longshot:feat/shots-draw-mods-ui into mod-api 2026-11-29 23:30:20 +00:00
Owner

Summary

Why. On the mod API branch (#2822) a headless run's screenshots (RX_VK_SHOTS, RX_VK_SHOT_MENU=1) drew the mods' UI with a copy of the window's draw order of their own, without Colour vision, and laid the hosted debug page out at the window's size instead of the shot's. This makes the shot and the window draw the overlays through one function, so a headless shot shows what a window would: mods' HUDs, windows and world labels, then the Insert menu (the menu system mod) and its page.

What changed

  • gpu/vk/vk_menu.cpp/.h: draw_overlays draws the mods' UI, then the menu and its hosted page; menu_record (the window) and menu_record_image (a shot) both call it, and the shot takes the window's Colour vision mode.
  • gpu/vk/vk_replay.cpp: the shot path passes Colour vision as the window does.
  • gpu/vk/vk_ui.cpp: the hosted debug page is laid into the shot's size when headless.
  • gpu/vk/switches.def: RX_VK_SHOT_MENU's row says what it draws (default off, unchanged).
  • Docs: docs/dev/developing.md (screenshots on a timer), the guide images README.
  • docs/dev/reference/control-bridge.md: menu_key works headless only with RX_VK_SHOT_MENU=1, which ticks the menu there.
  • Tests: tests/test_fps_overlay_order.py runs both record paths with stubs and checks they make the same draws and colour mode; tests/test_ui_renderer.py follows draw_overlays.

Testing

Tested: Linux (CachyOS, Linux 7.3, RTX 3090, NVIDIA 620.70.06), on bfa15b49 (before the rebase onto mod-api 4cc50ca1; f32312f8 compiles and passes the changed checks), a headless run through the job queue with the sandbox on, 1920x1080 shots every 20 presents, RX_VK_MENU_SCRIPT opening the Insert menu and stepping through its tabs, and the link-hud example loaded through LONGSHOT_DEV_MODS: the shots show the menu system mod's Graphics, Audio, Gameplay, Controls and NFC tabs as a window shows them, and link-hud's HUD (hearts and rupees, top left) and its label over Link with the menu closed.

Still to test:

  • A shot after a mod is switched off in the Mods tab, expecting its HUD gone (by hand, or a menu script that turns it off)

Measurements

Verdict: nothing to measure: the change is in a diagnostic switch's path (RX_VK_SHOT_MENU, off by default); a window's present calls the same draws as before, in the same order.

Risks

  • A window's overlays now go through draw_overlays; the test checks the window and shot paths make the same draw sequence. No switch to turn it off: the window path's order is unchanged.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit. (On the mod API branch, the base of this PR.)
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (The two checks this changes pass; the rest is the mod API branch's.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Approved in review, every comment answered.
  • CI passes on the head.

🤖 Generated with Claude Code

## Summary **Why.** On the mod API branch ([#2822](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2822)) a headless run's screenshots (`RX_VK_SHOTS`, `RX_VK_SHOT_MENU=1`) drew the mods' UI with a copy of the window's draw order of their own, without Colour vision, and laid the hosted debug page out at the window's size instead of the shot's. This makes the shot and the window draw the overlays through one function, so a headless shot shows what a window would: mods' HUDs, windows and world labels, then the Insert menu (the menu system mod) and its page. **What changed** - `gpu/vk/vk_menu.cpp`/`.h`: `draw_overlays` draws the mods' UI, then the menu and its hosted page; `menu_record` (the window) and `menu_record_image` (a shot) both call it, and the shot takes the window's Colour vision mode. - `gpu/vk/vk_replay.cpp`: the shot path passes Colour vision as the window does. - `gpu/vk/vk_ui.cpp`: the hosted debug page is laid into the shot's size when headless. - `gpu/vk/switches.def`: `RX_VK_SHOT_MENU`'s row says what it draws (default off, unchanged). - Docs: `docs/dev/developing.md` (screenshots on a timer), the guide images README. - `docs/dev/reference/control-bridge.md`: `menu_key` works headless only with `RX_VK_SHOT_MENU=1`, which ticks the menu there. - Tests: `tests/test_fps_overlay_order.py` runs both record paths with stubs and checks they make the same draws and colour mode; `tests/test_ui_renderer.py` follows `draw_overlays`. ## Testing **Tested:** Linux (CachyOS, Linux 7.3, RTX 3090, NVIDIA 620.70.06), on bfa15b49 (before the rebase onto mod-api 4cc50ca1; f32312f8 compiles and passes the changed checks), a headless run through the job queue with the sandbox on, 1920x1080 shots every 20 presents, `RX_VK_MENU_SCRIPT` opening the Insert menu and stepping through its tabs, and the `link-hud` example loaded through `LONGSHOT_DEV_MODS`: the shots show the menu system mod's Graphics, Audio, Gameplay, Controls and NFC tabs as a window shows them, and link-hud's HUD (hearts and rupees, top left) and its label over Link with the menu closed. **Still to test:** - A shot after a mod is switched off in the Mods tab, expecting its HUD gone (by hand, or a menu script that turns it off) ## Measurements **Verdict:** nothing to measure: the change is in a diagnostic switch's path (`RX_VK_SHOT_MENU`, off by default); a window's present calls the same draws as before, in the same order. ## Risks - A window's overlays now go through `draw_overlays`; the test checks the window and shot paths make the same draw sequence. No switch to turn it off: the window path's order is unchanged. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. *(On the mod API branch, the base of this PR.)* - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). *(The two checks this changes pass; the rest is the mod API branch's.)* - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Approved in review, every comment answered. - [ ] CI passes on the head. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
menu_record and menu_record_image now draw one function's overlays
(draw_overlays): the mods' UI (HUDs, windows, world labels, the FPS
counter), then the Insert menu with its hosted page. The shot gets the
window's Colour vision mode, and the hosted debug page is laid into the
shots' size headless rather than the swapchain's. The switch's row and
the docs say what it draws; tests/test_fps_overlay_order.py runs both
paths and checks the shot path's wiring.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(control): menu_key works headless only with RX_VK_SHOT_MENU=1, which ticks the menu there
Some checks failed
PR description / Title and description (pull_request_target) Failing after 8s
856de33cc0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member

Possibly related, for context:

  • PR #1709 feat(input): a Screenshot control saves a PNG of the game's picture, F12 and the Capture button by default — Overlapping screenshot capture and toast implementation in the same Vulkan files
Possibly related, for context: - PR #1709 feat(input): a Screenshot control saves a PNG of the game's picture, F12 and the Capture button by default — Overlapping screenshot capture and toast implementation in the same Vulkan files
Author
Owner

Tested in the game on this PC (Linux CachyOS, RTX 3090, NVIDIA 620.70.06): a headless run with the sandbox on, 1920x1080 shots, the Insert menu opened and stepped through by RX_VK_MENU_SCRIPT, and the link-hud example loaded. The shots show the menu system mod's tabs and link-hud's HUD and world label as a window shows them. Not yet shown: a mod switched off in the Mods tab leaving no HUD in the shot.

Tested in the game on this PC (Linux CachyOS, RTX 3090, NVIDIA 620.70.06): a headless run with the sandbox on, 1920x1080 shots, the Insert menu opened and stepped through by RX_VK_MENU_SCRIPT, and the link-hud example loaded. The shots show the menu system mod's tabs and link-hud's HUD and world label as a window shows them. Not yet shown: a mod switched off in the Mods tab leaving no HUD in the shot.
HumanBean force-pushed feat/shots-draw-mods-ui from 856de33cc0
Some checks failed
PR description / Title and description (pull_request_target) Failing after 8s
to f32312f8a1
All checks were successful
PR description / Title and description (pull_request_target) Successful in 7s
2026-11-29 23:25:50 +00:00
Compare
Author
Owner

Rebased onto mod-api 4cc50ca1 (main merged in), no conflicts; head f32312f8. The changed checks (overlay order, UI renderer, keyboard menu option, switch table, docs) pass, and the renderer and the game side compile.

Rebased onto mod-api 4cc50ca1 (main merged in), no conflicts; head f32312f8. The changed checks (overlay order, UI renderer, keyboard menu option, switch table, docs) pass, and the renderer and the game side compile.
HumanBean changed title from feat/shots-draw-mods-ui to feat(vk): headless shots draw the mods' UI as a window does 2026-11-29 23:26:33 +00:00
HumanBean merged commit 816d235493 into mod-api 2026-11-29 23:30:20 +00:00
HumanBean deleted branch feat/shots-draw-mods-ui 2026-11-29 23:30:21 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2837
No description provided.