I have a Microsoft Sidewinder Force Feedback 2 Joystick. It was released in 1998 and it uses USB. It works great in Descent and similar games.
I tried to use it in Kerbal Space Program, but the axis are not detected correctly, moving the joystick from one end to the other results in several jumps in the corresponding axis in the game. It was beyond unusable.
The solution I found requires two different pieces of software. FreePIE to create a mapping script and vJoy to install a virtual Joystick that works well with KSP.
FreePIE requires you to write a script in Python in order to make your Joystick work. It is very powerful but writing the scripts is not as simple as mapping using a GUI.
So, here's the script that works with the Sidewinder Joystick:
from System import Int16
def map_range(n, lu, hu, lm, hm):
return lm + (hm - lm) * float(n - lu) / (hu - lu)
if starting:
#min = Int16.MinValue
#max = Int16.MaxValue
# Kerbal Space Program hack
max = 16000
min = 1-max
vJoy[0].x = map_range(joystick[1].x, -1000, 1000, min, max)
vJoy[0].y = map_range(joystick[1].y, -1000, 1000, min, max)
vJoy[0].rz = map_range(joystick[1].zRotation, -1000, 1000, min, max)
vJoy[0].slider = map_range(joystick[1].sliders[0], -1000, 1000, min, max)
vJoy[0].setButton(0, joystick[1].getDown(0))
vJoy[0].setButton(1, joystick[1].getDown(1))
vJoy[0].setButton(2, joystick[1].getDown(2))
vJoy[0].setButton(3, joystick[1].getDown(3))
vJoy[0].setButton(4, joystick[1].getDown(4))
vJoy[0].setButton(5, joystick[1].getDown(5))
vJoy[0].setButton(6, joystick[1].getDown(6))
vJoy[0].setButton(7, joystick[1].getDown(7))
vJoy[0].setAnalogPov(0, joystick[1].pov[0])
After this, in KSP both Joysticks will appear, the Sidewinder is the first and the virtual one is next.
When mapping the controls, KSP will sometimes register the Sidewinder and sometimes register the vJoy. To fix this you should also edit the settings.cfg file.
The settings.cfg file for my KSP looks like this (only the relevant parts):
INPUT_DEVICES
{
vJoy - Virtual Joystick = 1
SideWinder Force Feedback 2 Joystick = 0
}
AXIS_PITCH
{
PRIMARY
{
name = vJoy - Virtual Joystick
axis = 1
inv = False
sensitivity = 1.81119001
deadzone = 0
scale = 1
group = 0
modeMask = -1
}
SECONDARY
{
name = None
axis = -1
inv = False
sensitivity = 1
deadzone = 0
scale = 1
group = 0
modeMask = -1
}
}
I hope this helps other to use whatever Input devices they want to play KSP.