Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Add-on Packages Page 1 of 9

Add-on Packages
Contents
• Overview
• Creating an Add-on Package
◦ SimBase.Document Schema
◦ AddOn.Component Schema
• Distributing an Add-on Package
• Add-on Package Example
Related Links
• Add-ons Overview
• Add-on Configuration Files
• Add-on Instructions for Developers

Overview
Add-on Packages are the recommended way of distributing add-ons because the package provides a
centralized list of all of the Add-on Components necessary to load the Add-on.

Creating an Add-on Package


After an add-on has been developed, an Add-on Package file should be created to specify which add-on
components Prepar3D should load when processing the add-on. This file must be called:

add-on.xml

The file should be placed at the root level directory of the developed add-on. The root level of the add-on
is typically the folder of the add-on's Product Name. The Instructions for Developers article outlines this
and where to place the add-on.xml file.

Inside this package file is both information about the Add-on Package as well as a list of Add-on
Components. Each Add-on Component specifies the category of the component, the path to where its
located, and other information.

The format for the add-on.xml is as follows:

SimBase.Document Schema

The properties at the SimBase.Document level describe the add-on package. The base document can
contain multiple AddOn.Component property sets which define each piece of add-on content that
describe the add-on.

Default
Property Description Examples
Value
Name Empty <SimBase.Document>
String  ...

https://www.prepar3d.com/SDKv4/sdk/add-ons/add-on_packages.html 15/08/2019
Add-on Packages Page 2 of 9

Default
Property Description Examples
Value
A name that will be used to  <AddOn.Name>My Add-
show the add-on package in the on</AddOn.Name>
UI.  ...
</SimBase.Document>
<SimBase.Document>
 ...
Description A description of the add-on
Empty  <AddOn.Description>My Add-
(Optional, Highly package which is shown in the
String on</AddOn.Description>
Recommended) UI.
 ...
</SimBase.Document>

AddOn.Component Schema

The AddOn.Component section specifies an individual add-on component that should be added when
processing a package.

Default
Property Description Examples
Value
Category The following list of Must <AddOn.Component>
keywords, shown Specify  ...
below, are categories  <Category>Scenery</Category>
that the component  ...
belongs to. </AddOn.Component>
>

Note: Use the bolded


keyword as the
category option.

• Autogen -
Refers to a
component that
adds an
additional
autogen
directory that
Prepar3D can
use to resolve
autogen files.
• DLL - Refers to
a component
that loads an
add-on library.
• EXE - Refers to
a component
that loads an
add-on
application.
• Effects - Refers
to a component
that adds an
additional

https://www.prepar3d.com/SDKv4/sdk/add-ons/add-on_packages.html 15/08/2019
Add-on Packages Page 3 of 9

Default
Property Description Examples
Value
effects directory
that Prepar3D
can use to
resolve effects.
• Fonts - Refers
to a component
that adds an
additional fonts
directory that
Prepar3D can
use to resolve
fonts.
• Gauges - Refers
to a component
that adds an
additional
gauges directory
that Prepar3D
can use to
resolve gauges.
• Sound - Refers
to a component
that adds an
additional sound
directory that
Prepar3D can
use to resolve
sound files.
• Scaleform -
Refers to a
component that
adds an
additional
scaleform
directory that
Prepar3D can
use to resolve
scaleform files.
• Scenarios -
Refers to a
component that
adds an
additional
scenario
directory that the
user can choose
to load scenarios
from.
• Scenery - Refers
to a component
that adds an
additional
scenery area to

https://www.prepar3d.com/SDKv4/sdk/add-ons/add-on_packages.html 15/08/2019
Add-on Packages Page 4 of 9

Default
Property Description Examples
Value
Prepar3D's
world.
• Scripts - Refers
to a component
that adds an
additional script
directory that
Prepar3D can
use to resolve
script files (.lua).
• ShadersHLSL -
Refers to a
component that
adds an
additional
shaders and
HLSL directory
that Prepar3D
can use to
shader and
HLSL files.
• SimObjects -
Refers to a
component that
adds an
additional
simobject
directory that the
user can choose
to load
simobjects from.
• Texture - Refers
to a component
that adds an
additional
texture directory
that Prepar3D
can use to
resolve textures.
• Weather -
Refers to a
component that
adds an
additional
weather
directory that
Prepar3D can
use to resolve
weather files.

Path The folder path of the Must <AddOn.Component>


component to be Specify  ...
loaded. By default the  <Path>My Scenery Folder</Path>
path is relative to the  ...

https://www.prepar3d.com/SDKv4/sdk/add-ons/add-on_packages.html 15/08/2019
Add-on Packages Page 5 of 9

Default
Property Description Examples
Value
directory of the add- </AddOn.Component>
on.xml file. However, >
absolute paths are
allowed.
A name for the
individual component.
For scenery
components this is
required, however it is
highly recommended
to have a component
name since it will
show in the UI. For
scenery components,
their name is also
shown in the Scenery
Library.
Name <AddOn.Component>
(Optional,  ...
Empty
required for  <Name>My Scenery Region</Name>
Note: Since String
Scenery  ...
Components) Prepar3D's </AddOn.Component>
configuration system
does not support
components of the
same category with the
same name, be wary of
creating a name that is
not unique or it will
overwrite the
identically named
component. However,
if the component is not
given a name, a name
collision cannot occur.
Type The type identifier GLOBAL <AddOn.Component>
(Texture string determines what  ...
Category Only) kind of path the entry  <Type>WORLD</Type>
refers to. At this  ...
moment, only texture </AddOn.Component>
components support
this feature. For
textures, the type of
entries are:

• UI
• GLOBAL
• WORLD

The default value is


GLOBAL and should
be sufficient for most
add-ons. Most systems

https://www.prepar3d.com/SDKv4/sdk/add-ons/add-on_packages.html 15/08/2019
Add-on Packages Page 6 of 9

Default
Property Description Examples
Value
will at least search
GLOBAL directories,
however some systems
may search both
GLOBAL and
WORLD directories
in a fallback manner.
At this time, the UI
texture type is only
used internally.
The layer of the
scenery area
component starting at
<AddOn.Component>
one, where higher
 ...
numbered layers take An integer
 <Layer>1</Layer>
Layer precendence over representing
 ...
(Scenery lower numbered a layer one
</AddOn.Component>
Category Only) layers. Add-on higher than
sceneries typically do the top layer
(A scenery component whose layer is the base
not specify a layer and
scenery layer)
it is assumed that they
should be the topmost
layer.
Specify optional
<AddOn.Component>
CommandLine command line
 ...
(Optional, EXE arguments to start the Empty
 <CommandLine>True</CommandLine>
and DLL add-on application String
 ...
Category Only) (EXE) or library
</AddOn.Component>
(DLL) with.
DLLType The DLLType Empty <AddOn.Component>
(Optional, DLL determines how the String  ...
Category Only) add-on library is  <DLLType>SimConnect</DLLType>
initially launched. If  ...
the DLLType is not </AddOn.Component>
set (i.e. Empty String),
then the default start,
"entry point", and stop,
"exit point", functions,
described in their
respective sections, are
used. The list of non-
default DLLTypes
are:

• SimConnect
• PDK

When using these


types above, the
default
DLLStartName and
DLLStopName
change, unless
overridden. Please be

https://www.prepar3d.com/SDKv4/sdk/add-ons/add-on_packages.html 15/08/2019
Add-on Packages Page 7 of 9

Default
Property Description Examples
Value
aware, the
DLLStartName's
function parameters
for each of the
parameters are also
different:

• Default (Empty
String): This
start function
does not have
any function
arguments.

• SimConnect:
This start
function has a
single function
argument which
is a pointer to a
constant
character array
or const char*.

• PDK: This start


function has a
single function
argument which
is a pointer to
the Prepar3D
PDK interface or
P3D::IPdk*.

It is not necessary to
set this field unless the
add-on developer
wishes to use an
overridden DLL start
name, "entry point".
The DLLStartName <AddOn.Component>
that will be used by  ...
Prepar3D, if this field <DLLStartName>MyEntryFunc</DLLStartName>
DLLStartName is not set, is  ...
(See </AddOn.Component>
(Optional, DLL determined by the
Description)
Category Only) DLLType:
• Default (Empty
String): (A hypothetical function called MyEntryFunc that
DLLStart is the entry point of the add-on)

• SimConnect:
SimConnectStart

• PDK: DLLStart

https://www.prepar3d.com/SDKv4/sdk/add-ons/add-on_packages.html 15/08/2019
Add-on Packages Page 8 of 9

Default
Property Description Examples
Value
DLLStopName It is not necessary to (See <Addon.Component>
(Optional, DLL set this field unless the Description)  ...
Category Only) add-on developer <DLLStopName>MyExitFunc</DLLStopName>
wishes to use an  ...
overridden DLL stop </Addon.Component>
name, "exit point".
The DLLStopName
that will be used by
Prepar3D, if this field (A hypothetical function called MyExitFunc that is
is not set, is the exit point of the add-on)
determined by the
DLLType:

• Default (Empty
String):
DLLStop

• SimConnect:
SimConnectStop

• PDK: DLLStop

The add-on library <Addon.Component>


(DLL) or application  ...
NewConsole
(EXE) will have a new  <NewConsole>True</NewConsole>
(Applications
console in contrary to False  ...
and Library
the default behavior of </Addon.Component>
Category Only)
inheriting the parent
application's console.

Distributing an Add-on Package


Create an Add-on Package that specifies a list of Add-on Components that Prepar3D should load. The
recommended and most straightforward way of distribution is to create an add-on whose directory
structure aligns with the Add-on Instructions for Developers and whose installation path is Prepar3D's
default add-on discovery folder:

%USERPROFILE%\Documents\Prepar3D v4 Add-
ons

Other distribution methods include:

• Add the add-on package directly using Command Line.


• Add an add-on discovery path using Command Line to automatically search for subfolders
containing add-on products (i.e. folders with the add-on package file titled add-on.xml)

When Prepar3D loads, there is a discovery phase where new add-on packages inside each of the
discoverable add-on folders are found and cached. Add-on packages can be found and loaded upon startup
if they are placed one directory level deep inside an add-on discovery folder. Any add-ons that were
cached but could no longer be found are subsequently cleaned up.

For each add-on package being processed, its add-on components, found inside the package, are
processed in the order they are read. By default, add-on components processed via packages will take

https://www.prepar3d.com/SDKv4/sdk/add-ons/add-on_packages.html 15/08/2019
Add-on Packages Page 9 of 9

precedence over any add-on components not found in a package (i.e. entries in add-on configuration
files).

Add-on Package Example


A full example of an add-on package is shown below:

add-on.xml

<SimBase.Document Type="AddOnXml" version="4,0" id="add-on">


<AddOn.Name>MyAddOn</AddOn.Name>
<AddOn.Description>My Add-on developed by My Company.</AddOn.Description>
<AddOn.Component>
<Category>SimObjects</Category>
<Path>Content\SimObjects\Airplanes</Path>
</AddOn.Component>
<AddOn.Component>
<Category>Scenarios</Category>
<Path>Content\Scenarios</Path>
</AddOn.Component>
<AddOn.Component>
<Category>Scenery</Category>
<Path>Content\Scenery\Scenery01</Path>
<Name>Scenery01</Name>
</AddOn.Component>
<AddOn.Component>
<Category>Scenery</Category>
<Path>Content\Scenery\Scenery02</Path>
<Name>Scenery02</Name>
</AddOn.Component>
<AddOn.Component>
<Category>DLL</Category>
<Path>MyFirstDll.dll</Path>
<DLLType>PDK</DLLType>
</AddOn.Component>
<AddOn.Component>
<Category>DLL</Category>
<Path>MySecond.dll</Path>
<DLLStartName>MyStartFunc</DLLStartName>
<DLLStopName>MyStopFunc</DLLStopName>
</AddOn.Component>
<AddOn.Component>
<Category>Texture</Category>
<Path>Textures/Global</Path>
<Type>GLOBAL</Type>
</AddOn.Component>
</SimBase.Document>

Note: This file above is meant to serve as an instructive example and shows the correct file format the
developer should use. However, there are DLL and folder paths referenced above that the developer may
not have. Make sure your add-on package file contains only add-on components that have valid file and
folder paths.

- top -

https://www.prepar3d.com/SDKv4/sdk/add-ons/add-on_packages.html 15/08/2019

You might also like