Commit Graph

3061 Commits

Author SHA1 Message Date
Sergey Minakov 2bd40b4c9c
[iOS] Nonnegative start index for virtual keyboard range
(cherry picked from commit 275772818d)
2021-04-30 12:07:57 +02:00
Fabio Alessandrelli e4cbf9c58a
[HTML5] Fix build for recent emscripten versions.
Library suffix should be `.a`, the `EXTRA_` in
`EXTRA_EXPORTED_RUNTIME_METHODS` is deprecated.

(cherry picked from commit b0f6dec02e)
2021-04-30 12:07:04 +02:00
thebestnom 8dc3d5eb7a
[Android] fix generateDevTemplate
(cherry picked from commit 0477256793)
2021-04-30 12:06:39 +02:00
thebestnom 31bc9d859b
[Android] Allow to build dev template with symbols
(cherry picked from commit fd7141fc03)
2021-04-30 12:06:34 +02:00
Rémi Verschelde 46a5f3a18e
Android: Upgrade buildTools from 30.0.1 to 30.0.3
It seems 30.0.1 had issues with compatibility with JDK 8 and 11,
which appear to be solved in 30.0.3 as per godotengine/godot-docs#4796.

(cherry picked from commit d88e1f04df)
2021-04-29 13:06:35 +02:00
Rémi Verschelde feac30b96a
Linux: Remove use_static_cpp override on x86_32
After further testing it seems to work fine now when building binaries with GCC 5
on Ubuntu 16.04 (previously we were using GCC 9 on Ubuntu 14.04).

Follow-up to #45629.

(cherry picked from commit aa15ad72ee)
2021-04-27 13:44:28 +02:00
Rémi Verschelde 5e16b10824
Android: Fix get_buffer false positive on empty dest buffer
Follow-up to #46810, this was missed in #47079 when fixing the issue
for other platforms.

Fixes #48135.

(cherry picked from commit a09f3833bd)
2021-04-23 22:02:34 +02:00
Rémi Verschelde 162c78f9dc
Linux: Don't attempt linking embree3 on non-tools, link it for headless too
`tech_debt++`, that's what we get for not taking the time to cleanup all this
and do it right...

Follow-up to #48073 and #48102.

(cherry picked from commit a14b51df92)
2021-04-23 12:34:27 +02:00
Rémi Verschelde aa84787fb4
lightmapper: Disable build if raycast module can't build
We need to propagate the hacky checks from the raycast config to the
lightmapper config, as the failure of a `can_build()` check is not notified to
other modules (which might even be checked further depending on the processing
order in SConstruct).

A more thorough fix would be to change SConstruct to do two loops on modules:
one to check `can_build()` and disable modules which can't build, then another
one to rechecked `can_build()` with the new lineup and do further config.
But there would be more risk for regressions than with this ad hoc hack.

