Repository navigation
Mac: one Pro Controller is one pad (IOHIDManager hands a device over once per matching dictionary) - #1722
Closed
LudovicLemarinel wants to merge 1 commit into
Closed
Mac: one Pro Controller is one pad (IOHIDManager hands a device over once per matching dictionary)#1722LudovicLemarinel wants to merge 1 commit into
LudovicLemarinel wants to merge 1 commit into
Conversation
…once per matching dictionary it meets, so the HID reader knows a pad by its I/O Registry entry, not by its IOHIDDeviceRef A Pro Controller meets both the GamePad usage dictionary and the vendor / product one added for identical pads (PR seedds#1595), and each match came as a new IOHIDDeviceRef for the same registry entry. hidpad_found compared references only, so one pad counted as two of its model against GameController's one controller: both were read as twins, players 1 and 2. A one-player game then opened the controller applet every few frames, and The Legend of Zelda: Ocarina of Time, which suspends its music while an applet has focus, played no area or cutscene music. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
seedds
added a commit
that referenced
this pull request
Nov 8, 2026
…once per matching dictionary it meets, so the HID reader knows a pad by its I/O Registry entry, not by its IOHIDDeviceRef (PR #1722) A Pro Controller meets both the GamePad usage dictionary and the vendor / product one added for identical pads (PR #1595), and each match came as a new IOHIDDeviceRef for the same registry entry. hidpad_found compared references only, so one pad counted as two of its model against GameController's one controller: both were read as twins, players 1 and 2. A one-player game then opened the controller applet every few frames, and The Legend of Zelda: Ocarina of Time, which suspends its music while an applet has focus, played no area or cutscene music. Co-authored-by: Ludovic LEMARINEL - Adesin.fr <10656218+LudovicLemarinel@users.noreply.github.com>
Owner
|
Landed unchanged as a00f03b (only the Ocarina note's "Found on this game" list needed a merge with lines added on main since), with you credited as co-author. Thanks — a clean root-cause fix: knowing a pad by its registry entry holds for any overlap among the matching dictionaries, not only the Pro Controller's. Still untested with this change: two Pro Controllers over USB (the #1595 case); if you have two, a run would close that gap. |
4 of 6 tasks
dandelion711
pushed a commit
to dandelion711/nxnative
that referenced
this pull request
Nov 8, 2026
…once per matching dictionary it meets, so the HID reader knows a pad by its I/O Registry entry, not by its IOHIDDeviceRef (PR seedds#1722) A Pro Controller meets both the GamePad usage dictionary and the vendor / product one added for identical pads (PR seedds#1595), and each match came as a new IOHIDDeviceRef for the same registry entry. hidpad_found compared references only, so one pad counted as two of its model against GameController's one controller: both were read as twins, players 1 and 2. A one-player game then opened the controller applet every few frames, and The Legend of Zelda: Ocarina of Time, which suspends its music while an applet has focus, played no area or cutscene music. Co-authored-by: Ludovic LEMARINEL - Adesin.fr <10656218+LudovicLemarinel@users.noreply.github.com>
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
…once per matching dictionary it meets, so the HID reader knows a pad by its I/O Registry entry, not by its IOHIDDeviceRef (PR seedds#1722) A Pro Controller meets both the GamePad usage dictionary and the vendor / product one added for identical pads (PR seedds#1595), and each match came as a new IOHIDDeviceRef for the same registry entry. hidpad_found compared references only, so one pad counted as two of its model against GameController's one controller: both were read as twins, players 1 and 2. A one-player game then opened the controller applet every few frames, and The Legend of Zelda: Ocarina of Time, which suspends its music while an applet has focus, played no area or cutscene music. Co-authored-by: Ludovic LEMARINEL - Adesin.fr <10656218+LudovicLemarinel@users.noreply.github.com>
Fasen24-AI
added a commit
to Fasen24-AI/swordboiMacNative
that referenced
this pull request
Nov 10, 2026
…ands a device over once per matching dictionary) Upstream pull requests applied in this commit (their authors' work, brought onto this tree with a three-way merge; the description is in each PR): - seedds#1722 by LudovicLemarinel (closed): Mac: one Pro Controller is one pad (IOHIDManager hands a device over once per matching dictionary)
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.
Problem
With one Switch Pro Controller connected to the Mac over Bluetooth, the host reads it as two players. The log shows the same pad taken twice, at the same USB location:
A one-player game then sees more controllers than it asked for, so it opens the controller applet. The applet closes and the game opens it again. In a session of about 9 minutes of The Legend of Zelda: Ocarina of Time (
0400486024DEC000), this happened 2,286 times, each time with a focus loss:Effect on the game. Ocarina of Time suspends its music while an applet has focus, as games do under the HOME menu. As a result:
DM_FS=1), the game never opensBGM_KokiriForest.bwav,BGM_Kokiri_*orBGM_Dm_Kokiri_*, although it loads the music table (bgm.Product.111.byml.zs),BGM_Static.bars.zsand the area-music actors.BGM_Shop_KokiriForest.bwav, played from a sound locator) worked.The applet loop by itself also costs every one-player game a focus change every few frames, whatever it does with its sound.
Cause
IOHIDManagerhands a device over once per matching dictionary it meets, and each time as a newIOHIDDeviceReffor the same I/O Registry entry.Since #1595 (identical pads that GameController lists fewer of than IOKit has),
hidpad_startmatches three dictionaries:057E/ product2009, so that every Pro Controller is counted whatever usage it declares.A Pro Controller declares the GamePad usage, so it meets two of them. A small IOKit program using the same matching shows it:
There are two references and one registry entry (
0x100010cfb).hidpad_foundrecognised a known device only by reference (d->hid == hid), so it stored the pad twice. Two steps then followed:hidpad_model_countfound 2 Pro Controllers in IOKit against GameController's 1.pad_dupes_wantconcluded that GameController hid one of them, so both references were read from report0x30as twins, one player each, and GameController's own controller was left unread.Fix
pad_hid_mac.hnow identifies a device by its I/O Registry entry ID (IORegistryEntryGetRegistryEntryIDonIOHIDDeviceGetService), throughhidpad_entry.hidpad_foundignores a reference whose entry is already ing_hidpads,g_hidpads_waitingorg_hidpads_gc.This is a general fix at the source, not a game-specific rule:
The finding is recorded as a new Input entry, One Pro Controller read as two players, in
docs/reference/services.md. It is also in the symptom index, regenerated withdm/tools/docs_symptoms.py, and under "Found on this game" in Ocarina of Time's note.Testing
controller 'Pro Controller' connected: player 1 (npad 0), with motion (gyro)line, no controller applet, and music in gameplay, confirmed by ear.t_hid,t_pad_hid,t_pad_apple,t_pad_proandt_motion_pro_macpass. No unit test includespad_hid_mac.h: it is compiled only infront_mac.m.dm/tools/tests/test_docs.pypasses.regress.py impact origin/main..HEADreports no affected game, andpad_hid_mac.his not inimpact_map.tsv. The change only concerns how the Mac front end enumerates physical controllers, which the headless regression runs do not have, soregress.py check --gameswas not run.🤖 Generated with Claude Code