How to Use External Configruation Files

Other problems or issues not covered by other troubleshooting topics.
Locked
nepr
Posts: 4
Joined: Mon Nov 02, 2015 12:28 am

How to Use External Configruation Files

Post by nepr »

Hi,

My first post, here, is about using external configuration files in Prepar3D.

The Learning topic on Add-on Configuration says this in the section, Add-on Life Cycle:
Initialization
Content
The priority for how add-on content configuration files are initialized are as follows:


Local: Configuration files found at: %LOCALAPPDATA%\Lockheed Martin\Prepar3D v3
Roaming: Configuration files found at: %APPDATA%\Lockheed Martin\Prepar3D v3
ProgramData: Configuration files found at: %PROGRAMDATA%\Lockheed Martin\Prepar3D v3

If multiple configuration files are found, then the list of paths are merged together when processed according to the above priority.
This is great, bringing to mind the method used in Linux applications where user config files are merged with system config files. But I can't find anything about two issues.

First, since the configuration files have [Area.xxx] and "Layer=yy" parameters, used for prioritization, what should I use for "xxx" and "yy" in a file defined outside of %PROGRAMDATA%\Lockheed Martin\Prepar3D v3 ? Do I have to be sure that the numbers I use are in sync, and don't conflict with those in %PROGRAMDATA%\Lockheed Martin\Prepar3D v3, or will the values I use externally be merged somehow, preserving the user-values-first prioritization? The text above actually uses the word, "merged", but it's not clear to me what that means in the specific cases, of Area and Layer.

Next, the Lessons topic, Management Of Add-ons, explains and gives examples of how to use the "-Configure" command line switch of the Prepar3D executable, instead or manual edits, to update the configuration files. This is also great, but I can't figure out whether or not this operation will update external configuration files, if they exist, or if it will bypass them and update the %PROGRAMDATA% files.

I haven't as yet tried simply doing it to see what happens. I'm trying to avoid doing that and suspect that I've missed something in the, Learning, documentation.

Thanks, for any help, you can provide.
Mike LM

Re: How to Use External Configruation Files

Post by Mike LM »

The section that you quoted is simply the order in which Prepar3D looks for .cfg files.
Local: Configuration files found at: %LOCALAPPDATA%\Lockheed Martin\Prepar3D v3
Roaming: Configuration files found at: %APPDATA%\Lockheed Martin\Prepar3D v3
ProgramData: Configuration files found at: %PROGRAMDATA%\Lockheed Martin\Prepar3D v3

If multiple configuration files are found, then the list of paths are merged together when processed according to the above priority.
If Prepar3D is looking for a value in file_name.cfg in Local and it's not there, then Prepar3D will look for it in file_name.cfg in Roaming. If it's found in Roaming then Prepar3D stops looking. If it isn't found in Roaming, then ProgramData will be searched.
nepr wrote:Next, the Lessons topic, Management Of Add-ons, explains and gives examples of how to use the "-Configure" command line switch of the Prepar3D executable, instead or manual edits, to update the configuration files. This is also great, but I can't figure out whether or not this operation will update external configuration files, if they exist, or if it will bypass them and update the %PROGRAMDATA% files.
The files that get configured are depending on the args following the switch. You can see the full list in our Learning Center under Prpear3D SDK > Add-Ons > Add-On Configuration.
nepr
Posts: 4
Joined: Mon Nov 02, 2015 12:28 am

Re: How to Use External Configruation Files

Post by nepr »

Hi,

Thanks for your reply. If I understand you, then if I create a file

%LOCALAPPDATA%\Lockheed Martin\Prepar3D v3\simobjects.cfg

that has a single entry

[Entry.0]
PATH=<some path>
TITLE=<some text>
.
.

Then P3D will use that simobjects.cfg and only that simobjects.cfg. It will not, for example, use the file

%PROGRAMDATA%\Lockheed Martin\Prepar3D v3\simobjects.cfg

