From 518a6912312b73c26fc16a7ba71419d79a7a8fb5 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 23 Jan 2018 19:49:50 +0200 Subject: [PATCH] Mono: Allow loading `mscorlib` from resources. (cherry picked from commit b3ddf12fb1774d63ac47a8d9890bf017b67d879e) --- core/os/file_access.cpp | 3 +++ modules/mono/mono_gd/gd_mono_assembly.cpp | 17 +++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 368b4ad09de..033b4b12b9e 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -479,6 +479,9 @@ void FileAccess::store_double(double p_dest) { uint64_t FileAccess::get_modified_time(const String &p_file) { + if (PackedData::get_singleton() && !PackedData::get_singleton()->is_disabled() && PackedData::get_singleton()->has_path(p_file)) + return 0; + FileAccess *fa = create_for_path(p_file); ERR_FAIL_COND_V(!fa, 0); diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp index 9d3bee21769..2827f4ea561 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.cpp +++ b/modules/mono/mono_gd/gd_mono_assembly.cpp @@ -143,11 +143,10 @@ MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **asse if (has_extension ? name == "mscorlib.dll" : name == "mscorlib") { GDMonoAssembly **stored_assembly = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name); - if (stored_assembly) - return (*stored_assembly)->get_assembly(); + if (stored_assembly) return (*stored_assembly)->get_assembly(); String path; - GDMonoAssembly *res = NULL; + MonoAssembly *res = NULL; for (int i = 0; i < search_dirs.size(); i++) { const String &search_dir = search_dirs[i]; @@ -155,21 +154,19 @@ MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **asse if (has_extension) { path = search_dir.plus_file(name); if (FileAccess::exists(path)) { - res = _load_assembly_from(name.get_basename(), path, refonly); - if (res != NULL) - break; + res = _load_assembly_from(name.get_basename(), path); + break; } } else { path = search_dir.plus_file(name + ".dll"); if (FileAccess::exists(path)) { - res = _load_assembly_from(name, path, refonly); - if (res != NULL) - break; + res = _load_assembly_from(name, path); + break; } } } - return res ? res->get_assembly() : NULL; + if (res) return res; } return NULL;