Xorg: remove binaries extraction

This commit is contained in:
zt515
2017-11-29 00:03:24 +08:00
parent 963d4cfe75
commit 26639d1f90

View File

@ -1003,111 +1003,8 @@ public class MainActivity extends Activity {
}
} catch (UnsatisfiedLinkError ignore) {
}
String[] binaryZipNames = new String[]{"binaries-" + android.os.Build.CPU_ABI + "-pie.zip", "binaries-" + android.os.Build.CPU_ABI2 + "-pie.zip", "binaries-" + android.os.Build.CPU_ABI + ".zip", "binaries-" + android.os.Build.CPU_ABI2 + ".zip", "binaries.zip"};
for (String binaryZip : binaryZipNames) {
try {
Log.i("SDL", "libSDL: Trying to extract binaries from assets " + binaryZip);
InputStream in = null;
try {
for (int i = 0; ; i++) {
InputStream in2 = getAssets().open(binaryZip + String.format("%02d", i));
if (in == null)
in = in2;
else
in = new SequenceInputStream(in, in2);
}
} catch (IOException ee) {
try {
if (in == null)
in = getAssets().open(binaryZip);
} catch (IOException eee) {
}
}
if (in == null)
throw new RuntimeException("libSDL: Extracting binaries failed, the .apk file packaged incorrectly");
ZipInputStream zip = new ZipInputStream(in);
File libDir = getFilesDir();
try {
libDir.mkdirs();
} catch (SecurityException ee) {
}
;
byte[] buf = new byte[16384];
while (true) {
ZipEntry entry = null;
entry = zip.getNextEntry();
/*
if( entry != null )
Log.i("SDL", "Extracting lib " + entry.getName());
*/
if (entry == null) {
Log.i("SDL", "Extracting binaries finished");
break;
}
if (entry.isDirectory()) {
File outDir = new File(libDir.getAbsolutePath() + "/" + entry.getName());
if (!(outDir.exists() && outDir.isDirectory()))
outDir.mkdirs();
continue;
}
OutputStream out = null;
String path = libDir.getAbsolutePath() + "/" + entry.getName();
try {
File outDir = new File(path.substring(0, path.lastIndexOf("/")));
if (!(outDir.exists() && outDir.isDirectory()))
outDir.mkdirs();
} catch (SecurityException eeeeeee) {
}
;
try {
CheckedInputStream check = new CheckedInputStream(new FileInputStream(path), new CRC32());
while (check.read(buf, 0, buf.length) > 0) {
}
;
check.close();
if (check.getChecksum().getValue() != entry.getCrc()) {
File ff = new File(path);
ff.delete();
throw new Exception();
}
Log.i("SDL", "File '" + path + "' exists and passed CRC check - not overwriting it");
continue;
} catch (Exception eeeeee) {
}
Log.i("SDL", "Saving to file '" + path + "'");
out = new FileOutputStream(path);
int len = zip.read(buf);
while (len >= 0) {
if (len > 0)
out.write(buf, 0, len);
len = zip.read(buf);
}
out.flush();
out.close();
Settings.nativeChmod(path, 0755);
//String chmod[] = { "/system/bin/chmod", "0755", path };
//Runtime.getRuntime().exec(chmod).waitFor();
}
break;
} catch (Exception eee) {
//Log.i("SDL", "libSDL: Error: " + eee.toString());
}
}
}
;
public static String GetMappedLibraryName(final String s) {
for (int i = 0; i < Globals.LibraryNamesMap.length; i++) {
if (Globals.LibraryNamesMap[i][0].equals(s))