in any way, and I will have one and only one simobject defined and P3D probably won't work. So, if I wanted P3D to work, in addition to any new custom entries, I would have to include (i.e., cut and paste) all the entries in the "default" (%PROGRAMDATA%) simobjects.cfg file in my new "custom" simobjects.cfg file. Furthermore, I would have to make sure that I keep my custom config file up-to-date if LM adds any new simobjects to the "default" file.

Is this correct?

If the above is correct, how should I interpret..
If multiple configuration files are found, then the list of paths are merged together when processed according to the above priority.
since the process I've just described doesn't involve any "merging", that I can see? If the above quote is referring to the different types of config files (i.e., simobjects, gauges, effects) and saying that all the paths in those different file types will be "merged", that still leaves me confused about what the "priortiy" that the quote refers to is.

Also, I understand that the command line switches refer to the different types of configuration files. My question was based on the assumption that P3D would, for example, merge multiple simobject.cfg, or gauges.cfg files, etc., found in the search hierarchy. Since, again if I understand you correctly, these files are not merged and only one of each type of config file will be used by P3D, then I assume that the first config file of each type that P3D finds will be updated by the command line execution of the Prepar3d executable. Is this, correct?

Thanks, again, for your help.
Mike LM

Re: How to Use External Configruation Files

Post by Mike LM »

nepr wrote:If I understand you, then if I create a file

...

Then P3D will use that simobjects.cfg and only that simobjects.cfg. It will not, for example, use the file

%PROGRAMDATA%\Lockheed Martin\Prepar3D v3\simobjects.cfg

in any way, and I will have one and only one simobject defined and P3D probably won't work. So, if I wanted P3D to work, in addition to any new custom entries, I would have to include (i.e., cut and paste) all the entries in the "default" (%PROGRAMDATA%) simobjects.cfg file in my new "custom" simobjects.cfg file. Furthermore, I would have to make sure that I keep my custom config file up-to-date if LM adds any new simobjects to the "default" file.

Is this correct?
I think I wasn't clear enough with my wording. My apologies for the confusion.

Some files are only looked for in one spot, so having different versions in different locations won't do anything.

Prepar3D effectively goes through the locations in order and checks for a file. Then all subsequent versions of the file will be appended to the end of a list, effectively merging them. When looking through the full list of data, Prepar3D will go down looking for a specific entry and stop looking once it has been found, so subsequent versions are ignored. Because the locations lower on the priority are appended last, they are ignored if an entry is in the locations higher in priority.

To clarify, no new files are created and no existing files are merged or deleted during this process
nepr wrote:Also, I understand that the command line switches refer to the different types of configuration files. My question was based on the assumption that P3D would, for example, merge multiple simobject.cfg, or gauges.cfg files, etc., found in the search hierarchy. Since, again if I understand you correctly, these files are not merged and only one of each type of config file will be used by P3D, then I assume that the first config file of each type that P3D finds will be updated by the command line execution of the Prepar3d executable. Is this, correct?
The default location of the file being configured is the default location for each file. This can be changed, however. Specifics regarding this are found in the Learning Center.
User avatar
aeronauta
Posts: 1661
Joined: Sun Oct 23, 2011 1:56 am
Location: Melbourne, Australia

Re: How to Use External Configruation Files

Post by aeronauta »

nepr, I think your confusion comes from the impression you have that you need a simobject.cfg or any other .cfg file, those files are already there and all you do is add your entries to them , I use this command syntax

Prepar3d.exe "-Configure: File=SimObjects, Operation=add, Title=T45, Path=D:\Add_On_Airplanes\Boeing_T45, Required=True, Active=True"
Prepar3d.exe "-Configure: File=Effects, Operation=add, Title=T45, Path=D:\Add_On_Airplanes\Boeing_T45\Effects, Required=True, Active=True"

this will add the T45 AC to my SIM, the AC files are in D:\Add_On_Airplanes\Boeing_T45.

