Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Prepar3D v3 - Configuration Files for Add-on Developers

Featured Replies

  • Moderator
NOTE: The following is likely of interest only to add-on developers, freeware or payware.
 
As many (most) of us now know, P3D v3 has set up an system of configuration files where they encourage us to place our add-on products.
 
Moreover, they have even provided command line parameters we can use to automatically add our new paths to these various configuration files! Sweet!
 
Unfortunately, the SDK documentation is just as opaque as any such has ever been... clear.png:fool:
 
Since I had to do this anyway, I've put together a simple batch (.bat) file that will do all the work for you. All anyone needs to do is edit this file to update the drive letter, path, title, etc. to suit their own needs.
 
This batch file will first make backup copies of these config files:
  • simobjects.cfg
  • effects.cfg
  • fonts.cfg
  • gauges.cfg
  • sound.cfg
I suggest that this should probably be removed from the .bat file before using it in your installers. I only used them while I was testing just to verify that I had all of the parameters correct! All new entries are made at the TOP of the existing config files, so whatever is in those new folders will be seen "first" before P3D v3 looks at its default folders.
 
Here then is my batch file:
echo
:: Make backup copies of P3Dv3's .cfg files
CD \ProgramData\Lockheed Martin\Prepar3D v3
Copy simobjects.cfg  simobjects_back.cfg
Copy effects.cfg  effects_back.cfg
Copy fonts.cfg fonts_back.cfg
Copy gauges.cfg gauges_back.cfg
Copy sound.cfg sound_back.cfg
 
:: Add new path to simobjects.cfg file
CD \Program Files (x86)\Lockheed Martin\Prepar3D v3
Prepar3D.exe "-Configure: File=SimObjects, Operation=Add, Path=D:\MilvizProducts\SimObjects\Airplanes, Title=Milviz Airplanes, Required=True, Active=True"
 
:: Add new path to effects.cfg file
CD \Program Files (x86)\Lockheed Martin\Prepar3D v3
Prepar3D.exe "-Configure: File=Effects, Operation=Add, Path=D:\MilvizProducts\Effects, Title=Milviz Effects, Required=True, Active=True"
 
:: Add new path to fonts.cfg file
CD \Program Files (x86)\Lockheed Martin\Prepar3D v3
Prepar3D.exe "-Configure: File=Fonts, Operation=Add, Path=D:\MilvizProducts\Fonts, Title=Milviz Fonts, Required=True, Active=True"
 
:: Add new path to gauges.cfg file
CD \Program Files (x86)\Lockheed Martin\Prepar3D v3
Prepar3D.exe "-Configure: File=Gauges, Operation=Add, Path=D:\MilvizProducts\Gauges, Title=Milviz Gauges, Required=True, Active=True"
 
:: Add new path to sound.cfg file
CD \Program Files (x86)\Lockheed Martin\Prepar3D v3
Prepar3D.exe "-Configure: File=Sound, Operation=Add, Path=D:\MilvizProducts\Sound, Title=Milviz Sound, Required=True, Active=True"
 
pause

 

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

What about Texture.cfg and Scenery.cfg folder?

Some Payware Airports bring you new texture inside the Texture Root, so you have to replace it too...

  • Author
  • Moderator

What about Texture.cfg and Scenery.cfg folder?

Some Payware Airports bring you new texture inside the Texture Root, so you have to replace it too...

My example was aimed specifically towards aircraft developers.

 

At this time according to the P3Dv3 SDK the Scenery.cfg can NOT be handled the same way as the other .cfg files. This is described in a separate article in the SDK cleverly named: Scenery Configuration File

 

The Texture.cfg file may be added to using the same syntax as the examples I've provided in my batch file.

 

In addition, the Terrain (terrain.cfg) system supports being configured but there is not a native way of installing, uninstalling, or modifying the associated configuration file. For information on configuring terrain, please see Terrain Configuration File.

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Fr. Bill,

 

Thanks for the post and the information you provided.  So what LM has done is to provide a quick and painless re-install provided developer's follow prescribed installation routines?  It is apparent that LM has left the door open to updating the core program without us having to perform a complete reinstall of all our addons.  I take this as a good thing as long as dev's learn the new format.

 

Regards,

 

Robert

\Robert Hamlich/

 

Very helpful Bill.

For the benefit of others, we'll say this works as designed but, does not insure that previous addons will port with success due to individual developer techniques. :wink:

  • Commercial Member

Playing around with a hypothetical batch file to config my Bar Harbor scenery, the user selects where to install the scenery, the batch file is included in a "Config" folder alongside the installed Scenery and Texture folders and the installer triggers it to run after copying all the files. This get's the P3D v3 path from the registry and configures the paths in the scenery.cfg and effects.cfg according to the user selected installation folder.


@echo off

:: determine if the OS is 32 bit or 64 bit and query the appropriate
:: registry key. Set the path into the variable "%p3dPath%", note the
:: path from the registry will contain a trailing slash so compose
:: commands accordingly, %p3dPath%Prepar3D.exe as opposed to %p3dPath%\Prepar3D.exe
:: which actually means "Lockheed Martin\Prepar3D v3\\Prepar3D.exe"
:: (note the double slashes, in practice they don't seem to
:: cause problems though so whatever...)


reg query HKLM\Hardware\Description\System\CentralProcessor\0 | find /i "x86" > nul
if %errorlevel% == 1 goto systemx64

:systemx86
for /f "tokens=1-2*" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Lockheed Martin\Prepar3D v3" /v SetupPath ^| find "REG_SZ"') do set p3dPath=%%c
goto check_path

