Skip to content

MrMinimal/msfs-rust-aircraft

Repository files navigation

General

Microsofts MSFS SDK Sample GaugeAircraft in Rust 🦀

Because I didn't want to write logic in Microsoft's cursed RPN language, XML or C++.

grafik

Requirements

  1. Git for Windows (with Git Bash)
  2. Rust
  3. MSFS SDK

Developing

Compile the Rust logic

  1. cd Sources/Rust
  2. cargo build -v --target wasm32-wasip1 --release && wasm-opt -O1 --signext-lowering --enable-bulk-memory -o ../../Packages/mycompany-aircraft-wasm-gauge/SimObjects/Airplanes/MyCompany_Gauge_Aircraft/panel/gauge_logic.wasm target/wasm32-wasip1/release/gauge_logic.wasm

Open project in MSFS

  1. Enable MSFS developer mode
  2. File -> Open Project -> open the rust_aircraft.xml project file in this repo
  3. Debug -> Console
  4. Disable the "Autoset" checkbox in the top right of the console and disable any filters
  5. Editors -> Project Editor
  6. Clear all messages in Console
  7. Press the "Build All" button in the Project Editor
  8. Search for the "Gauge Aircraft" to fly

Updating code

  1. Change something in the Rust code and build using the command above
  2. Project Manager: File -> close project (optional but makes reload way faster)
  3. Tools -> Behaviours
  4. In the Behaviours window: "Quick reload" (rebuilds the project if it wasn't closed before. Rebuild only required if file naming or project structure changes)

Checking WASM state

  1. Start a flight with the "GaugeAicraft" that should now be available in the sim
  2. Debug -> Display WASM Debug Window
  3. Select the .wasm file from the dropdown

License

Microsoft Flight Simulator © Microsoft Corporation. This project was created under Microsoft's "Game Content Usage Rules" using assets from Microsoft Flight Simulator, and it is not endorsed by or affiliated with Microsoft.

The contents of distribution packages built from the sources in this repository are therefore licensed as follows: in the case of original source code from FBW or compiled artifacts generated from it, under GPLv3. in the case of assets covered by the "Game Content Usage Rules", under the license granted by those rules.

About

Rust Aircraft Template for MSFS 2020

Topics

Resources

License

Stars

Watchers

Forks

Languages