Skip to content

Add Steam Controller (2026) support on macOS - #221

Open
thehobbit85 wants to merge 3 commits into
seedds:mainfrom
thehobbit85:codex/steam-controller
Open

thehobbit85 wants to merge 3 commits into
seedds:mainfrom
thehobbit85:codex/steam-controller

Conversation

@thehobbit85

@thehobbit85 thehobbit85 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Adds Steam Controller (2026) support to the Mac host, and shares controller mappings between the launcher and the host.

Commits

  1. host/hid: keep motion and rumble per player: each player keeps its own six-axis history (dm_pad_motion), rumble can go straight to a controller's own actuators (haptics_apple), and six-axis handles use the SDK's style indices and device bytes. Builds and passes the host suite on its own.
  2. host/input: support the Steam Controller (2026) on macOS:
    • A direct HID adapter (steam_input.h) for USB-C, the Puck and Bluetooth: buttons, both sticks with a 10% radial deadzone (DM_STEAM_DEADZONE), trackpads, rear buttons, gyro and rumble, each controller as its own player.
    • The Mac controller code moves out of front_mac.m into controllers_mac.m, one registry for every model. Main's wired Xbox One (GIP) and Xbox 360 (XUSB) pads, Switch Pro stick fallback, 8BitDo routes and GameController player lights are carried over; main's right-stick motion and its Controls menu stay as they are.
    • The raw HID adapter (pad_hid_mac.h) builds on main's per-device opening: a device the Steam adapter holds waits until it is free, pads are matched by their I/O Registry entry, and a model whose pad cannot be opened stays with GameController.
    • Key and button maps (input_map.h, DM_KEYMAP / DM_PAD_MAP) are shared with the launcher in the game's preference domain, so the mapping panel and the host agree (docs/frontends.md, docs/mac-controllers.md). The launcher applies the saved maps after main's Swift launcher has resolved launcher.json.
  3. ios/input: take the Switch 2 front's split flag on attach: the iOS front end takes the split argument commit 2 adds to dm_switch2_front.attach, with the Mac's rule.

Testing

Hardware (by the author, on a Steam Controller 2026): USB-C, Puck and Bluetooth all work; trackpads and rear buttons work; saved mappings persist. Earlier, @hrdkbhatnagar confirmed rumble and gyro in Tears of the Kingdom over USB-C, which led to the stick deadzone (report).

Gameplay (by the author, with the Steam Controller): LOLLIPOP CHAINSAW RePOP and The Legend of Zelda: Link's Awakening both appeared to work with the controller.

Both of these were on an earlier revision (head 3cf085260 or before); the refreshes since have not been retested on hardware.

