Commit graph

107 commits

Author SHA1 Message Date
Rémi Verschelde f5836b40d4
doc: Use self-closing tags for return and argument
For the time being we don't support writing a description for those, preferring
having all details in the method's description.

Using self-closing tags saves half the lines, and prevents contributors from
thinking that they should write the argument or return documentation there.

(cherry picked from commit 7adf4cc9b5)
2021-08-03 10:20:19 +02:00
Pedro J. Estébanez 817ffc01e1
Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-16 17:52:31 +02:00
Rémi Verschelde 140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Rémi Verschelde a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde e94161dada
SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an
explicit dependency on the build objects produced by that environment.

So when we update thirdparty code, Godot code using it is not necessarily
rebuilt (I think it is for changed headers, but not for changed .c/.cpp files),
which can lead to an invalid compilation output (linking old Godot .o files
with a newer, potentially ABI breaking version of thirdparty code).

This was only seen as really problematic with bullet updates (leading to
crashes when rebuilding Godot after a bullet update without cleaning .o files),
but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.

(cherry picked from commit c7b53c03ae)
2021-04-29 16:57:00 +02:00
Rémi Verschelde c3272997cd
doc: Update classref headers with 3.4 version 2021-04-26 13:15:29 +02:00
Hugo Locurcio f0d1bedc74
Print a warning when trying to seek in VideoPlayer
Seeking isn't implemented in built-in video formats and can only
be supported in GDNative-provided video formats.

(cherry picked from commit ea46639e22)
2021-04-20 20:16:42 +02:00
Rémi Verschelde 1aba997d75
doc: Sync classref with 3.3 version bump 2021-03-23 13:40:34 +01:00
Rémi Verschelde 49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Marcel Admiraal e21adf2bc6 Don't handle BaseException in build scripts 2020-12-12 10:10:23 +00:00
Hugo Locurcio 922136b30d
Document that WebM videos don't support the alpha channel
(cherry picked from commit 1a616726cf)
2020-11-26 09:38:46 +01:00
Hugo Locurcio 92a85b4445
Improve documentation about VideoPlayer video formats
This closes https://github.com/godotengine/godot-docs/issues/4021.

(cherry picked from commit 1efe57848a)
2020-09-24 14:43:11 +02:00
bruvzg 43888ebfaf
[macOS, 3.2] Add support for the Apple Silicon (ARM64) build target. 2020-06-29 14:43:29 +03:00
Rémi Verschelde 7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Rajat Goswami 19e71f94d8 Adding missing include guards to header files identified by LGTM.
This addresses the issue godotengine/godot#37143

(cherry picked from commit 2ecf928ae3)
2020-03-25 11:38:54 +01:00
Rémi Verschelde ac63e5d613 Workaround WebM playback bug after AudioServer latency fixes
af9bb0ea15 fixed AudioServer's
`get_output_delay()` (which used to always return 0) while renaming it
to `get_output_latency()`. It now returns the latency from the
AudioDriver, which can be non-0.

While this was a clear bugfix, it broke playback for WebM files without
audio track. It seems like the playback code, even though it queried
the output delay to calculate a time compensation, was designed to work
even though the delay value was actually bogus. Now that it's correct,
it's not working.

As a workaround we comment out uses of the output latency, restoring
the behavior of Godot 3.1.

This code should still be reviewed by someone more versed in video
playback and fixed to properly account for the non-0 driver latency.

Fixes #35760.

(cherry picked from commit da411d1625)
2020-02-14 16:02:34 +01:00
Rémi Verschelde 2d20fc39aa doc: Drop unused 'category' property from header
We already removed it from the online docs with #35132.

Currently it can only be "Built-In Types" (Variant types) or "Core"
(everything else), which is of limited use.

We might also want to consider dropping it from `ClassDB` altogether
in Godot 4.0.
2020-01-26 16:02:39 +01:00
Rémi Verschelde bb6c0d3e8b doc: Complete documentation for VideoStreams
Also quick clean up of the matching C++ files.
2020-01-26 11:29:07 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Rafał Mikrut 7dda9309f9 Memory leak and crash fixes 2019-11-10 09:49:13 +01:00
SeleckyErik 61bda112bd Refactor VideoPlayer and VideoStream
VideoStream:
- Fix const correctenss

