refactor(menu): move the Insert menu's logic out of the renderer into the game #3208
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3208
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:refactor/menu-out-of-renderer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The Insert menu's rows and frame were already Rust and TypeScript, but
gpu/vkstill held its open/close and input,the device features behind its rows (audio, microphone, NFC, monitors, vibration, input recording, Restart/Quit), the
output size and aspect rules, the lock texts and Save my pipeline list. This moves all of that into the game
(
game/crates/api,longshot-game), which calls the host directly. The renderer now knows no menu: it draws the UI'sdraw list, reports GPU facts and reacts to the settings snapshot. It is meant to behave as before.
gpu/vk/vk_menu*,menu_module.handgpu/vk/menu/are gone. What stays is ingpu/vk/settings/(settingsreactions, capabilities, status, the per-present tick, bug report) and in
vk_stats,vk_startup,vk_drs,vk_auto,vk_lang.MKWVK_API_VERSIONis 96 andMKW_UI_VERSION13.Read first:
game/crates/api/src/services/menu_input.rsandgame/crates/longshot-game/src/menu_input.rs: open/close and keys.The state is behind one mutex; the renderer calls in from one present at a time through
MkwVkHost.ui_begin.game/crates/api/src/services/devices.rs,output.rs,renderer_reasons.rs.game/crates/longshot-game/src/pipeline_share.rs.gpu/vk/vk_api.handgpu/vk/settings/.Overlaps open work-in-progress pull requests #3116 (renderer in its own process) and #3080 (renames across the
renderer): whichever merges second has to be rebased by hand.
Behaviour differences:
previous present's UI state (text field has the keyboard, window has input).
GetSystemMetrics.help-line translations are removed from each language file.
output:.main'ssettingsHost.open(#3209, the pause menu's Longshot Options button) is taken by the game's menu state, notthe renderer;
ui_modal()stands in formenu_is_open()in #3202's HUD-less picture for DLSS Frame Generation.main: with two microphones of one name, picking the other did nothing.Not moved, on purpose: the ReShade file list (the saved setting is a position in the renderer's list), the frame
generation clamp (it protects what goes to NGX and device creation) and the menu's language list (the renderer needs
it for font merging).
Seen on the way, already on
mainand not fixed here: the "DLAA only…" lock text is longer thanLsLocked.why, soit is cut off and probably never finds its translation.
Testing
Tested: Linux (CachyOS, kernel 7.3), RTX 3090, NVIDIA driver 0x9b118180, at 9f894d7aaee4 (before two later
rebases):
dev.py smoke, headless: PASS, in play fromkokiri-start, 900 frames, the Insert menu opened and its page hosted.Smoke screenshots leave overlays out, so this does not show the menu drawn.
HOS_SYSTEM_MODS_DIRset. The author reports ittested and looking good; the parts of the menu covered were not itemised.
Checks on Linux, on
main7bc53f8413(game-free, in the PC's job queue as builds). Nothing since 9f894d7aaee4 hasrun in the game: the branch has been rebased three times since, and got the microphone fix, the two ports above and
their checks.
cargo fmt --check,schema-gen --check,ffi-gen --check: pass.tests/run_all.py: 880 passed, 14 failed, 13 skipped, before the last fix (the HUD-less picture's compile). Two ofthe 14 (
test_image_reaper_threads,test_prepare_stall) passed when run again, here and onmain. The other 12also fail on
main:test_present_acquire_ahead,test_present_held_image,test_present_geometry_trace,test_present_image_free,test_dlssg,test_no_game_title,test_sync_watch_event,test_ui_renderer,test_turf_budget,test_vk_draw_overhead_lean,test_lifter,test_no_map_reload. After the fix, those and thechecks it touches were run again.
cargo test -p modtool: 273 passed, 1 failed: the menu mod's tests, which fail the same way onmain(the developerpage's layout on every run, a search frame over its script limit on some).
cargo test:the_repository_s_lock_and_the_table_agree,installed_versions_reuse_their_own_builds_with_one_profileand
a_copy_links_the_builders_files_clones_the_rest_and_refreshes_in_placefail, as onmainbefore this rebase.net-broker's two local endpoint tests failed in the full run and passed on a rerun.api,host-sysandlongshot-gamepasses withmain's two lints allowed (large_const_arrays,needless_range_loop); without that, the workspace stops on them.longshot_vk.solinks;check_host_compile.py: 83 units, 0 failed.check_host_compile.py: 81 units, 0 failed. The renderer DLLwas not fully linked: the local link script lacks the generated font and zstd objects.
Tests removed or weakened:
test_display_modes.py,test_fullscreen_monitor_menu.py,test_hos_ab_table.py,test_menu_hit.cpp,test_menu_utf8.pyandtest_output_size_start.pyare gone; their main cases are Rust testsnow. The compiled Menu size and cursor-mapping cases are now source checks or a Rust unit test, and the renderer's
Game language row choice is no longer tested since that code is gone.
Still to test:
Esc, the pause menu's Longshot Options button, the controller and touchpad; text fields; devices and monitors; Output resolution and locked upscaler rows;
Restart, Quit, Bug report; mod debug page, permission prompt and popped-out window (by hand).
HOS_SANDBOX=1: Restart, Bug report and Save my pipeline list (zip, clipboard, folder, issue page) (by hand).pipeline list, the Intel rows, ultrawide with FSR 4 shader preparation (@Beanstalk Windows, and by hand).
Measurements
Verdict: within the spread of
mainin the Market with the menu closed (one pair of runs).The pair compares the two heads in the table. The later rebases bring
main's own commits to both sides (#3202 onlyacts with DLSS Frame Generation, off here; #3209 adds the pause menu's button). This branch's changes since are a
microphone check, an action that opens the menu when asked, and reading the menu's open flag in one DLSS Frame
Generation check, none of which does work in the measured setup, so it was not measured again.
Setup: Linux (CachyOS), RTX 3090, NVIDIA 0x9b118180;
dev.py ab --scene market --seconds 30on two runtimes over onebase, 1920x1080 output, Render resolution 100 %, upscaler and frame generation off, V-Sync off, uncapped. CPU-bound on
both sides (GPU time 5.0 ms in a frame of about 7.7 ms).
f7d6d3bf61aecd79eb07A second
mainrun gave 126.9 fps, 7.80 ms median, 9.62 ms 99th percentile, 104.0 fps 1% low, so the differences aboveare smaller than
main's own run to run. The second run of this PR was cancelled: one pair was judged enough here. Notmeasured: frame time with the menu open, Windows, other GPUs.
Risks
open or close, or input reaching the game while it is open.
settings.tomlkeys and caches are unchanged. Mods see no API change. No switch is added or changed; a revertis enough.
Checklist
Ready for review
main; the title is a Conventional Commit.9f894d7aaee4, before three later rebases and the fixes since).
mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened. (Left unticked: some compiled checksare now source checks or gone, as Testing says.)
MKWVK_API_VERSIONbumped (MkwVkHostorMkwVkRendereringpu/vk/vk_api.hchanged).Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Assisted-by: Claude Code
Co-Authored-By: Claude Sonnet 5.5 [email protected]
🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8dyXQMB7P1gWv5UhGHB
Tested in game: Linux (CachyOS), RTX 3090, NVIDIA driver 0x9b118180, at 9f894d7aaee4 (before a clean rebase): headless dev.py smoke PASS (in play from kokiri-start, 900 frames, menu opened and page hosted), then a visible session played by hand with the sandbox off; the author reports it tested and looking good. Windows not run.
Still to test now names who runs each item.
Possibly related, for context:
@Beanstalk Windows (NVIDIA, AMD, Intel) and Linux AMD: start the game, reach play, open the Insert menu with the keyboard and a controller if there is one, change a Graphics setting, close the menu, and check the game takes input again and the log has no FATAL line.
Beanstalk test farm
Commit
72645c8· approved by nobody yet · dashboardA member of
BigBeanscan review this commit and comment@Beanstalkto test it.Added a quick Market A/B against main (one pair, CPU-bound, menu closed): within main's run-to-run spread.
WIP: refactor(menu): move the Insert menu's logic out of the renderer into the gameto refactor(menu): move the Insert menu's logic out of the renderer into the game@review
Recommendation: Request changes. Selecting a second microphone with the same name leaves the first one active. The moved menu paths also need the planned platform and in-game checks before their behavior can be considered verified.
The change moves menu input, device handling, output choices and pipeline sharing into the game, leaving the renderer responsible for drawing and reporting its state. It simplifies that boundary, but changes several platform and timing paths.
Blocking (1): must change before merging.
@fixor@rebasetry first). (for the author)Should fix (1): not blocking, but worth doing before merging.
game/crates/api/src/services/devices.rs:163: A change between two microphones with the same saved name is ignored because the row index is only compared when the name is empty. (more on the line) Do: Handle a changed microphone row index even when the saved name is nonempty, and test switching between identically named devices in both directions.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Not a performance change. One Linux RTX 3090 pair measured 128.3 versus 128.7 fps and 9.33 versus 9.42 ms p99 with the menu closed; the description reports a second base run but no second PR run, so this does not establish a performance difference.
Other systems: The change affects Windows and Linux device enumeration, menu input, output sizing, renderer settings, sandboxed pipeline sharing and frame generation. The recorded visible run was on Linux NVIDIA before the rebase; Windows and Linux AMD runs remain outstanding.
Switches: No switch is claimed to be added or changed. RX_VK_MENU_SCRIPT is moved into the game; its complete behavior was not independently verified.
Reviewed:
aecd79eb07againstf7d6d3bf61: Read AGENTS.md, CONTRIBUTING.md, the pull request template, relevant standards, commit log, and portions of the diff and moved menu, device, output and pipeline-sharing code. The diff and changed files are too large to have been read completely in this pass; generated files, translations and recorded runs were not independently reviewed in full. docs/review-checklist.md does not exist.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run, as requested. The supplied CI checks are still running.
Overlaps and merge order: The description identifies WIP pull requests #3116 and #3080; whichever merges second needs a manual rebase.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -0,0 +160,4 @@self.refresh_outputs();}let mic = mic_key(&c_text(&s.microphone_id));if start || mic != self.mic_want || (mic.is_empty() && self.mic_setting != s.microphone) {L1 (should fix): A change between two microphones with the same saved name is ignored because the row index is only compared when the name is empty.
When: With two microphones both named USB Mic, selecting the second changes s.microphone but leaves microphone_id unchanged. The condition is false, so self.mic and the host selection remain on the first device.
Do: Handle a changed microphone row index even when the saved name is nonempty, and test switching between identically named devices in both directions.
HumanBean referenced this pull request2026-12-05 00:05:55 +00:00
aecd79eb072bb4bbc664Rebased onto main
f359e26213(old headaecd79eb07, new head2bb4bbc664). Conflicts: the services module list (main replaced reload with restart_note), one Mods tab comment, and generated mod docs (regenerated). Also fixed the review's L1: picking another microphone of the same name now selects it; the same condition was on main in gpu/vk/menu/audio.cpp, so the bug predates this PR. Checks rerun (see Testing); not run in the game again, and not measured again (see Measurements).@review
Recommendation: Approve. The code is ready: only testing is left. The microphone selection fix handles the reported same-name case, and the branch is mergeable. The moved menu paths and per-present costs still need the runs identified in L2 and L3. Recommend approval; not approved on the forge.
The change moves Insert menu input and device logic into the game while leaving rendering in the renderer. It simplifies that boundary at the cost of a broad behavior-preserving migration that still needs platform testing.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
aecd79eb07)Resolved: L1 (A change between two microphones with the same saved name is ignored because the row index…); L4 (It conflicts with its base branch: bring it up to date (
@fixor@rebasetry first).)Still open: L2 (The moved input, device and output paths have not been exercised on Windows or Linux AMD,…); L3 (The per-present changes have not been measured with the menu open or with frame generation…)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Not a perf change. One Linux RTX 3090 menu-closed pair measured 128.3 versus 128.7 fps and 107.2 versus 106.1 fps 1% lows; the author reports those differences within main's run-to-run spread. The menu-open and frame-generation costs remain unmeasured.
Other systems: The migration affects input, audio devices, monitors, output sizing and per-present work on Windows and Linux, across GPU vendors and frame-generation modes. Linux NVIDIA had an earlier visible run; Windows and Linux AMD have not run, and frame generation with the menu open has not been measured.
Switches: None added or changed, according to the pull request.
Reviewed:
2bb4bbc664againstf359e26213: Read devices.rs and its tests, the microphone selection change and test, the changed generated-document headers and Mods tab comment, repository guidance, and the commit list. The full pull request diff and remaining changed code were not read in full; the review relies on the earlier ledger for those areas.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The recorded in-game session predates the rebase and microphone fix; CI is still running.
Overlaps and merge order: WIP #3116 and #3080 overlap the renderer; whichever merges second needs a manual rebase.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
2bb4bbc66414a29409f0Rebased onto main
7bc53f8413(old head2bb4bbc664, new head14a29409f0). Two things from main needed porting: #3209's settingsHost.open (the pause menu's button) is now taken by the game's menu state, with a test, and #3202's HUD-less check asks ui_modal() where it asked menu_is_open(), which did not compile here. Checks are in Testing. Not run in the game.@rebase
I rebased this pull request onto
main(0473f11e88): the new head is72645c8af4.Conflicts resolved
Nothing was built or run: read the resolution before merging.
Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
14a29409f072645c8af4Recommendation: Approve. The code is ready: only testing is left. The refactor has had a Linux in-game session, but its affected menu paths still need identified Windows and Linux AMD runs. Menu-open and frame-generation performance measurements are also outstanding. Recommend approval; not approved on the forge.
Moves menu input, device and output logic from the renderer into the game, simplifying the renderer while preserving the intended menu behavior. The change touches platform-dependent input and device paths and adds work to the present path.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
2bb4bbc664)Still open: L2 (The moved input, device and output paths have not been exercised on Windows or Linux AMD,…); L3 (The per-present changes have not been measured with the menu open or with frame generation…)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven: this is primarily a refactor. One Linux RTX 3090 Market run with the menu closed measured 128.3 fps before and 128.7 fps after; 1% lows were 107.2 and 106.1 fps. The differences were within the spread of a second main run, but there was only one PR run and no menu-open or frame-generation measurement.
Other systems: Windows, Linux AMD, controller input, devices, monitors and DLSS Frame Generation can follow changed paths. Windows and Linux host code compiled according to the PR, but Windows and Linux AMD have not been run, and the earlier Linux NVIDIA session did not identify the menu features exercised.
Switches: None added or changed, according to the PR.
Reviewed:
72645c8af4against0473f11e88: Read the repository guidance and pull request template, the changed menu-open and frame-generation paths and their surrounding code, and the commit and rebase summaries. The full pull request diff and all changed files were not read; generated files and translations were not individually reviewed. The repository review checklist and adjacent Tooling guidance were unavailable.; nothing run (a code review).Checked and fine:
Testing: No commands that build, test or run the project were executed. The reported earlier Linux NVIDIA session and compile checks are useful evidence; the requested platform runs and measurements remain outstanding. CI is still running.
Overlaps and merge order: #3116 and #3080 overlap; whichever merges second needs a manual rebase.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.