Take the 2-minute tour ×
Arqade is a question and answer site for passionate videogamers on all platforms. It's 100% free, no registration required.

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.

share|improve this question
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 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.

share|improve this answer
    
Sounds like a plan. I'll take a look into it, thanks! –  Waldir Leoncio Jan 31 at 22:21
up vote 0 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.