Mono: Allow loading `mscorlib` from resources.

(cherry picked from commit b3ddf12fb1)
This commit is contained in:
bruvzg 2018-01-23 19:49:50 +02:00 committed by Hein-Pieter van Braam
parent e8bfc09b81
commit 518a691231
2 changed files with 10 additions and 10 deletions

View File

@ -479,6 +479,9 @@ void FileAccess::store_double(double p_dest) {
uint64_t FileAccess::get_modified_time(const String &p_file) { 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); FileAccess *fa = create_for_path(p_file);
ERR_FAIL_COND_V(!fa, 0); ERR_FAIL_COND_V(!fa, 0);

View File

@ -143,11 +143,10 @@ MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **asse
if (has_extension ? name == "mscorlib.dll" : name == "mscorlib") { if (has_extension ? name == "mscorlib.dll" : name == "mscorlib") {
GDMonoAssembly **stored_assembly = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name); GDMonoAssembly **stored_assembly = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name);
if (stored_assembly) if (stored_assembly) return (*stored_assembly)->get_assembly();
return (*stored_assembly)->get_assembly();
String path; String path;
GDMonoAssembly *res = NULL; MonoAssembly *res = NULL;
for (int i = 0; i < search_dirs.size(); i++) { for (int i = 0; i < search_dirs.size(); i++) {
const String &search_dir = search_dirs[i]; const String &search_dir = search_dirs[i];
@ -155,21 +154,19 @@ MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **asse
if (has_extension) { if (has_extension) {
path = search_dir.plus_file(name); path = search_dir.plus_file(name);
if (FileAccess::exists(path)) { if (FileAccess::exists(path)) {
res = _load_assembly_from(name.get_basename(), path, refonly); res = _load_assembly_from(name.get_basename(), path);
if (res != NULL) break;
break;
} }
} else { } else {
path = search_dir.plus_file(name + ".dll"); path = search_dir.plus_file(name + ".dll");
if (FileAccess::exists(path)) { if (FileAccess::exists(path)) {
res = _load_assembly_from(name, path, refonly); res = _load_assembly_from(name, path);
if (res != NULL) break;
break;
} }
} }
} }
return res ? res->get_assembly() : NULL; if (res) return res;
} }
return NULL; return NULL;