summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/audio_driver_opensl.cpp11
-rw-r--r--platform/android/export/export.cpp15
-rw-r--r--platform/android/java_godot_lib_jni.cpp13
-rw-r--r--platform/android/os_android.cpp8
4 files changed, 11 insertions, 36 deletions
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index 3f7fd07997..711088c158 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -97,17 +97,10 @@ Error AudioDriverOpenSL::init() {
{ (SLuint32)SL_ENGINEOPTION_THREADSAFE, (SLuint32)SL_BOOLEAN_TRUE }
};
res = slCreateEngine(&sl, 1, EngineOption, 0, NULL, NULL);
- if (res != SL_RESULT_SUCCESS) {
+ ERR_FAIL_COND_V_MSG(res != SL_RESULT_SUCCESS, ERR_INVALID_PARAMETER, "Could not initialize OpenSL.");
- ERR_EXPLAIN("Could not Initialize OpenSL");
- ERR_FAIL_V(ERR_INVALID_PARAMETER);
- }
res = (*sl)->Realize(sl, SL_BOOLEAN_FALSE);
- if (res != SL_RESULT_SUCCESS) {
-
- ERR_EXPLAIN("Could not Realize OpenSL");
- ERR_FAIL_V(ERR_INVALID_PARAMETER);
- }
+ ERR_FAIL_COND_V_MSG(res != SL_RESULT_SUCCESS, ERR_INVALID_PARAMETER, "Could not realize OpenSL.");
return OK;
}
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 2fba8bbf7f..dc0a63d171 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -725,8 +725,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
uint32_t string_at = decode_uint32(&p_manifest[st_offset + i * 4]);
string_at += st_offset + string_count * 4;
- ERR_EXPLAIN("Unimplemented, can't read utf8 string table.");
- ERR_FAIL_COND(string_flags & UTF8_FLAG);
+ ERR_FAIL_COND_MSG(string_flags & UTF8_FLAG, "Unimplemented, can't read UTF-8 string table.");
if (string_flags & UTF8_FLAG) {
@@ -863,8 +862,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
memcpy(manifest_end.ptrw(), &p_manifest[ofs], manifest_end.size());
int32_t attr_name_string = string_table.find("name");
- ERR_EXPLAIN("Template does not have 'name' attribute");
- ERR_FAIL_COND(attr_name_string == -1);
+ ERR_FAIL_COND_MSG(attr_name_string == -1, "Template does not have 'name' attribute.");
int32_t ns_android_string = string_table.find("http://schemas.android.com/apk/res/android");
if (ns_android_string == -1) {
@@ -896,8 +894,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
} else if (dof_index == 2) {
required_value_string = "true";
} else {
- ERR_EXPLAIN("Unknown dof index " + itos(dof_index));
- ERR_FAIL();
+ ERR_FAIL_MSG("Unknown DoF index: " + itos(dof_index) + ".");
}
int32_t required_value = string_table.find(required_value_string);
if (required_value == -1) {
@@ -989,12 +986,10 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
memcpy(manifest_end.ptrw(), &p_manifest[ofs], manifest_end.size());
int32_t attr_name_string = string_table.find("name");
- ERR_EXPLAIN("Template does not have 'name' attribute");
- ERR_FAIL_COND(attr_name_string == -1);
+ ERR_FAIL_COND_MSG(attr_name_string == -1, "Template does not have 'name' attribute.");
int32_t ns_android_string = string_table.find("android");
- ERR_EXPLAIN("Template does not have 'android' namespace");
- ERR_FAIL_COND(ns_android_string == -1);
+ ERR_FAIL_COND_MSG(ns_android_string == -1, "Template does not have 'android' namespace.");
int32_t attr_uses_permission_string = string_table.find("uses-permission");
if (attr_uses_permission_string == -1) {
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index 77f077456e..1159e93166 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -686,20 +686,11 @@ static void _initialize_java_modules() {
print_line("Loading Android module: " + m);
jstring strClassName = env->NewStringUTF(m.utf8().get_data());
jclass singletonClass = (jclass)env->CallObjectMethod(cls, findClass, strClassName);
-
- if (!singletonClass) {
-
- ERR_EXPLAIN("Couldn't find singleton for class: " + m);
- ERR_CONTINUE(!singletonClass);
- }
+ ERR_CONTINUE_MSG(!singletonClass, "Couldn't find singleton for class: " + m + ".");
jmethodID initialize = env->GetStaticMethodID(singletonClass, "initialize", "(Landroid/app/Activity;)Lorg/godotengine/godot/Godot$SingletonBase;");
+ ERR_CONTINUE_MSG(!initialize, "Couldn't find proper initialize function 'public static Godot.SingletonBase Class::initialize(Activity p_activity)' initializer for singleton class: " + m + ".");
- if (!initialize) {
-
- ERR_EXPLAIN("Couldn't find proper initialize function 'public static Godot.SingletonBase Class::initialize(Activity p_activity)' initializer for singleton class: " + m);
- ERR_CONTINUE(!initialize);
- }
jobject obj = env->CallStaticObjectMethod(singletonClass, initialize, godot_java->get_activity());
env->NewGlobalRef(obj);
}
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index ebc319e57d..701a351203 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -71,8 +71,7 @@ const char *OS_Android::get_video_driver_name(int p_driver) const {
case VIDEO_DRIVER_GLES2:
return "GLES2";
}
- ERR_EXPLAIN("Invalid video driver index " + itos(p_driver));
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V_MSG(NULL, "Invalid video driver index: " + itos(p_driver) + ".");
}
int OS_Android::get_audio_driver_count() const {
@@ -223,10 +222,7 @@ bool OS_Android::request_permission(const String &p_name) {
Error OS_Android::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
p_library_handle = dlopen(p_path.utf8().get_data(), RTLD_NOW);
- if (!p_library_handle) {
- ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror());
- ERR_FAIL_V(ERR_CANT_OPEN);
- }
+ ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ", error: " + dlerror() + ".");
return OK;
}