Skip to content

Commit

Permalink
Merge branch 'Next'
Browse files Browse the repository at this point in the history
  • Loading branch information
TwinFan committed Aug 13, 2019
2 parents 63b8a32 + 153eefb commit 40a78de
Show file tree
Hide file tree
Showing 63 changed files with 10,701 additions and 137 deletions.
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ endif ()
set(CMAKE_CXX_STANDARD 17)

# Set include directories used by our code and dependencies.
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/Src")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/Include")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/Lib/xplanemp")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/Lib/LTAPI")
include_directories("${CMAKE_SOURCE_DIR}/Include")
include_directories("${CMAKE_SOURCE_DIR}/Lib/xplanemp/xplanemp.framework/Headers")
include_directories("${CMAKE_SOURCE_DIR}/Lib/LTAPI")
include_directories("${CMAKE_SOURCE_DIR}/Lib/XPSDK301/CHeaders/Widgets")
include_directories("${CMAKE_SOURCE_DIR}/Lib/XPSDK301/CHeaders/Wrappers")
include_directories("${CMAKE_SOURCE_DIR}/Lib/XPSDK301/CHeaders/XPLM")
Expand Down Expand Up @@ -78,9 +77,10 @@ set(Header_Files
Include/TextIO.h
Include/TFWidgets.h
Include/XPCompatibility.h
Lib/xplanemp/XPCAircraft.h
Lib/xplanemp/XPMPMultiplayer.h
Lib/xplanemp/XPMPPlaneRenderer.h
Lib/LTAPI/LTAPI.h
Lib/xplanemp/xplanemp.framework/Headers/XPCAircraft.h
Lib/xplanemp/xplanemp.framework/Headers/XPMPMultiplayer.h
Lib/xplanemp/xplanemp.framework/Headers/XPMPPlaneRenderer.h
)
source_group("Header Files" FILES ${Header_Files})

Expand Down
5 changes: 2 additions & 3 deletions Include/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//
// MARK: Version Information (CHANGE VERSION HERE)
//
constexpr float VERSION_NR = 1.20f;
constexpr float VERSION_NR = 1.21f;
constexpr bool VERSION_BETA = false;
extern float verXPlaneOrg; // version on X-Plane.org
extern int verDateXPlaneOrg; // and its date
Expand All @@ -42,7 +42,7 @@ extern int verDateXPlaneOrg; // and its date
#define WIN_FROM_RIGHT 0

constexpr int WIN_TIME_DISPLAY=8; // duration of displaying a message windows
constexpr float WIN_TIME_REMAIN=0.5f; // seconds to keep the msg window after last message
constexpr float WIN_TIME_REMAIN=1.0f; // seconds to keep the msg window after last message

