summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/mono_gd')
-rw-r--r--modules/mono/mono_gd/gd_mono_log.cpp24
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp14
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h3
3 files changed, 16 insertions, 25 deletions
diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp
index 087a7a2e5c..a6e04e561d 100644
--- a/modules/mono/mono_gd/gd_mono_log.cpp
+++ b/modules/mono/mono_gd/gd_mono_log.cpp
@@ -37,6 +37,7 @@
#include "core/os/os.h"
#include "../godotsharp_dirs.h"
+#include "../utils/string_utils.h"
static int log_level_get_id(const char *p_log_level) {
@@ -125,27 +126,6 @@ void GDMonoLog::_delete_old_log_files(const String &p_logs_dir) {
da->list_dir_end();
}
-static String format(const char *p_fmt, ...) {
- va_list args;
-
- va_start(args, p_fmt);
- int len = vsnprintf(NULL, 0, p_fmt, args);
- va_end(args);
-
- len += 1; // for the trailing '/0'
-
- char *buffer(memnew_arr(char, len));
-
- va_start(args, p_fmt);
- vsnprintf(buffer, len, p_fmt, args);
- va_end(args);
-
- String res(buffer);
- memdelete_arr(buffer);
-
- return res;
-}
-
void GDMonoLog::initialize() {
CharString log_level = OS::get_singleton()->get_environment("GODOT_MONO_LOG_LEVEL").utf8();
@@ -172,7 +152,7 @@ void GDMonoLog::initialize() {
OS::Time time_now = OS::get_singleton()->get_time();
int pid = OS::get_singleton()->get_process_id();
- String log_file_name = format("%d_%02d_%02d %02d.%02d.%02d (%d).txt",
+ String log_file_name = str_format("%d_%02d_%02d %02d.%02d.%02d (%d).txt",
date_now.year, date_now.month, date_now.day,
time_now.hour, time_now.min, time_now.sec, pid);
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index de4f3650bd..d586b73cf9 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -184,8 +184,13 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, ExportInfo *r_e
reftype, &key_reftype, &value_reftype, &exc);
UNLIKELY_UNHANDLED_EXCEPTION(exc);
- r_export_info->dictionary.key_type = managed_to_variant_type(ManagedType::from_reftype(key_reftype));
- r_export_info->dictionary.value_type = managed_to_variant_type(ManagedType::from_reftype(value_reftype));
+ ManagedType key_type = ManagedType::from_reftype(key_reftype);
+ ManagedType value_type = ManagedType::from_reftype(value_reftype);
+
+ r_export_info->dictionary.key_type = managed_to_variant_type(key_type);
+ r_export_info->dictionary.key_native_name = NATIVE_GDMONOCLASS_NAME(key_type.type_class);
+ r_export_info->dictionary.value_type = managed_to_variant_type(value_type);
+ r_export_info->dictionary.value_native_name = NATIVE_GDMONOCLASS_NAME(value_type.type_class);
}
return Variant::DICTIONARY;
@@ -205,7 +210,10 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, ExportInfo *r_e
reftype, &elem_reftype, &exc);
UNLIKELY_UNHANDLED_EXCEPTION(exc);
- r_export_info->array.element_type = managed_to_variant_type(ManagedType::from_reftype(elem_reftype));
+ ManagedType elem_type = ManagedType::from_reftype(elem_reftype);
+
+ r_export_info->array.element_type = managed_to_variant_type(elem_type);
+ r_export_info->array.element_native_name = NATIVE_GDMONOCLASS_NAME(elem_type.type_class);
}
return Variant::ARRAY;
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index 4a73f9e3e6..8d3fd4b349 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -61,13 +61,16 @@ T unbox(MonoObject *p_obj) {
struct ExportInfo {
struct ArrayInfo {
Variant::Type element_type;
+ String element_native_name;
ArrayInfo() :
element_type(Variant::NIL) {}
} array;
struct DictionaryInfo {
Variant::Type key_type;
+ String key_native_name;
Variant::Type value_type;
+ String value_native_name;
DictionaryInfo() :
key_type(Variant::NIL),