mirror of
https://github.com/Relintai/gdnative_cpp.git
synced 2024-11-12 10:25:31 +01:00
More fixes.
This commit is contained in:
parent
663ee4de7a
commit
360d2828fa
@ -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("")
|
||||
|
@ -56,7 +56,7 @@ namespace detail {
|
||||
// They all inherit `_Wrapped`.
|
||||
template <class T>
|
||||
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<T>(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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user