Commit graph

1757 commits

Author SHA1 Message Date
Rémi Verschelde
80e66a6214 Improve return value of OS.execute in blocking/non-blocking variants
Initialized the PID to -2, which will be the value returns in blocking-
mode where the PID is not available. (-1 was already taken to signify an
execution failure).

OS::execute will now properly return a non-OK error code when it fails
to execute the target file.

The documentation was rewritten to be very clear about the differences
between blocking and non-blocking mode.

Fixes #19056.

(cherry picked from commit f392650be2)
2018-11-01 11:39:20 +01:00
Fabio Alessandrelli
5262d1bbcc Fix marshalls size checks.
Yesterday, when playing around with my network code, I realized there is
a security issue in decode_variant, at least when decoding PoolArrays.
Basically, the size of the PoolArray is encoded in a uint32_t, when
decoding it, that value is cast to int when comparing if the packet is
actually that size causing numbers with MSB=1 to be interpreted as
negative thus always passing the check. That same value though, is used
as uint32_t again to resize the output vector.  For this reason, sending
a malformed packet with declared type PoolByteArray and size of 2^31(+x)
causes the engine to try to allocate 2+GB of pool memory, causing the
engine to crash.
2018-07-28 21:21:19 +02:00
Ignacio Etcheverry
e7110984f3 Add Dictionary::erase_checked(key) method
Same as erase, but it returns a boolean value indicating whether the pair was erased or not.
This method should be removed during the next compatibility breakage, and 'Dictionary::erase(key)' should be changed to return a boolean.

(cherry picked from commit 2f69e36cef)
2018-07-28 16:06:30 +02:00
Hein-Pieter van Braam
b64850e732 Make _ALWAYS_INLINE_ and _FORCE_INLINE_ equivalent
_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and
non-debug builds. This is a lot faster for Vector in the editor and
while running tests. The reason why this difference used to exist is
because force-inlined methods used to give a bad debugging experience.
After extensive testing with modern compilers this is no longer the
case.
2018-07-27 17:14:22 +02:00
Rémi Verschelde
c709dff1a2 Style: Format code with clang-format 6.0.1
(cherry picked from commit 7c9f7452f4)

Travis: Update style checks to clang-format 6.0.1

(cherry picked from commit 003ac67df1)
2018-07-18 16:37:23 +02:00
Pedro J. Estébanez
59a00c3cdd Fix debugger focus stealing
At least on Windows, the authorization must be given every time, not only at startup.

(cherry picked from commit 2fcbf9dd81)
2018-07-08 15:39:15 +02:00
GagaPete
139185e543 Fix CORS problems due to added headers on JS target
Before this change, missing User-Agent and Accept headers were automatically
added on all platforms. Setting the User-Agent header forces the browser to
do a CORS preflight (see 1) which fails if the HTTP endpoint is not
configured appropriate. It's not neccesary to set either header as the
browser sets them and so this commit disables that functionality on the JS
target.