:systemx64
for /f "tokens=1-2*" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Lockheed Martin\Prepar3D v3" /v SetupPath ^| find "REG_SZ"') do set p3dPath=%%c



:: make sure Prepare3D.exe exists at the path found else abort

:check_path
if not exist "%p3dPath%Prepar3D.exe" goto abort



:: make backups of the existing scenery.cfg and effects.cfg but
:: only if the backup files don't already exist (don't overwrite
:: the initial backup if setup_KBHB.bat gets run more than once)

if not exist "%programdata%\Lockheed Martin\Prepar3D v3\backup_scenery.cfg.kbhb" >nul copy "%programdata%\Lockheed Martin\Prepar3D v3\scenery.cfg" "%programdata%\Lockheed Martin\Prepar3D v3\backup_scenery.cfg.kbhb"
if not exist "%programdata%\Lockheed Martin\Prepar3D v3\backup_effects.cfg.kbhb" >nul copy "%programdata%\Lockheed Martin\Prepar3D v3\effects.cfg" "%programdata%\Lockheed Martin\Prepar3D v3\backup_effects.cfg.kbhb"



:: Add the two areas to the scenery.cfg. I want the landclass
:: beneath the scenery in the scenery library so adding that first
::
:: I want the user to be able to choose where he/she installs the
:: scenery and that will determine which directory the batch file
:: runs from as well as Local= in the scenery.cfg so I use %CD%
:: (current directory) in the Path= option. First cd up two
:: levels to get out of the KBHB Bar Harbor\Config folder

cd ..\..\

"%p3dPath%Prepar3D.exe" "-Configure: File=Scenery, Operation=Add, Path=%cd%\KBHB_Landclass, Title=KBHB_Landclass, Required=False, Active=True"

"%p3dPath%Prepar3D.exe" "-Configure: File=Scenery, Operation=Add, Path=%cd%\KBHB Bar Harbor, Title=KBHB Bar Harbor, Required=False, Active=True"



:: Add the KBHB effects folder to the effects.cfg

"%p3dPath%Prepar3D.exe" "-Configure: File=Effects, Operation=Add, Path=%cd%\KBHB Bar Harbor\effects, Title=KBHB Effects, Required=False, Active=True"



:: and when support for editing the terrain.cfg is eventually added I suspect the command might look something like this

::"%p3dPath%Prepar3D.exe" "-Configure: File=Terrain, Operation=Add, AppendFile=KBHB Bar Harbor\Config\terrain_cfg_KBHB_Shorelines.txt"



:: report success for 5 seconds and get out before the user sees the abort screen

cls
echo.
echo.
echo   Bar Harbor has been successfully installed!
echo   Start Prepar3D, go to airport: KBHB and enjoy!
>nul timeout /t 5
exit



:abort
cls
echo.
echo.
echo   There was a problem finding Prepar3D in your registry. Running one of the
echo   commonly available registry repair tools may fix the problem.
echo.
echo   Press a key to abort now...
>nul pause
exit

Here's the result in the scenery.cfg, "the user" selected to install the scenery into "D:\P3Dv3 Addon Content\Addon Scenery" in this case:

[Area.161]
Title=KBHB_Landclass
Local=D:\P3Dv3 Addon Content\Addon Scenery\KBHB_Landclass
Layer=161
Active=TRUE
Required=FALSE

[Area.162]
Title=KBHB Bar Harbor
Local=D:\P3Dv3 Addon Content\Addon Scenery\KBHB Bar Harbor
Layer=162
Active=TRUE
Required=FALSE

...and the effects.cfg:

[Entry.0]
PATH=D:\P3Dv3 Addon Content\Addon Scenery\KBHB Bar Harbor\effects
TITLE=KBHB Effects
ACTIVE=true
REQUIRED=true
[Entry.1]
PATH=D:\P3Dv3 Addon Content\Effects
TITLE=SimObject Effects
ACTIVE=true
REQUIRED=true
[Entry.2]
PATH=Effects
TITLE=Default Effects
ACTIVE=true
REQUIRED=true

Jim

Understood now. You have to check your scenery.cfg file is heading too.

 

Thanks Jim!

My%20Signature.jpg

Many thanks to Bill and Jim for sharing these helpful "worked examples" ! :smile:

 

GaryGB

  • 4 weeks later...

Very cool Y'all! Jim, is that "super-user" batch coding? Does batch coding allow for input? Or does take something like VB? Chas

My first sim flight simulator pD25zEJ.jpg

 

Take a ride to Stinking Creek! http://youtu.be/YP3fxFqkBXg Win10 Pro, GeForce GTX 1080TI/Rizen5 5600x  OCd,32 GB RAM,3x1920 x 1080, 60Hz , 27" Dell TouchScreen,TM HOTAS Warthog,TrackIR5,Saitek Combat Rudder Pedals HP reverbG2,Quest2

  • Commercial Member

Yeah you can get (some limited) user input if you want or need it but if you mean giving the user an option of where to install the scenery, that's taken care of by the installer's browse button, then the batch file runs from the installed directory afterwards and takes care of detecting/setting the correct paths on it's own.

 

Jim

Jim I have w10 and there is no Lockheed Martin entry in HKLM, its only in KKCU .V3 and V2.5, and its AppPath not SetupPath...

'REG QUERY "HKCU\SOFTWARE\Lockheed Martin\Prepar3D v3" /v  AppPath' I made a .bat with both queries SetupPath in HKLM and appPath in HKCU..

 

Jorge

  • Commercial Member

Ideally LM would set an environment variable %P3Dpath% or similar upon installation of v3 so we don't have to deal with flogging through the registry at all. Orbx did it, gmax does it...

and people like me with both 2.5 and 3 ... gets messy the same...

 

Jorge

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.