Compare commits

...
Author SHA1 Message Date
Automatic Release Builder 8dec1cb38c new version: 2018.3.6 2020-08-06 15:59:57 +01:00
James Turner f25e95958a Fix compilation for some MSVC versions 2020-08-03 14:25:58 +01:00
James Turner 08108d9cf1 HTTP: allow CAINFO to be set
Env var is SIMGEAR_TLS_CERT_PATH
2020-08-03 14:25:58 +01:00
James Turner 02cfd941c9 Set CMake OpenGL VND policy 2020-08-03 14:25:58 +01:00
Scott Giese 75b5a927c8 [boost::enable_if] Support Boost versions < 1.56 2020-06-30 11:37:51 +01:00
Scott Giese e4b58b65f3 Remove deprecated boost/utility.
This is enable compatibility with boost 1.69.
2020-06-29 09:41:24 +01:00
James Turner b1334bf9a0 Fix zero-interval repeat on pick/knob animation
See:
https://sourceforge.net/p/flightgear/codetickets/2241/

Note did not adjust bug in knob-animation ignoring repeatable flag
(always marked repeatable) since this might break some aircraft.
2020-06-29 09:39:04 +01:00
James Turner 2a9767b568 Fix compilation with Boost >= 1.73 2020-06-29 09:38:58 +01:00
James Turner 29f6d06f1a Packages: consider checksum failures for retry.
This means an out-of-sync mirror causes a retry on a different
mirror server.
2020-04-15 11:28:58 +01:00
Erik Hofman fcd8ebb8a3 Backport the OpenAL Doppler fixes 2020-04-13 10:11:41 +02:00
13 changed files with 95 additions and 31 deletions
+7 -1
View File
@@ -10,6 +10,12 @@ if(COMMAND cmake_policy)
if(POLICY CMP0067) if(POLICY CMP0067)
cmake_policy(SET CMP0067 NEW) cmake_policy(SET CMP0067 NEW)
endif() endif()
# OpenGL VND policy : use the old definition for now, until we can audit this
if(POLICY CMP0072)
cmake_policy(SET CMP0072 OLD)
endif()
if(POLICY CMP0093) if(POLICY CMP0093)
cmake_policy(SET CMP0093 NEW) cmake_policy(SET CMP0093 NEW)
endif() endif()
@@ -219,7 +225,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD
endif() endif()
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
set (BOOST_CXX_FLAGS "-DBOOST_BIMAP_DISABLE_SERIALIZATION") set (BOOST_CXX_FLAGS "-DBOOST_BIMAP_DISABLE_SERIALIZATION -DBOOST_NO_STDLIB_CONFIG")
include(BoostTestTargets) include(BoostTestTargets)
if(SIMGEAR_HEADLESS) if(SIMGEAR_HEADLESS)
+9
View File
@@ -107,6 +107,8 @@ public:
unsigned int bytesTransferred; unsigned int bytesTransferred;
unsigned int lastTransferRate; unsigned int lastTransferRate;
uint64_t totalBytesDownloaded; uint64_t totalBytesDownloaded;
SGPath tlsCertificatePath;
}; };
Client::Client() : Client::Client() :
@@ -122,6 +124,8 @@ Client::Client() :
d->maxPipelineDepth = 5; d->maxPipelineDepth = 5;
setUserAgent("SimGear-" SG_STRINGIZE(SIMGEAR_VERSION)); setUserAgent("SimGear-" SG_STRINGIZE(SIMGEAR_VERSION));
d->tlsCertificatePath = SGPath::fromEnv("SIMGEAR_TLS_CERT_PATH");
static bool didInitCurlGlobal = false; static bool didInitCurlGlobal = false;
if (!didInitCurlGlobal) { if (!didInitCurlGlobal) {
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
@@ -275,6 +279,11 @@ void Client::makeRequest(const Request_ptr& r)
curl_easy_setopt(curlRequest, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curlRequest, CURLOPT_FOLLOWLOCATION, 1);
if (!d->tlsCertificatePath.isNull()) {
const auto utf8 = d->tlsCertificatePath.utf8Str();
curl_easy_setopt(curlRequest, CURLOPT_CAINFO, utf8.c_str());
}
if (!d->proxy.empty()) { if (!d->proxy.empty()) {
curl_easy_setopt(curlRequest, CURLOPT_PROXY, d->proxy.c_str()); curl_easy_setopt(curlRequest, CURLOPT_PROXY, d->proxy.c_str());
curl_easy_setopt(curlRequest, CURLOPT_PROXYPORT, d->proxyPort); curl_easy_setopt(curlRequest, CURLOPT_PROXYPORT, d->proxyPort);
+1 -1
View File
@@ -635,7 +635,7 @@ void ArchiveExtractor::extractBytes(const uint8_t* bytes, size_t count)
d.reset(new ZipExtractorPrivate(this)); d.reset(new ZipExtractorPrivate(this));
} }
else { else {
SG_LOG(SG_IO, SG_ALERT, "Invcalid archive type"); SG_LOG(SG_IO, SG_WARN, "Invalid archive type");
_invalidDataType = true; _invalidDataType = true;
return; return;
} }
+1
View File
@@ -21,6 +21,7 @@
#include "NasalString.hxx" #include "NasalString.hxx"
#include <cassert> #include <cassert>
#include <stdexcept> // for std::runtime_error
namespace nasal namespace nasal
{ {
+5
View File
@@ -24,6 +24,11 @@
#include <simgear/structure/map.hxx> #include <simgear/structure/map.hxx>
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#if BOOST_VERSION >= 105600
#include <boost/core/enable_if.hpp>
#else
#include <boost/utility/enable_if.hpp>
#endif
namespace nasal namespace nasal
{ {
+16 -4
View File
@@ -57,7 +57,7 @@ public:
m_extractPath = aOwner->path().dir(); m_extractPath = aOwner->path().dir();
m_extractPath.append("_extract_" + aOwner->package()->md5()); m_extractPath.append("_extract_" + aOwner->package()->md5());
// clean up any existing files // clean up any existing files (eg from previous failed download)
Dir d(m_extractPath); Dir d(m_extractPath);
if (d.exists()) { if (d.exists()) {
d.remove(true /* recursive */); d.remove(true /* recursive */);
@@ -106,7 +106,9 @@ protected:
Request::responseHeadersComplete(); Request::responseHeadersComplete();
Dir d(m_extractPath); Dir d(m_extractPath);
d.create(0755); if (!d.create(0755)) {
SG_LOG(SG_GENERAL, SG_WARN, "Failed to create extraction directory" << d.path());
}
m_extractor.reset(new ArchiveExtractor(m_extractPath)); m_extractor.reset(new ArchiveExtractor(m_extractPath));
memset(&m_md5, 0, sizeof(SG_MD5_CTX)); memset(&m_md5, 0, sizeof(SG_MD5_CTX));
@@ -115,11 +117,20 @@ protected:
void gotBodyData(const char* s, int n) override void gotBodyData(const char* s, int n) override
{ {
// if there's a pre-existing error, discard byte sinstead of pushing
// more through the extactor
if (m_extractor->hasError()) {
return;
}
const uint8_t* ubytes = (uint8_t*) s; const uint8_t* ubytes = (uint8_t*) s;
SG_MD5Update(&m_md5, ubytes, n); SG_MD5Update(&m_md5, ubytes, n);
m_downloaded += n; m_downloaded += n;
m_owner->installProgress(m_downloaded, responseLength()); m_owner->installProgress(m_downloaded, responseLength());
m_extractor->extractBytes(ubytes, n); m_extractor->extractBytes(ubytes, n);
if (m_extractor->hasError()) {
SG_LOG(SG_GENERAL, SG_WARN, "archive extraction failed (from " + m_activeURL + ")");
}
} }
void onDone() override void onDone() override
@@ -214,7 +225,9 @@ private:
dir.remove(true /* recursive */); dir.remove(true /* recursive */);
} }
const auto canRetry = (aReason == Delegate::FAIL_NOT_FOUND) || (aReason == Delegate::FAIL_DOWNLOAD); const auto canRetry = (aReason == Delegate::FAIL_NOT_FOUND) ||
(aReason == Delegate::FAIL_DOWNLOAD) || (aReason == Delegate::FAIL_CHECKSUM);
if (canRetry && !m_urls.empty()) { if (canRetry && !m_urls.empty()) {
SG_LOG(SG_GENERAL, SG_WARN, "archive download failed from:" << m_activeURL SG_LOG(SG_GENERAL, SG_WARN, "archive download failed from:" << m_activeURL
<< "\n\twill retry with next mirror"); << "\n\twill retry with next mirror");
@@ -226,7 +239,6 @@ private:
return; return;
} }
// TODO - try other mirrors
m_owner->m_download.reset(); // ensure we get cleaned up m_owner->m_download.reset(); // ensure we get cleaned up
m_owner->installResult(aReason); m_owner->installResult(aReason);
} }
+7 -4
View File
@@ -122,14 +122,17 @@ void printPackageInfo(pkg::Package* pkg)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
sglog().setLogLevels( SG_ALL, SG_INFO );
HTTP::Client* http = new HTTP::Client(); HTTP::Client* http = new HTTP::Client();
pkg::Root* root = new pkg::Root(Dir::current().path(), "");
SGPath rootPath = SGPath::fromEnv("SG_PKG_ROOT", Dir::current().path());
pkg::Root* root = new pkg::Root(rootPath, "2019.1.1");
MyDelegate dlg; MyDelegate dlg;
root->addDelegate(&dlg); root->addDelegate(&dlg);
cout << "Package root is:" << Dir::current().path() << endl; cout << "Package root is:" << rootPath << endl;
cout << "have " << root->catalogs().size() << " catalog(s)" << endl; cout << "have " << root->catalogs().size() << " catalog(s)" << endl;
root->setHTTPClient(http); root->setHTTPClient(http);
+6 -1
View File
@@ -55,13 +55,18 @@ namespace boost {
struct disable_if : public disable_if_c<Cond::value, T> {}; struct disable_if : public disable_if_c<Cond::value, T> {};
} }
#else #else
# include <boost/utility.hpp>
# include <boost/type_traits/is_enum.hpp> # include <boost/type_traits/is_enum.hpp>
#if BOOST_VERSION >= 105600
#include <boost/core/enable_if.hpp>
#else
#include <boost/utility/enable_if.hpp>
#endif
# include <simgear/debug/logstream.hxx> # include <simgear/debug/logstream.hxx>
# include <simgear/math/SGMathFwd.hxx> # include <simgear/math/SGMathFwd.hxx>
# include <simgear/math/sg_types.hxx> # include <simgear/math/sg_types.hxx>
#endif #endif
#include <simgear/structure/SGReferenced.hxx> #include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
+23 -9
View File
@@ -136,11 +136,19 @@ osg::Vec2d eventToWindowCoords(const osgGA::GUIEventAdapter& ea)
virtual void update(double dt, int keyModState) virtual void update(double dt, int keyModState)
{ {
if (!_condition || _condition->test()) { SG_UNUSED(keyModState);
SG_UNUSED(keyModState); if (_condition && !_condition->test()) {
if (!_repeatable) return;
return; }
if (!_repeatable)
return;
const bool zeroInterval = (_repeatInterval <= 0.0);
if (zeroInterval) {
// fire once per frame
fireBindingList(_bindingsDown);
} else {
_repeatTime += dt; _repeatTime += dt;
while (_repeatInterval < _repeatTime) { while (_repeatInterval < _repeatTime) {
_repeatTime -= _repeatInterval; _repeatTime -= _repeatInterval;
@@ -682,12 +690,18 @@ public:
if (_hasDragged) { if (_hasDragged) {
return; return;
} }
_repeatTime += dt; const bool zeroInterval = (_repeatInterval <= 0.0);
while (_repeatInterval < _repeatTime) { if (zeroInterval) {
_repeatTime -= _repeatInterval; // fire once per frame
fire(keyModState & osgGA::GUIEventAdapter::MODKEY_SHIFT, _direction); fire(keyModState & osgGA::GUIEventAdapter::MODKEY_SHIFT, _direction);
} // of repeat iteration } else {
_repeatTime += dt;
while (_repeatInterval < _repeatTime) {
_repeatTime -= _repeatInterval;
fire(keyModState & osgGA::GUIEventAdapter::MODKEY_SHIFT, _direction);
} // of repeat iteration
}
} }
virtual bool hover( const osg::Vec2d& windowPos, virtual bool hover( const osg::Vec2d& windowPos,
-4
View File
@@ -353,10 +353,6 @@ void SGSampleGroup::update_sample_config( SGSoundSample *sample )
velocity = sample->get_velocity(); velocity = sample->get_velocity();
} }
if (_smgr->bad_doppler_effect()) {
velocity *= 100.0f;
}
#if 0 #if 0
if (length(position) > 20000) if (length(position) > 20000)
printf("%s source and listener distance greater than 20km!\n", printf("%s source and listener distance greater than 20km!\n",
+15 -6
View File
@@ -50,6 +50,7 @@ using std::vector;
#define MAX_SOURCES 128 #define MAX_SOURCES 128
#define SPEED_OF_SOUND 340.4f
#ifndef ALC_ALL_DEVICES_SPECIFIER #ifndef ALC_ALL_DEVICES_SPECIFIER
# define ALC_ALL_DEVICES_SPECIFIER 0x1013 # define ALC_ALL_DEVICES_SPECIFIER 0x1013
@@ -218,8 +219,8 @@ void SGSoundMgr::init()
alListenerfv( AL_POSITION, SGVec3f::zeros().data() ); alListenerfv( AL_POSITION, SGVec3f::zeros().data() );
alListenerfv( AL_VELOCITY, SGVec3f::zeros().data() ); alListenerfv( AL_VELOCITY, SGVec3f::zeros().data() );
alDopplerFactor(1.0); alDopplerFactor(1.0f);
alDopplerVelocity(340.3); // speed of sound in meters per second. alDopplerVelocity(SPEED_OF_SOUND);
// gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + // gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE +
// AL_ROLLOFF_FACTOR * (distance - AL_REFERENCE_DISTANCE)); // AL_ROLLOFF_FACTOR * (distance - AL_REFERENCE_DISTANCE));
@@ -248,8 +249,10 @@ void SGSoundMgr::init()
_renderer = (const char *)alGetString(AL_RENDERER); _renderer = (const char *)alGetString(AL_RENDERER);
if (_vendor == "Creative Labs Inc.") { if (_vendor == "Creative Labs Inc.") {
alDopplerFactor(100.0f);
_bad_doppler = true; _bad_doppler = true;
} else if (_vendor == "OpenAL Community" && _renderer == "OpenAL Soft") { } else if (_vendor == "OpenAL Community" && _renderer == "OpenAL Soft") {
alDopplerFactor(100.0f);
_bad_doppler = true; _bad_doppler = true;
} }
@@ -392,14 +395,20 @@ if (isNaN(toVec3f(_velocity).data())) printf("NaN in listener velocity\n");
SGVec3d velocity = SGVec3d::zeros(); SGVec3d velocity = SGVec3d::zeros();
if ( _velocity[0] || _velocity[1] || _velocity[2] ) { if ( _velocity[0] || _velocity[1] || _velocity[2] ) {
velocity = hlOr.backTransform(_velocity*SG_FEET_TO_METER); velocity = hlOr.backTransform(_velocity*SG_FEET_TO_METER);
}
if ( _bad_doppler ) { if ( _bad_doppler ) {
velocity *= 100.0f; double fact = 100.0;
double mag = length( velocity );
if (mag > SPEED_OF_SOUND) {
fact *= SPEED_OF_SOUND / mag;
}
alDopplerFactor(fact);
}
} }
alListenerfv( AL_VELOCITY, toVec3f(velocity).data() ); alListenerfv( AL_VELOCITY, toVec3f(velocity).data() );
// alDopplerVelocity(340.3); // TODO: altitude dependent // alDopplerVelocity(SPEED_OF_SOUND);
testForError("update"); testForError("update");
_changed = false; _changed = false;
} }
+4
View File
@@ -22,7 +22,11 @@
#include "SGSharedPtr.hxx" #include "SGSharedPtr.hxx"
#include <boost/type_traits/is_base_of.hpp> #include <boost/type_traits/is_base_of.hpp>
#if BOOST_VERSION >= 105600
#include <boost/core/enable_if.hpp>
#else
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(push) # pragma warning(push)
+1 -1
View File
@@ -1 +1 @@
2018.3.5 2018.3.6