FSX New PMDG 737NG variables

Hi everyone!

The file PMDG_NGX_SKD.h, situated in C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\PMDG\PMDG 737 NGX\SDK, suggests that there are some new variables added sometimes. Those are:
    // New variables for SP2
    unsigned int    COMM_ReceiverSwitches[3];            // Bit flags for selector receivers (see ACP_SEL_RECV_VHF1 etc): [0]=Capt, [1]=FO, [2]=Overhead
    bool            MAIN_annunAP_Amber[2];                // Amber color
    bool            MAIN_annunAT_Amber[2];                // Amber color
    int                ICE_WindowHeatTestSw;                // 0: OVHT  1: Neutral  2: PWR TEST
    bool            DOOR_annunFWD_ENTRY;
    bool            DOOR_annunFWD_SERVICE;
    bool            DOOR_annunAIRSTAIR;
    bool            DOOR_annunLEFT_FWD_OVERWING;
    bool            DOOR_annunRIGHT_FWD_OVERWING;
    bool            DOOR_annunFWD_CARGO;
    bool            DOOR_annunEQUIP;
    bool            DOOR_annunLEFT_AFT_OVERWING;
    bool            DOOR_annunRIGHT_AFT_OVERWING;
    bool            DOOR_annunAFT_CARGO;
    bool            DOOR_annunAFT_ENTRY;
    bool            DOOR_annunAFT_SERVICE;
    bool            AIR_annunAUTO_FAIL;
    bool            AIR_annunOFFSCHED_DESCENT;
    bool            AIR_annunALTN;
    bool            AIR_annunMANUAL;
    float            AIR_CabinAltNeedle;                // Value - ft
    float            AIR_CabinDPNeedle;                // Value - PSI
    float            AIR_CabinVSNeedle;                // Value - ft/min
    float            AIR_CabinValveNeedle;            // Value - 0 (closed) .. 1 (open)
    float            AIR_TemperatureNeedle;            // Value - degrees C
    float            AIR_DuctPressNeedle[2];            // Value - degrees C
    char            ELEC_MeterDisplayTop[13];        // Top line of the display: 3 groups of 4 digits (or symbols) + terminating zero
    char            ELEC_MeterDisplayBottom[13];    // Bottom line of the display
    char            IRS_DisplayLeft[7];                // Left display string, zero terminated
    char            IRS_DisplayRight[8];            // Right display string, zero terminated
    bool            IRS_DisplayShowsDots;            // True if the degrees and decimal dot symbols are shown on the IRS display
I am using C# to speak with PMDG. I have a struct of PMDG variables, however, those "new ones" appear to be missing. When I add a few of those to that struct:
            public float AIR_CabinAltNeedle; // Value
            public float AIR_CabinDPNeedle; // Value
            public float AIR_CabinVSNeedle; // Value
When the struct is returned, those are zeros, not populated. Any idea how to fix that? This is a piece of my code:

            _simConnect.MapClientDataNameToID(PMDG.PMDG_NGX_DATA_NAME, PMDG.PMDGIds.PMDG_NGX_DATA_ID);
            // Define the data area structure - this is a required step
            _simConnect.AddToClientDataDefinition(PMDG.PMDGIds.PMDG_NGX_DATA_DEFINITION, 0, (uint)Marshal.SizeOf(typeof(PMDG.PMDG_NGX_Data)), 0.0f, SimConnect.SIMCONNECT_UNUSED);



            _simConnect.OnRecvClientData += new SimConnect.RecvClientDataEventHandler(simconnect_PMDGVarsHandler);
        void simconnect_PMDGVarsHandler(SimConnect sender, SIMCONNECT_RECV_CLIENT_DATA data)

            switch ((DATA_REQUEST_ID)data.dwRequestID)
                case DATA_REQUEST_ID.DATA_REQUEST:
                    PMDG.PMDG_NGX_Data ngxVars = (PMDG.PMDG_NGX_Data)data.dwData[0];
                     //code here,

My SDK is the same as this one:


However, I've added the three variables from above at the end of the public struct PMDG_NGX_Data.
Hi again everyone!

So I managed to find out what's wrong. The variables need to be added in a certain order. This is what I've appended to the existing C# data struct:

            // New variables for SP2
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public uint[] COMM_ReceiverSwitches;          // Bit flags for selector receivers (see ACP_SEL_RECV_VHF1 etc): [0]=Capt, [1]=FO, [2]=Overhead
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] MAIN_annunAP_Amber;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] MAIN_annunAT_Amber;
            public byte ICE_WindowHeatTestSw;
            public byte DOOR_annunFWD_ENTRY;
            public byte DOOR_annunFWD_SERVICE;
            public byte DOOR_annunAIRSTAIR;
            public byte DOOR_annunLEFT_FWD_OVERWING;
            public byte DOOR_annunRIGHT_FWD_OVERWING;
            public byte DOOR_annunFWD_CARGO;
            public byte DOOR_annunEQUIP;
            public byte DOOR_annunLEFT_AFT_OVERWING;
            public byte DOOR_annunRIGHT_AFT_OVERWING;
            public byte DOOR_annunAFT_CARGO;
            public byte DOOR_annunAFT_ENTRY;
            public byte DOOR_annunAFT_SERVICE;
            public byte AIR_annunAUTO_FAIL;
            public byte AIR_annunOFFSCHED_DESCENT;
            public byte AIR_annunALTN;
            public byte AIR_annunMANUAL;
            public float AIR_CabinAltNeedle;
            public float AIR_CabinDPNeedle;
            public float AIR_CabinVSNeedle;
            public float AIR_CabinValveNeedle;
            public float AIR_TemperatureNeedle;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public float[] AIR_DuctPressNeedle;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)]
            public char[] ELEC_MeterDisplayTop;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)]
            public char[] ELEC_MeterDisplayBottom;
            //[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
            //public char[] IRS_DisplayLeft;
            //[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
            //public char[] IRS_DisplayRight;
            public byte IRS_DisplayShowsDots;            // True if the degrees and decimal dot symbols are shown on the IRS display
One problem though. I've commented IRS_DisplayLeft and IRS_DisplayRight out, because when those two variables are in the struct, SimConnect gives me exceptions 9 and 29. Anyone has any idea why? All other variables work just fine, just those two cause the exceptions to pop up. Looking at the reference, this is what I get, however, those exceptions do not make too much sense to me in this context. I am not dealing with Events, but variables. Any ideas?

Specifies that the ID has already been used. This can occur with menu IDs, or with the IDs provided to SimConnect_AddToDataDefinition, SimConnect_AddClientEventToNotificationGroup or SimConnect_MapClientDataNameToID.

Specifies that the event ID has been used already. This can occur with calls to SimConnect_MapClientEventToSimEvent, or SimConnect_SubscribeToSystemEvent.