//MARK: Unit conversions
constexpr int M_per_NM = 1852; // meter per 1 nautical mile = 1/60 of a lat degree
Expand Down Expand Up @@ -225,7 +225,6 @@ constexpr long HTTP_UNAUTHORIZED = 401;
constexpr long HTTP_FORBIDDEN = 403;
constexpr long HTTP_NOT_FOUND = 404;
constexpr long HTTP_NOT_AVAIL = 503; // "Service not available"
constexpr long CURL_TIMEOUT = 30; ///< [s] network timeout, see CURLOPT_TIMEOUT
constexpr int CH_MAC_ERR_CNT = 5; // max number of tolerated errors, afterwards invalid channel
constexpr int SERR_LEN = 100; // size of buffer for IO error texts (strerror_s)
#define ERR_XPLANE_ONLY "LiveTraffic works in X-Plane only, version 10 or higher"
Expand Down
3 changes: 3 additions & 0 deletions Include/DataRefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ enum dataRefsLT {
DR_CFG_FD_REFRESH_INTVL,
DR_CFG_FD_BUF_PERIOD,
DR_CFG_AC_OUTDATED_INTVL,
DR_CFG_NETW_TIMEOUT,
DR_CFG_LND_LIGHTS_TAXI,
DR_CFG_HIDE_BELOW_AGL,
DR_CFG_HIDE_TAXIING,
Expand Down Expand Up @@ -461,6 +462,7 @@ class DataRefs
int fdRefreshIntvl = 20; // how often to fetch new flight data
int fdBufPeriod = 90; // seconds to buffer before simulating aircrafts
int acOutdatedIntvl = 50; // a/c considered outdated if latest flight data more older than this compare to 'now'
int netwTimeout = 90; // [s] of network request timeout
int bLndLightsTaxi = false; // keep landing lights on while taxiing? (to be able to see the a/c as there is no taxi light functionality)
int hideBelowAGL = 0; // if positive: a/c visible only above this height AGL
int hideTaxiing = 0; // hide a/c while taxiing?
Expand Down Expand Up @@ -611,6 +613,7 @@ class DataRefs
inline int GetFdRefreshIntvl() const { return fdRefreshIntvl; }
inline int GetFdBufPeriod() const { return fdBufPeriod; }
inline int GetAcOutdatedIntvl() const { return acOutdatedIntvl; }
inline int GetNetwTimeout() const { return netwTimeout; }
inline bool GetLndLightsTaxi() const { return bLndLightsTaxi != 0; }
inline int GetHideBelowAGL() const { return hideBelowAGL; }
inline bool GetHideTaxiing() const { return hideTaxiing != 0; }
Expand Down
4 changes: 2 additions & 2 deletions Include/LTADSBEx.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@

// Testing an API key
#define ADSBEX_VERIFY_KEY_URL "https://adsbexchange.com/api/aircraft/icao/000000"
#define ADSBEX_ERR "ERR"
#define ADSBEX_NO_API_KEY "NO API KEY"
#define ADSBEX_ERR "msg"
#define ADSBEX_NO_API_KEY "You need a key."

#define ADSBEX_VERIFY_RAPIDAPI "https://adsbx-flight-sim-traffic.p.rapidapi.com/api/aircraft/json/lat/0.0/lon/0.0/dist/25/"
#define ADSBEX_RAPID_ERR "message"
Expand Down
4 changes: 4 additions & 0 deletions Include/LTRealTraffic.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ class RealTrafficConnection : public LTOnlineChannel, LTFlightDataChannel
std::thread thrUdpListener;
UDPReceiver udpTrafficData;
UDPReceiver udpWeatherData;
#if APL == 1 || LIN == 1
// the self-pipe to shut down the UDP listener thread gracefully
SOCKET udpPipe[2] = { INVALID_SOCKET, INVALID_SOCKET };
#endif
volatile bool bStopUdp = false;
volatile bool thrUdpRunning = false;
double lastReceivedTime = 0.0; // copy of simTime
Expand Down
3 changes: 3 additions & 0 deletions Include/LiveTraffic.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ bool FetchXPlaneOrgVersion ();
// default window open mode depends on XP10/11 and VR
TFWndMode GetDefaultWndOpenMode ();

// Replacement for XPLMDrawTranslucentDarkBox courtesy of slgoldberg
void LTDrawTranslucentDarkBox (int l, int t, int r, int b);

// MARK: Compiler differences

#if APL == 1 || LIN == 1
Expand Down
6 changes: 5 additions & 1 deletion Include/Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ class TCPConnection : public SocketNetworking
protected:
SOCKET f_session_socket = INVALID_SOCKET;
struct sockaddr_in f_session_addr;

#if APL == 1 || LIN == 1
// the self-pipe to shut down the TCP listener gracefully
SOCKET selfPipe[2] = { INVALID_SOCKET, INVALID_SOCKET };
#endif

public:
// The address is a string and it can represent an IPv4 or IPv6 address.
TCPConnection() : SocketNetworking() {}
Expand Down
2 changes: 2 additions & 0 deletions Include/SettingsUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class LTSettingsUI : public TFMainWindowWidget
TFIntFieldDataRef intMaxNumAc, intMaxFullNumAc, intFullDistance;
TFIntFieldDataRef intFdStdDistance, intFdRefreshIntvl;
TFIntFieldDataRef intFdBufPeriod, intAcOutdatedIntvl;
TFIntFieldDataRef intNetwTimeout;

// CSL tab
enum { SETUI_CSL_PATHS=7, SETUI_CSL_ELEMS_PER_PATH=3 };
Expand All @@ -81,6 +82,7 @@ class LTSettingsUI : public TFMainWindowWidget

// Debug tab
TFACSearchEditWidget txtDebugFilter;
TFButtonWidget btnDebugLogLevelDebug;
TFButtonDataRef btnDebugLogACPos, btnDebugLogModelMatch, btnDebugLogRawFd;
TFTextFieldWidget txtFixAcType, txtFixOp, txtFixLivery;

Expand Down
6 changes: 5 additions & 1 deletion Include/TFWidgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,13 @@ class TFDataRefLink
//
class TFButtonDataRef : public TFButtonWidget, public TFDataRefLink
{
public:
// shall parent window still be informed via MsgButtonStateChanged?
bool bInformParent = false;
public:
TFButtonDataRef (XPWidgetID _me = NULL, const char* dataRefName=NULL);
void setId (XPWidgetID _me, const char* dataRefName);
void setId (XPWidgetID _me, const char* dataRefName,
bool _bInformParent = false);
protected:
void Synch (); // button state with current data ref value
virtual bool MsgButtonStateChanged (XPWidgetID buttonWidget, bool bNowChecked);
Expand Down
65 changes: 65 additions & 0 deletions Lib/CURL/MacOSX-Framework64Lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
#
# Based on 'MacOSX-Framwork' as distributed with the curl source archive,
# adapted to produce a 64 bit static library only with current software,
# i.e. removed all PPC and 32 bit stuff.
#
# Added '--disable-shared --enable-static' to ./configure
# Disabled unneeded protocols
# Added '-Wno-deprecated-declarations' to CFLAGS
#

# bail out in case of errors
set -e

# fetch CURL version number from curlver.h
VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h`
FRAMEWORK_VERSION=Versions/Release-$VERSION

# path to the XCode developer tools and to the SDK, version numbers
DEVELOPER_PATH=`xcode-select --print-path`
SDK_PATH="$DEVELOPER_PATH/Platforms/MacOSX.platform/Developer/SDKs"
ARCHES64='-arch x86_64'
SDK64=`ls -r $SDK_PATH|egrep -v "10.[0-4][^0-9]" | head -1`
SDK64_DIR=$SDK_PATH/$SDK64
MACVER64=`echo $SDK64|sed -e s/[a-zA-Z]//g -e s/.\$//`
MINVER64='-mmacosx-version-min='$MACVER64

# Let's start
if test -d $SDK64_DIR; then
echo "----Configuring libcurl for 64 bit static library framework..."
./configure --disable-dependency-tracking --disable-shared --enable-static --enable-optimize --with-gssapi --with-darwinssl \
--disable-ldap --disable-ldaps --disable-ftp --disable-file --disable-rtsp --disable-dict --disable-telnet --disable-tftp \
--disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-dict --disable-telnet --disable-tftp \
CFLAGS="-Wno-deprecated-declarations -Os -isysroot $SDK64_DIR $ARCHES64" \
LDFLAGS="-Wl,-syslibroot,$SDK64_DIR $ARCHES64 -Wl,-headerpad_max_install_names" \
CC=$CC

echo "----Building 64 bit libcurl..."
make -j `sysctl -n hw.logicalcpu_max`

echo "----Creating 64 bit framework..."
if test -d libcurl.framework; then
rm -r libcurl.framework
fi
# create the structure including the Info.plist file and all public headers
mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Resources
/usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/${FRAMEWORK_VERSION}/Resources/Info.plist
mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl
cp include/curl/*.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl

# finally, copy the static library into place and add symlinks where needed
cp lib/.libs/libcurl.a libcurl.framework/${FRAMEWORK_VERSION}/libcurl
pushd libcurl.framework
ln -fs ${FRAMEWORK_VERSION}/libcurl libcurl
ln -fs ${FRAMEWORK_VERSION}/Resources Resources
ln -fs ${FRAMEWORK_VERSION}/Headers Headers
cd Versions
ln -fs $(basename "${FRAMEWORK_VERSION}") Current
popd

echo "SUCCESS: libcurl.framework is built and can now be included in other projects."
echo "Remember to define CURL_STATICLIB before including curl.h!"
else
echo "Building libcurl.framework requires Mac OS X 10.4 or later with the MacOSX10.4/5/6 SDK installed."
fi
1 change: 1 addition & 0 deletions Lib/CURL/libcurl.framework/Headers
1 change: 1 addition & 0 deletions Lib/CURL/libcurl.framework/Resources
1 change: 1 addition & 0 deletions Lib/CURL/libcurl.framework/Versions/Current
Loading

0 comments on commit 40a78de

Please sign in to comment.