Hello,
I have a ThrustMaster wheel for Xbox 360, and want to use it on my PC but trying to fix the combined throttle/break axis like suggested in this post : http://www.nogripracing.com/forum/showt ... p?t=348954
My Windows version is 10.1607-x64, Xbox driver / xinput1_4.dll is 10.0.14393.0, tested FreePIE versions from 1.5 to 1.9, launched without or with administrator rights...
But when "pad = xbox360[0]" (even if only this line in a script) then FreePIE say "external component has thrown an exception" in error panel, and script is stopped.
Any idea about this ?
"external component has thrown an exception" when xbox360
-
- One Eyed Hopeful
- Posts: 2
- Joined: Fri Nov 25, 2016 7:59 pm
-
- One Eyed Hopeful
- Posts: 2
- Joined: Fri Nov 25, 2016 7:59 pm
Re: "external component has thrown an exception" when xbox36
Finally I understood: FreePIE seeks for xinput1_3.dll, whereas Windows10 (fresh install) provides xinput1_4.dllMy Windows version is 10.1607-x64, Xbox driver / xinput1_4.dll is 10.0.14393.0
Solution: download directx_Jun2010_redist.exe from
https://www.microsoft.com/en-us/downloa ... px?id=8109 or
https://download.microsoft.com/download ... redist.exe
then open it with 7-Zip for example, extract APR2007_xinput_x86.cab, open it, and copy xinput1_3.dll to C:\Program Files (x86)\FreePIE\
Now I have 2 axis for brake/throttle with my xbox wheel
Here is my simple script (tested with BMW M3 Challenge, which automatically see vJoy axis at first) :
Code: Select all
# convert combined axis (z) of xbox360 xInput devices
# to 2 separate axis (1 for each individual trigger/pedal) = DirectInput mode
# FreePIE (x86)
# vJoy: x86\vJoyInterface.dll + x86\vJoyInterfaceWrap.dll -> FreePIE directory
# Windows10: directx_Jun2010_redist.exe -> (7-Zip) -> APR2007_xinput_x86.cab -> xinput1_3.dll -> FreePIE directory
# joy.cpl:
# - vJoy device = independent triggers/pedals
# - xbox device = buttons + sticks/wheel (+ combined triggers/pedals)
# before launching game: FreePIE.exe this-file.py /r /t
if starting:
xb = xbox360[0]
vj = vJoy[0]
vj_max = vj.axisMax
vj.rx = round( filters.ensureMapRange( xb.leftTrigger , 0, 1, -vj_max, vj_max ))
vj.ry = round( filters.ensureMapRange( xb.rightTrigger, 0, 1, -vj_max, vj_max ))
Code: Select all
# vJoy configuration = x+y+z+rx+ry+rz axis, 10 buttons, 1 continuous pov
if starting:
xb = xbox360[0]
vj = vJoy[0]
vj_max = vj.axisMax # = 16382
#diagnostics.debug( vj_max )
# (sticks = -1 to 1, triggers = 0 to 1)
vj.x = round( filters.ensureMapRange( xb.leftStickX , -1, 1, -vj_max, vj_max ))
vj.y = -round( filters.ensureMapRange( xb.leftStickY , -1, 1, -vj_max, vj_max ))
vj.rx = round( filters.ensureMapRange( xb.rightStickX , -1, 1, -vj_max, vj_max ))
vj.ry = round( filters.ensureMapRange( xb.rightStickY , -1, 1, -vj_max, vj_max ))
vj.z = round( filters.ensureMapRange( xb.leftTrigger , 0, 1, -vj_max, vj_max ))
vj.rz = round( filters.ensureMapRange( xb.rightTrigger, 0, 1, -vj_max, vj_max ))
# (+ vj.slider vj.dial)
# (xb buttons = True or False)
vj.setButton( 0, xb.a )
vj.setButton( 1, xb.b )
vj.setButton( 2, xb.x )
vj.setButton( 3, xb.y )
vj.setButton( 4, xb.leftShoulder )
vj.setButton( 5, xb.rightShoulder )
vj.setButton( 6, xb.back )
vj.setButton( 7, xb.start )
vj.setButton( 8, xb.leftThumb )
vj.setButton( 9, xb.rightThumb )
pov = 0
if xb.up : pov += 1
if xb.right: pov += 2
if xb.down : pov += 4
if xb.left : pov += 8
if pov == 0: vj.setAnalogPov( 0, -1 )
if pov == 1: vj.setAnalogPov( 0, 0 ) # 1 = up = 0°
if pov == 2: vj.setAnalogPov( 0, 9000 ) # 2 = right = 90°
if pov == 4: vj.setAnalogPov( 0, 18000 ) # 4 = down = 180°
if pov == 8: vj.setAnalogPov( 0, 27000 ) # 8 = left = 270°
if pov == 3: vj.setAnalogPov( 0, 4500 ) # 1 + 2 = up + right = 45°
if pov == 6: vj.setAnalogPov( 0, 13500 ) # 4 + 2 = down + right = 135°
if pov == 9: vj.setAnalogPov( 0, 31500 ) # 1 + 8 = up + left = 315°
if pov == 12: vj.setAnalogPov( 0, 22500 ) # 4 + 8 = down + left = 225°
Code: Select all
# source = http://www.nogripracing.com/forum/showthread.php?t=348954
# if game makes auto-detection for assignements, it will probably pick the combined axis ; then:
# - press trigger/pedal and a+b+y buttons (or CapsLock key) simultaneously
# - release trigger/pedal (and buttons)
# - you have 10 seconds to switch assignement on edit mode
# - after 10 seconds, the virtual axis is simulated
# if combo can't be used inside game: increase auto_move_delay, make combo before launching game,
# edit assignements and wait ; then exit game and repeat combo, etc. for 2nd trigger/pedal
######################################################################
from time import sleep
if starting:
lt_vaxis = "rx" # (left trigger/pedal)
rt_vaxis = "ry" # (right trigger/pedal)
auto_move_axis_key = Key.CapsLock
auto_move_button_1 = "a" # (or 0 to disable combo)
auto_move_button_2 = "b"
auto_move_button_3 = "y"
auto_move_axis_function_enabled = 1
button_to_key_mappings_enabled = 0 # if enabled:
# back button = escape key
# start button = enter key + mouse clic
# directionnal pad = arrow keys + mouse moves
######################################################################
invert_left_trigger = 0
invert_right_trigger = 0
lt_min, lt_max = 0, 1
rt_min, rt_max = 0, 1
# (10% deadzone: min=0.1 max=0.9)
auto_move_delay = 10
auto_move_travel_time = 1.5
auto_move_cycles = 2
# (after 10 seconds, reach maximum in 1.5 seconds, then wait 1.5 seconds,
# then move down to minimum ; then wait 1.5 seconds, and restart a 2nd time)
######################################################################
vj = vJoy[0]
xb = xbox360[0]
vjoy_min = -vj.axisMax
vjoy_max = vj.axisMax
if invert_left_trigger: lt_vjmin, lt_vjmax = vjoy_max, vjoy_min
else: lt_vjmin, lt_vjmax = vjoy_min, vjoy_max
if invert_right_trigger: rt_vjmin, rt_vjmax = vjoy_max, vjoy_min
else: rt_vjmin, rt_vjmax = vjoy_min, vjoy_max
# end of settings
######################################################################
def cycle(vd, vx):
jps = 30
stps = range(int(auto_move_travel_time * jps) + 1)
setattr(vd, vx, vjoy_min)
speech.say("auto-move, wait %s seconds" % int(auto_move_travel_time * 4 * auto_move_cycles - auto_move_travel_time))
for t in range(auto_move_cycles):
if t and auto_move_cycles > 1:
sleep(auto_move_travel_time)
for k in stps:
setattr(vd, vx, vjoy_min + k * vj.axisMax * 2 / (auto_move_travel_time * jps))
sleep(1 / float(jps))
sleep(auto_move_travel_time)
for k in reversed(stps):
setattr(vd, vx, vjoy_min + k * vj.axisMax * 2 / (auto_move_travel_time * jps))
sleep(1 / float(jps))
speech.say("done")
######################################################################
# main
setattr( vj, lt_vaxis, round(filters.ensureMapRange( xb.leftTrigger, lt_min, lt_max, lt_vjmin, lt_vjmax )))
setattr( vj, rt_vaxis, round(filters.ensureMapRange( xb.rightTrigger, rt_min, rt_max, rt_vjmin, rt_vjmax )))
######################################################################
if auto_move_axis_function_enabled:
if (auto_move_axis_key and keyboard.getKeyDown(auto_move_axis_key) or
auto_move_button_1 and
getattr(xb, auto_move_button_1) and
getattr(xb, auto_move_button_2) and
getattr(xb, auto_move_button_3)):
if xb.leftTrigger > (lt_min + 0.1) or xb.rightTrigger > (rt_min + 0.1):
axis_to_move = lt_vaxis if xb.leftTrigger > (lt_min + 0.1) else rt_vaxis
setattr(vj, axis_to_move, vjoy_min)
speech.say("auto-move in %s seconds" % auto_move_delay)
sleep(auto_move_delay)
cycle(vj, axis_to_move)
#else:
# speech.say("left %s, right %s" % (round(xb.leftTrigger,2),round(xb.rightTrigger,2)))
######################################################################
if button_to_key_mappings_enabled:
mouse.leftButton = xb.start
keyboard.setKey( Key.Return, xb.start )
keyboard.setKey( Key.Escape, xb.back )
keyboard.setKey( Key.UpArrow, xb.up )
keyboard.setKey( Key.DownArrow, xb.down )
keyboard.setKey( Key.LeftArrow, xb.left )
keyboard.setKey( Key.RightArrow, xb.right )
if getattr( xb, "up" ): mouse.deltaY = -1
if getattr( xb, "down" ): mouse.deltaY = 1
if getattr( xb, "left" ): mouse.deltaX = -2
if getattr( xb, "right" ): mouse.deltaX = 2