summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/crypto/SCsub1
-rw-r--r--core/crypto/crypto_core.cpp3
-rw-r--r--core/extension/gdextension.cpp61
-rw-r--r--core/extension/gdextension.h7
-rw-r--r--core/os/os.h2
-rw-r--r--core/templates/command_queue_mt.h13
6 files changed, 17 insertions, 70 deletions
diff --git a/core/crypto/SCsub b/core/crypto/SCsub
index a6defdfdab..8cff3cf679 100644
--- a/core/crypto/SCsub
+++ b/core/crypto/SCsub
@@ -34,6 +34,7 @@ if not has_module:
"constant_time.c",
"ctr_drbg.c",
"entropy.c",
+ "md.c",
"md5.c",
"sha1.c",
"sha256.c",
diff --git a/core/crypto/crypto_core.cpp b/core/crypto/crypto_core.cpp
index 17b34c08e2..69a83284cc 100644
--- a/core/crypto/crypto_core.cpp
+++ b/core/crypto/crypto_core.cpp
@@ -39,6 +39,9 @@
#include <mbedtls/md5.h>
#include <mbedtls/sha1.h>
#include <mbedtls/sha256.h>
+#if MBEDTLS_VERSION_MAJOR >= 3
+#include <mbedtls/compat-2.x.h>
+#endif
// RandomGenerator
CryptoCore::RandomGenerator::RandomGenerator() {
diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp
index 0ed4c3380c..546c40e9cb 100644
--- a/core/extension/gdextension.cpp
+++ b/core/extension/gdextension.cpp
@@ -729,53 +729,18 @@ GDExtensionInterfaceFunctionPtr GDExtension::get_interface_function(const String
Error GDExtension::open_library(const String &p_path, const String &p_entry_symbol) {
String abs_path = ProjectSettings::get_singleton()->globalize_path(p_path);
-#if defined(WINDOWS_ENABLED) && defined(TOOLS_ENABLED)
- // If running on the editor on Windows, we copy the library and open the copy.
- // This is so the original file isn't locked and can be updated by a compiler.
- bool library_copied = false;
- if (Engine::get_singleton()->is_editor_hint()) {
- if (!FileAccess::exists(abs_path)) {
- ERR_PRINT("GDExtension library not found: " + abs_path);
- return ERR_FILE_NOT_FOUND;
- }
-
- // Copy the file to the same directory as the original with a prefix in the name.
- // This is so relative path to dependencies are satisfied.
- String copy_path = abs_path.get_base_dir().path_join("~" + abs_path.get_file());
+ String actual_lib_path;
+ Error err = OS::get_singleton()->open_dynamic_library(abs_path, library, true, &actual_lib_path, Engine::get_singleton()->is_editor_hint());
- // If there's a left-over copy (possibly from a crash) then delete it first.
- if (FileAccess::exists(copy_path)) {
- DirAccess::remove_absolute(copy_path);
- }
-
- Error copy_err = DirAccess::copy_absolute(abs_path, copy_path);
- if (copy_err) {
- ERR_PRINT("Error copying GDExtension library: " + abs_path);
- return ERR_CANT_CREATE;
- }
- FileAccess::set_hidden_attribute(copy_path, true);
- library_copied = true;
-
- // Save the copied path so it can be deleted later.
- temp_lib_path = copy_path;
-
- // Use the copy to open the library.
- abs_path = copy_path;
+ if (actual_lib_path.get_file() != abs_path.get_file()) {
+ // If temporary files are generated, let's change the library path to point at the original,
+ // because that's what we want to check to see if it's changed.
+ library_path = actual_lib_path.get_base_dir().path_join(p_path.get_file());
}
-#endif
- Error err = OS::get_singleton()->open_dynamic_library(abs_path, library, true, &library_path);
ERR_FAIL_COND_V_MSG(err == ERR_FILE_NOT_FOUND, err, "GDExtension dynamic library not found: " + abs_path);
ERR_FAIL_COND_V_MSG(err != OK, err, "Can't open GDExtension dynamic library: " + abs_path);
-#if defined(WINDOWS_ENABLED) && defined(TOOLS_ENABLED)
- // If we copied the file, let's change the library path to point at the original,
- // because that's what we want to check to see if it's changed.
- if (library_copied) {
- library_path = library_path.get_base_dir() + "\\" + p_path.get_file();
- }
-#endif
-
void *entry_funcptr = nullptr;
err = OS::get_singleton()->get_dynamic_library_symbol_handle(library, p_entry_symbol, entry_funcptr, false);
@@ -803,13 +768,6 @@ void GDExtension::close_library() {
ERR_FAIL_NULL(library);
OS::get_singleton()->close_dynamic_library(library);
-#if defined(TOOLS_ENABLED) && defined(WINDOWS_ENABLED)
- // Delete temporary copy of library if it exists.
- if (!temp_lib_path.is_empty() && Engine::get_singleton()->is_editor_hint()) {
- DirAccess::remove_absolute(temp_lib_path);
- }
-#endif
-
library = nullptr;
class_icon_paths.clear();
@@ -1014,13 +972,6 @@ Error GDExtensionResourceLoader::load_gdextension_resource(const String &p_path,
err = p_extension->open_library(is_static_library ? String() : library_path, entry_symbol);
if (err != OK) {
-#if defined(WINDOWS_ENABLED) && defined(TOOLS_ENABLED)
- // If the DLL fails to load, make sure that temporary DLL copies are cleaned up.
- if (Engine::get_singleton()->is_editor_hint()) {
- DirAccess::remove_absolute(p_extension->get_temp_library_path());
- }
-#endif
-
// Unreference the extension so that this loading can be considered a failure.
p_extension.unref();
diff --git a/core/extension/gdextension.h b/core/extension/gdextension.h
index 2d0cb6a5ba..1f48edecf7 100644
--- a/core/extension/gdextension.h
+++ b/core/extension/gdextension.h
@@ -47,9 +47,6 @@ class GDExtension : public Resource {
void *library = nullptr; // pointer if valid,
String library_path;
-#if defined(WINDOWS_ENABLED) && defined(TOOLS_ENABLED)
- String temp_lib_path;
-#endif
bool reloadable = false;
struct Extension {
@@ -130,10 +127,6 @@ public:
Error open_library(const String &p_path, const String &p_entry_symbol);
void close_library();
-#if defined(WINDOWS_ENABLED) && defined(TOOLS_ENABLED)
- String get_temp_library_path() const { return temp_lib_path; }
-#endif
-
enum InitializationLevel {
INITIALIZATION_LEVEL_CORE = GDEXTENSION_INITIALIZATION_CORE,
INITIALIZATION_LEVEL_SERVERS = GDEXTENSION_INITIALIZATION_SERVERS,
diff --git a/core/os/os.h b/core/os/os.h
index 370e724c53..3827bb273a 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -153,7 +153,7 @@ public:
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
- virtual Error open_dynamic_library(const String &p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) { return ERR_UNAVAILABLE; }
+ virtual Error open_dynamic_library(const String &p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr, bool p_generate_temp_files = false) { return ERR_UNAVAILABLE; }
virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; }
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String &p_name, void *&p_symbol_handle, bool p_optional = false) { return ERR_UNAVAILABLE; }
diff --git a/core/templates/command_queue_mt.h b/core/templates/command_queue_mt.h
index 4056119851..e26f11d28a 100644
--- a/core/templates/command_queue_mt.h
+++ b/core/templates/command_queue_mt.h
@@ -364,6 +364,12 @@ class CommandQueueMT {
void _flush() {
lock();
+ if (unlikely(flush_read_ptr)) {
+ // Re-entrant call.
+ unlock();
+ return;
+ }
+
WorkerThreadPool::thread_enter_command_queue_mt_flush(this);
while (flush_read_ptr < command_mem.size()) {
uint64_t size = *(uint64_t *)&command_mem[flush_read_ptr];
@@ -376,13 +382,6 @@ class CommandQueueMT {
sync_sem->sem.post(); // Release in case it needs sync/ret.
}
- if (unlikely(flush_read_ptr == 0)) {
- // A reentrant call flushed.
- DEV_ASSERT(command_mem.is_empty());
- unlock();
- return;
- }
-
flush_read_ptr += size;
}
WorkerThreadPool::thread_exit_command_queue_mt_flush();