Optimal XBox 360 controller setup
Posted: Tue Jul 20, 2010 9:14 pm
[UPDATE: Please see http://wiki.alioth.net/index.php/XBox360_Controller for Linux XBox360 Controller setup]
I've plugged away at this and come up with the following set up using the Xboxdrv http://pingus.seul.org/~grumbel/xboxdrv/xboxdrv.html.
My launcher for Oolite that sets up Xboxdrv with my button and axis mappings is:
#!/bin/sh
# Start xboxdrv and remember its PID in the variable XBOXPID
xboxdrv -s --trigger-as-button --dpad-as-button -l 0 --axis-sensitivity X1=-0.5,X2=-0.5,Y2=-0.5 --axismap -Y2=Y2 --ui-axismap Y1=XK_1:XK_2 --ui-buttonmap \
du=XK_Up,dd=XK_Down,\
dl=XK_Left,dr=XK_Right,\
lt=XK_w,\
rt=XK_z,\
lb=XK_r,\
rb=XK_i,\
X=XK_Return,\
A=XK_t,\
B=XK_e,\
Y=XK_u,\
start=XK_d,\
guide=XK_j,\
back=XK_p,\
lb+du=XK_3,\
lb+dd=XK_8,\
lb+dl=XK_6,\
lb+dr=XK_7,\
lb+back=XK_5,\
lb+start=XK_c,\
lb+X=XK_h,\
lb+A=XK_backslash,\
lb+B=XK_m &
#du=XK_Up,dd=XK_Down : speed
#dl=XK_Left,dr=XK_Right : previous, next target
#lt=XK_w : fire lasers
#rt=XK_z : scanner zoom
#lb=XK_r : identify object
#rb=XK_i : inject speed
#X=XK_Return : launch missile
#A=XK_t : target missile
#B=XK_e : ecm
#Y=XK_u : untarget missile
#start=XK_d : fast dock
#guide=XK_j : jumpdrive
#back=XK_p : pause
#lb+du=XK_3 : buy equipment/ships
#lb+dd=XK_8 : market prices
#lb+dl=XK_6 : local/galactic chart
#lb+dr=XK_7 : planet info
#lb+back=XK_5 : current status/manifest
#lb+start=XK_c : slow dock with target
#lb+X=XK_h : hyperspace
#lb+A=XK_backslash : advanced compass
#lb+B=XK_m : comms log
XBOXPID=$!
# Give xboxdrv a second to startup and create the device
sleep 1
# Launch your favorite game
/usr/bin/oolite
# Kill xboxdrv and wait for it to finish
kill $XBOXPID
wait $XBOXPID
# EOF #
This required changing some key configs:
{
key_roll_left = "a";
key_roll_right = "s";
key_pitch_forward = "[";
key_pitch_back = "'";
key_yaw_left = ",";
key_yaw_right = ".";
key_increase_speed = 255; // up arrow
key_decrease_speed = 254; // down arrow
key_inject_fuel = "i";
key_fire_lasers = "w";
key_launch_missile = 13;
key_next_missile = "y";
key_ecm = "e";
key_target_incoming_missile = "T";
key_target_missile = "t";
key_untarget_missile = "u";
key_ident_system = "r";
key_scanner_zoom = "z";
key_scanner_unzoom = "Z";
key_launch_escapepod = 27; // escape
key_energy_bomb = "\t"; // tab
key_galactic_hyperspace = "g";
key_hyperspace = "h";
key_jumpdrive = "j";
key_dump_cargo = "D";
key_rotate_cargo = "R";
key_autopilot = "C";
key_autopilot_target = "c";
key_autodock = "d";
key_docking_clearance_request = "L";
key_snapshot = "*";
key_docking_music = "s";
key_advanced_nav_array = "^";
key_map_home = 302; // Home
key_map_info = "i";
key_pausebutton = "p";
key_show_fps = "F";
key_mouse_control = "M";
key_comms_log = "m";
key_next_compass_mode = "\\";
key_cloaking_device = "0";
key_contract_info = "?";
key_next_target = 252; // right arrow
key_previous_target = 253; // left arrow
key_custom_view = "v";
key_dump_target_state = "H";
}
Virtually everything can be controlled from the gamepad. For menus, the dpad is mapped to arrow keys and X is Enter. The left shoulder button is treated as a shift key.
Forward on the left analog stick gives forward view and back gives aft view - ie. the stick fwd/back is mapped to buttons, but left/right is not mapped and should be mapped in the game to roll. The other analog stick is for pitch/yaw.
I've plugged away at this and come up with the following set up using the Xboxdrv http://pingus.seul.org/~grumbel/xboxdrv/xboxdrv.html.
My launcher for Oolite that sets up Xboxdrv with my button and axis mappings is:
#!/bin/sh
# Start xboxdrv and remember its PID in the variable XBOXPID
xboxdrv -s --trigger-as-button --dpad-as-button -l 0 --axis-sensitivity X1=-0.5,X2=-0.5,Y2=-0.5 --axismap -Y2=Y2 --ui-axismap Y1=XK_1:XK_2 --ui-buttonmap \
du=XK_Up,dd=XK_Down,\
dl=XK_Left,dr=XK_Right,\
lt=XK_w,\
rt=XK_z,\
lb=XK_r,\
rb=XK_i,\
X=XK_Return,\
A=XK_t,\
B=XK_e,\
Y=XK_u,\
start=XK_d,\
guide=XK_j,\
back=XK_p,\
lb+du=XK_3,\
lb+dd=XK_8,\
lb+dl=XK_6,\
lb+dr=XK_7,\
lb+back=XK_5,\
lb+start=XK_c,\
lb+X=XK_h,\
lb+A=XK_backslash,\
lb+B=XK_m &
#du=XK_Up,dd=XK_Down : speed
#dl=XK_Left,dr=XK_Right : previous, next target
#lt=XK_w : fire lasers
#rt=XK_z : scanner zoom
#lb=XK_r : identify object
#rb=XK_i : inject speed
#X=XK_Return : launch missile
#A=XK_t : target missile
#B=XK_e : ecm
#Y=XK_u : untarget missile
#start=XK_d : fast dock
#guide=XK_j : jumpdrive
#back=XK_p : pause
#lb+du=XK_3 : buy equipment/ships
#lb+dd=XK_8 : market prices
#lb+dl=XK_6 : local/galactic chart
#lb+dr=XK_7 : planet info
#lb+back=XK_5 : current status/manifest
#lb+start=XK_c : slow dock with target
#lb+X=XK_h : hyperspace
#lb+A=XK_backslash : advanced compass
#lb+B=XK_m : comms log
XBOXPID=$!
# Give xboxdrv a second to startup and create the device
sleep 1
# Launch your favorite game
/usr/bin/oolite
# Kill xboxdrv and wait for it to finish
kill $XBOXPID
wait $XBOXPID
# EOF #
This required changing some key configs:
{
key_roll_left = "a";
key_roll_right = "s";
key_pitch_forward = "[";
key_pitch_back = "'";
key_yaw_left = ",";
key_yaw_right = ".";
key_increase_speed = 255; // up arrow
key_decrease_speed = 254; // down arrow
key_inject_fuel = "i";
key_fire_lasers = "w";
key_launch_missile = 13;
key_next_missile = "y";
key_ecm = "e";
key_target_incoming_missile = "T";
key_target_missile = "t";
key_untarget_missile = "u";
key_ident_system = "r";
key_scanner_zoom = "z";
key_scanner_unzoom = "Z";
key_launch_escapepod = 27; // escape
key_energy_bomb = "\t"; // tab
key_galactic_hyperspace = "g";
key_hyperspace = "h";
key_jumpdrive = "j";
key_dump_cargo = "D";
key_rotate_cargo = "R";
key_autopilot = "C";
key_autopilot_target = "c";
key_autodock = "d";
key_docking_clearance_request = "L";
key_snapshot = "*";
key_docking_music = "s";
key_advanced_nav_array = "^";
key_map_home = 302; // Home
key_map_info = "i";
key_pausebutton = "p";
key_show_fps = "F";
key_mouse_control = "M";
key_comms_log = "m";
key_next_compass_mode = "\\";
key_cloaking_device = "0";
key_contract_info = "?";
key_next_target = 252; // right arrow
key_previous_target = 253; // left arrow
key_custom_view = "v";
key_dump_target_state = "H";
}
Virtually everything can be controlled from the gamepad. For menus, the dpad is mapped to arrow keys and X is Enter. The left shoulder button is treated as a shift key.
Forward on the left analog stick gives forward view and back gives aft view - ie. the stick fwd/back is mapped to buttons, but left/right is not mapped and should be mapped in the game to roll. The other analog stick is for pitch/yaw.