Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Android export quicker (especially on Windows) #7079

Merged
merged 1 commit into from
Nov 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions platform/android/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,9 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) {

Vector<String> string_table;

printf("stirng block len: %i\n",string_block_len);
printf("stirng count: %i\n",string_count);
printf("flags: %x\n",string_flags);
//printf("stirng block len: %i\n",string_block_len);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'm more for deleting instead of commenting out, unless there is a strong reason we might want to reuse those in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akien-mga hm.. personally, I prefer to leave it as comment.
Because it helps sometimes when fixing problem for android.

//printf("stirng count: %i\n",string_count);
//printf("flags: %x\n",string_flags);

for(uint32_t i=0;i<string_count;i++) {

Expand Down Expand Up @@ -617,7 +617,7 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) {


p_manifest=ret;
printf("end\n");
//printf("end\n");
}

String EditorExportPlatformAndroid::get_project_name() const {
Expand Down Expand Up @@ -778,16 +778,16 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
else
nspace="";

printf("ATTR %i NSPACE: %i\n",i,attr_nspace);
printf("ATTR %i NAME: %i (%s)\n",i,attr_name,attrname.utf8().get_data());
printf("ATTR %i VALUE: %i (%s)\n",i,attr_value,value.utf8().get_data());
printf("ATTR %i FLAGS: %x\n",i,attr_flags);
printf("ATTR %i RESID: %x\n",i,attr_resid);
//printf("ATTR %i NSPACE: %i\n",i,attr_nspace);
//printf("ATTR %i NAME: %i (%s)\n",i,attr_name,attrname.utf8().get_data());
//printf("ATTR %i VALUE: %i (%s)\n",i,attr_value,value.utf8().get_data());
//printf("ATTR %i FLAGS: %x\n",i,attr_flags);
//printf("ATTR %i RESID: %x\n",i,attr_resid);

//replace project information
if (tname=="manifest" && attrname=="package") {

print_line("FOUND PACKAGE");
print_line("FOUND package");
string_table[attr_value]=get_package_name();
}

Expand All @@ -796,14 +796,14 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
//print_line("attrname: "+attrname);
if (tname=="manifest" && /*nspace=="android" &&*/ attrname=="versionCode") {

print_line("FOUND versioncode");
print_line("FOUND versionCode");
encode_uint32(version_code,&p_manifest[iofs+16]);
}


if (tname=="manifest" && /*nspace=="android" &&*/ attrname=="versionName") {

print_line("FOUND versionname");
print_line("FOUND versionName");
if (attr_value==0xFFFFFFFF) {
WARN_PRINT("Version name in a resource, should be plaintext")
} else
Expand Down Expand Up @@ -834,10 +834,10 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool

} else if (value.begins_with("godot.")) {
String perm = value.get_slice(".",1);
print_line("PERM: "+perm+" HAS: "+itos(perms.has(perm)));

if (perms.has(perm) || (p_give_internet && perm=="INTERNET")) {

print_line("PERM: "+perm);
string_table[attr_value]="android.permission."+perm;
}

Expand Down Expand Up @@ -871,12 +871,12 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool

} break;
}
printf("chunk %x: size: %d\n",chunk,size);
//printf("chunk %x: size: %d\n",chunk,size);

ofs+=size;
}

printf("end\n");
//printf("end\n");

//create new andriodmanifest binary

Expand All @@ -893,14 +893,14 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool

encode_uint32(ofs,&ret[string_table_begins+i*4]);
ofs+=string_table[i].length()*2+2+2;
print_line("ofs: "+itos(i)+": "+itos(ofs));
//print_line("ofs: "+itos(i)+": "+itos(ofs));
}
ret.resize(ret.size()+ofs);
uint8_t *chars=&ret[ret.size()-ofs];
for(int i=0;i<string_table.size();i++) {

String s = string_table[i];
print_line("savint string :"+s);
//print_line("savint string :"+s);
encode_uint16(s.length(),chars);
chars+=2;
for(int j=0;j<s.length();j++) { //include zero?
Expand Down Expand Up @@ -934,7 +934,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool

encode_uint32(new_stable_end-8,&ret[12]); //update new string table size

print_line("file size: "+itos(ret.size()));
//print_line("file size: "+itos(ret.size()));

p_manifest=ret;

Expand All @@ -949,7 +949,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
header[i]=decode_uint32(&p_manifest[i*4]);
}

print_line("STO: "+itos(header[3]));
//print_line("STO: "+itos(header[3]));
uint32_t st_offset=9*4;
//ERR_FAIL_COND(header[3]!=0x24)
uint32_t string_count=header[4];
Expand Down