From 59154cccf9fcf814a21a2596993fb1b6777d3bb7 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 20 Apr 2015 19:38:02 -0300 Subject: -Changed Godot exit to be clean. -Added more debug information on memory cleanliness on exit (if run with -v) -Fixed several memory leaks, fixes #1731, fixes #755 --- platform/android/export/export.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'platform/android/export/export.cpp') diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 1dca83274a..4d3f8f110a 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1635,8 +1635,11 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const { EditorExportPlatformAndroid::~EditorExportPlatformAndroid() { + quit_request=true; Thread::wait_to_finish(device_thread); + memdelete(device_lock); + memdelete(device_thread); } -- cgit v1.2.3 From 4804462ee06c1b3e2d1b50b857ce8693d3c0936d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 1 May 2015 10:44:08 -0300 Subject: -Fixes from source code analyzizer, closes #1768 --- platform/android/export/export.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'platform/android/export/export.cpp') diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 4d3f8f110a..35ea7f15f8 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -641,11 +641,11 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector& p_manifest) { int iofs=ofs+8; - uint32_t string_count=decode_uint32(&p_manifest[iofs]); - uint32_t styles_count=decode_uint32(&p_manifest[iofs+4]); + string_count=decode_uint32(&p_manifest[iofs]); + styles_count=decode_uint32(&p_manifest[iofs+4]); uint32_t string_flags=decode_uint32(&p_manifest[iofs+8]); - uint32_t string_data_offset=decode_uint32(&p_manifest[iofs+12]); - uint32_t styles_offset=decode_uint32(&p_manifest[iofs+16]); + string_data_offset=decode_uint32(&p_manifest[iofs+12]); + styles_offset=decode_uint32(&p_manifest[iofs+16]); /* printf("string count: %i\n",string_count); printf("flags: %i\n",string_flags); -- cgit v1.2.3 From 1e422941c88105852cc376569b7aa92e7784f4cd Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 1 May 2015 21:13:20 -0300 Subject: -Fixed android export options (screen sizes, orientation should work) -added functions to get mouse position in CanvasItem --- platform/android/export/export.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'platform/android/export/export.cpp') diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 35ea7f15f8..e11a2c09cd 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -768,19 +768,21 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector& p_manifest) { if (tname=="activity" && /*nspace=="android" &&*/ attrname=="screenOrientation") { + encode_uint32(orientation==0?0:1,&p_manifest[iofs+16]); + /* print_line("FOUND screen orientation"); if (attr_value==0xFFFFFFFF) { WARN_PRINT("Version name in a resource, should be plaintext") } else { string_table[attr_value]=(orientation==0?"landscape":"portrait"); - } + }*/ } if (tname=="application" && /*nspace=="android" &&*/ attrname=="label") { print_line("FOUND application"); if (attr_value==0xFFFFFFFF) { - WARN_PRINT("Application name in a resource, should be plaintext.") + WARN_PRINT("Application name in a resource, should be plaintext (but you can ignore this).") } else { String aname = get_project_name(); @@ -791,7 +793,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector& p_manifest) { print_line("FOUND activity name"); if (attr_value==0xFFFFFFFF) { - WARN_PRINT("Activity name in a resource, should be plaintext") + WARN_PRINT("Activity name in a resource, should be plaintext (but you can ignore this)") } else { String aname; if (this->name!="") { @@ -835,23 +837,19 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector& p_manifest) { WARN_PRINT("Screen res name in a resource, should be plaintext") } else if (attrname=="smallScreens") { - print_line("SMALLSCREEN"); - string_table[attr_value]=screen_support[SCREEN_SMALL]?"true":"false"; + encode_uint32(screen_support[SCREEN_SMALL]?0xFFFFFFFF:0,&p_manifest[iofs+16]); } else if (attrname=="mediumScreens") { - print_line("MEDSCREEN"); - string_table[attr_value]=screen_support[SCREEN_NORMAL]?"true":"false"; + encode_uint32(screen_support[SCREEN_NORMAL]?0xFFFFFFFF:0,&p_manifest[iofs+16]); } else if (attrname=="largeScreens") { - print_line("LARGECREEN"); - string_table[attr_value]=screen_support[SCREEN_LARGE]?"true":"false"; + encode_uint32(screen_support[SCREEN_LARGE]?0xFFFFFFFF:0,&p_manifest[iofs+16]); } else if (attrname=="xlargeScreens") { - print_line("XLARGECREEN"); - string_table[attr_value]=screen_support[SCREEN_XLARGE]?"true":"false"; + encode_uint32(screen_support[SCREEN_XLARGE]?0xFFFFFFFF:0,&p_manifest[iofs+16]); } } -- cgit v1.2.3 From 61e90385f6cbeebb8d3d03c33078802c2fa11eda Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 1 May 2015 22:45:32 -0300 Subject: -option to select arm and x86 architectures on android export (will not work with current templates, you have to make new and include both x86 and arm support) --- platform/android/export/export.cpp | 53 +++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 12 deletions(-) (limited to 'platform/android/export/export.cpp') diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index e11a2c09cd..d0e2dfbce1 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -187,6 +187,8 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { bool remove_prev; bool use_32_fb; bool immersive; + bool export_arm; + bool export_x86; String apk_expansion_salt; String apk_expansion_pkey; int orientation; @@ -281,6 +283,10 @@ bool EditorExportPlatformAndroid::_set(const StringName& p_name, const Variant& icon=p_value; else if (n=="package/signed") _signed=p_value; + else if (n=="architecture/arm") + export_arm=p_value; + else if (n=="architecture/x86") + export_x86=p_value; else if (n=="screen/use_32_bits_view") use_32_fb=p_value; else if (n=="screen/immersive_mode") @@ -350,6 +356,10 @@ bool EditorExportPlatformAndroid::_get(const StringName& p_name,Variant &r_ret) r_ret=icon; else if (n=="package/signed") r_ret=_signed; + else if (n=="architecture/arm") + r_ret=export_arm; + else if (n=="architecture/x86") + r_ret=export_x86; else if (n=="screen/use_32_bits_view") r_ret=use_32_fb; else if (n=="screen/immersive_mode") @@ -403,6 +413,8 @@ void EditorExportPlatformAndroid::_get_property_list( List *p_list p_list->push_back( PropertyInfo( Variant::STRING, "package/name") ); p_list->push_back( PropertyInfo( Variant::STRING, "package/icon",PROPERTY_HINT_FILE,"png") ); p_list->push_back( PropertyInfo( Variant::BOOL, "package/signed") ); + p_list->push_back( PropertyInfo( Variant::BOOL, "architecture/arm") ); + p_list->push_back( PropertyInfo( Variant::BOOL, "architecture/x86") ); p_list->push_back( PropertyInfo( Variant::BOOL, "screen/use_32_bits_view") ); p_list->push_back( PropertyInfo( Variant::BOOL, "screen/immersive_mode") ); p_list->push_back( PropertyInfo( Variant::INT, "screen/orientation",PROPERTY_HINT_ENUM,"Landscape,Portrait") ); @@ -1045,6 +1057,8 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d char fname[16384]; ret = unzGetCurrentFileInfo(pkg,&info,fname,16384,NULL,0,NULL,0); + bool skip=false; + String file=fname; Vector data; @@ -1097,20 +1111,31 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d } } + if (file=="lib/x86/libgodot_android.so" && !export_x86) { + skip=true; + } + + if (file=="lib/armeabi/libgodot_android.so" && !export_arm) { + skip=true; + } + print_line("ADDING: "+file); - zipOpenNewFileInZip(apk, - file.utf8().get_data(), - NULL, - NULL, - 0, - NULL, - 0, - NULL, - Z_DEFLATED, - Z_DEFAULT_COMPRESSION); - zipWriteInFileInZip(apk,data.ptr(),data.size()); - zipCloseFileInZip(apk); + if (!skip) { + zipOpenNewFileInZip(apk, + file.utf8().get_data(), + NULL, + NULL, + 0, + NULL, + 0, + NULL, + Z_DEFLATED, + Z_DEFAULT_COMPRESSION); + + zipWriteInFileInZip(apk,data.ptr(),data.size()); + zipCloseFileInZip(apk); + } ret = unzGoToNextFile(pkg); } @@ -1555,6 +1580,10 @@ EditorExportPlatformAndroid::EditorExportPlatformAndroid() { use_32_fb=true; immersive=true; + export_arm=true; + export_x86=false; + + device_thread=Thread::create(_device_poll_thread,this); devices_changed=true; -- cgit v1.2.3