Commit graph

100 commits

Author SHA1 Message Date
Ignacio Etcheverry c9882e61e2 Mono/C#: Fix assemblies being reloaded a second time unnecesarily 2020-04-23 02:23:25 +02:00
Ignacio Etcheverry 71fc87e101 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.
2020-04-22 16:44:03 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Ignacio Etcheverry 77dd061345 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-03-31 09:37:16 +02: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
Marcel Admiraal f0db13502a Remove duplicate WARN_PRINT macro. 2020-02-05 11:13:24 +01:00
Marcel Admiraal 5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +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 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
Rémi Verschelde c3ea4ea9b7
Merge pull request #34382 from van800/profiler
Allow attaching any external profiler, including JetBrains dotTrace
2019-12-16 22:00:36 +01:00
Ivan Shakhov 7c64779516 Allow attaching any external profiler, including JetBrains dotTrace 2019-12-16 20:34:30 +01:00
Rémi Verschelde a866028a7a Mono: Enable threads suspend workaround on Windows
This appears to be necessary for current official builds cross-compiled
with MinGW from Linux, using Mono 6.6.0.160.

Follow-up to #31784, see #29812 for details.
2019-12-16 15:40:26 +01:00
Ignacio Etcheverry 066ae9d83b Mono/C#: Several android fixes
- Added correct config file for android dllmaps.
- Fix __Internal DllImports with a dlopen fallback.
- Add missing P/Invoke functions and internal calls expected by the monodroid BCL and our custom version of the 'Android.Runtime.AndroidEnvironment' class (this last one can be found in the godot-mono-builds repo).
- Make sure to set 'btls' instead of 'legacy' as the default TLS provider on Android.
2019-12-04 19:03:42 +01:00
Ignacio Etcheverry 66de28eda8 Mono/C#: Add option to export assemblies outside of PCK
When using this options, assemblies will be saved in the Assemblies folder of the  data directory: 'data_AppName/Assemblies/'.
2019-11-29 00:36:05 +01:00
Ignacio Etcheverry de7c2ad21b Mono/C#: WebAssembly support 2019-11-13 21:41:11 +01:00
Ignacio Etcheverry 8a0c0371d4 C#: Fix regression from #32732 caused a crash on domain reload 2019-10-12 21:27:56 +02:00
Rémi Verschelde 3cc94b2c0b Mono: Fix template build after #32732 2019-10-11 15:17:36 +02:00
Ignacio Etcheverry 8c438a2197 C#: Fix detection of outdated release Godot API assemblies 2019-10-11 01:46:06 +02:00
Ignacio Roldán Etcheverry 763a4d8402
Merge pull request #32401 from neikeq/Kisaama!
Mono: Don't compare API hashes on release builds
2019-09-28 03:31:37 +02:00
Ignacio Etcheverry 1509890dbc Mono: Don't compare API hashes on release builds
API hashes cannot be calculated on release builds, as bindings information is lacking. Therefore, we should not be comparing it with the generated glue hash as they will never match.
2019-09-28 01:07:57 +02:00
Rémi Verschelde e067a54988
Merge pull request #32353 from neikeq/yamero
Mono: Improve API assembly load error message on exported games
2019-09-26 07:31:03 +02:00
Ignacio Etcheverry 2325fb11a8 Mono: Improve API assembly load error message on exported games 2019-09-25 22:32:39 +02:00
Ignacio Etcheverry 5ff4e0516b Mono: Don't use project settings for debugger agent on exported games 2019-09-25 22:03:24 +02:00
Ignacio Etcheverry 95c685143a C#: Make sure cs_glue_version is present when building export templates 2019-09-20 17:41:20 +02:00
Ignacio Etcheverry 5a6070dde3 Mono: Force preemptive thread suspend mode as a temporary workaround 2019-08-30 01:33:50 +02:00
Ignacio Etcheverry aa805e2699 Fix 'android_mono_config.gen.cpp' not compiled first time it's generated 2019-08-26 17:46:57 +02:00
Rémi Verschelde 8995d95da0
Merge pull request #31347 from neikeq/monodevelop-addin
C#: Add Ide Connection library and server for the editor
2019-08-14 11:39:41 +02:00
Ignacio Etcheverry c55ce204b3 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'modules/mono'
And 'CRASH_*_MSG' as well.

Also make error messages puntuation and quotation more consistent.
2019-08-09 12:13:21 +02:00
Ignacio Etcheverry 0b94203a79 C#: Add Ide Connection library and server for the editor
This will be used for communicating between the Godot editor and external IDEs/editors, for things like opening files, triggering hot-reload and running the game with a debugger attached.
2019-08-04 01:57:53 +02:00
Ignacio Etcheverry c9befa63d2 Mono: Don't try to update project assemblies from project manager
Previously, when running the project manager, we would try to load the API assemblies from the project and fail because we were not editing any project. This would make us try to copy the prebuilt API assemblies to the project. Since there is no project, it would try to copy them to the executable location. This would fail if Godot doesn't have permissions to write to that location.
This commit fixes that by instead trying to load the prebuilt API assemblies in the first place, if running the project manager.
2019-07-25 17:52:45 +02:00
Ignacio Etcheverry 513cc78f85 Mono: Add option to keep running after unhandled exceptions
By default, an unhandled exception will cause the application to be terminated; but the project setting `mono/unhandled_exception_policy` was added to change this behaviour.
The editor is hard-coded to never terminate because of unhandled exceptions, as that would make writing editor plugins a painful task, and we cannot kill the editor because of a mistake in a thirdparty plugin.
2019-07-24 23:19:15 +02:00
Ignacio Etcheverry 0197d86ab4 Mono: Fix editor API assembly not being updated
If both the core and editor API assemblies are missing or out of sync, Godot will only update the former and then abort when trying to load them again because the latter was not updated. Godot will update it correctly the next time it's started, but this should not be needed and it should work the first time. This commit fixes that.
2019-07-22 00:16:24 +02:00
Ignacio Etcheverry ec679dfffa Fix mono module build errors for release templates 2019-07-20 15:52:26 +02:00
Ignacio Etcheverry e59ac40712 Mono: Better handling of missing/outdated API assemblies
Remove the old API assembly invalidation system. It's pretty simple since now the editor has a hard dependency on the API assemblies and SCons takes care of prebuilding them.
If we fail to load a project's API assembly because it was either missing or outdated, we just copy the prebuilt assemblies to the project and try again. We also do this when creating the solution and before building, just in case the user removed them from the disk after they were loaded.
This way the API assemblies will be always loaded successfully. If they are not, it's a bug.

Also fixed:

- EditorDef was behaving like GlobalDef in GodotTools.
- NullReferenceException because we can't serialize System.WeakReference yet. Use Godot.WeakRef in the mean time.
2019-07-14 19:17:07 +02:00
Ignacio Etcheverry 069af23bdb Mono: Fix build errors with tools=no 2019-07-08 18:07:20 +02:00
Ignacio Etcheverry 5ed3d34cd9 Fix --generate-mono-glue bug when directory doesn't exist
DirAccess::get_full_path(path) only works if the path exists. Implement our own abspath function.
2019-07-08 18:07:15 +02:00
Ignacio Etcheverry 270af6fa08 Re-write mono module editor code in C#
Make the build system automatically build the C# Api assemblies to be shipped with the editor.
Make the editor, editor player and debug export templates use Api assemblies built with debug symbols.
Always run MSBuild to build the editor tools and Api assemblies when building Godot.
Several bugs fixed related to assembly hot reloading and restoring state.
Fix StringExtensions internal calls not being registered correctly, resulting in MissingMethodException.
2019-07-05 09:38:23 +02:00
Ignacio Etcheverry 9f1a8ce6a2 Mono: Android build and shared libraries fixes
Fix location of Mono's shared libraries.
Fix build failing if the directory 'platform/android/java/libs/{target}/{abi}' doesn't exist.
2019-07-03 17:48:12 +02:00
Ignacio Etcheverry 14df9e5cb2 Android build and export for the mono module 2019-06-03 17:09:24 +02:00
Ignacio Etcheverry 791e1294c3 Mono: Lazily load scripts metadata file
- Only load the scripts metadata file when it's really needed. This way we avoid false errors, when there is no C# project,  about missing scripts metadata file.
2019-04-26 19:53:44 +02:00
Ignacio Etcheverry 8759c0e31a Mono: Use exit(status) instead of abort() in exception hook 2019-04-18 15:01:50 +02:00
Ignacio Etcheverry ad2127a3e8 Replace a few #if/#elif with #ifdef and "#elif defined" 2019-04-05 23:41:51 +02:00
Ignacio Etcheverry e9e7aab8eb Mono: Some assembly referencing changes and cleanup
Apparently we don't need to call mono_debug_close_image ourselves and we can call mono_image_close right away as it's not our duty to keep that reference.
2019-03-10 18:55:31 +01:00
Ignacio Etcheverry 4299332ecc Mono: Fix assemblies path String incorrectly constructed from utf8
Also fixed a wrong ifdef that was causing Mono to never be initialized if mscorlib was not found (which was the case with the utf8 assemblies path bug this commit fixes).
This condition was meant for exported projects only, not for the editor only.
2019-03-09 23:00:03 +01:00
Ignacio Roldán Etcheverry 65487ed4ed
Merge pull request #26746 from shartte/godot-trace-listener
Add a custom TraceListener on Startup for Mono
2019-03-08 07:05:41 +01:00
Sebastian Hartte 37d448fca7 Added a Godot TraceListener, which is automatically installed on startup. Fixes that Debug/Trace Assertions are simply swallowed by Godot. 2019-03-07 21:00:19 +01:00
Ignacio Etcheverry e904f814c8 Mono: Fix crash when re-using script binding after domain reloading 2019-03-07 19:55:40 +01:00
Rémi Verschelde 0a7de5472f
Merge pull request #26591 from neikeq/oi
Mono: Add option to print MSBuild output and improve out of sync error
2019-03-04 18:36:10 +01:00
Ignacio Etcheverry 8877b07f4c Mono: Add option to print MSBuild output and improve out of sync error 2019-03-04 16:05:08 +01:00
Carter Anderson 839ed2d092 Add mono log profiler support 2019-03-02 23:32:03 -08:00