Commit graph

124 commits

Author SHA1 Message Date
Fabio Alessandrelli
781efc26e0 Remove now unused FileAccessBuffered. 2020-12-06 19:37:11 +01:00
reduz
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Ev1lbl0w
0d3a168a53
Fix wrong exit code being returned 2020-10-24 19:16:49 +01:00
Rémi Verschelde
01185acecb
NetBSD: Implement OS_Unix::get_executable_path()
Same implementation as OpenBSD seems to work fine.
2020-09-18 11:54:18 +02:00
Marcel Admiraal
4b3aec50c0 Replace calls to gmtime with gmtime_r and localtime with localtime_r. 2020-09-04 12:22:43 +01:00
bruvzg
d6e3a8a137
[macOS] Fix crash on failed fork. 2020-08-11 17:45:09 +03:00
Emmanuel Leblond
c6de3872f9
Remove OS.get_system_time_secs/get_system_time_msecs and change OS.get_unix_time return type to double 2020-05-31 14:19:31 +02:00
Rémi Verschelde
0ee0fa42e6 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
2020-05-14 21:57:34 +02:00
Rémi Verschelde
07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
lupoDharkael
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Juan Linietsky
a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03:00
Fabio Alessandrelli
b8ddaf9c33 Refactor ScriptDebugger.
EngineDebugger is the new interface to access the debugger.
It tries to be as agnostic as possible on the data that various
subsystems can expose.

It allows 2 types of interactions:

- Profilers:
  A subsystem can register a profiler, assigning it a unique name.
  That name can be used to activate the profiler or add data to it.
  The registered profiler can be composed of up to 3 functions:
    - Toggle: called when the profiler is activated/deactivated.
    - Add: called whenever data is added to the debugger
      (via `EngineDebugger::profiler_add_frame_data`)
    - Tick: called every frame (during idle), receives frame times.

- Captures: (Only relevant in remote debugger for now)
  A subsystem can register a capture, assigning it a unique name.
  When receiving a message, the remote debugger will check if it starts
  with `[prefix]:` and call the associated capture with name `prefix`.

Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new
profiler system.

Port SceneDebugger and RemoteDebugger to the new capture system.
The LocalDebugger also uses the new profiler system for scripts
profiling.
2020-03-08 12:36:39 +01:00
Rémi Verschelde
42595085a5
Merge pull request #36752 from RandomShaper/rework_semaphore
Drop old semaphore implementation
2020-03-05 16:33:45 +01:00
Mateo Dev .59
8a88637705 os: execute parse the command output from utf8 2020-03-03 21:58:50 -03:00
Pedro J. Estébanez
9a3a2b03b8 Drop old semaphore implementation
- Removed platform-specific implementations.
- Now all semaphores are in-object, unless they need to be conditionally created.
- Similarly to `Mutex`, provided a dummy implementation for when `NO_THREADS` is defined.
- Similarly to `Mutex`, methods are made `const` for easy use in such contexts.
- Language bindings updated: `wait()` and `post()` are now `void`.
- Language bindings updated: `try_wait()` added.

Bonus:
- Rewritten the `#ifdef` in `mutex.h` to meet the code style.
2020-03-03 13:20:42 +01:00
Pedro J. Estébanez
18fbdbb456 Reimplement Mutex with C++'s <mutex>
Main:
- It's now implemented thanks to `<mutex>`. No more platform-specific implementations.
- `BinaryMutex` (non-recursive) is added, as an alternative for special cases.
- Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes.
- Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts.
- A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this.
- `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`.
- Thread-safe utilities are therefore simpler now.

