Jump to content

[Tutorial] Joystick settings for PPjoy and GlovePie, Originally by Bedazzled


sal_vager

Recommended Posts

Originally posted by Bedazzled; 28th August 2012 at 07:27, and recovered by Atanvaryar

Use PPJoy (64bit version here) to create a virtual joystick, then use GlovePIE to run a script which maps the physical joystick controls to virtual ones which are interpreted correctly by Kerbal. The script needs to be running in the background while you are running Kerbal.

1. PPJoy

- open 'configure joysticks' dialog

- click 'add...' to create virtual joystick

- select it, click on 'mapping...', click on next

- select 'delete individual mapping - use interface default'

- click on next / yes / finish

2. GlovePIE script:

- open GlovePIE

- enter and save the script below

- click on run (do this each time you play Kerbal)

//joystick axes (rockets - uses rudder controls for roll)

PPJoy1.Analog0 = Joystick1.RotZ

PPJoy1.Analog1 = Joystick1.y

PPJoy1.Analog2 = -1 * Joystick1.z

PPJoy1.Analog6 = Joystick1.x

//joystick axes (space-planes - uses rudder controls for yaw)

//PPJoy1.Analog0 = Joystick1.x

//PPJoy1.Analog1 = Joystick1.y

//PPJoy1.Analog2 = -1 * Joystick1.z

//PPJoy1.Analog6 = Joystick1.RotZ

//pan camera

keyboard.Left = Joystick1.Pov1Right

keyboard.Right = Joystick1.Pov1Left

keyboard.Up = Joystick1.Pov1Down

keyboard.Down = Joystick1.Pov1Up

//zoom in/out

Keyboard.Equals = Joystick1.button3

Keyboard.Minus = Joystick1.button4

//map other keys to joystick buttons as required

Keyboard.T = Joystick1.Button1

Keyboard.M = Joystick1.Button2

Keyboard.F2 = Joystick1.Button8

//etc

3. SETTINGS

- You must edit the Kerbal 'settings.cfg' file manually, it won't work if you try to bind the controls in-game:

...

AXIS_PITCH

{

name = VirY

id = joy0.1

inv = False

sensitivity = 1

deadzone = 0

}

AXIS_ROLL

{

name = VirX

id = joy0.0

inv = False

sensitivity = 1

deadzone = 0

}

AXIS_YAW

{

name = VirRotZ

id = joy0.3

inv = False

sensitivity = 1

deadzone = 0

}

AXIS_THROTTLE

{

name = VirZ

id = joy0.2

inv = False

sensitivity = 1

deadzone = 0

}

...

NB you may need to play around with the joystick IDs in the script and config file, depending on what other controllers you've got plugged into your PC. Hope that helps!

You might also find xpadder is useful when setting up sticks and pads :)
Edited by sal_vager
Link to comment
Share on other sites

  • 1 year later...

Hi, thought I'd update this thread as I recently upgraded to Win 8.1 64 bit and found PPJoy doesn't have signed drivers.

All is not lost, if you want to use literally ANY joystick with Kerbal on Win 8.1, all you need is vJoy and FreePIE. They are similar to PPJoy and GlovePIE, except FreePIE uses Python syntax.

1. Install vJoy, create a virtual joystick, and use the "configure vJoy" program to set up the required number of axes, buttons and pov hats.

2. Install FreePIE, and enter the following script:

# KERBAL virtual joystick

from System import Int16

# position of joystick in USB game controller list (starts at 0)

joyID = 1

if starting: # indent following lines

<press tab>system.setThreadTiming(TimingTypes.HighresSystemTimer)

<press tab>system.threadExecutionInterval = 5

<press tab>joystick[joyID].setRange(Int16.MinValue / 2.001, Int16.MaxValue / 2.001) # you might need to mod this

# map analogue

vJoy[0].rx = joystick[joyID].x

vJoy[0].y = joystick[joyID].y

vJoy[0].x = joystick[joyID].zRotation

vJoy[0].z = -1 * joystick[joyID].z

vJoy[0].setAnalogPov(0, joystick[joyID].pov[0])

diagnostics.watch(joystick[joyID].pov[0]) # can be used to determine pov values for each direction

# map buttons

if joystick[joyID].getDown(0): # indent following line

<press tab>vJoy[0].setPressed(0)

elif joystick[joyID].getDown(1): # indent following line

<press tab>vJoy[0].setPressed(1)

# etc...

# map keys to buttons

keyboard.setKey(Key.T, joystick[joyID].getDown(0))

keyboard.setKey(Key.M, joystick[joyID].getDown(1))

keyboard.setKey(Key.NumberPadPlus, joystick[joyID].getDown(2))

keyboard.setKey(Key.NumberPadMinus, joystick[joyID].getDown(3))

# etc...

# map pov hats

keyboard.setKey(Key.DownArrow, joystick[joyID].pov[0] == 0)

keyboard.setKey(Key.LeftArrow, joystick[joyID].pov[0] == 9000)

keyboard.setKey(Key.UpArrow, joystick[joyID].pov[0] == 18000)

keyboard.setKey(Key.RightArrow, joystick[joyID].pov[0] == 27000)

# end of script

Notes:

(a) To find the correct value of JoyID, go to search, enter "USB game controllers", and find the joystick's position in the list (for item 1, joyID=0)

(B) Script indents were lost in post, use TAB to indent appropriate lines

3. Edit Kerbal / settings.cfg. It has to be edited manually, it won't work if you try to bind the controls in-game. In my case I map the axes to joy2.0, joy2.1, joy2.2 and joy2.3

AXIS_PITCH

{

name = None

id = joy2.1

inv = False

sensitivity = 1

deadzone = 0.05

scale = 1

group = 0

switchState = Any

}

AXIS_ROLL

{

name = None

id = joy2.0

inv = False

sensitivity = 1

deadzone = 0.05

scale = 1

group = 0

switchState = Any

}

AXIS_YAW

{

name = None

id = joy2.3

inv = False

sensitivity = 1

deadzone = 0.05

scale = 1

group = 0

switchState = Any

}

AXIS_THROTTLE

{

name = None

id = joy2.2

inv = False

sensitivity = 1

deadzone = 0.05

scale = 1

group = 0

switchState = Any

}

4. Save the script, run it, then start Kerbal.

5. You can alt-tab back to FreePIE and edit the script while Kerbal is running if you need to modify your keyboard mappings.

HTH :)

Edited by Bedazzled
Link to comment
Share on other sites

  • 2 years later...
9 minutes ago, minkz said:

Hi, can i use this for all car games? And where can i download Kerbal?

Since this thread is ancient, I really have no idea whether it still works or not, and what does it work with. Better start a new one.

You can buy KSP from the store, or from Steam.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...