Saitek X52 Pro MFD plugin - Version 1.1
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Saitek X52 Pro MFD plugin - Version 1.1
Saitek X52 Pro MFD plugin
Version 1.1 update
Changes:
- Added new MFD page: Compatible missiles - useful for people like me who sometimes have no idea which missiles are compatible with the current ship while looking at the missile stock in a station
- Changed money/min calculation formula, should be more accurate now
- Fixed Cargo and Equipped lists, they were not updating correctly
- (D) LED remained flashing red after you had low hull/shields and your shields recovered, fixed
- Fixed some bugs which could cause lockups in the MFD updater thread
Script SPK: http://www.mediafire.com/?4nyqv95jit4nsm3
Script zip: http://www.mediafire.com/?280yxn6to9eu02i
Application: http://www.mediafire.com/?dt20bwznd24sdpr
Use the SPK version with Cyrows plugin manager http://cycrow.thexuniverse.us/XPluginMa ... taller.exe, it works with AP!
Known problems:
- Incoming missiles damage warning is not working correctly, will be fixed in the next version
If you are updating from the V1.0 version simply overwrite the files with the new ones.
------------------------------------------------------------------------------------------------------------------
Here it is, the first release of my Saitek X52 plugin for X3:TC
There are 2 parts, an X3 AL script which exports game data and a windows application which interprets this data and displays the pages on the MFD and handles the LEDs.
MFD Pages:
Equipped missile page:
Type
Damage
Speed
Estimated travel time to target if fired
Stock in cargo hold
Flags (heat seaking, swarm, etc)
Player page:
Ship name / class
Hull numeric / %
Shield numeric / %
Laser energy numeric / %
Current money
Money change / minute (based on last hour played, SETA time is correctly handled)
Target page:
Name / class
Hull numeric / %
Shield numeric / % - normally these should need freight scanner but most of us know anyway that X ship has XY MJ/GJ shields normally, so I don't consider this a cheat
Enemy/Neutral/Friend
Incoming missiles page:
Closest missile:
Type
Damage
Speed
Estimated time until impact
- All incoming missiles:
Number incoming
Total damage
Cargo page:
List of goods in cargo hold
Equipped page:
List of equipped stuff on player ship
Left scroll wheel changes pages, right wheel scrolls text up/down.
Pressing the right wheel jumps to the top of the current page.
LED feedbacks:
Shield feedback:
T1/2 - 3/4 - 5/6 changes colors:
GGG 100 - 85
GGY 84 - 71
GYY 70 - 57
YYY 56 - 44
YYR 43 - 30
YRR 29 - 16
RRR 15 - 0
Hull feedback:
T1/2 - 3/4 - 5/6 flashing
No flashing 100
Very slow 99 - 80
Slow 79 - 60
Medium 59 - 40
Fast 39 - 20
Very fast 19 - 0
If you have shields<15% and hull<20% ALL LEDs will flash red.
If the shields power up only the T LEDs continue to flash until hull is repaired, all other LEDs resume normal operation.
(A) LED: Selected missiles str compared to target:
- off : no missile equipped
- green : will cause only shield damage
- yellow : will destroy shield and cause some hull damage
- red : will blow target to tiny little pieces
Fire LED:
- off: no missile equipped
- flashing speed shows targets range compared to equipped missiles range
- slow flash: target too far
- fast flash: target getting near enough
- on : target in range
POV2 LED: target status
- off : no target
- green : friendly
- yellow : neutral
- red : enemy
- red and flashing : enemy / stronger ship than yours (based on class/shield/hull)
(I) LED: closest incoming missile damage if hit:
- off : no incoming missile
- green flashing - only shield damage
- yellow flashing - hull damage expected
- red - you will not survive
(E) LED: all incoming missiles damage if all hit:
- off: no more incoming missile
- green flashing - only shield damage
- yellow flashing - hull damage expected
- red - you will not survive
(B) LED: Laser energy
- off : no weapons installed
- green: 100 - 75%
- yellow: 74 - 50 %
- red: 49 - 20 %
- red and flashing: <20%
(D) LED: ??? ideas welcome
Throttle LEDs: ship docked or 0 speed: off
ship moving : on
ship moving backward : flashing
About the app:
The 32bit version of the directoutput.dll is REQUIRED to run the application. At start, it will try to detect the correct path of the dll, looking for it in
- C:\Program Files (x86)\Saitek\DirectOutput\DirectOutput.dll or
- C:\Program Files\Saitek\DirectOutput\DirectOutput.dll
These are the default locations on 64bit and 32bit systems. If your saitek drivers are not installed to the default location or if your system drive is not C: it will fail to automatically locate the dll, you will need to tell it manually where it resides by pressing the Browse button. It can be anywhere, can have any name as long as you select the correct file. The one I have on my system is version 6.2.2.4, size 114688 bytes.
The same applies to the X3 log folder, it will try to look for it in [your documents folder]\Egosoft\X3TC. If you have your X3 logfiles (log*.txt) somewhere else hit the Browse button and select the correct folder.
After selecting the correct folders hit 'Save paths' and you won't have to do it again. (Saved to settings.ini)
If everything is OK, you should see a 'X52 Pro found and initialized!' message in the log window. If something goes wrong, it will display the error message also in the log window.
There is a 'ReInit' button. Hitting this will:
- Deinitialize the controller
- Unload the DLL
- Restart the Saitek directoutput service
- Load the DLL
- Initialize the controller
After a cycle, again, you should see the 'X52 Pro found and initialized!' message. Important: The ONLY supported device is the Saitek X52 Pro.
During testing, the DirectOutput library proved to be quite buggy. I tried to mitigate this by coding the app as fault-proof as possible, but still, problems, lockups can happen (but should be rare). If the MFD becomes unresponsive or the LEDs dont react correctly try to alt-tab out and hit the ReInit button. That should fix it and you can resume playing.
Known problems/limitations:
- If you change the current page using the left scroll the LEDs revert to the default state for a short time. This is because LED states are linked to the active page and a page change wipes the data, so they will all lit up until the next update cycle (which is every 50ms).
- Sometimes at a page chage the device does not send back data to the application (using the callback routine) so the app loses track of which is the currently active page. The sign of this is that all LEDs revert to the default state and dont do what they should. Changing the page again usually fixes it and normal operation is resumed. Again, this is a bug in the directoutput library.
- Changing LED brightness is not implemented currently. There is a function in the Saitek control panel for this, but its not documented/not included in the dll. Support for this - and better looking led effects - is possible in the future.
To develop my own dll wrapper I used documentation and code parts from other people, so they deserve credit for they work: Frederic Valery (Blackswift) and ellF (on saitekforum.com)
Some of the LED feedback ideas were taken from RotCurtSed's X3 Reunion plugin.
The scripts and the app is provided as-is: by using them you accept that I can't take responsibility if it sets your computer on fire, formats your harddrive or makes your girlfriend leave you. You were warned.
If you want to develop your own plugin contact me and I can send you source code. The app and the dll wrapper was written in delphi, compiled with RAD Studio 2010.
[ external image ] [ external image ]
Cheers,
Exi
Version 1.1 update
Changes:
- Added new MFD page: Compatible missiles - useful for people like me who sometimes have no idea which missiles are compatible with the current ship while looking at the missile stock in a station
- Changed money/min calculation formula, should be more accurate now
- Fixed Cargo and Equipped lists, they were not updating correctly
- (D) LED remained flashing red after you had low hull/shields and your shields recovered, fixed
- Fixed some bugs which could cause lockups in the MFD updater thread
Script SPK: http://www.mediafire.com/?4nyqv95jit4nsm3
Script zip: http://www.mediafire.com/?280yxn6to9eu02i
Application: http://www.mediafire.com/?dt20bwznd24sdpr
Use the SPK version with Cyrows plugin manager http://cycrow.thexuniverse.us/XPluginMa ... taller.exe, it works with AP!
Known problems:
- Incoming missiles damage warning is not working correctly, will be fixed in the next version
If you are updating from the V1.0 version simply overwrite the files with the new ones.
------------------------------------------------------------------------------------------------------------------
Here it is, the first release of my Saitek X52 plugin for X3:TC
There are 2 parts, an X3 AL script which exports game data and a windows application which interprets this data and displays the pages on the MFD and handles the LEDs.
MFD Pages:
Equipped missile page:
Type
Damage
Speed
Estimated travel time to target if fired
Stock in cargo hold
Flags (heat seaking, swarm, etc)
Player page:
Ship name / class
Hull numeric / %
Shield numeric / %
Laser energy numeric / %
Current money
Money change / minute (based on last hour played, SETA time is correctly handled)
Target page:
Name / class
Hull numeric / %
Shield numeric / % - normally these should need freight scanner but most of us know anyway that X ship has XY MJ/GJ shields normally, so I don't consider this a cheat
Enemy/Neutral/Friend
Incoming missiles page:
Closest missile:
Type
Damage
Speed
Estimated time until impact
- All incoming missiles:
Number incoming
Total damage
Cargo page:
List of goods in cargo hold
Equipped page:
List of equipped stuff on player ship
Left scroll wheel changes pages, right wheel scrolls text up/down.
Pressing the right wheel jumps to the top of the current page.
LED feedbacks:
Shield feedback:
T1/2 - 3/4 - 5/6 changes colors:
GGG 100 - 85
GGY 84 - 71
GYY 70 - 57
YYY 56 - 44
YYR 43 - 30
YRR 29 - 16
RRR 15 - 0
Hull feedback:
T1/2 - 3/4 - 5/6 flashing
No flashing 100
Very slow 99 - 80
Slow 79 - 60
Medium 59 - 40
Fast 39 - 20
Very fast 19 - 0
If you have shields<15% and hull<20% ALL LEDs will flash red.
If the shields power up only the T LEDs continue to flash until hull is repaired, all other LEDs resume normal operation.
(A) LED: Selected missiles str compared to target:
- off : no missile equipped
- green : will cause only shield damage
- yellow : will destroy shield and cause some hull damage
- red : will blow target to tiny little pieces
Fire LED:
- off: no missile equipped
- flashing speed shows targets range compared to equipped missiles range
- slow flash: target too far
- fast flash: target getting near enough
- on : target in range
POV2 LED: target status
- off : no target
- green : friendly
- yellow : neutral
- red : enemy
- red and flashing : enemy / stronger ship than yours (based on class/shield/hull)
(I) LED: closest incoming missile damage if hit:
- off : no incoming missile
- green flashing - only shield damage
- yellow flashing - hull damage expected
- red - you will not survive
(E) LED: all incoming missiles damage if all hit:
- off: no more incoming missile
- green flashing - only shield damage
- yellow flashing - hull damage expected
- red - you will not survive
(B) LED: Laser energy
- off : no weapons installed
- green: 100 - 75%
- yellow: 74 - 50 %
- red: 49 - 20 %
- red and flashing: <20%
(D) LED: ??? ideas welcome
Throttle LEDs: ship docked or 0 speed: off
ship moving : on
ship moving backward : flashing
About the app:
The 32bit version of the directoutput.dll is REQUIRED to run the application. At start, it will try to detect the correct path of the dll, looking for it in
- C:\Program Files (x86)\Saitek\DirectOutput\DirectOutput.dll or
- C:\Program Files\Saitek\DirectOutput\DirectOutput.dll
These are the default locations on 64bit and 32bit systems. If your saitek drivers are not installed to the default location or if your system drive is not C: it will fail to automatically locate the dll, you will need to tell it manually where it resides by pressing the Browse button. It can be anywhere, can have any name as long as you select the correct file. The one I have on my system is version 6.2.2.4, size 114688 bytes.
The same applies to the X3 log folder, it will try to look for it in [your documents folder]\Egosoft\X3TC. If you have your X3 logfiles (log*.txt) somewhere else hit the Browse button and select the correct folder.
After selecting the correct folders hit 'Save paths' and you won't have to do it again. (Saved to settings.ini)
If everything is OK, you should see a 'X52 Pro found and initialized!' message in the log window. If something goes wrong, it will display the error message also in the log window.
There is a 'ReInit' button. Hitting this will:
- Deinitialize the controller
- Unload the DLL
- Restart the Saitek directoutput service
- Load the DLL
- Initialize the controller
After a cycle, again, you should see the 'X52 Pro found and initialized!' message. Important: The ONLY supported device is the Saitek X52 Pro.
During testing, the DirectOutput library proved to be quite buggy. I tried to mitigate this by coding the app as fault-proof as possible, but still, problems, lockups can happen (but should be rare). If the MFD becomes unresponsive or the LEDs dont react correctly try to alt-tab out and hit the ReInit button. That should fix it and you can resume playing.
Known problems/limitations:
- If you change the current page using the left scroll the LEDs revert to the default state for a short time. This is because LED states are linked to the active page and a page change wipes the data, so they will all lit up until the next update cycle (which is every 50ms).
- Sometimes at a page chage the device does not send back data to the application (using the callback routine) so the app loses track of which is the currently active page. The sign of this is that all LEDs revert to the default state and dont do what they should. Changing the page again usually fixes it and normal operation is resumed. Again, this is a bug in the directoutput library.
- Changing LED brightness is not implemented currently. There is a function in the Saitek control panel for this, but its not documented/not included in the dll. Support for this - and better looking led effects - is possible in the future.
To develop my own dll wrapper I used documentation and code parts from other people, so they deserve credit for they work: Frederic Valery (Blackswift) and ellF (on saitekforum.com)
Some of the LED feedback ideas were taken from RotCurtSed's X3 Reunion plugin.
The scripts and the app is provided as-is: by using them you accept that I can't take responsibility if it sets your computer on fire, formats your harddrive or makes your girlfriend leave you. You were warned.
If you want to develop your own plugin contact me and I can send you source code. The app and the dll wrapper was written in delphi, compiled with RAD Studio 2010.
[ external image ] [ external image ]
Cheers,
Exi
Last edited by Exi on Sun, 5. Aug 12, 13:23, edited 5 times in total.
If you have a x52 you know the physical limits: 3 lines of text on each page (well, 3x16 chars, if you put in more it will scroll automatically), all the LED's can have 4 states: off, green, red or amber, except the missile fire and the throttle illumination, those 2 can only either on or off, no color control. It's possible to assign functions to the MFD's buttons like change page (Player data, Missile data, Target data, etc) or display a different value on the current page. I already have a working, multi-threaded LED control "engine", I only need to tell it "set LED X to red and blink it fast" and it will do until I command otherwise (5 blinking speeds possible), all LEDs are independent from eachother.
The Saitek control panel can control LED brightness too, I couldn't figure out that one, it's not documented. There is a 3rd party app written for linux that can do it, maybe I'll contact the author and ask him about details.
My only concern is the update frequency/timeout because there is no direct connection to the game engine, all data is aquired by using a script in X3 which will export data to a log file. This still needs testing, I dont know which is the lowest possible update frequency, but the timeout should be fairly low, I'm thinking about 2-500ms, that will feel almost realtime.
Other limitation from X3's side shouldn't occur: whatever it can export to a txt (log) file I can read with the plugin and display it or react to it somehow.
Exi
The Saitek control panel can control LED brightness too, I couldn't figure out that one, it's not documented. There is a 3rd party app written for linux that can do it, maybe I'll contact the author and ask him about details.
My only concern is the update frequency/timeout because there is no direct connection to the game engine, all data is aquired by using a script in X3 which will export data to a log file. This still needs testing, I dont know which is the lowest possible update frequency, but the timeout should be fairly low, I'm thinking about 2-500ms, that will feel almost realtime.
Other limitation from X3's side shouldn't occur: whatever it can export to a txt (log) file I can read with the plugin and display it or react to it somehow.
Exi
http://en.wikipedia.org/wiki/Pulse-width_modulationThe Saitek control panel can control LED brightness too, I couldn't figure out that one, it's not documented. There is a 3rd party app written for linux that can do it, maybe I'll contact the author and ask him about details.
2 MS way to fast, if your wiring to a log file every 2 MS, your taking up a ridiculous amount of cpu time - witch will cause the script engine to stall - especially in SetaMy only concern is the update frequency/timeout because there is no direct connection to the game engine, all data is aquired by using a script in X3 which will export data to a log file. This still needs testing, I dont know which is the lowest possible update frequency, but the timeout should be fairly low, I'm thinking about 2-500ms, that will feel almost realtime.
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire
-
- Posts: 3
- Joined: Sat, 16. Oct 10, 17:24
-
- Posts: 663
- Joined: Wed, 19. Oct 05, 14:07
-
- Posts: 3
- Joined: Sat, 16. Oct 10, 17:24
X3:Reunion is not supported in this release. It's possible that I'll do an update later but don't take this as a promise. There were working plugins for X3:R, heres RotCurtSed's original topic: http://www.saitekforum.com/showthread.php?t=13938
My aim was to create one for TC as I couldn't find any that is at least partially working, everyone who opened a topic regarding a new plugin gave up and never finished the work.
X52 non-pro is not supported and never will be. Sorry The 2 just look the same but the internals are completely different. As far as I know the non-pro doesn't have tri-state leds and the MFD can be used only with those programs (mainly MS Flight Sim series) that have built-in support. The SDK available from Saitek supports only the Pro model, thats what I worked with. So unless Saitek releases a SDK for the non-pro (they won't) its next to impossible to create software for it.
Cheers,
Exi
My aim was to create one for TC as I couldn't find any that is at least partially working, everyone who opened a topic regarding a new plugin gave up and never finished the work.
X52 non-pro is not supported and never will be. Sorry The 2 just look the same but the internals are completely different. As far as I know the non-pro doesn't have tri-state leds and the MFD can be used only with those programs (mainly MS Flight Sim series) that have built-in support. The SDK available from Saitek supports only the Pro model, thats what I worked with. So unless Saitek releases a SDK for the non-pro (they won't) its next to impossible to create software for it.
Cheers,
Exi
-
- Posts: 3
- Joined: Sat, 16. Oct 10, 17:24
You need Cycrow's plugin manager to be able to install SPK files: http://cycrow.thexuniverse.us/
The SPK contains the scripts that are needed to export in-game data from X3. Just download the plugin manager, install the SPK and done.
The SPK contains the scripts that are needed to export in-game data from X3. Just download the plugin manager, install the SPK and done.
Exi
good. i thought the process would much more complicated))
good. i thought the process would much more complicated))
Last edited by Giggzee on Sat, 27. Aug 11, 21:12, edited 1 time in total.
Just wanted to say thanks for this awesome app/script combo. I recently got an x52 Pro and being able to utilize its full functionality will be great.
Check out my mod Crystal Rarities
Kinnison - and possibly others having problems - try to download and run this build: X52 debug build
Just copy the file to the same folder where the original one resides.
Enable debug mode with the checkbox and use the buttons and everything like you normally would. A logfile will be created at logs\debug.log.
Send me that file in email and I'll compare with mine to see whats wrong.
Please provide your Saitek driver version as well.
It's possible that you are using a different driver/DLL and that changed the signals /data format the controller is using, in that case I'll need to add support for that in the app.
Just copy the file to the same folder where the original one resides.
Enable debug mode with the checkbox and use the buttons and everything like you normally would. A logfile will be created at logs\debug.log.
Send me that file in email and I'll compare with mine to see whats wrong.
Please provide your Saitek driver version as well.
It's possible that you are using a different driver/DLL and that changed the signals /data format the controller is using, in that case I'll need to add support for that in the app.