Repository navigation
Description
Context
Track the built-in version of the feature requested in discussion #615: optionally make each DualShock 3 player LED reflect its actual XInput user slot.
This is now feasible. The uncertainty that blocked #87 no longer applies in XInput mode because ControlApp can resolve the real Windows/XInput assignment instead of guessing from connection order.
Existing building blocks
ControlApp/Models/Util/XInputSlotResolver.csresolves a DsHidMini PnP device to XInput user index 0-3. It handles the XUSB/container path, the XInput HID child path used by Bluetooth, cache invalidation, and transient retries.DshmDevManalready watches both DsHidMini and XUSB interface arrival/removal and raises refresh events.- The driver publishes each device's IPC slot through
DsHidMiniDriver.IpcSlotIndexProperty/DsHidMiniInterop.TryGetIpcSlotIndex. DsHidMiniInterop.SetPlayerIndex(deviceIndex, playerIndex)and the driver command added by IPC feature to exchange data regardless of HID device mode #379 already apply the corresponding LED.- ControlApp can remain alive in the notification area through the existing Minimize to tray option.
One correction to the discussion's assumptions: the IPC command works with LED authority Automatic as well as Application; only Driver authority rejects it with STATUS_ACCESS_DENIED. Under Automatic, the IPC write hands LED output to the application path so the battery indicator does not immediately overwrite it.
Proposed implementation
Add a dedicated ControlApp background service (for example, XInputPlayerLedService) rather than coupling the behavior to the Devices-page labels.
- Add a per-user, global opt-in boolean to
ApplicationConfiguration, defaulting tofalse. - Register/start the service with the application host so it operates while ControlApp is open or hidden in the tray, independent of page navigation.
- Subscribe to:
- DsHidMini device-list changes;
- XUSB interface changes / slot cache invalidation;
- relevant effective configuration changes;
- the option being enabled at runtime.
- For each connected device:
- verify the live HID mode is XInput;
- resolve its actual XInput user index with
XInputSlotResolver; - read its one-based driver IPC device index;
- call
SetPlayerIndex(deviceIndex, xinputUserIndex + 1); - log failures without disrupting the rest of ControlApp.
- Deduplicate the last successfully applied
(device instance, XInput slot)and clear stale entries on disconnect/topology changes. Reuse the resolver's existing delayed retry behavior for transient enumeration races; continuous 500 ms input polling should not be necessary. - Add the checkbox and explanatory text to ControlApp's global Settings page. State that:
- it only affects XInput HID mode;
- driver IPC must be enabled;
- LED authority must be
AutomaticorApplication; - ControlApp must remain running (the tray option is sufficient).
There is an existing HidModeSettings.IsLEDsAsXInputSlotEnabled property/view-model member, but it is currently hidden, is not translated to driver configuration, and has no runtime consumer. Since the requested behavior is global and belongs to a running user-mode process, use ApplicationConfiguration as the source of truth and remove/migrate that dormant per-profile member to avoid two conflicting settings.
Acceptance criteria
- The option is off by default and persists per Windows user.
- Enabling it immediately updates all connected, resolvable XInput-mode DsHidMini controllers.
- Player LEDs are reapplied after USB/Bluetooth reconnect and XInput slot reassignment/topology changes.
- Four simultaneously connected genuine DS3 controllers can display player LEDs 1-4 according to their actual XInput slots.
- Non-XInput devices and unresolved slots are left unchanged.
-
DriverLED authority, unavailable IPC, missing IPC slot properties, and non-success NTSTATUS results are handled and logged without crashes or retry loops. - Disabling the option stops future synchronization; it does not need to invent a restoration state beyond allowing the configured driver/application LED behavior to resume on the next normal update/reconnect.
- Unit tests cover eligibility, index conversion, deduplication, topology refresh, and failure handling through testable resolver/IPC seams.
- The Settings UI explains the ControlApp-lifetime and LED-authority requirements.
Activity