Misc.:
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
- Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock).
- `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-26 20:40:10 +01:00
Hugo Locurcio
580b8cc012
Improve the console error logging appearance
This makes secondary information less visually prominent
to improve overall readability.

Various loggers were also tweaked for consistency.
2020-01-19 00:24:17 +01:00
Hugo Locurcio
785af45d8e
Disable colored console output when standard output isn't a TTY
This prevents Godot from writing ANSI escape codes when redirecting
stdout and stderr to a file.
2020-01-04 04:04:08 +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
bruvzg
7b64340eb0
Fix compilation warnings in macOS build, enable warnings=extra werror=yes for macOS CI. 2019-10-24 20:37:56 +03:00
Kanabenki
add91724e6 Fix casting to uint64_t when returning unix system time 2019-10-01 11:44:26 +02:00
Ruslan Mullayanov
b4c927b514 Added an exit code to the blocking mode of OS::execute
Updated documentation accordingly.

Fixes #31881.
2019-09-26 08:12:07 +02:00
qarmin
17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
Braden Bodily
71d71d55b5 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'
Condensed some if and ERR statements. Added dots to end of error messages

Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?),
core/os/memory.cpp,
drivers/png/png_driver_common.cpp,
drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
2019-08-17 12:33:15 +02:00
qarmin
9a77d748c0 Fixes minor issues found by static analyzer 2019-07-07 23:08:51 +02:00
hbina085
f78baa5f93 added a const keyword for a methods that return constant literal... 2019-05-21 02:16:30 -04:00
Juan Linietsky
cd4449e7ab Add FileAccess::set_unix_permissions for Unix platforms 2019-04-07 15:45:30 -03:00
Juan Linietsky
65f3a953de Remove SIGCHILD handle in OS_Unix, interferes with pclose() 2019-04-07 15:45:00 -03:00
Fabio Alessandrelli
0bcf0314f7 Fix jump over uninitialized value in OS Unix/X11 2019-04-09 15:12:55 +02:00
Pedro J. Estébanez
9c3ddf05cb Revert accidental commits
This reverts commit fb37284c02.
This reverts commit 4db0f51b9a.
2019-03-20 21:43:55 +01:00
Pedro J. Estébanez
fb37284c02 Create class for shared memory blocks [wip] 2019-03-20 20:44:43 +01:00
Rémi Verschelde
5fc86026ca Fix typos with codespell
Using codespell 1.14.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
doubleclick
lod
nd
numer
que
te
unselect
EOF
$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-02-13 09:23:29 +01:00
Ignacio Etcheverry
9bd9d21358 Fix OS_Unix::set_environment 2019-02-04 00:44:37 +01:00
Ignacio Etcheverry
41873ffa88 Added set_environment to OS class 2019-02-03 05:38:47 +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
volzhs
84d060c768 Added OS.get_system_time_msecs() 2018-12-20 18:50:50 +09:00
Leon Krause
5c2c47a174 Add proper stubs for OS_JavaScript::execute(), get_process_id(), kill()
Avoids linker warnings and errors about undefined references.
2018-10-29 21:41:59 +01:00
Fabio Alessandrelli
5393e7310d Avoid possible overflow in OS_Unix readlink
Also fix [-Wunused-result]
2018-10-07 12:56:07 +02:00
Marcelo Fernandez
d0a5ac577f Fix OS X get_ticks_usec return value after #22424 2018-09-30 13:06:46 -03:00
Fabio Alessandrelli
460e3376a4 Use monotonic clock for get_ticks_usec
Static _clock_start and _clock_setup function.
Use clock_gettime on Unix, mach_absolute_time on Mac.
2018-09-29 21:54:48 +02:00
Fabio Alessandrelli
01c3c1a07b Properly initialize Winsock on startup
Also fix typo in _get_last_error which caused Winsock connect to fail.
2018-09-13 16:05:47 +02:00
Fabio Alessandrelli
30327872e0 Unify StreamPeerTCP/TCP_Server with NetSocket API 2018-09-12 15:56:20 +02:00
Fabio Alessandrelli
1b99806b47 Unify PacketPeerUDP using NetSocket 2018-09-12 15:56:16 +02:00
Rémi Verschelde
277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Rémi Verschelde
72996df656
Revert "Try closing gracefully before terminating process" 2018-08-27 17:32:43 +02:00
Marcin Zawiejski
ca1c851dbd Try closing gracefully before terminating process
Use a Microsoft recommended way of process termination for the project
process run from the editor. This allows loaded DLLs to receive and handle
DLL_PROCESS_DETACH notification and cleanup any global state before the
process actually exits.
2018-08-20 22:41:06 +02:00
bruvzg
ce64c2a32e
Fix Linux/X11 build on ARMs. 2018-05-11 17:34:43 +03:00
Blazej Floch
c45f44d856 Local debugger fixes and extensions
- Adds q/quit option to console debugging
- Adds options (variable_prefix)
- Breaks into debugger with Ctrl-C in local debug mode (Unix/Windows)
- Added option to list all breakpoints
- Fixes add/remove breakpoint bug (invalid path parsing)
- Minor cleanup
2018-05-07 23:17:06 -04:00
Robin Hübner
8287441955 GDNative Unix: fix shared lib loading, dlopen expects leading ./ to interpret as relative path. 2018-04-28 14:36:35 +02:00