Is there a way to determine if you are using MSFS 2020 or MSFS2024, preferably by javascript sdk?
I need to implement some different logic depending on the sim version, for a toolbar.
Is there a way to determine if you are using MSFS 2020 or MSFS2024, preferably by javascript sdk?
I need to implement some different logic depending on the sim version, for a toolbar.
Currently you need a Simconnect program either as a Windows exe or a WASM module, and the connection onopen event callback parameter includes an appversion property. You can then write the value of that property (e.g. 12 for MSFS2024) into an L: variable, and your html/js and XML code can pick that up.
It’s not great, that call is unique to the Simconnect programming framework with no equivalent in the other four frameworks (XML RPN, HTML/JS, XML Templates, typescript gauges & apps). It’s an example of MSFS fragmenting which looks fine inside each of those bubbles but is inevitably going to be difficult to manage.
Thanks. Pretty hacky unfortunately, and not very neat for what you’d think would be a basic piece of info to retrieve if you have to deploy a product to both, from the one codebase.
On this topic, is it possible to determine platform? i.e. is module running or Xbox or PC?
Hello @StevenPearce833,
To determine whether the sim is being run on PC or Xbox, you can use these functions from an HTML instrument:
The functions are defined in the html_ui\JS\common.js
file, so if you are going to use them on an instrument, the JS file in question is already called for instance.
For SimConnect or WASM, there is no “C++ native” way. You would have to use the CommBus API if you plan on retrieving this data from a WASM module.
Hope this works for you.
Regards,
Carlos Daniel González Gómez
NextGen Simulations