New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Add hotplug support to DInput and XInput controller backends #7776

Open
wants to merge 2 commits into
base: master
from

Conversation

3 participants
@jordan-woyak
Copy link
Member

jordan-woyak commented Feb 2, 2019

Don't merge. I've noticed a minor issue that needs to be fixed.

This is just a rebase of ligfx's PR #6183.
I've tested it and it works and the code looks fine.

This will fix these issues:
https://bugs.dolphin-emu.org/issues/6047
https://bugs.dolphin-emu.org/issues/6997
https://bugs.dolphin-emu.org/issues/9669
https://bugs.dolphin-emu.org/issues/11323

Getting this merged should complete hotplug support for every input backend.
We could then even potentially remove the "Refresh" button from the UI.

Creates a third backend, Win32, which encompasses the existing XInput and DInput backends, and ask them to repopulate devices when it sees a change event.

Unfortunately, there's not really a great way to map change events to XInput and DInput devices. So, when a change event happens, all XInput and DInput controllers are removed and re-added. Stupid, but works. It's how SDL does it too.

(There's supposedly a way to map events to DInput devices, but the Internet claims it's sketchy. There is a straightforward way to do it for RawInput, if that's ever used in the future.)

-ligfx

@jordan-woyak jordan-woyak changed the title Wm devicechange Add hotplug support to DInput and XInput controller backends Feb 2, 2019

@ligfx

This comment has been minimized.

Copy link
Contributor

ligfx commented Feb 3, 2019

@jordan-woyak cool, it'd be great to get this moving again. Let me know if you have any questions about the code.

@iwubcode

This comment has been minimized.

Copy link
Contributor

iwubcode commented Feb 4, 2019

Tested and confirmed working on my Xbox360 wired controller (windows 10)

@jordan-woyak jordan-woyak changed the title Add hotplug support to DInput and XInput controller backends WIP - Add hotplug support to DInput and XInput controller backends Feb 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment