Writing an application for P3D AND FSX?

#1
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?
 
#2
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.
 
#3
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
 
#4
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.
 
#5
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
 
#6
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).
 
#7
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?
 
#8
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,...).
 
#9
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
#10
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/
 
#12
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
 
#13
Have you tried using the FSX SDK managed library in your P3D program. Like ollyau says, P3D should be backwards compatible.
 
#15
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
 
#16
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