Skip to content

Instantly share code, notes, and snippets.

@abhiraaid
Last active December 6, 2023 15:03
Show Gist options
  • Save abhiraaid/9bbfe37ea48c578b6a2a30289f8d181f to your computer and use it in GitHub Desktop.
Save abhiraaid/9bbfe37ea48c578b6a2a30289f8d181f to your computer and use it in GitHub Desktop.
#Define the SDL mapping string
#use SDL2 Gamepad Tool https://generalarcade.com/gamepadtool/ to generate mapping
SDL_MAPPING="03000000632500002705000010010000,SHANWAN Game Controller for Android,platform:Linux,a:b0,b:b1,x:b3,y:b4,back:b10,start:b11,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4"
#Start the game by setting environment variable
env SDL_GAMECONTROLLERCONFIG="$SDL_MAPPING" wine your_game.exe
#if it's a steam game, Set Launching Options as below
env SDL_GAMECONTROLLERCONFIG="03000000632500002705000010010000,SHANWAN Game Controller for Android,platform:Linux,a:b0,b:b1,x:b3,y:b4,back:b10,start:b11,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4" %command%
#Don't forget to replace the long string with your own mapping from SDL2 Gamepad Tool
#Link to video Guide https://youtu.be/P7yacSNePiA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment