diff options
-rw-r--r-- | doc/classes/CollisionObject.xml | 26 | ||||
-rw-r--r-- | doc/classes/CollisionObject2D.xml | 33 | ||||
-rw-r--r-- | modules/openssl/stream_peer_openssl.cpp | 60 | ||||
-rw-r--r-- | modules/openssl/stream_peer_openssl.h | 5 | ||||
-rw-r--r-- | platform/server/detect.py | 9 | ||||
-rw-r--r-- | platform/x11/detect.py | 9 |
6 files changed, 94 insertions, 48 deletions
diff --git a/doc/classes/CollisionObject.xml b/doc/classes/CollisionObject.xml index 98023a5898..64e9e07925 100644 --- a/doc/classes/CollisionObject.xml +++ b/doc/classes/CollisionObject.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="CollisionObject" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Base node for collision objects. </brief_description> <description> + CollisionObject is the base class for physics objects. It can hold any number of collision [Shape]\ s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods. </description> <tutorials> </tutorials> @@ -31,7 +33,7 @@ <argument index="0" name="owner" type="Object"> </argument> <description> - Creates new holder for the shapes. Argument is a [CollisionShape] node. It will return owner_id which usually you will want to save for later use. + Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference. </description> </method> <method name="get_capture_input_on_drag" qualifiers="const"> @@ -44,13 +46,14 @@ <return type="RID"> </return> <description> + Returns the object's [RID]. </description> </method> <method name="get_shape_owners"> <return type="Array"> </return> <description> - Shape owner is a node which is holding concrete shape resources. This method will return an array which is holding an integer numbers that are representing unique ID of each owner. You can use those ids when you are using others shape_owner methods. + Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument. </description> </method> <method name="is_ray_pickable" qualifiers="const"> @@ -65,6 +68,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> + If [code]true[/code] the shape owner and its shapes are disabled. </description> </method> <method name="remove_shape_owner"> @@ -73,6 +77,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> + Removes the given shape owner. </description> </method> <method name="set_capture_input_on_drag"> @@ -97,6 +102,7 @@ <argument index="0" name="shape_index" type="int"> </argument> <description> + Returns the [code]owner_id[/code] of the given shape. </description> </method> <method name="shape_owner_add_shape"> @@ -107,6 +113,7 @@ <argument index="1" name="shape" type="Shape"> </argument> <description> + Adds a [Shape] to the shape owner. </description> </method> <method name="shape_owner_clear_shapes"> @@ -115,7 +122,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> - Will remove all the shapes associated with given owner. + Removes all shapes from the shape owner. </description> </method> <method name="shape_owner_get_owner" qualifiers="const"> @@ -124,6 +131,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> + Returns the parent object of the given shape owner. </description> </method> <method name="shape_owner_get_shape" qualifiers="const"> @@ -134,7 +142,7 @@ <argument index="1" name="shape_id" type="int"> </argument> <description> - Will return a [Shape]. First argument owner_id is an integer that can be obtained from [method get_shape_owners]. Shape_id is a position of the shape inside owner; it's a value in range from 0 to [method shape_owner_get_shape_count]. + Returns the [Shape] with the given id from the given shape owner. </description> </method> <method name="shape_owner_get_shape_count" qualifiers="const"> @@ -143,7 +151,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> - Returns number of shapes to which given owner is associated to. + Returns the number of shapes the given shape owner contains. </description> </method> <method name="shape_owner_get_shape_index" qualifiers="const"> @@ -162,7 +170,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> - Will return [Transform] of an owner node. + Returns the shape owner's [Transform]. </description> </method> <method name="shape_owner_remove_shape"> @@ -173,7 +181,7 @@ <argument index="1" name="shape_id" type="int"> </argument> <description> - Removes related shape from the owner. + Removes a shape from the given shape owner. </description> </method> <method name="shape_owner_set_disabled"> @@ -184,6 +192,7 @@ <argument index="1" name="disabled" type="bool"> </argument> <description> + If [code]true[/code] disables the given shape owner. </description> </method> <method name="shape_owner_set_transform"> @@ -194,6 +203,7 @@ <argument index="1" name="transform" type="Transform"> </argument> <description> + Sets the [Transform] of the given shape owner. </description> </method> </methods> @@ -220,10 +230,12 @@ </signal> <signal name="mouse_entered"> <description> + Emitted when the mouse pointer enters any of this object's shapes. </description> </signal> <signal name="mouse_exited"> <description> + Emitted when the mouse pointer exits all this object's shapes. </description> </signal> </signals> diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml index db1412805f..52743bd37d 100644 --- a/doc/classes/CollisionObject2D.xml +++ b/doc/classes/CollisionObject2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Base node for 2D collisionables. + Base node for 2D collision objects. </brief_description> <description> - CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionShape2D] and/or [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API. + CollisionObject2D is the base class for 2D physics objects. It can hold any number of 2D collision [Shape2D]\ s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject2D can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods. </description> <tutorials> </tutorials> @@ -29,21 +29,21 @@ <argument index="0" name="owner" type="Object"> </argument> <description> - Creates new holder for the shapes. Argument is a [CollisionShape2D] node. It will return owner_id which usually you will want to save for later use. + Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference. </description> </method> <method name="get_rid" qualifiers="const"> <return type="RID"> </return> <description> - Return the RID of this object. + Returns the object's [RID]. </description> </method> <method name="get_shape_owners"> <return type="Array"> </return> <description> - Shape owner is a node which is holding concrete shape resources. This method will return an array which is holding an integer numbers that are representing unique ID of each owner. You can use those ids when you are using others shape_owner methods. + Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument. </description> </method> <method name="is_pickable" qualifiers="const"> @@ -59,6 +59,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> + If [code]true[/code] the shape owner and its shapes are disabled. </description> </method> <method name="is_shape_owner_one_way_collision_enabled" qualifiers="const"> @@ -75,6 +76,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> + Removes the given shape owner. </description> </method> <method name="set_pickable"> @@ -92,6 +94,7 @@ <argument index="0" name="shape_index" type="int"> </argument> <description> + Returns the [code]owner_id[/code] of the given shape. </description> </method> <method name="shape_owner_add_shape"> @@ -102,6 +105,7 @@ <argument index="1" name="shape" type="Shape2D"> </argument> <description> + Adds a [Shape2D] to the shape owner. </description> </method> <method name="shape_owner_clear_shapes"> @@ -110,7 +114,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> - Will remove all the shapes associated with given owner. + Removes all shapes from the shape owner. </description> </method> <method name="shape_owner_get_owner" qualifiers="const"> @@ -119,6 +123,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> + Returns the parent object of the given shape owner. </description> </method> <method name="shape_owner_get_shape" qualifiers="const"> @@ -129,7 +134,7 @@ <argument index="1" name="shape_id" type="int"> </argument> <description> - Will return a [Shape2D]. First argument owner_id is an integer that can be obtained from [method get_shape_owners]. Shape_id is a position of the shape inside owner; it's a value in range from 0 to [method shape_owner_get_shape_count]. + Returns the [Shape2D] with the given id from the given shape owner. </description> </method> <method name="shape_owner_get_shape_count" qualifiers="const"> @@ -138,7 +143,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> - Returns number of shapes to which given owner is associated to. + Returns the number of shapes the given shape owner contains. </description> </method> <method name="shape_owner_get_shape_index" qualifiers="const"> @@ -157,7 +162,7 @@ <argument index="0" name="owner_id" type="int"> </argument> <description> - Will return [Transform2D] of an owner node. + Returns the shape owner's [Transform2D]. </description> </method> <method name="shape_owner_remove_shape"> @@ -168,7 +173,7 @@ <argument index="1" name="shape_id" type="int"> </argument> <description> - Removes related shape from the owner. + Removes a shape from the given shape owner. </description> </method> <method name="shape_owner_set_disabled"> @@ -179,6 +184,7 @@ <argument index="1" name="disabled" type="bool"> </argument> <description> + If [code]true[/code] disables the given shape owner. </description> </method> <method name="shape_owner_set_one_way_collision"> @@ -199,11 +205,13 @@ <argument index="1" name="transform" type="Transform2D"> </argument> <description> + Sets the [Transform2D] of the given shape owner. </description> </method> </methods> <members> <member name="input_pickable" type="bool" setter="set_pickable" getter="is_pickable"> + If [code]true[/code] this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events. </member> </members> <signals> @@ -215,16 +223,17 @@ <argument index="2" name="shape_idx" type="int"> </argument> <description> + Emitted when an input event occurs and [code]input_pickable[/code] is [code]true[/code]. </description> </signal> <signal name="mouse_entered"> <description> - This event fires only once when the mouse pointer enters any shape of this object. + Emitted when the mouse pointer enters any of this object's shapes. </description> </signal> <signal name="mouse_exited"> <description> - This event fires only once when the mouse pointer exits all shapes of this object. + Emitted when the mouse pointer exits all this object's shapes. </description> </signal> </signals> diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index d40bf73883..c19bdc4214 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -29,6 +29,17 @@ /*************************************************************************/ #include "stream_peer_openssl.h" +// Compatibility with OpenSSL 1.1.0. +#if OPENSSL_VERSION_NUMBER >= 0x10100000L +#define BIO_set_num(b, n) +#else +#define BIO_set_num(b, n) ((b)->num = (n)) + +#define BIO_set_init(b, i) ((b)->init = (i)) +#define BIO_set_data(b, p) ((b)->ptr = (p)) +#define BIO_get_data(b) ((b)->ptr) +#endif + //hostname matching code from curl bool StreamPeerOpenSSL::_match_host_name(const char *name, const char *hostname) { @@ -157,10 +168,10 @@ int StreamPeerOpenSSL::_cert_verify_callback(X509_STORE_CTX *x509_ctx, void *arg } int StreamPeerOpenSSL::_bio_create(BIO *b) { - b->init = 1; - b->num = 0; - b->ptr = NULL; - b->flags = 0; + BIO_set_init(b, 1); + BIO_set_num(b, 0); + BIO_set_data(b, NULL); + BIO_clear_flags(b, ~0); return 1; } @@ -168,9 +179,9 @@ int StreamPeerOpenSSL::_bio_destroy(BIO *b) { if (b == NULL) return 0; - b->ptr = NULL; /* sb_tls_remove() will free it */ - b->init = 0; - b->flags = 0; + BIO_set_data(b, NULL); /* sb_tls_remove() will free it */ + BIO_set_init(b, 0); + BIO_clear_flags(b, ~0); return 1; } @@ -178,7 +189,7 @@ int StreamPeerOpenSSL::_bio_read(BIO *b, char *buf, int len) { if (buf == NULL || len <= 0) return 0; - StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)b->ptr; + StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)BIO_get_data(b); ERR_FAIL_COND_V(sp == NULL, 0); @@ -212,7 +223,7 @@ int StreamPeerOpenSSL::_bio_write(BIO *b, const char *buf, int len) { if (buf == NULL || len <= 0) return 0; - StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)b->ptr; + StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)BIO_get_data(b); ERR_FAIL_COND_V(sp == NULL, 0); @@ -258,6 +269,26 @@ int StreamPeerOpenSSL::_bio_puts(BIO *b, const char *str) { return _bio_write(b, str, strlen(str)); } +#if OPENSSL_VERSION_NUMBER >= 0x10100000L +BIO_METHOD *StreamPeerOpenSSL::_bio_method = NULL; + +BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() { + if (_bio_method) // already initialized. + return _bio_method; + + /* it's a source/sink BIO */ + _bio_method = BIO_meth_new(100 | 0x400, "streampeer glue"); + BIO_meth_set_write(_bio_method, _bio_write); + BIO_meth_set_read(_bio_method, _bio_read); + BIO_meth_set_puts(_bio_method, _bio_puts); + BIO_meth_set_gets(_bio_method, _bio_gets); + BIO_meth_set_ctrl(_bio_method, _bio_ctrl); + BIO_meth_set_create(_bio_method, _bio_create); + BIO_meth_set_destroy(_bio_method, _bio_destroy); + + return _bio_method; +} +#else BIO_METHOD StreamPeerOpenSSL::_bio_method = { /* it's a source/sink BIO */ (100 | 0x400), @@ -271,6 +302,11 @@ BIO_METHOD StreamPeerOpenSSL::_bio_method = { _bio_destroy }; +BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() { + return &_bio_method; +} +#endif + Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String &p_for_hostname) { if (connected) @@ -330,8 +366,8 @@ Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida } ssl = SSL_new(ctx); - bio = BIO_new(&_bio_method); - bio->ptr = this; + bio = BIO_new(_get_bio_method()); + BIO_set_data(bio, this); SSL_set_bio(ssl, bio, bio); if (p_for_hostname != String()) { @@ -532,7 +568,9 @@ void StreamPeerOpenSSL::initialize_ssl() { load_certs_func = _load_certs; _create = _create_func; +#if OPENSSL_VERSION_NUMBER < 0x10100000L CRYPTO_malloc_init(); // Initialize malloc, free, etc for OpenSSL's use +#endif SSL_library_init(); // Initialize OpenSSL's SSL libraries SSL_load_error_strings(); // Load SSL error strings ERR_load_BIO_strings(); // Load BIO error strings diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h index 1e445ef681..535114058d 100644 --- a/modules/openssl/stream_peer_openssl.h +++ b/modules/openssl/stream_peer_openssl.h @@ -53,7 +53,12 @@ private: static int _bio_gets(BIO *b, char *buf, int len); static int _bio_puts(BIO *b, const char *str); +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + static BIO_METHOD *_bio_method; +#else static BIO_METHOD _bio_method; +#endif + static BIO_METHOD *_get_bio_method(); static bool _match_host_name(const char *name, const char *hostname); static Error _match_common_name(const char *hostname, const X509 *server_cert); diff --git a/platform/server/detect.py b/platform/server/detect.py index 60c054713e..5c13297bc6 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -65,15 +65,6 @@ def configure(env): # FIXME: Check for existence of the libs before parsing their flags with pkg-config if (env['builtin_openssl'] == 'no'): - # Currently not compatible with OpenSSL 1.1.0+ - # https://github.com/godotengine/godot/issues/8624 - import subprocess - openssl_version = subprocess.check_output(['pkg-config', 'openssl', '--modversion']).strip('\n') - if (openssl_version >= "1.1.0"): - print("Error: Found system-installed OpenSSL %s, currently only supporting version 1.0.x." % openssl_version) - print("Aborting.. You can compile with 'builtin_openssl=yes' to use the bundled version.\n") - sys.exit(255) - env.ParseConfig('pkg-config openssl --cflags --libs') if (env['builtin_libwebp'] == 'no'): diff --git a/platform/x11/detect.py b/platform/x11/detect.py index b47d943174..591398dd6d 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -134,15 +134,6 @@ def configure(env): # FIXME: Check for existence of the libs before parsing their flags with pkg-config if (env['builtin_openssl'] == 'no'): - # Currently not compatible with OpenSSL 1.1.0+ - # https://github.com/godotengine/godot/issues/8624 - import subprocess - openssl_version = subprocess.check_output(['pkg-config', 'openssl', '--modversion']).strip('\n') - if (openssl_version >= "1.1.0"): - print("Error: Found system-installed OpenSSL %s, currently only supporting version 1.0.x." % openssl_version) - print("Aborting.. You can compile with 'builtin_openssl=yes' to use the bundled version.\n") - sys.exit(255) - env.ParseConfig('pkg-config openssl --cflags --libs') if (env['builtin_libwebp'] == 'no'): |