FsEnrouteLeg doubles are reported incorrectly in a FsPlannedRoute

Version: 1.6.34.0

Frequency: Consistently

Severity: High

Marketplace package name: Not Applicable

Context: Data returned from fsPlannedRouteGetEfbRoute() and fsPlannedRouteRegisterForBroadcast()

Similar MSFS 2020 issue: Not Applicable

Bug description: FsEnrouteLeg doubles are reported incorrectly in a FsPlannedRoute returned from fsPlannedRouteGetEfbRoute() and fsPlannedRouteRegisterForBroadcast(). There is data inside the doubles, but it is clearly incorrect. I’m guessing here, but maybe it’s a memory address mismatch issue. I’ve seen similar issues in SimConnect when trying to receive doubles on facilities. My workaround was to cast the returned facility data to a byte array[8] and use a union to convert it back to a double. This seemed to work with SimConnect, but not sure if it would do the same in this situation.

A workaround I’ll be implementing in the meantime is to ping SimConnect for the needed data for each leg and populate it accordingly. The only issue I can see with this is the region data isn’t always populated for each leg.

Repro steps: Build a fligh plan with a few waypoints in the EFB, send the flight plan to avionics, and inspect the output in a wasm debugger.

Attachments:

After more research it’s possible the doubles in the FsEnrouteLeg struct aren’t following the 8-byte alignment requirement when data is cast to the struct (this was my issue in my SimConnect implementation, so maybe this is related).

If data is being cast directly to FsEnrouteLeg in the MSFS source, then placing the doubles first in the struct would be the simplest test/solution since they would then follow the 8-byte requirement.