feat(input): Nintendo's GameCube controller adapter over WinUSB, read by the builder #3245
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!3245
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:feat/gamecube-adapter"
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
A player with Nintendo's official GameCube controller adapter (WUP-028, the Wii U / Switch one) found that it did
nothing in Longshot, even after switching it to WinUSB with Zadig. The reason: SDL reads that adapter only through
libusb, and the SDL3 Longshot ships (libsdl's own Windows release) is built without it. So SDL's Windows HID path
skips the adapter on purpose (
SDL_libusb_requiredin SDL'ssrc/hidapi/SDL_hidapi.c). With Zadig it isn't a HIDdevice at all, and without Zadig SDL skips it.
This PR has the builder read the adapter itself, the way it already reads the Switch 2 Pro Controller
(
build_core::switch2):interface class from the device's
DeviceInterfaceGUIDsregistry value, the way libusb's WinUSB backend finds adevice.
0x13. Its 37-byte reports are read onone thread.
"Nintendo GameCube Controller", with no motion, so it reaches the game as any of the builder's pads. The button
prompts are the Switch's (its name has "Nintendo").
analog L and R triggers are ZL and ZR. The control stick is the left stick and the C-stick the right. The axis
ranges widen as the sticks move, as in SDL's driver. The controller has no L or Minus: the Controls page binds
those to something else.
gamecube:lines go to the builder's standard error, like the control channel's lines, so in play they are in thegame's
longshot_log.txt.HOS_GAMECUBE=0(a kill switch, on by default) leaves the adapter to another program, such as Dolphin orDelfinovin. Only one program can have it. The builder's drivers now also take their switches from the environment the
game inherits (
control::pad_switches_of), not only from the command's own changes; that fixesHOS_SWITCH2setthat way too.
Also:
switch2.rs's WinUSB lookup moves to a newwinusb.rsthat takes the device's ids, so both drivers share it(the Switch 2 Pro's strings are unchanged).
Sdl::virtual_padtakes whether the pad has motion. Docs:docs/user/graphics-and-controls.md(how to set the adapter up),docs/dev/reference/input.md,docs/dev/reference/sandbox.md.Read first:
builder/crates/build-core/src/gamecube.rs(protocol on top, the Windows part inmod os), thenwinusb.rs.Testing
Tested: Windows 11, NVIDIA RTX 5080 (driver 621.47), with no adapter plugged in: a smoke run of this checkout's
runtime over the shared base (
mise run dev -- smoke). It reached play from kokiri-start, 900 frames, the Insert menuopened, PASS. The builder still serves the pads (
hid: controller support through the builder), and the game's loghas
gamecube: looking for a GameCube controller adapter on WinUSB (HOS_GAMECUBE=0 leaves it alone). Run again afterthe review fixes (
22dbbc40f): PASS, the same line.Checks:
cargo test -p build-core(gamecube, winusb, switch2, pads, control): 33 passed, 9 of them new. They coverthe adapter's report on recorded bytes (four ports, wired, WaveBird, the power bit), the button names, the stick and
trigger axes (y turned, the range widening), the rumble report, the switch, the WinUSB lookup's device names and GUID
parsing, and the drivers' switches taken as the game inherits them (set, removed, inherited). rustfmt clean.
mise run test -- --changed: 79 passed, 0 failed, 8 skipped (Linux-only).Clippy (
-D warnings) on build-core: clean but forunused import: note_lines(sandbox_windows.rs:384), whichfails on
maintoo.A player's official adapter on WinUSB, through the Launcher's build of
dc66d624e: the controller connected (hid: controller "Nintendo GameCube Controller" connected (SDL in the builder)), but input came through only now and then, late, and one controller did not work until replugged. Likely cause, fixed in338bbafae: 64-byte reads of 37-byte reports, out of line after the first. The same player's run of the Launcher build with that fix (338bbafae): "works perfect": the controller's input comes through with no delay.Still to test:
338bbafae): more than one controller, aWaveBird if they have one, rumble with the grey plug, and plugging controllers in and out while playing; expecting
gamecube: port 1: a wired controllerandhid: controller "Nintendo GameCube Controller" connected (SDL in the builder)inlongshot_log.txt, the buttons,sticks and triggers as Summary says, rumble with the grey plug in, and controllers coming and going while playing
(by hand: a tester lined up).
pad (by hand).
gamecube: ... another program has itin the log), and againafter
HOS_GAMECUBE=0, set inlongshot_env.txtand in the environment: the builder leaves it to Dolphin (by hand).winusb.rs(by hand:someone with one).
Note: the
switch2:andpads:lines (already onmain) still go through tracing, whichlongshot-builder's consolefilter drops in play; that is fixed apart, in its own pull request.
Measurements
Nothing to measure: the game process is unchanged; the builder gains one thread that looks for the adapter every 2 s (one device lookup, as the Switch 2 driver already does) and, with an adapter, reads its reports (about 125 a second).
Risks
Longshot can't have it.
HOS_GAMECUBE=0turns this off; the builder's log names the busy case.found (its Still to test line). A revert is enough.
Checklist
Ready for review
main; the title is a Conventional Commit.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
gpu/vk/switches.def.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11, NVIDIA RTX 5080 (driver 621.47), no GameCube adapter on this PC: a smoke run of this checkout's runtime over the shared base reached play from kokiri-start, 900 frames, the Insert menu opened, PASS; the builder still serves the pads (hid: controller support through the builder). A run with the adapter itself is in Still to test: a tester with one will build this PR from the Launcher.
Measurements: one line saying why there is nothing to measure (the game process is unchanged).
WIP: feat(input): Nintendo's GameCube controller adapter over WinUSB, read by the builderto feat(input): Nintendo's GameCube controller adapter over WinUSB, read by the builderRecommendation: Request changes. The kill switch does not work when inherited from the environment, and the promised adapter diagnostics are filtered out during normal play. The adapter and the moved Switch 2 lookup also still need hardware runs.
Adds Windows support for Nintendo’s GameCube adapter through WinUSB and shares device discovery with the existing Switch 2 driver. It adds a polling thread and four possible virtual pads, but its hardware behavior is not yet demonstrated.
Blocking (2): must change before merging.
builder/crates/build-core/src/control.rs:48: The new kill switch is collected only from explicit Command overrides, so an inherited environment value is ignored by the builder’s driver. (more on the line) Do: Collect the effective game environment, including inherited values and explicit removals, and test the inherited and overridden switch cases.builder/crates/build-core/src/gamecube.rs:167: The new Windows module permits unsafe code outside the locations allowed by the repository’s builder code rules; the new winusb.rs does the same. (more on the line) Do: Put the required unsafe system calls behind an allowed system-call boundary, or have the repository rule explicitly changed through the appropriate decision.Should fix (1): not blocking, but worth doing before merging.
builder/crates/build-core/src/gamecube.rs:244: The adapter setup and busy diagnostics use the build-core tracing target, which the builder’s normal console filter discards. (more on the line) Do: Route the actionable adapter diagnostics through a target or logging channel included in normal play, and update the sandbox instructions to name the actual destination.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
builder/crates/build-core/src/gamecube.rs:378: The new device path has not been exercised with the adapter it is meant to support. (more on the line) Do: Run the Launcher build on Windows with the official adapter on WinUSB: exercise all ports, controls, rumble, disconnect and reconnect, the Windows-driver case and the kill switch.builder/crates/build-core/src/switch2.rs:738: The shared lookup has not been exercised with the existing Switch 2 Pro Controller. (more on the line) Do: Run a Windows USB Switch 2 Pro Controller through connection, controls, motion, rumble and NFC after the lookup move.@fixcan do L1, L2 and L3.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven: the reported Windows smoke run had no adapter. The protocol unit tests exercise canned reports, but no run shows an adapter producing usable game input or rumble.
Other systems: The shared WinUSB lookup also serves the Windows Switch 2 Pro Controller; its USB input, motion, rumble and NFC path need a regression run. Linux does not compile the new Windows device module. The new thread runs in the builder alongside its SDL pad polling.
Switches: HOS_GAMECUBE is added, default on, with a row in switches.def. Its intended default enables the feature, but hardware behavior remains untested; an inherited HOS_GAMECUBE=0 currently does not reach the driver.
Reviewed:
4520f28001against7bc53f8413: Read the repository rules, PR template, standards, commit and diff; read the new GameCube and WinUSB code and the changed portions and relevant callers of control, pads, lib and switch2. Reviewed the changed documentation and switch row. The full large existing control, pads and switch2 files were skimmed outside the affected paths; Tooling’s AGENTS.md was unavailable, and docs/review-checklist.md does not exist.; nothing run (a code review).Checked and fine:
Testing: No code or tests were run during review. The author reports a Windows smoke run without the adapter and passing unit checks; CI is still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as llun took it out of WIP. Nothing was run; a maintainer decides.
@ -46,3 +45,4 @@/// (its file of switches' among them, [`crate::game_env::apply`]).#[must_use]pub fn pad_switches(cmd: &std::process::Command) -> Vec<(String, String)> {cmd.get_envs()L1 (blocking): The new kill switch is collected only from explicit Command overrides, so an inherited environment value is ignored by the builder’s driver.
When: When Longshot is started with HOS_GAMECUBE=0 in its environment and no game environment file overrides it, the game inherits that value, but pad_switches returns no entry and switched_on defaults to true. The builder can take the adapter from Dolphin despite the requested switch.
Do: Collect the effective game environment, including inherited values and explicit removals, and test the inherited and overridden switch cases.
@ -0,0 +164,4 @@/// The Windows device: the adapter found on WinUSB, its reports read and its rumble written on one thread, a virtual/// pad in the builder's SDL3 for each controller plugged in.#[cfg(windows)]#[allow(unsafe_code)]L3 (blocking): The new Windows module permits unsafe code outside the locations allowed by the repository’s builder code rules; the new winusb.rs does the same.
When: Both modules introduce Windows FFI under new allow(unsafe_code) exemptions, while docs/dev/standards.md restricts builder unsafe code to the named system-call modules.
Do: Put the required unsafe system calls behind an allowed system-call boundary, or have the repository rule explicitly changed through the appropriate decision.
@ -0,0 +241,4 @@let Some(class) = interface_class(super::VID, super::PID, None) else {let hid = on_hid_driver();if hid && !told.not_winusb {tracing::info!(L2 (should fix): The adapter setup and busy diagnostics use the build-core tracing target, which the builder’s normal console filter discards.
When: A player plugs in the adapter on Windows’ own driver: on_hid_driver finds it and emits the Zadig instructions, but report::console::init accepts only longshot_builder and longshot::console, so the promised instruction never reaches the player.
Do: Route the actionable adapter diagnostics through a target or logging channel included in normal play, and update the sandbox instructions to name the actual destination.
@ -0,0 +375,4 @@std::thread::sleep(std::time::Duration::from_millis(500));}}L4 (should fix): The new device path has not been exercised with the adapter it is meant to support.
When: The available game run had no adapter, so it cannot show that WinUSB discovery, report delivery, hotplug, controls and rumble work together on the official hardware.
Do: Run the Launcher build on Windows with the official adapter on WinUSB: exercise all ports, controls, rumble, disconnect and reconnect, the Windows-driver case and the kill switch.
@ -910,2 +737,2 @@let usb_path = find_path(&usb_class, 1)?;let hid_path = find_path(&hid_class, 0)?;let usb_class = interface_class(super::VID, super::PID_PRO, Some(1))?;let usb_path = find_path(&usb_class, super::VID, super::PID_PRO, Some(1))?;L5 (should fix): The shared lookup has not been exercised with the existing Switch 2 Pro Controller.
When: The Windows smoke run had no such controller, so a discovery or initialization regression would leave its USB controls and NFC unavailable without appearing in that run.
Do: Run a Windows USB Switch 2 Pro Controller through connection, controls, motion, rumble and NFC after the lookup move.
Thanks for the review. Pushed
22dbbc40f; the description is updated.pad_switchestook only the command's own changes, soHOS_GAMECUBE=0(andHOS_SWITCH2, already on main) set in the environment Longshot started with reached the game but not the builder's drivers. A driver's switch the command neither sets nor removes is now the inherited one (control::pad_switches_of), with tests for set, removed and inherited. TheSDL_*ones stay as they were: the builder's SDL reads its own environment.gamecube:lines now go to the builder's standard error witheprintln!, asbuild_core::channel'scontrol:lines do. In play,game_log's tee copies that intolongshot_log.txt. The smoke run's log showsgamecube: looking for a GameCube controller adapter on WinUSB (HOS_GAMECUBE=0 leaves it alone). The sandbox and input docs now namelongshot_log.txt. The same gap for theswitch2:andpads:lines on main is being fixed in its own PR.standards.md's sentence is out of date with the tree rather than a rule this breaks. 33 files inbuilder/crateshave#[allow(unsafe_code)]on main, among themswitch2.rs'smod os,pads.rs,deck_imu.rs,channel.rsandcontrol.rs, each with SAFETY comments.gamecube.rs'smod osandwinusb.rsfollowswitch2.rs's pattern exactly, andwinusb.rsis code moved out ofswitch2.rs, not new FFI. Bringing the standards sentence in line with the tree is a separate docs change.Pushed
dc66d624e: pad_switches_of's test used a made-up HOS_OTHER name, which the switch table check would take for a switch; it is PATH now. Tests and the switch table check pass.@review
Recommendation: Request changes. The new Windows code still places unsafe operations outside the locations permitted by the builder’s documented code rule. The adapter and the existing Switch 2 controller path also still need hardware runs.
The builder adds WinUSB support for Nintendo’s GameCube adapter and exposes its controllers as virtual SDL gamepads. It shares device lookup with the Switch 2 driver, at the cost of additional Windows-specific code and a background device scan.
Blocking (1): must change before merging.
builder/crates/build-core/src/gamecube.rs:167: The new Windows module permits unsafe code outside the locations allowed by the repository’s builder code rules; the new winusb.rs does the same. When: Both modules introduce Windows FFI under new allow(unsafe_code) exemptions, while docs/dev/standards.md restricts builder unsafe code to the named system-call modules. Do: Put the required unsafe system calls behind an allowed system-call boundary, or have the repository rule explicitly changed through the appropriate decision.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
builder/crates/build-core/src/gamecube.rs:378: The new device path has not been exercised with the adapter it is meant to support. When: The available game run had no adapter, so it cannot show that WinUSB discovery, report delivery, hotplug, controls and rumble work together on the official hardware. Do: Run the Launcher build on Windows with the official adapter on WinUSB: exercise all ports, controls, rumble, disconnect and reconnect, the Windows-driver case and the kill switch.builder/crates/build-core/src/switch2.rs:738: The shared lookup has not been exercised with the existing Switch 2 Pro Controller. When: The Windows smoke run had no such controller, so a discovery or initialization regression would leave its USB controls and NFC unavailable without appearing in that run. Do: Run a Windows USB Switch 2 Pro Controller through connection, controls, motion, rumble and NFC after the lookup move.@fixcan do L3.Since the last review (on
4520f28001)Resolved: L1 (The new kill switch is collected only from explicit Command overrides, so an inherited env…); L2 (The adapter setup and busy diagnostics use the build-core tracing target, which the builde…)
Still open: L3 (The new Windows module permits unsafe code outside the locations allowed by the repository…); L4 (The new device path has not been exercised with the adapter it is meant to support.); L5 (The shared lookup has not been exercised with the existing Switch 2 Pro Controller.)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven: recorded-byte tests cover the protocol, but no run with the adapter has shown the feature working. The reported Windows smoke run had no adapter connected.
Other systems: The shared WinUSB lookup also affects the Windows Switch 2 Pro Controller; its hardware run remains outstanding. Linux does not start either Windows driver. The reported Windows smoke run reached play without an adapter, but does not exercise the new device path.
Switches: HOS_GAMECUBE is added, on by default on Windows; setting it to 0 leaves the adapter available to other programs. Its table and user documentation are updated. HOS_SWITCH2 and HOS_SWITCH2_RUMBLE_TEST now also receive inherited environment values; their defaults are unchanged.
Reviewed:
dc66d624ecagainst7bc53f8413: Read the repository rules and PR template, the changes since the ledger head, gamecube.rs and winusb.rs, and the relevant switch collection, driver startup and logging paths. Skimmed the remaining PR diff and tests; did not read every changed code file in full.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. The author reports 33 build-core tests passing, a Windows smoke run without the adapter passing, and hardware runs still outstanding; CI is still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
Pushed
338bbafae: a tester's official adapter connected through the Launcher build, but input came through only now and then, with a lot of delay. The likely cause: the driver read 64 bytes at a time while a report is 37, and WinUSB keeps the extra for the next read, so reports after the first no longer lined up and most were dropped. It now reads one 37-byte report at a time, as Dolphin does, and the log says the adapter's packet size and how many of the first 1000 reads were no report. Not run on hardware yet: the tester will rebuild. Game-free tests and clippy pass (but for main's note_lines).Testing: the tester's first run (
dc66d624e) added; the read fix (338bbafae) is to be run next.Tested on hardware: the player with the official adapter rebuilt the PR in the Launcher with the read fix (
338bbafae) and reports it "works perfect". Several controllers, a WaveBird, rumble and plugging in and out stay in Still to test until they say.@review
Recommendation: Request changes. The adapter now works in the player's basic hardware run, but the new Windows code still violates the repository's stated unsafe-code location rule. The moved Switch 2 lookup also awaits a hardware run.
Adds Windows support for Nintendo's GameCube adapter through WinUSB and shares device lookup with the Switch 2 driver. It adds a polling thread and device-specific code so adapter controllers can reach the game as virtual pads.
Blocking (1): must change before merging.
builder/crates/build-core/src/gamecube.rs:167: The new Windows module permits unsafe code outside the locations allowed by the repository’s builder code rules; the new winusb.rs does the same. When: Both modules introduce Windows FFI under new allow(unsafe_code) exemptions, while docs/dev/standards.md restricts builder unsafe code to the named system-call modules. Do: Put the required unsafe system calls behind an allowed system-call boundary, or have the repository rule explicitly changed through the appropriate decision.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
builder/crates/build-core/src/switch2.rs:738: The shared lookup has not been exercised with the existing Switch 2 Pro Controller. When: The Windows smoke run had no such controller, so a discovery or initialization regression would leave its USB controls and NFC unavailable without appearing in that run. Do: Run a Windows USB Switch 2 Pro Controller through connection, controls, motion, rumble and NFC after the lookup move.@fixcan do L3.Since the last review (on
dc66d624ec)Resolved: L4 (The new device path has not been exercised with the adapter it is meant to support.)
Still open: L3 (The new Windows module permits unsafe code outside the locations allowed by the repository…); L5 (The shared lookup has not been exercised with the existing Switch 2 Pro Controller.)
Checks: Still running: 11 checks.
Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for basic input: the player reported that the official adapter worked without delay on head
338bbafae. Multiple controllers, WaveBird, rumble and hotplug remain untested; this is not a performance change.Other systems: The shared Windows WinUSB lookup can affect the Switch 2 Pro Controller; its hardware run remains outstanding. The GameCube driver is Windows-only; Linux does not run that device path.
Switches: HOS_GAMECUBE is new and defaults on for Windows adapter support; 0 leaves the adapter to another program. HOS_SWITCH2 and HOS_GAMECUBE now also follow inherited game environment values. The default enables the feature and the opt-out addresses exclusive access.
Reviewed:
338bbafaefagainst7bc53f8413: Read AGENTS.md, CONTRIBUTING.md, the PR template, the applicable unsafe-code rule, gamecube.rs, winusb.rs and lib.rs; inspected the diff and surrounding changed code. The larger control.rs, pads.rs and switch2.rs output was skimmed. docs/review-checklist.md and the adjacent Tooling AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports game-free checks and a Windows smoke run; the player reports a successful basic adapter run on this head. CI is still running.
Overlaps and merge order: Not checked; the network is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
Pushed
b6a164927: the sandbox table's GameCube row says it has run with a player's adapter (one controller's input), not yet with several controllers, a WaveBird, rumble or replugging. L3 (unsafe outside sys.rs/disk.rs) is left for a maintainer's decision, as the review asks: the rule as written doesn't match main (33 builder files have #[allow(unsafe_code)], switch2.rs's mod os among them), and this PR follows switch2.rs's pattern.L3: the rule's wording is proposed in #3250 (docs only), matching what main does: a module or function that calls the system or a C library itself allows unsafe, each block with its SAFETY comment. If a maintainer turns it down, this PR's WinUSB and SetupDi calls move to sys.rs instead.
@review
Recommendation: Request changes. The new Windows code still violates the builder’s documented unsafe-code rule. The existing Switch 2 Pro Controller path also awaits a hardware run after its lookup was moved.
The builder adds support for Nintendo’s GameCube adapter through WinUSB, including virtual gamepads and rumble, while sharing device lookup with the Switch 2 driver. One player reports working input with the adapter; the new Windows FFI code adds maintenance cost and currently conflicts with the repository’s stated rule.
Blocking (1): must change before merging.
builder/crates/build-core/src/gamecube.rs:167: The new Windows module permits unsafe code outside the locations allowed by the repository’s builder code rules; the new winusb.rs does the same. When: Both modules introduce Windows FFI under new allow(unsafe_code) exemptions, while docs/dev/standards.md restricts builder unsafe code to the named system-call modules. Do: Put the required unsafe system calls behind an allowed system-call boundary, or have the repository rule explicitly changed through the appropriate decision.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
builder/crates/build-core/src/switch2.rs:738: The shared lookup has not been exercised with the existing Switch 2 Pro Controller. When: The Windows smoke run had no such controller, so a discovery or initialization regression would leave its USB controls and NFC unavailable without appearing in that run. Do: Run a Windows USB Switch 2 Pro Controller through connection, controls, motion, rumble and NFC after the lookup move.@fixcan do L3.Since the last review (on
338bbafaef)Still open: L3 (The new Windows module permits unsafe code outside the locations allowed by the repository…); L5 (The shared lookup has not been exercised with the existing Switch 2 Pro Controller.)
Checks: Still running: 11 checks.
Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for one controller’s input: a player reported that the Launcher build at
338bbafaeworked perfectly after the 37-byte read fix. Multiple controllers, WaveBird, rumble and reconnects remain untested.Other systems: The shared WinUSB lookup can affect the existing Windows Switch 2 Pro Controller; no hardware run after the move is reported. The adapter’s multi-controller, wireless, rumble, reconnect and competing-program paths also remain to be exercised.
Switches: HOS_GAMECUBE is added, enabled by default; setting it to 0 leaves the adapter alone. HOS_SWITCH2 retains its enabled default, and both driver switches now honor the game’s inherited environment. The defaults support automatic controller use, with an opt-out for competing programs.
Reviewed:
b6a1649279against7bc53f8413: Read the current sandbox diff and its surrounding table, the relevant unsafe-code rule and unsafe locations, commit list, supplied description, comments, CI and ledger. The remaining changed code and repository rules were not read in full for this re-check.; nothing run (a code review).Checked and fine:
Testing: No commands that build, run tests or execute project code were run. The reported player run passed for one controller; Switch 2 hardware testing and the listed adapter scenarios remain outstanding. CI is still running.
Overlaps and merge order: Longshot#3250 proposes changing the unsafe-code rule; its acceptance before this pull request would affect L3.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
Thanks. On the review of
b6a164927:unsafe, each block with its// SAFETY:comment. Its review recommends approval, and its one should-fix (raw handles and mapped files) is pushed. Once a maintainer merges it, this PR'sgamecube.rsmod osandwinusb.rsfall under it: they are WinUSB, SetupDi and registry calls, each block with its SAFETY comment, as inswitch2.rs'smod os. If 3250 is turned down, the calls move tosys.rshere.winusb.rs. The lookup's strings are unchanged (VID_057E&PID_2069&MI_01for the WinUSB interface,&MI_00for HID), andwinusb.rs's tests check them.HOS_GAMECUBE=0) stay in Still to test until the player reports them.@rebase
I rebased this pull request onto
main(9eebe07ea1): the new head is4a66755b8d.Conflicts resolved
builder/crates/build-core/src/gamecube.rs,docs/dev/reference/input.mdNothing 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.
b6a16492794a66755b8dRecommendation: Approve. The code is ready: only testing is left. The GameCube adapter works for one controller in the reported hardware run, and the unsafe-code rule now permits the Windows modules. The moved Switch 2 Pro lookup still needs its hardware run. Recommend approval; not approved on the forge.
The builder reads Nintendo’s GameCube adapter through WinUSB and exposes its controllers as virtual gamepads. It shares device lookup code with the Switch 2 driver and adds a default-on kill switch.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
builder/crates/build-core/src/switch2.rs:738: The shared lookup has not been exercised with the existing Switch 2 Pro Controller. When: The Windows smoke run had no such controller, so a discovery or initialization regression would leave its USB controls and NFC unavailable without appearing in that run. Do: Run a Windows USB Switch 2 Pro Controller through connection, controls, motion, rumble and NFC after the lookup move.Since the last review (on
b6a1649279)Resolved: L3 (The new Windows module permits unsafe code outside the locations allowed by the repository…)
Still open: L5 (The shared lookup has not been exercised with the existing Switch 2 Pro Controller.)
Checks: Still running:
PR description / Title and description (pull_request_target).Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes: the player reported that one controller worked without delay on commit
338bbafaeafter the report-size fix. Multiple controllers, WaveBird, rumble and reconnects remain untested in the reported run.Other systems: The shared lookup also affects the Windows Switch 2 Pro Controller; its hardware run remains outstanding. The adapter driver is Windows-only; Linux and other gamepad paths are not intended to change.
Switches: HOS_GAMECUBE is added, default on; HOS_GAMECUBE=0 leaves the adapter to other programs. HOS_SWITCH2 and HOS_GAMECUBE now also honor inherited environment values. The default enables the feature, though it can claim the adapter before another program.
Reviewed:
4a66755b8dagainst9eebe07ea1: Read the changed GameCube logging lines, the console logging filter, the unsafe-code rule and unsafe annotations; inspected the change summary and commit history. The remaining changed files and repository review rules were not read in full.; nothing run (a code review).Checked and fine:
Testing: The reported Windows hardware run passed for one GameCube controller; the Switch 2 Pro run remains outstanding. No tests were run during this read-only review.
Overlaps and merge order: The unsafe-code standards change is present in the base; the comments identify PR #3250. The logging filter is also present in the base.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.