HowTo: Getting Steam, WINE, Game Controllers Working Together
HowTo: Getting Steam, WINE, Game Controllers Working Together
Part 1: Native Games Most Linux-native game use SDL2, which has hardcoded support for most gamepads. With a kernel gamepad driver (as in, without userspace drivers such as xboxdrv or ds4drv), most gamepads should work out of the box. If yours does not, you can add its mapping to SDL2 by setting the SDL_GAMECONTROLLERCONFIG environment variable. To generate the value that makes your gamepad work, you can use the following program: Refer to the following for background:Part 2: Steam Games in WINE Overview There are currently two protocols that games in Windows can use for gamepad support. If the game expects an Xbox 360 pad, it's using XInput. If it expects you to bind gamepad controls to game actions before playing, it's using DirectInput. In the following video, you can hear Icculus explaining the difference between the two:Controller support is an issue in WINE because as of this writing (WINE 2.21), WINE does not support XInput. Rather, it sees all connected controllers as DirectInput controllers. Hence, we'll use a program called x360ce, which is normally used on Windows to get DirectInput controllers working with XInput games. There are many guides, both written and video, to using x360ce, and most of the ones aimed at Windows gamers apply to WINE gamers. One particularly good one for WINE users is here:I'm aware that many of these previous guides recommend using xboxdrv. That is now outdated information. Do not use xboxdrv unless you're actually having issues without it. I've found that it certainly isn't needed for either an Xbox One S controller or a Wii U Pro Controller. Another issue is that WINE accepts input from both of the interfaces that Linux creates per gamepad: the evdev interface (/dev/input/event) and the joydev interface (/dev/input/js). We'll deal with that by disabling the joydev interface. For the following steps, you need a 64-bit multilib system and a WOW64-enabled WINE build. In other words, the same wine binary needs to be able to run both 64-bit and 32-bit Windows applications. Setting Up XInput Emulation With the gamepad plugged in, and when ~/.local/share/wineprefixes/x36ce does not exist: Code:
export WINEPREFIX=~/.local/share/wineprefixes/x360ce In x360ce, you set your gamepad's button mappings. For the sticks, the axes increase when going up and right. When you're ready, save. The output should be the following file:
Save the x360ce.ini file. Testing XInput Emulation Download XInputTest and unzip it: Code:
cd ~/.wine/drive_c Go into "wine control" and disable the "(js)" gamepad. Now you're ready to test your gamepad: Code:
cd x360ce\ vibmod\ 3.1.4.1 In your terminal, you should see confirmation that your XInput DLL override is being loaded: Code:
trace:loaddll:load_native_dll Loaded L”C:\\x360ce vibmod 3.1.4.1\\xinput1_3.dll” at 0x2cd0000: native Create a new 64-Bit WINE bottle for Steam. Code:
export WINEPREFIX=~/.local/share/wineprefixes/steam Then install Steam: Code:
winetricks -q steam
Code:
[Desktop Entry] Code:
Exec=env WINEDEBUG="-all" WINEPREFIX="/home/dugan/.local/share/wineprefixes/steam" /usr/bin/wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/dugan/.local/share/wineprefixes/steam/dosdevices/c:/users/Public/Desktop/Steam.lnk You probably also want change the name to something like: Code:
Name=Steam (32-Bit WINE) Code:
Comment=Steam for Windows Code:
> xdg-mime query default application/pdf From this point on you will launch Steam from the shortcut, use Steam to install your games, and, when you're ready to play, use Steam to launch them. Use the terminal to test and set up overrides on a game-by-game basis. Set WINEPREFIX in the environment, fire up winecfg, and browse for the game's .exe. Then set whatever overrides are needed for that game. If a game needs x360ce overrides, you'll start by copying x360ce's xinput1_3.dll to the same directory as the game's .exe, along with your x360ce.ini. Some games might need that DLL renamed (e.g. to xinput1_4.dll); use WINEDEBUG=loaddll to find out. Example: Wolfenstein: The New Order Wolfenstein: The New Order is a 64-Bit game. So you download the 64-bit xinput DLL for x360ce:Then you rename it to xinput1_3.dll, and put both it, and your x360ce.ini file, in the same directory as the game's executable. Then you set WINEPREFIX to Steam, fire up winecfg, and set an override so that it prefers the native xinput1_3.dll when it's running the game's executable. Example: Deathsmiles Deathsmiles recognizes both XInput and DirectInput. If you allow it to receive both XInput and DirectInput game controller input, (and/or if you have both the js and event joystick interfaces active), then the game will think it's receiving input from two game controllers, and you'll mysteriously find yourself controlling two characters with one controller. (I've seen Steam forum posts indicating that this can also happen when you run the game on Windows). The solution is to use the DirectInput Blocker from here: Set DeathSmiles up with x360ce as usual (put x360ce.ini and the 32-bit xinput1_3.dll in the game's directory, set the DLL override). Then add the DirectInput Blocker (dinput8.dll) to the game's directory, and add a native override for that too. (This also applies to DoDonPachi Resurrection, except that DoDonPachi Resurrection messes up less dramatically if you miss a step). Part 3: Steam Controller Setting up a Steam Controller is similar to setting up any other gamepad. Start by replacing the xinput DLL from x360ce with one from dumbxinputemu. This is like x360ce, except that it doesn't need to be configured. Instead, it has hardcoded mappings that are correct for the Steam Controller's Xbox 360 emulation. Then, you have three options for how to set up your Steam Controller mappings. You can can use sc-controller. The next two options use Steam for Linux to set the mappings. The first option is to use Steam for Linux's Big Picture Mode to set up your Steam Controller for the game, and then to make sure that Steam is running at the same time that the game is. In most cases, that means you'll have both Steam for Linux and Steam for Windows running at the same time. You can set up Steam for Linux's desktop configuration to be correct for the game, as demonstrated in the following video:The second option write a shell script to run the game, add it to Steam for Linux as a non-Steam game, and set up your Steam Controller for that game. |
Just one follow up:
If you're adding WINE game to Linux Steam as a non-Steam game, name it the Steam app id. For example, Wolfenstein: The New Order is 201810, so name the shortcut 201810. Then you have access to the community Steam Controller configurations for that game! Then you download and set a Steam Grid banner for the shortcut, so you can tell which game it is. |
I've noticed that as of WINE 3.3, almost none of the above is needed. All you really need to do is set your SDL_GAMECONTROLLERCONFIG string correctly (as you would for SDL2 games). I set it for my DualShock 4, and both XInputTest and Ducktales: Remastered started working correctly with my DualShock 4, with no further configuration needed.
|
Thank you for the explanations.
I'm really confused though. I installed Steam through playonlinux (4.2.11) which worked fine. Than I installed Cuphead through Steam which also worked and the game runs perfectly. I'm using Wine 3.8 on KDE Neon (Ubuntu LTS). My controller is a 8Bitdo SFC 30, connected via Bluetooth. In the Wine control panel > Game controllers > Test joystick I can verify that it's working. BUT to get it working in Steam, I have to configure the controller in Steam and thats where I'm stuck. When I go to Steam > Settings > Controller > General Controller Settings Wine says "DWrite.dll missing fatal error" and Steam crashes. It's the same when I try to launch Big Picture mode. I'm relatively new to Linux and the whole Wine, playonlinux, winetricks etc. is quite complex to be honest. I feel really close though. Thanks in advance |
Are you talking about that Steam Controller/Big Picture thing?
You launch Linux Steam in Big Picture Mode and set up your controller via Linux Steam. Then you launch either your Windows game or Windows Steam. That means that Linux Steam will handle your controller setup for your Windows game. You'll either have Linux Steam running in Big Picture Mode in the background, or you'll have Linux Steam's overlay over your Windows game. Disable the overlay in Windows Steam and don't launch it in Big Picture Mode. In many cases, yes, this does mean you'll have both Linux Steam and Windows Steam running at the same time. |
@dugan THANK YOU SO MUCH IT WORKED!! I don't know where I and others would be without Linux wizards like you.
To sum all steps I have done for others and myself: If you want to
So far the installation and configuarion part. To start Cuphead with gamepad support do the following:
|
I just did Steam Controller test on slackware-current (SDL 2.0.8, kernel 4.14.55, wine staging 3.11). I left SDL_GAMECONTROLLERCONFIG unset, installed Ducktales: Remastered (which uses XInput on Windows) in Windows Steam, added it to Linux Steam as a non-Steam game, set its Steam Controller configuration to the "Gamepad" template in Big Picture mode, and launched it. It then correctly treated the Steam Controller as an Xbox 360 controller. No further setup needed.
|
Just tried Valkyria Chronicles. It just needed the DirectInput Blocker (link and information in the top post) to work properly with my Xbox One S controller.
|
All times are GMT -5. The time now is 09:47 PM. |