Commit Graph

6042 Commits

Author SHA1 Message Date
James Turner
b2666c40f7 DNSClient: reorder timeout check
Check completion before timeout, so that complete requests which have
also exceeded their timeout don’t crash
2022-09-09 12:03:43 +01:00
Florent Rougon
cc3fab04a3 ResourceManager::findPath(): remove the first validate() call and warning
- Remove the SGPath::validate() call added in commit
  22779ee2c4 (first part of findPath():
  when it is called with a non-null second argument).

- Remove the warning printed when the assembled path is absolute and
  fails the SGPath::validate() read permission test (this caused too
  much noise and confusion).

- Keep the behavior or accepting absolute, existing paths that pass the
  SGPath::validate() read permission test.

This way, the 'play-audio-sample' FGCommand will continue to work with
absolute paths. If/when the built-in launcher is updated to set up the
read-allowed paths early enough, maybe we can revert FG commits
3ee54cbd72bd8f and 896be707ae558 and re-add the SGPath::validate()
call in the first part of findPath()---assuming it is deemed useful.
2022-08-28 14:53:05 +02:00
Florent Rougon
f906d82213 embedded_resources_test.cxx: fix warnings 2022-08-27 11:08:21 +02:00
Florent Rougon
64c5ed2be1 ResourceManager::findPath(): adjust a comment
Based on a discussion on flightgear-devel (see in particular James
Turner's message at [1]).

[1] https://sourceforge.net/p/flightgear/mailman/message/37697739/
2022-08-24 15:03:44 +02:00
Florent Rougon
22779ee2c4 ResourceManager::findPath(): validate; accept absolute, read-allowed paths
- Perform the SGPath::validate() test for read access before returning a
  path obtained with a non-null second argument ("aContext").

- If SGPath(aContext, aResource) is an absolute path for which read
  access is authorized by SGPath::validate(), return it. This restores
  the possibility of using the 'play-audio-sample' FGCommand with an
  absolute, read-allowed path (was lost in FG commit 8853fded2953959).

- Because a fair number of the existing uses of
  ResourceManager::findPath() are not quite correct IMO, we execute the
  final part where all providers are tried in turn even if
  SGPath(aContext, aResource) is an absolute path (otherwise, the sim
  wouldn't start because it couldn't load materials.xml---see [1]).

- The SG_LOG call will spot a few errors in calling code/data, such as
  access tried for
  '/Aircraft/Generic/flightrecorder/generic-piston-propeller-4.xml' and
  '/Textures/Sky/cl_cumulus2.png'; since the function does not return at
  this point, these incorrect absolute paths which should be relative
  will still be given a chance with the BasePathProvider that has its
  base path set to $FG_ROOT; thus, they will be found as before this
  commit despite the new "access refused" warning (but please fix
  them!).

This commit requires FlightGear commit e7594f46876fc6b0b.

[1] https://sourceforge.net/p/flightgear/mailman/message/37697516/
2022-08-24 01:33:57 +02:00
Florent Rougon
9608072787 SGPath: make read_allowed_paths and write_allowed_paths static data members
No functional change, only a tidier organization.
2022-08-22 23:59:37 +02:00
Florent Rougon
e002a481f4 Import FlightGear's fgValidatePath() as SGPath::validate()
This will allow us to perform access control validation in SimGear. The
current implementation of SGPath::validate() is 99% Rebecca Palmer's
work (see fgValidatePath() in FlightGear commit
6a30e7086ea2f1a060dd77dab6e7e8a15b43e82d); only the coding style has
been slightly modernized here since we can now use, for instance,
C++11's range-based for loop.
2022-08-22 13:15:48 +02:00
Florent Rougon
1ef4a7eb9e SGPath: rename validate() to updateAttrsIfNull()
This is to avoid confusion because the following commit will make
SGPath::validate(bool) replace the fgValidatePath() function from the
FlightGear repository.
2022-08-22 12:58:11 +02:00
Florent Rougon
8febf6b9f5 SGSoundSample constructor changes
- Add an explicit constructor SGSoundSample(const SGPath& file) that
  directly uses the specified path instead of going through
  ResourceManager::findPath().

- Reimplement the existing constructor as
  SGSoundSample(const std::string& file, const SGPath& dir),
  delegating to the new one.

- The first argument of the delegating constructor is now a
  const std::string& instead of a const char*.

Among others, this will allow a better implementation of
FGSoundManager::playAudioSampleCommand(). More explanations can be found
here:

  https://sourceforge.net/p/flightgear/mailman/message/37695786/
2022-08-20 08:20:38 +02:00
James Hogan
8e43ccc87b
Compositor: Fix log message about shadow pass
Fix a slightly messy log message about a pass not being a shadow pass,
where there was no end quote or space after the pass name.
2022-07-30 23:56:57 +01:00
Erik Hofman
aead0a305f Jean-Paul Acneaux (www2):
Update the world magnetic model data set from WMM2015 to WMM2020.
2022-07-24 08:29:48 +02:00
James Turner
b1dbb9499c METAR parsing: parse more cloud covers
Parse cloud coverage with no coverage or height
SF-ID: https://sourceforge.net/p/flightgear/codetickets/2750/
2022-07-01 16:24:36 +02:00
James Turner
a74181ded9 Allow specifing TerraSync DNS nameserver 2022-06-07 23:15:29 +01:00
Lars Toenning
8f940ed4f2 Fix SPDX license identifier 2022-06-03 09:58:56 +01:00
James Turner
a47b214c18 Allow SGVec<> isNaN in release build 2022-06-01 14:57:37 +01:00
Lars Toenning
4259db0b8f Add unittest for SGTimer/SGTimerQueue 2022-05-29 19:12:06 +01:00
Stuart Buchanan
a8cb72d653 WS30: Improved coastlines
Build a high resolution texture containing coastline
data that will be mixed with the landclass texture
in the ws30 shader.

Replaces the previous approach of creating a separate
coastline mesh.
2022-05-28 21:03:48 +01:00
Lars Toenning
e04f89e8b2 Use std::function for callbacks
Reduce complexity by using std::function for callbacks instead of our own class.
2022-05-25 10:37:26 +01:00
James Turner
e1aba1364b Disable the 'no shaders defined' error for now
Until we have a way to mark techqniues as permanently disabled,
remove this check, since it generates false positives. Especially,
see model-combined technnique n=9.
2022-05-25 10:36:43 +01:00
James Turner
5afeb44cec Effects: pass model XML file path, not dir path
Pass the full path to the XML file, not is containg directory, through
effects, so that it's available for error reporting. Convert to an
actual directory when using the path to lookup other resources.
2022-05-25 10:35:31 +01:00
Lars Toenning
e0e3456a68 Refactor SGTimerQueue
Use std::unique_ptrs to handle SGTimer
Use std::vector as container together with STL heap functions
2022-05-16 09:50:54 +01:00
Julian Smith
13ca3cec56 simgear/screen/video-encoder*: build fixes for ffmpeg code on Windows.
simgear/screen/video-encoder-internal.hxx:
    Fixed initialisation of AVRational instance to work on Windows.
simgear/screen/video-encoder.cxx:
    av_log(): vasprintf() is not available on Windows so use fixed buffer on
    Windows.
2022-05-04 17:54:46 +01:00
Julian Smith
20898923e0 simgear/timing/rawprofile.hxx: minor update to docs. 2022-05-01 23:24:42 +01:00
Julian Smith
eb94d12c4f simgear/screen/video-encoder.cxx: fixed build failure when SG_FFMPEG undefined. 2022-05-01 23:24:42 +01:00
Julian Smith
ac37f734ba simgear/screen/video-encoder*: support for logging timing info for sws_scale(). 2022-05-01 15:18:58 +01:00
Julian Smith
8037a0eb20 simgear/timing/rawprofile.hxx: support for profiling single piece of code. 2022-05-01 15:18:54 +01:00
Julian Smith
294e0b0bb7 simgear/structure/commands.cxx: removed assert that fires if we don't use thread-cpu affinities. 2022-04-30 00:45:23 +01:00
Erik Hofman
12c0166f92 Calculate if the sound source is within the mach cone relateive the the listener and calculate the offset within the mach code for use by the sound configuration file. 2022-04-29 15:07:14 +02:00
Erik Hofman
6719a8e3d5 Add functions to return the squared length of a vector: Comparing two squared values prevents two computionally heavy sqrt calls. 2022-04-25 10:48:07 +02:00
Stuart Buchanan
fa2b5911b7 WS30: Add waterline-start and waterline-end params
Used for coastline mixing.
2022-04-09 16:24:51 +01:00
James Turner
363906828f Reduce log noise for a common message in input 2022-04-06 07:50:36 +01:00
Lars Toenning
b01e8f51f1 Add missing include 2022-03-27 20:07:27 +01:00
Erik Hofman
718b09d7c3 Do not use ShaderVG until it's ready for use 2022-03-25 07:40:51 +01:00
James Turner
2993671fa4 Subsystems: only record timings if enabled
Avoid some overhead in copying std::map<>, in the common case where
subsystem timing reporting is not enabled.
2022-03-24 16:06:09 +00:00
Julian Smith
de0ab92cca simgear/nasal/code.c: fixed conversion of strings to bool.
We need to check IS_OBJ(r) after IS_STR(r) because all strings are also
objects.

For example this fixes a bug where an empty string evaluated as true.
2022-03-20 15:07:13 +00:00
Richard Harrison
3cc7b9a17b DDS-TC: Add origin to CanvasImage loadImage
Method loadImage should set the canvas origin to allow the DDS texture cache to act appropriately (i.e. not include anything from Canvas)
2022-03-17 11:43:46 +01:00
Richard Harrison
9e0ab6e268 DDS-TC : Always exclude all of canvas origin
The assumption is that all images coming from Canvas should be excluded from inclusion into the DDS texture cache.

Previously there was special logic that only excluded transparent images of Canvas origin but this was probably wrong.
2022-03-17 11:42:33 +01:00
Richard Harrison
91eca221f9 Fix Translate axis animation Refs ticket #2706
Due to an error I made in 7ac90850 all AxisObject-based translate animations were inverted.

I think this correctly fixes the animations so that a value of zero is the 'start' vertex of the axis and a value of 1.0 is the 'end' value of the axis.

Start and end are now defined on the lowest x,y,z that aren't equivalent (within 0.01mm)

see: https://sourceforge.net/p/flightgear/codetickets/2706/
2022-03-14 16:58:12 +01:00
Richard Harrison
83eda09558 Remove threaded Nasal garbage collection refs #2674 Nasal corruption:
refs: https://sourceforge.net/p/flightgear/codetickets/2674/

Because disabling threaded GC wouldn't result in exactly the same allocation and GC due to changes I made to the GC as part of the threaded GC work the only safe thing to do is to remove it all.

Once we have figured out if it is the threaded GC causing the problem or not then we will at least know what needs fixing.
2022-03-13 21:37:28 +01:00
Richard Harrison
30736ea057 Use helper method for OSGText alignment 2022-03-10 20:13:25 +01:00
Richard Harrison
92c4ea9f45 Added helper method for OSGText alignment conversion 2022-03-10 15:11:52 +01:00
James Turner
56e3a652f9 Fix ShaderVG compilation on macOS (and others?)
We had a manual change in ShivaVG, to include the shConfig.h file
explicitly, since the sources do not include it themselves. Replicate
this change in our copy of ShaderVG.

Necessary to fix compilation on macOS and likely FreeBSD as well.
2022-03-09 10:43:22 +00:00
James Turner
ddb5e52885 Nasal: extend boolify() to work on containers/objects
Consider non-empty containers and non-nil objects (eg, ghosts) to be
true-like, in boolify(). This makes for more natural testing of return
values.

Since these types previously caused a runtime error, should be backwards
compatible, unless code was relying on the error. This seems improbable,
if it happens in practice, we can revert and find a different solution.
2022-03-09 10:36:58 +00:00
James Turner
47a103f7ea Nasal: add str() helper to force a type to be a string
Calls existing naStringValue internally.
2022-03-09 09:58:37 +00:00
James Turner
6bbf7ed109 Add missing declaration to SpacerItem 2022-03-09 09:58:37 +00:00
James Turner
a6bd613159 Remove log message, now property changes are stable 2022-03-09 09:58:37 +00:00
Erik Hofman
6a32b758af Remove a mistake, GLEW is not required when including the correct headers 2022-02-26 13:24:07 +01:00
James Turner
bb18c59530 Grid: Add row/column stretch implementation
Also add a basic test case for stretch behaviour.
2022-02-26 11:23:21 +00:00
James Turner
6b9575d076 Expat: build on older GLibC versions
getrandom() is only in GLibC >= 2.2.5, and CentOS 7 uses an older
GCC version, so add CMake logic to fallback to /dev/urandom as the
Expat entroy source.
2022-02-25 20:59:20 +00:00
James Turner
7ee427c202 Add GridLayout for Canvas.Layout
Need a grid layout in addition to the existing vbox/hbox layouts,
add a basic one. Still work in progress, minimal test cases pass.
No height-for-width support yet, but row/column spanning and stretch
factors are supported.

Move some functionality from Layout.cxx into BoxLayout.cxx, which
is specific to the one-dimensions layout types.
2022-02-25 16:39:39 +00:00