#!/bin/sh # This shell script part of the QStick package, which uses the KBStick # program to translate joystick messages into keyboard messages which # are sent to an X server, to the end of adding joystick support to # keyboard-and-mouse or keyboard only games. # # KBStick is released under the GNU Public License, please see the # source code, Makefile and README file for more information. # Assign X KeyCodes to shell variables. This is small number of the # X keyboard KeyCodes (corresponding to the keypad keys). # KP_Up=80 KP_Down=88 KP_Left=83 KP_Right=85 KP_Home=79 KP_End=87 KP_Begin=84 KP_Prior=81 KP_Next=89 KP_Divide=112 KP_Multiply=63 KP_Subtract=82 KP_Add=86 KP_Insert=90 KP_Delete=91 KP_Enter=108 # Assign keycodes to the Microsoft Sidewinder # directional pad. These in turn will be assigned # to the general axis defs below MS_Pad_Left=100 MS_Pad_Right=102 MS_Pad_Up=98 MS_Pad_Down=104 # Assign KeyCodes to the joystick axes. # Axes 0 and 1 should be the x (horizontal) and y (vertical) axes of the # stick itself. Axes beyond these will correspond to rudder, throttle, etc. # controls. # KBStick supports up to 6 axes, though altering the source code # to support more would be a trivial exercise. # # *If you un-comment any of these be sure to un-comment the exports below.* # KBS_Axis_0_Plus=$MS_Pad_Right KBS_Axis_1_Plus=$MS_Pad_Down #KBS_Axis_2_Plus= #KBS_Axis_3_Plus= #KBS_Axis_4_Plus= #KBS_Axis_5_Plus= KBS_Axis_0_Minus=$MS_Pad_Left KBS_Axis_1_Minus=$MS_Pad_Up #KBS_Axis_2_Minus= #KBS_Axis_3_Minus= #KBS_Axis_4_Minus= #KBS_Axis_5_Minus= # Assign keycodes to the Microsoft Sidewinder gamepad. # These in turn will be assigned to the general button # definitions below MS_Pad_start=52 MS_Pad_M=29 MS_Pad_A=30 MS_Pad_B=26 MS_Pad_C=46 MS_Pad_X=32 MS_Pad_Y=31 MS_Pad_Z=45 MS_Pad_L_Finger=65 MS_Pad_R_Finger=36 # Assign KeyCodes to the joystick buttons. # Location and order of buttons/button number will vary from joystick to # joystick. Choosing the KeyCodes of unused keyboard keys to assign to # joystick buttons makes moot the matter of which button sends which KeyCode # since one can run QStick and _then_ run and configure the games you wish # to play, rather than configuring the games first then trying to match # button messages to your game configuration. # KBStick supports up to 12 joystick buttons, but once again altering the # source code to allow more would be a minor task. # KBS_Button_0=$MS_Pad_A KBS_Button_1=$MS_Pad_B KBS_Button_2=$MS_Pad_C KBS_Button_3=$MS_Pad_X KBS_Button_4=$MS_Pad_Y KBS_Button_5=$MS_Pad_Z KBS_Button_6=$MS_Pad_L_Finger KBS_Button_7=$MS_Pad_R_Finger KBS_Button_8=$MS_Pad_start KBS_Button_9=$MS_Pad_M KBS_Button_10=$KP_Delete KBS_Button_11=$KP_Enter # Assign a quit button. # Setting the environment variable KBS_Quit_Button makes the assigned button # (actually any button that sends the assigned KeyCode) cause the KBStick program # to exit after 3 consecutive quit button presses. Any other button press resets # the quit count to 0, but it would probably be good to choose a seldom # used button to be the quit button lest in the fever of a Deathmatch you # turn off your joystick support. B) # Though KBStick issues a warning if you don't you need not assign a quit # key at all. # # KBS_Quit_Button=$KBS_Button_7 # Assign a Dead Zone around the center all your joystick axes. # This is really better done with a calibrator like jscal from the # Linux Joystick Driver distribution. # #export KBS_Dead_Zone=500 # Export the shell variables to the environment... # export KBS_Axis_0_Plus KBS_Axis_1_Plus #export KBS_Axis_2_Plus KBS_Axis_3_Plus #export KBS_Axis_4_Plus KBS_Axis_5_Plus export KBS_Axis_0_Minus KBS_Axis_1_Minus #export KBS_Axis_2_Minus KBS_Axis_3_Minus #export KBS_Axis_4_Minus KBS_Axis_5_Minus export KBS_Button_0 KBS_Button_1 KBS_Button_2 KBS_Button_3 export KBS_Button_4 KBS_Button_5 KBS_Button_6 KBS_Button_7 export KBS_Button_8 KBS_Button_9 KBS_Button_10 KBS_Button_11 export KBS_Quit_Button # ...And run KBStick in the background. # This command line assumes KBStick is in your path and that /dev/js0 is the # joystick that you are using. # ./kbstick /dev/js0 & # The End