1: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests
(cherry picked from commit 8a4dccc4ce)
2018-07-08 15:39:15 +02:00
Rhody Lugo
2f3e4c1a7a add NoCache wrapper to Command
(cherry picked from commit 920224a535)
2018-06-22 14:42:14 +02:00
bruvzg
518a691231 Mono: Allow loading mscorlib from resources.
(cherry picked from commit b3ddf12fb1)
2018-06-13 11:57:40 +00:00
Hugo Locurcio
403f7dc35f Change ".." punctuation for "..." in editor strings (#16507)
(cherry picked from commit 1c419531a0)
2018-06-05 21:42:33 +02:00
Alexander Alekseev
8231b3cef8 Vector3::round, Vector2::round & Vector2::ceil methods were added.
Now both structs (Vector2 & Vector3) have round, floor & ceil methods.
(see #18603)

(cherry picked from commit 26963473a9)
2018-06-01 18:08:29 +02:00
Paul Joannon
1d3be8c453 fix API string path
(cherry picked from commit a35c8bbdc7)
2018-05-13 23:03:48 +02:00
Ibrahn Sahir
5f632391ca fix for segfault when using CallBasic in visual script on release build
(cherry picked from commit 95dfa5b96d)
2018-05-13 22:11:08 +02:00
RaphaelHunter
0b9f61c9a6 add condition check in Imgae::create(...)
(cherry picked from commit 63e258cc8f)
2018-05-13 21:59:22 +02:00
Hein-Pieter van Braam
5917063192
Merge pull request #18082 from RandomShaper/improve-gui-touch-3.0
Implement universal translation of touch to mouse (3.0)
2018-05-13 21:30:37 +02:00
Hein-Pieter van Braam
bcb38393a5
Merge pull request #18157 from RandomShaper/improve-uri-utils-3.0
Improve/fix URI utils (3.0)
2018-05-13 21:11:42 +02:00
Max Hilbrunner
0551c5c2cd PCKPacker:pck_start(): Update version
(cherry picked from commit a3aa5ad0d0)
2018-05-01 22:04:08 +02:00
Pedro J. Estébanez
e10a2e5999 Implement universal translation of touch to mouse
Now generating mouse events from touch is optional (on by default) and it's performed by `InputDefault` instead of having each OS abstraction doing it. (*)

The translation algorithm waits for a touch index to be pressed and tracks it translating its events to mouse events until it is raised, while ignoring other pointers.

Furthermore, to avoid an stuck "touch mouse", since not all platforms may report touches raised when the window is unfocused, it checks if touches are still down by the time it's focused again and if so it resets the state of the emulated mouse.

*: In the case of Windows, since it already provides touch-to-mouse translation by itself, "echo" mouse events are filtered out to have it working like the rest.

On X11 a little hack has been needed to avoid a case of a spurious mouse motion event that is generated during touch interaction.

Plus: Improve/fix tracking of current mouse position.
2018-04-30 19:04:35 +02:00
Hein-Pieter van Braam
3ee4d6af2e Hand-merge API hash fixes #18514
This hasn't made it into master yet but is important for mono support.
If this turns out to be the wrong call we'll revert and merge whatever
next version of this becomes available.
2018-04-29 20:44:48 +02:00
Marcelo Fernandez
e7837828f6 Improved error checking at EditorExportPlatformPC::export_project
(cherry picked from commit 0876502f72)
2018-04-29 15:12:21 +02:00
Marcelo Fernandez
272fb05270 Added File.get_path and File.get_path_absolute functions
(cherry picked from commit a4e64c5454)
2018-04-29 15:09:29 +02:00
George Marques
3acd6fb728 Fix names of Variant operators
(cherry picked from commit fefee533ae)
2018-04-28 22:56:33 +02:00
Bojidar Marinov
44f4c8e745 Fix crash resulting from bad month check in core_bind.cpp
Also, make it clear that day is 0-based. This might cause very slight differcies in existing games.
Fixes #18221

(cherry picked from commit 4b9cf93338)
2018-04-28 22:53:02 +02:00
Crazy-P
e5a17617e6 Resolves Inccorect Quaternion Conversion
Fixes https://github.com/godotengine/godot/issues/18025

(cherry picked from commit ae7a9df292)
2018-04-28 20:29:40 +02:00
Pedro J. Estébanez
c07d588e80 Fix listing files inside directory in pack file
When adding a directory path to the inventory of the pack, an empty file name was being added to the file list. That made `Directory.get_ntext()` signal end-of-list too early so that files in a subdirectory were missed.

Fixes #15801.
Helps with #16798.

(cherry picked from commit 536611704a)
2018-04-28 17:35:48 +02:00
robfram
141e389c3f Fix non working action names containing whitespaces
Now the action name is quoted if it contains spaces. Also, quotation
mark (") is added to the forbidden character list for action names, as
it was also a bug.

Fix #17322

(cherry picked from commit ea94a82596)
2018-04-28 17:04:20 +02:00
Andreas Haas
6472d8c7d4 Mono: Avoid invalid class names.
Disallow reserved keywords as class names and prefix base class with the Godot
namespace if it's the same as the class name.

Fixes #12483

(cherry picked from commit 700d07cf7c)
2018-04-15 00:48:11 +02:00
Ruslan Mustakov
99cf2ffb19 iPhone X support and iOS-related fixes
Starting from April 2018 Apple no longer accepts apps that do not
support iPhone X. For games this mainly means respecting the safe area,
unobstructed by notch and virtual home button. UI controls must be
placed within the safe area so that users can interact with them.

This commit:

- Adds OS::get_window_safe_area method that returns unobscured area of
  the window, where interactive controls should be rendered.

- Reorganizes how launch screens are exported - the previous way was
  incorrect and modern iPhones did not pick up the correct screens and
  because of that used a non-native resolution to render the game.

- Adds launch screen options for iPhone X.

- Makes launch screens optional in the export template. If not
  specified, a white screen will be used.

- Adds App Store icon (1024x1024) export option as it now has to be
  bundled with the app instead of being provided in iTunes Connect.

- Fixes crash when launching games in iOS Simulator. It happened because
  controllerWasConnected callback came before the engine was
  initialized. Now in such case the controllers will be queued up and
  registered after initialization is done.

- Fixes issue with the virtual keyboard where for some reason
  autocorrection panel would intersect with the keyboard itself and not
  allow you to use the top row of the keyboard. This is fixed by
  disabling autocorrection altogether.

Closes #17358. Fixes #17428. Fixes #17331.

(cherry picked from commit 1d9a3a9b1c)
2018-04-14 20:17:47 +02:00
Pedro J. Estébanez
1c25e50490 Add new window setting: always on top
Implemented for Windows and Linux.

(cherry picked from commit ee2c31d306)
2018-04-14 19:03:53 +02:00
Pedro J. Estébanez
a9ec1e3913 Fix buggy http-encoding
(cherry picked from commit 1fc85b87bd)

The original commit's message said "percent-encoding" because it was fixing the same code under a different method name. That rename was reverted but the fix was and is still relevant.
2018-04-12 21:22:46 +02:00
Pedro J. Estébanez
46101928bd Enhance HTTPClient.query_string_from_dict()
(cherry picked from commit 8d8e9d54c8)
2018-04-12 21:20:10 +02:00
Bojidar Marinov
607884139c Fix a potential bug hinted by clang
(cherry picked from commit 4d81e8afe6)
2018-03-29 00:27:46 +02:00
Marcelo Fernandez
814b610ed3 Fix for clang warning at distance_to
(cherry picked from commit bbd21c2203)
2018-03-29 00:15:24 +02:00
Andrew Dunai
683511310e Fix garbage in string padding.
(cherry picked from commit 0269e366f1)
2018-03-28 23:51:31 +02:00
Pedro J. Estébanez
8da76f3bb8 Fix wrong SSL handshake
The name of the remote host is passed to mbed TLS in all cases so the client hello message is correctly formed.

(cherry picked from commit 602da6fa4f)
2018-03-28 23:49:00 +02:00
Hein-Pieter van Braam
675899a521 Fix various valgrind reported uninitialized variable uses
(cherry picked from commit d702d7b335)
2018-03-01 21:06:31 +01:00
Nicolas Silva
9c27e4d885 Allow degenerate triangles in polygon triangulation when necessary.
(cherry picked from commit e73266a51c)
2018-03-01 20:18:08 +01:00
Poommetee Ketson
17408bea9c (Magnify|Pan)Gesture: implement as_text
(cherry picked from commit 67e20dc2b6)
2018-02-27 17:52:18 +01:00
Ignacio Etcheverry
dde14e15c6 Mono: Better versioning and gracefully unloading of Godot API assemblies
(cherry picked from commit f37090ccf4)
2018-02-26 22:36:03 +01:00
Rémi Verschelde
d79a7a2773 Refactor version macros and fix related bugs
The previous logic with VERSION_MKSTRING was a bit unwieldy, so there were
several places hardcoding their own variant of the version string, potentially
with bugs (e.g. forgetting the patch number when defined).

The new logic defines:

- VERSION_BRANCH, the main 'major.minor' version (e.g. 3.1)
- VERSION_NUMBER, which can be 'major.minor' or 'major.minor.patch',
  depending on whether the latter is defined (e.g. 3.1.4)
- VERSION_FULL_CONFIG, which contains the version status (e.g. stable)
  and the module-specific suffix (e.g. mono)
- VERSION_FULL_BUILD, same as above but with build/reference name
  (e.g. official, custom_build, mageia, etc.)
  Note: Slight change here, as the previous format had the build name
  *before* the module-specific suffix; now it's after
- VERSION_FULL_NAME, same as before, so VERSION_FULL_BUILD prefixed
  with "Godot v" for readability

Bugs fixed thanks to that:

- Export templates version matching now properly takes VERSION_PATCH
  into account by relying on VERSION_FULL_CONFIG.
- ClassDB hash no longer takes the build name into account, but limits
  itself to VERSION_FULL_CONFIG (build name is cosmetic, not relevant
  for the API hash).
- Docs XML no longer hardcode the VERSION_STATUS, this was annoying.
- Small cleanup in Windows .rc file thanks to new macros.

(cherry picked from commit 23ebae01dc)
2018-02-24 01:34:34 +01:00
Artem Varaksa
eacd66e784 Clean up some bad words from code comments
(cherry picked from commit d35e486228)
2018-02-22 12:22:41 +01:00
Rémi Verschelde
f04cd405ac Fix loading project.binary from PCK file
Regression introduced in #16825.
My logic was correct, but not the error code I was expecting.
The error reporting in FileAccess likely needs a review too.

(cherry picked from commit 57d562b394)
2018-02-22 12:19:43 +01:00
Rémi Verschelde
f55b376d78 Improve error reporting of ProjectSettings::setup()
And use it to better report errors in the console and project manager
when a project.godot file is corrupted.

Fixes #14963.

(cherry picked from commit 7839076f95)
2018-02-22 12:19:28 +01:00
luz.paz
751806b5c7 Fix typos with codespell
Found via `codespell -q 3 --skip="./thirdparty,./editor/translations" -I ../godot-word-whitelist.txt`
Whitelist consists of:
```
ang
doubleclick
lod
nd
que
te
unselect
```

(cherry picked from commit 612ab4bbc6)
2018-02-22 12:17:06 +01:00
Poommetee Ketson
40018e995c Color:fix setting V switch S to old V value
(cherry picked from commit f4f92b55e1)
2018-02-22 12:07:07 +01:00
hungrymonkey
245c11be08 Change function signature from float to double to match type get_doubleCloses #16160
(cherry picked from commit d2f1c87063)
2018-02-21 23:59:15 +01:00
Hein-Pieter van Braam
99efa7ce62 Revert "Fix wrong return type of xform functions"
As this will change bindings API this will have to wait for 3.1

This reverts commit 187c40d64d.
2018-02-21 23:47:04 +01:00
Rémi Verschelde
57f707f951 Add locale renames for Hebrew and Indonesian on Windows
Windows does not fully respect ISO 639-1 like other systems,
so we have to override its locale values for those languages.

Also added comments to document the locale provenance.

(cherry picked from commit 0c7bed45c4)
2018-02-19 22:27:19 +01:00
Marcelo Fernandez
150423203b Added OS::center_window to center the window precisely on desktop platforms
(cherry picked from commit ea1d726a46)
2018-02-19 22:14:05 +01:00
Nicolas Silva
a0e59a7259 Fix polygon triangulation failure.
The ear clipping algorithm used to triangulate polygons has a slightly too conservative point-in-triangle test which can, in some configurations prevent it from finding a possible tessellation. Relaxing the test by considering that points exactly on edges don't belong the triangle fixes the issue. Changing the semantic of the test is safe because no other code makes use of it. A more detailed explanation can be found in issue #16395.

Fixes #16395.

(cherry picked from commit 91215e1919)
2018-02-19 22:13:46 +01:00