diff options
Diffstat (limited to 'platform/android/java_glue.cpp')
-rw-r--r-- | platform/android/java_glue.cpp | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index b11994eef0..b9e13892d2 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -747,8 +747,34 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env, } + const char ** cmdline=NULL; + int cmdlen=0; + bool use_apk_expansion=false; + if (p_cmdline) { + int cmdlen = env->GetArrayLength(p_cmdline); + if (cmdlen) { + cmdline = (const char**)malloc((env->GetArrayLength(p_cmdline)+1)*sizeof(const char*)); + cmdline[cmdlen]=NULL; + + for (int i=0; i<cmdlen; i++) { + + jstring string = (jstring) env->GetObjectArrayElement(p_cmdline, i); + const char *rawString = env->GetStringUTFChars(string, 0); + if (!rawString) { + __android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is null\n",i); + } else { + // __android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString); + + if (strcmp(rawString,"-main_pack")==0) + use_apk_expansion=true; + } + + cmdline[i]=rawString; + } + } + } - os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model,_show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _play_video, _is_video_playing, _pause_video, _stop_video); + os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model,_show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _play_video, _is_video_playing, _pause_video, _stop_video,use_apk_expansion); os_android->set_need_reload_hooks(p_need_reload_hook); char wd[500]; @@ -759,16 +785,6 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env, __android_log_print(ANDROID_LOG_INFO,"godot","**SETUP"); - const char ** cmdline=NULL; - int cmdlen = env->GetArrayLength(p_cmdline); - cmdline = (const char**)malloc((env->GetArrayLength(p_cmdline)+1)*sizeof(const char*)); - cmdline[cmdlen]=NULL; - for (int i=0; i<cmdlen; i++) { - - jstring string = (jstring) env->GetObjectArrayElement(p_cmdline, i); - const char *rawString = env->GetStringUTFChars(string, 0); - cmdline[i]=rawString; - } #if 0 char *args[]={"-test","render",NULL}; @@ -833,6 +849,7 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_quit(JNIEnv * env, jobjec input_mutex->lock(); quit_request=true; + print_line("BACK PRESSED"); input_mutex->unlock(); } @@ -1289,7 +1306,10 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject } else if (val == 61453) { ievent.key.scancode = KEY_ENTER; ievent.key.unicode = KEY_ENTER; - } + } else if (p_scancode==4) { + + quit_request=true; + } input_mutex->lock(); key_events.push_back(ievent); @@ -1390,7 +1410,7 @@ static Variant::Type get_jni_type(const String& p_type) { static const char* get_jni_sig(const String& p_type) { - print_line("getting sig for " + p_type); + static struct { const char *name; const char *sig; |