A WASM module-based Server and a full Client API combination.
This project is geared towards other MSFS developers/coders who need a convenient way to remotely access parts of the Simulator which are normally inaccessible via SimConnect, such as some variable types and 'H' events, and running RPN "calculator code" directly on the sim.
The Client API can be utilized natively from C++, or via .NET managed assembly from C#, Python, or other languages.
The system also provides direct access to functions from within the Simulator environment and in many cases could be used as a simpler alternative to SimConnect for basic functionality like reading/setting Simulation Variables or triggering Key Events. SimConnect is still used as the network "transport" layer, but this usage is abstracted into, essentially, an implementation detail.
One of the motivations for this project was seeing multiple MSFS tool authors and casual hackers creating their own WASM modules and protocols just to support their own product or need. There is nothing wrong with this, of course, but for the Sim user it can be a disadvantage on several levels. They may end up running multiple versions of modules which all do essentially the same thing, and it may be confusing which WASM module they need to support which tool, just to name two obvious issues. For the developer, programming the WASM modules comes with its own quirks, too, not to mention the time involved. And regardless of the supposed isolated environment a WASM module is supposed to run in, it's still very easy to take down the whole Simulator with some errant code... ;-)
Since MS/Asobo have been, ahem, "slow" to add further remote access features to SimConnect (or come up with some other method), this project is an attempt at establishing a "standard" or "common" way of doing so. At the least I hope it motivates some kind of standards adoption.
On a more practical note, I am using it with the MSFS Touch Portal Plugin which I'm currently maintaining.
format_calculator_string()
using RPN String FormattingSimConnect_MapClientEventToSimEvent(id, "event_name")
and SimConnect_TransmitClientEvent(id)
..
(period) as per SimConnect convention), or derive from the connected Client's name (to ensure uniqueness).SimConnect_TransmitClientEvent_EX1()
).
Over in the Releases there are 3 packages provided. (The actual file names have version numbers appended.)
WASimCommander_SDK
- All header files, pre-built static and dynamic libs, packaged WASM module, pre-build GUI, reference documentation, and other tools/examples.WASimModule
- Just the WASM module component, ready to be dropped into a MSFS Community folder.WASimUI
- Just the GUI application, which is very handy in combination with the WASM module for exploring the system.Watch -> Custom -> Releases this repo (button at top) or subscribe to the ATOM feed for release notifications.
Update announcements are also posted on my Discord server's WASimCommander release announcement channel.
The SDK and updates are published on Flightsim.to where one could "subscribe" to release notifications (account required).
There are three basic console-style tests/examples included for C++
, C#
, and Python
in the src/Testing folder. If you like reading code, this is the place to start.
API documentation generated from source comments is published here: https://wasimcommander.max.paperno.us/
A good place to start with the docs is probably the WASimClient
page.
The GUI is written in C++ (using Qt library for UI), and while not the simplest example, is a full implementation of almost all the available API features. The main WASimClient
interactions all happen in the MainWindow::Private
class at the top of the WASimUi.cpp file.
More to come... or Just Read The Source :-)
Please note that when using the .NET builds in your project, it is vital to include the Ijwhost.dll
in your runtime directory along with WASimCommander.WASimClient.dll
.
While the latter will get copied to your build output automatically as a dependency, the Ijwhost.dll
will not. This will result in a runtime error that says ‘Could not load file or assembly 'WASimCommander.WASimClient.dll’. The specified module could not be found.` even though it is clearly there in the runtime directory.
Likewise you will probably want to copy the default client_conf.ini
configuration file to your build output/runtime as well (this file defines some default options like logging).
Both files should be included in the build as "content" files. This can be done via the VS UI or by editing the project file directly. As an example, assuming you copied the WASimCommander managed libraries to a ./lib
folder of your source, the following two entries from a .csproj file illustrate the settings:
To check status of the WASM module, enable Developer Mode in MSFS, show the "WASM Debug" window (Options -> WASM) and check if the module shows up in the list in that window. If not, then it's not installed. If it does and any of the text is RED, it is installed but crashed for some reason (let me know!). If the text is green then everything is good on that side.
Also in Dev Mode, check the Console for messages. It may show MSFS errors related to the module, and the module itself logs to the console as well. There should be 2 console log messages from the module when it starts up, the latter showing the version number.
The module also logs to a file, though it's a bit tricky to find. On my edition (from MS store) the "working directory" for the modules is
D:\WpSystem\S-1-5-21-611220451-769921231-644967174-1000\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\packages\wasimcommander-module\work
To enable more verbose logging on the module at startup, edit the server_conf.ini
file which is found in the module's install folder (Community\wasimcommander-module\modules
). There are comments in there indicating the options.
Keep in mind that the server logging level can also be changed remotely at runtime, but of course that only works if you can establish a connection to the module in the first place.
Basically the log is the primary source of information here. By default it logs at the "Info" level to: 1) The current console window, assuming there is one (the host app is started from a console). So if using WASimUI
, for example, just start it from a command prompt. 2) A file in whatever current directory it is running in (so, for the UI, that would be the UI's install folder).
Of course if you're using WASimUI
, it also provides a full logging interface and you can set all the log levels from there, for both client and server sides.
There should also be a client_conf.ini
file alongside whatever is using the Client where initial logging location, levels and network configuration (timeout and SimConnect.cfg index) is set. The config file has comments indicating the available options.
The GitHub repository is the primary source of all these things. You know what to do...
Use the Issues feature for bug reports and concise feature suggestions.
Use Discussions for any other topic.
There is also a Discord support forum on my server, along with release announcement and general chat channels.
Most flight simulator forums seem fairly strict about not using their site to provide product support. So please use GitHub, unless you're absolutely sure no rules would be broken or toes stepped upon otherwise.
This project is written, tested, and documented by myself, Maxim (Max) Paperno.
https://github.com/mpaperno/
Uses and includes a slightly modified version of logfault by Jarle Aase, used under the MIT license. Changes documented in the code.
Uses and includes IniPP by Matthias C. M. Troffaes, used under the MIT license.
Uses the Microsoft SimConnect SDK under the terms of the MS Flight Simulator SDK EULA (11/2019) document.
WASimUI (GUI):
FilterTableHeader
and FilterLineEdit
components from DB Browser for SQLite under GPL v3 license.MultisortTableView
from https://github.com/dimkanovikov/MultisortTableView under GPL v3 license.Documentation generated with Doxygen and styled with the most excellent Doxygen Awesome.
WASimCommander Project
COPYRIGHT: Maxim Paperno; All Rights Reserved.
Dual licensed under the terms of either the GNU General Public License (GPL) or the GNU Lesser General Public License (LGPL), as published by the Free Software Foundation, either version 3 of the Licenses, or (at your option) any later version.
Licensed under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Copies of the GNU GPL and LGPL are included with this project and are available at http://www.gnu.org/licenses/.
Except as contained in this copyright notice, the names of the authors or their institutions shall not be used in advertising or otherwise to promote the sale, use, or other dealings in, any product using this Software, or any derivative of this Software, without prior written authorization from the authors.
This project may also use 3rd-party Open Source software under the terms of their respective licenses. The copyright notice above does not apply to any 3rd-party components used within.