This is an Autohotkey script and supporting dlls that allows much more programmability of the Saitek X52 than the software provided by Saitek, and in the meantime also works around the issues R5 has with the X52.
*update*
The .dll that gets raw data from the X52 seems to have some issues on X64 systems. I will look into that. In the meantime, I've posted X52AllegianceThrottleMapNoX52DLL-Release.ahk to the share linked below. This does not make use of the X52 dll that was causing problems, but also does not allow data about the mouse stick or the scroll wheel to be collected.
*update 2*
After more testing, I've discovered that you get better utility by allowing SST to send keystrokes for some of the axes, rather than trying to do this myself. This means that the mode switch isn't available to the autohotkey script, but it does simplify the setup procedure. I probably could just use the X52AllegianceThrottleMapNoX52DLL-Release.ahk script, but I spent too much time working out the DLL to not use it anymore.
This script implements the following features:
- Joystick button press at throttle full forward
- Joystick button press at throttle full back
- POV hat up mapped to PPJoy POV
- All other buttons on the X52 mapped straight to PPJoy button presses except the Mode Switch, Wheel Up, Wheel Down and Wheel Click
For the throttle full forward and back button press feature, this script remaps the throttle axis so that 0% is at the idle detent and 100% is at the afterburner detent. Moving the throttle to the full forward position will cause a joystick button press to register, as will moving the throttle to the full back position.
In the script comments, there are examples of a dual stage trigger button press de-coupler. This causes button 1 to stop being pressed when the trigger is fully depressed. Additionally, there is a timer so that button 1 has to be held for 250 ms before the button press registers. This is to enables the second stage trigger press to be registered without registering the first stage trigger press.
This script makes use of a DLL that is very specific to the X52. This DLL could be easily adapted to work with other USB joysticks, so the source code is also attached. This DLL is heavily derived from the HClient sample program in the Window Device Driver Kit, and might be useful to people looking for examples of how to work with HID reports.
This script also makes use of a PPJoy.dll that enables multiple PPJoy virtual joysticks to be used within the same script. This was originally because the X52 has more than 32 buttons to press, and I wanted to use more than one virtual joystick to contain them all. However, multiple PPJoy joysticks turned out not to be supported by Allegiance, so the usefulness of this might not be obvious in the script. Nevertheless, the source for this is also included in case anybody finds that useful as well.
The PPJoy.dll was adapted from the one published by ninjabob7 on the autohotkey.com forums here:
http://www.autohotkey.com/forum/topic52913...highlight=ppjoy
Download:
http://cid-51fc5ec244cdf7f3.skydrive.live....4CDF7F3!144
Installation:
1. Install autohotkey (
http://www.autohotkey.com/)
2. Install PPJoy (
http://rapidshare.com/#!download|118tl3 ... e.exe|2173)
3. Configure PPJoy Joystick
3.1 Goto "Start|All Programs|PPJoy Joystick Driver", and click on "Configure Joysticks"
3.2 In the Joystick Configuration Utility, click "Add"
3.3 Select "Controller 1" and click Add
3.4 Select "PPJoy Virtual Joystick 1" and click "Mapping"
3.5 Select the "Modify the mapping ..." radio button and click "Next"
3.6. Set the controller to "4 Axes, 32 buttons, 1 POV hat"
3.7 Map Axis 1 to X Axis; Axis 2 to Y Axis; Axis 3 to Throttle; and Axis 4 to rudder
3.8 Click "next"
3.9 Map X Axis to Analog 0; Y Axis to Analog 1; Throttle to Analog 2; Rudder to Analog 3
3.10 click "next"
3.11 click "next" again to get to mappings for buttons 17-32
3.12 map "Button N" to "Digital N-1" for buttons 17-32
3.13 click "next"
3.14 eat pie
3.15 map North to Digital 32; East to Digital 33; West to Digital 34; South to Digital 35
Step 4 was made obsolete when I stopped trying to capture the mini-stick, mode, and wheel turns myself
4. Replace Saitek HID driver with Microsoft generic driver
4.0 Make certain X52 is plugged in
4.1 Open device manager
4.2 Expand "Human Interface Devices" section
4.3 Right click on Saitek Device, select "properties"
4.4 On HID-compliant game controller Properties dialog, go to the "Driver" tab, and click "Update Driver"
4.5 On "Update Driver Software" dialog, click "Browse computer ..."
4.6 On "Update Driver Software" dialog, click "Let me pick ..."
4.7 On "Update Driver Software" dialog, select "HID-compliant game controller", then click "next"
5. Unzip "X52AllegianceThrottleMap" to a convenient directory
6. Run "X52AllegianceThrottleMap+SST-Release.ahk"
7. Do any SST programming you might want for the rotaries, slider, mini-stick and the wheel
8. Enjoy using your X52 in Alleg