Read Aircraft.cfg file

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Locked
Framac
Posts: 12
Joined: Sun Nov 06, 2011 11:52 pm

Post by Framac »

Hi



Is there any way to read the aircraft.cfg file from the plane in use?

I need to read the key "ui_createdby" in the file, but do not know how to read the file.



I appreciate any help. :)



Thanks.



Framac
User avatar
aeronauta
Posts: 1657
Joined: Sun Oct 23, 2011 1:56 am
Location: Melbourne, Australia

Post by aeronauta »

In C:\Program Files (x86)\Lockheed Martin\Prepar3D\SimObjects\Airplanes\ (or where you have your SimObjects folder and if a helo in rotorcraft) look for the aircraft you want and open the folder , thhere you will find the Aircraft.cfg file, open it with notepad and look for ui_createdby= , some aircraft do not use this entry.



regards Jorge
Jorge Roldan
OZx Developer (aero) - Hovercontrol Helicopter Certified Pilot - Spad.Next Beta Tester - VATPAC Pilot PR
System i9-9990 4.7Ghz 32GB W11 Nvidia GeForce RTX 2080 8GB
Premek
Posts: 24
Joined: Thu Nov 15, 2012 10:32 am

Post by Premek »

Jorge, I'd say Framac means how to read it by SimConnect.



Framac - could you be more specific? What do you mean by " but do not know how to read the file"?



Cheers,

Premek
Framac
Posts: 12
Joined: Sun Nov 06, 2011 11:52 pm

Post by Framac »

ok,

I know where the file is.

I'm developing one application/ACARS using simconnect to create a log flight, but I need to read some entries of the file.

My problem is how to read the aircraft.cfg of the plane in use by FSX.



How can I know the path of the file aircraft.cfg or SimObjects/"aircraft" folder in use?



With simconnect I can only read some entries like ATC TYPE, ATC MODEL, ATC ID, ATC AIRLINE, TITLE, but I need to read some other information of the plane selected and in use by FSX that is stored in aircraft.cfg.













Premek
Posts: 24
Joined: Thu Nov 15, 2012 10:32 am

Post by Premek »

Hi Framac



To get the FSX application path you have to read register entry 'HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0\AppPath' (It may also be in 'HKEY_LOCAL_MACHINE')



After that, you should read the TITLE. There you'll find text what is in Aircraft.cfg as Title in the section '[fltsim.x]' where is also the 'ui_createdby' field.
Framac
Posts: 12
Joined: Sun Nov 06, 2011 11:52 pm

Post by Framac »

Sorry, I may not have explained well.

I have the path of FSX, yes, I can read it from the registry.

I know that planes are inside the folder SimObjects\Airplanes.

In SimObjects\Airplanes I have folders of airplanes and inside I have the aircraft.cfg, and know how to read the file, because the structure is like INI files.



But I do not have the folder name of the plane in use, so I have "Application Path FSX"\SimObjects\Airplanes\ I DO NOT KNOW \aircraft.cfg



Premek, for exemple, the C172 of Microsoft is stored in the folder "Microsoft Flight Simulator X \ SimObjects \ Airplanes \ C172"



In this case, the folder name is "C172"

But the title is "Cessna Skyhawk 172SP Paint1"

When I select the plane "Cessna Skyhawk 172SP Paint1" how can I know that the folder is "C172"



The Bombardier CRJ 700 Paint1 is stored in folder: Bombardier_CRJ_700

When I select the plane "Bombardier CRJ 700 Paint1" how can I know that the folder is "Bombardier_CRJ_700"



My Problem is: In this case, how do I know the name of the folder of the aircraft in use to read the aircraft.cfg?



Thanks for your help



Framac
Premek
Posts: 24
Joined: Thu Nov 15, 2012 10:32 am

Post by Premek »

Well, I'd say the most effective way is to create a dictionary when your app starts - just walk-through the 'Airplanes' folder and for each sub-folder make a list of available 'Titles'.

Or is there any constrain you could not do it this way?



Btw. we should decide where will we talk - either in FSDev or here :D
Framac
Posts: 12
Joined: Sun Nov 06, 2011 11:52 pm

Post by Framac »

Thanks, Premek,

I think this is the best option until now, I hope the users don't have one zillion folders :D.



I only post in fsdeveloper because sometimes the users are not the same, and someone can have a better idea. ;)

I will try this idea, and the option of Doug from fsdeveloper.

Thanks. (y)
agarti
Posts: 26
Joined: Thu Jun 14, 2012 4:32 pm

Post by agarti »

Or maybe intuition for what concerns the folder structure of P3D for compatibility installing FSX aircraft models on P3D, lies in the very structure of the program's folder, to make more similar to the FSX folder and make better the function of the various additional programs that serve the migration patterns of P3D FSX, Prepar3D folder should be like that of FSX, while here we have a folder and sub-folder.



Example Main folder (Microsoft Flight Simulator X) = Folder Main, (Lockheed Martin's Prepar3D).



Regards Daniel
Framac
Posts: 12
Joined: Sun Nov 06, 2011 11:52 pm

Post by Framac »

I found it. :)

I have to read AIR file path, this file is in the aircraft folder,



c++ code here..

http://www.fsdeveloper.com/forum/archiv ... 20082.html





C# Code...

...



enum REQUESTID

{

AIRCRAFT_PATH,

};

...

private void initDataRequest()

{

try

{

...

my_simconnect.OnRecvSystemState += my_simconnect_OnRecvSystemState;

my_simconnect.RequestSystemState(REQUESTID.AIRCRAFT_PATH, "AircraftLoaded");

...

}

}



void my_simconnect_OnRecvSystemState(SimConnect sender, SIMCONNECT_RECV_SYSTEM_STATE data)

{

string aircraftpath= Path.GetDirectoryName(data.szString);



}

Fabo.sk
Posts: 38
Joined: Mon Oct 07, 2013 5:43 pm

Post by Fabo.sk »

Handy. Thanks.
Locked