VideoPlayer:
- Remove unused member variable last_frame
- Move _mix_audios function definition to source file
- Fix function parameter naming to match p_ convention
- Fix const correctness
- Add null checking
2019-10-24 01:35:47 +01:00
Robin Hübner 8aeade74db Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in rest of 'modules/' 2019-08-12 10:15:54 +02:00
Rémi Verschelde 5dae2ea777 SCons: Enable C++11 on the whole codebase
**Important:** This does not mean *yet* that C++11 features should be used
in contributions to Godot's codebase.

For now this change is done solely for feature branches working on Vulkan
support and GDScript typed instruction sets for Godot 4.0, which will both
use C++11 features and are based on the master branch.

The plan is to start porting the codebase to C++11 after Godot 3.2 is
released, following upcoming guidelines on the subset of new features that
should be used, and when/how to use them.

We will advertise clearly when C++11 contributions are open, especially
once we start a coordinated effort to port Godot's massive codebase. In the
meantime, please bear with us and good ol' C++03. :)
2019-07-22 17:17:30 +02:00
Rémi Verschelde b0d41847ed SCons: Use CPPDEFINES instead of CPPFLAGS for pre-processor defines
It's the recommended way to set those, and is more portable
(automatically prepends -D for GCC/Clang and /D for MSVC).

We still use CPPFLAGS for some pre-processor flags which are not
defines.
2019-07-03 09:59:04 +02:00
Rémi Verschelde d61bce1b75
Merge pull request #29910 from m4gr3d/dev_deprecate_armv6
Deprecate support for Android armv6 architecture
2019-06-20 10:22:23 +02:00
fhuya f7200d6960 Deprecate armv6 support for Android 2019-06-19 12:05:58 -07:00
JohnJLight 38d3bfe971 Made use of semicolons more consitent, fixed formatting 2019-06-19 15:24:31 +02:00
Rémi Verschelde d6176db271 Unexpose subclasses of ResourceFormatLoader and -Saver
ResourceFormatLoader and ResourceFormatSaver are meant to be overridden
to add support for different formats in ResourceLoader and ResourceSaver.
Those should be exposed as they can be overridden in plugins.

On the other hand, all predefined subclasses of those two base classes
are only meant to register support for new file and resource types, but
should not and cannot be used directly from script, so they should not
be exposed.

Also unexposed ResourceImporterOGGVorbis (and thus its base class
ResourceImporter) which are editor-only.
2019-06-18 17:56:23 +02:00
qarmin 8245db869f Small fixes to unrechable code, possibly overflows, using NULL pointers 2019-06-03 21:52:50 +02:00
Rémi Verschelde a7f00f3bac
Merge pull request #28530 from akien-mga/scons-prepend-cpppath
SCons: Always use env.Prepend for CPPPATH
2019-04-30 18:23:38 +02:00
Rémi Verschelde 9da3d736ad Fix sign-compare error from #26051 2019-04-30 14:12:46 +02:00
Rémi Verschelde 12cc760538
Merge pull request #26051 from 20kdc/videofix
webm/theora/yuv2rgb/libsimplewebm: Fix colour issues I could find.
2019-04-30 13:38:44 +02:00
Rémi Verschelde d52b70fb5e SCons: Always use env.Prepend for CPPPATH
Include paths are processed from left to right, so we use Prepend to
ensure that paths to bundled thirdparty files will have precedence over
system paths (e.g. `/usr/include` should have lowest priority).
2019-04-30 13:12:06 +02:00
Juan Linietsky af9bb0ea15 Clean up latency related functions 2019-04-27 12:23:05 -03:00
Rémi Verschelde c2a669a9f0 SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGS
Many contributors (me included) did not fully understand what CCFLAGS,
CXXFLAGS and CPPFLAGS refer to exactly, and were thus not using them
in the way they are intended to be.

As per the SCons manual: https://www.scons.org/doc/HTML/scons-user/apa.html

- CCFLAGS: General options that are passed to the C and C++ compilers.
- CFLAGS: General options that are passed to the C compiler (C only;
  not C++).
- CXXFLAGS: General options that are passed to the C++ compiler. By
  default, this includes the value of $CCFLAGS, so that setting
  $CCFLAGS affects both C and C++ compilation.
