Query MSFS flightplan

Hi,

I am trying to query the MSFS flightplan internally from wasm as well as from an external application via SimConnect. Especially I would be interested in getting all waypoint names, but basically as much information about the flightplan as possible.

If only external reading was required, this would be easily done by opening up “AppData\Roaming\Microsoft Flight Simulator\MISSIONS\Custom\CustomFlight\CUSTOMFLIGHT.PLN”, but from wasm of course we cannot open that file as its outside our packages scope.

I played around with the GPS simulation variables and was able to get GPS_FLIGHT_PLAN_WP_COUNT as well as GPS_WP_NEXT_ID. From there “I thought” maybe via setting GPS_OVERRIDEN to true and advancing GPS_FLIGHT_PLAN_WP_INDEX until GPS_FLIGHT_PLAN_WP_COUNT is reached I might be able to get all waypoint names via GPS_WP_NEXT_ID. But all I am getting with this approach is the first waypoint’s name over and over again and nothing else.

I also briefly tried the C:fs9gps approach using execute_calculator_code, but just as described here this just gives me nothing in MSFS, even though according to here I think it should somehow work?

My last straw was this approach which makes use of the legacy GPSInfo, but just like for the op this just crashes the wasm and thus seems to never have been fixed…either by making it work, or removing it alltogether.

As I am too tired to continue poking holes into the dark: has anyone of you ever made this work, and if yes, how?

Greets,
Ben

AN example of how to read a full FP by Simconnect would be a great addition to the SDK, and would save so many developers from trying to re-invent the wheel, with varying degrees of success.

2 Likes

Hello @BenBaron85 ,

Well, I know you can get the FP from the sim through the Coherent.call function and passing the GET_FLIGHTPLAN event into it, but this requires the CommBus methods, and hence a HTML/JS instrument acting as a bridge for passing the information. As far as I know, this would be one possible solution, but of course this depends on your development requirements and needs.

Regards,
Carlos Gonzalez
NextGen Simulations

1 Like

Absolutely agreed!

Thanks Carlos: yes…I saw that from html/js there might be a solution in place, but I think a wasm only approach must be available. There already were shortcomings before MSFS came into play in this area, but they all could be mitigated due to running in an unrestricted dll. Now, due to being restricted to sandboxed wasm, this simply needs to be provided by the sim. So I still hope someone from the team can at least confirm that currently it is either simply not possible at all…or provide a way of how it can be achieved without having to use html/js solely because of this limitiation.

Greets,
Ben

1 Like

haha congrats - it’s not a great API to something as basic as a Flight Simulator Flight Plan. There are cumulative reasons why it’s so limited, not least because the code is 25 years old, but now it’s the game’s extremely weak support for string vars making it next to impossible to write an open-source module that would read the actual flight plan file and present it without all the current convoluted mangling.

All the answers you need are in here:

2 Likes

Well: the answers are there, if like the op in that post, you are “Programming a MSFS html nav intrument”…maybe there the C:fs9gps approach at least somehow works.

But in wasm using this in conjunction with execute_calculator_code does seemingly nothing, or I am using it wrong.

So it would be nice to get confirmation from Asobo, if this should still work in wasm, and if yes, how.

1 Like