Local, on this head (dfec25504, main 7d398f7a9; macOS, Apple Silicon):

  • Mac host build (GAME=010015100B514000) on each commit.
  • Host test suite (make -C dm/host/tests run, 90 commands, each run on its own): 88 pass, including t_hid, t_haptics_apple, t_controllers_mac, t_pad_hid_mac, t_pad_gip, t_pad_xusb, t_pad_gip_mac, t_motion_pro, t_motion_pro_mac, t_input_map, t_pad_map and t_pad_motion. The other two are main's: t_memstat alternates between pass and fail (its sources are main's), and t_cheats does not link on main either (main's hle_os.c now calls dm_thread_native_wait).
  • t_controllers_mac, t_haptics_apple and t_pad_hid_mac under ASan/UBSan: pass, no reports.
  • test_docs.py, test_game_profile.py, test_nsp_chain.py, test_nsp_mac_app.py, test_nsp_mac.py, test_launcher_settings.py, test_nsp_multi_program.py, test_bug_report.py and dm/ios/tests/test_launcher_storage.py pass. test_env_switches.py fails the same way on main (switches quoted in the docs but read nowhere). The symptom and patch indexes are current.
  • iOS: dm/ios/tools/compile_check.py (270 files) and swiftc -typecheck of the iOS Swift sources pass. This is a source check, not an IPA or device run.

Not run here: clang-tidy (no LLVM locally; CI runs it), regress.py check --games (no Mac game builds on this machine), a physical iPhone.

Known limits

  • The gyro scale has not been calibrated against a known rotation.
  • One player per model drives both raw HID motion and the stick fallback, so a Pro Controller whose gyro is turned off in the mapping panel also loses its stick fallback.
  • The original 2015 Steam Controller is a different protocol and is not handled.
  • The Mac menu bar now has main's Controls menu (Right Stick Motion) beside this PR's Controllers menu; they could become one.

Changes in this revision

Rebased on main 7d398f7a9, keeping the three commits. Main changed code this PR builds on, so its changes are carried over:

  • Raw HID (pad_hid_mac.h): main now opens each raw HID pad on its own (1947c0df1), as this PR did. This PR uses main's version (opening, scheduling, closing and the Input Monitoring messages) and keeps only its own additions: matching by registry entry, the deferred list for devices the Steam Controller adapter holds (hidpad_available, hidpad_retry), and handing a model back to GameController when one of its pads cannot be opened. The fixtures follow main: a pad handed back to GameController stays open but unread, and t_pad_hid_mac is main's plus the hidpad_available stub.
  • Launcher (launcher.c): main moved saved choices into the Swift launcher (7cf637e1f), which resolves launcher.json's rows only. DM_KEYMAP and DM_PAD_MAP stay in C: they are applied after it (saved_controls, with the same checks and order; DM_SAVED_CHOICES=0 skips them and says so), and a value from the launch environment is added to DM_ENV_LAUNCH_KEYS, so the host keeps it fixed. docs/frontends.md no longer mentions DMSettings.
  • Player lights: main's GameController player lights (cfdae4aa4) are set from the registry: a pad's player when it joins, and off when it leaves or waits to join. Original Joy-Cons keep their own HID-driven lights. The controller fixture checks this.

Earlier revisions: on ab44edaba, main's lazy Pro stick probe, XUSB pads and right-stick motion were carried over. On 168e9e780, the PR was split into its commits, and the lint workflow change and the HMMA tests (already in #870) were removed.

Front-ends: Mac launchers share DM_KEYMAP and DM_PAD_MAP in the per-game preference domain; use the controller-specific choice contract in docs/frontends.md for extra inputs and model settings.

@hrdkbhatnagar

hrdkbhatnagar commented Oct 26, 2026 •

Copy link
Copy Markdown

I tested this PR with a real 2026 Steam Controller. Rumble works. Gyro data reaches the game, but TotK's gyro aiming does not respond to it. Details below.

Setup

  • MacBook Pro M4 Pro, macOS 27.0.1 (26A434), Xcode 26.3
  • Steam Controller (2026) over USB-C: 28de:1302, report 0x42 (54 bytes, about 250 per second). Steam was closed.
  • PR head f7c2f2f, merged locally into ff44c59 (the build my TotK Mac app came from) and into c484b13 (current main). Each merge has 3 conflicts, all additive (dm/host/Makefile, dm/host/tests/Makefile, dm/host/tests/t_hid.c). In tests/Makefile, the run: … t_controllers_mac line ends up in the middle of the main run recipe, so $(B)/t_symbols has to move above it.
  • t_hid (129 checks), t_pad_map, t_pad_motion, t_controllers_mac and t_haptics_apple pass on both merges. dmhost builds for TotK.

Results

Feature Result
Detection controller 'Steam Controller (2026)': player 1, no [RED] lines
Buttons / sticks worked in play
Rumble works
Gyro: report decoding (steam_input.h) matches the hardware (see below)
Gyro: delivery to the game works: TotK reads live values
Gyro: TotK bow aiming (motion controls on) no response
Trackpads, rear buttons, Bluetooth, Puck not tested

Axes and signs

A read-only IOKit probe (sends nothing to the controller) guided four moves and integrated the raw gyro at offset 40, using the PR's scale. The accelerometer is at offset 34.

Move Raw gyro (x, y, z), degrees Raw accel (x, y, z), G Expected with Switch axes (x right, y forward, z up)
Flat on desk (rest) (+0.01, +0.00, +0.99) +1 G on z (specific force); the PR negates it to (0, 0, −1) ✓
Turn left (CCW from above) (+4.5, −3.8, +27.7) positive about z ✓
Tilt far edge up (+16.9, −1.9, −2.4) y +0.11 positive about x ✓; accel +y ✓
Roll right (right grip down) (−4.5, +25.2, +2.4) x −0.35 positive about y ✓; accel −x ✓

So the controller's axes are the Switch's, and the PR's mapping (acc = -raw, gyro = +raw) has the right signs. The angles were a third to a half of what I asked for. That may be my movement, but I have not confirmed the ±2000 dps scale against gravity.

What TotK receives

I added a temporary trace, DM_GYRO_TRACE=1, to controller_publish_motion and six_states:

gyro trace: controller motion #1 focus 1 (app 1 window 1 modal 0) slot 0 merge 0 gyro_enabled 1 -> gyro (0.000, 0.000, -0.000) rev/s acc (-0.00, 0.15, -1.00)
gyro trace: GetSixAxisSensorHandles npad 0 style 0x1 -> 1 handle(s), first 0
gyro trace: six_states #2760 handle 0 n 16 player 0 physical 1 (history 7054) -> gyro (-0.090, 0.005, 0.096) rev/s acc (-0.48, -0.43, -0.63) dir row0 (0.83, -0.37, 0.42)
gyro trace: six_states #3480 handle 0 n 16 player 0 physical 1 (history 8341) -> gyro (0.017, -0.044, 0.269) rev/s acc (0.03, -0.05, -1.00) dir row0 (0.95, -0.31, -0.07)

TotK 1.4.3 imports only GetSixAxisSensorHandles, StartSixAxisSensor and GetSixAxisSensorStates. Its poller at main+0x47aec0 reads 16 states per npad into a 0xe98-byte per-npad record (states at +0x290). main+0x47a140 onwards then:

  • counts new samples from the sampling number (newest − last seen, at most 16);
  • converts acceleration and gyro to (−x, z, y);
  • remaps the angle and direction the same way;
  • flags an "untouched sensor" pattern (zero x/z acceleration with an identity direction).

A DM_PROBE at main+0x47a1d4 (the store of the new-sample count) gave x15 = 2 to 4 every frame with the sampling number advancing, so the game's input layer takes the samples. The bow aim still did not move. Whatever drops the motion is further up, in TotK's aiming or camera code. I didn't get further than that.

Side finding: six-axis handle encoding

GetSixAxisSensorHandles puts the style bit number in byte 0 (FullKey → 0). On the console, byte 0 is the SDK style index (FullKey 3, Handheld 4, JoyDual 5, JoyLeft 6, JoyRight 7, with 0 = None), and the host's vibration handles already use that. I switched both the handles and six_connected to the index (ctz(style) + 3) and TotK then got handle 0x3. It made no difference to TotK's aiming, but it is a divergence from hardware that another game could trip on. It predates this PR (main has the same encoding), and t_hid's h = 0x100 would need updating if it changes.

Not done

  • Trackpads, rear buttons and the mapping window were not exercised.
  • Bluetooth and Puck were not tested; this controller was on USB-C only.
  • The gyro scale against gravity is unconfirmed.

@hrdkbhatnagar

Copy link
Copy Markdown

Follow-up: gyro aiming works with a stick deadzone

I found why TotK's bow aiming ignored the gyro. The motion data was correct throughout. The Steam Controller's sticks have no deadzone in this PR.

steam_decode passes the raw stick axes through. At rest they sit a few counts off zero, while the console reports a centred stick as exactly 0. TotK treats any non-zero stick as stick input and ignores motion while aiming. In play, gyro aiming started working briefly after I used an ability (which reset TotK's input state) and stopped for good once I touched the left stick.

With a radial deadzone in steam_decode, gyro aiming works: right away, after walking with the left stick, and while moving and aiming at once. The camera stick feels normal.

--- a/dm/host/steam_input.h
+++ b/dm/host/steam_input.h
@@ #pragma once
+#include <math.h>
 #include <stddef.h>
+#include <stdlib.h>
 #include <string.h>
@@
+// The raw HID sticks rest a few counts off centre; the console's input service reports a centred stick as exactly 0 (a radial deadzone), and games rely on it:
+// Tears of the Kingdom treats any non-zero stick as stick input and stops gyro aiming. Radial deadzone of DM_STEAM_DEADZONE (fraction of full scale, default 0.10),
+// rescaled so the edge still reaches full scale
+static inline void steam_deadzone(int32_t *x, int32_t *y) {
+    static float dz = -1; if (dz < 0) { const char *e = getenv("DM_STEAM_DEADZONE"); dz = e ? (float)atof(e) : 0.10f; if (!(dz >= 0 && dz < 0.9f)) dz = 0.10f; }
+    float fx = *x / 32767.0f, fy = *y / 32767.0f, m = sqrtf(fx * fx + fy * fy);
+    if (m <= dz) { *x = *y = 0; return; }
+    float k = (m - dz) / (1 - dz) / m;   // each axis clamped on its own, so a full diagonal stays at full scale on both axes
+    *x = (int32_t)lrintf(fmaxf(-1, fminf(1, fx * k)) * 32767); *y = (int32_t)lrintf(fmaxf(-1, fminf(1, fy * k)) * 32767);
+}
@@ steam_decode
     s->rx = steam_axis(p + 14); s->ry = steam_axis(p + 16);
+    steam_deadzone(&s->lx, &s->ly); steam_deadzone(&s->rx, &s->ry);

t_pad_map (including its full-diagonal case), t_controllers_mac, t_hid (129 checks) and t_haptics_apple pass. The 10% default worked well; I didn't try other values.

How it was traced (TotK 1.4.3, main offsets):

  • main+0x100d030 copies the newest sample (count, gyro, direction rows) into a per-frame snapshot every frame.
  • main+0x874c1c updates the player's input object. Its motion object is at +0x430, and main+0x874e6c updates it from that snapshot.
  • The same function sets bit 0x10 of [input+0x418] when a button in mask 0xf60ff is down, or when the stick at [snapshot+8] is not exactly 0.0. I didn't trace this further than that, but it is probably what the aiming code checks.
  • Hardware read watchpoints showed nothing reading the motion object while aiming before the fix. Gyro worked as soon as the sticks rested at exactly 0.

Corrections to my comment above:

  • The validity check in the input layer flags a sample when its acceleration is all zero or its direction is exactly the identity. It isn't one combined pattern.
  • main+0x874e6c treats an exactly-identity direction as "no sensor" and resets its aim reference. The PR's orientation starts at identity, as it does after Recenter gyro. That may be worth knowing, though once the controller is moving it didn't cause problems here.
  • The six-axis handle encoding note stands, but it isn't related to this problem.

Still not tested: trackpads, rear buttons, the mapping window, Bluetooth and the Puck.

@v0lumehi

Copy link
Copy Markdown
Contributor

Heads-up: #388 proposes treating controls as data that every UI writes (#388 (comment)): the key and button maps (#386's DM_KEYMAP / DM_PAD_MAP) in one per-game store, so a controls page in any launcher and an in-app panel never disagree. Support for a new controller sits underneath that and is independent of it. Mentioning it so the thread has the full picture.

@thehobbit85
thehobbit85 force-pushed the codex/steam-controller branch 2 times, most recently from e2bdbaf to f115432 Compare October 29, 2026 20:18
@thehobbit85

Copy link
Copy Markdown
Contributor Author

The fixes for the USB-C findings and gyro-aiming follow-up are included in the cleaned three-commit series:

  • Both raw sticks have a 10% radial deadzone, configurable with DM_STEAM_DEADZONE, with rescaled travel and preserved outer diagonals. Trackpad coordinates are unchanged.
  • Six-axis handles use SDK style indices and device bytes, with matching validation on reads.
  • The complete test recipe, including t_symbols, is retained. Added tests receive the sanitizer flags.
  • Mapped Shake follows the controller's player without discarding native/Pro/phone orientation; direct Steam histories remain independent.

Implementation and regressions: motion/rumble foundations and controller input. The full host suite, ASan/UBSan and thread checks passed locally, as did the Mac host build. Both code commits also build and pass the host suite independently.

The remaining hardware limits are documented: gyro scale calibration is still unconfirmed, and this final revision needs physical trackpad/rear-button/transport retesting. Recenter keeps a truthful identity pose; we have not added a fabricated rotation to avoid TotK's identity check. No game was launched during this update.

@thehobbit85

Copy link
Copy Markdown
Contributor Author

The shared-controls coordination comment is now implemented in 075ce81.

The launcher and host use #386's input_map.h parser and launcher.DM_KEYMAP / launcher.DM_PAD_MAP keys in the same per-game app preference domain. The panel writes the shared standard button map; extra physical inputs, pad modes and gyro settings use model-specific dictionaries in that same domain and cannot override standard mappings. Shake is an additive target to preserve this PR's per-player bindings. The HID transport remains independent of the mapping UI.

Launch environment and env.txt overrides remain temporary and fixed in the panel. DM_SAVED_CHOICES=0 ignores saved choices and prevents writes; restoring defaults removes the relevant keys. Legacy controllers.plist mappings are imported explicitly, keeping the old file intact. Standalone hosts use the same lowercase default domain as packaged apps, and custom bundle IDs are preserved.

Synthetic integration tests cover launcher/host domain agreement, precedence, malformed choices, session-only edits, model isolation and panel actions. They passed, along with the packaging/docs tests and lint ratchet. The store contract and player guide describe the behavior.

This incorporates #386 at 97eaa989. The later proposed type: syntax remains subject to maintainer review and is not claimed as implemented here. The PR description also records a separate failure in unchanged graphics code: t_pso_bundle builds an archive for the installed macOS 27 SDK, which this macOS 26.6 runtime rejects.

@thehobbit85

Copy link
Copy Markdown
Contributor Author

Hi @seedds — I've refreshed the branches that had conflicts with current main. Could you help me prioritize review of these PRs?

Validation and remaining limitations are recorded in each PR. CI on the refreshed heads is being verified separately. Which of these best fits the project's current priorities, and are there scope changes or specific validation you would like before review? I'm happy to focus on a smaller subset first. Thanks for your time.

@thehobbit85
thehobbit85 force-pushed the codex/steam-controller branch 3 times, most recently from 6adc104 to 54d923a Compare November 8, 2026 08:00
@thehobbit85
thehobbit85 force-pushed the codex/steam-controller branch 2 times, most recently from 892b350 to 5bd183c Compare November 10, 2026 02:45
v0lumehi added a commit to LNPANDY/NX2Apple that referenced this pull request Nov 10, 2026
0115 and 0117 extend fork-only parts upstream declined (#492, #488). 0118, 0120 and 0121 build on the touch patches 0065 to 0070 and 0090, 0122 on seedds/nxnative#221. They are forwarded once those land.
@gxt43

gxt43 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

dm/host/input_preferences_mac.h in this PR does not compile for a multi-program game: [@"org.nxnative." DM_GAME_ID lowercaseString] joins two literals, but game.py header_multi defines DM_GAME_ID as (dm_game_cur()->id), read at run time (called object type 'NSString *' is not a function or function pointer in front_mac.m and controllers_mac.m, found on LUNAR Remastered Collection, 0100DCD01E9EE000). Joining at run time gives the same string for a one-program game:

return NSBundle.mainBundle.bundleIdentifier ?: [[@"org.nxnative." stringByAppendingString:@(DM_GAME_ID)] lowercaseString];

@thehobbit85
thehobbit85 force-pushed the codex/steam-controller branch from 5bd183c to 1766226 Compare November 13, 2026 06:01
@thehobbit85
thehobbit85 force-pushed the codex/steam-controller branch from 1766226 to 6a585be Compare November 14, 2026 17:56
Haseenesss added a commit to Haseenesss/NX2Apple that referenced this pull request Nov 14, 2026
)

Patch 0017 builds the Mac preferences domain by joining @"org.nxnative."
and DM_GAME_ID as string literals. A multi-program profile such as
Super Mario 3D All-Stars defines DM_GAME_ID at run time, so its Mac host
did not compile. The new patch boxes the ID at run time, as
seedds/nxnative#221's branch already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
LNPANDY pushed a commit to LNPANDY/NX2Apple that referenced this pull request Nov 14, 2026
…s_mac.h)

Patch 0017's input_preferences_mac.h joined "org.nxnative." with DM_GAME_ID at compile time,
which does not compile when DM_GAME_ID is read at run time, as in a game of several programs
(LUNAR Remastered Collection). The new patch 0054 joins them at run time; the string is the
same for a one-program game. Belongs in seedds/nxnative#221 with 0017.

The other two engine bugs of #1224 (cpk.py offsets, provisional program profiles) are upstream
as 8e7b9bf and 5b086b7 and came with the sync to 5a4e23a2e952.

Part of #1224.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JhC6PmqAEWZuUNEEEgBm91
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
Adapt seedds/nxnative PR seedds#221 by thehobbit85 ([email protected]) at source commit 5e2b1c7276e0745825f17d7875ec0e56b6913f7b to the NX2Apple pinned engine and existing input mapping carrier. Preserve fork window, screen, aspect and cursor behavior while integrating controller ownership, motion, haptics and shared preferences.

Retain the pin refresh's split Joy-Con input, per-half motion and haptic localities in the shared controller registry. Preserve the newer pointer, embedded-section and iOS game-framework behavior.

Advertise DMControllerMappings=1 in Mac app metadata so launchers can gate the shared mapping contract independently of DMSettings.

Front-ends: Gate shared DM_KEYMAP, DM_PAD_MAP and controller.<model> preferences on the DMControllerMappings capability marker. See docs/frontends.md for the exact storage contract.

Upstream-Status: forwarded seedds#221
Reason: Provide Steam Controller support and shared Mac controller mappings on the pinned engine while the upstream pull request is pending
Issue: seedds#221
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
Upstream-Status: pending [builds on controllers_mac from seedds#221]
Reason: Open an in-game Home menu on short Home press, pause in background, and guard hide timers across resume
Issue: LNPANDY/NX2Apple#1120
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
…d test

Upstream-Status: pending [builds on seedds#1322 and seedds#221]
Reason: Honor DM_PAD_PRESS_TO_JOIN on Bluetooth Joy-Cons and verify one Pro Controller registers one pad
Issue: LNPANDY/NX2Apple#1150
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
…program games

Symptom: the Mac host of LUNAR Remastered Collection (a launcher and two game programs, packed
as one app with the profile key programs) does not compile: front_mac.m and controllers_mac.m
stop in input_preferences_mac.h with "called object type 'NSString *' is not a function or
function pointer".

Cause: input_preferences_mac.h built the fallback preferences domain by joining two literals at
compile time, [@"org.nxnative." DM_GAME_ID lowercaseString]. That works when DM_GAME_ID is a
string literal, as in a one-program game's game_profile.h. For a game of several programs,
game.py header_multi defines it as (dm_game_cur()->id), a C string read at run time, and the
juxtaposition no longer parses.

Fix: join the strings at run time, [[@"org.nxnative." stringByAppendingString:@(DM_GAME_ID)]
lowercaseString], as front_mac.m already boxes DM_GAME_ID with @(...). The domain is the same
string for a one-program game.

Checked: with this change Lunar's Mac app builds and runs the launcher and both game programs
(M3 Max); the domain string of a one-program game is unchanged (the same characters, joined at
run time).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JhC6PmqAEWZuUNEEEgBm91

Upstream-Status: pending (a fix to patch 0017's input_preferences_mac.h, forwarded as seedds#221: it belongs in that pull request)
Reason: patch 0017's input_preferences_mac.h does not compile for a game of several programs (LUNAR Remastered Collection), where DM_GAME_ID is read at run time
Issue: LNPANDY/NX2Apple#1224
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
…mple

motion_apple.h now takes a controller as a motion source once its rotation rate
changes from its first report. test_native_motion_integration sent one report and
expected it published; it now sends a priming report first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Upstream-Status: fork-only (t_controllers_mac.m comes with patch 0017, forwarded seedds#221)
Reason: test_native_motion_integration in the fork's t_controllers_mac.m needs a priming report since patch 0100
Issue: LNPANDY/NX2Apple#971
@thehobbit85

Copy link
Copy Markdown
Contributor Author

Hi @seedds,

First of all, thank you so much for all the time you put into maintaining this project, and for the time you spend reviewing my many PRs. I know there have been a lot of them, and I really appreciate the patience and care you give each one.

If and when you have a moment, would you be willing to take a second look at this Steam Controller (2026) PR (#221), and see whether it could be merged? It has been rebased onto current main and is mergeable. If anything about it isn't the way you'd like it, whether the approach, its scope, or how it is split up, I'm very happy to change it, split it, or rework it however suits you best.

To be honest about why I'm asking: out of all my PRs, the LOLLIPOP CHAINSAW RePOP ones (#684 and #3075) and the Steam Controller one (#221) are the only ones I've personally been interested in. All the others are just me trying to be useful to the project.

No pressure at all, and thanks again for everything you do here.

Each player keeps its own six-axis history (dm_pad_motion), so a
controller's gyro reaches its own npad and is cleared on disconnect or
recenter. Rumble can go straight to a controller's own actuators
(haptics_apple) instead of only through GameController. Six-axis
handles use the SDK's style indices and device bytes.

Covered by t_hid and t_haptics_apple.
Read the Steam Controller (2026) over USB-C, its Puck and Bluetooth
straight from its HID reports (steam_input.h): buttons, both sticks
with a radial deadzone (DM_STEAM_DEADZONE), trackpads, rear buttons,
gyro and rumble, each controller as its own player.

The Mac controller code moves out of front_mac.m into
controllers_mac.m, which routes every controller model through one
registry. Key and button maps (input_map.h) are shared with the
launcher in the game's preference domain, so the mapping panel and
the host agree; model-specific extras sit beside them.

Covered by t_controllers_mac, t_input_map, t_pad_map, t_pad_motion and
test_nsp_mac_app.py.

Front-ends: Mac launchers share DM_KEYMAP and DM_PAD_MAP in the per-game preference domain; use the controller-specific choice contract in docs/frontends.md for extra inputs and model settings.
dm_switch2_front.attach now passes split: a Joy-Con that leaves its pair takes its player at once, or goes back into the pair. The Mac front end does this; the iOS one still had the one-argument callback, so DmGamepad.m no longer compiled. With DM_PAD_PRESS_TO_JOIN, iOS now waits for a button only for a new pad, not a split one, as on the Mac.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration and repository settings (.github) docs Documentation game: 0100F2C0115B6000 The Legend of Zelda: Tears of the Kingdom host The Horizon host: SVCs, services, threads, memory (dm/host) ios The iPhone and iPad app (dm/ios) mac The Mac front end and app (dm/mac, front_mac.m) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants