{"id":15036283,"url":"https://github.com/mpaperno/wasimcommander","last_synced_at":"2025-04-09T23:23:37.785Z","repository":{"id":39695786,"uuid":"506854285","full_name":"mpaperno/WASimCommander","owner":"mpaperno","description":"WASM Module and developer API for remote access to the Microsoft Flight Simulator 2020 \u0026 2024 \"Gauge API\" functions.","archived":false,"fork":false,"pushed_at":"2024-11-30T02:33:46.000Z","size":4893,"stargazers_count":48,"open_issues_count":2,"forks_count":10,"subscribers_count":7,"default_branch":"next","last_synced_at":"2025-03-24T01:12:51.905Z","etag":null,"topics":["cpp-library","csharp-library","microsoft-flight-simulator","microsoft-flight-simulator-2020","microsoft-flight-simulator-2024","msfs","msfs-dev","msfs2020","msfs2024","python-library","simconnect","wasm"],"latest_commit_sha":null,"homepage":"http://wasimcommander.max.paperno.us/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpaperno.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.GPL.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-24T02:34:27.000Z","updated_at":"2025-03-13T13:28:17.000Z","dependencies_parsed_at":"2023-11-11T20:26:22.424Z","dependency_job_id":"dbd33a70-735e-4a8f-be3f-a84f57aea090","html_url":"https://github.com/mpaperno/WASimCommander","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpaperno%2FWASimCommander","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpaperno%2FWASimCommander/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpaperno%2FWASimCommander/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpaperno%2FWASimCommander/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpaperno","download_url":"https://codeload.github.com/mpaperno/WASimCommander/tar.gz/refs/heads/next","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248126931,"owners_count":21052105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp-library","csharp-library","microsoft-flight-simulator","microsoft-flight-simulator-2020","microsoft-flight-simulator-2024","msfs","msfs-dev","msfs2020","msfs2024","python-library","simconnect","wasm"],"created_at":"2024-09-24T20:30:42.543Z","updated_at":"2025-04-09T23:23:37.748Z","avatar_url":"https://github.com/mpaperno.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/mpaperno/WASimCommander?include_prereleases)](https://github.com/mpaperno/WASimCommander/releases)\n[![GPLv3 License](https://img.shields.io/badge/license-GPLv3-blue.svg)](LICENSE.GPL.txt)\n[![LGPGv3 License](https://img.shields.io/badge/license-LGPLv3-blue.svg)](LICENSE.LGPL.txt)\n[![API Documentation](https://img.shields.io/badge/API-Documentation-07A7EC?labelColor=black)](https://wasimcommander.max.paperno.us/)\n[![Discord](https://img.shields.io/static/v1?style=flat\u0026color=7289DA\u0026\u0026labelColor=7289DA\u0026message=Discord%20Chat\u0026label=\u0026logo=discord\u0026logoColor=white)](https://discord.gg/meWyE4dcAt)\n\n\n# WASimCommander\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://github.com/mpaperno/WASimCommander/wiki/images/logo/WASim-Logo_640x160.png\" style=\"width: auto;\" /\u003e\n\u003c/div\u003e\n\n## Remote access to the Microsoft Flight Simulator 2020 \u0026 2024 \"Gauge API.\"\n\n**A WASM module-based Server and a full Client API combination.**\n\nThis project is geared towards other MSFS developers/coders who need a convenient way to remotely access parts of the Simulator which are normally\ninaccessible via _SimConnect_, such as some variable types and 'H' events, and running RPN \"calculator code\" directly on the sim.\n\nThe Client API can be utilized natively from C++, or via .NET managed assembly from C#, Python, or other languages.\n\nThe system also provides direct access to functions from within the Simulator environment and in many cases could be used as a simpler alternative\nto _SimConnect_ for basic functionality like reading/setting Simulation Variables or triggering Key Events. _SimConnect_ is still used as the network\n\"transport\" layer, but this usage is abstracted into, essentially, an implementation detail.\n\n### Motivation\n\nOne 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\nown 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\nmultiple versions of modules which all do essentially the same thing, and it may be confusing which WASM module they need to support which tool,\njust to name two obvious issues. For the developer, programming the WASM modules comes with its own quirks, too, not to mention the time involved.\nAnd 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\nsome errant code... ;-)\n\nSince 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\nat establishing a \"standard\" or \"common\" way of doing so. At the least I hope it motivates _some_ kind of standards adoption.\n\nOn a more practical note, I am using it with the [MSFS Touch Portal Plugin](https://github.com/mpaperno/MSFSTouchPortalPlugin) which I'm currently maintaining.\n\n-------------\n### Features\n\n#### Remote Capabilities\n- **Execute Calculator Code**:\n    - With or without a returned result; Result returned as numeric and string types.\n    - Formatted results from `format_calculator_string()` using\n      [RPN String Formatting](https://docs.flightsimulator.com/html/Additional_Information/Reverse_Polish_Notation.htm#strings)\n- **Get Variable**: Return value result from any type of variable accessible to a standalone WASM module\n    (basically everything but Gauge and Instrument types, but also including Token vars).\n    - With optional Unit specifier for variable types which support it.\n- **Set Variable**: Set the value of any settable variable type, with optional Unit specifier for variable types which support it.\n- **Create Variable**: Create (and get/set) a new Local variable if it doesn't already exist.\n- **List Local Variables**: Get a list of all available 'L' variables with their names and current IDs.\n- **Lookup**: Return a numeric ID for a SimVar/Local/Token variable, Unit, or Key Event name.\n- **Subscribe** to _Calculator Code_ and _Get Variable_ results:\n    - Get \"push\" notifications whenever result values change; Change monitoring can be configured at any rate down to the millisecond (~25ms minimum).\n        Can also be configured to use the \"delta epsilon\" feature of SimConnect (to ignore insignificant changes in value) or, conversely, to always send\n        updates even when values do not change.\n    - Optionally perform manual (\"polled\") updates of subscriptions at any interval of your choice.\n    - Any calculator code saved in subscriptions is **pre-compiled to a more efficient byte code** representation before being passed to the respective calculator\n        functions. This significantly improves performance for recurring calculations.\n- **Register Named Events**:\n    - Save recurring \"set events,\" like activating controls using calculator code, for more efficient and simpler re-use.\n        Saved calculator code is pre-compiled to a more efficient byte code representation before being passed to the calculator function.\n        This significantly improves performance for recurring events.\n    - Registered events can be executed \"natively\" via _WASim API_ by simply sending a short command with the saved event ID.\n    - Saved events can also be named and executed via standard SimConnect commands `SimConnect_MapClientEventToSimEvent(id, \"event_name\")` and `SimConnect_TransmitClientEvent(id)`.\n    - Event names can be completely custom (including a `.` (period) as per SimConnect convention), or derive from the connected Client's name (to ensure uniqueness).\n- **Send Simulator \"Key Events\"** directly by ID or name (instead of going through the SimConnect mapping process or executing calculator code). Much more efficient than the other methods.\n    - **New in v1.1.0:** Send Key Events with up to 5 values (like the new `SimConnect_TransmitClientEvent_EX1()`).\n    - **New in v1.3.0:** Send Custom Key Events (the ones with a \".\" in the name that are defined by particular models) by name or ID with up to 5 values.\n- **Remote Logging**: Log messages (errors, warnings, debug, etc) can optionally be sent to the Client, with specific minimum level (eg. only warnings and errors).\n- **Ping** the Server to check that the WASM module is installed and running before trying to connect or use its features.\n\n#### Core Components\n- WASM module-based Server supports multiple simultaneous, independent client connections.\n- Full-featured Client implementation available as a C++ library and a C#/.NET assembly.\n- Well-defined message API for communication between Server module and any client implementation.\n- Uses standard SimConnect messages for the base network \"transport\" layer.\n- All data allocations are on client side, so SimConnect limits in WASM module are bypassed (can in theory support unlimited clients).\n- No wasted data allocations, each data/variable subscription is stored independently avoiding complications with offsets or data overflows.\n- Minimum possible impact on MSFS in terms of memory and CPU usage; practically zero effect for Sim user when no clients are connected (Server is idle).\n- Server periodically checks that a client is still connected by sending \"heartbeat\" ping requests and enforcing a timeout if no response is received.\n- Extensive logging at configurable levels (debug/info/warning/etc) to multiple destinations (file/console/remote) for both Server and Client.\n    - Uses an efficient **lazy logging** implementation which doesn't evaluate any arguments if the log message will be discarded anyway\n    (eg. a DEBUG level message when minimum logging level is INFO).\n    - Logging levels can be set at startup via config files and changed at runtime for each facility (including remotely on the server).\n- Includes a SimConnect request/exception tracking feature for detailed diagnostics.\n- Extensive documentation for core API and all Client library features.\n- Efficiency and runtime safety are core requirements.\n\n#### Desktop GUI\n- Includes a full-featured desktop application which demonstrates/tests all available features of the API.\n- Fully usable as a standalone application which saves preferences, imports/exports lists of data subscriptions/registered events, and other friendly features.\n- Very useful for \"exploring\" the simulator in general, like checking variable values, testing effects of key events and RPN calculator code.\n- Can be used with the [MSFS/SimConnect Touch Portal Plugin](https://github.com/mpaperno/MSFSTouchPortalPlugin) for import/export of custom variable request definitions.\n\n\u003cp\u003e \u0026nbsp; \u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://github.com/mpaperno/WASimCommander/wiki/images/gui/wasimui-dark-new-v1005.png\"\u003e\u003cimg src=\"https://github.com/mpaperno/WASimCommander/wiki/images/gui/wasimui-dark-new-v1005.png\" style=\"width: 65%;\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n\u003cp\u003e \u0026nbsp; \u003c/p\u003e\n\n\n-------------\n### Downloads and Updates\n\nOver in the [Releases](https://github.com/mpaperno/WASimCommander/releases) there are 3 packages provided. (The actual file names have version numbers appended.)\n- `WASimCommander_SDK` - All header files, pre-built static and dynamic libs, packaged WASM module, pre-build GUI, reference documentation, and other tools/examples.\n- `WASimModule` - Just the WASM module component, ready to be dropped into a MSFS _Community_ folder.\n- `WASimUI` - Just the GUI application, which is very handy in combination with the WASM module for exploring the system.\n\n_Watch_ -\u003e _Custom_ -\u003e _Releases_ this repo (button at top) or subscribe to the [ATOM feed](https://github.com/mpaperno/WASimCommander/releases.atom) for release notifications.\n\nUpdate announcements are also posted on my Discord server's [WASimCommander release announcement channel](https://discord.gg/StbmZ2ZgsF).\n\nThe SDK and updates are [published on Flightsim.to](https://flightsim.to/file/36474/wasimcommander) where one could \"subscribe\" to release notifications (account required).\n\n-------------\n### Documentation \u0026 Examples\n\nThere are three basic console-style tests/examples included for `C++`, `C#`, and `Python` in the [src/Testing](https://github.com/mpaperno/WASimCommander/tree/main/src/Testing) folder.\nIf you like reading code, this is the place to start.\n\nAPI documentation generated from source comments is published here: https://wasimcommander.max.paperno.us/ \u003cbr/\u003e\nA good place to start with the docs is probably the [`WASimClient`](https://wasimcommander.max.paperno.us/class_w_a_sim_commander_1_1_client_1_1_w_a_sim_client.html) page.\n\nThe 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\nAPI features. The main `WASimClient` interactions all happen in the `MainWindow::Private` class at the top of the\n[WASimUi.cpp](https://github.com/mpaperno/WASimCommander/tree/main/src/WASimUI/WASimUI.cpp#L80) file.\n\nMore to come... or [Just Read The Source](https://github.com/mpaperno/WASimCommander/tree/main/src) :-)\n\n#### Using .NET Libraries\n\nPlease 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`.\n\nWhile 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\n`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.\n\nLikewise 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).\n\nBoth 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.\nAs an example, assuming you copied the WASimCommander managed libraries to a `./lib` folder of your source, the following two entries\nfrom a .csproj file illustrate the settings:\n\n```xml\n  \u003cContentWithTargetPath Include=\".\\lib\\WASimCommander\\Ijwhost.dll\"\u003e\n    \u003cCopyToOutputDirectory\u003ePreserveNewest\u003c/CopyToOutputDirectory\u003e\n    \u003cTargetPath\u003eIjwhost.dll\u003c/TargetPath\u003e\n  \u003c/ContentWithTargetPath\u003e\n  \u003cContentWithTargetPath Include=\".\\lib\\WASimCommander\\client_conf.ini\"\u003e\n    \u003cCopyToOutputDirectory\u003ePreserveNewest\u003c/CopyToOutputDirectory\u003e\n    \u003cTargetPath\u003eclient_conf.ini\u003c/TargetPath\u003e\n  \u003c/ContentWithTargetPath\u003e\n```\n\n-------------\n### Troubleshooting\n\n#### WASM Module\nTo check status of the WASM module, enable Developer Mode in MSFS, show the \"WASM Debug\" window (_Options_ -\u003e _WASM_) and check if the module shows up\nin 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!).\nIf the text is green then everything is good on that side.\n\nAlso 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.\nThere should be 2 console log messages from the module when it starts up, the latter showing the version number.\n\nThe 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 \u003cbr/\u003e\n`D:\\WpSystem\\S-1-5-21-611220451-769921231-644967174-1000\\AppData\\Local\\Packages\\Microsoft.FlightSimulator_8wekyb3d8bbwe\\LocalState\\packages\\wasimcommander-module\\work`\n\nTo enable more verbose logging on the module at startup, edit the `server_conf.ini` file which is found in the module's install folder\n(`Community\\wasimcommander-module\\modules`). There are comments in there indicating the options.\n\nKeep in mind that the server logging level can also be changed remotely at runtime, but\nof course that only works if you can establish a connection to the module in the first place.\n\n#### WASimClient (or anything using it, like WASimUI)\n\nBasically the log is the primary source of information here. By default it logs at the \"Info\" level to:\n1) 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.\n2) A file in whatever current directory it is running in (so, for the UI, that would be the UI's install folder).\n\nOf 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.\n\nThere should also be a `client_conf.ini` file alongside whatever is using the Client\nwhere initial logging location, levels and network configuration (timeout and SimConnect.cfg index) is set.\nThe config file has comments indicating the available options.\n\n-------------\n### Issues, Support, Suggestions, Discussion\n\nThe GitHub repository is the primary source of all these things. You know what to do...\n\nUse the [Issues](https://github.com/mpaperno/WASimCommander/issues) feature for bug reports and concise feature suggestions.\n\nUse [Discussions](https://github.com/mpaperno/WASimCommander/discussions) for any other topic.\n\nThere is also a [Discord support forum](https://discord.gg/QhUDFX6Kun) on my server,\nalong with [release announcement](https://discord.gg/StbmZ2ZgsF) and [general chat](https://discord.gg/meWyE4dcAt) channels.\n\nMost flight simulator forums seem fairly strict about _not_ using their site to provide product support. So please use GitHub,\nunless you're absolutely sure no rules would be broken or toes stepped upon otherwise.\n\n-------------\n### Credits\n\nThis project is written, tested, and documented by myself, Maxim (Max) Paperno.\u003cbr/\u003e\nhttps://github.com/mpaperno/\n\nUses and includes a slightly modified version of [_logfault_ by Jarle Aase](https://github.com/jgaa/logfault), used under the MIT license. Changes documented in the code.\n\nUses and includes [_IniPP_ by Matthias C. M. Troffaes](https://github.com/mcmtroffaes/inipp), used under the MIT license.\n\nUses the _Microsoft SimConnect SDK_ under the terms of the _MS Flight Simulator SDK EULA (11/2019)_ document.\n\nWASimUI (GUI):\n- Uses portions of the [_Qt Library_](http://qt.io) under the terms of the GPL v3 license.\n- Uses and includes the following symbol fonts for icons, under the terms of their respective licenses:\n  - [IcoMoon Free](https://icomoon.io/#icons-icomoon) - IcoMoon.io, GPL v3.\n  - [Material Icons](https://material.io/) - Google, Apache License v2.0.\n- Uses modified versions of `FilterTableHeader` and `FilterLineEdit` components from [DB Browser for SQLite](https://github.com/sqlitebrowser/sqlitebrowser) under GPL v3 license.\n- Uses modified version of `MultisortTableView` from \u003chttps://github.com/dimkanovikov/MultisortTableView\u003e under GPL v3 license.\n- Uses Natural (alpha-numeric) sorting algorithm implementation for _Qt_ by Litkevich Yuriy (public domain).\n\n\nDocumentation generated with [Doxygen](https://www.doxygen.nl/) and styled with the most excellent [Doxygen Awesome](https://jothepro.github.io/doxygen-awesome-css).\n\n-------------\n### Copyright, License, and Disclaimer\n\nWASimCommander Project \u003cbr /\u003e\nCOPYRIGHT: Maxim Paperno; All Rights Reserved.\n\n#### API Library and Client Components\nDual licensed under the terms of either the GNU General Public License (**GPL**)\nor the GNU Lesser General Public License (**LGPL**), as published by the Free Software\nFoundation, either **version 3** of the Licenses, or (at your option) any later version.\n\n#### WASM Module Server and GUI Components\nLicensed under the terms of the GNU General Public License (**GPL**) as published by\nthe Free Software Foundation, either **version 3** of the License, or (at your option)\nany later version.\n\n#### General\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nCopies of the GNU GPL and LGPL are included with this project\nand are available at \u003chttp://www.gnu.org/licenses/\u003e.\n\nExcept as contained in this copyright notice, the names of the authors or\ntheir institutions shall not be used in advertising or otherwise to\npromote the sale, use, or other dealings in, any product using this\nSoftware, or any derivative of this Software, without prior written\nauthorization from the authors.\n\nThis project may also use 3rd-party Open Source software under the terms\nof their respective licenses. The copyright notice above does not apply\nto any 3rd-party components used within.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpaperno%2Fwasimcommander","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpaperno%2Fwasimcommander","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpaperno%2Fwasimcommander/lists"}