Although this is an old thread, the problem persists, so I have written a guide which I hope will be of use. You can find the latest version in the Guides to XWA on the appropriate Steam-Community Website (I am not able to post links here). Please see there for the latest version and further and more detailed information.
In short:
1. Install vJoy as virtual Joystick driver and FreePIE as bridge between vJoy and your input device.
2. Configure vJoy Device No. 1 with X/Y/Z/Rx/Ry/Rz axis and 2 Buttons
3. Run the following script in FreePIE (File->New, Paste, Save, Press F5):
########## FreePIE Script Start ##########
## !!!!! REPLACE ALL OCCURENCES of "____" (four consecutive underscores )
## with four consecutive spaces or
## a single tab before attempting to run !!!!!
#Initialization
if starting:
____rmbKey = Key.X #Key bound to right mouse botton
____#Higher values = faster centering
____centreX = 0.015
____centreY = 0.03
____#Sensitivities
____sensX = 50
____sensY = 50
____sensZ = 10
____viewSens = 50
____#Timings
____system.setThreadTiming(TimingTypes.HighresSystemTimer)
____system.threadExecutionInterval = 20
____#Initial values of axis / latches /etc.
____x = 0
____y = 0
____z = -vJoy[0].axisMax
____rx = 0
____ry = 0
____timeKeyPressed = 0
____freelook = False
____viewLatch = False
____moveLatch = False
____rmbLatch = False
#Freelook via Numpad mapped to mouse while middle mouse button pressed
if freelook:
____if timeKeyPressed <= 0:
________timeKeyPressed = viewSens
____
________#rx += mouse.deltaX * viewSens
________if mouse.deltaX > 0:
____________keyboard.setKey(Key.NumberPad6, True)
____________keyboard.setKey(Key.NumberPad6, False)
________if mouse.deltaX < 0:
____________keyboard.setKey(Key.NumberPad4, True)
____________keyboard.setKey(Key.NumberPad4, False)
____________
________#ry += mouse.deltaY * viewSens
________if mouse.deltaY > 0:
____________keyboard.setKey(Key.NumberPad2, True)
____________keyboard.setKey(Key.NumberPad2, False)
________if mouse.deltaY < 0:
____________keyboard.setKey(Key.NumberPad8, True)
____________keyboard.setKey(Key.NumberPad8, False)
____else:
________timeKeyPressed -= system.threadExecutionInterval
________if timeKeyPressed < 0:
____________timeKeyPressed = 0
else:
____# Mouse axis as Joystick via vJoy-Driver
____if mouse.deltaX:
________moveLatch = True
________x += mouse.deltaX * sensX
________if abs(x) > vJoy[0].axisMax:
____________x = vJoy[0].axisMax * x / abs(x)
____else:
________x /= (1.0 + centreX)
____
____if mouse.deltaY:
________moveLatch = True
________y += mouse.deltaY * sensY
________if abs(y) > vJoy[0].axisMax:
____________y = vJoy[0].axisMax * y / abs(y)
____else:
________y /= (1.0 + centreY)
# recenter
if (not freelook and viewLatch):
____rx = 0
____ry = 0
____viewLatch = False
#keyboard override mouse
#if (moveLatch and keyboard.getPressed(Key.Space) or keyboard.getPressed(Key.Z)):
#____x = 0
#____y = 0
#____moveLatch = False
#right mouse button
if (mouse.getPressed(1) or mouse.rightButton):
____if (not rmbLatch):
________keyboard.setKey(rmbKey, True)
________keyboard.setKey(rmbKey, False)
____rmbLatch = True
else:
____rmbLatch = False
____
#code for hold freelock
freelook = mouse.getButton(2) or mouse.middleButton
#if (mouse.getPressed(3)):
#____viewLatch = True
____
#code for toggle freelook
#toggle = keyboard.getPressed(Key.CapsLock)
#if (toggle):
#____freelook = not freelook
#Throttle via Z-Axis mapped to mouse wheel
if (mouse.wheel):
____z += mouse.wheel * sensZ
____if abs(z) > vJoy[0].axisMax:
________z = vJoy[0].axisMax * z / abs(z)
________
##### vJoy mapping #####
### Standard mapping ###
#vJoy[0].rx = rx
#vJoy[0].ry = ry
#vJoy[0].x = x
#vJoy[0].y = y
#vJoy[0].z = -z
### X-Wing Alliance default "weird" mapping ###
vJoy[0].rx = 0
vJoy[0].ry = 0
vJoy[0].rz = x
vJoy[0].x = 0
vJoy[0].y = -y
vJoy[0].z = -z
#Joystick buttons mapped to mouse buttons
vJoy[0].setButton(0, mouse.getButton(0) or mouse.leftButton)
vJoy[0].setButton(1, mouse.getButton(1) or mouse.rightButton)
#Diagnostics
diagnostics.watch(vJoy[0].x)
diagnostics.watch(vJoy[0].y)
diagnostics.watch(vJoy[0].z)
diagnostics.watch(vJoy[0].rx)
diagnostics.watch(vJoy[0].ry)
diagnostics.watch(vJoy[0].rz)
diagnostics.watch(freelook)
diagnostics.watch(moveLatch)
diagnostics.watch(mouse.getButton(0) or mouse.leftButton)
diagnostics.watch(mouse.getButton(1) or mouse.rightButton)
diagnostics.watch(mouse.getButton(2) or mouse.middleButton)
diagnostics.watch(vJoy[0].axisMax)
########## FreePIE Script End ##########
Once you have completed the above steps, you should be able to control your ship with your mouse movements, use the mouse wheel as throttle, fire your weapons with the left mouse button, (un)link your weapons using the right mouse button and free-look while holding the middle mouse button.
What I like about this solution is that it is not limited to a specific game or even gaming. With FreePIE you can work with the RAW inputs and have full control over all operations. Of course, you can change the example script to make the inputs softer by setting centerX and/or centerY to lower values - or discard automatic centering altogether.
According to the FreePIE documentation, you can also use this method to modify the inputs of your hardware joystick, transfer them to vJoy and thus solve problems such as wrong axes or other inconveniences.
What can be inconvenient with this solution is that you need some programming knowledge to make customizations.
Post edited January 17, 2024 by Fox1245680