protonscr

Controller for Telltale games

protonclosed
ValveSoftware/Proton#847 · opened 2018-08-28 by ejeandel · updated 2019-05-16 · 4 comments · github
Eejeandel 2018-08-28 github

I have investigated the problem that makes the xbox controller not work in the various Telltale games (the Walking Dead games, the Wolf Among Us, etc), and I found the reason.

The game actually tries to see if the controller name begins with one of the three following strings:
XBOX 360 For Windows, XUSB Gamepad, Logitech
and tests if the controller is a gamepad, i.e. has a DevType of 66069

The problem is that the DevType given by the function fill_joystick_dideviceinstanceW in joystick_linuxinput.c is 66068, not 66069, as all controllers are seen as joysticks :
DI8DEVTYPE_JOYSTICK | DIDEVTYPE_HID | (DI8DEVTYPEJOYSTICK_STANDARD << 8)
rather than gamepads
DI8DEVTYPE_GAMEPAD | DIDEVTYPE_HID | (DI8DEVTYPEGAMEPAD_STANDARD << 8)

I've patched the file to change the devtype, and the controller work without any problem. My patch is below, It's not clear whether such a patch should be applied, though. I don't know if changing all controllers to gamepads is the right idea.

A few notes:

  • Changing the controller name to "Logitech" also makes the controller work. This can be done using
    xboxdrv --device-name. Some buttons seems to be mapped wrongly, though

(I previously thought that changing the device name to "Logitech", "XBOX 360 For Windows", or "XUSB Gamepad" was also necessary for the controller to work, but actually just changing the devtype is enough)

  • I've changed the code in joystick_linuxinput.c instead of joystick_linux.c because I don't really understand the difference between event and js, but the good solution should probably change both codes (+ joystick_sdl) I guess ?
--- joystick_linuxinput2.c      2018-08-28 17:30:10.183217009 +0000
+++ joystick_linuxinput.c       2018-08-31 13:46:39.832480727 +0000
@@ -355,7 +355,7 @@
     lpddi->guidFFDriver = GUID_NULL;
 
     if (version >= 0x0800)
-        lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
+        lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEGAMEPAD_STANDARD << 8);
     else
         lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);

Jjw2013 2019-01-05 github

I can confirm the part about Telltale and the controller name. Looking into e.g. WalkingDead101.exe, it seems like

a.) their games are not using XINPUT at all, but DINPUT8 only, and
b.) They compare the product ID of the Gamepad, and look for e.g. "XBOX 360 For Windows"

So using an XINPUT workaround like x360ce won't have any effect, as XINPUT doesn't get used at all. But I found a special DINPUT8.DLL that pretends all controllers are XBOX 360s:

https://sites.google.com/site/tocaedit/files / dinput8-x360cev21.zip

I've put the spoofer/dinput8.dll into the same directory as WalkingDead101.exe, and used

WINEPREFIX=~/.local/share/Steam/steamapps/compatdata/207610/pfx winecfg

to set the Library dinput8 to "Native,Buildin"

Started the game, and ... it asks me to "Press Start" instead of clicking a key. Controller works!

Right now, I can play as follows:

8bitdo SN30 Pro -> Bluetooth -> RPi with OSMC & SteamLink -> Steam on Ubuntu 18.04 running TWD

Also tested on TWD Season 2 and Sam & Max, all working. The remaining problem is, that starting with TWD Season 3, newer Telltale games like Guardians of the Galaxy run in 64 bit, but the spoofing library above is 32 bit only.

One alternative would be, to implement the spoofing/renaming logic into Wine/Proton directly; one could implement a registry joystick renaming hook in dlls/dinput/joystick_linuxinput.c or some more generic place. Ideally, one could overwrite the ProductName, InstanceName and DeviceType via Registry entries, per original controller name or for 'ANY'.

Jjw2013 2019-01-05 github

I haven't coded anything for wine yet, but looking into the source code, it should be possible to implement a registry based property remapping in a generic way, into the function JoystickWGenericImpl_GetProperty in file dlls/dinput/joystick.c

Jjw2013 2019-05-16 github

Nice work @aeikum , thank you very much !
I've quickly tested Telltales TWD New Frontier, and Guardians of the Galaxy. 8bitdo SN30 Pro works in both of them now, using Steam + Proton 4.2-4. Before, it was not recognized at all by their games.

Aaeikum 2019-05-16 github

Great! Thanks to both of you for reporting and diagnosing the problem.

Proton versions

Launch options

DLLs