• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Writing an application for P3D AND FSX?

Messages
22
Country
sweden
Hi! I wonder what I have to do to make an application for both p3d and fsx. Right now I only add the reference for the P3D. Dll.. Do I have to add a reference to the fsx. Dll as well?
 
Messages
258
Country
luxembourg
Yes. P3D and FSX are more or less the same but it is better to refer to the according .dll (so the P3D for P3D and the FSX one for FSX).
Additionally you will avoid possible problems regarding network losses while refering to another sim.
 
Messages
22
Country
sweden
Yes. P3D and FSX are more or less the same but it is better to refer to the according .dll (so the P3D for P3D and the FSX one for FSX).
Additionally you will avoid possible problems regarding network losses while refering to another sim.
But how do I know if the user got FSX or P3D? If he is using P3D he needs to use the p3d dll and if he is using fsx he needs to use the fsx dll
 
Messages
258
Country
luxembourg
Well depending on what application you are writing there exists numerous options. Either you do it the "simple" way in writing your application once for P3D and once for FSX and the user needs to get (and install) the correct version. An alternative to this would be to include the P3D.dll and FSX.dll in one application and let the application choose to which .dll it should refer (If I am not mistaken there is an option in SimConnect to check if FSX or P3D is running). The third method would be to let the user select upon start of the application (for example via a combobox module) which simulator he uses and that then only the selected .dll will be used. Although this sounds like much work I would suggest you to maybe consider first of all build the application for one simulator (usually this is FSX) and then if you still want to support P3D, to code the P3D part. Both simulator are nearly the same but only nearly and to be honest the changeing between the two platforms all the way with your code (can) really suck.
 
Messages
22
Country
sweden
Well depending on what application you are writing there exists numerous options. Either you do it the "simple" way in writing your application once for P3D and once for FSX and the user needs to get (and install) the correct version. An alternative to this would be to include the P3D.dll and FSX.dll in one application and let the application choose to which .dll it should refer (If I am not mistaken there is an option in SimConnect to check if FSX or P3D is running). The third method would be to let the user select upon start of the application (for example via a combobox module) which simulator he uses and that then only the selected .dll will be used. Although this sounds like much work I would suggest you to maybe consider first of all build the application for one simulator (usually this is FSX) and then if you still want to support P3D, to code the P3D part. Both simulator are nearly the same but only nearly and to be honest the changeing between the two platforms all the way with your code (can) really suck.
Yeah because I'm writing a acars software and really need both fsx and p3d support
 
Messages
258
Country
luxembourg
Yes for sure you might need both versions, that's not the problem but working on both versions at the same time might kill you especially if you are new to this (and according to this topic here, this might be the case).
 
Messages
22
Country
sweden
Yes for sure you might need both versions, that's not the problem but working on both versions at the same time might kill you especially if you are new to this (and according to this topic here, this might be the case).
Yeah, but what is the big difference? Like is the syntax different?
 
Messages
258
Country
luxembourg
There should be no syntax difference since both use C++ but there might be changes in the logic of simconnect (for example other variable names, other types,...).
 
Messages
1,243
Country
canada
Gustav,

What are you going to write it in C++ or C#. Do you use Visual Studio?

I have my C++ non managed programs in one solution. I then add one project for FSX with the lib,inc etc for FSX. I then add a second project for P3D with the lib, inc etc for P3d. (some newer features in P3D)
The cpp files are common except for the part that figures out if its P3D running or FSX. This way I have one common code base for the application and a small part that determines the program in use. I also create two exe's. That way one code change two compiles and two testing stages. I don't copy paste code from one to the other.
My set up program puts both on the users computer (haven't worked on the setup yet).

I think you can do the same for C# and add references to each project for FSX or P3D simconnect.

use #if else and namespace alias
 
Last edited:

ollyau

Resource contributor
Messages
1,026
Country
us-california
Why not just target the SimConnect libraries from the FSX SDK? That's what the Prepar3D SDK page suggests:

The Prepar3D v2 SDK 2.5.12945.0 is directly compatible with Prepar3D v2.5. The SimConnect.lib and LockheedMartin.Prepar3D.SimConnect.dll provided in the SDK can not be used to connect to FSX, ESP or any previous release of Prepar3D.

The SimConnect server in the Prepar3D application is backwards compatible with the SimConnect.dll’s of P3D 1.x, FSX and ESP and the ESP SimConnect server is backwards compatible with the SimConnect.dll’s of FSX. This means that if you are trying to develop an add on that will work with FSX, ESP, and Prepar3D, you will need to use a version of the SimConnect SDK that works with FSX.

The Prepar3D SDK 1.4.4747.0 (Prepar3D SDK Release 1.4) is directly compatible with Prepar3D 1.4.4747.0 (Prepar3D Release 1.4). The SimConnect.lib and LockheedMartin.Prepar3D.SimConnect.dll provided in the SDK can not be used to connect to FSX, ESP or any previous release of Prepar3D.

The SimConnect server in the Prepar3D application is backwards compatible with the SimConnect.dll’s of FSX and ESP and the ESP SimConnect server is backwards compatible with the SimConnect.dll’s of FSX. This means that if you are trying to develop an add on that will work with FSX, ESP, and Prepar3D, you will need to use a version of the SimConnect SDK that works with FSX.

http://www.prepar3d.com/support/sdk/
 
Messages
22
Country
sweden
Gustav,

What are you going to write it in C++ or C#. Do you use Visual Studio?

I have my C++ non managed programs in one solution. I then add one project for FSX with the lib,inc etc for FSX. I then add a second project for P3D with the lib, inc etc for P3d. (some newer features in P3D)
The cpp files are common except for the part that figures out if its P3D running or FSX. This way I have one common code base for the application and a small part that determines the program in use. I also create two exe's. That way one code change two compiles and two testing stages. I don't copy paste code from one to the other.
My set up program puts both on the users computer (haven't worked on the setup yet).

I think you can do the same for C# and add references to each project for FSX or P3D simconnect.

use #if else and namespace alias
I'm using c# in visual studio
 
Messages
1,243
Country
canada
Have you tried using the FSX SDK managed library in your P3D program. Like ollyau says, P3D should be backwards compatible.
 
Messages
1,243
Country
canada
I'm not sure how you have your system set-up.

I am not at my development computer, so I can't give you code at the moment.

But ....

If you have FSX deluxe and have loaded the SDK SP2 or Acceleration then just use the managed code examples there to work with P3D 2.5

If you don't have FSX deluxe then download P3D 1.4 SDK (free) - it's basically the same as FSX deluxe SP2 - create a managed code program from P3D 1.4 SDK and see it it works with P3D 2.5.

Both these options should work with both FSX and P3D 2.5.

I gave you the explanation in the other thread about aircraft altitude. here
 
Messages
22
Country
sweden
I'm not sure how you have your system set-up.

I am not at my development computer, so I can't give you code at the moment.

But ....

If you have FSX deluxe and have loaded the SDK SP2 or Acceleration then just use the managed code examples there to work with P3D 2.5

If you don't have FSX deluxe then download P3D 1.4 SDK (free) - it's basically the same as FSX deluxe SP2 - create a managed code program from P3D 1.4 SDK and see it it works with P3D 2.5.

Both these options should work with both FSX and P3D 2.5.

I gave you the explanation in the other thread about aircraft altitude. here
Yeah I got it to work now :D
 
Top