I'm playing Half-Life 2 with an Xbox 360 wired controller in Ubuntu Steam, but the default key mapping is really weird: not only is the default mapping strange to me (e.g. L_SHOULDER for jumping), many actions are just unmapped.

Anyway, every time I run the game I have to remap everything, since the changes are not persistent. I've seen a thread that offers a solution involving the creation of a config file. This is helpful, but still requires loading the cfg file every time and looks more like a workaround than a solution. I can't believe there isn't a better way to save a custom mapping!

By the way, this is really exclusive to HL2. I've tried the same in other Valve titles (namely, Portal and Team Fortress 2) and in games from other companies and never had a problem.

  • 2
    Corerct me if I'm wrong, but isnt' there also a file/setting that allows you to run a specific line of script at the start of a game? I dont' know it offhand, and I could be wrong, but I remember something like that in the back of my mind.
    – Zibbobz
    Jan 31, 2014 at 19:15

2 Answers 2


According to this article:

By default the Half Life 2 engine looks for autoexec.cfg at startup, and if it finds it, it will automatically load and execute all the valid commands in it along with those in config.cfg while starting up Half Life 2.

Additionally, you can create any other .cfg files you need, name them as you wish (as long as they end in .cfg), such as mytweaks.cfg, place them in the same directory as config.cfg, and then run the commands they contain from the Half Life 2 console (or from autoexec.cfg) by using the "exec" command. For example typing the command: exec mytweaks.cfg in the console will execute the command variables contained in the mytweaks.cfg file. They will not run automatically at startup however - only autoexec.cfg and config.cfg can do that.

  • Sounds like a plan. I'll take a look into it, thanks! Jan 31, 2014 at 22:21

I've finally managed to get this to work. It turns out Half Life 2 executes a file named 360-controller.cfg automatically whenever it starts (for Linux, it executes 360controller-linux.cfg; both are located at ~/.steam/SteamApps/common/Half-Life 2/hl2/cfg). So all you need to do is tweak that file to you liking. Here's my setup (the missing buttons are left to default):

joy_name "Game controller"

bind "A_BUTTON" "+jump"
bind "B_BUTTON" "+reload"
bind "X_BUTTON" "+use"
bind "Y_BUTTON" "phys_swap"

bind "L_SHOULDER" "+zoom"
bind "R_SHOULDER" "impulse 100"

bind "START" "pause"

bind "STICK1" "+speed"      // Right Stick Down
bind "STICK2" "+duck"       // Left Stick Down

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .