63 #include <shared_mutex>
68 #if INCLUDE_FMOD_SOUND + 0 >= 1
69 #include "fmod_errors.h"
70 #include "fmod_studio.h"
74 #include "XPLMUtilities.h"
75 #include "XPLMScenery.h"
76 #include "XPLMProcessing.h"
77 #include "XPLMGraphics.h"
78 #include "XPLMDataAccess.h"
79 #include "XPLMPlugin.h"
80 #include "XPLMDisplay.h"
81 #include "XPLMCamera.h"
82 #include "XPLMPlanes.h"
84 #include "XPLMSound.h"
98 #if INCLUDE_FMOD_SOUND + 0 >= 1
106 #define UNKNOWN_PLUGIN_NAME "(unknown)"
272 XPLMCameraPosition_t
posCamera = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
274 XPLMCameraPosition_t
prevCamera = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
313 extern GlobVars
glob;
Definitions of 2-D routines, like drawing aircraft labels.
Definitions for serving TCAS target dataRef updates.
Additional definitions beyond what public XPCAircraft defines.
Managing CSL Models, including matching and loading.
Manages contrails for an aircraft.
Definitions for creating the map layer.
Low-level network communications, especially for TCP/UDP.
Master/Client communication for aircraft synchronization on remote networked instances.
Sound for aircraft, based on XPLMSound.
Miscellaneous utility functions, including logging.
XPMP2::Aircraft / XPCAircraft represent an aircraft as managed by XPMP2.
#define UNKNOWN_PLUGIN_NAME
Definition: XPMP2.h:106
XPMP2::Aircraft represent an aircraft as managed by XPMP2.
Initialization and general control functions for XPMP2.
XPMPPlaneNotification
Events that trigger a notification callback.
Definition: XPMPMultiplayer.h:754
unsigned XPMPPlaneID
Unique ID for an aircraft created by a plugin.
Definition: XPMPMultiplayer.h:252
void(* XPMPPlaneNotifier_f)(XPMPPlaneID inPlaneID, XPMPPlaneNotification inNotification, void *inRefcon)
Type of the callback function you provide, called when one of the events defined in XPMPPlaneNotifica...
Definition: XPMPMultiplayer.h:766
Semi-public remote network functionality for master/client operations.
Actual representation of all aircraft in XPMP2.
Definition: XPMPAircraft.h:178
Definition: XPMPAircraft.h:70
logLevelTy
Logging level.
Definition: Utilities.h:249
@ logINFO
regular info messages
Definition: Utilities.h:251
std::map< XPMPPlaneID, Aircraft * > mapAcTy
Map of all aircraft, key is tthe plane id.
Definition: Aircraft.h:57
GlobVars glob
The one and only global variable structure.
Definition: Utilities.cpp:29
RemoteStatusTy
State of remote communcations.
Definition: XPMPRemote.h:439
@ REMOTE_RECV_WAITING
waiting to receive data, periodically sending a token of interest
Definition: XPMPRemote.h:443
@ REMOTE_OFF
no remote connectivtiy, not listening, not sending
Definition: XPMPRemote.h:440
@ REMOTE_SEND_WAITING
listening for a request to send data, but not actively sending data
Definition: XPMPRemote.h:441
@ REMOTE_SENDING
actively sending aircraft data out to the network
Definition: XPMPRemote.h:442
@ REMOTE_RECEIVING
actively receiving data
Definition: XPMPRemote.h:444
ThreeWaySwitchTy
3-way switch type
Definition: XPMP2.h:111
@ SWITCH_CFG_OFF
config: force off
Definition: XPMP2.h:112
@ SWITCH_CFG_AUTO
config: automatic or default
Definition: XPMP2.h:113
@ SWITCH_CFG_ON
config: force on
Definition: XPMP2.h:114
std::map< std::string, CSLModel > mapCSLModelTy
Map of CSLModels (owning the object), ordered by related group / type.
Definition: CSLModels.h:250
std::map< std::string, Doc8643 > mapDoc8643Ty
Map of Doc8643 information, key is the (icao) type code.
Definition: RelatedDoc8643.h:103
std::list< Obj8DataRefs > listObj8DataRefsTy
a list of Obj8DataRefs definitions
Definition: RelatedDoc8643.h:130
std::list< XPMPPlaneNotifierTy > listXPMPPlaneNotifierTy
Definition: XPMP2.h:129
std::map< std::string, XPLMMapLayerID > mapMapLayerIDTy
A map holding our layer identifier, indexed by the map's name.
Definition: Map.h:27
void XPMPSendNotification(const Aircraft &plane, XPMPPlaneNotification _notification)
Send a notification to all observers.
Definition: XPMPMultiplayer.cpp:572
std::map< std::string, std::string > mapCSLPackageTy
Map of CSLPackages: Maps an id to the base path (path ends on forward slash)
Definition: CSLModels.h:27
int PrefsFuncIntDefault(const char *, const char *, int _default)
Default config function just always returns the provided default value.
Definition: Utilities.cpp:179
All global config settings and variables are kept in one structure for convenient access and central ...
Definition: XPMP2.h:135
std::string defaultICAO
Default ICAO aircraft type designator if no match can be found.
Definition: XPMP2.h:180
listObj8DataRefsTy listObj8DataRefs
List of dataRef replacement in .obj files.
Definition: XPMP2.h:154
XPLMPluginID pluginId
This plugin's id.
Definition: XPMP2.h:267
bool bHasControlOfAIAircraft
Do we control X-Plane's AI/Multiplayer planes?
Definition: XPMP2.h:200
float vCam_z
Definition: XPMP2.h:276
bool bSoundMuteOnPause
Config: Mute on Pause?
Definition: XPMP2.h:250
bool bXPUsingModernGraphicsDriver
Using a modern graphics driver, ie. Vulkan/Metal?
Definition: XPMP2.h:263
listXPMPPlaneNotifierTy listObservers
List of notifier functions registered for being notified of creation/destruction/model change.
Definition: XPMP2.h:164
ThreeWaySwitchTy remoteCfgFromIni
Configuration file entry: Are we to support remote connections?
Definition: XPMP2.h:231
RemoteStatusTy remoteStatus
Status of remote connections to networked clients.
Definition: XPMP2.h:233
XPLMCameraPosition_t posCamera
Current camera location, updated every flight loop.
Definition: XPMP2.h:272
mapMapLayerIDTy mapMapLayers
Map of map layer ids, i.e. for each map this is the id of the corresponding layer of ours.
Definition: XPMP2.h:209
std::array< mapRelatedTy, REL_TXT_NUM > mapRelated
Content of related.txt and similar files as a map of keys to group id.
Definition: XPMP2.h:173
std::array< std::string, REL_TXT_NUM > pathRelated
Paths to related.txt, relOp.txt... files.
Definition: XPMP2.h:171
bool bDrawLabels
Shall we draw aircraft labels?
Definition: XPMP2.h:189
std::string pathMapIcons
path to file containing plane icons for map display
Definition: XPMP2.h:211
int contrailAltMax_ft
[ft] Auto Contrails: Maximum altitude
Definition: XPMP2.h:241
mapAcTy mapAc
Global map of all created planes.
Definition: XPMP2.h:187
int remotePort
The port we use is different from the port the X-Plane BEACON uses, so we don't get into conflict.
Definition: XPMP2.h:217
float prevCamera_ts
When has prevCamera been updated last?
Definition: XPMP2.h:278
bool bLabelCutOffAtVisibility
Cut off labels at XP's reported visibility mit?
Definition: XPMP2.h:195
std::string pluginName
Name of the plugin we are serving (used as map layer name or for folders)
Definition: XPMP2.h:157
std::string pathObj8DataRefs
Path to the Obj8DataRefs.txt file.
Definition: XPMP2.h:152
std::thread::id xpThread
id of X-Plane's thread (when it is OK to use XP API calls)
Definition: XPMP2.h:269
void UpdateCfgVals()
Update all settings, e.g. for logging level, by calling prefsFuncInt.
Definition: Utilities.cpp:185
std::string logAcronym
Plugin acronym used in log output.
Definition: XPMP2.h:159
ThreeWaySwitchTy eLabelOverride
Label drawing overriden in XPMP2.prf?
Definition: XPMP2.h:191
int(* prefsFuncInt)(const char *, const char *, int)
Configuration callback for integer values.
Definition: XPMP2.h:162
float vCam_x
Camera velocity.
Definition: XPMP2.h:276
float sndMasterVol
Sound master volume.
Definition: XPMP2.h:254
int verXPLM
XPLM's SDK version number (XPLMGetVersions)
Definition: XPMP2.h:261
void ThisThreadIsXP()
Set current thread as main xp Thread.
Definition: XPMP2.h:303
float maxLabelDist
Maximum distance for drawing labels? [m], defaults to 3nm.
Definition: XPMP2.h:193
int contrailAltMin_ft
[ft] Auto Contrails: Minimum altitude
Definition: XPMP2.h:240
std::string carIcaoType
Ground vehicle type identifier (map decides icon based on this)
Definition: XPMP2.h:182
size_t remoteBufSize
Buffer size, ie. max message length we send over multicast.
Definition: XPMP2.h:225
void ReadVersions()
Read version numbers into verXplane/verXPLM.
Definition: Utilities.cpp:280
std::string resourceDir
Resource directory, to store local definitions of vertical offsets (clamping)
Definition: XPMP2.h:184
bool bLogMdlMatch
Debug model matching?
Definition: XPMP2.h:141
bool remoteAutoDiscovery() const
Use auto-discovery for the MC send interface?
Definition: XPMP2.h:221
bool RemoteIsSender() const
Are we a sender?
Definition: XPMP2.h:237
XPMPPlaneID NextPlaneId()
Get the next unique artifical plane id.
Definition: Utilities.cpp:37
mapCSLModelTy mapCSLModels
Global map of all CSL Models, indexed by related group, aircraft type, and model id.
Definition: XPMP2.h:178
int verXPlane
X-Plane's version number (XPLMGetVersions)
Definition: XPMP2.h:259
logLevelTy logLvl
Logging level.
Definition: XPMP2.h:139
bool bObjReplDataRefs
Replace dataRefs in .obj files on load? (defaults to OFF!)
Definition: XPMP2.h:148
bool bHandleDupId
Handle duplicate XPMP2::Aircraft::modeS_id by overwriting with unique id.
Definition: XPMP2.h:145
bool bMapLabels
Do we show labels with the aircraft icons?
Definition: XPMP2.h:207
void ReadConfigFile()
Read from a generic XPMP2.prf or XPMP2.<logAcronym>.prf config file.
Definition: Utilities.cpp:79
bool bClampAll
Clamp all planes to the ground? Default is false as clamping is kinda expensive due to Y-Testing.
Definition: XPMP2.h:143
ThreeWaySwitchTy remoteCfg
Configuration: Are we to support remote connections?
Definition: XPMP2.h:229
XPLMCameraPosition_t prevCamera
Previous camera location of about a second ago.
Definition: XPMP2.h:274
bool bXPNetworkedSetup
Is X-Plane configured for networked multi-computer or multiplayer setup?
Definition: XPMP2.h:265
bool contrailMulti
Auto-create multiple or just a single contrail?
Definition: XPMP2.h:243
bool RemoteIsListener() const
Are we a listener?
Definition: XPMP2.h:235
float labelFontScaling
Label font scaling factor.
Definition: XPMP2.h:197
std::string remoteMCGroup
The multicast group that we use, which is the same X-Plane is using itself for its BEACON.
Definition: XPMP2.h:215
int remoteTxfFrequ
Max transfer frequency per second.
Definition: XPMP2.h:227
bool bSoundForceFmodInstance
Config: Force own FMOD instance?
Definition: XPMP2.h:248
std::string remoteSendIntf
The interface used to send multicast on. (Empty == auto-discovery)
Definition: XPMP2.h:219
void UpdateCameraPos()
Update the stored camera position and velocity values.
Definition: Utilities.cpp:295
mapDoc8643Ty mapDoc8643
Content of Doc8643.txt file.
Definition: XPMP2.h:169
ThreeWaySwitchTy eAIOverride
AI Control overriden in XPMP2.prf?
Definition: XPMP2.h:202
float vCam_y
Definition: XPMP2.h:276
bool bSoundAutoMuted
Is sound currently being auto-muted?
Definition: XPMP2.h:256
bool UsingModernGraphicsDriver() const
Using a modern graphics driver, ie. Vulkan/Metal?
Definition: XPMP2.h:301
int xpCycleNum
Current XP cycle number (see XPLMGetCycleNumber())
Definition: XPMP2.h:281
bool bSoundAvail
Is the sound system available?
Definition: XPMP2.h:252
bool bMapEnabled
Do we feed X-Plane's maps with our aircraft positions?
Definition: XPMP2.h:205
bool IsXPThread() const
Is this thread XP's main thread?
Definition: XPMP2.h:306
int contrailLifeTime
[s] Contrail default time to live
Definition: XPMP2.h:242
XPMPPlaneID planeId
Current plane ID counter.
Definition: XPMP2.h:285
GlobVars(logLevelTy _logLvl=logINFO, bool _logMdlMatch=false)
Constructor.
Definition: XPMP2.h:292
mapCSLPackageTy mapCSLPkgs
Global map of all CSL Packages, indexed by xsb_aircraft.txt::EXPORT_NAME
Definition: XPMP2.h:176
bool bSoundOnStartup
Config: Start Sound on startup?
Definition: XPMP2.h:246
std::string pathDoc8643
Path to Doc8643.txt file.
Definition: XPMP2.h:167
bool bObjReplTextures
Replace textures in .obj files on load if needed?
Definition: XPMP2.h:150
int remoteTTL
Time-to-live, or mumber of hops for a multicast message.
Definition: XPMP2.h:223
Stores the function and refcon pointer for plane creation/destrcution notifications.
Definition: XPMP2.h:118
bool operator==(const XPMPPlaneNotifierTy &o)
Definition: XPMP2.h:125
XPMPPlaneNotifier_f func
Definition: XPMP2.h:119
XPMPPlaneNotifierTy(XPMPPlaneNotifier_f _func=nullptr, void *_refcon=nullptr)
Definition: XPMP2.h:122
void * refcon
Definition: XPMP2.h:120