Commit graph

145 commits

Author SHA1 Message Date
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
Ignacio Etcheverry
6492de800f
Merge pull request #26661 from neikeq/issue-17601
Mono: Fix array field being assigned MonoArray** instead of MonoArray*
2019-03-05 23:03:25 +01:00
Ignacio Etcheverry
c6ac7333a6 Mono: Fix array field being assigned MonoArray** instead of MonoArray*
Fixes #17601
2019-03-05 21:46:55 +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
marxin
e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
marxin
8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Ignacio Etcheverry
9421da57ad C#: Add 'Singleton' property to singleton wrapper class
This property returns an instance of the singleton.
The purpose of this is to allow using methods from the base class like 'Connect'.
Since all Godot singletons inherit Object, the type of the returned instance is Godot.Object.
2019-02-19 22:38:22 +01:00
Ignacio Etcheverry
1174d10e3c
Merge pull request #25890 from neikeq/issue-25818
Fix Godot.Reference marshalling from MonoObject* to Variant
2019-02-19 15:05:05 +01:00
Ignacio Etcheverry
a8dfe9ff7f Don't print 'Cannot find Mono in the registry' if bundled with Godot
Closes #24753
2019-02-15 19:52:32 +01:00
Ignacio Etcheverry
d17ba9a140 Mono: Fix export template build errors
Fixes #25903
2019-02-15 19:52:22 +01:00
Ignacio Etcheverry
b41a793592 Fix Godot.Reference marshalling from MonoObject* to Variant
Need to cast Ref<T> to Variant instead of constructing Variant from Object*, otherwise the Variant won't hold a reference.
2019-02-14 22:54:15 +01:00
Rémi Verschelde
55ca2a7c88
Merge pull request #25821 from akien-mga/sync-class-and-filenames
Ensure classes match their header filename
2019-02-13 08:49:39 +01:00
Rémi Verschelde
fe7e11e008 Modules: Ensure classes match their header filename
Renamed:
- `modules/mono/mono_gd/gd_mono_class_member.h` -> `i_mono_class_member.h`
- `modules/upnp/upnpdevice.h` -> `upnp_device.h`
- `modules/websocket/websocket_multiplayer.h` -> `websocket_multiplayer_peer.h`
2019-02-12 22:59:56 +01:00
Rémi Verschelde
c4835c4345
Merge pull request #25721 from neikeq/ww
Use script instance binding for objects constructed from C#
2019-02-12 15:29:25 +01:00
Ignacio Etcheverry
24a2ae7f3c Do not initialize Mono if 'res://.mono/' and mscorlib are missing
This is needed to avoid aborting due to missing mscorlib for projects that do not use C#.
If 'res://.mono/' exists, then we assume the project uses C#, in which case a missing mscorlib should still abort.
2019-02-10 18:34:37 +01:00
Ignacio Etcheverry
9df44c2d2c Use script instance binding for objects constructed from C#
Only possible if the object class is a "native type". If the object class is a user class (that derives a "native type") then a script is needed.
Since CSharpLanguage does cleanup of script instance bindings when finished, cases like #25621 will no longer cause problems.

Fixed ~Object() trying to free script instance bindings after the language has already been removed, which would result in a NULL dereference.
2019-02-09 00:32:18 +01:00
Ignacio Etcheverry
919fa75803
Merge pull request #25574 from neikeq/ss
Mono: Lifetime fixes for CSharpInstance and instance binding data
2019-02-03 07:36:33 +01:00
Ignacio Etcheverry
d8593747e0 Mono: Fix default debugger agent argument never being used 2019-02-03 06:51:07 +01:00
Ignacio Etcheverry
3233083f63 Mono: Lifetime fixes for CSharpInstance and instance binding data
Avoid CSharpInstance from accessing its state after self destructing (by deleting the Reference owner).
It's now safe to replace the script instance without leaking or crashing.

Also fixed godot_icall_Object_weakref return reference being freed before returning.
2019-02-03 06:47:25 +01:00
Ignacio Etcheverry
065828d159 Mono: Fix MonoPosixHelper not being found 2019-02-03 05:38:47 +01:00
Ignacio Etcheverry
d3c51a5dfb Mono: Cleanup 2019-02-03 05:38:40 +01:00
Ignacio Etcheverry
bc8b61bb06 Mono: Fix hot reload build errors and cleanup 2019-01-22 18:33:36 +01:00
Ignacio Etcheverry
077e489773 Mono: Add assembly reloading to running games
Add environment variable to specify a custom --debugger-agent for mono.
2019-01-21 22:44:09 +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
Rémi Verschelde
d1f3b622f0 Fix missing/malformed license headers 2019-01-01 12:46:36 +01:00
Hein-Pieter van Braam
4e25e5066b Reduce String CoW
By introducing an intermediate proxy class for the array subscript
operator for String and CharString we can control better when CowData
will actually CoW.

This should improve performance of String usage for most cases.
2018-12-16 16:51:38 +01:00
Ben Rog-Wilhelm
b26487a2b4 Tweaks after feedback 2018-12-08 00:54:12 -08:00
Ben Rog-Wilhelm
f13f2d512f Implement CSharpScript::get_script_method_list and related functionality. 2018-12-07 23:54:40 -08:00
Ignacio Etcheverry
989b93d6a4
Merge pull request #24091 from neikeq/ii
C#: Improve tool script support and fix reloading issues
2018-11-30 21:39:13 +01:00
Ignacio Etcheverry
b9b7dcdf00 C#: Improve tool script support and fix reloading issues 2018-11-30 20:43:06 +01:00
Ignacio Etcheverry
6d7dc9d98b
Merge pull request #23583 from neikeq/ee
Improve the C# API projects generation
2018-11-08 01:52:27 +01:00
Ignacio Etcheverry
02d5ff4cd0 Improve the C# API projects generation
- Now there is only one solution that contains both GodotSharp and GodotSharpEditor project. Previously we had one solution for each project
- GodotSharpEditor reference GodotShatp with a 'ProjectReference'. Previously it was a 'Reference' to the assembly
- This also simplifies the command line option to generate this solution: 'godot --generate-cs-api <OutputDir>'
2018-11-08 01:05:22 +01:00
Ryan Schmitt
366c7e0f48 Fix false error when exporting enum in c# 2018-11-05 01:22:15 -08:00
Ignacio Etcheverry
d47cec43f2
Merge pull request #23162 from neikeq/cc
Proper support for namespaces and other enhancement/fixes
2018-10-25 18:18:40 +02:00
Ignacio Etcheverry
1aac95a737 Parse C# script namespace and class
- Added a very simple parser that can extract the namespace and class name of a C# script.
2018-10-25 18:00:24 +02:00
Ignacio Etcheverry
454b933106 Fix internal assembly load from
- Also make sure we load API assemblies from 'res://.mono/assemblies/'.
2018-10-22 20:35:44 +02:00
Mads Ynddal
16c0c037c8 Removed undeclared and unused variable, which caused a compile error 2018-10-21 21:55:30 +02:00
Ignacio Etcheverry
23ae64b15e C#: Optimize struct marshalling
- We no longer box struct to return them from internal calls.
- Use reinterpret_cast if the managed struct layout is the same as the native struct.
2018-10-17 22:36:26 +02:00
Ignacio Etcheverry
b63e518ce9 Mono: Fix crash on NodePath/RID disposal during Godot shutdown 2018-10-06 23:00:18 +02:00
Ignacio Etcheverry
9475e86078 Fix build error for windows mono export templates 2018-10-05 17:47:34 +02:00
Ignacio Etcheverry
d7ece43b74 Mono: Editor and export template dependencies and fixes
- Bundle editor dependencies:
    - 'GodotSharp': Root data directory for the editor
        - 'Tools': Editor dependencies. Only GodotSharp.dll for now.
        - 'Api': Prebuilt GodotSharp and GodotSharpEditor API assemblies.
        - 'Mono': Mono files to bundle with the editor.
            - 'bin': (Optional, not used for now) Mono bin directory.
            - 'etc': Mono configuration files.
            - 'lib': Mono dependency shared libraries.
            - 'lib/mono/4.5': Framework assemblies.
    - Added build option to copy the required files from the mono installation to 'GodotSharp/Mono'. Enable with 'copy_mono_root=yes'. Disabled by default.

- Export template dependencies:
    - 'data_AppName'/'data_Godot':
        - 'Mono': Mono files to bundle with the game.
            - 'etc': Mono configuration files.
            - 'lib': Mono dependency shared libraries.
    - The data directory is generated when compiling and must be bundled with the export templates. In the case of OSX, the data directory must be placed inside the 'osx.zip' export template.
    - In OSX, alternative location for directories (needed for app bundles) are:
        - 'data_AppName/Mono/etc' --> '../Resources/GodotSharp/Mono/etc'
        - 'data_AppName/Mono/lib' --> '../Frameworks/GodotSharp/Mono/lib'

- The editor can bundle prebuilt API assemblies.
    - Generate them with a tools build by running: `--generate-cs-core-api <GodotSharp_OutputDir> --generate-cs-editor-api <GodotSharpEditor_OutputDir> <GodotSharp_OutputDir>/bin/Release/GodotSharp.dll` (This command will be simplified in the future and both projects will be in the same solution)
    - Build the solutions and copy the output files to '#bin/GodotSharp/Api'.
- Fixed API assembly being added twice during the export process.
2018-10-03 19:16:29 +02:00
Ignacio Etcheverry
50fd5ef3b5 Mono: Fix not creating generic Array or Dictionary where expected 2018-09-27 00:11:31 +02:00
Ignacio Etcheverry
0f3de6ef3a Do not update cache if the C# API assembly is out of sync 2018-09-26 23:59:38 +02:00
Ignacio Etcheverry
50f6dbff87 Mono: Fix opening code editors in OSX and cleanup 2018-09-17 20:00:19 +02:00