Repository navigation
Map Nintendo controller face buttons by label on macOS and iOS - #180
Nishikori-Yui wants to merge 2 commits into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
ea12b67 to
fccf983
Compare
|
Updated this PR based on @bingoxp's suggestion. Thanks for pointing out The implementation now uses The same fix is now applied to both macOS and iOS. I've also updated the PR description with the implementation details, before/after code, and device-probe results, including tests with an official and a third-party Switch Pro Controller. |
|
@seedds, the changes are ready for review. I'd appreciate it if you could take a look when you have a chance. Hopefully we can get this fix merged upstream soon. |
|
Heads-up: #388 proposes treating controls as data that every UI writes (#388 (comment)): the key and button maps (#386's |
|
Thanks for pointing out the overlap with #295, #382, and #386. I agree that the controller work should eventually be coordinated in one place. For #180, the intended scope is only the default behavior when no user mapping has been configured. It uses A future controls UI or |
|
A data point from iPadOS for this PR: GameController reports a combined Joy-Con (L/R) pair by label too, not only the Pro Controller. On an iPad Air 13-inch (M3), iPadOS 27.2 (productCategory So the |
…settings, Ocarina of Time on Qualcomm - Game language: Polish (pl) and Thai (th), from SDK 21's own settings table (sdk+0xc62b5c in Ocarina of Time lists pt-BR, pl, th); the launcher list, the host's DM_LANG mapping and GetAvailableLanguageCodes. Ocarina of Time (`0400486024DEC000`) carries EUpl messages, Donkey Kong Bananza (`040074A01BF12000`) 1.1 EUpl and THth. - Launcher: one full page per game with tabs Performance (Picture, Speed, Advanced), Game (options, Game language, Controls), Saves and Storage; rows wrap and say what they do; profile options keep their description and say when they need Prepare again. - Recommended settings per game and phone (game.tsv recommend rows, Recommend.java): a card with Recommended / Custom and tags on the rows; facts from GLES at launcher start before the first readiness check. Ocarina of Time on Qualcomm: system driver, Performance preset, Full vegetation off. - Resolution presets (res_preset, scene_output rows) and Scene resolution overlays from a game's own dynamic resolution palette (scene_res.py, DM_ROMFS_OVERLAY). - Qualcomm's own driver: mesh draws through compute by default (full Ocarina of Time foliage; DM_VK_MESH=1 keeps native mesh shading). - Mesh draws through compute: a draw takes its own record's entry, and prewarm drops mesh / pixel pairings that do not feed each other (see-through on Adreno 830, black-line flicker on Turnip, issue seedds#180). - Texture serial map: probes past tombstones, live and tombstone counts apart (the table no longer grows with every serial ever registered). - pack_android.py: a profile with a selected shader set builds that set on the Mac and Windows (issue seedds#178). - PRs seedds#150, seedds#151, seedds#171 (FrenklinFish) and seedds#156, seedds#163 (Omnicrash) were merged on Forgejo before this update.
Summary
GCController.productCategoryon both macOS and iOS.buttonA -> A,buttonB -> B, etc.).Joy-ConandJoyConspellings, as found in SDL and Chromium metadata.Motivation
The Mac frontend previously converted face buttons by physical position for every controller. On an NS Pro Controller, pressing the printed B button (bottom position) therefore produced the game's A input. The same positional conversion also existed in the iOS frontend.
GameController exposes face buttons as
buttonA,buttonB,buttonX, andbuttonY. The supplied probe results show that for Nintendo-layout devices these properties can reflect the printed labels. InterpretingbuttonBas the right-position input on those controllers caused the mismatch: the physical B was sent to the game as A.Detection approach
Following the recommendation in the review discussion, this uses a Nintendo-only whitelist rather than attempting to enumerate Xbox, PlayStation, and every third-party controller. It checks Apple's
productCategory, not the user-editablevendorName:We accept both Joy-Con spellings because SDL reports
Nintendo Switch Joy-Con (L/R), while Chromium hasNintendo Switch JoyCon (L/R). Categories that do not match retain the existing positional behavior.Before and after
Before: every controller mapped by position
This is the Xbox-style physical-position conversion for Switch games:
For the NS Pro Controller's printed B, GameController reports
buttonB, but the old code treated that property as the right-position input and sent game A.After: label mapping for Nintendo categories, position mapping otherwise
The same conditional mapping is implemented in iOS
read_pad, using itsB_A/B_B/B_X/B_Yinput bits.Device probe evidence
The reported GameController probe output:
Both the original and third-party Switch-layout controllers report
Switch Pro Controller, while DualSense reportsDualSense. This supports using Apple's category as the auto-detection signal instead of matching a user-editable name.Mapping details
Switch,Joy-Con, orJoyConbuttonASwitch,Joy-Con, orJoyConbuttonBSwitch,Joy-Con, orJoyConbuttonXSwitch,Joy-Con, orJoyConbuttonYbuttonB(right position)buttonA(bottom position)buttonY(top position)buttonX(left position)Shoulders, triggers, sticks, D-pad, menu/options buttons, rumble, input delivery, and player assignment are unchanged.
Verification
133 files, 0 failed.git diff --checkpasses.Limitation
Auto-detection depends on Apple's
productCategory. A third-party Switch-layout controller reported under an unrelated category will continue to use positional mapping. This change intentionally does not add a manual layout setting or enumerate other controller categories.