Crate msfs

source ·
Expand description

msfs-rs

These bindings include:

  • MSFS Gauge API
  • SimConnect API
  • NanoVG API
  • Networking API
  • Communication Bus API

Building

Tools such as cargo-wasi may not work. When in doubt, try invoking cargo build --target wasm32-wasi directly.

If your MSFS SDK is not installed to C:\MSFS SDK you will need to set the MSFS_SDK env variable to the correct path.

Known Issues and Work-Arounds

Missing various exports

Add a local .cargo/config.toml file with the following settings:

[target.wasm32-wasi]
rustflags = [
  "-Clink-arg=--export-table",
  "-Clink-arg=--export=malloc",
  "-Clink-arg=--export=free",
]

Modules

  • Bindings for the commbus API available in the MSFS SDK.
  • Bindings to the Legacy/gauges.h API
  • Bindings to the networking API. It can be used to do HTTPS requests.
  • NanoVG is small antialiased vector graphics rendering library with a lean API modeled after the HTML5 Canvas API. It can be used to draw gauge instruments in MSFS. See Gauge::create_nanovg.

Structs

Enums

  • Used in Gauges to dispatch lifetime events, mouse events, and SimConnect events.

Attribute Macros

  • Declare a gauge callback. It will be automatically exported with the name NAME_gauge_callback, where NAME is the name of the decorated function.
  • Declare a standalone module.