Commit graph

366 commits

Author SHA1 Message Date
Pedro J. Estébanez
32a9227f5b Robustify multi-threading primitives 2023-02-17 19:16:10 +01:00
Hugo Locurcio
badcfa2523
Expose OS.read_string_from_stdin() to the scripting API
This can be used in scripts to read user input in a blocking manner.

This also removes the unused `block` argument, which is always `true`.
2023-01-16 11:39:53 +01:00
Rémi Verschelde
1426cd3b3a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".

Backported from #70885.
2023-01-10 15:26:54 +01:00
Hugo Locurcio
76a14cfd02
Expose the "restart on exit" OS functionality
This can be used to restart a project with specific command line arguments
applied. This can work in tandem with `OS.get_cmdline_args()` to restart
with the same command line arguments as used to originally run the project.

Example use cases:

- Restart to apply an user setting change that requires a restart to work.
- Restart with a Godot command line argument to change the video driver,
  audio driver, etc.
2022-09-20 17:27:46 +02:00
Rémi Verschelde
0bed7ea63f
Merge pull request #61316 from bruvzg/tts_3x
[3.x] Backport text-to-speech support.
2022-08-05 23:45:51 +02:00
Rémi Verschelde
14c9325b5d
Merge pull request #62408 from Razoric480/raz/fix-no-cache
[3.x] Fix nested resources being cached if no-cache argument used
2022-08-05 23:43:54 +02:00
Rémi Verschelde
26762a71b6
Merge pull request #58537 from winterpixelgames/feature/virtual-keyboard-types-3.x 2022-08-05 19:37:13 +02:00
Rémi Verschelde
751b16a285 File: Re-add support to skip CR (\r) in File::get_as_text
This was removed in #63481, and we confirmed that it's better like this,
but we add back the possibility to strip CR as an option, to optionally
restore the previous behavior.

For performance this is done directly in `String::parse_utf8`.

Also fixes Android `FileAccess::get_line()` as this one _should_ strip CR.

Supersedes #63717.

(cherry picked from commit 1418f97c70)
2022-08-01 00:40:55 +02:00
Fredia Huya-Kouadio
fc2c202312 Address remaining scoped storage regressions
- Accelerate common path used to check the storage scope for a given path
- Update the logic for the `get_as_text()` method - previous logic loads the content of a text file one byte at a time
2022-07-26 07:42:49 -07:00
Francois Belair
2ceb93bbef Fix custom res caching sub-res even if no-cache
Fixes #59686, fixes #59752
2022-07-13 11:18:26 -04:00
Brian Semrau
ce24b48e50 Add support for multiple virtual keyboard types 2022-07-07 14:22:28 -04:00
bruvzg
6489fe890e
Backport text-to-speech support. 2022-07-01 11:04:50 +03:00
Haoyu Qiu
f740b4f481 Check thread func in base scripts for argument info 2022-06-27 11:24:04 +08:00
mdavisprog
53fb0440d3 Add OS::is_process_running function.
Adds the is_process_running function to the native OS class and exposes it to script.

This is implemented on Windows and Unix platforms. A stub is provided for other platforms that do not support this function.

Documentation is updated to reflect new API function.

(cherry picked from commit f3c1232c59)
2022-05-05 15:02:46 +02:00
Rémi Verschelde
d8e702b010
Merge pull request #60552 from madmiraal/implement-3466-3.x
[3.x] Add a method for obtaining display cutouts on Android
2022-05-02 07:58:05 +02:00
kobewi
b7336524f2 Expose move_to_trash()
(cherry picked from commit b80e52f048)
2022-04-27 12:41:01 +02:00
Marcel Admiraal
ec2270b88f Add a method for obtaining display cutouts on Android 2022-04-26 13:52:33 +02:00
Haoyu Qiu
8f0f98ffab Bind Semaphore.try_wait() 2022-04-25 20:47:09 +08:00
Hugo Locurcio
cec7c908ca
Add get_screen_refresh_rate() to OS
This method can be used to get the refresh rate of a given screen.
It is supported on Windows, macOS, Linux, Android and iOS (but not
HTML5).
2022-03-10 22:10:48 +01:00
Hugo Locurcio
7f9e974a8b
Add an OS.get_processor_name() method
This method can be used to get the CPU model name.
It can be used in conjunction with
`VisualServer.get_video_adapter_name()` and
`VisualServer.get_video_adapter_vendor()` for annotating benchmarks
and automatic graphics quality configuration.
2022-02-16 18:39:02 +01:00
Haoyu Qiu
76297e744d Add OS.has_clipboard() to check clipboard content 2022-01-19 20:19:06 +08:00
Rémi Verschelde
879244c54e
Merge pull request #56015 from bruvzg/phy_code_conv 2022-01-16 11:36:26 +01:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Rémi Verschelde
8a192cd0ab
Merge pull request #55987 from bruvzg/wt🤎3 2022-01-10 16:43:56 +01:00
kobewi
3f0248dc8e Fix method validation in Thread 2022-01-04 14:48:16 +01:00
bruvzg
59085d5051
[Windows] Improve console handling and execute.
Always build with the GUI subsystem.
Redirect stdout and stderr output to the parent process console.
Use CreateProcessW for blocking `execute` calls with piped stdout and stderr (prevent console windows for popping up when used with the GUI subsystem build, and have more consistent behavior with non-blocking calls).
Add `open_console` argument to the `execute` to open a new console window (for both blocking and non-blocking calls).
Remove `interface/editor/hide_console_window` editor setting.
Remove `Toggle System Console` menu option.
Remove `set_console_visible` and `is_console_visible` functions.
2021-12-18 10:13:27 +02:00
bruvzg
b4ec1c5817
Backport: Allow for mapping scancodes to current layout
Co-authored-by: Frixuu <kontakt@lukasz.xyz>
2021-12-17 13:04:47 +02:00
Hugo Locurcio
58296c7e21
Add an OS.crash() method for testing system crash handler
This makes it possible to test the system's crash handler without
having to modify engine code or exploit an engine bug.
2021-12-04 01:40:56 +01:00
Brian Semrau
04846156c3
Expose Thread::get_main_id in core bindings
(cherry picked from commit c558263d84)
2021-11-20 11:48:09 +01:00
Max Hilbrunner
e29126914d
Save all 64 bits of get_ticks_msec() in more cases
(cherry picked from commit 5dc02eb8b0)
2021-10-26 18:23:31 +02:00
Rémi Verschelde
4186c5e757
Merge pull request #53490 from briansemrau/thread-is-alive-3.x
[3.x] [core_bind] Add `Thread::is_alive`
2021-10-12 22:35:26 +02:00
Yuri Sizov
b02c61ddb1 Ignore OS specific values (constants, project settings, properties)
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2021-10-10 23:40:32 +03:00
Brian Semrau
d734bcc289 [core_bind] Add Thread::is_alive 2021-10-06 13:18:40 -04:00
Haoyu Qiu
7be67ee1b7 Fix crash when creating thread 2021-10-03 16:03:41 +08:00
Rémi Verschelde
b4fc24b73f
Implement OS::get_locale_language() helper method
This method extracts the 2 or 3-letter language code from `OS::get_locale()`,
making it easier for users to identify the "main" language code for users
that might have different OS locales due to different OS or region, but
should be matched to the same translation (e.g. "generic" Spanish).

Fixes #40703.

(cherry picked from commit def99c7baf)
2021-09-21 20:33:12 +02:00
Haoyu Qiu
468a2a2a65 Expose enum related methods in ClassDB 2021-09-11 20:33:29 +08:00
kobewi
6eb52b0768
Fix renaming directories
(cherry picked from commit 0dde3e5b59)
2021-08-18 23:19:44 +02:00
ne0fhyk
c88d1608ab Add partial support for Android scoped storage.
This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30.
In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
2021-08-13 11:04:17 -07:00
Pedro J. Estébanez
9aafb22d99
Fix logic to allow default null thread argument
(cherry picked from commit a6303b70a5)
2021-08-12 16:42:16 +02:00
Rémi Verschelde
8db0bd4424
OS: Fix used resource debug prints
These methods were broken by 22419082d9
5 years ago and nobody complained, so maybe they're not so useful...
But at least this should restore them to a working state.

(cherry picked from commit 8c3a6b10a9)
2021-08-06 13:24:02 +02:00
Pedro J. Estébanez
e0f8efcb01
Fix thread start with no user data when target has no default argument
(cherry picked from commit 7ca8051645)
2021-08-03 09:33:25 +02:00
Rémi Verschelde
d3f500cf33
Merge pull request #48390 from lawnjelly/delta_smooth
Add frame delta smoothing option
2021-07-22 12:43:39 +02:00
Andrii Doroshenko (Xrayez)
726111f38f Add Engine.print_error_messages property to disable printing errors
Backports #48359 to 3.x.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-07-20 13:58:07 +03:00
lawnjelly
6914d7c6e0 Add frame delta smoothing option
Frame deltas are currently measured by querying the OS timer each frame. This is subject to random error. Frame delta smoothing instead filters the delta read from the OS by replacing it with the refresh rate delta wherever possible.

This PR also contains code to estimate the refresh rate based on the input deltas, without reading the refresh rate from the host OS.
2021-07-14 08:44:31 +01:00
Faymoon
03f7d707e7
Let thread func have optional parameter
Fixes #38042.

(cherry picked from commit 78ead60372)
2021-07-13 11:40:09 +02:00
Hugo Locurcio
21ad630e11
Expose OS data directory getter methods
This can be used by editor plugins and non-game applications to
store data in the correct directories according to the
XDG Base Directory specification.
2021-06-19 09:28:53 +02:00
Marcel Admiraal
7e03bd1671 Remove duplicate WARN_PRINTS macro 2021-06-18 12:57:59 +01:00
Marcel Admiraal
5a58516231 Remove duplicate ERR_PRINTS macro 2021-06-16 11:56:25 +01:00
Marcel Admiraal
6d63ccba31 Add OS.get_external_data_dir() to get Android external directory 2021-06-10 16:48:37 +01:00
Rémi Verschelde
fd4475f652
OS: Better validation of invalid input for get_unix_time_from_datetime
Default missing keys to Unix time 0 (1970-01-01 at 00:00:00 UTC).
Abort if year <= 0, this is not supported by the current algorithm.

Prevents an infinite loop further down.

Fixes #49022.

(cherry picked from commit 62efa30ed2)
2021-06-01 12:52:18 +02:00