diff options
Diffstat (limited to 'modules/mono')
-rw-r--r-- | modules/mono/build_scripts/make_android_mono_config.py | 6 | ||||
-rw-r--r-- | modules/mono/csharp_script.cpp | 18 | ||||
-rw-r--r-- | modules/mono/csharp_script.h | 2 | ||||
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 44 | ||||
-rw-r--r-- | modules/mono/glue/gd_glue.cpp | 10 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_field.cpp | 42 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_marshal.cpp | 140 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_marshal.h | 42 | ||||
-rw-r--r-- | modules/mono/utils/string_utils.cpp | 8 |
9 files changed, 156 insertions, 156 deletions
diff --git a/modules/mono/build_scripts/make_android_mono_config.py b/modules/mono/build_scripts/make_android_mono_config.py index 8cad204d7b..0afd939c57 100644 --- a/modules/mono/build_scripts/make_android_mono_config.py +++ b/modules/mono/build_scripts/make_android_mono_config.py @@ -24,7 +24,7 @@ def generate_compressed_config(config_src, output_dir): #ifdef ANDROID_ENABLED #include "core/io/compression.h" -#include "core/pool_vector.h" + namespace { @@ -36,9 +36,9 @@ static const unsigned char config_compressed_data[] = { %s }; } // namespace String get_godot_android_mono_config() { - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(config_uncompressed_size); - PoolVector<uint8_t>::Write w = data.write(); + uint8_t* w = data.ptrw(); Compression::decompress(w.ptr(), config_uncompressed_size, config_compressed_data, config_compressed_size, Compression::MODE_DEFLATE); String s; diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index c722076fe2..15415d7655 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -428,24 +428,24 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { if (p_var_type_name == Variant::get_type_name(Variant::ARRAY)) return "Collections.Array"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_BYTE_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_BYTE_ARRAY)) return "byte[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_INT_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_INT_ARRAY)) return "int[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_REAL_ARRAY)) { + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_REAL_ARRAY)) { #ifdef REAL_T_IS_DOUBLE return "double[]"; #else return "float[]"; #endif } - if (p_var_type_name == Variant::get_type_name(Variant::POOL_STRING_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_STRING_ARRAY)) return "string[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_VECTOR2_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_VECTOR2_ARRAY)) return "Vector2[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_VECTOR3_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_VECTOR3_ARRAY)) return "Vector3[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_COLOR_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_COLOR_ARRAY)) return "Color[]"; Variant::Type var_types[] = { @@ -473,7 +473,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { return "object"; } -String CSharpLanguage::make_function(const String &, const String &p_name, const PoolStringArray &p_args) const { +String CSharpLanguage::make_function(const String &, const String &p_name, const PackedStringArray &p_args) const { // FIXME // - Due to Godot's API limitation this just appends the function to the end of the file // - Use fully qualified name if there is ambiguity @@ -491,7 +491,7 @@ String CSharpLanguage::make_function(const String &, const String &p_name, const return s; } #else -String CSharpLanguage::make_function(const String &, const String &, const PoolStringArray &) const { +String CSharpLanguage::make_function(const String &, const String &, const PackedStringArray &) const { return String(); } #endif diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 32a5b30c18..8ee741b4d2 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -432,7 +432,7 @@ public: virtual bool has_named_classes() const; virtual bool supports_builtin_mode() const; /* TODO? */ virtual int find_function(const String &p_function, const String &p_code) const { return -1; } - virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const; + virtual String make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const; virtual String _get_indentation() const; /* TODO? */ virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const {} /* TODO */ virtual void add_global_constant(const StringName &p_variable, const Variant &p_value) {} diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 34f01ce3c6..0724d72ce6 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -503,23 +503,23 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf xml_output.append("<c>"); xml_output.append(tag); xml_output.append("</c>"); - } else if (tag == "PoolByteArray") { + } else if (tag == "PackedByteArray") { xml_output.append("<see cref=\"byte\"/>"); - } else if (tag == "PoolIntArray") { + } else if (tag == "PackedIntArray") { xml_output.append("<see cref=\"int\"/>"); - } else if (tag == "PoolRealArray") { + } else if (tag == "PackedRealArray") { #ifdef REAL_T_IS_DOUBLE xml_output.append("<see cref=\"double\"/>"); #else xml_output.append("<see cref=\"float\"/>"); #endif - } else if (tag == "PoolStringArray") { + } else if (tag == "PackedStringArray") { xml_output.append("<see cref=\"string\"/>"); - } else if (tag == "PoolVector2Array") { + } else if (tag == "PackedVector2Array") { xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".Vector2\"/>"); - } else if (tag == "PoolVector3Array") { + } else if (tag == "PackedVector3Array") { xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".Vector3\"/>"); - } else if (tag == "PoolColorArray") { + } else if (tag == "PackedColorArray") { xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".Color\"/>"); } else { const TypeInterface *target_itype = _get_type_or_null(TypeReference(tag)); @@ -2628,13 +2628,13 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar r_iarg.default_argument = "null"; break; case Variant::ARRAY: - case Variant::POOL_BYTE_ARRAY: - case Variant::POOL_INT_ARRAY: - case Variant::POOL_REAL_ARRAY: - case Variant::POOL_STRING_ARRAY: - case Variant::POOL_VECTOR2_ARRAY: - case Variant::POOL_VECTOR3_ARRAY: - case Variant::POOL_COLOR_ARRAY: + case Variant::PACKED_BYTE_ARRAY: + case Variant::PACKED_INT_ARRAY: + case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_STRING_ARRAY: + case Variant::PACKED_VECTOR2_ARRAY: + case Variant::PACKED_VECTOR3_ARRAY: + case Variant::PACKED_COLOR_ARRAY: r_iarg.default_argument = "new %s {}"; r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF; break; @@ -2914,20 +2914,20 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { #define INSERT_ARRAY(m_type, m_proxy_t) INSERT_ARRAY_FULL(m_type, m_type, m_proxy_t) - INSERT_ARRAY(PoolIntArray, int); - INSERT_ARRAY_FULL(PoolByteArray, PoolByteArray, byte); + INSERT_ARRAY(PackedIntArray, int); + INSERT_ARRAY_FULL(PackedByteArray, PackedByteArray, byte); #ifdef REAL_T_IS_DOUBLE - INSERT_ARRAY(PoolRealArray, double); + INSERT_ARRAY(PackedRealArray, double); #else - INSERT_ARRAY(PoolRealArray, float); + INSERT_ARRAY(PackedRealArray, float); #endif - INSERT_ARRAY(PoolStringArray, string); + INSERT_ARRAY(PackedStringArray, string); - INSERT_ARRAY(PoolColorArray, Color); - INSERT_ARRAY(PoolVector2Array, Vector2); - INSERT_ARRAY(PoolVector3Array, Vector3); + INSERT_ARRAY(PackedColorArray, Color); + INSERT_ARRAY(PackedVector2Array, Vector2); + INSERT_ARRAY(PackedVector3Array, Vector3); #undef INSERT_ARRAY diff --git a/modules/mono/glue/gd_glue.cpp b/modules/mono/glue/gd_glue.cpp index 17483c4457..ce81ea391d 100644 --- a/modules/mono/glue/gd_glue.cpp +++ b/modules/mono/glue/gd_glue.cpp @@ -44,8 +44,8 @@ MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_objects) { Variant ret; - PoolByteArray varr = GDMonoMarshal::mono_array_to_PoolByteArray(p_bytes); - PoolByteArray::Read r = varr.read(); + PackedByteArray varr = GDMonoMarshal::mono_array_to_PackedByteArray(p_bytes); + const uint8_t *r = varr.ptr(); Error err = decode_variant(ret, r.ptr(), varr.size(), NULL, p_allow_objects); if (err != OK) { ret = RTR("Not enough bytes for decoding bytes, or invalid format."); @@ -257,18 +257,18 @@ void godot_icall_GD_pushwarning(MonoString *p_str) { MonoArray *godot_icall_GD_var2bytes(MonoObject *p_var, MonoBoolean p_full_objects) { Variant var = GDMonoMarshal::mono_object_to_variant(p_var); - PoolByteArray barr; + PackedByteArray barr; int len; Error err = encode_variant(var, NULL, len, p_full_objects); ERR_FAIL_COND_V_MSG(err != OK, NULL, "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID)."); barr.resize(len); { - PoolByteArray::Write w = barr.write(); + uint8_t *w = barr.ptrw(); encode_variant(var, w.ptr(), len, p_full_objects); } - return GDMonoMarshal::PoolByteArray_to_mono_array(barr); + return GDMonoMarshal::PackedByteArray_to_mono_array(barr); } MonoString *godot_icall_GD_var2str(MonoObject *p_var) { diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 178647b968..21d78483ee 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -247,37 +247,37 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ } if (array_type->eklass == CACHED_CLASS_RAW(uint8_t)) { - SET_FROM_ARRAY(PoolByteArray); + SET_FROM_ARRAY(PackedByteArray); break; } if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) { - SET_FROM_ARRAY(PoolIntArray); + SET_FROM_ARRAY(PackedIntArray); break; } if (array_type->eklass == REAL_T_MONOCLASS) { - SET_FROM_ARRAY(PoolRealArray); + SET_FROM_ARRAY(PackedRealArray); break; } if (array_type->eklass == CACHED_CLASS_RAW(String)) { - SET_FROM_ARRAY(PoolStringArray); + SET_FROM_ARRAY(PackedStringArray); break; } if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) { - SET_FROM_ARRAY(PoolVector2Array); + SET_FROM_ARRAY(PackedVector2Array); break; } if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) { - SET_FROM_ARRAY(PoolVector3Array); + SET_FROM_ARRAY(PackedVector3Array); break; } if (array_type->eklass == CACHED_CLASS_RAW(Color)) { - SET_FROM_ARRAY(PoolColorArray); + SET_FROM_ARRAY(PackedColorArray); break; } @@ -434,26 +434,26 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Array(), CACHED_CLASS(Array)); mono_field_set_value(p_object, mono_field, managed); } break; - case Variant::POOL_BYTE_ARRAY: { - SET_FROM_ARRAY(PoolByteArray); + case Variant::PACKED_BYTE_ARRAY: { + SET_FROM_ARRAY(PackedByteArray); } break; - case Variant::POOL_INT_ARRAY: { - SET_FROM_ARRAY(PoolIntArray); + case Variant::PACKED_INT_ARRAY: { + SET_FROM_ARRAY(PackedIntArray); } break; - case Variant::POOL_REAL_ARRAY: { - SET_FROM_ARRAY(PoolRealArray); + case Variant::PACKED_REAL_ARRAY: { + SET_FROM_ARRAY(PackedRealArray); } break; - case Variant::POOL_STRING_ARRAY: { - SET_FROM_ARRAY(PoolStringArray); + case Variant::PACKED_STRING_ARRAY: { + SET_FROM_ARRAY(PackedStringArray); } break; - case Variant::POOL_VECTOR2_ARRAY: { - SET_FROM_ARRAY(PoolVector2Array); + case Variant::PACKED_VECTOR2_ARRAY: { + SET_FROM_ARRAY(PackedVector2Array); } break; - case Variant::POOL_VECTOR3_ARRAY: { - SET_FROM_ARRAY(PoolVector3Array); + case Variant::PACKED_VECTOR3_ARRAY: { + SET_FROM_ARRAY(PackedVector3Array); } break; - case Variant::POOL_COLOR_ARRAY: { - SET_FROM_ARRAY(PoolColorArray); + case Variant::PACKED_COLOR_ARRAY: { + SET_FROM_ARRAY(PackedColorArray); } break; default: break; } diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 19d627218e..63890f6066 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -113,25 +113,25 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { return Variant::ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(uint8_t)) - return Variant::POOL_BYTE_ARRAY; + return Variant::PACKED_BYTE_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return Variant::POOL_INT_ARRAY; + return Variant::PACKED_INT_ARRAY; if (array_type->eklass == REAL_T_MONOCLASS) - return Variant::POOL_REAL_ARRAY; + return Variant::PACKED_REAL_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(String)) - return Variant::POOL_STRING_ARRAY; + return Variant::PACKED_STRING_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) - return Variant::POOL_VECTOR2_ARRAY; + return Variant::PACKED_VECTOR2_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) - return Variant::POOL_VECTOR3_ARRAY; + return Variant::PACKED_VECTOR3_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(Color)) - return Variant::POOL_COLOR_ARRAY; + return Variant::PACKED_COLOR_ARRAY; } break; case MONO_TYPE_CLASS: { @@ -491,25 +491,25 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return (MonoObject *)Array_to_mono_array(p_var->operator Array()); if (array_type->eklass == CACHED_CLASS_RAW(uint8_t)) - return (MonoObject *)PoolByteArray_to_mono_array(p_var->operator PoolByteArray()); + return (MonoObject *)PackedByteArray_to_mono_array(p_var->operator PackedByteArray()); if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return (MonoObject *)PoolIntArray_to_mono_array(p_var->operator PoolIntArray()); + return (MonoObject *)PackedIntArray_to_mono_array(p_var->operator PackedIntArray()); if (array_type->eklass == REAL_T_MONOCLASS) - return (MonoObject *)PoolRealArray_to_mono_array(p_var->operator PoolRealArray()); + return (MonoObject *)PackedRealArray_to_mono_array(p_var->operator PackedRealArray()); if (array_type->eklass == CACHED_CLASS_RAW(String)) - return (MonoObject *)PoolStringArray_to_mono_array(p_var->operator PoolStringArray()); + return (MonoObject *)PackedStringArray_to_mono_array(p_var->operator PackedStringArray()); if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) - return (MonoObject *)PoolVector2Array_to_mono_array(p_var->operator PoolVector2Array()); + return (MonoObject *)PackedVector2Array_to_mono_array(p_var->operator PackedVector2Array()); if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) - return (MonoObject *)PoolVector3Array_to_mono_array(p_var->operator PoolVector3Array()); + return (MonoObject *)PackedVector3Array_to_mono_array(p_var->operator PackedVector3Array()); if (array_type->eklass == CACHED_CLASS_RAW(Color)) - return (MonoObject *)PoolColorArray_to_mono_array(p_var->operator PoolColorArray()); + return (MonoObject *)PackedColorArray_to_mono_array(p_var->operator PackedColorArray()); ERR_FAIL_V_MSG(NULL, "Attempted to convert Variant to a managed array of unmarshallable element type."); } break; @@ -638,20 +638,20 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return GDMonoUtils::create_managed_from(p_var->operator Dictionary(), CACHED_CLASS(Dictionary)); case Variant::ARRAY: return GDMonoUtils::create_managed_from(p_var->operator Array(), CACHED_CLASS(Array)); - case Variant::POOL_BYTE_ARRAY: - return (MonoObject *)PoolByteArray_to_mono_array(p_var->operator PoolByteArray()); - case Variant::POOL_INT_ARRAY: - return (MonoObject *)PoolIntArray_to_mono_array(p_var->operator PoolIntArray()); - case Variant::POOL_REAL_ARRAY: - return (MonoObject *)PoolRealArray_to_mono_array(p_var->operator PoolRealArray()); - case Variant::POOL_STRING_ARRAY: - return (MonoObject *)PoolStringArray_to_mono_array(p_var->operator PoolStringArray()); - case Variant::POOL_VECTOR2_ARRAY: - return (MonoObject *)PoolVector2Array_to_mono_array(p_var->operator PoolVector2Array()); - case Variant::POOL_VECTOR3_ARRAY: - return (MonoObject *)PoolVector3Array_to_mono_array(p_var->operator PoolVector3Array()); - case Variant::POOL_COLOR_ARRAY: - return (MonoObject *)PoolColorArray_to_mono_array(p_var->operator PoolColorArray()); + case Variant::PACKED_BYTE_ARRAY: + return (MonoObject *)PackedByteArray_to_mono_array(p_var->operator PackedByteArray()); + case Variant::PACKED_INT_ARRAY: + return (MonoObject *)PackedIntArray_to_mono_array(p_var->operator PackedIntArray()); + case Variant::PACKED_REAL_ARRAY: + return (MonoObject *)PackedRealArray_to_mono_array(p_var->operator PackedRealArray()); + case Variant::PACKED_STRING_ARRAY: + return (MonoObject *)PackedStringArray_to_mono_array(p_var->operator PackedStringArray()); + case Variant::PACKED_VECTOR2_ARRAY: + return (MonoObject *)PackedVector2Array_to_mono_array(p_var->operator PackedVector2Array()); + case Variant::PACKED_VECTOR3_ARRAY: + return (MonoObject *)PackedVector3Array_to_mono_array(p_var->operator PackedVector3Array()); + case Variant::PACKED_COLOR_ARRAY: + return (MonoObject *)PackedColorArray_to_mono_array(p_var->operator PackedColorArray()); default: return NULL; } @@ -785,25 +785,25 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type return mono_array_to_Array((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(uint8_t)) - return mono_array_to_PoolByteArray((MonoArray *)p_obj); + return mono_array_to_PackedByteArray((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return mono_array_to_PoolIntArray((MonoArray *)p_obj); + return mono_array_to_PackedIntArray((MonoArray *)p_obj); if (array_type->eklass == REAL_T_MONOCLASS) - return mono_array_to_PoolRealArray((MonoArray *)p_obj); + return mono_array_to_PackedRealArray((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(String)) - return mono_array_to_PoolStringArray((MonoArray *)p_obj); + return mono_array_to_PackedStringArray((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) - return mono_array_to_PoolVector2Array((MonoArray *)p_obj); + return mono_array_to_PackedVector2Array((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) - return mono_array_to_PoolVector3Array((MonoArray *)p_obj); + return mono_array_to_PackedVector3Array((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(Color)) - return mono_array_to_PoolColorArray((MonoArray *)p_obj); + return mono_array_to_PackedColorArray((MonoArray *)p_obj); if (p_fail_with_err) { ERR_FAIL_V_MSG(Variant(), "Attempted to convert a managed array of unmarshallable element type to Variant."); @@ -987,8 +987,8 @@ Array mono_array_to_Array(MonoArray *p_array) { // TODO: Use memcpy where possible -MonoArray *PoolIntArray_to_mono_array(const PoolIntArray &p_array) { - PoolIntArray::Read r = p_array.read(); +MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array) { + const int *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(int32_t), p_array.size()); @@ -999,13 +999,13 @@ MonoArray *PoolIntArray_to_mono_array(const PoolIntArray &p_array) { return ret; } -PoolIntArray mono_array_to_PoolIntArray(MonoArray *p_array) { - PoolIntArray ret; +PackedIntArray mono_array_to_PackedIntArray(MonoArray *p_array) { + PackedIntArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolIntArray::Write w = ret.write(); + int *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = mono_array_get(p_array, int32_t, i); @@ -1014,8 +1014,8 @@ PoolIntArray mono_array_to_PoolIntArray(MonoArray *p_array) { return ret; } -MonoArray *PoolByteArray_to_mono_array(const PoolByteArray &p_array) { - PoolByteArray::Read r = p_array.read(); +MonoArray *PackedByteArray_to_mono_array(const PackedByteArray &p_array) { + const uint8_t *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(uint8_t), p_array.size()); @@ -1026,13 +1026,13 @@ MonoArray *PoolByteArray_to_mono_array(const PoolByteArray &p_array) { return ret; } -PoolByteArray mono_array_to_PoolByteArray(MonoArray *p_array) { - PoolByteArray ret; +PackedByteArray mono_array_to_PackedByteArray(MonoArray *p_array) { + PackedByteArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolByteArray::Write w = ret.write(); + uint8_t *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = mono_array_get(p_array, uint8_t, i); @@ -1041,8 +1041,8 @@ PoolByteArray mono_array_to_PoolByteArray(MonoArray *p_array) { return ret; } -MonoArray *PoolRealArray_to_mono_array(const PoolRealArray &p_array) { - PoolRealArray::Read r = p_array.read(); +MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array) { + const real_t *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), REAL_T_MONOCLASS, p_array.size()); @@ -1053,13 +1053,13 @@ MonoArray *PoolRealArray_to_mono_array(const PoolRealArray &p_array) { return ret; } -PoolRealArray mono_array_to_PoolRealArray(MonoArray *p_array) { - PoolRealArray ret; +PackedRealArray mono_array_to_PackedRealArray(MonoArray *p_array) { + PackedRealArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolRealArray::Write w = ret.write(); + real_t *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = mono_array_get(p_array, real_t, i); @@ -1068,8 +1068,8 @@ PoolRealArray mono_array_to_PoolRealArray(MonoArray *p_array) { return ret; } -MonoArray *PoolStringArray_to_mono_array(const PoolStringArray &p_array) { - PoolStringArray::Read r = p_array.read(); +MonoArray *PackedStringArray_to_mono_array(const PackedStringArray &p_array) { + const String *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(String), p_array.size()); @@ -1081,13 +1081,13 @@ MonoArray *PoolStringArray_to_mono_array(const PoolStringArray &p_array) { return ret; } -PoolStringArray mono_array_to_PoolStringArray(MonoArray *p_array) { - PoolStringArray ret; +PackedStringArray mono_array_to_PackedStringArray(MonoArray *p_array) { + PackedStringArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolStringArray::Write w = ret.write(); + String *w = ret.ptrw(); for (int i = 0; i < length; i++) { MonoString *elem = mono_array_get(p_array, MonoString *, i); @@ -1097,8 +1097,8 @@ PoolStringArray mono_array_to_PoolStringArray(MonoArray *p_array) { return ret; } -MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array) { - PoolColorArray::Read r = p_array.read(); +MonoArray *PackedColorArray_to_mono_array(const PackedColorArray &p_array) { + const Color *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(Color), p_array.size()); @@ -1110,13 +1110,13 @@ MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array) { return ret; } -PoolColorArray mono_array_to_PoolColorArray(MonoArray *p_array) { - PoolColorArray ret; +PackedColorArray mono_array_to_PackedColorArray(MonoArray *p_array) { + PackedColorArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolColorArray::Write w = ret.write(); + Color *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = MARSHALLED_IN(Color, (M_Color *)mono_array_addr_with_size(p_array, sizeof(M_Color), i)); @@ -1125,8 +1125,8 @@ PoolColorArray mono_array_to_PoolColorArray(MonoArray *p_array) { return ret; } -MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array) { - PoolVector2Array::Read r = p_array.read(); +MonoArray *PackedVector2Array_to_mono_array(const PackedVector2Array &p_array) { + const Vector2 *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(Vector2), p_array.size()); @@ -1138,13 +1138,13 @@ MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array) { return ret; } -PoolVector2Array mono_array_to_PoolVector2Array(MonoArray *p_array) { - PoolVector2Array ret; +PackedVector2Array mono_array_to_PackedVector2Array(MonoArray *p_array) { + PackedVector2Array ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolVector2Array::Write w = ret.write(); + Vector2 *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = MARSHALLED_IN(Vector2, (M_Vector2 *)mono_array_addr_with_size(p_array, sizeof(M_Vector2), i)); @@ -1153,8 +1153,8 @@ PoolVector2Array mono_array_to_PoolVector2Array(MonoArray *p_array) { return ret; } -MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array) { - PoolVector3Array::Read r = p_array.read(); +MonoArray *PackedVector3Array_to_mono_array(const PackedVector3Array &p_array) { + const Vector3 *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(Vector3), p_array.size()); @@ -1166,13 +1166,13 @@ MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array) { return ret; } -PoolVector3Array mono_array_to_PoolVector3Array(MonoArray *p_array) { - PoolVector3Array ret; +PackedVector3Array mono_array_to_PackedVector3Array(MonoArray *p_array) { + PackedVector3Array ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolVector3Array::Write w = ret.write(); + Vector3 *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = MARSHALLED_IN(Vector3, (M_Vector3 *)mono_array_addr_with_size(p_array, sizeof(M_Vector3), i)); diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index e662e7814e..d3527109ff 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -127,40 +127,40 @@ String mono_object_to_variant_string(MonoObject *p_obj, MonoException **r_exc); MonoArray *Array_to_mono_array(const Array &p_array); Array mono_array_to_Array(MonoArray *p_array); -// PoolIntArray +// PackedIntArray -MonoArray *PoolIntArray_to_mono_array(const PoolIntArray &p_array); -PoolIntArray mono_array_to_PoolIntArray(MonoArray *p_array); +MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array); +PackedIntArray mono_array_to_PackedIntArray(MonoArray *p_array); -// PoolByteArray +// PackedByteArray -MonoArray *PoolByteArray_to_mono_array(const PoolByteArray &p_array); -PoolByteArray mono_array_to_PoolByteArray(MonoArray *p_array); +MonoArray *PackedByteArray_to_mono_array(const PackedByteArray &p_array); +PackedByteArray mono_array_to_PackedByteArray(MonoArray *p_array); -// PoolRealArray +// PackedRealArray -MonoArray *PoolRealArray_to_mono_array(const PoolRealArray &p_array); -PoolRealArray mono_array_to_PoolRealArray(MonoArray *p_array); +MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array); +PackedRealArray mono_array_to_PackedRealArray(MonoArray *p_array); -// PoolStringArray +// PackedStringArray -MonoArray *PoolStringArray_to_mono_array(const PoolStringArray &p_array); -PoolStringArray mono_array_to_PoolStringArray(MonoArray *p_array); +MonoArray *PackedStringArray_to_mono_array(const PackedStringArray &p_array); +PackedStringArray mono_array_to_PackedStringArray(MonoArray *p_array); -// PoolColorArray +// PackedColorArray -MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array); -PoolColorArray mono_array_to_PoolColorArray(MonoArray *p_array); +MonoArray *PackedColorArray_to_mono_array(const PackedColorArray &p_array); +PackedColorArray mono_array_to_PackedColorArray(MonoArray *p_array); -// PoolVector2Array +// PackedVector2Array -MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array); -PoolVector2Array mono_array_to_PoolVector2Array(MonoArray *p_array); +MonoArray *PackedVector2Array_to_mono_array(const PackedVector2Array &p_array); +PackedVector2Array mono_array_to_PackedVector2Array(MonoArray *p_array); -// PoolVector3Array +// PackedVector3Array -MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array); -PoolVector3Array mono_array_to_PoolVector3Array(MonoArray *p_array); +MonoArray *PackedVector3Array_to_mono_array(const PackedVector3Array &p_array); +PackedVector3Array mono_array_to_PackedVector3Array(MonoArray *p_array); // Structures diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp index 911ac5c4a3..49c4fb3f73 100644 --- a/modules/mono/utils/string_utils.cpp +++ b/modules/mono/utils/string_utils.cpp @@ -162,22 +162,22 @@ String escape_csharp_keyword(const String &p_name) { #endif Error read_all_file_utf8(const String &p_path, String &r_content) { - PoolVector<uint8_t> sourcef; + Vector<uint8_t> sourcef; Error err; FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot open file '" + p_path + "'."); int len = f->get_len(); sourcef.resize(len + 1); - PoolVector<uint8_t>::Write w = sourcef.write(); - int r = f->get_buffer(w.ptr(), len); + uint8_t *w = sourcef.ptrw(); + int r = f->get_buffer(w, len); f->close(); memdelete(f); ERR_FAIL_COND_V(r != len, ERR_CANT_OPEN); w[len] = 0; String source; - if (source.parse_utf8((const char *)w.ptr())) { + if (source.parse_utf8((const char *)w)) { ERR_FAIL_V(ERR_INVALID_DATA); } |