diff --git a/binding_generator.py b/binding_generator.py index 81b2b9d..781c8f4 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -244,7 +244,7 @@ def generate_class_header(used_classes, c, use_template_get_node): ) source.append( - "\tstatic inline Object *___get_from_variant(Variant a) { pandemonium_object *o = (pandemonium_object*) a; return (o) ? (Object *) godot::nativescript_1_1_api->pandemonium_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, o) : nullptr; }" + "\tstatic inline Object *___get_from_variant(Variant a) { pandemonium_object *o = (pandemonium_object*) a; return (o) ? (Object *) godot::nativescript_api->pandemonium_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, o) : nullptr; }" ) enum_values = [] @@ -465,7 +465,7 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node source.append("\tpandemonium_string_name class_name;") source.append('\tgodot::api->pandemonium_string_name_new_data(&class_name, "' + c["name"] + '");') - source.append("\t_detail_class_tag = godot::core_1_2_api->pandemonium_get_class_tag(&class_name);") + source.append("\t_detail_class_tag = godot::api->pandemonium_get_class_tag(&class_name);") source.append("\tgodot::api->pandemonium_string_name_destroy(&class_name);") source.append("}") @@ -477,7 +477,7 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node source.append( "\treturn (" + class_name - + ' *) godot::nativescript_1_1_api->pandemonium_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, godot::api->pandemonium_get_class_constructor((char *)"' + + ' *) godot::nativescript_api->pandemonium_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, godot::api->pandemonium_get_class_constructor((char *)"' + c["name"] + '")());' ) @@ -739,7 +739,7 @@ def generate_icall_header(icalls): if is_class_type(ret_type): source.append("\tif (ret) {") source.append( - "\t\treturn (Object *) godot::nativescript_1_1_api->pandemonium_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, ret);" + "\t\treturn (Object *) godot::nativescript_api->pandemonium_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, ret);" ) source.append("\t}") source.append("") diff --git a/include/core/Godot.hpp b/include/core/Godot.hpp index fe6a7bd..c77b5f2 100644 --- a/include/core/Godot.hpp +++ b/include/core/Godot.hpp @@ -56,7 +56,7 @@ namespace detail { // They all inherit `_Wrapped`. template T *get_wrapper(pandemonium_object *obj) { - return (T *)godot::nativescript_1_1_api->pandemonium_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, obj); + return (T *)godot::nativescript_api->pandemonium_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, obj); } // Custom class instances are not obtainable by just casting the pointer to the base class they inherit, @@ -210,7 +210,7 @@ void register_class() { godot::nativescript_api->pandemonium_nativescript_register_class(godot::_RegisterState::nativescript_handle, T::___get_class_name(), T::___get_base_class_name(), create, destroy); - godot::nativescript_1_1_api->pandemonium_nativescript_set_type_tag(godot::_RegisterState::nativescript_handle, + godot::nativescript_api->pandemonium_nativescript_set_type_tag(godot::_RegisterState::nativescript_handle, T::___get_class_name(), (const void *)T::___get_id()); T::_register_methods(); @@ -231,7 +231,7 @@ void register_tool_class() { godot::nativescript_api->pandemonium_nativescript_register_tool_class(godot::_RegisterState::nativescript_handle, T::___get_class_name(), T::___get_base_class_name(), create, destroy); - godot::nativescript_1_1_api->pandemonium_nativescript_set_type_tag(godot::_RegisterState::nativescript_handle, + godot::nativescript_api->pandemonium_nativescript_set_type_tag(godot::_RegisterState::nativescript_handle, T::___get_class_name(), (const void *)T::___get_id()); T::_register_methods(); @@ -590,7 +590,7 @@ T *Object::cast_to(const Object *obj) { return nullptr; if (T::___CLASS_IS_SCRIPT) { - size_t have_tag = (size_t)godot::nativescript_1_1_api->pandemonium_nativescript_get_type_tag(obj->_owner); + size_t have_tag = (size_t)godot::nativescript_api->pandemonium_nativescript_get_type_tag(obj->_owner); if (have_tag) { if (!godot::_TagDB::is_type_known((size_t)have_tag)) { have_tag = 0; @@ -605,7 +605,7 @@ T *Object::cast_to(const Object *obj) { return detail::get_custom_class_instance(obj); } } else { - if (godot::core_1_2_api->pandemonium_object_cast_to(obj->_owner, (void *)T::___get_id())) { + if (godot::api->pandemonium_object_cast_to(obj->_owner, (void *)T::___get_id())) { return (T *)obj; } } diff --git a/include/core/GodotGlobal.hpp b/include/core/GodotGlobal.hpp index afc02e4..2ba3e3d 100644 --- a/include/core/GodotGlobal.hpp +++ b/include/core/GodotGlobal.hpp @@ -37,18 +37,13 @@ namespace godot { -extern "C" const pandemonium_gdnative_core_api_struct *api; -extern "C" const pandemonium_gdnative_core_1_1_api_struct *core_1_1_api; -extern "C" const pandemonium_gdnative_core_1_2_api_struct *core_1_2_api; +extern "C" const pandemonium_gdnative_api_struct *api; extern "C" const pandemonium_gdnative_ext_nativescript_api_struct *nativescript_api; -extern "C" const pandemonium_gdnative_ext_nativescript_1_1_api_struct *nativescript_1_1_api; extern "C" const pandemonium_gdnative_ext_pluginscript_api_struct *pluginscript_api; extern "C" const pandemonium_gdnative_ext_android_api_struct *android_api; -extern "C" const pandemonium_gdnative_ext_arvr_api_struct *arvr_api; extern "C" const pandemonium_gdnative_ext_videodecoder_api_struct *videodecoder_api; extern "C" const pandemonium_gdnative_ext_net_api_struct *net_api; -extern "C" const pandemonium_gdnative_ext_net_3_2_api_struct *net_3_2_api; extern "C" const void *gdnlib; diff --git a/src/core/Array.cpp b/src/core/Array.cpp index 4b5b7a4..a5853c1 100644 --- a/src/core/Array.cpp +++ b/src/core/Array.cpp @@ -201,22 +201,22 @@ int Array::bsearch_custom(const Variant &value, const Object *obj, } Array Array::duplicate(const bool deep) const { - pandemonium_array arr = godot::core_1_1_api->pandemonium_array_duplicate(&_pandemonium_array, deep); + pandemonium_array arr = godot::api->pandemonium_array_duplicate(&_pandemonium_array, deep); return Array(arr); } Variant Array::max() const { - pandemonium_variant v = godot::core_1_1_api->pandemonium_array_max(&_pandemonium_array); + pandemonium_variant v = godot::api->pandemonium_array_max(&_pandemonium_array); return Variant(v); } Variant Array::min() const { - pandemonium_variant v = godot::core_1_1_api->pandemonium_array_min(&_pandemonium_array); + pandemonium_variant v = godot::api->pandemonium_array_min(&_pandemonium_array); return Variant(v); } void Array::shuffle() { - godot::core_1_1_api->pandemonium_array_shuffle(&_pandemonium_array); + godot::api->pandemonium_array_shuffle(&_pandemonium_array); } Array::~Array() { diff --git a/src/core/GodotGlobal.cpp b/src/core/GodotGlobal.cpp index 92ca1e4..b9b7a52 100644 --- a/src/core/GodotGlobal.cpp +++ b/src/core/GodotGlobal.cpp @@ -55,18 +55,13 @@ namespace godot { void *_RegisterState::nativescript_handle; int _RegisterState::language_index; -const pandemonium_gdnative_core_api_struct *api = nullptr; -const pandemonium_gdnative_core_1_1_api_struct *core_1_1_api = nullptr; -const pandemonium_gdnative_core_1_2_api_struct *core_1_2_api = nullptr; +const pandemonium_gdnative_api_struct *api = nullptr; const pandemonium_gdnative_ext_nativescript_api_struct *nativescript_api = nullptr; -const pandemonium_gdnative_ext_nativescript_1_1_api_struct *nativescript_1_1_api = nullptr; const pandemonium_gdnative_ext_pluginscript_api_struct *pluginscript_api = nullptr; const pandemonium_gdnative_ext_android_api_struct *android_api = nullptr; -const pandemonium_gdnative_ext_arvr_api_struct *arvr_api = nullptr; const pandemonium_gdnative_ext_videodecoder_api_struct *videodecoder_api = nullptr; const pandemonium_gdnative_ext_net_api_struct *net_api = nullptr; -const pandemonium_gdnative_ext_net_3_2_api_struct *net_3_2_api = nullptr; const void *gdnlib = NULL; @@ -121,6 +116,7 @@ void Godot::gdnative_init(pandemonium_gdnative_init_options *options) { const pandemonium_gdnative_api_struct *core_extension = godot::api->next; + /* while (core_extension) { if (core_extension->version.major == 1 && core_extension->version.minor == 1) { godot::core_1_1_api = (const pandemonium_gdnative_core_1_1_api_struct *)core_extension; @@ -129,6 +125,7 @@ void Godot::gdnative_init(pandemonium_gdnative_init_options *options) { } core_extension = core_extension->next; } + */ // now find our extensions for (int i = 0; i < godot::api->num_extensions; i++) { @@ -136,15 +133,17 @@ void Godot::gdnative_init(pandemonium_gdnative_init_options *options) { case GDNATIVE_EXT_NATIVESCRIPT: { godot::nativescript_api = (const pandemonium_gdnative_ext_nativescript_api_struct *)godot::api->extensions[i]; + /* const pandemonium_gdnative_api_struct *extension = godot::nativescript_api->next; while (extension) { if (extension->version.major == 1 && extension->version.minor == 1) { - godot::nativescript_1_1_api = (const pandemonium_gdnative_ext_nativescript_1_1_api_struct *)extension; + //godot::nativescript_1_1_api = (const pandemonium_gdnative_ext_nativescript_1_1_api_struct *)extension; } extension = extension->next; } + */ } break; case GDNATIVE_EXT_PLUGINSCRIPT: { godot::pluginscript_api = (const pandemonium_gdnative_ext_pluginscript_api_struct *)godot::api->extensions[i]; @@ -152,15 +151,13 @@ void Godot::gdnative_init(pandemonium_gdnative_init_options *options) { case GDNATIVE_EXT_ANDROID: { godot::android_api = (const pandemonium_gdnative_ext_android_api_struct *)godot::api->extensions[i]; } break; - case GDNATIVE_EXT_ARVR: { - godot::arvr_api = (const pandemonium_gdnative_ext_arvr_api_struct *)godot::api->extensions[i]; - } break; case GDNATIVE_EXT_VIDEODECODER: { godot::videodecoder_api = (const pandemonium_gdnative_ext_videodecoder_api_struct *)godot::api->extensions[i]; } break; case GDNATIVE_EXT_NET: { godot::net_api = (const pandemonium_gdnative_ext_net_api_struct *)godot::api->extensions[i]; + /* const pandemonium_gdnative_api_struct *extension = godot::net_api->next; while (extension) { @@ -170,6 +167,7 @@ void Godot::gdnative_init(pandemonium_gdnative_init_options *options) { extension = extension->next; } + */ } break; default: @@ -182,7 +180,7 @@ void Godot::gdnative_init(pandemonium_gdnative_init_options *options) { binding_funcs.alloc_instance_binding_data = wrapper_create; binding_funcs.free_instance_binding_data = wrapper_destroy; - godot::_RegisterState::language_index = godot::nativescript_1_1_api->pandemonium_nativescript_register_instance_binding_data_functions(binding_funcs); + godot::_RegisterState::language_index = godot::nativescript_api->pandemonium_nativescript_register_instance_binding_data_functions(binding_funcs); // register these now ___register_types(); @@ -194,7 +192,7 @@ void Godot::gdnative_terminate(pandemonium_gdnative_terminate_options *options) } void Godot::gdnative_profiling_add_data(const char *p_signature, uint64_t p_time) { - godot::nativescript_1_1_api->pandemonium_nativescript_profiling_add_data(p_signature, p_time); + godot::nativescript_api->pandemonium_nativescript_profiling_add_data(p_signature, p_time); } void Godot::nativescript_init(void *handle) { @@ -202,7 +200,7 @@ void Godot::nativescript_init(void *handle) { } void Godot::nativescript_terminate(void *handle) { - godot::nativescript_1_1_api->pandemonium_nativescript_unregister_instance_binding_data_functions(godot::_RegisterState::language_index); + godot::nativescript_api->pandemonium_nativescript_unregister_instance_binding_data_functions(godot::_RegisterState::language_index); } } // namespace godot diff --git a/src/core/NodePath.cpp b/src/core/NodePath.cpp index ef75bd1..fea14f1 100644 --- a/src/core/NodePath.cpp +++ b/src/core/NodePath.cpp @@ -82,7 +82,7 @@ bool NodePath::is_empty() const { } NodePath NodePath::get_as_property_path() const { - pandemonium_node_path path = godot::core_1_1_api->pandemonium_node_path_get_as_property_path(&_node_path); + pandemonium_node_path path = godot::api->pandemonium_node_path_get_as_property_path(&_node_path); return NodePath(path); } String NodePath::get_concatenated_subnames() const { diff --git a/src/core/String.cpp b/src/core/String.cpp index 7af3ab0..d459bb2 100644 --- a/src/core/String.cpp +++ b/src/core/String.cpp @@ -494,28 +494,28 @@ signed char String::naturalnocasecmp_to(String p_str) const { } String String::dedent() const { - pandemonium_string s = godot::core_1_1_api->pandemonium_string_dedent(&_pandemonium_string); + pandemonium_string s = godot::api->pandemonium_string_dedent(&_pandemonium_string); return String(s); } PoolStringArray String::rsplit(const String &divisor, const bool allow_empty, const int maxsplit) const { pandemonium_pool_string_array arr = - godot::core_1_1_api->pandemonium_string_rsplit(&_pandemonium_string, &divisor._pandemonium_string, allow_empty, maxsplit); + godot::api->pandemonium_string_rsplit(&_pandemonium_string, &divisor._pandemonium_string, allow_empty, maxsplit); return PoolStringArray(arr); } String String::rstrip(const String &chars) const { - pandemonium_string s = godot::core_1_1_api->pandemonium_string_rstrip(&_pandemonium_string, &chars._pandemonium_string); + pandemonium_string s = godot::api->pandemonium_string_rstrip(&_pandemonium_string, &chars._pandemonium_string); return String(s); } String String::trim_prefix(const String &prefix) const { - pandemonium_string s = godot::core_1_1_api->pandemonium_string_trim_prefix(&_pandemonium_string, &prefix._pandemonium_string); + pandemonium_string s = godot::api->pandemonium_string_trim_prefix(&_pandemonium_string, &prefix._pandemonium_string); return String(s); } String String::trim_suffix(const String &suffix) const { - pandemonium_string s = godot::core_1_1_api->pandemonium_string_trim_suffix(&_pandemonium_string, &suffix._pandemonium_string); + pandemonium_string s = godot::api->pandemonium_string_trim_suffix(&_pandemonium_string, &suffix._pandemonium_string); return String(s); } diff --git a/src/core/TagDB.cpp b/src/core/TagDB.cpp index fbc871a..ac11af8 100644 --- a/src/core/TagDB.cpp +++ b/src/core/TagDB.cpp @@ -52,7 +52,7 @@ bool is_type_known(size_t type_tag) { } void register_global_type(const char *name, size_t type_tag, size_t base_type_tag) { - godot::nativescript_1_1_api->pandemonium_nativescript_set_global_type_tag(godot::_RegisterState::language_index, name, (const void *)type_tag); + godot::nativescript_api->pandemonium_nativescript_set_global_type_tag(godot::_RegisterState::language_index, name, (const void *)type_tag); register_type(type_tag, base_type_tag); }