Commit graph

253 commits

Author SHA1 Message Date
Rémi Verschelde b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde 64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Rémi Verschelde 7e61be3cb0
Style: Remove executable bit from non-runnable files 2021-05-04 14:45:07 +02:00
Ignacio Roldán Etcheverry 83494c30fe C#: Fix double casting in wasm m2n trampolines
The trampolines were casting double to `size_t` (likely a copy-paste
mistake), so the value was getting truncated.
2021-04-17 05:24:00 +02:00
Matthew A. Robinson b4455ffd75 Add mutex protecting script bindings map from getting corrupted 2021-03-22 20:26:44 -04:00
Rémi Verschelde a0f56b5459
Mono: Fix Android build after #46900
(cherry picked from commit 2274d4eebc)
2021-03-18 17:58:49 +01:00
Ilya Kuznetsov cacf96962d
Added mono_unhandled_exception call to unhandled_exception hook
(cherry picked from commit 6061ff7ba1)
2021-03-17 15:17:02 +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
Rémi Verschelde 558d524bcb Mono: Don't use C++17 [[maybe_unused]] to preserve C++14 compatibility
The 3.2 branch compiles against the C++14 standard to keep good compatibility
with somewhat older compilers.

Fixes #45839.
2021-03-05 23:28:09 +01: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 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
Ignacio Etcheverry 44d8669364
C#: Fix System.Collections.Generic.List marshalling
(cherry picked from commit da90364adf)
2021-01-26 17:00:17 +01:00
Rémi Verschelde 9f2c24e8ce
Cleanup: Remove executable bit from files which don't need it
Drop unused xpmfix.sh script.

(cherry picked from commit 76c6007aa6)
2021-01-26 17:00:15 +01:00
magian1127 cb679dc434 C # mono supports Unicode code 2021-01-18 16:34:10 +08:00
Rémi Verschelde 49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde 188609e5ab
CI: Update to clang-format 11 and apply ternary operator changes
(cherry picked from commit af878716f2)
2021-01-13 16:14:35 +01:00
Ignacio Etcheverry 1a5e985ed4 [3.2] Mono: Make Godot provide its own WASM m2n trampolines
This depends on a custom Mono patch from this commit:
godotengine/godot-mono-builds@0e312939bd
2020-12-14 19:46:41 +01:00
Hugo Locurcio 8542d6ecd5
Tweak log file names for consistency between Mono and non-Mono logs
- Avoid spaces in Mono log file names.
- Use a `.log` extension for Mono logs, just like non-Mono logs.
- Use periods to separate hours/minutes/seconds for non-Mono logs.

(cherry picked from commit 4d81776fc9)
2020-12-09 11:22:05 +01:00
Ignacio Etcheverry 2725ce6798
Fix unhandled exception re-thrown in the editor
(cherry picked from commit bbaf854956)
2020-12-09 11:22:05 +01:00
Sergey Minakov 5d1284204d iOS: port ARC support 2020-10-06 00:23:25 +03:00
Tom Daffin 46b4e82f92
Add mono log message to error for fatal errors
(cherry picked from commit c15fb42d45)
2020-09-14 12:07:12 +02:00
Ignacio Etcheverry e72ee23c43 [3.2] C#: Fix endless reload loop if project has unicode chars
The assembly modified time wasn't picked properly
as the path was treated as latin-1, so the file
watcher was constantly firing the event.
2020-09-08 19:47:47 +02:00
Ignacio Etcheverry bd18b2ff6a [3.2] Fix 'Parameter "assembly" is null' error
This error was normally being printed when
trying to open the project assembly while
the project was not yet built.
The error should not be printed. It's the job
of this method's caller to decide whether to
print an error or not if loading failed.
2020-09-04 01:09:35 +02:00
Ignacio Etcheverry e1f17a0b35 3.2 C#/Mono: Check assembly version when loading
Not sure if we should check revision too, but this is good enough for what we want.
This will be needed to load the correct Microsoft.Build when we switch to the nuget version.

Manual cherry-pick of af4acb5b11 (relevant parts)
2020-08-20 21:38:33 +02:00
Nhiqill 8d5dab5a05 Pop from front to avoid infinite loop with nested classes
(cherry picked from commit 42d1b4f389)
2020-07-28 00:57:27 +02:00
endlesstravel 13d4813ddf fix crash when pass null in print array in GD.print
fix crash when pass null in print array in GD.print 2

fix crash when pass null in print array in GD.print 3

fix space

(cherry picked from commit d2461bad63)
2020-07-03 15:38:07 +02:00
Ignacio Etcheverry c682410379 Mono/C#: Fix unhandled exception not being printed
For some reason `mono_unhandled_exception` is not
printing the exception as its comment claims.
Use `mono_print_unhandled_exception` instead.

(cherry picked from commit f87ae395ee)
2020-06-26 08:10:24 +02:00
Rémi Verschelde 327479472e Revert "return boxed long when marshalling a godot int to mono runtime in dynamic contexts"
This reverts commit 42a31501a8.

It breaks compat as is and needs some further work before it can be
cherry-picked for 3.2.x.
2020-06-22 08:35:21 +02:00
Michael Belousov 42a31501a8 return boxed long when marshalling a godot int to mono runtime in dynamic contexts
(cherry picked from commit 60fcefba69)
2020-06-19 16:17:27 +02:00
NutmegStudio 96a3b91eee Fixes building mono release templates
(cherry picked from commit a77f633161)
2020-06-04 12:09:40 +02:00
Ignacio Etcheverry f0bc3482d4 Mono/C#: Don't try to load project assembly in project manager
This was causing an error message when launching the manager,
because there is no project assembly to load.

(cherry picked from commit d7e21ecd63)
2020-05-25 16:34:15 +02:00
Ignacio Etcheverry 34132d2f67 Mono: Fix hot-reloading of nested classes
(cherry picked from commit e0a001549e)
2020-05-11 11:01:13 +02:00
Ignacio Etcheverry fb2e00a854 [3.2] C#: Rewrite GodotTools messaging protocol 2020-05-10 21:05:00 +02:00
Ignacio Etcheverry 8cdcb410e0 Mono/C#: Fix load hook not called for some assemblies on domain reload
(cherry picked from commit f5510262bc)
2020-04-27 10:15:24 +02:00
Ignacio Etcheverry 6aca932659 C#: Revert marshalling of IDictionary/IEnumerable implementing types
Added marshalling for `System.Collections.Generic.List<T>` and
`System.Collections.Generic.Dictionary<TKey, TValue>`.
2020-04-23 15:36:01 +02:00
Ignacio Etcheverry dfdb7bdc87 Mono/C#: Fix assemblies being reloaded a second time unnecesarily
(cherry picked from commit c9882e61e2)
2020-04-23 11:34:42 +02:00
Ignacio Etcheverry cf729f2111 Mono/C#: Allow exporting System.Array of type Godot.Object
(cherry picked from commit 0fec3cb5ed)
2020-04-23 11:17:23 +02:00
Ignacio Etcheverry 317d8decad Mono/C#: Allow debugging exported games
- Include PDB files in exported games.
- Release export templates also allow debugging now.

Right now the only way to enable debugging in exported games is with the  environment variables, which may be cumbersome or not even possible on some platforms.

(cherry picked from commit 71fc87e101)
2020-04-23 11:15:35 +02:00
Ignacio Etcheverry 445f1c6e7b Mono/C#: Add iOS support
Right now, games only work on devices when exported with FullAOT+Interpreter.
There are some issues left that need to addressed for FullAOT alone. Right now,
it's giving issues with the Godot.NativeCalls static constructor.
2020-04-14 18:03:10 +02:00
Ignacio Etcheverry bda993dd79 C#: Fix uses of old Configuration names
(cherry picked from commit 66c0b7ce98)
2020-04-06 18:14:07 +02:00
Ignacio Etcheverry d68b9c20d6 Mono/C#: Script interface calls now attach the current thread
Added guards to all C# script interface calls to attach the current thread
for the current scope if the thread is not already attached.
This is far from ideal, as attaching the thread is not cheap and all managed
thread local storage is lost when we detach the thread at the end of the calls.
However, it's the best we can do for now to avoid crashing
when an unattached thread tries to interact with C# code.
2020-01-16 17:47:36 +01:00
Rémi Verschelde 9b8d1383ce Mono: Fix parsing assembly names as UTF-8
Fixes #27185.
2020-01-15 11:51:03 +01:00
Ignacio Etcheverry a6a5ef0fd6 Mono/C#: Add error checks to detect possible Reference leaks 2020-01-13 21:00:07 +01:00
Ignacio Etcheverry 844a8d215b Mono/C#: Make 'GD.Print' and its variants fallback to 'ToString()'
Up until now, 'GD.Print' would convert parameters first to
Variant and only then to String. This meant parameters that cannot be
converted to Variant would be printed as "Null".
This commit makes 'GD.Print' fallback to 'System.Object.ToString()'
if the parameter could not be converted to Variant.
The same applies to all 'GD.Print' variants:
'GD.PrintS', 'GD.PrintT', 'GD.PrintErr' and 'GD.PrintRaw'.
2020-01-02 13:54:20 +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
Ignacio Etcheverry 0ef635c0e3 Mono/C#: Fix memory leak with new Reference instances created from C# 2019-12-25 19:33:59 +01:00
Rémi Verschelde 2a4c528d06
Merge pull request #34465 from neikeq/no-hardcode-debugger-wait
Mono/C#: Remove hard-coded debugger wait at initialization
2019-12-19 21:27:59 +01:00
Ignacio Etcheverry f3c6c63b94 Mono/C#: Remove hard-coded debugger wait at initialization
Up until now debug builds would always wait up to 500 ms during initialization
to give time for debuggers to attach to the game.
We no longer want this as it increases startup time unnecesarily.
The way forward is to setup the debugger agent as client instead of server.
This way it's the game that connect to the debugger, not the other way around.
If server mode is still desired, suspend=y can be used to indefinitely wait
for the debugger to attach. This all can be specified with the environment
variable 'GODOT_MONO_DEBUGGER_AGENT' when launching the game.
2019-12-19 17:07:20 +01:00