https://bugs.winehq.org/show_bug.cgi?id=45992
Bug ID: 45992 Summary: Some Unity games expect XInputSetState to succeed or ignore gamepad input Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: xinput Assignee: wine-bugs@winehq.org Reporter: beren.minor+wine@gmail.com Distribution: ---
Created attachment 62554 --> https://bugs.winehq.org/attachment.cgi?id=62554 Force HID_set_state to succeed
As described in the title, it looks like that some games (Unity based AFAIK) are calling XInputSetState on detected gamepads, and expect it to return ERROR_SUCCESS.
For example, "Mages of Mystralia" - Unity engine based - was not detecting my XBox360 gamepad correctly, with wine 3.18, although many calls to XInputGetState were logged, and although it looked to be correctly detected according to HID messages. I believe this also happens for other Unity games.
For some reason, the gamepad force feedback support is not detected (not sure if it should under wine), and the feature flag isn't present on the corresponding device, so XInputSetState > HID_set_state returns ERROR_UNSUPPORTED.
Changing ERROR_UNSUPPORTED to ERROR_SUCCESS - see attached patch file - fixes the gamepad detection issue, and the game accepts gamepad input afterwards. Of course, this isn't the proper way to fix the issue, but it's a workaround for the games.
https://bugs.winehq.org/show_bug.cgi?id=45992
beren.minor+wine@gmail.com beren.minor+wine@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |beren.minor+wine@gmail.com, | |leslie_alistair@hotmail.com | |, z.figura12@gmail.com
--- Comment #1 from beren.minor+wine@gmail.com beren.minor+wine@gmail.com --- Add wine-staging maintainers to CCs, as I believe the patch could be useful as a quick workaround.
https://bugs.winehq.org/show_bug.cgi?id=45992
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |3.18
--- Comment #2 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- Can add a trace for "device->caps.Flags" value in HID_set_state then attach a +xinput log?
https://bugs.winehq.org/show_bug.cgi?id=45992
--- Comment #3 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- Could you make that a +hid,+xinput log?
https://bugs.winehq.org/show_bug.cgi?id=45992
--- Comment #4 from beren.minor+wine@gmail.com beren.minor+wine@gmail.com --- Created attachment 62565 --> https://bugs.winehq.org/attachment.cgi?id=62565 WINEDEBUG=hid,xinput log for Mages of Mystralia
Added the trace and here is the log. As you can see at the beginning, hid does not detect any output feature on the gamepad.
I quickly had a look at this part and I believe there should be "type 0, tag 9" lines if it were the case. I didn't figure out why, and from where comes the descriptor, so I went for an easier fix.
Also, I could confirm that this also is an issue on other Unity games, such as Milanoir for example. On this other game, the gamepad briefly works on the opening sequence, but then isn't taken into account anyore once XInputSetState has been called and returns ERROR_UNSUPPORTED.
I don't know if it's specific to XBox360 gamepad though, or if this is the case for any other gamepad, for example ones without force feedback.
https://bugs.winehq.org/show_bug.cgi?id=45992
--- Comment #5 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- Thanks.
When researching the issue, I came across this. It might be that the kernel isn't reporting the controller has rumble support, so XINPUT_CAPS_FFB_SUPPORTED isn't set correctly.
Xbox One S Controller Rumbling On Linux, Valve Working On Upstreaming SteamOS Changes https://www.phoronix.com/scan.php?page=news_item&px=Xbox-One-S-Rumble-Li...
https://bugs.winehq.org/show_bug.cgi?id=45992
--- Comment #6 from beren.minor+wine@gmail.com beren.minor+wine@gmail.com --- Alright, this might be an issue with the Linux driver then. I'll have a look in this direction.
I tried fftest already to be sure and it was working just fine, but maybe it doesn't care about the reported capabilities.
https://bugs.winehq.org/show_bug.cgi?id=45992
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |STAGED Staged patchset| |https://github.com/wine-sta | |ging/wine-staging/tree/mast | |er/patches/xinput1_3-XInput | |SetState
https://bugs.winehq.org/show_bug.cgi?id=45992
--- Comment #7 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- Created attachment 62769 --> https://bugs.winehq.org/attachment.cgi?id=62769 Sample Rumble example
Code can be found at https://code.msdn.microsoft.com/XInput-Win32-Samples-cc25ce24
I've changed the code to display the return value from XInputSetState.
I need sometime with an XInput compatible joystick/Gamepad to run the attached program and report the error cod returned.
https://bugs.winehq.org/show_bug.cgi?id=45992
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|STAGED |RESOLVED Fixed by SHA1| |186d107e4d586860008e2ac5fb1 | |e2ebdbce06145 Resolution|--- |FIXED
--- Comment #8 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- Fixed by https://source.winehq.org/git/wine.git/?a=commit;h=186d107e4d586860008e2ac5f...
https://bugs.winehq.org/show_bug.cgi?id=45992
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.21.