# Compatibility

> Which browsers, operating systems, and controllers @gamepadly/sdk supports, and what has been verified on real hardware.

Source: https://gamepadly.com/sdk/compatibility

`@gamepadly/sdk` uses progressive capability tiers (**L0 → L1 → L2**) so your game works everywhere out of the box and upgrades automatically when richer hardware and browser APIs are available.

- **Verified**: Tested on physical hardware in the listed environment.
- **Implemented (Untested)**: Protocol/API path is implemented per spec, not yet verified on that exact OS/transport combination.
- **Unsupported**: Not supported by browser APIs, OS audio stack, or hardware transport.

> **Current verification scope: Windows 10/11 + desktop Chrome / Edge only.** Everything outside that is implemented to spec but has not been confirmed on physical hardware yet. If you run the [live examples](https://gamepadly.com/sdk/examples) on another OS, browser, or controller, please [open an issue](https://github.com/gamepadly/gamepadly-sdk/issues) with what worked and what did not; confirmed results are promoted to **Verified**.

## 1. Browser & OS Tier Overview

| Tier | Capabilities | Chrome / Edge (Desktop) | Firefox (Desktop) | Safari (Desktop) | Mobile Browsers | Install Required |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| **L0 — Standard + Xbox Impulse** | Raw 0% deadzone sticks, buttons, P1–P4, dual-motor rumble, Xbox Series `trigger-rumble` | **Verified** (Windows) · **Implemented (Untested)** (macOS / Linux) | **Implemented (Untested)** (no `trigger-rumble`; see [non-standard mappings](#5-non-standard-gamepad-api-mappings)) | **Implemented (Untested)** (no `trigger-rumble`; see [non-standard mappings](#5-non-standard-gamepad-api-mappings)) | **Implemented (Untested)** (standard input) | None |
| **L1 — WebHID** | PS5 Adaptive Triggers, 6-axis Gyro/Accel, Touchpad, Lightbar; Switch Pro dual-band LRA HD Rumble, 6-axis Gyro/Accel | **Verified** (Windows) · **Implemented (Untested)** (macOS / Linux) — requires one-click user picker | **Unsupported** (no WebHID) | **Unsupported** (no WebHID) | **Unsupported** | None |
| **L2 — DualSense 4ch Audio (`setSinkId`)** | Ch0/Ch1 controller speaker + Ch2/Ch3 L/R voice coils (48 kHz) | **Verified** (Windows + USB-C; requires Windows Quadraphonic + mic label permission) | **Unsupported** (no `setSinkId`) | **Unsupported** (no `setSinkId`) | **Unsupported** | None |
| **L2 — DualSense 4ch Audio (`Gamepadly Link`)** | Low-latency event-driven Windows WASAPI 4ch + system-volume speaker sync | **Verified** (Windows 10/11 + USB-C) | **Implemented (Untested)** (Windows 10/11 + USB-C; speaker amp unlock still requires WebHID) | **Unsupported** (macOS) | **Unsupported** | Optional MIT tray companion (`v0.4.0+`) or custom fork |

> **Zero Link dependency**: L0 and L1 run 100% in the browser on your own HTTPS origin without installing or connecting to `Gamepadly Link`.

## 2. Controller Feature Matrix

All **Verified** cells below were tested in desktop Chrome / Edge on Windows.

| Controller | Connection | Input & 0% Drift (L0) | Dual Rumble (L0) | Adaptive / Impulse Triggers | HD Rumble / 4ch VCM | 6-Axis Gyro & Touchpad | Automatic Fallback |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| **PS5 DualSense / Edge** | USB-C (Windows) | **Verified** | **Verified** | **Verified** (L1 WebHID 10-zone Adaptive Triggers) | **Verified** (L2 4ch VCM + Speaker via Link or `setSinkId`) | **Verified** (L1 Gyro + Dual-finger Touchpad) | Without L2 → falls back to L0/L1 dual-motor rumble (`dual_rumble`) |
| **PS5 DualSense / Edge** | USB-C (macOS / Linux) | **Implemented (Untested)** | **Implemented (Untested)** | **Implemented (Untested)** (L1 WebHID) | **Unsupported** (4ch USB audio not verified outside Windows) | **Implemented (Untested)** (L1 WebHID) | Falls back to dual-motor rumble (`dual_rumble`) |
| **PS5 DualSense / Edge** | Bluetooth (Windows) | **Verified** | **Verified** | **Verified** (L1 WebHID BT report `0x31` CRC32) | **Unsupported** (DualSense BT exposes no 4ch audio device) | **Verified** (L1 Gyro + Touchpad) | Falls back to dual-motor rumble (`dual_rumble`) |
| **PS5 DualSense / Edge** | Bluetooth (macOS / Linux) | **Implemented (Untested)** | **Implemented (Untested)** | **Implemented (Untested)** (L1 WebHID) | **Unsupported** | **Implemented (Untested)** | Falls back to dual-motor rumble (`dual_rumble`) |
| **Xbox Series X\|S / Xbox One** | USB / Bluetooth (Windows) | **Verified** | **Verified** | **Verified** (L0 `trigger-rumble` in Chrome/Edge 126+) | **Unsupported** (uses Impulse Triggers instead) | **Unsupported** (no gyro/touchpad hardware) | `playPreset()` routes to `impulse_triggers` (or `dual_rumble` if browser lacks `trigger-rumble`) |
| **Xbox Series X\|S / Xbox One** | USB / Bluetooth (macOS / Linux) | **Implemented (Untested)** | **Implemented (Untested)** | **Implemented (Untested)** | **Unsupported** | **Unsupported** | Same as above |
| **Nintendo Switch Pro** | USB / Bluetooth (Windows) | **Verified** | **Verified** | **Unsupported** (digital ZL/ZR triggers) | **Verified** (L1 WebHID dual-band LRA HD Rumble, clamped `<= 0.85`) | **Verified** (L1 6-axis Gyro + read-only SPI calibration) | Without WebHID → falls back to Gamepad API input (`dual_rumble` / `none`) |
| **Nintendo Switch Pro** | USB / Bluetooth (macOS / Linux) | **Implemented (Untested)** | **Implemented (Untested)** | **Unsupported** | **Implemented (Untested)** | **Implemented (Untested)** | Same as above |
| **Standard / Third-Party Gamepads** (8BitDo, GameSir, Hall/TMR, etc.) | USB / Bluetooth | **Implemented (Untested)** (standard mapping); non-standard pads need [`gamepadMappings`](#5-non-standard-gamepad-api-mappings) | **Implemented (Untested)** (when browser exposes `vibrationActuator`) | **Unsupported** | **Unsupported** | **Unsupported** | `playPreset()` routes to `dual_rumble` (or `none` if no actuator) |

## 3. Permissions & Failure Modes

| Path | Browser / OS Requirement | Failure Code / Behavior | Recommended UI Guidance |
| :--- | :--- | :--- | :--- |
| **L1 WebHID (`hub.connectWebHID()`)** | Top-level secure context (`https://` or `localhost`); **blocked in cross-origin `<iframe>`s** (e.g. embedded CodePen/CodeSandbox previews) unless the iframe has `allow="hid"`. Must run inside a user click. | Resolves `false` if the user closes the picker. Throws if the browser lacks `navigator.hid`, or with a `SecurityError` in a cross-origin iframe without `allow="hid"`. See [Troubleshooting](https://gamepadly.com/sdk/troubleshooting#webhid-dualsense-triggers-and-switch-pro-hd-rumble). | Keep L0 working automatically; show a clear one-click "Enable PS5 / Switch Pro Features" button. |
| **L2 Browser Direct (`connectDualSenseViaBrowser`)** | Chrome/Edge `AudioContext.setSinkId()`, DualSense over USB-C, Windows speaker layout set to **Quadraphonic**, and one-time microphone permission to read output labels (audio track released immediately; zero recording). | Returns `no_set_sink_id` or `dualsense_audio_not_found`; if Windows is set to Stereo (2ch), `bind.isQuadraphonicReady` is `false`. | Explain why label permission is requested before calling; prompt user to configure Quadraphonic in `mmsys.cpl` if `maxChannelCount < 4`. |
| **L2 Companion (`connectDualSenseViaCompanion`)** | Windows 10/11 + USB-C DualSense + `Gamepadly Link v0.4.0+` (`protocol/v1.1`). Must run inside a user click (Chrome Local Network Access `targetAddressSpace: 'loopback'`). | Typed errors: `link_not_running` (also returned if running older Link `<= v0.3.3` on a third-party origin because CORS blocks pre-v1.1 `403` responses), `link_outdated`, `user_denied` (with `retryAfterSec`), `consent_timeout`, `consent_busy`, `origin_not_allowed`, `dualsense_audio_not_found`. | Tell users to approve the tray prompt (or start/update Link `v0.4.0+`); fall back to L0/L1 haptics seamlessly so gameplay is never blocked. |

## 4. Haptic Routing Fallback Chain

Every call to `p1.haptics.pulse()`, `p1.haptics.sweep()`, `p1.haptics.playPreset()`, or `bridge.triggerHaptic()` returns the actual `HapticRouteTier` selected:

1. `'4ch_vcm'` — DualSense 4-channel VCM audio (when L2 is bound and `maxChannelCount >= 4`)
2. `'hd_rumble'` — Nintendo Switch Pro WebHID dual-band LRA HD Rumble
3. `'impulse_triggers'` — Xbox Series L/R Impulse Triggers (`trigger-rumble`)
4. `'dual_rumble'` — Standard Gamepad API dual-motor rumble
5. `'none'` — No connected actuator (e.g. keyboard/mouse mode)

## 5. Non-Standard Gamepad API Mappings

Browsers only guarantee button and axis positions when a controller reports `gamepad.mapping === 'standard'`. Firefox, Safari, and some third-party pads often report an empty mapping (`''`), so the raw indices differ per browser and device.

- Every input snapshot carries `state.mapping`: `'standard'`, `'nonstandard'`, `'custom'` (a rule you supplied matched), `'hid'` (decoded from WebHID, always correct), or `'none'`.
- When `mapping === 'nonstandard'`, the SDK still reads the standard indices and `getCapabilities()` explains the risk in `standard_input.reason`. Show a hint, offer WebHID for DualSense / Switch Pro, or supply your own layout:

```ts
import { createGamepadly } from '@gamepadly/sdk';

const hub = createGamepadly({
  gamepadMappings: [
    {
      match: (pad) => pad.mapping === '' && pad.id.includes('Vendor: 054c'),
      buttons: { cross: 1, circle: 2, square: 0, triangle: 3 },
      axes: { rx: 2, ry: 5 },
      triggers: { l2: { axis: 3 }, r2: { axis: 4 } }, // -1 = released, 1 = fully pressed
    },
  ],
});
```

The layout above is an illustration, not a verified table. The SDK does not ship per-browser layouts yet; confirmed layouts contributed through issues will be added as built-in rules.