Similar story for the `platform/x11/detect.py` change... oh my eyes :(

(cherry picked from commit a2c68d9da7)
2021-04-22 19:43:12 +02:00
Rémi Verschelde 66625962bf
embree: Allow building against system library on Linux
(cherry picked from commit b266cc2315)
2021-04-22 18:07:35 +02:00
Gromph d964b86249
Fix EditorExportPlugin _export_begin and _export_end functions not being called when exporting UWP
in uwp's version of export.cpp create a ExportNotifier object so that EditorExportPlugin _export_begin and _export_end functions will be called as documentated.

(cherry picked from commit 564ddcde77)
2021-04-20 20:12:53 +02:00
Rémi Verschelde d91c1a60a4
Merge pull request #47954 from m4gr3d/automatically_remove_legacy_storage_attribute
Disable the `requestLegacyExternalStorage` attribute when there are no storage permissions
2021-04-16 17:11:22 +02:00
Fredia Huya-Kouadio bc68872e2d Disable the `requestLegacyExternalStorage` attribute when there are no storage permissions. 2021-04-16 07:26:24 -07:00
Fredia Huya-Kouadio d7e5c8fad5 Fix issue causing export to fail with "Could not unzip temporary unaligned APK" error and improve command output logging. 2021-04-15 13:26:05 -07:00
Sergey Minakov cdd921e908
[iOS] Fix for plugin modified time check
(cherry picked from commit 15630a4931)
2021-04-14 13:29:55 +02:00
Fredia Huya-Kouadio 158c848ac5 Fix custom boot splash image scaling. 2021-04-12 16:39:32 -07:00
Fredia Huya-Kouadio dedeada310 Fix issue causing the response callback to be invoked with the invalid `requestCode`. 2021-04-09 13:38:36 -07:00
Bastiaan Olij abaa032fae
Fixes on android:
- checking for validity of ENV in wrapper classes
- fix for access to JavaVM from threads

(cherry picked from commit b3a43430aa)
2021-04-06 22:02:10 +02:00
Fabio Alessandrelli 00f3807a24 [HTML5] Implement WebGL fallback.
According to project settings and when WebGL2 is not available.
2021-04-06 12:56:45 +02:00
Fabio Alessandrelli f90b24a805
[HTML5] Disable body_size in fetch.
We were using `Content-Length` from the server when `Content-Encoding`
was not set (i.e. response was not compressed).

Sadly, in CORS requests accessing headers is restricted, and while
`Content-Length` is enabled by default, `Content-Encoding` is not.

This results in the impossibility of knowing if the content was
compressed, unless the server explicitly enabled the encoding header
via `Access-Control-Expose-Headers`.

To keep maximum compatibility we must disable `body_size` completely.

(cherry picked from commit 737ed0f66e)
2021-04-05 11:59:38 +02:00
Fabio Alessandrelli 74fd9409d5
[HTML5] Fix WM notifications not being called.
Regression from the library refactoring, binding and not calling is
pretty useless 'o_o.

(cherry picked from commit 01658adb30)
2021-03-29 21:09:19 +02:00
Rémi Verschelde 10fb798883
Merge pull request #47456 from akien-mga/3.x-windows-mingw-aslr
Windows: Disable ASLR protection w/ MinGW, it breaks Mono
2021-03-29 19:06:44 +02:00
Fabio Alessandrelli b402c1cb17
[HTML5] Fix Mono builds (old emcc?)
Promise chaining the emscripten module `then` function breaks it badly,
causing an infinite loop.
I'm unsure about the source of the issue, but most likely at this point
is due to the old emscripten version (I remember very old html5 builds
having issue with promise chaining too).

With this commit, we no longer use the module as a promise, and
instantiate it using `Promise` objects directly for compatibility.

(cherry picked from commit ae3c9345cc)
2021-03-29 19:04:29 +02:00
Rémi Verschelde f7a999c814
Windows: Disable ASLR protection w/ MinGW, it breaks Mono
We might be able to make it work by building Mono itself with
ASLR protection too, but there might still be issues when loading
e.g. GDNative DLLs built without ASLR protection.

In the short term this is not a goal, but we can reconsider later
what is actually needed for ASLR protection to work and keep things
user-friendly.
2021-03-29 14:39:20 +02:00
bruvzg 7447c3b76c
[macOS] Enable code signing by default, use ad-hoc signature if no identity specified.
(cherry picked from commit 09c8e69232)
2021-03-29 14:29:54 +02:00
Hein-Pieter van Braam-Stewart ff3099abcf Fix thread_local, tls, ASLR, and DEP with MingW
This commit changes the way Thread::caller_id works. By moving caller_id
to the .cpp file we make sure that the TLS variable doesn't get
relocated twice causing a crash. Since we build with LTO for release
builds (and everyone should be doing that anyway) there is no extra
overhead from the non-static method. We do do an extra bool check now
there but I don't think this will add much in the way of overhead.

This check cannot be avoided if we still want to be able to cache the
thread ID hash, as we had to move the setter because of limitations of
the WinRT platform. The original workaround for this was in #46813 but
this has some unintended consequences. Specifically; threads that never
create a Thread object will always return 0 in Thread::get_caller_id()
which caused a regression. For instance the editor now freezes when
importing large textures. This PR also addresses that.

Additionally we now enable ASLR support when building with MingW, this
includes a workaround for MingW. MingW refuses to create an appropriate
relocation table if no symbols are exported. So we just export the
various main() functions in godot_windows.cpp.

While ASLR support isn't criticial for Godot, previous versions of Godot
just happened to work with a dynamic base 'by accident' and some users
run Godot this way. After the thread change the .tls section now needs
relocations to make this work. By enabling ASLR at build-time we create
these relocations and people who forced ALSR on previously will now get
a working Godot again.

This fixes #47256 and fixes #47219

This is the 3.x version of this PR. For master a different approach is
possible which I will make in the coming days.
2021-03-25 23:20:12 +01:00
Fabio Alessandrelli 6181452a54
[HTML5] Fix loading when mime-type is missing.
`WebAssembly.instantiateStreaming` requires the mime-type to be
`application/wasm`, but some servers (including most debug servers) do
not provide the content-type header.

This commit forces it via JavaScript, by creating a `Response` object
with the `wasm` content, and explicitly defined `content-type` header.

(cherry picked from commit 778ef4e217)
2021-03-20 23:10:00 +01:00
Fabio Alessandrelli be9b0e0b73
[HTML5] Fix editor version numbering.
Should not write patch version when it's `0`.

(cherry picked from commit 60f2166c27)
2021-03-20 23:08:28 +01:00
Rafał Mikrut 6b6324441f
Allow to not optimize release build
(cherry picked from commit 0b298d201e)
2021-03-20 23:05:13 +01:00
bruvzg 15ff752737
Add "Replace existing signature" to the macOS export (enabled by default).
(cherry picked from commit 9e18fce943)
2021-03-18 22:31:09 +01:00
Fredia Huya-Kouadio 14e7f6fa7c Fix onMainRequestPermissionsResult callback for Android plugins. 2021-03-17 09:30:19 -07:00
Fredia Huya-Kouadio 864f4201b9
Enable `doNotStrip` when doing development/debugging within Android Studio
(cherry picked from commit 4380004176)
2021-03-17 15:17:02 +01:00
Fredia Huya-Kouadio 94df08aae1 Leverage java annotations to simplify the logic used to register the Godot plugin methods. 2021-03-16 01:20:43 -07:00
Alex Hirsch 5a882a659a
Add parameter checkes to FileAccess get_buffer functions
fix #46540

(cherry picked from commit cdf3099c68)
2021-03-14 12:03:22 +01:00
Andrii Doroshenko (Xrayez) 7c7f4602e7
Add `use_asan` option for MSVC to enable AddressSanitizer
Exposes AddressSanitizer support in MSVC compiler. Can be installed via individual
components in the Visual Studio 2019 Installer.

Disabled by default. Compile the engine with `scons use_asan=yes`.

(cherry picked from commit 53901d870b)
2021-03-13 22:10:15 +01:00
Ev1lbl0w a586f9daae
Replace malloc's with Godot's memalloc macro
(cherry picked from commit 838e7d0a8d)
2021-03-13 22:01:27 +01:00
Fabio Alessandrelli 64feaed39b [HTML5] Drag and drop zip in project manager.
With a very nice hack, a new hidden configuration option that delays
dropped files removal at exit.

This still leaks while the project manager is running, but will clear
memory as soon as it exits or load something.
(reminder, dropped files are reguarly removed after the signal is
emitted specifically to avoid leaks, but I prefer hacking the HTML5
config then the project manager).

(cherry picked from commit f1e810adcb)
2021-03-12 10:43:52 +01:00
Fabio Alessandrelli 82b900bdda [HTML5] Properly set canvas size during setup.
It used to be updated before the first iteration, causing the
window/viewport size values to be incorrect during the initialization
phase (e.g. during the first `_ready` notification).

(cherry picked from commit 3f059b90d6)
2021-03-12 10:13:08 +01:00
Fabio Alessandrelli 4b38aefd33 [HTML5] Opt-in virtual keyboard support.
Added as an export option "Experimental Virtual Keyboard".
There is no zoom, so text/line edit must be in the top part of the
screen, or it will get hidden by the virtual keyboard.
UTF8/Latin-1 only (I think regular UTF-8 should work out of the box in
4.0 but I can't test it).
It uses an hidden textarea or input, based on the multiline variable,
and only gets activated if the device has a touchscreen.
This could cause problems on devices with both touchscreen and a real
keyboard (although input should still work in general with some minor
focus issues). I'm thinking of a system to detect the first physical
keystroke and disable it in case, but it might do more harm then good,
so it must be well thought.
2021-03-11 20:58:09 +01:00
Fabio Alessandrelli 758daab3ad [HTML5] Respect allow_hidpi option during setup
The option was forced to `true` before, unlike on other platforms.
2021-03-08 23:35:10 +01:00
Rémi Verschelde fd5966af64
Merge pull request #46797 from Faless/js/3.x_pwa_simple
[3.2][HTML5] Add PWA support to the editor page.
2021-03-08 17:29:57 +01:00
Fabio Alessandrelli d942d553ef [HTML5] Add PWA support to the editor page.
This allows to install it as an app, and provide offline support (after
the first run).
Practically, this boils down to adding a JSON file as a manifest, an
offline page to be displayed when the cached files are not avaialble,
and a JS file to cache resources and return them.

The reason for the "first run requirements" is that some browsers, will
emit an "install" by just visiting the page (to see if the JS code is
compatibile), and we do not want to force casual visitors to just
download the 10 MiB+ compressed editor WebAssembly file without pressing
the start button.

Special thanks to Hugo Locurcio (Calinou) for the initial work.
2021-03-08 17:06:41 +01:00
Fabio Alessandrelli 9028b7a095 [HTML5] Catch audio worklet errors on disconnect.
Which could happen if the worklet was not fully loaded, or the audio
context had already aborted.
2021-03-08 17:06:41 +01:00
Rémi Verschelde 03dda90ddd Linux: Fix PRIME detection on Steam
To avoid trying to do PRIME detection on fake `libGL.so` as used by e.g.
Renderdoc or Primus, we skip detection if there's a `libGL.so` in
`LD_LIBRARY_PATH`... and our luck is that Steam defines it and includes
system paths too, thus the actual system `libGL`... 🤦

So if we detect Steam, we skip this check.

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>

(cherry picked from commit 562b1cd2cda2098e62c7501dae87393def99c23a)
2021-03-08 16:03:24 +01:00
Fabio Alessandrelli c01f35de12 [HTML5] Replace XMLHttpRequest with Fetch.
This has some advantages:
- Streaming/chunked response support.
- Broader headers support.
2021-03-06 11:44:43 +01:00
Fabio Alessandrelli 751a6f9a63 [HTML5] Rename heapCopy to heapSlice.
New heapCopy function copies a TypedArray to the heap.
2021-03-05 17:32:17 +01:00
Fabio Alessandrelli 41c64533b0 [HTML5] Export process writes sizes in template.
This allow the loading bar to be much more reliable, even in cases where
realible stream loading status is not detectable (server-side
compression, chunked encoding).
2021-03-05 17:32:17 +01:00
Fabio Alessandrelli f64ec5f1ad [HTML5] Preloader fetch, streaming instantiation. 2021-03-05 17:32:17 +01:00
Shane Liesegang 4d06a5c2b0 Mono/macOS: Separate data dir into frameworks and resources for codesigning
Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
(cherry picked from commit 42eb09ddcc)
2021-03-04 12:21:17 +01:00
Jordan Schidlowsky ced5f5398a add msan sanitizer option for linus/bsd, lsan option for osx
(cherry picked from commit da35cd2f00)
2021-03-04 11:33:35 +01:00
bruvzg 1c27d4a73d
[macOS] Add entitlements config and export template `dylib` signing to the export. 2021-03-03 12:40:44 +02:00
Ev1lbl0w be4e34b495
Prevent invalid values when resizing window (X11) 2021-03-01 12:22:16 +00:00
Pedro Rodrigues 66da113237 Fix out of bounds array access on OS_X11 code
The problem happened on methods `get_screen_position`, `get_screen_size`
and `set_current_screen` when they were passed a negative screen value.

Fixes:
- #46184
- #46185
- #46186
2021-02-28 17:20:04 +00:00
Rémi Verschelde 8385a0d8ad
Merge pull request #46458 from m4gr3d/fix_invalid_missing_templates_error
[3.2] Fix invalid missing template error when the Android build template is not installed
2021-02-27 16:52:41 +01:00
Fredia Huya-Kouadio 92d3287648 Fix invalid missing template error when the Android build template is not installed. 2021-02-26 12:28:19 -08:00
Fredia Huya-Kouadio c5fb32d594 Update the logic to load Godot Android plugins packaged into the binary.
The previous logic had the side effect of imposing a limit of one plugin per `aar` binary. The update lifts that restriction.
2021-02-26 09:09:40 -08:00
Fabio Alessandrelli 43e429fa93 [HTML5] Add jsdoc2rst tool.
A template for `jsdoc` that generat the HTML5 public classref.

The script can be run via `npm run docs` to print to stdout.

You can dry run via `npm run docs -- --d dry-run` or write to file via
`npm run docs -- -d /path/to/file.rst`

Also update Makefile in `doc/` and add dry run test to CI.

(cherry picked from commit 472482013e)
2021-02-26 15:35:45 +01:00
Fabio Alessandrelli 681c10af45 [HTML5] Document Engine and EngineConfig (jsdoc).
This commit also removes the utils.js engine file, moving some of it's
content to config.js and some to engine.js .

(cherry picked from commit 018ee5a4dc)
2021-02-26 15:35:38 +01:00
Fabio Alessandrelli e3664e971b [HTML5] Make editor HTML build tag scons4-proof.
We used to have it like `$GODOT_VERSION` which caused inconsistencies
between different scons versions when substituting it.
It's now `@GODOT_VERSION@`, which is safe on both scons3 and scons4.

(cherry picked from commit 4404eb57e4)
2021-02-26 15:22:51 +01:00
PouleyKetchoupp ea1d4256a4 Added LocalVector to Visual Studio debugger visualization
(cherry picked from commit 27d5e1fff0)
2021-02-25 15:14:32 +01:00
Fredia Huya-Kouadio 65eb5fdf1e Update the initialization timeline for the Godot fragment to be more consistent with the previous activity based timeline.
(cherry picked from commit 3ce7678374)
2021-02-25 15:14:32 +01:00
Fredia Huya-Kouadio 9fb5215db5 Add logic to record the version of the Godot engine for the Android platform.
(cherry picked from commit bc5120eb97)
2021-02-25 15:14:32 +01:00
Rémi Verschelde 693a27e9dd
Merge pull request #46336 from m4gr3d/fix_android_resources_inclusion
[3.2] Update the filtering logic to properly handle directories with `.gdignore` files
2021-02-25 14:15:19 +01:00
Hein-Pieter van Braam-Stewart 5f71fad6b6 Allow static linking with libatomic using clang
When using use_static_cpp we want to statically link with atomic as well
to make sure we don't incur any new runtime dependencies.

Scons doesn't quite support this so we do this little trick.
2021-02-23 14:48:51 +01:00
Fredia Huya-Kouadio 48108444f1 Update the filtering logic to properly handle directories with `.gdignore` files. 2021-02-22 20:18:56 -08:00
Hein-Pieter van Braam-Stewart 5ff172e34d Use -latomic when using clang (server platform)
version of c9b3a00a63 for the server
platform

(cherry picked from commit 6a146d405c)
2021-02-22 21:39:22 +01:00
Pedro J. Estébanez c75b3fedc4 Fix build error in UWP 2021-02-22 17:57:27 +01:00
Rémi Verschelde d1f023c35b SCons: Fix UWP build after #45618 2021-02-22 15:30:48 +01:00
Hein-Pieter van Braam f15f5b4578
Merge pull request #46242 from hpvb/dri-prime-amd
[3.2] Add 'AMD' GPU vendor name to PRIME detector
2021-02-20 17:19:04 +01:00
Hein-Pieter van Braam-Stewart 0cce213f14 Use -latomic when linking whe using clang on Linux
According to the LLVM documentation when using GNU's libstdc++ clang
will not automatically link with -latomic. This is necessary since we
merged c++11 atomics support.

This fixes linking using Clang on Linux
2021-02-20 16:37:00 +01:00
Hein-Pieter van Braam-Stewart 92687b4544 Add 'AMD' GPU vendor name to PRIME detector
Apparently some recent Mesa version also changed AMD's vendor string. In
addition I found a small uninitialized variable that's corrected now.
2021-02-20 02:03:05 +01:00
Rémi Verschelde 0d94bf707f
Merge pull request #46201 from Faless/js/3.x_canvas_size_pr
[3.2] [HTML5] Easier HTML templates, better canvas size handling.
2021-02-19 15:16:59 +01:00
Fabio Alessandrelli 45a67fab35 [HTML5] Better fullscreen, canvas resizing.
Three canvas resize policies:
- `None`: Godot window settings are ignored.
- `Project`: Godot handles the canvas like a native app (resizing it
  when setting the window size).
- `Adaptive`: Canvas size will always adapt to browser window size.

Use `None` if you want to control the canvas size with custom JavaScript
code.
2021-02-19 05:13:44 +01:00
Fabio Alessandrelli 1eef8a318b [HTML5] Easier HTML templates, better deinit/cleanup. 2021-02-19 05:13:44 +01:00
Hein-Pieter van Braam 220f24c191
Merge pull request #45618 from RandomShaper/modernize_mt_3.2
Backport of all the multi-threading modernization (3.2)
2021-02-18 20:47:24 +01:00
Fredia Huya-Kouadio ca6e1c1c45
Override `ANDROID_NDK_ROOT` based on the project ndk version.
This helps resolve issues where the project ndk version differs from the one pointed by the `ANDROID_NDK_ROOT` environment variable (if it exists).

(cherry picked from commit edeca16fb6)
2021-02-18 14:59:10 +01:00
Pedro J. Estébanez 4485b43a57 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 12:23:25 +01:00
Fredia Huya-Kouadio ef9d945e16 Disable engine splash logic on Android; this is now handled by the Android theme api.
In addition, add support for scaling and applying filter to the splash screen on Android.
One limitation of the api being used is that the splash screen aspect ratio is not maintained when it's scaled up.
2021-02-18 03:17:58 -08:00
Pedro J. Estébanez 6d89f675b1 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez 8f6a636ae7 Modernize Semaphore
- Based on C++11's `mutex` and `condition_variable`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez 4ddcdc031b Modernize Mutex
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez b450036120 Modernize RWLock
- Based on C++14's `shared_time_mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-02-18 11:41:07 +01:00
Fredia Huya-Kouadio 96a3f01ac5
Add missing `ndkVersion` to the library gradle build config.
(cherry picked from commit 9418197081)
2021-02-18 10:37:59 +01:00
Fredia Huya-Kouadio 1557bc8396
Revert AGP to version 4.0.1 as a workaround to https://issuetracker.google.com/issues/171235570 in version 4.1.x
(cherry picked from commit e5311f3523)
2021-02-18 10:37:28 +01:00
Rémi Verschelde ad7710ae5e
Dynamically load libudev.so.1 on Linux if `udev=yes`
This makes it possibly to run Linux binaries compiled with udev support on
Linux systems which do not provide udev (typically systemd-less distros).

If udev is missing, we fall back to parsing `/dev/input` like when compiled
without udev support (`udev=no`).

Also adding some verbose debug statements to know which method we're using
when debugging Linux joypad issues.

The libudev so wrappers were generated on Mageia 8 with libudev 246.9 using
https://github.com/hpvb/dynload-wrapper:
```
./generate-wrapper.py --include /usr/include/libudev.h --sys-include '<libudev.h>' \
  --soname libudev.so.1 --init-name libudev --omit-prefix gnu_ \
  --output-header libudev-so_wrap.h --output-implementation libudev-so_wrap.c
```

(cherry picked from commits a10c259c1d
and e26a1f807b)

Edit: Updated to version 0.2 of dynload-wrapper to fix symbols clobbering as
done in #46143.
2021-02-18 10:31:31 +01:00
Rémi Verschelde 48b73e4532
Android: Bump NDK version to 21.4.7075529
This is what GitHub Actions now provide and they removed the previous 21.3.6528147.
A bit annoying to have our hand forced this way but it's still 21.x so should be good
to upgrade.

(cherry picked from commit c730da8b20)
2021-02-18 00:36:46 +01:00
Quadtree a81f896ec1
Add cwrap to EXTRA_EXPORTED_RUNTIME_METHODS
(cherry picked from commit d2c34e83b5)
2021-02-18 00:35:57 +01:00
Fredia Huya-Kouadio d559def1a9 Add verbose logging to help with troubleshooting the Android build/export process. 2021-02-17 13:30:01 -08:00
Fabio Alessandrelli 03edba4d75 [HTML5] Implement get_processor_count. 2021-02-17 13:42:26 +01:00
Hein-Pieter van Braam-Stewart 228803e9db Dynamically load libpulse.so.0 and libasound.so.1 on Linux
By generating stubs using https://github.com/hpvb/dynload-wrapper we
can dynamically load libpulse and libasound on systems where it is available.
Both are still a build-time requirement but no longer a run-time dependency.

For maintenance purposes the wrappers should not need to be re-generated
unless we want to bump pulse or asound to an incompatible version. It is
unlikely we will want to do this any time soon.

cherry-pick from 09f82fa6ea
2021-02-17 10:31:52 +01:00
Fredia Huya-Kouadio 64f5a7b8ca Expose GodotPlugin's utility methods used for registration and signal emitting.
This enables creation and use of a plugin like class by composition rather than inheritance.
2021-02-15 15:57:36 -08:00
Rémi Verschelde 40c30adf04
Merge pull request #46034 from bruvzg/ignore_warp_on_mode_change_3
[macOS, 3.2] Ignore mouse move event caused by mouse mode switch.
2021-02-15 11:09:28 +01:00
bruvzg bc04bbbe2a
[macOS] Ignore mouse move event caused by mouse mode switch. 2021-02-15 00:19:47 +02:00
Fabio Alessandrelli b3f78687de [HTML5] Detect screen scale and DPI.
`OS.get_screen_scale` will now return the `window.devicePixelRatio`
value, `OS.get_screen_dpi` uses CSS media queries to find approximate
DPI value for the current display.
`OS.get_screen_size` also return the actual screen size (not the CSS
pixel size).
2021-02-12 12:02:30 +01:00
Rémi Verschelde b2f925ea42
Merge pull request #45889 from Faless/js/3.x_xhr_fix
[3.2] [HTML5] Fix HTTPClient request_raw.
2021-02-11 11:08:14 +01:00
Rémi Verschelde 6f26df58a8
Merge pull request #45884 from Faless/js/3.x_more_handlers
[3.2] [HTML5] Handle contextmenu, webglcontextlost internally.
2021-02-11 10:53:41 +01:00
Fabio Alessandrelli 4086a123b9 [HTML5] Fix HTTPClient request_raw.
Now send data according to the spec, properly handle null data.
Simplify JS code since we are at it.
2021-02-11 09:32:17 +01:00
Fabio Alessandrelli 8c9a503bde [HTML5] Handle contextmenu, webglcontextlost internally.
This way they are automatically cleaned up when the engine exits,
landing a hand to browsers garbage collectors.
2021-02-11 08:00:53 +01:00
Rémi Verschelde 5bec2cf3d4
Merge pull request #45772 from CherokeeLanguage/3.2
[3.2] Fix issue with NVIDIA and axis mapping for joysticks.
2021-02-10 17:04:05 +01:00
Michael Conrad 8777282c40 Fix joystick axis mapping issues with NVIDIA shield. Probably others.
Issues addressed:

a) Axis mappings were including virtual mouse axes on NVIDIA Shield TV.

The virtual mouse axes have the same axis numbers as the normal analog stick numbers. This was completely breaking joypad support on NVIDIA Shield TV.

b) Joypads were being tracked in a List with the index in the list being treated as the Godot device id.

If a device were to be removed, any device later in the list would be shifted, potentially causing future events with the shifted joypads to have incorrect IDs according to the Godot engine.

c) Unnecessary events were being sent to the Godot engine.

A check was added (per Joystick) that will prevent sending events for all axes when only a single axis value changed.
A similar check was added for "HATs".

See #45712
2021-02-09 08:33:42 -05:00