XPMP2
X-Plane multiplayer library 2 - using instancing
|
Classes | |
struct | CSLModelInfo_t |
Collates some information on the CSL model. More... | |
class | Aircraft |
Actual representation of all aircraft in XPMP2. More... | |
class | XPMP2Error |
XPMP2 Exception class, e.g. thrown if there are no CSL models or duplicate modeS_ids when creating an Aircraft. More... | |
struct | RemoteDataRefPackTy |
Definition for how to map dataRef values to (u)int8, ie. to an integer range of 8 bits. More... | |
struct | RemoteMsgBaseTy |
Message header, identical for all message types. More... | |
struct | RemoteMsgBeaconTy |
"Beacon of Interest", ie. some message on the multicast just to wake up sender More... | |
struct | RemoteMsgSettingsTy |
Settings message, identifying a sending plugin, regularly providing its settings. More... | |
struct | RemoteAcDetailTy |
A/C details, packed into an array message. More... | |
struct | RemoteMsgAcDetailTy |
A/C detail message, has an inherited header plus an array of XPMP2::RemoteAcDetailTy elements. More... | |
struct | RemoteAcPosUpdateTy |
A/C Position updates based on global coordinates. More... | |
struct | RemoteMsgAcPosUpdateTy |
A/C detail message, has an inherited header plus an array of XPMP2::RemoteAcDetailTy elements. More... | |
struct | RemoteAcAnimTy |
A/C animation dataRef changes. More... | |
struct | RemoteMsgAcAnimTy |
A/C animation dataRef message, has an inherited header plus an array of variable sized XPMP2::RemoteAcAnimTy elements. More... | |
struct | RemoteAcRemoveTy |
A/C Removal only includes the plane id, structure required for msgSize() function. More... | |
struct | RemoteMsgAcRemoveTy |
A/C removal message, an array of plane ids. More... | |
struct | RemoteCBFctTy |
Function prototypes for callback functions to handle the received messages. More... | |
struct | multiDataRefsTy |
Keeps the dataRef handles for one of the up to 19 legacy AI/Multiplayer slots ("sim/multiplayer/position") More... | |
struct | infoDataRefsTy |
Keeps the dataRef handles for one of the up to 63 shared data slots ("sim/multiplayer/position/plane#...") More... | |
union | TcasLightsTy |
A structure simplifying communicaton with sim/cockpit2/tcas/targets/position/lights. More... | |
class | LegacyAircraft |
This class helps creating aircraft via the legacy global functions. It provides standard implementations of the abstract callbacks. More... | |
class | CSLObj |
One .obj file of a CSL model (of which it can have multiple) More... | |
class | CSLModel |
Represents a CSL model as it is saved on disk. More... | |
struct | LocalIntfAddrTy |
Stores information about local interface addresses. More... | |
struct | SockAddrTy |
Helper definition for all these IPv4/6 differences. More... | |
class | NetRuntimeError |
Exception raised by XPMP2::SocketNetworking objects. More... | |
class | SocketNetworking |
Base class for any socket-based networking. More... | |
class | UDPReceiver |
Receives UDP messages. More... | |
class | UDPMulticast |
UDP Multicast, always binding to INADDR_ANY. More... | |
class | TCPConnection |
Listens to TCP connections and opens a session socket upon connect. More... | |
struct | InetAddrTy |
Numerical IP address, used for both ipv4 and ipv6, for ease of handling. More... | |
struct | Doc8643 |
Represents a line in the Doc8643.txt file, of which we use only classification and WTC. More... | |
struct | Obj8DataRefs |
A pair of strings, first one to search for, second one to replace it with. More... | |
struct | RemoteAcDetailTy_v0 |
Version 0 A/C details, packed into an array message. More... | |
struct | RemoteMsgAcDetailTy_v0 |
Version 0 A/C detail message, has an inherited header plus an array of XPMP2::RemoteAcDetailTy elements. More... | |
struct | RmtAcCacheTy |
Holds a copy of some aircraft data as was sent out last. More... | |
class | RmtDataBaseTy |
Base structure for passing information from XP's main thread to the multicast thread. More... | |
class | RmtDataEnqeueTy |
Passing information about any data type (like a/c full detail message); the data is contained as copy. More... | |
class | RmtDataAcAnimTy |
Animation dataRef requires a special queue data type as each msg element is already of variable length. More... | |
class | RmtMsgBufTy |
Helper class to manage the temporary buffers in which the network message are put together. More... | |
struct | SoundDefTy |
Definition of how sound is handled based on dataRef values (type) More... | |
class | FmodError |
Exception class to pass on error information. More... | |
class | SoundFile |
Represents a sound file. More... | |
class | SoundWAV |
Represents a WAV file, read into memory, played by XP's Sound API. More... | |
class | SoundChannel |
A sound object being played, called channel. More... | |
class | SoundSystem |
Base class for sound systems, practically empty. More... | |
class | SoundSystemXP |
Encapsulates the XP12 Sound System. More... | |
class | SoundFMOD |
Represents a sound file to be passed on to FMOD to be played. More... | |
class | SoundSystemFMOD |
Encapsulates direct access to the FMOD Sound System. More... | |
struct | XPMPPlaneNotifierTy |
Stores the function and refcon pointer for plane creation/destrcution notifications. More... | |
struct | GlobVars |
All global config settings and variables are kept in one structure for convenient access and central definition. More... | |
union | SockAddrTy.__unnamed4__ |
union | InetAddrTy.__unnamed6__ |
union | RmtDataAcAnimTy.__unnamed8__ |
Typedefs | |
typedef std::map< float, XPMPPlaneID > | mapAcByDistTy |
Map of Aircrafts, sorted by (priority-biased) distance. More... | |
typedef std::map< std::string, Aircraft::wakeTy > | mapWakeTy |
typedef std::map< XPMPPlaneID, Aircraft * > | mapAcTy |
Map of all aircraft, key is tthe plane id. More... | |
typedef std::map< std::string, int > | mapStrIntTy |
a map of a text and a counter More... | |
typedef std::map< std::string, std::string > | mapCSLPackageTy |
Map of CSLPackages: Maps an id to the base path (path ends on forward slash) More... | |
typedef std::list< CSLObj > | listCSLObjTy |
List of objects. More... | |
typedef std::pair< std::string, std::string > | pairOfStrTy |
typedef std::map< std::string, CSLModel > | mapCSLModelTy |
Map of CSLModels (owning the object), ordered by related group / type. More... | |
typedef std::multimap< unsigned long, std::pair< CSLModel *, const CSLModel::MatchCritTy * > > | mmapCSLModelPTy |
Multimap of references to CSLModels and match criteria for matching purposes. More... | |
typedef std::map< std::string, XPLMMapLayerID > | mapMapLayerIDTy |
A map holding our layer identifier, indexed by the map's name. More... | |
typedef std::set< LocalIntfAddrTy > | SetLocalIntfAddrTy |
Set of local IP interface addresses. More... | |
typedef std::map< std::string, int > | mapRelatedTy |
Map of group membership: ICAO a/c type maps to line in related.txt. More... | |
typedef std::map< std::string, Doc8643 > | mapDoc8643Ty |
Map of Doc8643 information, key is the (icao) type code. More... | |
typedef std::list< Obj8DataRefs > | listObj8DataRefsTy |
a list of Obj8DataRefs definitions More... | |
typedef std::map< XPMPPlaneID, RmtAcCacheTy > | mapRmtAcCacheTy |
Defines a map with the plane id as key and the aboce cache structure as payload. More... | |
typedef std::unique_ptr< RmtDataBaseTy > | ptrRmtDataBaseTy |
Smart pointer to XPMP2::RmtDataBaseTy by which we manage objects of this and derived types. More... | |
typedef std::queue< ptrRmtDataBaseTy, std::list< ptrRmtDataBaseTy > > | queueRmtDataTy |
A queue managing the information objects, used to transfer data between main thread and network thread. More... | |
typedef RmtDataEnqeueTy< RemoteAcDetailTy, RMT_MSG_AC_DETAILED > | RmtDataAcDetailTy |
A/C Detail queue type. More... | |
typedef RmtDataEnqeueTy< RemoteAcPosUpdateTy, RMT_MSG_AC_POS_UPDATE > | RmtDataAcPosUpdateTy |
A/C Position Update queue type. More... | |
typedef RmtDataEnqeueTy< RemoteAcRemoveTy, RMT_MSG_AC_REMOVE > | RmtDataAcRemoveTy |
A/C Removal queue type. More... | |
typedef std::unique_ptr< RmtDataAcAnimTy > | ptrRmtDataAcAnimTy |
Smart pointer to XPMP2::RmtDataAcAnimTy. More... | |
typedef XPLM_API FMOD_CHANNEL *() | f_XPLMPlayPCMOnBus(void *audioBuffer, uint32_t bufferSize, FMOD_SOUND_FORMAT soundFormat, int freqHz, int numChannels, int loop, XPLMAudioBus audioType, XPLMPCMComplete_f inCallback, void *inRefcon) |
typedef XPLM_API FMOD_RESULT() | f_XPLMStopAudio(FMOD_CHANNEL *fmod_channel) |
typedef XPLM_API FMOD_RESULT() | f_XPLMSetAudioPosition(FMOD_CHANNEL *fmod_channel, FMOD_VECTOR *position, FMOD_VECTOR *velocity) |
typedef XPLM_API FMOD_RESULT() | f_XPLMSetAudioFadeDistance(FMOD_CHANNEL *fmod_channel, float min_fade_distance, float max_fade_distance) |
typedef XPLM_API FMOD_RESULT() | f_XPLMSetAudioVolume(FMOD_CHANNEL *fmod_channel, float source_volume) |
typedef XPLM_API FMOD_RESULT() | f_XPLMSetAudioCone(FMOD_CHANNEL *fmod_channel, float inside_angle, float outside_angle, float outside_volume, FMOD_VECTOR *orientation) |
typedef std::unique_ptr< SoundFile > | SoundFilePtr |
Smart pointer to a SoundFile object. More... | |
typedef std::map< std::string, SoundFilePtr > | mapSoundPtrTy |
Map of all sounds, indexed by a sound name (type) More... | |
typedef std::list< XPMPPlaneNotifierTy > | listXPMPPlaneNotifierTy |
Functions | |
Aircraft * | AcFindByID (XPMPPlaneID _id) |
Find aircraft by its plane ID, can return nullptr. More... | |
bool | AcSetDefaultWakeData (const std::string &_wtc, const Aircraft::wakeTy &_wake) |
(Re)Define default wake turbulence values per WTC More... | |
std::uint16_t | PJWHash16 (const char *s) |
Produces a reproducible(!) hash value for strings. More... | |
CSLModel * | CSLModelByPkgShortId (std::uint16_t _pkgHash, const std::string &_shortId) |
Find a model by package name hash and short id. More... | |
template<class T > | |
constexpr const T & | clamp (const T &v, const T &lo, const T &hi) |
Clamps v between lo and hi : lo if v < lo , hi if hi < v , otherwise v More... | |
RemoteStatusTy | RemoteGetStatus () |
Returns the current Remote status. More... | |
void | RemoteRecvStart (const RemoteCBFctTy &_rmtCBFcts) |
Starts the listener, will call provided callback functions with received messages. More... | |
void | RemoteRecvStop () |
Stops the receiver. More... | |
void | TwoDDrawLabels () |
Write the labels of all aircraft. More... | |
int | CPLabelDrawing (XPLMDrawingPhase, int, void *) |
Drawing callback, called by X-Plane in every drawing cycle. More... | |
void | TwoDActivate () |
Activate actual label drawing, esp. set up drawing callback. More... | |
void | TwoDDeactivate () |
Deactivate actual label drawing, esp. stop drawing callback. More... | |
void | TwoDInit () |
Initialize the module. More... | |
void | TwoDCleanup () |
Grace cleanup. More... | |
void | AIMultiClearAIDataRefs (multiDataRefsTy &drM, bool bDeactivateToZero) |
Resets all actual values of the AI/multiplayer dataRefs of one plane to something initial. More... | |
void | AIMultiClearInfoDataRefs (infoDataRefsTy &drI) |
Clears the shared info dataRefs. More... | |
bool | GoTCASOverride () |
Are we going to new (TCAS override) or the old way? More... | |
bool | GoTCASWake () |
Can we use the XP12 wake support system? More... | |
size_t | AIUpdateMultiplayerDataRefs () |
The old way: Update Multiplayer dataRefs directly. More... | |
size_t | AIUpdateTCASTargets () |
The modern way: Use TCAS override and update TCAS targets. More... | |
void | AIAssignSlots (size_t fromSlot, size_t toSlot) |
Assigns slots, ie. planes to places in gSlots. More... | |
void | AIMultiUpdate () |
Updates all TCAS target dataRefs, both standard X-Plane, as well as additional shared dataRefs for text publishing. More... | |
int | AIMultiControlPlaneCount (XPLMDrawingPhase, int inIsBefore, void *) |
Callback to toggle aircraft count ("TCAS hack") More... | |
void | AIMultiClearTcasDataRefs () |
Clears the key (mode_s) of the TCAS target dataRefs. More... | |
void | AIMultiInitAllDataRefs (bool bDeactivateToZero) |
Reset all (controlled) multiplayer dataRef values of all planes. More... | |
void | AIMultiInformDREs () |
Inform DRE and DRT of our shared dataRefs. More... | |
void | AIMultiInit () |
Initialize the module. More... | |
void | AIMultiCleanup () |
Grace cleanup. More... | |
float | obj_get_float (void *) |
int | obj_get_float_array (void *, float *, int, int inCount) |
See obj_get_float() More... | |
void | AcInit () |
Initialize the module. More... | |
void | AcCleanup () |
Grace cleanup, esp. remove all aircraft. More... | |
bool | ContrailInit () |
Initialize the Contrail module and load the Contrail object. More... | |
void | ContrailCleanup () |
Graceful shutdown. More... | |
std::string | CSLModelGetKeyStr (int _related, const std::string &_type, const std::string &_id) |
compiles the string used as key in the CSL model map More... | |
std::string | CSLModelsConvPackagePath (const std::string &pkgPath, int lnNr, bool bPkgOptional=false) |
Turn a relative package path into a full path. More... | |
void | CSLModelsAdd (CSLModel &_csl) |
Adds a readily defined CSL model to all the necessary maps. More... | |
const char * | CSLModelsReadPkgId (const std::string &path) |
Scans an xsb_aircraft.txt file for EXPORT_NAME entries to fill the list of packages. More... | |
const char * | CSLModelsFindPkgs (const std::string &_path, std::vector< std::string > &paths, int _maxDepth=5) |
Recursively scans folders to find xsb_aircraft.txt files of CSL packages. More... | |
void | AcTxtLine_DEPENDENCY (std::vector< std::string > &tokens, int lnNr) |
Process an DEPENDENCY line of an xsb_aircraft.txt file. More... | |
void | AcTxtLine_OBJ8_AIRCRAFT (CSLModel &csl, const std::string &ln, const std::string &xsbAircraftPath, const std::string &exportName, int lnNr) |
Process an OBJ8_AIRCRAFT line of an xsb_aircraft.txt file. More... | |
void | AcTxtLine_OBJECT_AIRCRAFT (CSLModel &csl, const std::string &, int) |
Process an OBJECT or AIRCRAFT line of an xsb_aircraft.txt file (which are no longer supported) More... | |
void | AcTxtLine_OBJ8 (CSLModel &csl, std::vector< std::string > &tokens, int lnNr) |
void | AcTxtLine_VERT_OFFSET (CSLModel &csl, std::vector< std::string > &tokens, int lnNr) |
Process an VERT_OFFSET line of an xsb_aircraft.txt file. More... | |
void | AcTxtLine_OFFSET (CSLModel &csl, std::vector< std::string > &tokens, int lnNr) |
void | AcTxtLine_MATCHES (CSLModel &csl, std::vector< std::string > &tokens, int lnNr) |
Process an ICAO, AIRLINE, LIVERY, or MATCHES line of an xsb_aircraft.txt file. More... | |
int | StrCntString (const mapStrIntTy &m, std::string &s) |
Compiles a string from a map of string->int like "(A320 x 5, A388 x 12)". More... | |
const char * | CSLModelsProcessAcFile (const std::string &path) |
Process one xsb_aircraft.txt file for importing OBJ8 models. More... | |
void | CSLModelsInit () |
Initialization. More... | |
void | CSLModelsCleanup () |
Grace cleanup. More... | |
const char * | CSLModelsLoad (const std::string &_path, int _maxDepth=5) |
Read the CSL Models found in the given path and below. More... | |
CSLModel * | CSLModelById (const std::string &_cslId, mapCSLModelTy::iterator *_pOutIter=nullptr) |
Find a model by unique id. More... | |
CSLModel * | CSLModelByKey (const std::string &_cslKey, mapCSLModelTy::iterator *_pOutIter=nullptr) |
Find a model by (even more) unique key. More... | |
template<class IteratorT > | |
IteratorT | iterRnd (IteratorT lower, IteratorT upper) |
Returns any random value in the range [cslLower; cslUpper) , or upper if there is no value in that range. More... | |
bool | CSLFindMatch (const std::string &_type, const std::string &_airline, const std::string &_livery, bool bIgnoreNoMatch, int &quality, CSLModel *&pModel) |
Tries finding a match using both aircraft and Doc8643 attributes. More... | |
int | CSLModelMatching (const std::string &_type, const std::string &_airline, const std::string &_livery, CSLModel *&pModel) |
Find a matching model. More... | |
bool | IsInRect (float x, float y, const float bounds_ltrb[4]) |
Tests if x/y lies within the rect, given as a float[4] array. More... | |
void | MapPrepareCacheCB (XPLMMapLayerID, const float *inTotalMapBoundsLeftTopRightBottom, XPLMMapProjectionID projection, void *) |
Prepare map drawing information. More... | |
void | MapIconDrawingCB (XPLMMapLayerID inLayer, const float *inMapBoundsLeftTopRightBottom, float, float mapUnitsPerUserInterfaceUnit, XPLMMapStyle, XPLMMapProjectionID projection, void *refcon) |
Actually draw the icons into the map. More... | |
void | MapLabelDrawingCB (XPLMMapLayerID inLayer, const float *inMapBoundsLeftTopRightBottom, float, float mapUnitsPerUserInterfaceUnit, XPLMMapStyle, XPLMMapProjectionID projection, void *refcon) |
Actually draw the labels into th emap. More... | |
void | MapDeleteCB (XPLMMapLayerID inLayer, void *) |
Called when a map is about to be deleted. More... | |
void | MapLayerCreate (const char *mapIdentifier) |
Create our map layer for the given map. More... | |
void | MapCreateAll () |
Loop all existing maps and create our map layer for them. More... | |
void | MapDestroyAll () |
Remove all our map layers. More... | |
void | MapCreateCB (const char *mapIdentifier, void *) |
Callback called when a map is created. We then need to add our layer to it. More... | |
void | MapInit () |
Initialize the module. More... | |
void | MapCleanup () |
Grace cleanup. More... | |
std::string | _NetwGetIntfName (uint32_t idx, uint8_t family) |
Get an interface's name. More... | |
LocalIntfAddrTy | _NetwFindLocalIntf (const std::string &intf, uint8_t family) |
Find a matching local interface based on name and family. More... | |
void | _NetwGetLocalAddresses (bool bForceRefresh=false) |
Fetch all local addresses and cache locally. More... | |
uint32_t | _GetIntfNext (const uint32_t prevIdx, SetLocalIntfAddrTy::const_iterator &i, uint8_t family, uint32_t fMust, uint32_t fSkip) |
Internal: Returns the next interface index of a broadcast interface for the given protocol family. More... | |
uint32_t | GetIntfFirst (SetLocalIntfAddrTy::const_iterator &i, uint8_t family, uint32_t fMust, uint32_t fSkip=0) |
Returns the first interface index of a broadcast interface for the given protocol family. More... | |
uint32_t | GetIntfNext (SetLocalIntfAddrTy::const_iterator &i, uint8_t family, uint32_t fMust, uint32_t fSkip=0) |
Returns the next interface index of a broadcast interface for the given protocol family. More... | |
std::vector< std::string > | NetwGetInterfaces (uint8_t family, uint32_t fMust=0, uint32_t fSkip=0) |
Return list of known local interfaces. More... | |
std::string | NetwGetInterfaceNames (uint8_t family, uint32_t fMust=0, uint32_t fSkip=0) |
Return comma-separated string will all known local interfaces, calls NetwGetInterfaces() More... | |
bool | NetwIsLocalAddr (const InetAddrTy &addr) |
Is given address a local one? More... | |
bool | NetwIsLocalAddr (const SockAddrTy &sa) |
Is given address a local one? More... | |
bool | NetwIsLocalAddr (const sockaddr *pSa) |
Is given address a local one? More... | |
const char * | RelatedLoad (RelTxtTy relType, const std::string &_path) |
Read the related.txt file, full path passed in. More... | |
const char * | RelatedLoad (const std::string _paths[], size_t _num) |
Load all related files. More... | |
int | RelatedGet (RelTxtTy relType, const std::string &_key) |
Find the related group for a given key, 0 if none. More... | |
const char * | Doc8643Load (const std::string &_path) |
Load the content of the provided Doc8643.txt file. More... | |
const Doc8643 & | Doc8643Get (const std::string &_type) |
Return a reference to the matching Doc8643 object. More... | |
bool | Doc8643IsTypeValid (const std::string &_type) |
Is the given aircraft type a valid ICAO type as per Doc8643? More... | |
const char * | Obj8DataRefsLoad (const std::string &_path) |
Load the content of the provided Obj8DataRefs.txt file. More... | |
std::unique_lock< std::mutex > | glockRmtData (gmutexRmtData) |
The lock that we keep during handling of the flight loop. More... | |
bool | RmtSendContinue () |
Conditions for continued send operation. More... | |
void | RmtSendProcessQueue () |
Process the data passed down to us in the queue. More... | |
void | RmtSendSettings () |
Send our settings. More... | |
void | RmtSendLoop () |
Sending function, ie. we are actively sending data out. More... | |
void | RmtSendMain () |
Thread main function for the sender. More... | |
void | RmtSendBeacon () |
Sends an Interest Beacon. More... | |
bool | RmtRecvContinue () |
Conditions for continued receive operation. More... | |
void | RmtRecvMain () |
Thread main function for the receiver. More... | |
void | RmtStartMCThread (bool bSender) |
Start the background thread to listen to multicast, to see if anybody is interested in our data. More... | |
void | RmtStopAll () |
Stop all threads and communication with the network. More... | |
void | RemoteInit () |
Initialize the module. More... | |
void | RemoteCleanup () |
Grace cleanup, stops all threads. More... | |
void | RemoteSenderUpdateStatus () |
Compares current vs. expected status and takes appropriate action. More... | |
void | RemoteAcEnqueueStarts (float now) |
void | RemoteAcEnqueue (const Aircraft &ac) |
Regularly called from the flight loop callback to send a/c date onto the network. More... | |
void | RemoteAcEnqueueDone () |
Informs us that all a/c have been processed: All pending messages to be sent now. More... | |
void | RemoteAcRemove (const Aircraft &ac) |
Informs us about an aircraft deletion. More... | |
void | RemoteAcClearAll () |
Informs us that there are no more aircraft, clear our caches! More... | |
FMOD_VECTOR | FmodHeadPitch2Vec (const float head, const float pitch) |
Convert heading/pitch to normalized x/y/z vector. More... | |
bool | XPSoundIsAvail () |
Are XP12 sound functions available? More... | |
bool | XPSoundLoadFctPtr () |
Tries to find all the new XP12 sound functions, available as of XP12.04. More... | |
int | SoundLoadXPSounds () |
Load fixed set of X-Plane-internal sounds. More... | |
const char * | SoundEventTxt (Aircraft::SoundEventsTy e) |
Return a text for the values of Aircraft::SoundEventsTy. More... | |
void | FmodHeadPitchRoll2Normal (const float head, const float pitch, const float roll, FMOD_VECTOR &vecDir, FMOD_VECTOR &vecNorm) |
Convert heading/pitch to normal x/y/z vector. More... | |
void | FmodNormalizeHeadingPitch (float &head, float &pitch) |
Normalize Pitch/Heading. More... | |
void | SoundInit () |
Initialize the sound module and load the sounds. More... | |
void | SoundUpdatesBegin () |
Prepare for this frame's updates, which are about to start. More... | |
void | SoundUpdatesDone () |
Tell FMOD that all updates are done. More... | |
void | SoundCleanup () |
Graceful shoutdown. More... | |
ThreeWaySwitchTy | Read3WaySwitch (std::string &sVal, const std::string &sKey, const std::string &cfgFileName, ThreeWaySwitchTy defVal) |
Convert strings on , auto , off to enums of type ThreeWaySwitchTy More... | |
int | PrefsFuncIntDefault (const char *, const char *, int _default) |
Default config function just always returns the provided default value. More... | |
bool | ExistsFile (const std::string &filename) |
Does a file path exist? More... | |
bool | IsDir (const std::string &path) |
Is path a directory? More... | |
bool | CreateDir (const std::string &path) |
Create directory if it does not exist. More... | |
bool | CopyFileIfNewer (const std::string &source, const std::string &destDir) |
Copy file if source is newer or destination missing. More... | |
std::list< std::string > | GetDirContents (const std::string &path) |
List of files in a directory (wrapper around XPLMGetDirectoryContents) More... | |
std::istream & | safeGetline (std::istream &is, std::string &t) |
Read a line from a text file, no matter if ending on CRLF or LF. More... | |
const std::string & | GetXPSystemPath () |
Returns XP's system directory, including a trailing slash. More... | |
std::string | StripXPSysDir (const std::string &path) |
If a path starts with X-Plane's system directory it is stripped. More... | |
void | RemoveExtension (std::string &path) |
Removes everything after the last dot, the dot including. More... | |
std::string & | str_tolower (std::string &s) |
change a std::string to uppercase More... | |
std::vector< std::string > | str_tokenize (const std::string s, const std::string tokens, bool bSkipEmpty=true) |
separates string into tokens More... | |
float | headDiff (float head1, float head2) |
(Shortest) difference between 2 angles: How much to turn to go from h1 to h2? More... | |
std::valarray< float > | HeadPitch2Vec (const float head, const float pitch) |
Convert heading/pitch to normalized x/y/z vector. More... | |
std::valarray< float > | HeadPitchRoll2Normal (const float head, const float pitch, const float roll) |
Convert heading/pitch/roll to unit and normal vector, ie. returns 6 values, first 3 like HeadPitch2Vec, second three the normal vector (pointing "up") More... | |
float | GetMiscNetwTime () |
Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt. More... | |
std::string | GetMiscNetwTimeStr (float _time=NAN) |
Return the network time as a string like used in the XP's Log.txt. More... | |
const char * | GetGraphicsDriverTxt () |
Text string for current graphics driver in use. More... | |
bool | IsPaused () |
X-Plane in a Pause state? More... | |
bool | IsViewExternal () |
Is current X-Plane view an external view (outside a cockpit)? More... | |
bool | CheckEverySoOften (float &_lastCheck, float _interval, float _now) |
Convenience function to check on something at most every x seconds. More... | |
const char * | LogGetString (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg, va_list args) |
Returns ptr to static buffer filled with formatted log string. More... | |
void | LogMsg (const char *szFile, int ln, const char *szFunc, logLevelTy lvl, const char *szMsg,...) XPMP2_FMTARGS(5) |
Log Text to log file. More... | |
std::string & | rtrim (std::string &s, const char *t=WHITESPACE) |
trimming of string (from right) More... | |
std::string & | ltrim (std::string &s, const char *t=WHITESPACE) |
trimming of string (from left) More... | |
std::string & | trim (std::string &s, const char *t=WHITESPACE) |
trimming of string (from both ends) More... | |
std::string | leftOf (const std::string &s, const std::string &terminators) |
Returns everything left of any of terminators. More... | |
bool | fequal (float a, float b) |
Are these two float near-equal? (to avoid trying something like a == b) More... | |
template<class T > | |
T | rad2deg (const T _rad) |
Convert radians to degrees, normalized to [0..360) More... | |
template<class T > | |
T | deg2rad (const T _deg) |
Convert degree to radians. More... | |
template<class T > | |
T | sqr (const T a) |
Square. More... | |
template<class T > | |
T | dist (const T x1, const T y1, const T z1, const T x2, const T y2, const T z2) |
Pythagorean distance between two points in a 3-D world. More... | |
float | atan2deg (float x, float y) |
atan2 converted to degrees: the angle between (0|0) and the given point More... | |
float | angleLocCoord (float x1, float z1, float x2, float z2) |
Angle of line from point (x1|z1) to point (x2|z2) More... | |
template<class numT > | |
numT | headNormalize (numT _head) |
Normalize a heading value to [0..360), works for both float and double values. More... | |
bool | CheckEverySoOften (float &_lastCheck, float _interval) |
Convenience function to check on something at most every x seconds. More... | |
std::string | TOPOSIX (const std::string &p) |
On Lin/Win there is no need for a conversion, but we do treat p now as std::string More... | |
std::string | FROMPOSIX (const std::string &p) |
On Lin/Win there is no need for a conversion, but we do treat p now as std::string More... | |
void | XPMPSendNotification (const Aircraft &plane, XPMPPlaneNotification _notification) |
Send a notification to all observers. More... | |
const char * | XPMPValidateResourceFiles (const char *resourceDir) |
Validate all required files are available in the resource directory. More... | |
Variables | |
constexpr float | RPM_to_RADs = 0.10471975511966f |
Defined by XPMP2 internally. More... | |
constexpr double | M_per_FT = 0.3048 |
Convert feet to meters, e.g. for altitude calculations. More... | |
constexpr int | M_per_NM = 1852 |
Convert nautical miles to meters. More... | |
constexpr double | KT_per_M_per_S = 1.94384 |
Convert m/s to knots. More... | |
constexpr float | G_EARTH = 9.80665f |
standard gravitational acceleration [m/s²] More... | |
constexpr const char * | REMOTE_SIGNATURE = "TwinFan.plugin.XPMP2.Remote" |
The signature of the XPMP2 Remote Client. More... | |
const std::array< RemoteDataRefPackTy, V_COUNT > | REMOTE_DR_DEF |
An array holding all dataRef packing definitions. More... | |
struct XPMP2::RemoteMsgBaseTy | PACKED |
constexpr std::uint8_t | RMT_VER_BEACON = 0 |
Interest Beacon message version number. More... | |
constexpr int | REMOTE_SEND_SETTINGS_INTVL = 20 |
How often to send settings? [s]. More... | |
constexpr std::uint8_t | RMT_VER_SETTINGS = 0 |
Setttings message version number. More... | |
constexpr std::uint8_t | RMT_VER_AC_DETAIL = 3 |
A/C detail message version number. More... | |
constexpr std::uint8_t | RMT_VER_AC_DETAIL_2 = 2 |
constexpr std::uint8_t | RMT_VER_AC_DETAIL_1 = 1 |
constexpr std::uint8_t | RMT_VER_AC_DETAIL_0 = 0 |
constexpr std::uint8_t | RMT_VER_AC_POS_UPDATE = 0 |
A/C Position update message version number. More... | |
constexpr double | REMOTE_DEGREE_RES = 0.00000001 |
What is the maximum difference a RemoteAcPosUpdateTy can hold? More... | |
constexpr double | REMOTE_MAX_DIFF_DEGREE = REMOTE_DEGREE_RES * INT16_MAX |
maximum degree difference that can be represented in a pos update msg More... | |
constexpr double | REMOTE_ALT_FT_RES = 0.01 |
resolution of altitude[ft] updates More... | |
constexpr double | REMOTE_MAX_DIFF_ALT_FT = REMOTE_ALT_FT_RES * INT16_MAX |
maximum altitude[ft] difference that can be represented in a pos update msg More... | |
constexpr float | REMOTE_TIME_RES = 0.0001f |
resolution of time difference More... | |
constexpr float | REMOTE_MAX_DIFF_TIME = REMOTE_TIME_RES * UINT16_MAX |
maximum time difference thatn can be represented in a pos update msg More... | |
constexpr std::uint8_t | RMT_VER_AC_ANIM = 0 |
A/C Position update message version number. More... | |
constexpr std::uint8_t | RMT_VER_AC_REMOVE = 0 |
A/C removal message version number. More... | |
constexpr float | FAR_AWAY_VAL_GL = 9999999.9f |
Don't dare using NAN...but with this coordinate for x/y/z a plane should be far out and virtually invisible. More... | |
constexpr float | AISLOT_CHANGE_PERIOD = 15.0f |
How often do we reassign AI slots? [seconds]. More... | |
constexpr int | AI_PRIO_MULTIPLIER = 10 * M_per_NM |
How much distance does each AIPrio add? More... | |
float | F_NULL [10] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f} |
A constant array of zero values supporting quick array initialization. More... | |
constexpr int | XPLM_PHASE_AIRPLANES = 25 |
The drawing phase "xplm_Phase_Airplanes" is deprecated in XP11.50 upwards, but we need it in earlier versions to fake TCAS. More... | |
const char * | DATA_REF_EDITORS [] |
std::vector< std::string > | vecDREdataRefStr |
list of dataRef strings to be send to the editors More... | |
constexpr size_t | SDR_CSLMODEL_TXT_SIZE = 40 |
Number of characters to be allowed for CSL model text. More... | |
XPLMFlightLoopID | gFlightLoopID = nullptr |
The id of our flight loop callback. More... | |
std::vector< std::unique_ptr< std::string > > | drStrings |
std::vector< XPLMDataRef > | ahDataRefs |
Registered dataRefs. More... | |
XPLMObjectRef | ghContrailObj = nullptr |
The one global Contrail object. More... | |
XPLMDataRef | ghDrContrailLifeTime = nullptr |
The handle for the registered Contrail LifeTime dataRef. More... | |
XPLMFlightLoopID | gGarbageCollectionID = nullptr |
The ids of our garbage collection flight loop callback. More... | |
constexpr float | GARBAGE_COLLECTION_PERIOD = 60.0f |
How often to call the garbage collection [s]. More... | |
constexpr float | GARBAGE_COLLECTION_TIMEOUT = 180.0f |
Unload an unused object after how many seconds? More... | |
constexpr int | MAP_ICON_WIDTH = 3 |
Dimenson of MapIcon.png. More... | |
constexpr int | MAP_ICON_HEIGHT = 3 |
Dimenson of MapIcon.png. More... | |
constexpr int | MAP_MIN_ICON_SIZE = 40 |
Minimum icon size in map in UI units. More... | |
constexpr float | MAP_AC_SIZE = 30.0f |
Assumed size of an aircraft in m. More... | |
std::array< const char *, 2 > | ALL_MAPS |
The list of known maps, which are hard-coded by X-Plane's SDK. More... | |
constexpr int | SERR_LEN = 100 |
Maximum length of OS error message. More... | |
SetLocalIntfAddrTy | gAddrLocal |
Set of local IP interface addresses. More... | |
std::recursive_mutex | mtxAddrLocal |
Mutex to safeguard access to gAddrLocal More... | |
std::recursive_mutex | mtxSocketClose |
Mutex to ensure closing is done in one thread only to avoid race conditions on deleting the buffer. More... | |
constexpr int | ERR_CFG_FILE_MAXWARN = 5 |
Maximum number of warnings during file read before bailing. More... | |
const Doc8643 | DOC8643_EMPTY |
constexpr int | REMOTE_RECV_BEACON_INTVL = 15 |
How often to send an Interest Beacon? [s]. More... | |
constexpr float | REMOTE_SEND_AC_DETAILS_INTVL = 10.f |
How often to send full a/c details? [s]. More... | |
mapRmtAcCacheTy | gmapRmtAcCache |
Cache for last data sent out to the network. More... | |
unsigned | gFullUpdDue = 0 |
What's the full update group that has its turn now? More... | |
unsigned | gFullUpdLastDone = 0 |
the last actually processed full update group More... | |
unsigned | gNxtFullUpdGrpToAssign = 0 |
What's the next group number to assign to the next a/c? (Assigned will be the value incremented by 1) More... | |
float | gNow = 0.0f |
Current network timestamp. More... | |
float | gNxtTxfTime = 0.0f |
When to actually process position updates next? More... | |
queueRmtDataTy | gqueueRmtData |
the queue for passing data from main to network thread More... | |
std::condition_variable | gcvRmtData |
notifies the network thread of available data to be processed More... | |
std::mutex | gmutexRmtData |
constexpr int | MC_MAX_ERR =5 |
after this many errors we no longer try listening More... | |
std::thread | gThrMC |
remote listening/sending thread More... | |
UDPMulticast * | gpMc = nullptr |
multicast socket for listening/sending (destructor uses locks, which don't work during module shutdown, so can't create a global object due to its exit-time destructor) More... | |
volatile bool | gbStopMCThread = false |
Shall the network thread stop? More... | |
bool | gbRemoteGaveUp = false |
No longer try remote functionality, have seen to many errors. More... | |
float | gSendSettingsLast = 0.0f |
Timestamp when we sent our settings the last time. More... | |
RmtMsgBufTy< RemoteAcDetailTy, RMT_MSG_AC_DETAILED, RMT_VER_AC_DETAIL > | gMsgAcDetail |
A/C Detail message. More... | |
RmtMsgBufTy< RemoteAcPosUpdateTy, RMT_MSG_AC_POS_UPDATE, RMT_VER_AC_POS_UPDATE > | gMsgAcPosUpdate |
A/C Position Update message. More... | |
RmtMsgBufTy< RemoteAcAnimTy, RMT_MSG_AC_ANIM, RMT_VER_AC_ANIM > | gMsgAcAnim |
A/C Animation dataRefs message. More... | |
RmtMsgBufTy< RemoteAcRemoveTy, RMT_MSG_AC_REMOVE, RMT_VER_AC_REMOVE > | gMsgAcRemove |
A/C Removal message. More... | |
RemoteCBFctTy | gRmtCBFcts |
The callback function pointers the remote client plugin provided. More... | |
SoundSystem * | gpSndSys = nullptr |
The sound system in use. More... | |
FMOD_RESULT | gFmodRes = FMOD_OK |
last FMOD result code, needed by the following macro, better don't rely on anywhere else More... | |
constexpr float | FMOD_3D_MAX_DIST = 10000.0f |
Value used for 3D max distance, which doesn't have much of a function for the inverse roll-off model used here. More... | |
constexpr int | EXP_COMP_SKIP_CYCLES = 10 |
In how many cycles to skip expensive computations? More... | |
f_XPLMPlayPCMOnBus * | gpXPLMPlayPCMOnBus = nullptr |
f_XPLMStopAudio * | gpXPLMStopAudio = nullptr |
f_XPLMSetAudioPosition * | gpXPLMSetAudioPosition = nullptr |
f_XPLMSetAudioFadeDistance * | gpXPLMSetAudioFadeDistance = nullptr |
f_XPLMSetAudioVolume * | gpXPLMSetAudioVolume = nullptr |
f_XPLMSetAudioCone * | gpXPLMSetAudioCone = nullptr |
constexpr int | FMOD_NUM_VIRT_CHANNELS = 1000 |
Number of virtual channels during initialization. More... | |
constexpr float | FMOD_LOW_PASS_GAIN = 0.2f |
Gain used when activating Low Pass filter. More... | |
GlobVars | glob |
The one and only global variable structure. More... | |
const char * | LOG_LEVEL [] |
constexpr const char * | RSRC_RELATED = "related.txt" |
constexpr const char * | RSRC_REL_OP = "relOp.txt" |
constexpr const char * | RSRC_DOC8643 = "Doc8643.txt" |
constexpr const char * | RSRC_MAP_ICONS = "MapIcons.png" |
constexpr const char * | RSRC_OBJ8DATAREFS = "Obj8DataRefs.txt" |
constexpr double | PI = 3.1415926535897932384626433832795028841971693993751 |
Pi. More... | |
constexpr float | EPSILON_F = 0.00001f |
Epsilon, a small number. More... | |
union XPMP2::TcasLightsTy |
A structure simplifying communicaton with sim/cockpit2/tcas/targets/position/lights.
Class Members | ||
---|---|---|
struct BitsTy | b | |
int | i | the full integer value |
union XPMP2::SockAddrTy.__unnamed4__ |
union XPMP2::InetAddrTy.__unnamed6__ |
union XPMP2::RmtDataAcAnimTy.__unnamed8__ |
Class Members | ||
---|---|---|
char | bufSize[RemoteAcAnimTy::msgSize(V_COUNT)] | a declaration that only makes sure that enough memory is reserved so that XPMP2::RmtDataAcAnimTy::data::v can fill up to max |
RemoteAcAnimTy | data | The animation dataRef values element. |
typedef XPLM_API FMOD_CHANNEL*() XPMP2::f_XPLMPlayPCMOnBus(void *audioBuffer, uint32_t bufferSize, FMOD_SOUND_FORMAT soundFormat, int freqHz, int numChannels, int loop, XPLMAudioBus audioType, XPLMPCMComplete_f inCallback, void *inRefcon) |
typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMSetAudioCone(FMOD_CHANNEL *fmod_channel, float inside_angle, float outside_angle, float outside_volume, FMOD_VECTOR *orientation) |
typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMSetAudioFadeDistance(FMOD_CHANNEL *fmod_channel, float min_fade_distance, float max_fade_distance) |
typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMSetAudioPosition(FMOD_CHANNEL *fmod_channel, FMOD_VECTOR *position, FMOD_VECTOR *velocity) |
typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMSetAudioVolume(FMOD_CHANNEL *fmod_channel, float source_volume) |
typedef XPLM_API FMOD_RESULT() XPMP2::f_XPLMStopAudio(FMOD_CHANNEL *fmod_channel) |
typedef std::list<CSLObj> XPMP2::listCSLObjTy |
List of objects.
typedef std::list<Obj8DataRefs> XPMP2::listObj8DataRefsTy |
a list of Obj8DataRefs definitions
typedef std::list<XPMPPlaneNotifierTy> XPMP2::listXPMPPlaneNotifierTy |
typedef std::map<float,XPMPPlaneID> XPMP2::mapAcByDistTy |
Map of Aircrafts, sorted by (priority-biased) distance.
typedef std::map<XPMPPlaneID,Aircraft*> XPMP2::mapAcTy |
Map of all aircraft, key is tthe plane id.
typedef std::map<std::string,CSLModel> XPMP2::mapCSLModelTy |
Map of CSLModels (owning the object), ordered by related group / type.
typedef std::map<std::string,std::string> XPMP2::mapCSLPackageTy |
Map of CSLPackages: Maps an id to the base path (path ends on forward slash)
typedef std::map<std::string, Doc8643> XPMP2::mapDoc8643Ty |
Map of Doc8643 information, key is the (icao) type code.
typedef std::map<std::string, XPLMMapLayerID> XPMP2::mapMapLayerIDTy |
A map holding our layer identifier, indexed by the map's name.
typedef std::map<std::string, int> XPMP2::mapRelatedTy |
Map of group membership: ICAO a/c type maps to line in related.txt.
typedef std::map<XPMPPlaneID,RmtAcCacheTy> XPMP2::mapRmtAcCacheTy |
Defines a map with the plane id as key and the aboce cache structure as payload.
typedef std::map<std::string,SoundFilePtr> XPMP2::mapSoundPtrTy |
Map of all sounds, indexed by a sound name (type)
typedef std::map<std::string, int> XPMP2::mapStrIntTy |
a map of a text and a counter
typedef std::map<std::string, Aircraft::wakeTy> XPMP2::mapWakeTy |
typedef std::multimap<unsigned long,std::pair<CSLModel*,const CSLModel::MatchCritTy*> > XPMP2::mmapCSLModelPTy |
Multimap of references to CSLModels and match criteria for matching purposes.
typedef std::pair<std::string,std::string> XPMP2::pairOfStrTy |
typedef std::unique_ptr<RmtDataAcAnimTy> XPMP2::ptrRmtDataAcAnimTy |
Smart pointer to XPMP2::RmtDataAcAnimTy.
typedef std::unique_ptr<RmtDataBaseTy> XPMP2::ptrRmtDataBaseTy |
Smart pointer to XPMP2::RmtDataBaseTy by which we manage objects of this and derived types.
typedef std::queue<ptrRmtDataBaseTy,std::list<ptrRmtDataBaseTy> > XPMP2::queueRmtDataTy |
A queue managing the information objects, used to transfer data between main thread and network thread.
A/C Detail queue type.
A/C Position Update queue type.
A/C Removal queue type.
typedef std::set<LocalIntfAddrTy> XPMP2::SetLocalIntfAddrTy |
Set of local IP interface addresses.
typedef std::unique_ptr<SoundFile> XPMP2::SoundFilePtr |
Smart pointer to a SoundFile object.
enum XPMP2::DR_VALS : std::uint8_t |
The dataRefs provided by XPMP2 to the CSL models.
Enumerator | |
---|---|
V_CONTROLS_GEAR_RATIO |
|
V_CONTROLS_NWS_RATIO |
|
V_CONTROLS_FLAP_RATIO |
|
V_CONTROLS_SPOILER_RATIO |
|
V_CONTROLS_SPEED_BRAKE_RATIO |
|
V_CONTROLS_SLAT_RATIO |
|
V_CONTROLS_WING_SWEEP_RATIO |
|
V_CONTROLS_THRUST_RATIO |
|
V_CONTROLS_YOKE_PITCH_RATIO |
|
V_CONTROLS_YOKE_HEADING_RATIO |
|
V_CONTROLS_YOKE_ROLL_RATIO |
|
V_CONTROLS_THRUST_REVERS |
|
V_CONTROLS_TAXI_LITES_ON |
|
V_CONTROLS_LANDING_LITES_ON |
|
V_CONTROLS_BEACON_LITES_ON |
|
V_CONTROLS_STROBE_LITES_ON |
|
V_CONTROLS_NAV_LITES_ON |
|
V_GEAR_NOSE_GEAR_DEFLECTION_MTR |
|
V_GEAR_TIRE_VERTICAL_DEFLECTION_MTR |
|
V_GEAR_TIRE_ROTATION_ANGLE_DEG |
|
V_GEAR_TIRE_ROTATION_SPEED_RPM |
|
V_GEAR_TIRE_ROTATION_SPEED_RAD_SEC |
|
V_ENGINES_ENGINE_ROTATION_ANGLE_DEG |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RPM |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC |
|
V_ENGINES_PROP_ROTATION_ANGLE_DEG |
|
V_ENGINES_PROP_ROTATION_SPEED_RPM |
|
V_ENGINES_PROP_ROTATION_SPEED_RAD_SEC |
|
V_ENGINES_THRUST_REVERSER_DEPLOY_RATIO |
|
V_ENGINES_ENGINE_ROTATION_ANGLE_DEG1 |
|
V_ENGINES_ENGINE_ROTATION_ANGLE_DEG2 |
|
V_ENGINES_ENGINE_ROTATION_ANGLE_DEG3 |
|
V_ENGINES_ENGINE_ROTATION_ANGLE_DEG4 |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RPM1 |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RPM2 |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RPM3 |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RPM4 |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC1 |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC2 |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC3 |
|
V_ENGINES_ENGINE_ROTATION_SPEED_RAD_SEC4 |
|
V_MISC_TOUCH_DOWN |
|
V_COUNT | always last, number of dataRefs XPMP2 pre-defines |
enum XPMP2::logLevelTy |
Logging level.
State of the X-Plane object: Is it being loaded or available?
enum XPMP2::RelTxtTy : size_t |
enum XPMP2::RemoteMsgTy : std::uint8_t |
Message type.
enum XPMP2::RemoteStatusTy : unsigned |
State of remote communcations.
enum XPMP2::ThreeWaySwitchTy : int |
uint32_t XPMP2::_GetIntfNext | ( | const uint32_t | prevIdx, |
SetLocalIntfAddrTy::const_iterator & | i, | ||
uint8_t | family, | ||
uint32_t | fMust, | ||
uint32_t | fSkip | ||
) |
Internal: Returns the next interface index of a broadcast interface for the given protocol family.
LocalIntfAddrTy XPMP2::_NetwFindLocalIntf | ( | const std::string & | intf, |
uint8_t | family | ||
) |
Find a matching local interface based on name and family.
std::string XPMP2::_NetwGetIntfName | ( | uint32_t | idx, |
uint8_t | family | ||
) |
Get an interface's name.
void XPMP2::_NetwGetLocalAddresses | ( | bool | bForceRefresh = false | ) |
Fetch all local addresses and cache locally.
void XPMP2::AcCleanup | ( | ) |
Grace cleanup, esp. remove all aircraft.
Aircraft * XPMP2::AcFindByID | ( | XPMPPlaneID | _id | ) |
Find aircraft by its plane ID, can return nullptr.
void XPMP2::AcInit | ( | ) |
Initialize the module.
bool XPMP2::AcSetDefaultWakeData | ( | const std::string & | _wtc, |
const Aircraft::wakeTy & | _wake | ||
) |
(Re)Define default wake turbulence values per WTC
void XPMP2::AcTxtLine_DEPENDENCY | ( | std::vector< std::string > & | tokens, |
int | lnNr | ||
) |
Process an DEPENDENCY line of an xsb_aircraft.txt
file.
void XPMP2::AcTxtLine_MATCHES | ( | CSLModel & | csl, |
std::vector< std::string > & | tokens, | ||
int | lnNr | ||
) |
Process an ICAO, AIRLINE, LIVERY, or MATCHES line of an xsb_aircraft.txt
file.
void XPMP2::AcTxtLine_OBJ8 | ( | CSLModel & | csl, |
std::vector< std::string > & | tokens, | ||
int | lnNr | ||
) |
Process an OBJ8 line of an xsb_aircraft.txt
file We don't care what type of object it is (ignoring the 1st parameter)
void XPMP2::AcTxtLine_OBJ8_AIRCRAFT | ( | CSLModel & | csl, |
const std::string & | ln, | ||
const std::string & | xsbAircraftPath, | ||
const std::string & | exportName, | ||
int | lnNr | ||
) |
Process an OBJ8_AIRCRAFT line of an xsb_aircraft.txt
file.
void XPMP2::AcTxtLine_OBJECT_AIRCRAFT | ( | CSLModel & | csl, |
const std::string & | , | ||
int | |||
) |
Process an OBJECT or AIRCRAFT line of an xsb_aircraft.txt
file (which are no longer supported)
void XPMP2::AcTxtLine_OFFSET | ( | CSLModel & | csl, |
std::vector< std::string > & | tokens, | ||
int | lnNr | ||
) |
Process an OFFSET line of a PilotEdge xsb_aircraft.txt
file, actually its 3rd parameter only (we still don't know what the first 2 are)
void XPMP2::AcTxtLine_VERT_OFFSET | ( | CSLModel & | csl, |
std::vector< std::string > & | tokens, | ||
int | lnNr | ||
) |
Process an VERT_OFFSET line of an xsb_aircraft.txt
file.
void XPMP2::AIAssignSlots | ( | size_t | fromSlot, |
size_t | toSlot | ||
) |
Assigns slots, ie. planes to places in gSlots.
Called in several passes as to make sure that the lowest n slots are occupied by the closest n planes.
void XPMP2::AIMultiCleanup | ( | ) |
Grace cleanup.
Make sure we aren't in control, then Unshare the shared dataRefs
void XPMP2::AIMultiClearAIDataRefs | ( | multiDataRefsTy & | drM, |
bool | bDeactivateToZero | ||
) |
Resets all actual values of the AI/multiplayer dataRefs of one plane to something initial.
void XPMP2::AIMultiClearInfoDataRefs | ( | infoDataRefsTy & | drI | ) |
Clears the shared info dataRefs.
void XPMP2::AIMultiClearTcasDataRefs | ( | ) |
Clears the key (mode_s) of the TCAS target dataRefs.
int XPMP2::AIMultiControlPlaneCount | ( | XPLMDrawingPhase | , |
int | inIsBefore, | ||
void * | |||
) |
Callback to toggle aircraft count ("TCAS hack")
We use AI Aircraft to simulate TCAS blibs, but we don't want these AI Aircraft to actually draw. So during aircraft drawing phase we tell X-Plane there are no AI planes, afterwards we put the correct number back
void XPMP2::AIMultiInformDREs | ( | ) |
Inform DRE and DRT of our shared dataRefs.
void XPMP2::AIMultiInit | ( | ) |
Initialize the module.
Fetches all dataRef handles for all dataRefs of all up to 19 AI/multiplayer slots
void XPMP2::AIMultiInitAllDataRefs | ( | bool | bDeactivateToZero | ) |
Reset all (controlled) multiplayer dataRef values of all planes.
void XPMP2::AIMultiUpdate | ( | ) |
Updates all TCAS target dataRefs, both standard X-Plane, as well as additional shared dataRefs for text publishing.
size_t XPMP2::AIUpdateMultiplayerDataRefs | ( | ) |
The old way: Update Multiplayer dataRefs directly.
size_t XPMP2::AIUpdateTCASTargets | ( | ) |
The modern way: Use TCAS override and update TCAS targets.
|
inline |
Angle of line from point (x1|z1) to point (x2|z2)
|
inline |
atan2 converted to degrees: the angle between (0|0) and the given point
|
inline |
Convenience function to check on something at most every x seconds.
_lastCheck | Provide a float which holds the time of last check (init with 0.0f ) |
_interval | [seconds] How often to perform the check? |
true
if more than _interval
time has passed since _lastCheck
bool XPMP2::CheckEverySoOften | ( | float & | _lastCheck, |
float | _interval, | ||
float | _now | ||
) |
Convenience function to check on something at most every x seconds.
_lastCheck | Provide a float which holds the time of last check (init with 0.0f ) |
_interval | [seconds] How often to perform the check? |
_now | Current time, possibly from a call to GetTotalRunningTime() |
true
if more than _interval
time has passed since _lastCheck
|
constexpr |
Clamps v
between lo
and hi
: lo
if v
< lo
, hi
if hi
< v
, otherwise v
void XPMP2::ContrailCleanup | ( | ) |
Graceful shutdown.
bool XPMP2::ContrailInit | ( | ) |
Initialize the Contrail module and load the Contrail object.
Has a quick exit if already initialized or has already failed to initialize
bool XPMP2::CopyFileIfNewer | ( | const std::string & | source, |
const std::string & | destDir | ||
) |
Copy file if source is newer or destination missing.
int XPMP2::CPLabelDrawing | ( | XPLMDrawingPhase | , |
int | , | ||
void * | |||
) |
Drawing callback, called by X-Plane in every drawing cycle.
bool XPMP2::CreateDir | ( | const std::string & | path | ) |
Create directory if it does not exist.
bool XPMP2::CSLFindMatch | ( | const std::string & | _type, |
const std::string & | _airline, | ||
const std::string & | _livery, | ||
bool | bIgnoreNoMatch, | ||
int & | quality, | ||
CSLModel *& | pModel | ||
) |
Tries finding a match using both aircraft and Doc8643 attributes.
Each attribute is represented by a bit in a bit mask. Lower priority attributes are represented by low value bits, and vice versa high prio match criteria by high value bits. The bit is 0 if the attribute matches and 1 if not. The resulting numeric value of the bitmask is considered the match quality: The lower the number the better the quality.
CSLModel * XPMP2::CSLModelById | ( | const std::string & | _cslId, |
mapCSLModelTy::iterator * | _pOutIter = nullptr |
||
) |
Find a model by unique id.
_cslId | The model's unique id to search for (package name/short id) | |
[out] | _pOutIter | Optional pointer to an iterator variable, receiving the iterator position of the found model |
CSLModel * XPMP2::CSLModelByKey | ( | const std::string & | _cslKey, |
mapCSLModelTy::iterator * | _pOutIter = nullptr |
||
) |
Find a model by (even more) unique key.
_cslKey | The model's unique key into the map | |
[out] | _pOutIter | Optional pointer to an iterator variable, receiving the iterator position of the found model |
CSLModel * XPMP2::CSLModelByPkgShortId | ( | std::uint16_t | _pkgHash, |
const std::string & | _shortId | ||
) |
Find a model by package name hash and short id.
This approach is used by the remote client to safe network bandwith. If an exact match with pkgHash
and shortID
is not found, then a model matching the short id alone is returned if available.
std::string XPMP2::CSLModelGetKeyStr | ( | int | _related, |
const std::string & | _type, | ||
const std::string & | _id | ||
) |
compiles the string used as key in the CSL model map
int XPMP2::CSLModelMatching | ( | const std::string & | _type, |
const std::string & | _airline, | ||
const std::string & | _livery, | ||
CSLModel *& | pModel | ||
) |
Find a matching model.
Matching happens usually in just one pass by calling CSLFindMatch().
The only exception is if the passed-in aircraft type is not an official ICAO type (which is what doc8643-matching bases on). In that case, the first pass is done without doc8643-matching. If that pass found no actual match, then there is a second pass based on the default ICAO type.
_type | ICAO aircraft type like "A319" | |
_airline | ICAO airline code like "DLH" | |
_livery | Any specific livery code, in LiveTraffic e.g. the tail number | |
[out] | pModel | Receives the pointer to the matching CSL model, or NULL if nothing found |
void XPMP2::CSLModelsAdd | ( | CSLModel & | _csl | ) |
Adds a readily defined CSL model to all the necessary maps.
void XPMP2::CSLModelsCleanup | ( | ) |
Grace cleanup.
std::string XPMP2::CSLModelsConvPackagePath | ( | const std::string & | pkgPath, |
int | lnNr, | ||
bool | bPkgOptional = false |
||
) |
Turn a relative package path into a full path.
Turns a relative package path in xsb_aircraft.txt
(like "__Bluebell_Airbus:A306/A306_AAW.obj") into a full path pointing to a concrete file and verifies the file's existence.
const char* XPMP2::CSLModelsFindPkgs | ( | const std::string & | _path, |
std::vector< std::string > & | paths, | ||
int | _maxDepth = 5 |
||
) |
Recursively scans folders to find xsb_aircraft.txt
files of CSL packages.
_path | The path to start the search in | |
[out] | paths | List of paths in which an xsb_aircraft.txt file has actually been found |
_maxDepth | How deep into the folder hierarchy shall we search? (defaults to 5) |
void XPMP2::CSLModelsInit | ( | ) |
Initialization.
const char * XPMP2::CSLModelsLoad | ( | const std::string & | _path, |
int | _maxDepth = 5 |
||
) |
Read the CSL Models found in the given path and below.
_path | Path to a folder, which will be searched hierarchically for xsb_aircraft.txt files |
_maxDepth | Search shall go how many folders deep at max? |
const char* XPMP2::CSLModelsProcessAcFile | ( | const std::string & | path | ) |
Process one xsb_aircraft.txt
file for importing OBJ8 models.
const char* XPMP2::CSLModelsReadPkgId | ( | const std::string & | path | ) |
Scans an xsb_aircraft.txt
file for EXPORT_NAME
entries to fill the list of packages.
|
inline |
Convert degree to radians.
|
inline |
Pythagorean distance between two points in a 3-D world.
const Doc8643 & XPMP2::Doc8643Get | ( | const std::string & | _type | ) |
Return a reference to the matching Doc8643 object.
bool XPMP2::Doc8643IsTypeValid | ( | const std::string & | _type | ) |
Is the given aircraft type a valid ICAO type as per Doc8643?
const char * XPMP2::Doc8643Load | ( | const std::string & | _path | ) |
Load the content of the provided Doc8643.txt
file.
bool XPMP2::ExistsFile | ( | const std::string & | filename | ) |
Does a file path exist?
|
inline |
Are these two float near-equal? (to avoid trying something like a == b)
FMOD_VECTOR XPMP2::FmodHeadPitch2Vec | ( | const float | head, |
const float | pitch | ||
) |
Convert heading/pitch to normalized x/y/z vector.
void XPMP2::FmodHeadPitchRoll2Normal | ( | const float | head, |
const float | pitch, | ||
const float | roll, | ||
FMOD_VECTOR & | vecDir, | ||
FMOD_VECTOR & | vecNorm | ||
) |
Convert heading/pitch to normal x/y/z vector.
void XPMP2::FmodNormalizeHeadingPitch | ( | float & | head, |
float & | pitch | ||
) |
Normalize Pitch/Heading.
Heading: [0; 360), Pitch: [-90; 90]
|
inline |
On Lin/Win there is no need for a conversion, but we do treat p
now as std::string
std::list< std::string > XPMP2::GetDirContents | ( | const std::string & | path | ) |
List of files in a directory (wrapper around XPLMGetDirectoryContents)
const char * XPMP2::GetGraphicsDriverTxt | ( | ) |
Text string for current graphics driver in use.
uint32_t XPMP2::GetIntfFirst | ( | SetLocalIntfAddrTy::const_iterator & | i, |
uint8_t | family, | ||
uint32_t | fMust, | ||
uint32_t | fSkip = 0 |
||
) |
Returns the first interface index of a broadcast interface for the given protocol family.
uint32_t XPMP2::GetIntfNext | ( | SetLocalIntfAddrTy::const_iterator & | i, |
uint8_t | family, | ||
uint32_t | fMust, | ||
uint32_t | fSkip = 0 |
||
) |
Returns the next interface index of a broadcast interface for the given protocol family.
float XPMP2::GetMiscNetwTime | ( | ) |
Get synched network time from X-Plane (sim/network/misc/network_time_sec) as used in Log.txt.
std::string XPMP2::GetMiscNetwTimeStr | ( | float | _time = NAN | ) |
Return the network time as a string like used in the XP's Log.txt.
_time | If given convert that time, otherwise convert XPMP2::GetMiscNetwTime() |
const std::string & XPMP2::GetXPSystemPath | ( | ) |
Returns XP's system directory, including a trailing slash.
std::unique_lock<std::mutex> XPMP2::glockRmtData | ( | gmutexRmtData | ) |
The lock that we keep during handling of the flight loop.
|
inline |
Are we going to new (TCAS override) or the old way?
|
inline |
Can we use the XP12 wake support system?
float XPMP2::headDiff | ( | float | head1, |
float | head2 | ||
) |
(Shortest) difference between 2 angles: How much to turn to go from h1 to h2?
numT XPMP2::headNormalize | ( | numT | _head | ) |
Normalize a heading value to [0..360), works for both float and double values.
std::valarray< float > XPMP2::HeadPitch2Vec | ( | const float | head, |
const float | pitch | ||
) |
Convert heading/pitch to normalized x/y/z vector.
valarray
with 3 values, x, y, and z std::valarray< float > XPMP2::HeadPitchRoll2Normal | ( | const float | head, |
const float | pitch, | ||
const float | roll | ||
) |
Convert heading/pitch/roll to unit and normal vector, ie. returns 6 values, first 3 like HeadPitch2Vec, second three the normal vector (pointing "up")
bool XPMP2::IsDir | ( | const std::string & | path | ) |
Is path a directory?
bool XPMP2::IsInRect | ( | float | x, |
float | y, | ||
const float | bounds_ltrb[4] | ||
) |
Tests if x/y lies within the rect, given as a float[4] array.
bool XPMP2::IsPaused | ( | ) |
X-Plane in a Pause state?
bool XPMP2::IsViewExternal | ( | ) |
Is current X-Plane view an external view (outside a cockpit)?
IteratorT XPMP2::iterRnd | ( | IteratorT | lower, |
IteratorT | upper | ||
) |
Returns any random value in the range [cslLower; cslUpper)
, or upper
if there is no value in that range.
|
inline |
Returns everything left of any of terminators.
const char * XPMP2::LogGetString | ( | const char * | szPath, |
int | ln, | ||
const char * | szFunc, | ||
logLevelTy | lvl, | ||
const char * | szMsg, | ||
va_list | args | ||
) |
Returns ptr to static buffer filled with formatted log string.
void XPMP2::LogMsg | ( | const char * | szPath, |
int | ln, | ||
const char * | szFunc, | ||
logLevelTy | lvl, | ||
const char * | szMsg, | ||
... | |||
) |
Log Text to log file.
|
inline |
trimming of string (from left)
void XPMP2::MapCleanup | ( | ) |
Grace cleanup.
void XPMP2::MapCreateAll | ( | ) |
Loop all existing maps and create our map layer for them.
void XPMP2::MapCreateCB | ( | const char * | mapIdentifier, |
void * | |||
) |
Callback called when a map is created. We then need to add our layer to it.
void XPMP2::MapDeleteCB | ( | XPLMMapLayerID | inLayer, |
void * | |||
) |
Called when a map is about to be deleted.
void XPMP2::MapDestroyAll | ( | ) |
Remove all our map layers.
void XPMP2::MapIconDrawingCB | ( | XPLMMapLayerID | inLayer, |
const float * | inMapBoundsLeftTopRightBottom, | ||
float | , | ||
float | mapUnitsPerUserInterfaceUnit, | ||
XPLMMapStyle | , | ||
XPLMMapProjectionID | projection, | ||
void * | refcon | ||
) |
Actually draw the icons into the map.
This call computes the labels location on the map and puts this info into the aircraft object. MapLabelDrawingCB() reuses the cached location info.
void XPMP2::MapInit | ( | ) |
Initialize the module.
void XPMP2::MapLabelDrawingCB | ( | XPLMMapLayerID | inLayer, |
const float * | inMapBoundsLeftTopRightBottom, | ||
float | , | ||
float | mapUnitsPerUserInterfaceUnit, | ||
XPLMMapStyle | , | ||
XPLMMapProjectionID | projection, | ||
void * | refcon | ||
) |
Actually draw the labels into th emap.
void XPMP2::MapLayerCreate | ( | const char * | mapIdentifier | ) |
Create our map layer for the given map.
void XPMP2::MapPrepareCacheCB | ( | XPLMMapLayerID | , |
const float * | inTotalMapBoundsLeftTopRightBottom, | ||
XPLMMapProjectionID | projection, | ||
void * | |||
) |
Prepare map drawing information.
It seems that XPLMMapScaleMeter only works from here, otherwise could crash the sim. (Reported as bug to Laminar)
std::string XPMP2::NetwGetInterfaceNames | ( | uint8_t | family, |
uint32_t | fMust, | ||
uint32_t | fSkip | ||
) |
Return comma-separated string will all known local interfaces, calls NetwGetInterfaces()
std::vector< std::string > XPMP2::NetwGetInterfaces | ( | uint8_t | family, |
uint32_t | fMust = 0 , |
||
uint32_t | fSkip = 0 |
||
) |
Return list of known local interfaces.
family | AF_INET or AF_INET6 |
fMust | Return only interfaces having these interface flags like IFF_MULTICAST , IFF_BROADCAST |
fSkip | Skipt interfaces having these interface flags like IFF_LOOPBACK |
bool XPMP2::NetwIsLocalAddr | ( | const InetAddrTy & | addr | ) |
Is given address a local one?
|
inline |
Is given address a local one?
|
inline |
Is given address a local one?
const char * XPMP2::Obj8DataRefsLoad | ( | const std::string & | _path | ) |
Load the content of the provided Obj8DataRefs.txt
file.
float XPMP2::obj_get_float | ( | void * | ) |
We need to provide these functions for purely formal reasons. They are not actually ever called as we provide the current dataRef values via XPLMInstanceSetPosition. So we don't bother providing any implementation
int XPMP2::obj_get_float_array | ( | void * | , |
float * | , | ||
int | , | ||
int | inCount | ||
) |
See obj_get_float()
std::uint16_t XPMP2::PJWHash16 | ( | const char * | s | ) |
Produces a reproducible(!) hash value for strings.
Result is the same if the same string is provided, across platform and across executions, unlike what std::hash requires.
It is implemented as a 16-bit version of the PJW hash:
int XPMP2::PrefsFuncIntDefault | ( | const char * | , |
const char * | , | ||
int | _default | ||
) |
Default config function just always returns the provided default value.
|
inline |
Convert radians to degrees, normalized to [0..360)
ThreeWaySwitchTy XPMP2::Read3WaySwitch | ( | std::string & | sVal, |
const std::string & | sKey, | ||
const std::string & | cfgFileName, | ||
ThreeWaySwitchTy | defVal | ||
) |
Convert strings on
, auto
, off
to enums of type ThreeWaySwitchTy
int XPMP2::RelatedGet | ( | RelTxtTy | relType, |
const std::string & | _acType | ||
) |
Find the related group for a given key, 0
if none.
const char * XPMP2::RelatedLoad | ( | const std::string | _paths[], |
size_t | _num | ||
) |
Load all related files.
const char * XPMP2::RelatedLoad | ( | RelTxtTy | relType, |
const std::string & | _path | ||
) |
Read the related.txt
file, full path passed in.
void XPMP2::RemoteAcClearAll | ( | ) |
Informs us that there are no more aircraft, clear our caches!
void XPMP2::RemoteAcEnqueue | ( | const Aircraft & | ac | ) |
Regularly called from the flight loop callback to send a/c date onto the network.
Will collect data into network messages but only send out when full
void XPMP2::RemoteAcEnqueueDone | ( | ) |
Informs us that all a/c have been processed: All pending messages to be sent now.
void XPMP2::RemoteAcEnqueueStarts | ( | float | now | ) |
Informs us that updating a/c will start now, do some prep work
void XPMP2::RemoteAcRemove | ( | const Aircraft & | ac | ) |
Informs us about an aircraft deletion.
void XPMP2::RemoteCleanup | ( | ) |
Grace cleanup, stops all threads.
RemoteStatusTy XPMP2::RemoteGetStatus | ( | ) |
Returns the current Remote status.
void XPMP2::RemoteInit | ( | ) |
Initialize the module.
void XPMP2::RemoteRecvStart | ( | const RemoteCBFctTy & | _rmtCBFcts | ) |
Starts the listener, will call provided callback functions with received messages.
void XPMP2::RemoteRecvStop | ( | ) |
Stops the receiver.
void XPMP2::RemoteSenderUpdateStatus | ( | ) |
Compares current vs. expected status and takes appropriate action.
void XPMP2::RemoveExtension | ( | std::string & | path | ) |
Removes everything after the last dot, the dot including.
|
inline |
Conditions for continued receive operation.
void XPMP2::RmtRecvMain | ( | ) |
Thread main function for the receiver.
< error counter for network thread
void XPMP2::RmtSendBeacon | ( | ) |
Sends an Interest Beacon.
|
inline |
Conditions for continued send operation.
void XPMP2::RmtSendLoop | ( | ) |
Sending function, ie. we are actively sending data out.
void XPMP2::RmtSendMain | ( | ) |
Thread main function for the sender.
< error counter for network thread
void XPMP2::RmtSendProcessQueue | ( | ) |
Process the data passed down to us in the queue.
void XPMP2::RmtSendSettings | ( | ) |
Send our settings.
void XPMP2::RmtStartMCThread | ( | bool | bSender | ) |
Start the background thread to listen to multicast, to see if anybody is interested in our data.
void XPMP2::RmtStopAll | ( | ) |
Stop all threads and communication with the network.
|
inline |
trimming of string (from right)
std::istream & XPMP2::safeGetline | ( | std::istream & | is, |
std::string & | t | ||
) |
Read a line from a text file, no matter if ending on CRLF or LF.
Read a text line, handling both Windows (CRLF) and Unix (LF) ending Code makes use of the fact that in both cases LF is the terminal character. So we read from file until LF (without widening!). In case of CRLF files there then is a trailing CR, which we just remove.
void XPMP2::SoundCleanup | ( | ) |
Graceful shoutdown.
const char* XPMP2::SoundEventTxt | ( | Aircraft::SoundEventsTy | e | ) |
Return a text for the values of Aircraft::SoundEventsTy.
void XPMP2::SoundInit | ( | ) |
Initialize the sound module and load the sounds.
int XPMP2::SoundLoadXPSounds | ( | ) |
Load fixed set of X-Plane-internal sounds.
void XPMP2::SoundUpdatesBegin | ( | ) |
Prepare for this frame's updates, which are about to start.
void XPMP2::SoundUpdatesDone | ( | ) |
Tell FMOD that all updates are done.
|
inline |
Square.
std::vector< std::string > XPMP2::str_tokenize | ( | const std::string | s, |
const std::string | tokens, | ||
bool | bSkipEmpty | ||
) |
separates string into tokens
std::string & XPMP2::str_tolower | ( | std::string & | s | ) |
change a std::string to uppercase
int XPMP2::StrCntString | ( | const mapStrIntTy & | m, |
std::string & | s | ||
) |
Compiles a string from a map of string->int like "(A320 x 5, A388 x 12)".
std::string XPMP2::StripXPSysDir | ( | const std::string & | path | ) |
If a path starts with X-Plane's system directory it is stripped.
|
inline |
On Lin/Win there is no need for a conversion, but we do treat p
now as std::string
|
inline |
trimming of string (from both ends)
void XPMP2::TwoDActivate | ( | ) |
Activate actual label drawing, esp. set up drawing callback.
void XPMP2::TwoDCleanup | ( | ) |
Grace cleanup.
void XPMP2::TwoDDeactivate | ( | ) |
Deactivate actual label drawing, esp. stop drawing callback.
void XPMP2::TwoDDrawLabels | ( | ) |
Write the labels of all aircraft.
XPMPDefaultPlaneRenderer
of the original libxplanemp void XPMP2::TwoDInit | ( | ) |
Initialize the module.
void XPMP2::XPMPSendNotification | ( | const Aircraft & | plane, |
XPMPPlaneNotification | _notification | ||
) |
Send a notification to all observers.
const char* XPMP2::XPMPValidateResourceFiles | ( | const char * | resourceDir | ) |
Validate all required files are available in the resource directory.
|
inline |
Are XP12 sound functions available?
bool XPMP2::XPSoundLoadFctPtr | ( | ) |
Tries to find all the new XP12 sound functions, available as of XP12.04.
std::vector<XPLMDataRef> XPMP2::ahDataRefs |
Registered dataRefs.
|
constexpr |
How much distance does each AIPrio add?
|
constexpr |
How often do we reassign AI slots? [seconds].
std::array<const char*, 2> XPMP2::ALL_MAPS |
The list of known maps, which are hard-coded by X-Plane's SDK.
const char* XPMP2::DATA_REF_EDITORS[] |
const Doc8643 XPMP2::DOC8643_EMPTY |
std::vector<std::unique_ptr<std::string> > XPMP2::drStrings |
Here we store the dataRef strings as smart pointers, so that the pointed-to location will not change but we can easily manage them
|
constexpr |
Epsilon, a small number.
|
constexpr |
Maximum number of warnings during file read before bailing.
|
constexpr |
In how many cycles to skip expensive computations?
float XPMP2::F_NULL[10] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f} |
A constant array of zero values supporting quick array initialization.
|
constexpr |
Don't dare using NAN...but with this coordinate for x/y/z a plane should be far out and virtually invisible.
|
constexpr |
Value used for 3D max distance, which doesn't have much of a function for the inverse roll-off model used here.
|
constexpr |
Gain used when activating Low Pass filter.
|
constexpr |
Number of virtual channels during initialization.
|
constexpr |
standard gravitational acceleration [m/s²]
SetLocalIntfAddrTy XPMP2::gAddrLocal |
Set of local IP interface addresses.
|
constexpr |
How often to call the garbage collection [s].
|
constexpr |
Unload an unused object after how many seconds?
bool XPMP2::gbRemoteGaveUp = false |
No longer try remote functionality, have seen to many errors.
volatile bool XPMP2::gbStopMCThread = false |
Shall the network thread stop?
std::condition_variable XPMP2::gcvRmtData |
notifies the network thread of available data to be processed
XPLMFlightLoopID XPMP2::gFlightLoopID = nullptr |
The id of our flight loop callback.
FMOD_RESULT XPMP2::gFmodRes = FMOD_OK |
last FMOD result code, needed by the following macro, better don't rely on anywhere else
unsigned XPMP2::gFullUpdDue = 0 |
What's the full update group that has its turn now?
unsigned XPMP2::gFullUpdLastDone = 0 |
the last actually processed full update group
XPLMFlightLoopID XPMP2::gGarbageCollectionID = nullptr |
The ids of our garbage collection flight loop callback.
XPLMObjectRef XPMP2::ghContrailObj = nullptr |
The one global Contrail object.
XPLMDataRef XPMP2::ghDrContrailLifeTime = nullptr |
The handle for the registered Contrail LifeTime dataRef.
GlobVars XPMP2::glob |
The one and only global variable structure.
mapRmtAcCacheTy XPMP2::gmapRmtAcCache |
Cache for last data sent out to the network.
RmtMsgBufTy<RemoteAcAnimTy, RMT_MSG_AC_ANIM, RMT_VER_AC_ANIM> XPMP2::gMsgAcAnim |
A/C Animation dataRefs message.
RmtMsgBufTy<RemoteAcDetailTy,RMT_MSG_AC_DETAILED,RMT_VER_AC_DETAIL> XPMP2::gMsgAcDetail |
A/C Detail message.
RmtMsgBufTy<RemoteAcPosUpdateTy,RMT_MSG_AC_POS_UPDATE,RMT_VER_AC_POS_UPDATE> XPMP2::gMsgAcPosUpdate |
A/C Position Update message.
RmtMsgBufTy<RemoteAcRemoveTy,RMT_MSG_AC_REMOVE,RMT_VER_AC_REMOVE> XPMP2::gMsgAcRemove |
A/C Removal message.
std::mutex XPMP2::gmutexRmtData |
protects modifying access to the queue and the condition variable
float XPMP2::gNow = 0.0f |
Current network timestamp.
unsigned XPMP2::gNxtFullUpdGrpToAssign = 0 |
What's the next group number to assign to the next a/c? (Assigned will be the value incremented by 1)
float XPMP2::gNxtTxfTime = 0.0f |
When to actually process position updates next?
UDPMulticast* XPMP2::gpMc = nullptr |
multicast socket for listening/sending (destructor uses locks, which don't work during module shutdown, so can't create a global object due to its exit-time destructor)
SoundSystem * XPMP2::gpSndSys = nullptr |
The sound system in use.
f_XPLMPlayPCMOnBus* XPMP2::gpXPLMPlayPCMOnBus = nullptr |
f_XPLMSetAudioCone* XPMP2::gpXPLMSetAudioCone = nullptr |
f_XPLMSetAudioFadeDistance* XPMP2::gpXPLMSetAudioFadeDistance = nullptr |
f_XPLMSetAudioPosition* XPMP2::gpXPLMSetAudioPosition = nullptr |
f_XPLMSetAudioVolume* XPMP2::gpXPLMSetAudioVolume = nullptr |
f_XPLMStopAudio* XPMP2::gpXPLMStopAudio = nullptr |
queueRmtDataTy XPMP2::gqueueRmtData |
the queue for passing data from main to network thread
RemoteCBFctTy XPMP2::gRmtCBFcts |
The callback function pointers the remote client plugin provided.
float XPMP2::gSendSettingsLast = 0.0f |
Timestamp when we sent our settings the last time.
std::thread XPMP2::gThrMC |
remote listening/sending thread
|
constexpr |
Convert m/s to knots.
const char* XPMP2::LOG_LEVEL[] |
|
constexpr |
Convert feet to meters, e.g. for altitude calculations.
|
constexpr |
Convert nautical miles to meters.
|
constexpr |
Assumed size of an aircraft in m.
|
constexpr |
Dimenson of MapIcon.png.
|
constexpr |
Dimenson of MapIcon.png.
|
constexpr |
Minimum icon size in map in UI units.
|
constexpr |
after this many errors we no longer try listening
std::recursive_mutex XPMP2::mtxAddrLocal |
Mutex to safeguard access to gAddrLocal
std::recursive_mutex XPMP2::mtxSocketClose |
Mutex to ensure closing is done in one thread only to avoid race conditions on deleting the buffer.
XPMP2::RemoteMsgAcDetailTy_v0 XPMP2::PACKED |
|
constexpr |
Pi.
|
constexpr |
resolution of altitude[ft] updates
|
constexpr |
What is the maximum difference a RemoteAcPosUpdateTy can hold?
resolution of degree updates
const std::array< RemoteDataRefPackTy, V_COUNT > XPMP2::REMOTE_DR_DEF |
An array holding all dataRef packing definitions.
Defines per dataRef the value range we support transferring to the remote client.
|
constexpr |
maximum altitude[ft] difference that can be represented in a pos update msg
|
constexpr |
maximum degree difference that can be represented in a pos update msg
|
constexpr |
maximum time difference thatn can be represented in a pos update msg
|
constexpr |
How often to send an Interest Beacon? [s].
|
constexpr |
How often to send full a/c details? [s].
|
constexpr |
How often to send settings? [s].
|
constexpr |
The signature of the XPMP2 Remote Client.
|
constexpr |
resolution of time difference
|
constexpr |
A/C Position update message version number.
|
constexpr |
A/C detail message version number.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
A/C Position update message version number.
|
constexpr |
A/C removal message version number.
|
constexpr |
Interest Beacon message version number.
|
constexpr |
Setttings message version number.
|
constexpr |
Defined by XPMP2 internally.
Convert revolutions-per-minute (RPM) to radians per second (rad/s) by multiplying with PI/30
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Number of characters to be allowed for CSL model text.
|
constexpr |
Maximum length of OS error message.
std::vector<std::string> XPMP2::vecDREdataRefStr |
list of dataRef strings to be send to the editors
|
constexpr |
The drawing phase "xplm_Phase_Airplanes" is deprecated in XP11.50 upwards, but we need it in earlier versions to fake TCAS.