New version of runxboxdrv

This commit is contained in:
Ingo Ruhnke 2011-01-28 17:27:32 +01:00
parent 8e36d9692a
commit 3c9379eb67
4 changed files with 82 additions and 103 deletions

65
runxboxdrv/keyconfig.plist Executable file
View file

@ -0,0 +1,65 @@
{
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 = "n";
key_map_home = 302; // Home
key_map_info = "O";
key_pausebutton = "p";
key_show_fps = "F";
key_mouse_control = "M";
key_comms_log = "m";
key_next_compass_mode = "b";
key_cloaking_device = "0";
key_contract_info = "o";
key_next_target = 252; // right arrow
key_previous_target = 253; // left arrow
key_custom_view = "v";
key_dump_target_state = "H";
}

View file

@ -1,66 +0,0 @@
[options]
silent=true
trigger-as-button=true
dpad-as-button=true
led=0
[axis-sensitivity]
X1=-0.5
X2=-0.5
Y2=-0.5
[axismap]
Y2=-Y2
[ui-axismap]
Y1=XK_1:XK_2
[ui-buttonmap]
# speed
du=XK_Up
dd=XK_Down
# previous, next target
dl=XK_Left
dr=XK_Right
# fire lasers
lt=XK_w
# identify object
rt=XK_r
# next missile
lb=XK_y
# inject speed
rb=XK_i
# launch missile
X=XK_Return
# target missile
A=XK_t
# ecm
B=XK_e
# untarget missile
Y=XK_u
# scanner zoom
start=XK_z
# jumpdrive
guide=XK_j
# pause
back=XK_p
# buy equipment/ships
lb+du=XK_3
# market prices
lb+dd=XK_8
# local/galactic chart
lb+dl=XK_6
# planet info
lb+dr=XK_7
# current status/manifest
lb+back=XK_5
# hyperspace
lb+guide=XK_h
# slow dock with target
lb+start=XK_c
# fast dock
lb+X=XK_d
# advanced compass
lb+A=XK_backslash
# comms log
lb+B=XK_m

View file

@ -1,16 +1,17 @@
[options]
[xboxdrv]
silent=true
trigger-as-button=true
dpad-as-button=true
square-axis=true
led=0
[axis-sensitivity]
X1=-0.5
X2=-0.5
Y2=-0.5
X1=-0.7
X2=-0.7
Y2=-0.7
[axismap]
Y2=-Y2
-Y2=Y2
[ui-axismap]
Y1=XK_1:XK_2
@ -61,6 +62,13 @@ lb+start=XK_c
# fast dock
lb+X=XK_d
# advanced compass
lb+A=XK_backslash
lb+A=XK_b
# comms log
lb+B=XK_m
# advanced navigational array
lb+Y=XK_n
# contract info
lb+rb=XK_o
# EOF #

View file

@ -616,39 +616,11 @@ class RunXBoxDrv(object):
out = RunXBoxDrv.getNext(myProc)
print out
def xboxdrvconfiguration(self):
parser = ConfigParser.ConfigParser()
parser.optionxform = str
if not parser.read(self.configfile):
raise Exception("XBoxDrv game config not found: " + self.configfile)
cfg = dict([(s, dict(parser.items(s))) for s in parser.sections()])
optionlist = []
for sectionname in cfg:
section = cfg[sectionname]
if sectionname == "options":
for inkey in section:
key, value = self.checkminusvalue(inkey, section[inkey])
if value == "true":
optionlist.append("--%s" % key)
else:
optionlist.append("--%s=%s" % (key, value))
continue
paramline = ""
for inkey in section:
key, value = self.checkminusvalue(inkey, section[inkey])
paramline = "%s%s=%s," % (paramline, key, value)
if paramline.endswith(","):
optionlist.append("--%s" % sectionname)
optionlist.append(paramline[:-1])
return optionlist
def process(self):
commandlist = [self.xboxdrvpath]
if self.configfile:
commandlist = commandlist + self.xboxdrvconfiguration()
commandlist = commandlist + ["--config=%s" % self.configfile]
print commandlist
myProc = Process(commandlist)
with_timeout(1, self.checkLoaded, myProc)
@ -679,12 +651,12 @@ def main():
usage = "Usage: %prog [options] [command [args]]"
parser = OptionParser(usage)
parser.add_option("--cfg", help="xboxdrv configuration")
parser.add_option("--config", help="xboxdrv configuration")
parser.add_option("--xboxdrv", help="full path to xboxdrv")
parser.add_option("--sudo", help="sudo command to use")
(options, args) = parser.parse_args()
runxboxdrv = RunXBoxDrv(options.cfg, options.xboxdrv, options.sudo, args)
runxboxdrv = RunXBoxDrv(options.config, options.xboxdrv, options.sudo, args)
runxboxdrv.process()
if __name__ == "__main__":