docs: Update CONTROLLERS for Wine 7.0

This commit is contained in:
Andrew Eikum 2022-02-04 18:40:16 +02:00 committed by Arkadiusz Hiler
parent 053954076c
commit f3b9480b5f

View File

@ -15,53 +15,68 @@ the game's behalf. This turns the raw HID protocol data into usable things like
buttons and joysticks. buttons and joysticks.
dinput is a "legacy" API that allows applictions to talk to any type of dinput is a "legacy" API that allows applictions to talk to any type of
joystick. On Windows, it is likely implemented on top of HID. Notably, dinput joystick. On Windows, it is implemented on top of HID. Notably, dinput allows
allows easy access to controllers that no other API does, so it is still used easy access to controllers that no other API does, so it is still used by
by modern games despite being "legacy." modern games despite being "legacy."
xinput is the new API that supports only Xbox controllers. On Windows, it is xinput is the new API that supports only Xbox controllers. On Windows, it is
likely implemented on top of rawinput, as Xbox controllers do not behave like likely implemented on top of rawinput, as Xbox controllers do not behave like
standard HID devices. standard HID devices.
winmm is the very legacy API, for when joysticks were hooked up through the winmm is the very legacy API, for when joysticks were hooked up through the
soundcard. On modern Windows, it is likely implemented on top of hid. soundcard. On modern Windows, it is implemented on top of dinput.
Here is a diagram for how these APIs are mapped down to the system by Proton: Here is a diagram for how these APIs are mapped down to the system by Proton:
-------- ----------
|game.exe| | game.exe |
-------- ----------
/ | | | | application / | | | \
********|**|*|*|**|*********************** / | | | \ application
------ / | | | | wine *********/****|*|**|****\******************
|xinput| | | | | | | | \ \ wine
------ / | | | | | | | \
| / | | | ------ | | ----- \
--- / / | \ |xinput| | | |winmm| |
|hid|--- / | \ ------ | | ----- |
--- / | \ | | \ | |
| / | \ | | | | |
-------- ------ ----- \ | ------ |
|rawinput| |dinput| |winmm| \ | |dinput| |
-------- ------ ----- \ | ------ /
| | | | | / /
----------- | ---------------- | | | /
|winebus.sys| | |winejoystick.drv| --- /
----------- | ---------------- |hid| /
| \ / | wine --- /
***|*********|***********|**************** | /
\ | | linux | |
\ ---- | --------
\ |SDL2| | |rawinput|
\ ---- | --------
\ | \ | |
\ | ---- | -----------
\ | \ | |winebus.sys|
------ ----------- -----------
|hidraw| |input event| | | wine
------ ----------- ************|******|***********************
| | linux
| ----
| |SDL2|
| ----
| | \
| | \
| | |
------ -----------
|hidraw| |input event|
------ -----------
| |
\ /
========
|hardware|
========
Some things to note: Some things to note:
@ -74,7 +89,7 @@ other) protocol can talk directly to those devices.
Xbox controllers do not speak real HID. Instead Windows provides a HID Xbox controllers do not speak real HID. Instead Windows provides a HID
compatibility layer so dinput, which is implemented on top of HID, will present compatibility layer so dinput, which is implemented on top of HID, will present
the Xbox controller to legacy games. Of course some games (Unity) have noticed the Xbox controller to legacy games. Of course some games (Unity) have noticed
that, and talk directly to this internal HID interface, so we had to duplicate that, and talk directly to this internal HID interface, so we need to duplicate
it bit-for-bit in winebus.sys. it bit-for-bit in winebus.sys.
Some games support talking directly to certain controller types. For example, Some games support talking directly to certain controller types. For example,
@ -98,16 +113,3 @@ device for your controller, especially if it is a less well-known controller.
In those cases, we access it through SDL2 via its linux js backend and try to In those cases, we access it through SDL2 via its linux js backend and try to
treat it as an Xbox controller, even if it is not mapped with the Steam client treat it as an Xbox controller, even if it is not mapped with the Steam client
mapping feature. mapping feature.
Future improvements:
winmm's joystick APIs should be implemented on top of HID so it can use the
Steam controller mapping feature via winebus/SDL2.
xinput should be implemented on top of rawinput, as the Xbox HID compatibility
layer does not provide all of the features xinput requires. We currently use a
hack to work around this.
dinput should be implemented on top of HID, so we can avoid the code
duplication we have now with both winebus and dinput using SDL2 directly.