Commit graph

2932 commits

Author SHA1 Message Date
Fabio Alessandrelli
1eef8a318b [HTML5] Easier HTML templates, better deinit/cleanup. 2021-02-19 05:13:44 +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
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
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
Bastiaan Olij
6afb9d327e
Use /Zi and /FS for including debugger symbols on Windows with MSVC
(cherry picked from commit 4946ae16fc)
2021-02-08 22:36:37 +01:00
Rémi Verschelde
42d3d9c345
SCons: Fix debug_symbols tests after switch to BoolVariable
Bug introduced in #45679.

Fixes part of #45816.

(cherry picked from commit 849c090343)

Also removes useless `debug_symbols=full` mode.
2021-02-08 22:36:32 +01:00
Marcel Admiraal
4e833b2e28 Fix used uninitialized warning in os_x11.cpp 2021-02-06 10:43:02 +00:00
Fredia Huya-Kouadio
5886d09521 Improve the logic to compile for Android by automatically detecting and setting up the Android NDK if needed.
(cherry picked from commit eee213e01a)
2021-02-05 13:29:02 +01:00
Sergey Minakov
518ba25fae [iOS] Remove remote notifications code
Using any remote notification method (even indirectly) causes App Store to trigger APNS warning email.

(cherry picked from commit 4fda1ae6b8)
2021-02-05 09:26:09 +01:00
Rémi Verschelde
f3c030aa47 SCons: Add production=yes option to use production defaults
This is meant for users making custom builds to match the options used on
optimized, official builds.

This enables, on the platforms which support them:
- `use_static_cpp=yes` (portable binaries for Linux and Windows)
- `use_lto=yes` (link time optimizations - note: requires a lot of RAM!)
- `debug_symbols=no` (no debug symbols, smaller binaries)

Also abort when using MSVC with `production=yes`, as:
- It cannot optimize the GDScript VM like GCC or Clang do, leading to
  significant performance drops.
- Its LTO support is unreliable, at least used to trigger crashes last
  we tried it extensively.

All options can still be overridden if specified, and the `dev=yes` option
was changed to also support overrides.

(cherry picked from commit db26871210)
2021-02-05 09:26:09 +01:00
Rémi Verschelde
f9bf6fc3f3
Merge pull request #45706 from Faless/js/3.x_editor_preload
[3.2] [HTML5] Better editor persistent folders, automatically open zip import popup
2021-02-04 14:54:04 +01:00
Rémi Verschelde
cdb5ac52f5
Merge pull request #45685 from naithar/feature/extend-plugin-params
[3.2] [iOS] Additional 'linker_flags' plugin parameter
2021-02-03 18:37:47 +01:00
Rémi Verschelde
92859d7b2b
Merge pull request #45693 from naithar/feature/ios-loading_screen-3.2
[3.2] [iOS] Native loading screen implementation
2021-02-03 18:37:06 +01:00
Sergey Minakov
fdec8d726d iOS: Use storyboard as loading screen
If 'Launch Screen' storyboard is present it will be used as loading screen.
2021-02-03 20:01:05 +03:00
Fabio Alessandrelli
2668ca7a8c [HTML5] Make home path persistent in editor.
We used to only persist specific sub-folder of /home/web_user/ when
running the Web Editor. This resulted in bad UX about default project
creation path etc.
This PR makes the whole folder persistent, move the zip preloading to a
different folder (to avoid persisting it), and automatically prompt the
user to import it if present.
2021-02-03 17:18:28 +01:00
Sergey Minakov
309835b917 [iOS] Additional 'linker_flags' plugin parameter 2021-02-03 18:22:17 +03:00
Samuele Zolfanelli
36635c8357 Added atom checks to x11 XChangeProperty and XGetWindowProperty 2021-02-03 16:08:37 +01:00
Fabio Alessandrelli
08efe327b6 [HTML5] Fix mouse_mode and fullscreen detection.
The canvas_id is `#`-prefixed to work with emscripten as a CSS selector.
When comparing to an event target ID (e.g. when checking if the canvas
is fullscreen, or is locking the mouse) we need to skip the first char
(the hash).
2021-02-02 20:03:39 +01:00
Rémi Verschelde
3115ac4b60
Merge pull request #45663 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.4) - 19th batch
2021-02-02 19:19:31 +01:00
Rémi Verschelde
5506143522
Linux: Enable udev support by default
This has been enabled for years in official binaries, and users making custom builds
may end up not enabling it unknowingly, so it's best if we default to the same as
what official builds do.