Prepar3d.exe "-Configure: File=Scenery, Operation=add, Title=JOZx_Lib, Path=D:\JOZX_Install\OZx\OZx_LIB, Required=True, Active=True"

this will add some of the OZx scenery files..the scenery / texture files are in D:\JOZX_Install\OZx\OZx_LIB and the scenery.cfg will have this entry generated by the command

[Area.209]
Title=JOZx_Lib
Local=D:\JOZX_Install\OZx\OZx_LIB
Layer=209
Active=TRUE
Required=TRUE

the area and layer number is determined by P3D according to the position of the entry. Higher number entry gets priority.

My P3D V3.1 is in D:\Prepar3D v3

I use batch files to do the configuring

Hope this helps clarify this subject.

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
nepr
Posts: 4
Joined: Mon Nov 02, 2015 12:28 am

Re: How to Use External Configruation Files

Post by nepr »

Thanks, guys, for your help.

If I may, I'd like to clarify my "use case", as (sorry) I should have done earlier.

What I'd like to be able to do is to have my own "user" versions of (at present), simobjects.cfg, effects.cfg, and gauges.cfg. When I was using P3D V3.0, I used prepar3d.exe on the command line and it updated the files in

%PROGRAMDATA%\Lockheed Martin\Prepar3D v3

When V3.1 came out, those changes were wiped out because I uninstalled V3.0 and deleted all the files before installing V3.1. I then had to re-do my changes via the command line. This seems to have worked fine, and frankly is no big deal, but I always like to avoid such user-performed updates because of my lack of confidence in the competence of the user (me).

Reading through the Learning topics provided with P3D, I noted the "Add-on Life Cycle" section that suggested to me that I could create my own simobjects.cfg, effects.cfg, and gauges.cfg (and etc.) that would not have to be deleted as part of uninstalling/re-installing P3D and that would be isolated from, but merged with changes made by Lockheed Martin to the %PROGRAMDATA% versions of those config files. So, I would have my own, User-created versions of those files in

%LOCALAPPDATA%\Lockheed Martin\Prepar3D v3 or
%APPDATA%\Lockheed Martin\Prepar3D v3

that I would not have to change or re-update because they would survive an uninstall/re-install unchanged and P3D would know where to find them and would give them priority over any conflicting entries in the default %PROGRAMDATA%... folder.

So, the real question I have is, can I do this; would this work? Or perhaps I should ask, does this make any sense?

Thanks, again, guys.
User avatar
aeronauta
Posts: 1661
Joined: Sun Oct 23, 2011 1:56 am
Location: Melbourne, Australia

Re: How to Use External Configruation Files

Post by aeronauta »

I see now, yes you can , using the command line you need to specify the FileLocation. The command will create the file if it does not exist, place the entry in it AND and then when P3D runs reads it first then merges it with the default file in program data.

Prepar3d.exe "-Configure: File=SimObjects, FileLOcation=Roaming, Operation=add, Title=T45, Path=D:\Add_On_Airplanes\Boeing_T45, Required=True, Active=True"
Prepar3d.exe "-Configure: File=Effects, FileLOcation=Roaming, Operation=add, Title=T45, Path=D:\Add_On_Airplanes\Boeing_T45\Effects, Required=True, Active=True"

This placed the .cfg files in the C:\Users\aero\AppData\Roaming\Lockheed Martin\Prepar3D v3, but be warned the uninstall instructions recommend to delete that directory...you woukld now what do to.

Jorge

ps see the examples in the SDK

PSS I don't know if you could use any subdirectory in filelocation= ,like e:\myfiles P3D|...
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
nepr
Posts: 4
Joined: Mon Nov 02, 2015 12:28 am

Re: How to Use External Configruation Files

Post by nepr »

