FSConnect
by Russel Dirks
russdirks@yahoo.ca
www.dirks-software.ca
Version 3.00
FSConnect is a module that gets loaded by Microsoft Flight Simulator (MSFS) and interacts with
third-party programs (clients), providing data regarding the user aircraft. Version 3.00 adds support for XML expressions, as well as the ability to
generate key events by which you can control the user aircraft and certain aspects of the simulator. See the Version History section
below for more info.
FSConnect adds no functionality to MSFS, nor does it add anything to the user interface. The only reason to have this program on your system is if it is required by third-party
programs that you use.
Installation
Simply copy FSConnect.dll into your FS200x\MODULES folder.
That's all there is to it for general users. The remainder of this documentation will be of use mainly to developers.
For Developers
FSConnect comes with a Software Development Kit (SDK), comprised of this documentation, sample programs, and source
code that you can add to your application to facilitate data exchange with FS. Currently the source
code is available in Visual Basic, C++ and Delphi. The VB and C++ code was written by myself, whereas the
Delphi code was contributed by Rudolf Schider. If your application is in another language, you will
have to port the code over to that language.
Function Summary
The SDK provides the following functions. Note that the source code contains
detailed comments for each function. Also, the SDK contains sample programs that show how to call each of the following functions.
fscGetLatitude, fscGetLongitude - these are simple high-level functions you can call to retrieve the latitude/longitude of the user aircraft.
fscGetVar - this is a general purpose data query function. It exposes the function lookup_var, which is part of the Panels & Gauges SDK (P&G). You pass in a token to indicate which data item you want back. See the file TokenVar.doc in the reference folder for a complete list of tokens. Note that each token is marked with a letter : either N, D, O, B, F, E, or P. The letter indicates the data type of the returned data. Note that for items marked with a "P", you call the next function, fscGetString, not this function.
fscGetString - this is similar to the previous function. Only use it to retrieve items marked with "P" in TokenVar.doc
fscGetVersions - this retrieves the version of FSConnect currently loaded, the version of MSFS, and the name of the MSFS exe file, eg "FS2004.exe"
fscTriggerKeyEvent - this is a new function for version 3.00. It exposes the function trigger_key_event , which is part of the P&G SDK. It allows you to control pretty much any aspect of the user aircraft. For instance, you can manipulate the flight controls, or any of the instruments on the panel. You can also manipulate certain aspects of the simulator. See the file EventIDs.doc, located in the reference folder, for a complete list of event IDs you can use.
fscGetXMLVar - this is another new function for version 3.00. It exposes the function execute_calculator_code , which is part of the P&G SDK. It takes as an input parameter any valid XML expression, and returns the result. This basically allows you to retrieve various data items regarding the user aircraft and the simulator itself. There is about 95% overlap between what you can get with this function and what you can get with fscGetVar. There are however a few unique things you can get with this function, such as the name of the user aircraft. See the file Parameters.doc located in the reference folder for a complete list of XML variables that you can query.
fscSetLatitude, fscSetLongitude - these only work in FS2002 and earlier.
fscMemRead, fscMemWrite - these functions allow you to read or write from/to any location within the MSFS address space.
fscSearchMemRange, fscSearchMemAll - these two functions allow you to search for specific data within the MSFS address space.
Version History
Aug 2005 - Version 3.00
- Added a new function, fscTriggerKeyEvent, which allows you to control the user aircraft, and many aspects of the simulator.
- FSConnect now supports XML expressions. You can finally find out what aircraft the user is flying!
- ALERT Delphi developers! I changed the parameter declarations for fscGetLatitude, fscGetLongitude, and fscGetVar. If you had previous Delphi code that worked with version 2.01, it probably won't compile now. You can either modify your code, or if that's too much of a pain, you can simply change the code in FSConnect.pas back the way it was so it matches your code.
- changed the license agreement for developers, to allow them to package and distribute FSConnect with their applications.
Feb 2005 - Version 2.01
- FSConnect now contains a Delphi interface provided by Rudolf Schider. (www.schider.com) The DLL is unchanged.
May 2004 - Version 2.00a
- Fixed memory leak in the client code. Note : the DLL is not affected by this bug, and is unchanged from version 2.00. If you're not a developer, this version has nothing new for you. If you are a developer and you've written an application that uses FSConnect, you can either simply swap out the old FSConnect.cpp / FSConnect.bas and swap in the new ones, and then recompile your application, or you can hand edit the code : simply change every occurrence of DeleteAtom to GlobalDeleteAtom. That's it.
- Memory Leak Info. The memory leak occurs on the client side. FSConnect uses atoms to pass data back and forth, but due to a bug in the code, atoms Mere not being deleted properly. I was using DeleteAtom instead of GlobalDeleteAtom. If many, many data queries were executed, eventually Windows would run out of memory and start passing back corrupted data. The fix is to use GlobalDeleteAtom to delete atoms.
Augustt 2003 - Version 2.00
- adapted FSConnect for FS2004
- note: writing lat/lon into FS2004 does not produce the desired effect :-(
- fixed a few bugs in the SDK code. If you have already incorporated the previous code in your application, simply replace FSConnect.bas or FSConnect.cpp with the new versions. Nothing else changed. The interface was not changed.
June 2003 - Version 1.00
- initial release
Credits
- "Bruce Software", for his sample code of a skeleton module.
- Rudolf Schider, for porting the interface functions over to Delphi. Thank-you Rudolf! (www.schider.com)
License - General Users
FSConnect, associated documents and files, are copyright © 2005 by Russel Dirks. FSConnect is distributed as Freeware. Use this program at your own risk. The author accepts no liability for damage (real or imagined) caused to your computer while using this program.
License & Distribution - Developers
You may use FSConnect.dll as an interface between FS and your application. You may use and adapt any source code in this package for use in your application. You may package and distribute FSConnect.dll with your product, with appropriate credits in your documentation, including a reference to my web site, www.dirks-software.ca.