fix(builder): a Switch 2 Pro Controller's rumble takes the controller's whole range #3239
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!3239
Loading…
Reference in a new issue
No description provided.
Delete branch "fofuxo/Longshot:fix/switch2-rumble-strength"
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
On a Switch 2 Pro Controller over USB, the game's light rumbles could not be felt. The builder's driver
(
build_core::switch2) turned the two motor strengths into the controller's rumble frame at 380 (low band) and 130(high band) of the frame's 1023, kept to 511 together. That is the Switch2Connect bridge's limit, chosen for what it
took a USB port to power, and it was never measured. A fall in the game asks 0.08 of the low motor, which went out as
30 of 1023: about 3% of the controller's range, where SDL gives a Joy-Con or a Switch Pro Controller 8%.
Each band now takes its motor's share of 1023, and the two come down together when they pass it (
limit_frame, thecheck
game_reportalready used), as SDL plays the motors on Nintendo's other pads. 0.08 on the low motor is now 81of 1023; both motors at full are 511 + 511.
To see it on
main: a Switch 2 Pro Controller on USB, Vibration on Auto, and fall from a ledge: the log showshid: vibration #...: low 0.08and the controller barely moves. A Joy-Con playing the same strengths (it falls back toits motors too, see Risks) shakes clearly.
Read first:
rumble_reportandAMP_SUM_MAXinbuilder/crates/build-core/src/switch2.rs.See #2670 (the same driver over Bluetooth, which this doesn't add).
Testing
Tested: Windows 11 Pro (build 26300), AMD Ryzen 9 5900X, NVIDIA GeForce RTX 3070 (driver 621.47), a Switch 2 Pro
Controller on USB beside a pair of Joy-Cons over Bluetooth.
In the game, a runtime of this branch (
acc8e34e, before a rebase over one unrelated commit ofmain) from my ownsave: falling from the same ledge as on
main, the Pro Controller 2 now shakes about as hard as the left Joy-Con,which plays the same low motor through SDL. On
main(nightly-1118-3a0f7d8f) the same falls were barely felt.By hand, outside the game, writing the driver's own report 0x02 to the controller beside a Joy-Con pair rumbled
through the same SDL3 Longshot ships, at the same motor strengths: the falls' 0.08 at 3% (
main), 6% and 8% (thisPR), then 2 to 100 % held on buttons. At 8% the two felt alike across the range. 1023 together shook clearly harder
than 511 and started and stopped cleanly; both bands at 1023 felt no stronger than 1023 together.
dev.py test-changed: the crates the change reaches;cargo test -p build-core --lib switch2: 8 passed.mise run teston Windows 11, with WinLibs' GCC 16.2 and the checkout's llvm-mingw clang first on the PATH:829 passed, 52 skipped, 30 failed. The same 30 fail on
main@7bc53f84in the same environment (run againalone there), none in the code this changes. Two more (
test_run_all_junit.py,test_utf8_paths.py) failed onceunder load in an earlier run and pass alone.
The 30 that also fail on
main, by cause{cxx}not found on Windows (shutil.whichgivesclang++.EXE, so no++suffix tostrip, and there is no
cc):test_audio_output_errors,test_audio_source,test_audio_source_load,test_audio_wave_buffer_release,test_game_font,test_hd_rumble,test_pad_headphones_reader,test_pad_speaker,test_rumble_mapping,test_rumble_refresh,test_vibration_permission.run_all.pylooks fortoolchain/glslang/bin/glslangValidator, the folder holdsglslang.exe):test_framegen_hdr,test_fsr3fi_hud_layer,test_fsr3fi_hudless_colour,test_gfx_effects,test_temporal_present_bandwidth.test_fsr4_tune,test_lifter. No symlink privilege (Windows' DeveloperMode off):
test_longshot_builder.unknown type name 'VkImageView'):test_present_acquire_ahead,test_present_held_image,test_present_image_free.test_present_geometry_trace(dlssg_active),test_sync_watch_event(
settings_start),test_turf_budget(order_watch_on).test_dlssgandtest_ui_renderer(a source line the test looks for),test_no_map_reload,test_helpers_extract,test_no_game_title(it namestests/test_lower_cs2r_depbar.py).Still to test:
falls, Din's Fire), expecting no
write refused/stuck rumble any more often than onmain(by hand). One hand testhere stopped taking reports after many full-strength presses while it also kept writing zero reports every 12 ms,
which the driver never does; with the driver's own stops it held up through many more full presses, and the driver
falls back to the controller's own samples (
Rumble::written) if its motor-strength reports are refused three times in a row. HD-report writes do not use that fallback.HOS_SWITCH2_HD=1: RenHDrum's HD Rumble 2 reports are now limited at 1023 together instead of 511, expecting louderstrong effects and the same light ones (by hand, nobody has run it yet).
Measurements
Verdict: the bug's light rumble goes from 30 to 81 of 1023, as a Joy-Con plays the same request; felt by hand
beside one.
Setup: the game-free test,
cargo test -p build-core --lib switch2, onmainand here; the in-game falls above.7bc53f84176fe70dthe_rumble_s_reports_then_its_samples_once_the_controller_stops_taking_them: 0.08 on the low motoronly_a_whole_hd_rumble_2_report_of_the_game_s_is_written: a game report at 900 + 900Risks
row. Nothing changes for other pads, Bluetooth, or Linux (the kernel's driver).
samples after three refused motor-strength reports. HD-report writes do not use that fallback. A revert puts 511 back.
No switch.
Seen while testing, not changed here (worth issues of their own):
hid: "Nintendo Switch Joy-Con (L/R)" did not take HD rumble ()) and fellback to its motors, where SDL plays the low motor on the left Joy-Con alone and the high one on the right alone, so
a fall barely moves the right one.
build_core::switch2's own log lines (switch2: ... started,HOS_SWITCH2_RUMBLE_TEST's result, the stuck-rumblenotice) reach no log: the builder's console sink keeps only its own crate's target and
build_core::report.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (30 fail here and onmainalike,named in Testing.)
main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: RTX 3070 (621.47), Windows 11, Switch 2 Pro Controller on USB beside Joy-Cons over Bluetooth: a fall now shakes the Pro Controller 2 about as hard as the left Joy-Con, where on main it was barely felt
Possibly related, for context:
WIP: fix(builder): a Switch 2 Pro Controller's rumble takes the controller's whole rangeto fix(builder): a Switch 2 Pro Controller's rumble takes the controller's whole range@review
Recommendation: Approve. The code is ready: only testing is left. The reported in-game comparison shows that the light-rumble fix helps on the tested controller. The higher ceiling still needs the stated sustained-use and experimental HD-rumble runs before merge. Recommend approval; not approved on the forge.
The Windows USB driver gives each rumble band more of the controller’s range and limits their combined amplitude. This makes light effects feel stronger, while also raising the ceiling for experimental HD reports.
Nits (1): optional.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
builder/crates/build-core/src/switch2.rs:340: The higher ceiling needs the sustained controller and USB-port comparison already listed in Still to test. (more on the line) Do: Run comparable long sessions on main and this branch with strong effects on another Windows PC and USB port, recording refused writes and stuck rumble.builder/crates/build-core/src/switch2.rs:340: The changed limit also applies to experimental HD reports, but that mode has not been exercised on the controller. (more on the line) Do: Run representative light and strong HD effects in game on the USB controller and compare playback and stopping with main. (@fixdoes its part first: Keep the previous 511 limit for game_report while applying the new ceiling only to motor-derived reports.)@fixcan do L2 and L3.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported light-rumble case: the generated low-band amplitude rises from 30 to 81 out of 1023, and the author reports that the same in-game fall became clearly perceptible beside a Joy-Con. The hardware comparison was on one PC and controller; sustained reliability at the higher ceiling remains unproven.
Other systems: The changed driver handles the Switch 2 Pro Controller over USB on Windows. Linux, Bluetooth and other controllers do not use this encoding. The shared limit also changes experimental RenHDrum HD reports; that path has not been tested with the new ceiling.
Switches: No switch added, removed or changed. The existing HOS_SWITCH2_HD switch defaults off; enabling it selects the experimental HD path whose amplitude ceiling changes here.
Reviewed:
176fe70d9bagainst7bc53f8413: Read AGENTS.md, CONTRIBUTING.md, the PR template, the diff and commit messages; reviewed the changed encoding, tests, Windows rumble thread and host selection path, and the input reference change. Skimmed the remainder of switch2.rs, input.md and standards.md. docs/review-checklist.md and the adjacent Tooling checkout were absent. No generated files or recorded runs were changed.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no tests or project code were run. The author reports the game-free tests and an in-game Windows comparison. CI was still running.
Overlaps and merge order: Not checked; the network is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -339,0 +337,4 @@/// The most a motor's two amplitudes may be together (as [`rumble_report`] keeps them). On a Pro Controller 2 over/// USB, 1023 together shook clearly harder than 511 and still started and stopped cleanly, while both fields at their/// full 1023 felt no stronger than 1023 together (measured by hand).pub const AMP_SUM_MAX: u64 = 1023;L1 (should fix): The higher ceiling needs the sustained controller and USB-port comparison already listed in Still to test.
When: Strong effects can now send up to 1023 combined instead of 511; the author observed a controller stop accepting reports during a separate repeated-write experiment, so normal long-session reliability at this ceiling remains unknown.
Do: Run comparable long sessions on main and this branch with strong effects on another Windows PC and USB port, recording refused writes and stuck rumble.
L2 (should fix): The changed limit also applies to experimental HD reports, but that mode has not been exercised on the controller.
When: With HOS_SWITCH2_HD=1, game_report now permits stronger frames than main; the unit test checks the bytes, not whether actual HD effects play and stop correctly.
Do: Run representative light and strong HD effects in game on the USB controller and compare playback and stopping with main.
@fix
I didn't fix this pull request: the change I made would remove a switch this pull request adds (
assert_eq!(&kept[2..7], &super::rumble_frame(511, 511));inbuilder/crates/build-core/src/switch2.rs), which undoes it. So L2 is the author's now. Nothing was pushed.Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@fix
176fe70d9b9efeb46123Recommendation: Approve. The code is ready: only testing is left. The light-rumble fix is demonstrated in game, but the higher ceiling still needs the sustained USB comparison and a controller run of the experimental HD mode. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
9efeb46123. I rebased it ontomain(3778dbdf52). I edited its description to match the change.Nothing was built or run: the checks run again on the new head.
Switch 2 Pro Controller motor strengths now use the controller's full rumble range, making light effects easier to feel. The same higher limit applies to experimental HD reports, with sustained behavior still untested.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
builder/crates/build-core/src/switch2.rs:340: The higher ceiling needs the sustained controller and USB-port comparison already listed in Still to test. When: Strong effects can now send up to 1023 combined instead of 511; the author observed a controller stop accepting reports during a separate repeated-write experiment, so normal long-session reliability at this ceiling remains unknown. Do: Run comparable long sessions on main and this branch with strong effects on another Windows PC and USB port, recording refused writes and stuck rumble.builder/crates/build-core/src/switch2.rs:340: The changed limit also applies to experimental HD reports, but that mode has not been exercised on the controller. When: With HOS_SWITCH2_HD=1, game_report now permits stronger frames than main; the unit test checks the bytes, not whether actual HD effects play and stop correctly. Do: Run representative light and strong HD effects in game on the USB controller and compare playback and stopping with main.Checks: they run again on this head; a failure shows on the pull request.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. The reported test changes a 0.08 low-motor request from 30 to 81 of 1023, and the author reports that the same fall felt comparable to a Joy-Con on Windows.
Other systems: The changed driver runs on Windows with the Switch 2 Pro Controller over USB. Linux, Bluetooth and other controllers do not use this path. Experimental HD reports share the higher limit and have not been exercised on the controller.
Switches: No switches added, changed or removed. Existing HOS_SWITCH2_HD is off by default; when enabled, its reports receive the higher limit.
Reviewed:
9efeb46123against3778dbdf52: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the rebased diff and commits, and the relevant rumble, report, fallback and test code. Skimmed the rest of switch2.rs, input.md and the related callers. Tooling's AGENTS.md and docs/review-checklist.md were unavailable.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run. The author reports an in-game Windows comparison and game-free tests; CI has not run on this head.
Overlaps and merge order: None identified from the supplied information.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.