summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/mono_gd')
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp17
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.cpp13
2 files changed, 25 insertions, 5 deletions
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index 7699e0d0cd..c90da31f3a 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -56,6 +56,10 @@
#include "main/main.h"
#endif
+#ifdef ANDROID_ENABLED
+#include "android_mono_config.gen.h"
+#endif
+
#define OUT_OF_SYNC_ERR_MESSAGE(m_assembly_name) "The assembly '" m_assembly_name "' is out of sync. " \
"This error is expected if you just upgraded to a newer Godot version. " \
"Building the project will update the assembly to the correct version."
@@ -287,7 +291,11 @@ void GDMono::initialize() {
gdmono_debug_init();
#endif
+#ifdef ANDROID_ENABLED
+ mono_config_parse_memory(get_godot_android_mono_config().utf8().get_data());
+#else
mono_config_parse(NULL);
+#endif
mono_install_unhandled_exception_hook(&unhandled_exception_hook, NULL);
@@ -651,12 +659,13 @@ bool GDMono::_load_project_assembly() {
if (project_assembly)
return true;
- String name = ProjectSettings::get_singleton()->get("application/config/name");
- if (name.empty()) {
- name = "UnnamedProject";
+ String appname = ProjectSettings::get_singleton()->get("application/config/name");
+ String appname_safe = OS::get_singleton()->get_safe_dir_name(appname);
+ if (appname_safe.empty()) {
+ appname_safe = "UnnamedProject";
}
- bool success = load_assembly(name, &project_assembly);
+ bool success = load_assembly(appname_safe, &project_assembly);
if (success) {
mono_assembly_set_main(project_assembly->get_assembly());
diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp
index f1f0015ac9..1b765a09ff 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.cpp
+++ b/modules/mono/mono_gd/gd_mono_assembly.cpp
@@ -270,7 +270,18 @@ Error GDMonoAssembly::load(bool p_refonly) {
Vector<uint8_t> data = FileAccess::get_file_as_array(path);
ERR_FAIL_COND_V(data.empty(), ERR_FILE_CANT_READ);
- String image_filename = ProjectSettings::get_singleton()->globalize_path(path);
+ String image_filename;
+
+#ifdef ANDROID_ENABLED
+ if (path.begins_with("res://")) {
+ image_filename = path.substr(6, path.length());
+ } else {
+ image_filename = ProjectSettings::get_singleton()->globalize_path(path);
+ }
+#else
+ // FIXME: globalize_path does not work on exported games
+ image_filename = ProjectSettings::get_singleton()->globalize_path(path);
+#endif
MonoImageOpenStatus status = MONO_IMAGE_OK;