Hi,
ps see the examples in the SDK
<blushing> There was an example of this on the very page I quoted in my first post! I had a feeling I was missing something obvious. Thanks, for your help and patience!
User avatar
aeronauta
Posts: 1661
Joined: Sun Oct 23, 2011 1:56 am
Location: Melbourne, Australia

Re: How to Use External Configruation Files

Post by aeronauta »

Glad you understand now!!, well now the problem begins, as unless the AC is very simple and written to be self contained ( not relaying on the root folder to work,( specifically the RealAir dukeT2) all this command will result in not a fully operational AC, EG A2A aircrafts are hard coded so you cannot install them outside P3D root, others have panels that are directly hard coded to the root ..and so on... ORBX FTX Central2 is manipulating the files so much that it's almost impossible to get to work...any way I try with every AC I can , I managed to install the full OZx scenery and some others outside the root P3D but not all other sceneries work.

Enjoy its all part of the learning..

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
ananda
Posts: 491
Joined: Tue Nov 26, 2013 11:40 am
Location: Harton Village, UK

Re: How to Use External Configruation Files

Post by ananda »

If multiple configuration files are found, then the list of paths are merged together when processed according to the above priority.
How does this work with scenery.cfgs?

I need to insert a layer above the defaults but below all of the base files to contain revised airport altitudes:

Code: Select all

[General]
Title=FS9 World Scenery
Description=FS9 Scenery Data
Clean_on_Exit=TRUE

[Area.001]
Title=Default Terrain
Texture_ID=1
Local=Scenery\World
Layer=1
Active=TRUE
Required=TRUE

[Area.002]
Title=Default Scenery
Local=Scenery\BASE
Layer=2
Active=TRUE
Required=TRUE

[Area.003]
Title=Revised-Altitudes
Local=J:\Revised-Altitudes
Layer=3
Active=TRUE
Required=FALSE

[Area.004]
Title=0000 Base
Local=Scenery\0000
Layer=4
Active=TRUE
Required=FALSE
User avatar
aeronauta
Posts: 1661
Joined: Sun Oct 23, 2011 1:56 am
Location: Melbourne, Australia

Re: How to Use External Configruation Files

Post by aeronauta »

This is a guess as I cannot test it , but if you create a scenery.cfg file in C:\Users\your ID \AppData\Roaming\Lockheed Martin\Prepar3D v3 and place in it the following

[General]
Title=FS9 World Scenery
Description=FS9 Scenery Data
Clean_on_Exit=TRUE

[Area.001]
Title=Default Terrain
Texture_ID=1
Local=Scenery\World
Layer=1
Active=TRUE
Required=TRUE

[Area.002]
Title=Default Scenery
Local=Scenery\BASE
Layer=2
Active=TRUE
Required=TRUE

[Area.003]
Title=Revised-Altitudes
Local=J:\Revised-Altitudes
Layer=3
Active=TRUE
Required=FALSE


then in the scenery.cfg file you sstart the entries from (deleting from 0 to 3)


[Area.004]
Title=0000 Base
Local=Scenery\0000
Layer=4
Active=TRUE
Required=FALSE

to the end... I think that P3D will read the first file and then append the second (from program data ) and you shd be OK. dont worry about the number , as if they are consecutive dont have to start from 0, if there is a brake it will stop.

Try , I can't do it as I don't have the files.

Jorge

ps the hard part about this is that it may become a bit hard to manage in case of a change... don't know either how ORBX would treat this...
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
ananda
Posts: 491
Joined: Tue Nov 26, 2013 11:40 am
Location: Harton Village, UK

Re: How to Use External Configruation Files

Post by ananda »

That would fail on the first update.

I don't think LM have thought through the implications of multiple cfgs.
User avatar
aeronauta
Posts: 1661
Joined: Sun Oct 23, 2011 1:56 am
Location: Melbourne, Australia

Re: How to Use External Configruation Files

Post by aeronauta »

ananda, I guess in my PS I should have said VERY HARD to manage!!!!! you are right as any P3D update that changes the default would brake the sequence...

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
Locked