- CPPFLAGS: User-specified C preprocessor options. These will be
  included in any command that uses the C preprocessor, including not
  just compilation of C and C++ source files [...], but also [...]
  Fortran [...] and [...] assembly language source file[s].

TL;DR: Compiler options go to CCFLAGS, unless they must be restricted
to either C (CFLAGS) or C++ (CXXFLAGS). Preprocessor defines go to
CPPFLAGS.
2019-04-24 16:57:58 +02:00
Rémi Verschelde 6af69f851a doc: Drop unused <demos> tag 2019-04-19 11:03:46 +02:00
Rémi Verschelde 39c868171e doc: Bump version to 3.2 2019-04-01 12:33:56 +02:00
20kdc b1f5cee7d9 webm/theora/yuv2rgb: Fix YUV conversion issues and add BGRP WEBM handling. (Now clang-format friendly.)
This should fix the various issues with colours in Ogg Theora and WEBM playback.
(A reference project is attached to PR #26051, which this commit should be part of.)

This version of the commit, rather than moving x->RGBA handling into libsimplewebm, uses a colourspace field added to libsimplewebm by a PR there.
Thus, the commit that precedes this should be the synchronization & cleanup commit for that.

Also, this version is now clang-format friendly. I hope.
2019-02-21 22:33:43 +00:00
Rémi Verschelde 7f4ee36469 Android: Add support for x86_64 architecture
Like arm64v8, this is only supported by API 21 and later,
so we enforce 21 as min API for x86_64.

Part of #25030.
2019-01-16 11:39:39 +01:00
Rémi Verschelde e5f1d19352 Consistency in resource format saver/loader de-registration
Some used 'is_valid()' checks, others not. Validity is already checked in 'unref()',
and 'remove_resource_format_*()' has an ERR_FAIL condition on 'is_null()' already
(which shouldn't happen since we're only unregistering things that we previously
registered.

Also add missing GDCLASS statement in ResourceFormatLoaderVideoStreamGDNative,
missed in #20552 which was last amended before #19501 was merged.
2019-01-10 12:45:57 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde dcc7f2b54b
Merge pull request #24545 from akien-mga/osxcross-mono
SCons: Allow building Mono module with OSXCross
2018-12-30 15:07:18 +01:00
Rémi Verschelde 95e96947f6 SCons: Drop ios_sim option forcing x86, simulator needs x86_64 2018-12-27 14:11:13 +01:00
Rémi Verschelde d52100f4ff SCons: Allow building Mono module with OSXCross
Improve the test logic to only assume that we're building for macOS
if OSXCROSS_ROOT is defined *and* we requested p=osx.

Supersedes #24480.
2018-12-22 12:36:19 +01:00
Rémi Verschelde 6770357e47 Android: Better identify thirdparty C/C++ code
- The `cpu-features.{c,h}` code was only used by chance by the webm
  (libvpx) code, so I moved it there. It was actually introduced before
  that and wasn't in use, and libvpx just happened to be able to
  compile thanks to it being bundled.
  It could potentially be compiled on the fly from the Android NDK, but
  since we plan to replace the webm module by a GDNative plugin in the
  near future, I went the bundling route.

- `ifaddrs_android.h` is already provided in the Android NDK as
  `ifaddrs.h`, same as on other Unixes. Yet we cannot use it until we
  up the min API level to 24, where `getifaddrs` is first defined.
  I moved the files to `thirdparty/misc` and synced them with upstream
  WebRTC (only indentation changes and removal of `static` qualifiers).

Also removes dropped thirdparty files from COPYRIGHT.txt after changes
in #24105 and #24145.
2018-12-20 13:07:54 +01:00
Marc Gilleron 065e2670af Added basic support for custom resource savers and loaders 2018-12-15 05:34:53 +00:00
Marc Gilleron c1bba054e6 Don't delete FileAccess when it is null 2018-10-05 20:24:28 +01:00
Rémi Verschelde 3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +02:00
Rémi Verschelde 5adf7aa6b7 SCons: Fix checks for clang in env['CXX']
They would match the whole path instead of only the filename.
2018-09-25 11:15:25 +02:00