Commit graph

276 commits

Author SHA1 Message Date
Raul Santos
862691a9f7
Support explicit values in flag properties, add C# flags support
- Add support for explicit values in properties using `PROPERTY_HINT_FLAGS`
that works the same way it does for enums.
- Fix enums and flags in VisualScriptEditor (it wasn't considering the
explicit value).
- Use `PROPERTY_HINT_FLAGS` for C# enums with the FlagsAttribute instead
of `PROPERTY_HINT_ENUM`.
2022-03-19 19:22:54 +01:00
Rémi Verschelde
0c6391a425
Merge pull request #57420 from neikeq/issue-55638 2022-01-31 18:23:08 +01:00
Ignacio Roldán Etcheverry
c7f716e2ea Mono/C#: Fix Android AAB export failing to load native libs
By default, when installing from Android App Bundles the native
libraries are not extracted. They are loaded directly from the APK.
See: https://stackoverflow.com/a/56551499

Passing only the file name to dlopen, without the location, makes it
search the native library in all locations, including inside the apk.
2022-01-29 21:58:57 +01:00
Ignacio Roldán Etcheverry
3b085e2665 C#: Allow configuring Mono debugger agent with cmdline args
The command line option is the same you would pass to Mono, but it
begins with `--mono-debugger-agent=` instead of `--debugger-agent=`.

This is useful for platforms where it's difficult for the user to
configure it via environment variables, like Android.
2022-01-16 12:36:36 +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
Raul Santos
36cd00a84b
Init params_buffer_size member in GDMonoMethod 2022-01-01 02:23:40 +01:00
Raul Santos
613751a742 Fix get_all_delegates method for generic classes
If the class is generic, we must get its generic type definition and use
it to retrieve the delegates.
2021-12-04 01:51:50 +01:00
Hugo Locurcio
4c88a82f50
Move Mono unhandled exception setting to be located within a subsection
Settings that aren't within a subsection are difficult to reach when
other settings do have a subsection.

This also adds documentation for the project setting.
2021-11-10 20:57:35 +01:00
Rémi Verschelde
d0b1e3d002
Merge pull request #53942 from raulsntos/no-boxing 2021-11-08 13:15:25 +01:00
Ignacio Roldán Etcheverry
690bf12c4c C#: Don't use ActivityThread to determine Android nativeLibraryDir 2021-11-08 02:35:06 +01:00
Ignacio Roldán Etcheverry
e282ee0a48 C#: Fix property set call boxing value when unboxed was expected 2021-11-03 13:02:53 +01:00
Ignacio Etcheverry
b775573a21 Don't box params on Native->C# calls with Variant params
Godot uses Variant parameters for calls to script methods.
Up until now we were boxing such parameters when marshalling
them for invokation, even if they were value types.

Now Godot allocates the marshalled parameters on the stack,
reducing the GC allocations resulted from boxing.
2021-11-03 13:02:53 +01:00
Rémi Verschelde
87c80f529f
clang-format: Enable BreakBeforeTernaryOperators
clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
2021-10-28 14:50:33 +02:00
Rémi Verschelde
42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Raul Santos
977898709f Fix hint_string for C# enum arrays 2021-10-15 19:07:31 +02:00
Rémi Verschelde
f04a1bec63
Merge pull request #53628 from raulsntos/fix-list-marshal-3.x 2021-10-15 17:36:00 +02:00
Rémi Verschelde
b8761569f6
Merge pull request #53582 from raulsntos/mono-marshal-generics-3.x 2021-10-15 17:35:32 +02:00
Raul Santos
059750cd0d Support marshaling generic Godot.Object
Allows using generic C# types in signals as long as they inherit
from `Godot.Object`.
2021-10-13 18:22:06 +02:00
Raul Santos
fd160b642e Fix C# List<T> marshalling 2021-10-10 11:41:37 +02:00
Raul Santos
ec2f86ec9a Support arrays of StringName, NodePath and RID in mono 2021-10-08 18:52:40 +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
Ignacio Roldán Etchevery
a3722a73aa C#+iOS: Fix crash at exit for passing NULL domain to mono_jit_cleanup 2021-06-02 01:34:00 +02:00
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