The original reason for having it opt-in was likely the addition of a dependency on
libudev, but that should be fairly ubiquitous by now.

(cherry picked from commit e8b69fccbe)
2021-02-02 13:30:54 +01:00
Rémi Verschelde
43ab32ae7e
Linux: Build with use_static_cpp=yes by default for x86_64
This enables `-static-libgcc -static-libstdc++` which help make custom Linux
builds more portable (official builds have been using this option for years).

For some obscure reason Ubuntu 18.04 i386 crashes when using the option for
i386 builds, so let's play it safe and enable for x86_64 only for now.

(cherry picked from commit 1ebd66daff)
2021-02-02 13:30:54 +01:00
zaevi
56535539d4
add search extensions for scons' path
(cherry picked from commit befbfecd4d)
2021-02-02 13:02:47 +01:00
Jari Ronkainen
299769a99a
Go through all event devices, not just event[0-32]
There are no guarantees that joypads are in event0-event32
range.  Some devices, such as laptops with detachable keyboards
and wacom can reserve events all the way up to 32.

Some udev rules with e.g. custom controller firmwares may
load the device as /dev/input/eventX, where X is greater than
32.

This patch uses POSIX dirent to enumerate the event devices, so
entries outside 0-32 range are not skipped.

(cherry picked from commit 01c030f9b7)
2021-02-02 13:02:45 +01:00
Sergey Minakov
19d240c8a7 [iOS] Initialize plugins earlier
Initialize iOS plugins before 'Main::setup' call to have access to them in script's '_init' function.
2021-02-01 15:28:14 +03:00
Marcel Admiraal
4616d843ba Don't handle BaseException in JavaScript build script 2021-01-28 19:43:08 +00:00
Rémi Verschelde
c2ea80348c
Revert "[3.2] Add separate simulator flag for iOS build, change main library to xcframework." 2021-01-27 21:53:16 +01:00
Sergey Minakov
d2af815039
[iOS] Rework push notification methods usage
Moved AppDelegate push notifications methods implementation to 'GODOT_ENABLE_PUSH_NOTIFICATIONS'
which can be used in plugins to implement APNS plugins.

(cherry picked from commit 366ce084f4)
2021-01-26 22:11:10 +01:00
Sergey Minakov
7c076fbd0b
[iOS] Fix embedding of plugin libraries
(cherry picked from commit 6d67827f4e)
2021-01-26 17:00:15 +01:00
Sergey Minakov
7689f05786
[iOS] Added support for '.xcframework' in plugins
(cherry picked from commit 01d513f3ca)
2021-01-26 17:00:15 +01:00
Rémi Verschelde
c5a22d7284
Merge pull request #45480 from bruvzg/ios_arm64_sim_3
[3.2] Add separate `simulator` flag for iOS build, change main library to `xcframework`.
2021-01-26 15:20:27 +01:00
Rémi Verschelde
061f87e064
Merge pull request #45336 from naithar/feature/plugins-migration-3.2
[3.2] [iOS] iOS Plugins Migration
2021-01-26 15:06:46 +01:00
bruvzg
389a4bfa59
[3.2] Add separate simulator flag for iOS build, change main library to xcframework format. 2021-01-26 16:00:26 +02:00
Fabio Alessandrelli
f8d7067bf7 [HTML5] Builtin HTTP server disable browsers cache
We don't want browsers to cache our temporary exports (since they will
always differ).
2021-01-25 20:16:44 +01:00