fix(input): restore Windows controller input on the Rust Mod API #2516
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!2516
Loading…
Reference in a new issue
No description provided.
Delete branch "snaildev99/Longshot:fix/rust-api-controller"
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
Restore Windows controller input when the Rust game runs inside the AppContainer. The broker opens the SDL devices and gives the game a dedicated controller connection. The Switch 2 Pro USB driver and its NFC reader are unavailable in the Windows sandbox.
Rebased on Rust Mod API #2434 at
b9ac71657. This supersedes #2016. The controller connection is restricted to the game process or its same-image relaunch, and the broker carries the virtual-controller flag. The forge target ismod-api. Controller-only diffTesting
Previous hand test at
7448586ca. Windows 11, one 8BitDo Ultimate 2 over Bluetooth, AppContainer enabled. On the Rust API baseline there was no gameplay input. With this change, movement and L-menu input worked in Adult Kakariko.Before the latest changes, both C fixtures compiled and passed on Windows with llvm-mingw Clang via
tests/test_pad_broker_route.pyandtests/test_pad_broker_state.py. They cover input routing, session ownership, snapshot bounds, disconnect and reconnect handling, and sensor recovery.Still to test: Windows gameplay on the rebased head, the full project suite and Linux build. Physical reconnect, gyro and rumble remain to be exercised by hand.
The standard Windows builder at this #2434 revision misses the ImGui include flags for
vk_ui2.cpp. The local play builds use the renderer's existing ImGui flags for that file.Measurements
Verdict: The same controller regained gameplay input with the sandbox enabled.
563ca4e557448586caInput latency and frame time have not been measured.
Risks
This changes the controller broker handshake and snapshot format. Use a broker and game from the same build. Hardware coverage currently includes the reported Bluetooth controller on the previously tested revision.
Checklist
Ready for review
When it applies
Ready to merge
Tested in game: Windows 11, one 8BitDo Ultimate 2 over Bluetooth, AppContainer enabled. On the Rust API baseline there was no gameplay input. With this change, movement and L-menu input worked in Adult Kakariko.
Possibly related, for context:
7448586cabac4856fe71ac4856fe71f8b0c6c68cRebased the controller fix on Rust Mod API #2434 at
b9ac71657. Both Windows broker fixtures passed onf8b0c6c68. The previous Bluetooth playtest is recorded above. Windows gameplay confirmation on the new head is pending. Controller-only diff@review
Recommendation: Approve. The rebased head still needs gameplay and controller-feature testing. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The Windows broker opens controllers outside the AppContainer and sends bounded input snapshots and motor commands to the game. It restores input in an earlier playtest, at the cost of sandboxed HD haptics and Switch 2 Pro USB support; the Linux build regression must be fixed.
Should fix (2): not blocking, but worth doing before merging.
tests/test_pad_motion_policy.py:12: This new fixture defaults to gcc and ignores CC, so it cannot run with the project's selected compiler on systems without gcc. (more on the line) Do: Honor CC and choose an available portable compiler fallback, as the other new controller fixtures do.docs/dev/reference/sandbox.md:378: The documented confined gameplay run names controllers that are not supported by the supplied test report. (more on the line) Do: Describe the recorded 8BitDo run and leave the other controllers listed as untested unless their results are supplied.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
host/pad_broker_windows.c:153: The rebased controller transport and its recovery paths need an in-game hardware run. (more on the line) Do: On the head, reproduce the baseline failure and verify buttons, sticks, physical disconnect and reconnect, gyro and motor rumble in Windows sandboxed gameplay; record the controller and results.host/pad_sdl.c:250: The changed sensor recovery policy also needs a native controller run. (more on the line) Do: After fixing the Linux build, exercise motion enable, disable and recovery with a real controller on Linux or unconfined Windows and record the result.@fixcan do L1 and L2.Checks: Still running:
Guide screenshots / Guide images and local UI source review (pull_request),Third-party parts / As their notes say (pull_request),Third-party parts / The same as upstream (pull_request).More: does it help, other systems, switches, what was read
Does it help: Unproven on this head. The author reports movement and L-menu input with one Bluetooth controller on earlier commit
7448586ca, compared with no input on the Rust API baseline; the rebased head has not been played.Other systems: The transport affects Windows sandboxed SDL controllers, motion, motor rumble, reconnects and Steam Input. The motion policy also changes on unconfined Windows and Linux. Linux compilation is broken; hardware behavior on the current head remains untested.
Switches: HOS_SWITCH2 remains on by default and HOS_SWITCH2_RUMBLE_TEST remains off, but neither operates in the Windows sandbox. HOS_HD_RUMBLE and HOS_RUMBLE_BACKEND retain their defaults but cannot enable the corresponding haptic backends there. The restrictions are documented.
Reviewed:
f8b0c6c68cagainstb9ac716574: Read the repository rules, PR template, standards, commits, changes to the broker and controller paths, and the new controller fixtures. Skimmed the remaining changed tests and documentation. Tooling's adjacent AGENTS.md and docs/review-checklist.md were absent. The full contents of every changed code file and all dependent callers were not read.; nothing run (a code review).Checked and fine:
Testing: No code, tests or project scripts were run, as requested. The author reports that two Windows fixtures passed on the head; the full suite, Linux build and head gameplay remain pending.
Overlaps and merge order: The PR says it supersedes #2016 and targets the Rust Mod API branch at #2434. No independent Forgejo overlap check was possible with the network closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -364,3 +376,3 @@### What needs checking on WindowsNothing of this has run on Windows yet. Known to work in an AppContainer, from how Windows treats them (and how UWP appsThe confined gameplay run used a PS4 and a Switch Pro controller. Motion, ordinary rumble, hotplug and reconnect,L2 (should fix): The documented confined gameplay run names controllers that are not supported by the supplied test report.
When: The PR and its comments report one 8BitDo Ultimate 2 over Bluetooth, but this page says the run used a PS4 and a Switch Pro controller, overstating hardware coverage.
Do: Describe the recorded 8BitDo run and leave the other controllers listed as untested unless their results are supplied.
@ -0,0 +150,4 @@free(s);InterlockedExchange(&occupied, 0);}int hos_pad_broker_serve(void **session, const void *request, size_t bytes, BrokerPadSnapshot *out) {L3 (should fix): The rebased controller transport and its recovery paths need an in-game hardware run.
When: The only gameplay result predates the dedicated connection and rebase; the head's fixtures use fake devices and do not show that real controller input, reconnect, motion and rumble work through the Windows broker.
Do: On the head, reproduce the baseline failure and verify buttons, sticks, physical disconnect and reconnect, gyro and motor rumble in Windows sandboxed gameplay; record the controller and results.
@ -235,3 +250,1 @@if (pads[i].motion_on != want && now >= pads[i].motion_retry_ns) {const int ok = hos_sdl_pad_sensor_enable(pads[i].gc, HOS_SDL_SENSOR_ACCEL, want) &hos_sdl_pad_sensor_enable(pads[i].gc, HOS_SDL_SENSOR_GYRO, want);if ((pads[i].motion_on != want || (!want && pads[i].motion_enabled)) && now >= pads[i].motion_retry_ns) {L4 (should fix): The changed sensor recovery policy also needs a native controller run.
When: The revised enable and rollback loop runs outside the Windows sandbox too, including on Linux; the fixture substitutes sensor calls and cannot establish that a real device continues reporting motion after toggling and recovery.
Do: After fixing the Linux build, exercise motion enable, disable and recovery with a real controller on Linux or unconfined Windows and record the result.
@ -0,0 +9,4 @@def main():parser = argparse.ArgumentParser()parser.add_argument("--cc", default="gcc")L1 (should fix): This new fixture defaults to gcc and ignores CC, so it cannot run with the project's selected compiler on systems without gcc.
When: A Windows developer with the supported llvm-mingw Clang toolchain and CC set to clang runs the test without --cc; it still attempts to execute gcc.
Do: Honor CC and choose an available portable compiler fallback, as the other new controller fixtures do.
@fix
f8b0c6c68cddd8e39300Recommendation: Approve. The code is ready: only testing is left. The earlier Windows playtest showed that controller input returned, but the rebased transport and sensor recovery have not yet been exercised on hardware. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
ddd8e39300. I rebased it ontomod-api(93c7a8e8ae). I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
The broker gives the sandboxed Windows game access to controller input while retaining the game's existing input mapping. The latest fix corrects the recorded controller coverage and compiler selection in a fixture; it does not remove the controller feature.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
host/pad_broker_windows.c:153: The rebased controller transport and its recovery paths need an in-game hardware run. When: The only gameplay result predates the dedicated connection and rebase; the head's fixtures use fake devices and do not show that real controller input, reconnect, motion and rumble work through the Windows broker. Do: On the head, reproduce the baseline failure and verify buttons, sticks, physical disconnect and reconnect, gyro and motor rumble in Windows sandboxed gameplay; record the controller and results.host/pad_sdl.c:250: The changed sensor recovery policy also needs a native controller run. When: The revised enable and rollback loop runs outside the Windows sandbox too, including on Linux; the fixture substitutes sensor calls and cannot establish that a real device continues reporting motion after toggling and recovery. Do: After fixing the Linux build, exercise motion enable, disable and recovery with a real controller on Linux or unconfined Windows and record the result.Checks: they run again on this head; a failure shows on the pull request.
More: does it help, other systems, switches, what was read
Does it help: Unproven on the rebased head. An 8BitDo Ultimate 2 over Bluetooth had no gameplay response on the earlier Rust API baseline and supported movement and L-menu input on the earlier PR revision, according to the author's Windows 11 playtest.
Other systems: The transport affects sandboxed Windows controller input, motion, rumble and reconnect behavior. Native controller sensor recovery also changed; its device behavior remains untested. Linux build confirmation is pending.
Switches: HOS_SWITCH2 remains on by default for unconfined Windows; its USB driver and NFC reader are unavailable in the sandbox. HOS_SWITCH2_RUMBLE_TEST remains off by default and applies to unconfined Windows. The fix adds no switches.
Reviewed:
ddd8e39300against93c7a8e8ae: Read the fix diff, the motion-policy fixture, the controller transport and sensor-recovery code relevant to the ledger, and the repository rules and PR template. The larger base diff and other changed files were not read in full; recorded runs were read from the PR and comments.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run. The author reports two Windows broker fixtures passed before the latest changes; gameplay on the rebased head, reconnect, gyro, rumble and the Linux build remain to be tested.
Overlaps and merge order: The PR says it supersedes #2016 and targets mod-api after #2434; no independent overlap check was available.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
WIP: fix(input): restore Windows controller input on the Rust Mod APIto fix(input): restore Windows controller input on the Rust Mod API