SimConnect_RequestFacilitiesList_EX1 - different behaviour to MSFS 2020?

Version: 1.3.23.0

Frequency: Consistently

Severity: Blocker

Bug description:

I’m experiencing some issues when trying to use the ‘SimConnect_RequestFacilitiesList_EX1’ function to build a list of nearby airports in MSFS 2024. Note that the same code is working correctly in MSFS 2020.

I’ve attached the WASM C++ code that is being used, and here is what is outputted to the dev console in both sims:

2020

2024

As you can see, in MSFS 2024 the airports that are being returned have invalid idents and latitude/longitude values, whereas everything is as expected in MSFS 2020. I couldn’t see any significant changes to the relevant sections of the SimConnect API but the issue looks like a type mismatch at first glance.

Thanks,
Martyn

Hi Martyn,

Looks like the memory area storing your results is getting corrupted, or similar memory management issue. Could be caused by some API call, or could be the user code, hard to say w/out seeing code. Seems tied to string handling, perhaps. A minimal example which reproduces this would be helpful.

Cheers,
-Max

Hi Max,

Thanks for the help. I forgot to attach the relevant code in my original post.

I’ve got several versions of Facility_ProcessAirport with attempts at debugging and safer memory management but to no avail. The attached version is working fine in MSFS 2020 and is broadly the same as a version that worked fine in Prepar3D.

GPS100_airports.cpp (4.7 KB)

Thanks,
Martyn

Even with this simpler code, I’m seeing similarly invalid data in MSFS 2024:

void HandleAirportList(const SIMCONNECT_RECV_AIRPORT_LIST* pAirportList)
{
    DWORD count = pAirportList->dwArraySize;  // Get number of airports in the list

    // Pointer to the first airport in the list
    const SIMCONNECT_DATA_FACILITY_AIRPORT* pAirport = (const SIMCONNECT_DATA_FACILITY_AIRPORT*)(pAirportList + 1);

    // Iterate over each airport in the list
    for (DWORD i = 0; i < count; ++i, ++pAirport)
    {
        fprintf(stderr, "Airport ICAO: %s, Latitude: %.6f, Longitude: %.6f, Altitude: %.1f\n",
            pAirport->Ident,    // ICAO code
            pAirport->Latitude, // Latitude
            pAirport->Longitude, // Longitude
            pAirport->Altitude  // Altitude
        );
    }
}

Thanks,
Martyn

Hi,

The only thing that has been changed using this API is the size of the Ident field. Indeed, in MSFS 2020 it was a 6 length string whereas in MSFS 2024, it is a 9 length string. This changed has been made to handle very long helipad’s ident.

However, the API has been handled the version of the user to retrieve data that he can parse. A MSFS2020 addon (with a old version of SimConnect) will receive a old struct whereas a addon compiled with the MSFS SDK 2024 will receive a new struct.

I suspect that you wasm file is compiled with the MSFS SDK 2024 (so it is identified as a 2024 addon and will receive the new struct) but it uses the SimConnect.h from the MSFS 2020 sdk.
(or maybe the other way : a MSFS 2020 sdk with a newest SimConnect.h).

Could you check your project configuration or share it with us so we can investigate?

Best Regards
Maxime / Asobo

1 Like

Thanks Maxime, you’re absolutely right, the WASM was being compiled using the MSFS 2020 SDK files rather than MSFS 2024. I’ve fixed that and it’s now working as expected.

Thanks for the quick reply.

Martyn