Read each emulator's device identity instead of deriving it - #4
Merged
Conversation
Two faults in the GameCube auto-setup, both found on an AYN Thor: Dolphin's Android device qualifier is Source/ID/Name, and the ID comes from InputDevice.getControllerNumber() — Android's own gamepad enumeration counter (ControllerInterface::AddDevice prefers GetPreferredId(), which the Android backend fills from getControllerNumber, falling back to a duplicate-name index only for non-gamepads). We wrote the pad's rank among our own virtual gamepads instead, which only matches when nothing else is connected: on a handheld with a built-in controller that number is already taken, so the section bound to the wrong device or to none. On the Thor the built-in pad holds number 1 and ours reports 3. It is now read from the live input-device list, alongside the port lookup Eden already used, and a player whose pad isn't enumerated is skipped rather than given a guessed id. The dual-Joy-Con stick default also had the GameCube sticks crossed — main stick driven by the right Joy-Con and C-stick by the left. The Switch Pro and Nunchuk defaults already route left to left. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Eden numbers its `port` by walking InputDevice.getDeviceIds() and counting every physical game controller it passes (InputHandler.getDevices), so a built-in pad shifts ours along — a controller number already registered is skipped but still consumes a port. We were ranking our own virtual pads among themselves, which only agrees when nothing else is connected. On the AYN Thor the built-in Odin Controller (device id 10) takes port 0 and our pad (id 15) is port 1, but we wrote port 0 — the same fault just fixed for Dolphin, and invisible on any device where our pad happens to enumerate first. Both rules now live in VirtualGamepadIdentity next to each other, each read from the emulator's own source: Dolphin wants getControllerNumber(), Eden wants that walk order, and neither is the player number. Dolphin's Wii Remote config addresses our own DSU slot, so it has nothing to look up. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three faults in the emulator auto-setup, all found on an AYN Thor. The common cause: we were deriving the number each emulator uses to identify our virtual pads, instead of reading it.
Every emulator picks a different quantity, and none of them is the player number. Each rule below was read from that emulator's own source, not inferred.
Dolphin: wrong
DeviceidDolphin's qualifier is
Source/ID/Name, and the ID comes fromInputDevice.getControllerNumber().ControllerInterface::AddDeviceprefersGetPreferredId(), which the Android backend fills fromgetControllerNumber(), falling back to a duplicate-name index only for non-gamepads:We wrote the pad's rank among our own virtual gamepads (
rank + 1), which only coincides when nothing else is connected.Eden: wrong
portEden (yuzu lineage) numbers
portby walkingInputDevice.getDeviceIds()and counting every physical game controller it passes — a controller number already registered is skipped but still consumes a port:deviceIds.forEach { deviceId -> InputDevice.getDevice(deviceId)?.apply { if (isPhysicalGameController(this)) { if (!gameControllerDeviceIds.contains(controllerNumber)) { ...port... } port++ } } }We were ranking our pads among themselves, so any built-in controller shifts ours along unnoticed. This was invisible on devices where our pad happens to enumerate first.
Measured on the Thor
Exactly two devices pass Eden's
isPhysicalGameController:Android/1/…Android/3/…(controller number)port:0port:1(Odin takes 0)The Dolphin value matches the hand-corrected working config exactly. Any handheld with a built-in controller breaks the old assumption — the Thor, and the Odin 2 Portal a reporter is using.
Crossed sticks on dual Joy-Cons
gameCubeSticks(DUAL)routed the GameCube main stick from the right Joy-Con and the C-stick from the left. The Switch Pro and Nunchuk defaults already route left→left; GameCube was the outlier.Structure
Both lookups now sit together in
VirtualGamepadIdentity(renamed fromVirtualGamepadPorts), each documented with the emulator rule it mirrors, so a future auto-mapping can't quietly go back to deriving a number. Dolphin's Wii Remote config addresses our own DSU slot (DSUClient/<slot>/Joycon2), so it has nothing to look up — audited, unchanged.A player whose pad isn't enumerated is now skipped rather than handed a guessed id, since a wrong id binds to the wrong device or to none.
Verified
./gradlew build :konsist:testgreen;DolphinGcpadConfigTestupdated — the case that asserted the old rank behaviour now asserts the reported controller number, plus a new case covering the skip.dumpsys inputand cross-checked against the hand-correctedGCPadNew.ini.Note
Unrelated to #3 (stick calibration) and based on
main, so the two can merge in either order.🤖 Generated with Claude Code