StandaloneModule
This sample project illustrates how you can make a single, "stand alone" WASM module that connects to SimConnect SDK without being "attached" to an object within the simulation world. The important part of this sample is found in the Sources/Code
folder, where you'll see a Visual Studio project that can then be compiled into a WASM module:
Once compiled the WASM module would be placed into the PackageSources
folder to be copied as part of the project, as shown in this project.
You can expand the link below to see the StandaloneModule
file and folder structure:
|---+ StandaloneModule |---+ PackageDefinitions
| |---+ mycompany-module-stabdalone
| | |---+ ContentInfo
| | |---- Thumbnail.jpg | |---- mycompany-module-standalone.xml |---+ PackageSources | |---+ modules | |---- standalonemodule.wasm |---+ Sources | |---+ Code | |---- Module.cpp | |---- Module.h | |---- StandaloneModule.sln | |---- StandaloneModule.vcxproj | |---- StandaloneModule.vcxproj.filters | |---- StandaloneModule.vcxproj.user |---- StandaloneModuleProject.xml
Loading And Building The Project
In order to load and build the project in Microsoft Flight Simulator, you must have previously enabled Developer Mode (see here for more information). Once enabled, simply follow these steps:
- Use the Open project... command from the File menu.
- Select the file
StandaloneModuleProject.xml
from theStandaloneModule
sample project:
- The Project Editor should open automatically and show you the project
mycompany-module-standalone
(if the Project Editor doesn't open, then you can open it from the Developer Mode Tools menu):
- Clicking on the project in the Project Editor will open the Inspector Window, and here you need to click the Build Package button (if the Inspector Window does not open automatically, go to the View menu in the Project Editor and open it from there).
- This will build a package from the files specified in your project. This package will be named
StandaloneModule.wasm
and will be output in thePackages/mycompany-module-standalone/modules
folder:
- At this point, you will need to add the entire package (so copy the folder
mycompany-module-standalone
) into The Community Folder and then restart the game.
- Once your game has restarted you need to select a new flight and start it, then open The Console. Here you can do a search for "New Flight Loaded" (which is the message that the module should output if a flight ios succesfully started) and you should see the message listed: