1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

Mono: Cleanup

This commit is contained in:
Ignacio Etcheverry
2019-01-29 00:02:35 +01:00
parent eb1e3ee232
commit d3c51a5dfb
24 changed files with 129 additions and 143 deletions

View File

@@ -54,17 +54,6 @@
#include "main/main.h"
#endif
#ifdef MONO_PRINT_HANDLER_ENABLED
void gdmono_MonoPrintCallback(const char *string, mono_bool is_stdout) {
if (is_stdout) {
OS::get_singleton()->print(string);
} else {
OS::get_singleton()->printerr(string);
}
}
#endif
GDMono *GDMono::singleton = NULL;
namespace {
@@ -162,11 +151,6 @@ void GDMono::initialize() {
GDMonoLog::get_singleton()->initialize();
#ifdef MONO_PRINT_HANDLER_ENABLED
mono_trace_set_print_handler(gdmono_MonoPrintCallback);
mono_trace_set_printerr_handler(gdmono_MonoPrintCallback);
#endif
String assembly_rootdir;
String config_dir;
@@ -327,7 +311,7 @@ namespace GodotSharpBindings {
uint64_t get_core_api_hash();
#ifdef TOOLS_ENABLED
uint64_t get_editor_api_hash();
#endif // TOOLS_ENABLED
#endif
uint32_t get_bindings_version();
void register_generated_icalls();
@@ -344,29 +328,20 @@ void GDMono::_register_internal_calls() {
#endif
}
#ifdef DEBUG_METHODS_ENABLED
void GDMono::_initialize_and_check_api_hashes() {
api_core_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
#ifdef MONO_GLUE_ENABLED
if (api_core_hash != GodotSharpBindings::get_core_api_hash()) {
if (get_api_core_hash() != GodotSharpBindings::get_core_api_hash()) {
ERR_PRINT("Mono: Core API hash mismatch!");
}
#endif
#ifdef TOOLS_ENABLED
api_editor_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
#ifdef MONO_GLUE_ENABLED
if (api_editor_hash != GodotSharpBindings::get_editor_api_hash()) {
if (get_api_editor_hash() != GodotSharpBindings::get_editor_api_hash()) {
ERR_PRINT("Mono: Editor API hash mismatch!");
}
#endif
#endif // TOOLS_ENABLED
#endif // MONO_GLUE_ENABLED
}
#endif // DEBUG_METHODS_ENABLED
void GDMono::add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly) {
@@ -915,7 +890,7 @@ void GDMono::unhandled_exception_hook(MonoObject *p_exc, void *) {
ScriptDebugger::get_singleton()->idle_poll();
#endif
abort();
_UNREACHABLE_();
GD_UNREACHABLE();
}
GDMono::GDMono() {
@@ -946,12 +921,10 @@ GDMono::GDMono() {
editor_tools_assembly = NULL;
#endif
#ifdef DEBUG_METHODS_ENABLED
api_core_hash = 0;
#ifdef TOOLS_ENABLED
api_editor_hash = 0;
#endif
#endif
}
GDMono::~GDMono() {
@@ -1074,17 +1047,9 @@ void _GodotSharp::_bind_methods() {
_GodotSharp::_GodotSharp() {
singleton = this;
queue_empty = true;
#ifndef NO_THREADS
queue_mutex = Mutex::create();
#endif
}
_GodotSharp::~_GodotSharp() {
singleton = NULL;
if (queue_mutex) {
memdelete(queue_mutex);
}
}