aboutsummaryrefslogtreecommitdiff
path: root/modules/gdnative/register_types.cpp
diff options
context:
space:
mode:
authorThomas Herzog2017-11-14 15:34:07 +0100
committerGitHub2017-11-14 15:34:07 +0100
commitbd2b1a62d9d6f97ebfa7457ab3e84ae839531bdb (patch)
tree2594fc77cd508c9b570c97b9f47e7ed8a45781dd /modules/gdnative/register_types.cpp
parentf83b73be132d0e75272fd47899bc2d24d1285a39 (diff)
parentd82942e1c5716961bf921de7795becfa0cd05807 (diff)
downloadgodot-bd2b1a62d9d6f97ebfa7457ab3e84ae839531bdb.tar.gz
godot-bd2b1a62d9d6f97ebfa7457ab3e84ae839531bdb.tar.zst
godot-bd2b1a62d9d6f97ebfa7457ab3e84ae839531bdb.zip
Diffstat (limited to 'modules/gdnative/register_types.cpp')
-rw-r--r--modules/gdnative/register_types.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 19a62b9c4..ca69f2eca 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -81,7 +81,7 @@ Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
}
Ref<GDNativeLibrary> lib = ResourceLoader::load(p_dir->get_file_path(i));
- if (lib.is_valid() && lib->is_singleton_gdnative()) {
+ if (lib.is_valid() && lib->is_singleton()) {
file_paths.insert(p_dir->get_file_path(i));
}
}
@@ -141,6 +141,9 @@ GDNativeCallRegistry *GDNativeCallRegistry::singleton;
Vector<Ref<GDNative> > singleton_gdnatives;
+GDNativeLibraryResourceLoader *resource_loader_gdnlib = NULL;
+GDNativeLibraryResourceSaver *resource_saver_gdnlib = NULL;
+
void register_gdnative_types() {
#ifdef TOOLS_ENABLED
@@ -153,6 +156,12 @@ void register_gdnative_types() {
ClassDB::register_class<GDNativeLibrary>();
ClassDB::register_class<GDNative>();
+ resource_loader_gdnlib = memnew(GDNativeLibraryResourceLoader);
+ resource_saver_gdnlib = memnew(GDNativeLibraryResourceSaver);
+
+ ResourceLoader::add_resource_format_loader(resource_loader_gdnlib);
+ ResourceSaver::add_resource_format_saver(resource_saver_gdnlib);
+
GDNativeCallRegistry::singleton = memnew(GDNativeCallRegistry);
GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall);
@@ -185,11 +194,11 @@ void register_gdnative_types() {
void *proc_ptr;
Error err = singleton_gdnatives[i]->get_symbol(
- "godot_gdnative_singleton",
+ lib->get_symbol_prefix() + "gdnative_singleton",
proc_ptr);
if (err != OK) {
- ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton_gdnatives[i]->get_library()->get_active_library_path()) + "\" found").utf8().get_data());
+ ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton_gdnatives[i]->get_library()->get_current_library_path()) + "\" found").utf8().get_data());
} else {
((void (*)())proc_ptr)();
}
@@ -224,6 +233,9 @@ void unregister_gdnative_types() {
}
#endif
+ memdelete(resource_loader_gdnlib);
+ memdelete(resource_saver_gdnlib);
+
// This is for printing out the sizes of the core types
/*