├── .gitignore ├── Android Apps Native Library Compression SDK.docx ├── ApkLibCompress ├── .classpath ├── .project ├── .settings │ └── org.eclipse.jdt.core.prefs ├── bin │ └── ApkCompress.jar ├── exefile │ ├── forbidden_list.txt │ ├── linux │ │ ├── 7za │ │ ├── License.txt │ │ ├── aapt │ │ ├── copying.txt │ │ ├── readelf │ │ └── zipalign │ ├── mac │ │ ├── 7za │ │ ├── License.txt │ │ ├── aapt │ │ ├── copying.txt │ │ ├── readelf │ │ └── zipalign │ ├── singapk.bat │ ├── tools.jar │ └── windows │ │ ├── 7z.dll │ │ ├── 7za.exe │ │ ├── License.txt │ │ ├── aapt.exe │ │ ├── readelf.exe │ │ └── zipalign.exe └── src │ └── compress │ └── unzipapk │ ├── ComPressApk.java │ └── OsCommand.java ├── CompressDemo ├── .classpath ├── .project ├── .settings │ └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── ic_launcher-web.png ├── jni │ ├── Android.mk │ ├── Application.mk │ ├── CompressDemo.cpp │ ├── helloone.c │ ├── hellothree.c │ └── hellotwo.c ├── libs │ ├── android-support-v4.jar │ ├── armeabi-v7a │ │ ├── libhelloone.so │ │ ├── libhellothree.so │ │ └── libhellotwo.so │ ├── armeabi │ │ ├── libhelloone.so │ │ ├── libhellothree.so │ │ └── libhellotwo.so │ ├── mips │ │ ├── libhelloone.so │ │ ├── libhellothree.so │ │ └── libhellotwo.so │ └── x86 │ │ ├── libhelloone.so │ │ ├── libhellothree.so │ │ └── libhellotwo.so ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── layout │ │ ├── activity_main.xml │ │ └── activity_second.xml │ ├── menu │ │ ├── main.xml │ │ └── second.xml │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── com │ └── example │ └── compressdemo │ ├── DemoService.java │ ├── JNILib.java │ ├── MainActivity.java │ └── SecondActivity.java ├── DecRawso ├── .classpath ├── .cproject ├── .project ├── .settings │ ├── org.eclipse.cdt.codan.core.prefs │ └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── MainActivity.java ├── NativeLibraryHelper.java ├── ic_launcher-web.png ├── jni │ ├── 7zC │ │ ├── 7z.h │ │ ├── 7zAlloc.c │ │ ├── 7zAlloc.h │ │ ├── 7zBuf.c │ │ ├── 7zBuf.h │ │ ├── 7zCrc.c │ │ ├── 7zCrc.h │ │ ├── 7zCrcOpt.c │ │ ├── 7zDec.c │ │ ├── 7zFile.c │ │ ├── 7zFile.h │ │ ├── 7zIn.c │ │ ├── 7zStream.c │ │ ├── 7zVersion.h │ │ ├── Bcj2.c │ │ ├── Bcj2.h │ │ ├── Bra.c │ │ ├── Bra.h │ │ ├── Bra86.c │ │ ├── CpuArch.c │ │ ├── CpuArch.h │ │ ├── Lzma2Dec.c │ │ ├── Lzma2Dec.h │ │ ├── LzmaDec.c │ │ ├── LzmaDec.h │ │ ├── Ppmd.h │ │ ├── Ppmd7.c │ │ ├── Ppmd7.h │ │ ├── Ppmd7Dec.c │ │ └── Types.h │ ├── 7zMain.c │ ├── Android.mk │ ├── Application.mk │ └── DecRawso.cpp ├── libs │ ├── armeabi │ │ ├── libDecRawso.so │ │ └── libDecRawso22.so │ └── x86 │ │ ├── libDecRawso.so │ │ └── libDecRawso22.so ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values-de-rDE │ │ └── string.xml │ ├── values-en-rUS │ │ └── string.xml │ ├── values-fr-rFR │ │ └── string.xml │ ├── values-ja-rJP │ │ └── string.xml │ ├── values-ko-rKR │ │ └── string.xml │ ├── values-ru-rRU │ │ └── string.xml │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ ├── values-zh-rCN │ │ └── string.xml │ ├── values-zh-rTW │ │ └── string.xml │ └── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── com │ └── library │ └── decrawso │ ├── CloudDownloader.java │ ├── DecRawso.java │ └── UtilsFunc.java ├── DecRawso_Jar ├── libs │ ├── DecRawso.jar │ ├── armeabi │ │ ├── libDecRawso.so │ │ └── libDecRawso22.so │ └── x86 │ │ ├── libDecRawso.so │ │ └── libDecRawso22.so └── res │ ├── values-de-rDE │ └── decrawso_string.xml │ ├── values-en-rUS │ └── decrawso_string.xml │ ├── values-fr-rFR │ └── decrawso_string.xml │ ├── values-ja-rJP │ └── decrawso_string.xml │ ├── values-ko-rKR │ └── decrawso_string.xml │ ├── values-ru-rRU │ └── decrawso_string.xml │ ├── values-zh-rCN │ └── decrawso_string.xml │ ├── values-zh-rTW │ └── decrawso_string.xml │ └── values │ └── decrawso_strings.xml ├── LICENSE ├── Licenses ├── License-7z.txt ├── License-p7zip.txt └── License.txt ├── README.md ├── readme.docx ├── 压缩工具问答.docx └── 安卓压缩工具集说明文档.docx /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | -------------------------------------------------------------------------------- /Android Apps Native Library Compression SDK.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/Android Apps Native Library Compression SDK.docx -------------------------------------------------------------------------------- /ApkLibCompress/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ApkLibCompress/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ApkLibCompress 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /ApkLibCompress/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.6 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.6 12 | -------------------------------------------------------------------------------- /ApkLibCompress/bin/ApkCompress.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/bin/ApkCompress.jar -------------------------------------------------------------------------------- /ApkLibCompress/exefile/forbidden_list.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/forbidden_list.txt -------------------------------------------------------------------------------- /ApkLibCompress/exefile/linux/7za: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/linux/7za -------------------------------------------------------------------------------- /ApkLibCompress/exefile/linux/License.txt: -------------------------------------------------------------------------------- 1 | 7-Zip source code 2 | ~~~~~~~~~~~~~~~~~ 3 | License for use and distribution 4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | 7-Zip Copyright (C) 1999-2010 Igor Pavlov. 7 | 8 | Licenses for files are: 9 | 10 | 1) CPP/7zip/Compress/Rar* files: GNU LGPL + unRAR restriction 11 | 2) All other files: GNU LGPL 12 | 13 | The GNU LGPL + unRAR restriction means that you must follow both 14 | GNU LGPL rules and unRAR restriction rules. 15 | 16 | 17 | GNU LGPL information 18 | -------------------- 19 | 20 | This library is free software; you can redistribute it and/or 21 | modify it under the terms of the GNU Lesser General Public 22 | License as published by the Free Software Foundation; either 23 | version 2.1 of the License, or (at your option) any later version. 24 | 25 | This library is distributed in the hope that it will be useful, 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | Lesser General Public License for more details. 29 | 30 | You should have received a copy of the GNU Lesser General Public 31 | License along with this library; if not, write to the Free Software 32 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 33 | 34 | 35 | unRAR restriction 36 | ----------------- 37 | 38 | The decompression engine for RAR archives was developed using source 39 | code of unRAR program. 40 | All copyrights to original unRAR code are owned by Alexander Roshal. 41 | 42 | The license for original unRAR code has the following restriction: 43 | 44 | The unRAR sources cannot be used to re-create the RAR compression algorithm, 45 | which is proprietary. Distribution of modified unRAR sources in separate form 46 | or as a part of other software is permitted, provided that it is clearly 47 | stated in the documentation and source comments that the code may 48 | not be used to develop a RAR (WinRAR) compatible archiver. 49 | 50 | 51 | -- 52 | Igor Pavlov 53 | -------------------------------------------------------------------------------- /ApkLibCompress/exefile/linux/aapt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/linux/aapt -------------------------------------------------------------------------------- /ApkLibCompress/exefile/linux/readelf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/linux/readelf -------------------------------------------------------------------------------- /ApkLibCompress/exefile/linux/zipalign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/linux/zipalign -------------------------------------------------------------------------------- /ApkLibCompress/exefile/mac/7za: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/mac/7za -------------------------------------------------------------------------------- /ApkLibCompress/exefile/mac/License.txt: -------------------------------------------------------------------------------- 1 | 7-Zip source code 2 | ~~~~~~~~~~~~~~~~~ 3 | License for use and distribution 4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | 7-Zip Copyright (C) 1999-2010 Igor Pavlov. 7 | 8 | Licenses for files are: 9 | 10 | 1) CPP/7zip/Compress/Rar* files: GNU LGPL + unRAR restriction 11 | 2) All other files: GNU LGPL 12 | 13 | The GNU LGPL + unRAR restriction means that you must follow both 14 | GNU LGPL rules and unRAR restriction rules. 15 | 16 | 17 | GNU LGPL information 18 | -------------------- 19 | 20 | This library is free software; you can redistribute it and/or 21 | modify it under the terms of the GNU Lesser General Public 22 | License as published by the Free Software Foundation; either 23 | version 2.1 of the License, or (at your option) any later version. 24 | 25 | This library is distributed in the hope that it will be useful, 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | Lesser General Public License for more details. 29 | 30 | You should have received a copy of the GNU Lesser General Public 31 | License along with this library; if not, write to the Free Software 32 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 33 | 34 | 35 | unRAR restriction 36 | ----------------- 37 | 38 | The decompression engine for RAR archives was developed using source 39 | code of unRAR program. 40 | All copyrights to original unRAR code are owned by Alexander Roshal. 41 | 42 | The license for original unRAR code has the following restriction: 43 | 44 | The unRAR sources cannot be used to re-create the RAR compression algorithm, 45 | which is proprietary. Distribution of modified unRAR sources in separate form 46 | or as a part of other software is permitted, provided that it is clearly 47 | stated in the documentation and source comments that the code may 48 | not be used to develop a RAR (WinRAR) compatible archiver. 49 | 50 | 51 | -- 52 | Igor Pavlov 53 | -------------------------------------------------------------------------------- /ApkLibCompress/exefile/mac/aapt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/mac/aapt -------------------------------------------------------------------------------- /ApkLibCompress/exefile/mac/readelf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/mac/readelf -------------------------------------------------------------------------------- /ApkLibCompress/exefile/mac/zipalign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/mac/zipalign -------------------------------------------------------------------------------- /ApkLibCompress/exefile/singapk.bat: -------------------------------------------------------------------------------- 1 | java -classpath tools.jar sun.security.tools.JarSigner -keystore C:\Users\yli162\.android\debug.keystore -storepass android -keypass android -sigfile CERT %1 androiddebugkey 2 | windows\zipalign -v 4 %1 %2 -------------------------------------------------------------------------------- /ApkLibCompress/exefile/tools.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/tools.jar -------------------------------------------------------------------------------- /ApkLibCompress/exefile/windows/7z.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/windows/7z.dll -------------------------------------------------------------------------------- /ApkLibCompress/exefile/windows/7za.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/windows/7za.exe -------------------------------------------------------------------------------- /ApkLibCompress/exefile/windows/License.txt: -------------------------------------------------------------------------------- 1 | 7-Zip 2 | ~~~~~ 3 | License for use and distribution 4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | 7-Zip Copyright (C) 1999-2010 Igor Pavlov. 7 | 8 | Licenses for files are: 9 | 10 | 1) 7z.dll: GNU LGPL + unRAR restriction 11 | 2) All other files: GNU LGPL 12 | 13 | The GNU LGPL + unRAR restriction means that you must follow both 14 | GNU LGPL rules and unRAR restriction rules. 15 | 16 | 17 | Note: 18 | You can use 7-Zip on any computer, including a computer in a commercial 19 | organization. You don't need to register or pay for 7-Zip. 20 | 21 | 22 | GNU LGPL information 23 | -------------------- 24 | 25 | This library is free software; you can redistribute it and/or 26 | modify it under the terms of the GNU Lesser General Public 27 | License as published by the Free Software Foundation; either 28 | version 2.1 of the License, or (at your option) any later version. 29 | 30 | This library is distributed in the hope that it will be useful, 31 | but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 33 | Lesser General Public License for more details. 34 | 35 | You can receive a copy of the GNU Lesser General Public License from 36 | http://www.gnu.org/ 37 | 38 | 39 | unRAR restriction 40 | ----------------- 41 | 42 | The decompression engine for RAR archives was developed using source 43 | code of unRAR program. 44 | All copyrights to original unRAR code are owned by Alexander Roshal. 45 | 46 | The license for original unRAR code has the following restriction: 47 | 48 | The unRAR sources cannot be used to re-create the RAR compression algorithm, 49 | which is proprietary. Distribution of modified unRAR sources in separate form 50 | or as a part of other software is permitted, provided that it is clearly 51 | stated in the documentation and source comments that the code may 52 | not be used to develop a RAR (WinRAR) compatible archiver. 53 | 54 | 55 | -- 56 | Igor Pavlov 57 | -------------------------------------------------------------------------------- /ApkLibCompress/exefile/windows/aapt.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/windows/aapt.exe -------------------------------------------------------------------------------- /ApkLibCompress/exefile/windows/readelf.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/windows/readelf.exe -------------------------------------------------------------------------------- /ApkLibCompress/exefile/windows/zipalign.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/ApkLibCompress/exefile/windows/zipalign.exe -------------------------------------------------------------------------------- /ApkLibCompress/src/compress/unzipapk/OsCommand.java: -------------------------------------------------------------------------------- 1 | package compress.unzipapk; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.BufferedWriter; 5 | import java.io.File; 6 | import java.io.FileNotFoundException; 7 | import java.io.FileOutputStream; 8 | import java.io.IOException; 9 | import java.io.InputStreamReader; 10 | import java.io.OutputStreamWriter; 11 | import java.util.ArrayList; 12 | 13 | import javax.swing.JOptionPane; 14 | 15 | public class OsCommand { 16 | private static OsCommand mOsCommand=null; 17 | private String JarPath; 18 | private String JarPathParent; 19 | private static boolean mbSlience=false; 20 | 21 | private OsCommand(String jarPath,String sys) 22 | { 23 | JarPathParent = jarPath; 24 | JarPath = jarPath+sys; 25 | } 26 | 27 | protected static void newInstance(String jarPath,boolean bSlience) { 28 | if(mOsCommand!=null) 29 | return; 30 | 31 | mbSlience = bSlience; 32 | String OS=System.getProperties().getProperty("os.name").toLowerCase(); //get the os name 33 | if(OS.indexOf("linux")>=0) 34 | { 35 | mOsCommand = new OsCommand(jarPath,"../exefile/linux/"); 36 | //Process p = Runtime.getRuntime().exec("chmod +x "+jarPath+"../exefile/linux/*"); 37 | //p.waitFor(); 38 | File[] files = new File(jarPath+"../exefile/linux/").listFiles(); 39 | for(File file:files) 40 | { 41 | file.setExecutable(true); 42 | } 43 | } 44 | else if(OS.indexOf("windows")>=0) 45 | { 46 | mOsCommand = new OsCommand(jarPath,"../exefile/windows/"); 47 | } 48 | else if(OS.indexOf("mac")>=0&&OS.indexOf("os")>0 /*&&OS.indexOf("x")<0*/) //mac os x is also ok 49 | { 50 | mOsCommand = new OsCommand(jarPath,"../exefile/mac/"); 51 | 52 | File[] files = new File(jarPath+"../exefile/mac/").listFiles(); 53 | for(File file:files) 54 | { 55 | file.setExecutable(true); 56 | } 57 | } 58 | else 59 | { 60 | mOsCommand = null; 61 | } 62 | } 63 | 64 | private void outputstr(String msg) 65 | { 66 | System.out.print(msg); 67 | if(!mbSlience) 68 | JOptionPane.showMessageDialog(null,msg); 69 | else 70 | { 71 | try { 72 | BufferedWriter porterr = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(JarPathParent+"oserror.log",true))); 73 | porterr.write(msg); 74 | porterr.newLine(); 75 | porterr.close(); 76 | 77 | } catch (FileNotFoundException e) { 78 | // TODO Auto-generated catch block 79 | e.printStackTrace(); 80 | } catch (IOException e) { 81 | // TODO Auto-generated catch block 82 | e.printStackTrace(); 83 | } 84 | } 85 | } 86 | 87 | protected static OsCommand getInstance() { 88 | return mOsCommand; 89 | } 90 | 91 | class WatchThread extends Thread 92 | { 93 | Process p; 94 | boolean over; 95 | public WatchThread(Process p) 96 | { 97 | this.p = p; 98 | over = false; 99 | } 100 | 101 | public void run() { 102 | try { 103 | if (p == null) return; 104 | BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); 105 | while (true) { 106 | if (p==null || over) { 107 | break; 108 | } 109 | while(br.readLine()!=null); 110 | Thread.sleep(50); 111 | } 112 | br.close(); 113 | } catch (Exception e) { 114 | e.printStackTrace(); 115 | } 116 | } 117 | public void setOver(boolean over) { 118 | this.over = over; 119 | } 120 | } 121 | 122 | public boolean CompressWithLzma(String cmd) { 123 | // TODO Auto-generated method stub 124 | Runtime rn=Runtime.getRuntime(); 125 | try{ 126 | System.out.println("compress, it will take some time"); 127 | Process process = rn.exec(JarPath+"7za a -t7z "+cmd); 128 | WatchThread wt = new WatchThread(process); 129 | wt.start(); 130 | process.waitFor(); 131 | wt.setOver(true); 132 | wt.join(); 133 | }catch(Exception e){ 134 | outputstr("Error: compress "+cmd); 135 | return false; 136 | } 137 | return true; 138 | } 139 | 140 | public boolean AndroidAapt(String cmd,String workpath) { 141 | // TODO Auto-generated method stub 142 | Runtime rn=Runtime.getRuntime(); 143 | try{ 144 | //System.out.println("aapt "+cmd); 145 | Process process = rn.exec(JarPath+"aapt "+cmd,null,new File(workpath)); 146 | process.waitFor(); 147 | }catch(Exception e){ 148 | outputstr("Error: aapt "+cmd); 149 | return false; 150 | } 151 | return true; 152 | } 153 | 154 | public boolean ApkJarSigner(String apkname, String[] keyname) { 155 | // TODO Auto-generated method stub 156 | Runtime rn=Runtime.getRuntime(); 157 | try{ 158 | System.out.println("JarSigner "+apkname); 159 | Process process = rn.exec("java -classpath "+JarPath+"../tools.jar sun.security.tools.JarSigner -keystore "+ 160 | keyname[0]+" -storepass " +keyname[1]+" -keypass "+keyname[2]+" -sigfile "+keyname[4]+" "+apkname+" "+keyname[3]); 161 | process.waitFor(); 162 | }catch(Exception e){ 163 | outputstr("Error: JarSigner "+apkname); 164 | return false; 165 | } 166 | return true; 167 | } 168 | 169 | public String ApkZipAlign(String apkname) { 170 | // TODO Auto-generated method stub 171 | String outname = null; 172 | Runtime rn=Runtime.getRuntime(); 173 | try{ 174 | outname = apkname.substring(0, apkname.lastIndexOf("."))+"Align.apk"; 175 | System.out.println("ZipAlign "+outname); 176 | File zipalignf = new File(outname); 177 | if(zipalignf.exists()) 178 | zipalignf.delete(); 179 | 180 | Process process = rn.exec(JarPath+"zipalign -v 4 "+apkname+" "+outname); 181 | WatchThread wt = new WatchThread(process); 182 | wt.start(); 183 | process.waitFor(); 184 | wt.setOver(true); 185 | wt.join(); 186 | 187 | if(!new File(outname).exists()) 188 | { 189 | outputstr("Error: ZipAlign "+apkname); 190 | return null; 191 | } 192 | else 193 | { 194 | new File(apkname).delete(); 195 | } 196 | }catch(Exception e){ 197 | outputstr("Error: ZipAlign "+apkname); 198 | return null; 199 | } 200 | return outname; 201 | } 202 | 203 | public ArrayList GetShareLibrary(String libname) 204 | { 205 | boolean IsX86Lib=false; 206 | String LineStr=null; 207 | ArrayList libarrary = new ArrayList(); 208 | Runtime rn=Runtime.getRuntime(); 209 | 210 | if(!libname.endsWith(".so")) 211 | return libarrary; 212 | 213 | try{ 214 | Process process = rn.exec(JarPath+"readelf -h "+libname); 215 | if(process != null) 216 | { 217 | BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); 218 | while((LineStr=br.readLine())==null) //wait output,if the output is just once, use it ok, otherwise must use thread 219 | Thread.sleep(50); 220 | while(LineStr!=null) 221 | { 222 | if(LineStr.indexOf("Intel")>-1) 223 | { 224 | IsX86Lib = true; 225 | break; 226 | } 227 | LineStr = br.readLine(); 228 | } 229 | if(LineStr!=null) 230 | while(br.readLine()!=null); 231 | 232 | br.close(); 233 | process.waitFor(); 234 | } 235 | if(IsX86Lib) //only detect x86 lib 236 | { 237 | process = rn.exec(JarPath+"readelf -d "+libname); 238 | if(process != null) 239 | { 240 | BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); 241 | while((LineStr=br.readLine())==null) //wait output,if the output is just once, use it ok, otherwise must use thread 242 | Thread.sleep(50); 243 | while(LineStr!=null) 244 | { 245 | if(LineStr.indexOf("Shared library")>-1) 246 | { 247 | String[] getnames = LineStr.split("\\["); 248 | if(getnames.length>1 && getnames[1].startsWith("lib")) 249 | { 250 | libarrary.add(getnames[1].substring(0, getnames[1].length()-1)); 251 | } 252 | } 253 | LineStr = br.readLine(); 254 | } 255 | br.close(); 256 | process.waitFor(); 257 | } 258 | } 259 | }catch(Exception e){ 260 | outputstr("Error: GetShareLibrary "+libname); 261 | return libarrary; 262 | } 263 | return libarrary; 264 | } 265 | 266 | public boolean IsArmShareLibrary(String libname) 267 | { 268 | boolean IsArmLib=false; 269 | String LineStr=null; 270 | Runtime rn=Runtime.getRuntime(); 271 | 272 | if(!libname.endsWith(".so")) 273 | return false; 274 | 275 | try{ 276 | Process process = rn.exec(JarPath+"readelf -h "+libname); 277 | if(process != null) 278 | { 279 | BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); 280 | while((LineStr=br.readLine())==null) //wait output,if the output is just once, use it ok, otherwise must use thread 281 | Thread.sleep(50); 282 | while(LineStr!=null) 283 | { 284 | if(LineStr.indexOf("ARM")>-1) 285 | { 286 | IsArmLib = true; 287 | break; 288 | } 289 | LineStr = br.readLine(); 290 | } 291 | if(LineStr!=null) 292 | while(br.readLine()!=null); 293 | 294 | br.close(); 295 | process.waitFor(); 296 | } 297 | 298 | }catch(Exception e){ 299 | outputstr("Error: IsArmShareLibrary "+libname); 300 | return false; 301 | } 302 | return IsArmLib; 303 | } 304 | 305 | } 306 | -------------------------------------------------------------------------------- /CompressDemo/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /CompressDemo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | CompressDemo 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /CompressDemo/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /CompressDemo/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 13 | 14 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /CompressDemo/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/ic_launcher-web.png -------------------------------------------------------------------------------- /CompressDemo/jni/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | LOCAL_PATH := $(call my-dir) 16 | 17 | include $(CLEAR_VARS) 18 | 19 | LOCAL_MODULE := helloone 20 | LOCAL_SRC_FILES := helloone.c 21 | 22 | LOCAL_CFLAGS += -DARCH_STRING=\"libhelloone.so\ is\ $(TARGET_ARCH_ABI)\" 23 | 24 | include $(BUILD_SHARED_LIBRARY) 25 | 26 | include $(CLEAR_VARS) 27 | 28 | LOCAL_MODULE := hellotwo 29 | LOCAL_SRC_FILES := hellotwo.c 30 | 31 | LOCAL_CFLAGS += -DARCH_STRING=\"libhellotwo.so\ is\ $(TARGET_ARCH_ABI)\" 32 | 33 | include $(BUILD_SHARED_LIBRARY) 34 | 35 | 36 | include $(CLEAR_VARS) 37 | 38 | LOCAL_MODULE := hellothree 39 | LOCAL_SRC_FILES := hellothree.c 40 | 41 | LOCAL_CFLAGS += -DARCH_STRING=\"libhellothree.so\ is\ $(TARGET_ARCH_ABI)\" 42 | 43 | include $(BUILD_SHARED_LIBRARY) 44 | -------------------------------------------------------------------------------- /CompressDemo/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := x86 armeabi armeabi-v7a mips -------------------------------------------------------------------------------- /CompressDemo/jni/CompressDemo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /CompressDemo/jni/helloone.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | #include 18 | #include 19 | 20 | /* This is a trivial JNI example where we use a native method 21 | * to return a new VM String. See the corresponding Java source 22 | * file located at: 23 | * 24 | * apps/samples/hello-jni/project/src/com/example/hellojni/HelloJni.java 25 | */ 26 | jstring 27 | Java_com_example_compressdemo_JNILib_whoamione( JNIEnv* env, 28 | jobject thiz ) 29 | { 30 | return (*env)->NewStringUTF(env, ARCH_STRING); 31 | } 32 | -------------------------------------------------------------------------------- /CompressDemo/jni/hellothree.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | #include 18 | #include 19 | 20 | /* This is a trivial JNI example where we use a native method 21 | * to return a new VM String. See the corresponding Java source 22 | * file located at: 23 | * 24 | * apps/samples/hello-jni/project/src/com/example/hellojni/HelloJni.java 25 | */ 26 | jstring 27 | Java_com_example_compressdemo_DemoService_whoamithree( JNIEnv* env, 28 | jobject thiz ) 29 | { 30 | return (*env)->NewStringUTF(env, ARCH_STRING); 31 | } 32 | -------------------------------------------------------------------------------- /CompressDemo/jni/hellotwo.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | #include 18 | #include 19 | 20 | /* This is a trivial JNI example where we use a native method 21 | * to return a new VM String. See the corresponding Java source 22 | * file located at: 23 | * 24 | * apps/samples/hello-jni/project/src/com/example/hellojni/HelloJni.java 25 | */ 26 | jstring 27 | Java_com_example_compressdemo_JNILib_whoamitwo( JNIEnv* env, 28 | jobject thiz ) 29 | { 30 | return (*env)->NewStringUTF(env, ARCH_STRING); 31 | } 32 | -------------------------------------------------------------------------------- /CompressDemo/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/android-support-v4.jar -------------------------------------------------------------------------------- /CompressDemo/libs/armeabi-v7a/libhelloone.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/armeabi-v7a/libhelloone.so -------------------------------------------------------------------------------- /CompressDemo/libs/armeabi-v7a/libhellothree.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/armeabi-v7a/libhellothree.so -------------------------------------------------------------------------------- /CompressDemo/libs/armeabi-v7a/libhellotwo.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/armeabi-v7a/libhellotwo.so -------------------------------------------------------------------------------- /CompressDemo/libs/armeabi/libhelloone.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/armeabi/libhelloone.so -------------------------------------------------------------------------------- /CompressDemo/libs/armeabi/libhellothree.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/armeabi/libhellothree.so -------------------------------------------------------------------------------- /CompressDemo/libs/armeabi/libhellotwo.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/armeabi/libhellotwo.so -------------------------------------------------------------------------------- /CompressDemo/libs/mips/libhelloone.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/mips/libhelloone.so -------------------------------------------------------------------------------- /CompressDemo/libs/mips/libhellothree.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/mips/libhellothree.so -------------------------------------------------------------------------------- /CompressDemo/libs/mips/libhellotwo.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/mips/libhellotwo.so -------------------------------------------------------------------------------- /CompressDemo/libs/x86/libhelloone.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/x86/libhelloone.so -------------------------------------------------------------------------------- /CompressDemo/libs/x86/libhellothree.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/x86/libhellothree.so -------------------------------------------------------------------------------- /CompressDemo/libs/x86/libhellotwo.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/libs/x86/libhellotwo.so -------------------------------------------------------------------------------- /CompressDemo/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /CompressDemo/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-17 15 | android.library.reference.1=../DecRawso 16 | -------------------------------------------------------------------------------- /CompressDemo/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /CompressDemo/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /CompressDemo/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /CompressDemo/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/CompressDemo/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /CompressDemo/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | -------------------------------------------------------------------------------- /CompressDemo/res/layout/activity_second.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 19 | 20 | 28 | 29 | 37 | 38 | -------------------------------------------------------------------------------- /CompressDemo/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /CompressDemo/res/menu/second.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /CompressDemo/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CompressDemo/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /CompressDemo/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /CompressDemo/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /CompressDemo/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /CompressDemo/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CompressDemo 5 | Settings 6 | Hello world! 7 | SecondActivity 8 | 9 | 10 | -------------------------------------------------------------------------------- /CompressDemo/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /CompressDemo/src/com/example/compressdemo/DemoService.java: -------------------------------------------------------------------------------- 1 | package com.example.compressdemo; 2 | 3 | import com.library.decrawso.DecRawso; 4 | 5 | import android.app.Service; 6 | import android.content.Intent; 7 | import android.os.Binder; 8 | import android.os.IBinder; 9 | 10 | 11 | public class DemoService extends Service { 12 | 13 | private native static String whoamithree(); 14 | 15 | @Override 16 | public IBinder onBind(Intent intent) { 17 | // TODO Auto-generated method stub 18 | return new LocalBinder(); 19 | } 20 | 21 | @Override 22 | public void onCreate() { 23 | // TODO Auto-generated method stub 24 | DecRawso.NewInstanceInService(this); //must initial DecRawso in different process 25 | System.loadLibrary("hellothree"); //must load after NewInstanceInService 26 | super.onCreate(); 27 | } 28 | 29 | @Override 30 | public void onDestroy() { 31 | // TODO Auto-generated method stub 32 | 33 | super.onDestroy(); 34 | } 35 | 36 | public class LocalBinder extends Binder { 37 | DemoService getService() { 38 | // Return this instance of LocalService so clients can call public methods 39 | return DemoService.this; 40 | } 41 | } 42 | 43 | public String getLibStr() 44 | { 45 | return whoamithree(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CompressDemo/src/com/example/compressdemo/JNILib.java: -------------------------------------------------------------------------------- 1 | package com.example.compressdemo; 2 | 3 | import com.library.decrawso.DecRawso; 4 | 5 | public class JNILib { 6 | public native static String whoamione(); 7 | public native static String whoamitwo(); 8 | public native static String whoamithree(); 9 | 10 | static 11 | { 12 | System.load(DecRawso.GetInstance().GetPath("helloone")); 13 | //System.loadLibrary("helloone"); //now, you can just use the orignal code 14 | System.loadLibrary("hellotwo"); 15 | //System.loadLibrary("hellothree"); //move to service 16 | } 17 | } -------------------------------------------------------------------------------- /CompressDemo/src/com/example/compressdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.compressdemo; 2 | 3 | import com.library.decrawso.DecRawso; 4 | import android.os.Bundle; 5 | import android.os.Handler; 6 | import android.app.Activity; 7 | import android.app.ActivityManager; 8 | import android.app.ProgressDialog; 9 | import android.content.Context; 10 | import android.content.Intent; 11 | import android.view.Menu; 12 | import android.view.View; 13 | import android.widget.TextView; 14 | 15 | public class MainActivity extends Activity { 16 | 17 | private Context mContext; 18 | private int sync_async = 0; 19 | 20 | private void switchto() 21 | { 22 | Intent intent = new Intent(); 23 | intent.setClass(MainActivity.this, SecondActivity.class); 24 | startActivity(intent); 25 | } 26 | 27 | private Handler mDecRawsoHdl = new Handler() 28 | { 29 | public void handleMessage(android.os.Message msg) 30 | { 31 | switch(msg.what) 32 | { 33 | case DecRawso.HDL_MSGDECEND: 34 | if(!DecRawso.GetInstance().ShowError(mContext,msg.arg1)) //if no error, go on 35 | { 36 | switchto(); 37 | MainActivity.this.finish(); 38 | } 39 | //if you don't use ProgressDialog, you must stop the application by your self, and until this message. 40 | break; 41 | } 42 | } 43 | }; 44 | 45 | protected void onDestroy(){ 46 | super.onDestroy(); 47 | } 48 | 49 | @Override 50 | protected void onCreate(Bundle savedInstanceState) { 51 | super.onCreate(savedInstanceState); 52 | setContentView(R.layout.activity_main); 53 | mContext = this; 54 | 55 | //test for x86 56 | //DecRawso.ConfigureFilter("libffmpeg", "libffmpeg_x86.so"); 57 | 58 | if(sync_async==0) 59 | { 60 | //DecRawso.NewInstance(mContext.getApplicationContext(),mDecRawsoHdl,true); //you can use ApplicationContext 61 | DecRawso.NewInstance(mContext,mDecRawsoHdl,true); 62 | } 63 | else 64 | { 65 | //you can also use sync call 66 | DecRawso.NewInstance(mContext,null,false); 67 | // you can also add here, but if decoding use too much time, it will make application no response 68 | // if you loadlib just after initial, it will change to sync call (not recommend) 69 | DecRawso.GetInstance().waitdecoding(); 70 | switchto(); 71 | //this.finish(); 72 | } 73 | //test for x86 74 | //DecRawso.ConfigureFilter("libffmpeg", "libffmpeg_x86xx.so"); 75 | } 76 | 77 | @Override 78 | public boolean onCreateOptionsMenu(Menu menu) { 79 | // Inflate the menu; this adds items to the action bar if it is present. 80 | getMenuInflater().inflate(R.menu.main, menu); 81 | return true; 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /CompressDemo/src/com/example/compressdemo/SecondActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.compressdemo; 2 | 3 | import com.example.compressdemo.DemoService.LocalBinder; 4 | 5 | import android.os.Bundle; 6 | import android.app.Activity; 7 | import android.content.ComponentName; 8 | import android.content.Context; 9 | import android.content.Intent; 10 | import android.content.ServiceConnection; 11 | import android.view.Menu; 12 | import android.widget.TextView; 13 | import android.os.IBinder; 14 | 15 | public class SecondActivity extends Activity { 16 | 17 | private TextView tv1; 18 | private TextView tv2; 19 | private TextView tv3; 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_second); 25 | 26 | tv1 = (TextView)findViewById(R.id.textView1); 27 | tv2 = (TextView)findViewById(R.id.textView2); 28 | tv3 = (TextView)findViewById(R.id.TextView3); 29 | 30 | ServiceConnection mSc; 31 | mSc = new ServiceConnection(){ 32 | @Override 33 | public void onServiceConnected(ComponentName name, IBinder service) { 34 | //Log.d(TAG, "service connected"); 35 | DemoService ss = ((LocalBinder)service).getService(); 36 | //ss.sayHelloWorld(); 37 | tv3.setText("Service: "+ss.getLibStr()); 38 | } 39 | 40 | @Override 41 | public void onServiceDisconnected(ComponentName name) { 42 | //Log.d(TAG, "service disconnected"); 43 | } 44 | }; 45 | 46 | Intent service = new Intent(this.getApplicationContext(),DemoService.class); 47 | this.bindService(service, mSc, Context.BIND_AUTO_CREATE); 48 | 49 | JNILib nativelib = new JNILib(); //here System.loadLibrary, !!! DecRawso have been initialed 50 | 51 | tv1.setText(JNILib.whoamione()); 52 | tv2.setText(JNILib.whoamitwo()); 53 | } 54 | 55 | @Override 56 | public boolean onCreateOptionsMenu(Menu menu) { 57 | // Inflate the menu; this adds items to the action bar if it is present. 58 | getMenuInflater().inflate(R.menu.second, menu); 59 | return true; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /DecRawso/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /DecRawso/.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /DecRawso/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | DecRawso 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | ?children? 14 | ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\|| 15 | 16 | 17 | ?name? 18 | 19 | 20 | 21 | org.eclipse.cdt.make.core.append_environment 22 | true 23 | 24 | 25 | org.eclipse.cdt.make.core.buildArguments 26 | 27 | 28 | 29 | org.eclipse.cdt.make.core.buildCommand 30 | ndk-build 31 | 32 | 33 | org.eclipse.cdt.make.core.cleanBuildTarget 34 | clean 35 | 36 | 37 | org.eclipse.cdt.make.core.contents 38 | org.eclipse.cdt.make.core.activeConfigSettings 39 | 40 | 41 | org.eclipse.cdt.make.core.enableAutoBuild 42 | false 43 | 44 | 45 | org.eclipse.cdt.make.core.enableCleanBuild 46 | true 47 | 48 | 49 | org.eclipse.cdt.make.core.enableFullBuild 50 | true 51 | 52 | 53 | org.eclipse.cdt.make.core.stopOnError 54 | true 55 | 56 | 57 | org.eclipse.cdt.make.core.useDefaultBuildCmd 58 | true 59 | 60 | 61 | 62 | 63 | com.android.ide.eclipse.adt.ResourceManagerBuilder 64 | 65 | 66 | 67 | 68 | com.android.ide.eclipse.adt.PreCompilerBuilder 69 | 70 | 71 | 72 | 73 | org.eclipse.jdt.core.javabuilder 74 | 75 | 76 | 77 | 78 | com.android.ide.eclipse.adt.ApkBuilder 79 | 80 | 81 | 82 | 83 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 84 | full,incremental, 85 | 86 | 87 | 88 | 89 | 90 | com.android.ide.eclipse.adt.AndroidNature 91 | org.eclipse.jdt.core.javanature 92 | org.eclipse.cdt.core.cnature 93 | org.eclipse.cdt.core.ccnature 94 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 95 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 96 | 97 | 98 | -------------------------------------------------------------------------------- /DecRawso/.settings/org.eclipse.cdt.codan.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.cdt.codan.checkers.errnoreturn=-Warning 3 | org.eclipse.cdt.codan.checkers.errnoreturn.params={implicit\=>false} 4 | org.eclipse.cdt.codan.checkers.errreturnvalue=-Error 5 | org.eclipse.cdt.codan.checkers.errreturnvalue.params={} 6 | org.eclipse.cdt.codan.checkers.noreturn=-Error 7 | org.eclipse.cdt.codan.checkers.noreturn.params={implicit\=>false} 8 | org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=-Error 9 | org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 10 | org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=-Error 11 | org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 12 | org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=-Warning 13 | org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={} 14 | org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=-Error 15 | org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={} 16 | org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=-Warning 17 | org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false} 18 | org.eclipse.cdt.codan.internal.checkers.CatchByReference=-Warning 19 | org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={unknown\=>false,exceptions\=>()} 20 | org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=-Error 21 | org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 22 | org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=-Error 23 | org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 24 | org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=-Error 25 | org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 26 | org.eclipse.cdt.codan.internal.checkers.InvalidArguments=-Error 27 | org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 28 | org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=-Error 29 | org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 30 | org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=-Error 31 | org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 32 | org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=-Error 33 | org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 34 | org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=-Error 35 | org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 36 | org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info 37 | org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={pattern\=>"^[a-z]",macro\=>true,exceptions\=>()} 38 | org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=-Warning 39 | org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={} 40 | org.eclipse.cdt.codan.internal.checkers.OverloadProblem=-Error 41 | org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 42 | org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=-Error 43 | org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 44 | org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=-Error 45 | org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 46 | org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning 47 | org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={} 48 | org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning 49 | org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={} 50 | org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=-Warning 51 | org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={macro\=>true,exceptions\=>()} 52 | org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=-Warning 53 | org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={paramNot\=>false} 54 | org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=-Warning 55 | org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={else\=>false,afterelse\=>false} 56 | org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=-Error 57 | org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 58 | org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=-Warning 59 | org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={macro\=>true} 60 | org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=-Warning 61 | org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={macro\=>true} 62 | org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=-Warning 63 | org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={macro\=>true,exceptions\=>("@(\#)","$Id")} 64 | org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=-Error 65 | org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} 66 | -------------------------------------------------------------------------------- /DecRawso/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /DecRawso/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DecRawso/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.intel.only7zdec; 2 | 3 | import java.io.File; 4 | import java.lang.reflect.InvocationTargetException; 5 | import android.os.Bundle; 6 | import android.app.Activity; 7 | import android.content.Context; 8 | import android.view.Menu; 9 | import android.view.View; 10 | import android.widget.Button; 11 | import android.widget.ImageButton; 12 | import android.widget.Toast; 13 | 14 | public class MainActivity extends Activity { 15 | 16 | private Button m_ButtonStart; 17 | private Context cont; 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_main); 23 | cont = this.getApplicationContext(); 24 | 25 | m_ButtonStart = (Button)findViewById(R.id.button1); 26 | m_ButtonStart.setOnClickListener(new Button.OnClickListener() 27 | { 28 | public void onClick(View v) 29 | { 30 | //JNILib.Decode("/sdcard/test7z/test.7z",temp); 31 | JNILib tt = new JNILib(cont); 32 | } 33 | } 34 | ); 35 | } 36 | 37 | @Override 38 | public boolean onCreateOptionsMenu(Menu menu) { 39 | // Inflate the menu; this adds items to the action bar if it is present. 40 | getMenuInflater().inflate(R.menu.main, menu); 41 | return true; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /DecRawso/NativeLibraryHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.internal.content; 18 | 19 | import android.content.pm.PackageManager; 20 | import android.os.Build; 21 | import android.os.SystemProperties; 22 | import android.util.Slog; 23 | 24 | import java.io.File; 25 | 26 | /** 27 | * Native libraries helper. 28 | * 29 | * @hide 30 | */ 31 | public class NativeLibraryHelper { 32 | private static final String TAG = "NativeHelper"; 33 | 34 | private static final boolean DEBUG_NATIVE = false; 35 | private static final boolean ENABLE_HOUDINI = Build.CPU_ABI.equals("x86") && (Build.CPU_ABI2.length()!=0); 36 | 37 | private static native long nativeSumNativeBinaries(String file, String cpuAbi, String cpuAbi2); 38 | 39 | /** 40 | * Sums the size of native binaries in an APK. 41 | * 42 | * @param apkFile APK file to scan for native libraries 43 | * @return size of all native binary files in bytes 44 | */ 45 | public static long sumNativeBinariesLI(File apkFile) { 46 | final String cpuAbi = Build.CPU_ABI; 47 | final String cpuAbi2 = Build.CPU_ABI2; 48 | 49 | if (ENABLE_HOUDINI) { 50 | long result = nativeSumNativeBinaries(apkFile.getPath(), cpuAbi, cpuAbi2); 51 | if (result == 0) { 52 | final String abiUpgrade = SystemProperties.get("ro.product.cpu.upgradeabi", "armeabi"); 53 | result = nativeSumNativeBinaries(apkFile.getPath(), cpuAbi, abiUpgrade); 54 | } 55 | return result; 56 | } else { 57 | return nativeSumNativeBinaries(apkFile.getPath(), cpuAbi, cpuAbi2); 58 | } 59 | } 60 | 61 | private static native int nativeListNativeBinaries(String file, String cpuAbi, String cpuAbi2); 62 | 63 | /** 64 | * List the native binaries info in an APK. 65 | * 66 | * @param apkFile APK file to scan for native libraries 67 | * @return {@link PackageManager#INSTALL_SUCCEEDED} or {@link PackageManager#INSTALL_ABI2_SUCCEEDED} 68 | * or another error code from that class if not 69 | */ 70 | public static int listNativeBinariesLI(File apkFile) { 71 | final String cpuAbi = Build.CPU_ABI; 72 | final String cpuAbi2 = Build.CPU_ABI2; 73 | 74 | if (ENABLE_HOUDINI) { 75 | int result = nativeListNativeBinaries(apkFile.getPath(), cpuAbi, cpuAbi2); 76 | if ((result != PackageManager.INSTALL_SUCCEEDED) && (result != PackageManager.INSTALL_ABI2_SUCCEEDED)) { 77 | final String abiUpgrade = SystemProperties.get("ro.product.cpu.upgradeabi", "armeabi"); 78 | result = nativeListNativeBinaries(apkFile.getPath(), cpuAbi, abiUpgrade); 79 | } 80 | return result; 81 | } else { 82 | return PackageManager.INSTALL_SUCCEEDED; 83 | } 84 | } 85 | 86 | 87 | private native static int nativeCopyNativeBinaries(String filePath, String sharedLibraryPath, 88 | String cpuAbi, String cpuAbi2); 89 | 90 | /** 91 | * Copies native binaries to a shared library directory. 92 | * 93 | * @param apkFile APK file to scan for native libraries 94 | * @param sharedLibraryDir directory for libraries to be copied to 95 | * @return {@link PackageManager#INSTALL_SUCCEEDED} or {@link PackageManager#INSTALL_ABI2_SUCCEEDED} 96 | * if successful or another error code from that class if not 97 | */ 98 | public static int copyNativeBinariesIfNeededLI(File apkFile, File sharedLibraryDir) { 99 | final String cpuAbi = Build.CPU_ABI; 100 | final String cpuAbi2 = Build.CPU_ABI2; 101 | 102 | if (ENABLE_HOUDINI) { 103 | int result = nativeCopyNativeBinaries(apkFile.getPath(), sharedLibraryDir.getPath(), cpuAbi, cpuAbi2); 104 | if ((result != PackageManager.INSTALL_SUCCEEDED) && (result != PackageManager.INSTALL_ABI2_SUCCEEDED)) { 105 | final String abiUpgrade = SystemProperties.get("ro.product.cpu.upgradeabi", "armeabi"); 106 | result = nativeCopyNativeBinaries(apkFile.getPath(), sharedLibraryDir.getPath(), cpuAbi, abiUpgrade); 107 | } 108 | return result; 109 | } else { 110 | return nativeCopyNativeBinaries(apkFile.getPath(), sharedLibraryDir.getPath(), cpuAbi, cpuAbi2); 111 | } 112 | } 113 | 114 | // Convenience method to call removeNativeBinariesFromDirLI(File) 115 | public static boolean removeNativeBinariesLI(String nativeLibraryPath) { 116 | return removeNativeBinariesFromDirLI(new File(nativeLibraryPath)); 117 | } 118 | 119 | // Remove the native binaries of a given package. This simply 120 | // gets rid of the files in the 'lib' sub-directory. 121 | public static boolean removeNativeBinariesFromDirLI(File nativeLibraryDir) { 122 | if (DEBUG_NATIVE) { 123 | Slog.w(TAG, "Deleting native binaries from: " + nativeLibraryDir.getPath()); 124 | } 125 | 126 | boolean deletedFiles = false; 127 | 128 | /* 129 | * Just remove any file in the directory. Since the directory is owned 130 | * by the 'system' UID, the application is not supposed to have written 131 | * anything there. 132 | */ 133 | if (nativeLibraryDir.exists()) { 134 | final File[] binaries = nativeLibraryDir.listFiles(); 135 | if (binaries != null) { 136 | for (int nn = 0; nn < binaries.length; nn++) { 137 | if (DEBUG_NATIVE) { 138 | Slog.d(TAG, " Deleting " + binaries[nn].getName()); 139 | } 140 | 141 | if (!binaries[nn].delete()) { 142 | Slog.w(TAG, "Could not delete native binary: " + binaries[nn].getPath()); 143 | } else { 144 | deletedFiles = true; 145 | } 146 | } 147 | } 148 | // Do not delete 'lib' directory itself, or this will prevent 149 | // installation of future updates. 150 | } 151 | 152 | return deletedFiles; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /DecRawso/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/ic_launcher-web.png -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7z.h: -------------------------------------------------------------------------------- 1 | /* 7z.h -- 7z interface 2 | 2010-03-11 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_H 5 | #define __7Z_H 6 | 7 | #include "7zBuf.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | #define k7zStartHeaderSize 0x20 12 | #define k7zSignatureSize 6 13 | extern Byte k7zSignature[k7zSignatureSize]; 14 | #define k7zMajorVersion 0 15 | 16 | enum EIdEnum 17 | { 18 | k7zIdEnd, 19 | k7zIdHeader, 20 | k7zIdArchiveProperties, 21 | k7zIdAdditionalStreamsInfo, 22 | k7zIdMainStreamsInfo, 23 | k7zIdFilesInfo, 24 | k7zIdPackInfo, 25 | k7zIdUnpackInfo, 26 | k7zIdSubStreamsInfo, 27 | k7zIdSize, 28 | k7zIdCRC, 29 | k7zIdFolder, 30 | k7zIdCodersUnpackSize, 31 | k7zIdNumUnpackStream, 32 | k7zIdEmptyStream, 33 | k7zIdEmptyFile, 34 | k7zIdAnti, 35 | k7zIdName, 36 | k7zIdCTime, 37 | k7zIdATime, 38 | k7zIdMTime, 39 | k7zIdWinAttributes, 40 | k7zIdComment, 41 | k7zIdEncodedHeader, 42 | k7zIdStartPos, 43 | k7zIdDummy 44 | }; 45 | 46 | typedef struct 47 | { 48 | UInt32 NumInStreams; 49 | UInt32 NumOutStreams; 50 | UInt64 MethodID; 51 | CBuf Props; 52 | } CSzCoderInfo; 53 | 54 | void SzCoderInfo_Init(CSzCoderInfo *p); 55 | void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc); 56 | 57 | typedef struct 58 | { 59 | UInt32 InIndex; 60 | UInt32 OutIndex; 61 | } CSzBindPair; 62 | 63 | typedef struct 64 | { 65 | CSzCoderInfo *Coders; 66 | CSzBindPair *BindPairs; 67 | UInt32 *PackStreams; 68 | UInt64 *UnpackSizes; 69 | UInt32 NumCoders; 70 | UInt32 NumBindPairs; 71 | UInt32 NumPackStreams; 72 | int UnpackCRCDefined; 73 | UInt32 UnpackCRC; 74 | 75 | UInt32 NumUnpackStreams; 76 | } CSzFolder; 77 | 78 | void SzFolder_Init(CSzFolder *p); 79 | UInt64 SzFolder_GetUnpackSize(CSzFolder *p); 80 | int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex); 81 | UInt32 SzFolder_GetNumOutStreams(CSzFolder *p); 82 | UInt64 SzFolder_GetUnpackSize(CSzFolder *p); 83 | 84 | SRes SzFolder_Decode(const CSzFolder *folder, const UInt64 *packSizes, 85 | ILookInStream *stream, UInt64 startPos, 86 | Byte *outBuffer, size_t outSize, ISzAlloc *allocMain); 87 | 88 | typedef struct 89 | { 90 | UInt32 Low; 91 | UInt32 High; 92 | } CNtfsFileTime; 93 | 94 | typedef struct 95 | { 96 | CNtfsFileTime MTime; 97 | UInt64 Size; 98 | UInt32 Crc; 99 | UInt32 Attrib; 100 | Byte HasStream; 101 | Byte IsDir; 102 | Byte IsAnti; 103 | Byte CrcDefined; 104 | Byte MTimeDefined; 105 | Byte AttribDefined; 106 | } CSzFileItem; 107 | 108 | void SzFile_Init(CSzFileItem *p); 109 | 110 | typedef struct 111 | { 112 | UInt64 *PackSizes; 113 | Byte *PackCRCsDefined; 114 | UInt32 *PackCRCs; 115 | CSzFolder *Folders; 116 | CSzFileItem *Files; 117 | UInt32 NumPackStreams; 118 | UInt32 NumFolders; 119 | UInt32 NumFiles; 120 | } CSzAr; 121 | 122 | void SzAr_Init(CSzAr *p); 123 | void SzAr_Free(CSzAr *p, ISzAlloc *alloc); 124 | 125 | 126 | /* 127 | SzExtract extracts file from archive 128 | 129 | *outBuffer must be 0 before first call for each new archive. 130 | 131 | Extracting cache: 132 | If you need to decompress more than one file, you can send 133 | these values from previous call: 134 | *blockIndex, 135 | *outBuffer, 136 | *outBufferSize 137 | You can consider "*outBuffer" as cache of solid block. If your archive is solid, 138 | it will increase decompression speed. 139 | 140 | If you use external function, you can declare these 3 cache variables 141 | (blockIndex, outBuffer, outBufferSize) as static in that external function. 142 | 143 | Free *outBuffer and set *outBuffer to 0, if you want to flush cache. 144 | */ 145 | 146 | typedef struct 147 | { 148 | CSzAr db; 149 | 150 | UInt64 startPosAfterHeader; 151 | UInt64 dataPos; 152 | 153 | UInt32 *FolderStartPackStreamIndex; 154 | UInt64 *PackStreamStartPositions; 155 | UInt32 *FolderStartFileIndex; 156 | UInt32 *FileIndexToFolderIndexMap; 157 | 158 | size_t *FileNameOffsets; /* in 2-byte steps */ 159 | CBuf FileNames; /* UTF-16-LE */ 160 | } CSzArEx; 161 | 162 | void SzArEx_Init(CSzArEx *p); 163 | void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc); 164 | UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder); 165 | int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *resSize); 166 | 167 | /* 168 | if dest == NULL, the return value specifies the required size of the buffer, 169 | in 16-bit characters, including the null-terminating character. 170 | if dest != NULL, the return value specifies the number of 16-bit characters that 171 | are written to the dest, including the null-terminating character. */ 172 | 173 | size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest); 174 | 175 | SRes SzArEx_Extract( 176 | const CSzArEx *db, 177 | ILookInStream *inStream, 178 | UInt32 fileIndex, /* index of file */ 179 | UInt32 *blockIndex, /* index of solid block */ 180 | Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */ 181 | size_t *outBufferSize, /* buffer size for output buffer */ 182 | size_t *offset, /* offset of stream for required file in *outBuffer */ 183 | size_t *outSizeProcessed, /* size of file in *outBuffer */ 184 | ISzAlloc *allocMain, 185 | ISzAlloc *allocTemp); 186 | 187 | 188 | /* 189 | SzArEx_Open Errors: 190 | SZ_ERROR_NO_ARCHIVE 191 | SZ_ERROR_ARCHIVE 192 | SZ_ERROR_UNSUPPORTED 193 | SZ_ERROR_MEM 194 | SZ_ERROR_CRC 195 | SZ_ERROR_INPUT_EOF 196 | SZ_ERROR_FAIL 197 | */ 198 | 199 | SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAlloc *allocTemp); 200 | 201 | EXTERN_C_END 202 | 203 | #endif 204 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zAlloc.c: -------------------------------------------------------------------------------- 1 | /* 7zAlloc.c -- Allocation functions 2 | 2010-10-29 : Igor Pavlov : Public domain */ 3 | 4 | #include "7zAlloc.h" 5 | 6 | /* #define _SZ_ALLOC_DEBUG */ 7 | /* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ 8 | 9 | #ifdef _SZ_ALLOC_DEBUG 10 | 11 | #ifdef _WIN32 12 | #include 13 | #endif 14 | 15 | #include 16 | int g_allocCount = 0; 17 | int g_allocCountTemp = 0; 18 | 19 | #endif 20 | 21 | void *SzAlloc(void *p, size_t size) 22 | { 23 | p = p; 24 | if (size == 0) 25 | return 0; 26 | #ifdef _SZ_ALLOC_DEBUG 27 | fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount); 28 | g_allocCount++; 29 | #endif 30 | return malloc(size); 31 | } 32 | 33 | void SzFree(void *p, void *address) 34 | { 35 | p = p; 36 | #ifdef _SZ_ALLOC_DEBUG 37 | if (address != 0) 38 | { 39 | g_allocCount--; 40 | fprintf(stderr, "\nFree; count = %10d", g_allocCount); 41 | } 42 | #endif 43 | free(address); 44 | } 45 | 46 | void *SzAllocTemp(void *p, size_t size) 47 | { 48 | p = p; 49 | if (size == 0) 50 | return 0; 51 | #ifdef _SZ_ALLOC_DEBUG 52 | fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp); 53 | g_allocCountTemp++; 54 | #ifdef _WIN32 55 | return HeapAlloc(GetProcessHeap(), 0, size); 56 | #endif 57 | #endif 58 | return malloc(size); 59 | } 60 | 61 | void SzFreeTemp(void *p, void *address) 62 | { 63 | p = p; 64 | #ifdef _SZ_ALLOC_DEBUG 65 | if (address != 0) 66 | { 67 | g_allocCountTemp--; 68 | fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp); 69 | } 70 | #ifdef _WIN32 71 | HeapFree(GetProcessHeap(), 0, address); 72 | return; 73 | #endif 74 | #endif 75 | free(address); 76 | } 77 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zAlloc.h: -------------------------------------------------------------------------------- 1 | /* 7zAlloc.h -- Allocation functions 2 | 2010-10-29 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_ALLOC_H 5 | #define __7Z_ALLOC_H 6 | 7 | #include 8 | 9 | void *SzAlloc(void *p, size_t size); 10 | void SzFree(void *p, void *address); 11 | 12 | void *SzAllocTemp(void *p, size_t size); 13 | void SzFreeTemp(void *p, void *address); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zBuf.c: -------------------------------------------------------------------------------- 1 | /* 7zBuf.c -- Byte Buffer 2 | 2008-03-28 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #include "7zBuf.h" 7 | 8 | void Buf_Init(CBuf *p) 9 | { 10 | p->data = 0; 11 | p->size = 0; 12 | } 13 | 14 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc) 15 | { 16 | p->size = 0; 17 | if (size == 0) 18 | { 19 | p->data = 0; 20 | return 1; 21 | } 22 | p->data = (Byte *)alloc->Alloc(alloc, size); 23 | if (p->data != 0) 24 | { 25 | p->size = size; 26 | return 1; 27 | } 28 | return 0; 29 | } 30 | 31 | void Buf_Free(CBuf *p, ISzAlloc *alloc) 32 | { 33 | alloc->Free(alloc, p->data); 34 | p->data = 0; 35 | p->size = 0; 36 | } 37 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zBuf.h: -------------------------------------------------------------------------------- 1 | /* 7zBuf.h -- Byte Buffer 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_BUF_H 5 | #define __7Z_BUF_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | typedef struct 14 | { 15 | Byte *data; 16 | size_t size; 17 | } CBuf; 18 | 19 | void Buf_Init(CBuf *p); 20 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc); 21 | void Buf_Free(CBuf *p, ISzAlloc *alloc); 22 | 23 | typedef struct 24 | { 25 | Byte *data; 26 | size_t size; 27 | size_t pos; 28 | } CDynBuf; 29 | 30 | void DynBuf_Construct(CDynBuf *p); 31 | void DynBuf_SeekToBeg(CDynBuf *p); 32 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc); 33 | void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zCrc.c: -------------------------------------------------------------------------------- 1 | /* 7zCrc.c -- CRC32 calculation 2 | 2009-11-23 : Igor Pavlov : Public domain */ 3 | 4 | #include "7zCrc.h" 5 | #include "CpuArch.h" 6 | 7 | #define kCrcPoly 0xEDB88320 8 | 9 | #ifdef MY_CPU_LE 10 | #define CRC_NUM_TABLES 8 11 | #else 12 | #define CRC_NUM_TABLES 1 13 | #endif 14 | 15 | typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table); 16 | 17 | static CRC_FUNC g_CrcUpdate; 18 | UInt32 g_CrcTable[256 * CRC_NUM_TABLES]; 19 | 20 | #if CRC_NUM_TABLES == 1 21 | 22 | #define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 23 | 24 | static UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table) 25 | { 26 | const Byte *p = (const Byte *)data; 27 | for (; size > 0; size--, p++) 28 | v = CRC_UPDATE_BYTE_2(v, *p); 29 | return v; 30 | } 31 | 32 | #else 33 | 34 | UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table); 35 | UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table); 36 | 37 | #endif 38 | 39 | UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size) 40 | { 41 | return g_CrcUpdate(v, data, size, g_CrcTable); 42 | } 43 | 44 | UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size) 45 | { 46 | return g_CrcUpdate(CRC_INIT_VAL, data, size, g_CrcTable) ^ CRC_INIT_VAL; 47 | } 48 | 49 | void MY_FAST_CALL CrcGenerateTable() 50 | { 51 | UInt32 i; 52 | for (i = 0; i < 256; i++) 53 | { 54 | UInt32 r = i; 55 | unsigned j; 56 | for (j = 0; j < 8; j++) 57 | r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); 58 | g_CrcTable[i] = r; 59 | } 60 | #if CRC_NUM_TABLES == 1 61 | g_CrcUpdate = CrcUpdateT1; 62 | #else 63 | for (; i < 256 * CRC_NUM_TABLES; i++) 64 | { 65 | UInt32 r = g_CrcTable[i - 256]; 66 | g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8); 67 | } 68 | g_CrcUpdate = CrcUpdateT4; 69 | #ifdef MY_CPU_X86_OR_AMD64 70 | if (!CPU_Is_InOrder()) 71 | g_CrcUpdate = CrcUpdateT8; 72 | #endif 73 | #endif 74 | } 75 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zCrc.h: -------------------------------------------------------------------------------- 1 | /* 7zCrc.h -- CRC32 calculation 2 | 2009-11-21 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_CRC_H 5 | #define __7Z_CRC_H 6 | 7 | #include "Types.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | extern UInt32 g_CrcTable[]; 12 | 13 | /* Call CrcGenerateTable one time before other CRC functions */ 14 | void MY_FAST_CALL CrcGenerateTable(void); 15 | 16 | #define CRC_INIT_VAL 0xFFFFFFFF 17 | #define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL) 18 | #define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 19 | 20 | UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size); 21 | UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size); 22 | 23 | EXTERN_C_END 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zCrcOpt.c: -------------------------------------------------------------------------------- 1 | /* 7zCrcOpt.c -- CRC32 calculation : optimized version 2 | 2009-11-23 : Igor Pavlov : Public domain */ 3 | 4 | #include "CpuArch.h" 5 | 6 | #ifdef MY_CPU_LE 7 | 8 | #define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 9 | 10 | UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table) 11 | { 12 | const Byte *p = (const Byte *)data; 13 | for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) 14 | v = CRC_UPDATE_BYTE_2(v, *p); 15 | for (; size >= 4; size -= 4, p += 4) 16 | { 17 | v ^= *(const UInt32 *)p; 18 | v = 19 | table[0x300 + (v & 0xFF)] ^ 20 | table[0x200 + ((v >> 8) & 0xFF)] ^ 21 | table[0x100 + ((v >> 16) & 0xFF)] ^ 22 | table[0x000 + ((v >> 24))]; 23 | } 24 | for (; size > 0; size--, p++) 25 | v = CRC_UPDATE_BYTE_2(v, *p); 26 | return v; 27 | } 28 | 29 | UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table) 30 | { 31 | return CrcUpdateT4(v, data, size, table); 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zFile.c: -------------------------------------------------------------------------------- 1 | /* 7zFile.c -- File IO 2 | 2009-11-24 : Igor Pavlov : Public domain */ 3 | 4 | #include "7zFile.h" 5 | 6 | #include 7 | #define LOG_TAG "7z" 8 | //#define msg_Dbg(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) 9 | #define msg_Dbg(...) 10 | 11 | #ifndef USE_WINDOWS_FILE 12 | 13 | #ifndef UNDER_CE 14 | #include 15 | #endif 16 | 17 | #else 18 | 19 | /* 20 | ReadFile and WriteFile functions in Windows have BUG: 21 | If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1) 22 | from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES 23 | (Insufficient system resources exist to complete the requested service). 24 | Probably in some version of Windows there are problems with other sizes: 25 | for 32 MB (maybe also for 16 MB). 26 | And message can be "Network connection was lost" 27 | */ 28 | 29 | #define kChunkSizeMax (1 << 22) 30 | 31 | #endif 32 | 33 | void File_Construct(CSzFile *p) 34 | { 35 | #ifdef USE_WINDOWS_FILE 36 | p->handle = INVALID_HANDLE_VALUE; 37 | #else 38 | p->file = NULL; 39 | #endif 40 | } 41 | 42 | #if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE) 43 | static WRes File_Open(CSzFile *p, const char *name, int writeMode) 44 | { 45 | #ifdef USE_WINDOWS_FILE 46 | p->handle = CreateFileA(name, 47 | writeMode ? GENERIC_WRITE : GENERIC_READ, 48 | FILE_SHARE_READ, NULL, 49 | writeMode ? CREATE_ALWAYS : OPEN_EXISTING, 50 | FILE_ATTRIBUTE_NORMAL, NULL); 51 | return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError(); 52 | #else 53 | if(p->mgr) 54 | { 55 | #ifndef ANDROID22 56 | p->asset = AAssetManager_open(p->mgr,name,AASSET_MODE_UNKNOWN); 57 | #endif 58 | return (p->asset != NULL) ? 0 : 2; 59 | } 60 | else 61 | { 62 | p->file = fopen(name, writeMode ? "wb+" : "rb"); 63 | return (p->file != 0) ? 0 : 64 | #ifdef UNDER_CE 65 | 2; /* ENOENT */ 66 | #else 67 | errno; 68 | #endif 69 | } 70 | #endif 71 | } 72 | 73 | WRes InFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 0); } 74 | WRes OutFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 1); } 75 | #endif 76 | 77 | #ifdef USE_WINDOWS_FILE 78 | static WRes File_OpenW(CSzFile *p, const WCHAR *name, int writeMode) 79 | { 80 | p->handle = CreateFileW(name, 81 | writeMode ? GENERIC_WRITE : GENERIC_READ, 82 | FILE_SHARE_READ, NULL, 83 | writeMode ? CREATE_ALWAYS : OPEN_EXISTING, 84 | FILE_ATTRIBUTE_NORMAL, NULL); 85 | return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError(); 86 | } 87 | WRes InFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 0); } 88 | WRes OutFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 1); } 89 | #endif 90 | 91 | WRes File_Close(CSzFile *p) 92 | { 93 | #ifdef USE_WINDOWS_FILE 94 | if (p->handle != INVALID_HANDLE_VALUE) 95 | { 96 | if (!CloseHandle(p->handle)) 97 | return GetLastError(); 98 | p->handle = INVALID_HANDLE_VALUE; 99 | } 100 | #else 101 | if(p->mgr) 102 | { 103 | #ifndef ANDROID22 104 | if(p->asset) 105 | AAsset_close(p->asset); 106 | #endif 107 | p->asset = NULL; 108 | } 109 | else if (p->file != NULL) 110 | { 111 | int res = fclose(p->file); 112 | if (res != 0) 113 | return res; 114 | p->file = NULL; 115 | } 116 | #endif 117 | return 0; 118 | } 119 | 120 | WRes File_Read(CSzFile *p, void *data, size_t *size) 121 | { 122 | size_t originalSize = *size; 123 | if (originalSize == 0) 124 | return 0; 125 | 126 | #ifdef USE_WINDOWS_FILE 127 | 128 | *size = 0; 129 | do 130 | { 131 | DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize; 132 | DWORD processed = 0; 133 | BOOL res = ReadFile(p->handle, data, curSize, &processed, NULL); 134 | data = (void *)((Byte *)data + processed); 135 | originalSize -= processed; 136 | *size += processed; 137 | if (!res) 138 | return GetLastError(); 139 | if (processed == 0) 140 | break; 141 | } 142 | while (originalSize > 0); 143 | return 0; 144 | 145 | #else 146 | if(p->mgr) 147 | { 148 | msg_Dbg("file read"); 149 | #ifndef ANDROID22 150 | if(p->asset) 151 | *size = AAsset_read(p->asset,data,originalSize); 152 | #endif 153 | if (*size == originalSize) 154 | return 0; 155 | return -1; 156 | } 157 | else 158 | { 159 | *size = fread(data, 1, originalSize, p->file); 160 | if (*size == originalSize) 161 | return 0; 162 | return ferror(p->file); 163 | } 164 | 165 | #endif 166 | } 167 | 168 | WRes File_Write(CSzFile *p, const void *data, size_t *size) 169 | { 170 | size_t originalSize = *size; 171 | if (originalSize == 0) 172 | return 0; 173 | 174 | #ifdef USE_WINDOWS_FILE 175 | 176 | *size = 0; 177 | do 178 | { 179 | DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize; 180 | DWORD processed = 0; 181 | BOOL res = WriteFile(p->handle, data, curSize, &processed, NULL); 182 | data = (void *)((Byte *)data + processed); 183 | originalSize -= processed; 184 | *size += processed; 185 | if (!res) 186 | return GetLastError(); 187 | if (processed == 0) 188 | break; 189 | } 190 | while (originalSize > 0); 191 | return 0; 192 | 193 | #else 194 | 195 | if(p->mgr) 196 | { 197 | msg_Dbg("file write"); 198 | return -1; 199 | } 200 | else 201 | { 202 | *size = fwrite(data, 1, originalSize, p->file); 203 | if (*size == originalSize) 204 | return 0; 205 | return ferror(p->file); 206 | } 207 | #endif 208 | } 209 | 210 | WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin) 211 | { 212 | #ifdef USE_WINDOWS_FILE 213 | 214 | LARGE_INTEGER value; 215 | DWORD moveMethod; 216 | value.LowPart = (DWORD)*pos; 217 | value.HighPart = (LONG)((UInt64)*pos >> 16 >> 16); /* for case when UInt64 is 32-bit only */ 218 | switch (origin) 219 | { 220 | case SZ_SEEK_SET: moveMethod = FILE_BEGIN; break; 221 | case SZ_SEEK_CUR: moveMethod = FILE_CURRENT; break; 222 | case SZ_SEEK_END: moveMethod = FILE_END; break; 223 | default: return ERROR_INVALID_PARAMETER; 224 | } 225 | value.LowPart = SetFilePointer(p->handle, value.LowPart, &value.HighPart, moveMethod); 226 | if (value.LowPart == 0xFFFFFFFF) 227 | { 228 | WRes res = GetLastError(); 229 | if (res != NO_ERROR) 230 | return res; 231 | } 232 | *pos = ((Int64)value.HighPart << 32) | value.LowPart; 233 | return 0; 234 | 235 | #else 236 | 237 | int moveMethod; 238 | int res; 239 | switch (origin) 240 | { 241 | case SZ_SEEK_SET: moveMethod = SEEK_SET; break; 242 | case SZ_SEEK_CUR: moveMethod = SEEK_CUR; break; 243 | case SZ_SEEK_END: moveMethod = SEEK_END; break; 244 | default: return 1; 245 | } 246 | 247 | if(p->mgr) 248 | { 249 | msg_Dbg("file seek"); 250 | #ifndef ANDROID22 251 | if(p->asset) 252 | *pos = AAsset_seek(p->asset,(long)*pos, moveMethod); 253 | else 254 | return -1; 255 | #endif 256 | 257 | if(*pos<0) 258 | return -1; 259 | else 260 | return 0; 261 | } 262 | else 263 | { 264 | res = fseek(p->file, (long)*pos, moveMethod); 265 | *pos = ftell(p->file); 266 | return res; 267 | } 268 | 269 | #endif 270 | } 271 | 272 | WRes File_GetLength(CSzFile *p, UInt64 *length) 273 | { 274 | #ifdef USE_WINDOWS_FILE 275 | 276 | DWORD sizeHigh; 277 | DWORD sizeLow = GetFileSize(p->handle, &sizeHigh); 278 | if (sizeLow == 0xFFFFFFFF) 279 | { 280 | DWORD res = GetLastError(); 281 | if (res != NO_ERROR) 282 | return res; 283 | } 284 | *length = (((UInt64)sizeHigh) << 32) + sizeLow; 285 | return 0; 286 | 287 | #else 288 | 289 | if(p->mgr) 290 | { 291 | msg_Dbg("file length"); 292 | #ifndef ANDROID22 293 | if(p->asset) 294 | { 295 | *length = AAsset_getLength(p->asset); 296 | } 297 | else 298 | #endif 299 | return -1; 300 | } 301 | else 302 | { 303 | long pos = ftell(p->file); 304 | int res = fseek(p->file, 0, SEEK_END); 305 | *length = ftell(p->file); 306 | fseek(p->file, pos, SEEK_SET); 307 | return res; 308 | } 309 | 310 | #endif 311 | } 312 | 313 | 314 | /* ---------- FileSeqInStream ---------- */ 315 | 316 | static SRes FileSeqInStream_Read(void *pp, void *buf, size_t *size) 317 | { 318 | CFileSeqInStream *p = (CFileSeqInStream *)pp; 319 | return File_Read(&p->file, buf, size) == 0 ? SZ_OK : SZ_ERROR_READ; 320 | } 321 | 322 | void FileSeqInStream_CreateVTable(CFileSeqInStream *p) 323 | { 324 | p->s.Read = FileSeqInStream_Read; 325 | } 326 | 327 | 328 | /* ---------- FileInStream ---------- */ 329 | 330 | static SRes FileInStream_Read(void *pp, void *buf, size_t *size) 331 | { 332 | CFileInStream *p = (CFileInStream *)pp; 333 | return (File_Read(&p->file, buf, size) == 0) ? SZ_OK : SZ_ERROR_READ; 334 | } 335 | 336 | static SRes FileInStream_Seek(void *pp, Int64 *pos, ESzSeek origin) 337 | { 338 | CFileInStream *p = (CFileInStream *)pp; 339 | return File_Seek(&p->file, pos, origin); 340 | } 341 | 342 | void FileInStream_CreateVTable(CFileInStream *p) 343 | { 344 | p->s.Read = FileInStream_Read; 345 | p->s.Seek = FileInStream_Seek; 346 | } 347 | 348 | 349 | /* ---------- FileOutStream ---------- */ 350 | 351 | static size_t FileOutStream_Write(void *pp, const void *data, size_t size) 352 | { 353 | CFileOutStream *p = (CFileOutStream *)pp; 354 | File_Write(&p->file, data, &size); 355 | return size; 356 | } 357 | 358 | void FileOutStream_CreateVTable(CFileOutStream *p) 359 | { 360 | p->s.Write = FileOutStream_Write; 361 | } 362 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zFile.h: -------------------------------------------------------------------------------- 1 | /* 7zFile.h -- File IO 2 | 2009-11-24 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_FILE_H 5 | #define __7Z_FILE_H 6 | 7 | #ifdef _WIN32 8 | #define USE_WINDOWS_FILE 9 | #endif 10 | 11 | #ifdef USE_WINDOWS_FILE 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | #include "Types.h" 18 | #include 19 | 20 | EXTERN_C_BEGIN 21 | 22 | /* ---------- File ---------- */ 23 | 24 | typedef struct 25 | { 26 | #ifdef USE_WINDOWS_FILE 27 | HANDLE handle; 28 | #else 29 | FILE *file; 30 | AAssetManager *mgr; 31 | AAsset *asset; 32 | #endif 33 | } CSzFile; 34 | 35 | void File_Construct(CSzFile *p); 36 | #if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE) 37 | WRes InFile_Open(CSzFile *p, const char *name); 38 | WRes OutFile_Open(CSzFile *p, const char *name); 39 | #endif 40 | #ifdef USE_WINDOWS_FILE 41 | WRes InFile_OpenW(CSzFile *p, const WCHAR *name); 42 | WRes OutFile_OpenW(CSzFile *p, const WCHAR *name); 43 | #endif 44 | WRes File_Close(CSzFile *p); 45 | 46 | /* reads max(*size, remain file's size) bytes */ 47 | WRes File_Read(CSzFile *p, void *data, size_t *size); 48 | 49 | /* writes *size bytes */ 50 | WRes File_Write(CSzFile *p, const void *data, size_t *size); 51 | 52 | WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin); 53 | WRes File_GetLength(CSzFile *p, UInt64 *length); 54 | 55 | 56 | /* ---------- FileInStream ---------- */ 57 | 58 | typedef struct 59 | { 60 | ISeqInStream s; 61 | CSzFile file; 62 | } CFileSeqInStream; 63 | 64 | void FileSeqInStream_CreateVTable(CFileSeqInStream *p); 65 | 66 | 67 | typedef struct 68 | { 69 | ISeekInStream s; 70 | CSzFile file; 71 | } CFileInStream; 72 | 73 | void FileInStream_CreateVTable(CFileInStream *p); 74 | 75 | 76 | typedef struct 77 | { 78 | ISeqOutStream s; 79 | CSzFile file; 80 | } CFileOutStream; 81 | 82 | void FileOutStream_CreateVTable(CFileOutStream *p); 83 | 84 | EXTERN_C_END 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zStream.c: -------------------------------------------------------------------------------- 1 | /* 7zStream.c -- 7z Stream functions 2 | 2010-03-11 : Igor Pavlov : Public domain */ 3 | 4 | #include 5 | 6 | #include "Types.h" 7 | 8 | SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType) 9 | { 10 | while (size != 0) 11 | { 12 | size_t processed = size; 13 | RINOK(stream->Read(stream, buf, &processed)); 14 | if (processed == 0) 15 | return errorType; 16 | buf = (void *)((Byte *)buf + processed); 17 | size -= processed; 18 | } 19 | return SZ_OK; 20 | } 21 | 22 | SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size) 23 | { 24 | return SeqInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF); 25 | } 26 | 27 | SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf) 28 | { 29 | size_t processed = 1; 30 | RINOK(stream->Read(stream, buf, &processed)); 31 | return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF; 32 | } 33 | 34 | SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset) 35 | { 36 | Int64 t = offset; 37 | return stream->Seek(stream, &t, SZ_SEEK_SET); 38 | } 39 | 40 | SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size) 41 | { 42 | const void *lookBuf; 43 | if (*size == 0) 44 | return SZ_OK; 45 | RINOK(stream->Look(stream, &lookBuf, size)); 46 | memcpy(buf, lookBuf, *size); 47 | return stream->Skip(stream, *size); 48 | } 49 | 50 | SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType) 51 | { 52 | while (size != 0) 53 | { 54 | size_t processed = size; 55 | RINOK(stream->Read(stream, buf, &processed)); 56 | if (processed == 0) 57 | return errorType; 58 | buf = (void *)((Byte *)buf + processed); 59 | size -= processed; 60 | } 61 | return SZ_OK; 62 | } 63 | 64 | SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size) 65 | { 66 | return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF); 67 | } 68 | 69 | static SRes LookToRead_Look_Lookahead(void *pp, const void **buf, size_t *size) 70 | { 71 | SRes res = SZ_OK; 72 | CLookToRead *p = (CLookToRead *)pp; 73 | size_t size2 = p->size - p->pos; 74 | if (size2 == 0 && *size > 0) 75 | { 76 | p->pos = 0; 77 | size2 = LookToRead_BUF_SIZE; 78 | res = p->realStream->Read(p->realStream, p->buf, &size2); 79 | p->size = size2; 80 | } 81 | if (size2 < *size) 82 | *size = size2; 83 | *buf = p->buf + p->pos; 84 | return res; 85 | } 86 | 87 | static SRes LookToRead_Look_Exact(void *pp, const void **buf, size_t *size) 88 | { 89 | SRes res = SZ_OK; 90 | CLookToRead *p = (CLookToRead *)pp; 91 | size_t size2 = p->size - p->pos; 92 | if (size2 == 0 && *size > 0) 93 | { 94 | p->pos = 0; 95 | if (*size > LookToRead_BUF_SIZE) 96 | *size = LookToRead_BUF_SIZE; 97 | res = p->realStream->Read(p->realStream, p->buf, size); 98 | size2 = p->size = *size; 99 | } 100 | if (size2 < *size) 101 | *size = size2; 102 | *buf = p->buf + p->pos; 103 | return res; 104 | } 105 | 106 | static SRes LookToRead_Skip(void *pp, size_t offset) 107 | { 108 | CLookToRead *p = (CLookToRead *)pp; 109 | p->pos += offset; 110 | return SZ_OK; 111 | } 112 | 113 | static SRes LookToRead_Read(void *pp, void *buf, size_t *size) 114 | { 115 | CLookToRead *p = (CLookToRead *)pp; 116 | size_t rem = p->size - p->pos; 117 | if (rem == 0) 118 | return p->realStream->Read(p->realStream, buf, size); 119 | if (rem > *size) 120 | rem = *size; 121 | memcpy(buf, p->buf + p->pos, rem); 122 | p->pos += rem; 123 | *size = rem; 124 | return SZ_OK; 125 | } 126 | 127 | static SRes LookToRead_Seek(void *pp, Int64 *pos, ESzSeek origin) 128 | { 129 | CLookToRead *p = (CLookToRead *)pp; 130 | p->pos = p->size = 0; 131 | return p->realStream->Seek(p->realStream, pos, origin); 132 | } 133 | 134 | void LookToRead_CreateVTable(CLookToRead *p, int lookahead) 135 | { 136 | p->s.Look = lookahead ? 137 | LookToRead_Look_Lookahead : 138 | LookToRead_Look_Exact; 139 | p->s.Skip = LookToRead_Skip; 140 | p->s.Read = LookToRead_Read; 141 | p->s.Seek = LookToRead_Seek; 142 | } 143 | 144 | void LookToRead_Init(CLookToRead *p) 145 | { 146 | p->pos = p->size = 0; 147 | } 148 | 149 | static SRes SecToLook_Read(void *pp, void *buf, size_t *size) 150 | { 151 | CSecToLook *p = (CSecToLook *)pp; 152 | return LookInStream_LookRead(p->realStream, buf, size); 153 | } 154 | 155 | void SecToLook_CreateVTable(CSecToLook *p) 156 | { 157 | p->s.Read = SecToLook_Read; 158 | } 159 | 160 | static SRes SecToRead_Read(void *pp, void *buf, size_t *size) 161 | { 162 | CSecToRead *p = (CSecToRead *)pp; 163 | return p->realStream->Read(p->realStream, buf, size); 164 | } 165 | 166 | void SecToRead_CreateVTable(CSecToRead *p) 167 | { 168 | p->s.Read = SecToRead_Read; 169 | } 170 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/7zVersion.h: -------------------------------------------------------------------------------- 1 | #define MY_VER_MAJOR 9 2 | #define MY_VER_MINOR 20 3 | #define MY_VER_BUILD 0 4 | #define MY_VERSION "9.20" 5 | #define MY_DATE "2010-11-18" 6 | #define MY_COPYRIGHT ": Igor Pavlov : Public domain" 7 | #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE 8 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Bcj2.c: -------------------------------------------------------------------------------- 1 | /* Bcj2.c -- Converter for x86 code (BCJ2) 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #include "Bcj2.h" 5 | 6 | #ifdef _LZMA_PROB32 7 | #define CProb UInt32 8 | #else 9 | #define CProb UInt16 10 | #endif 11 | 12 | #define IsJcc(b0, b1) ((b0) == 0x0F && ((b1) & 0xF0) == 0x80) 13 | #define IsJ(b0, b1) ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1)) 14 | 15 | #define kNumTopBits 24 16 | #define kTopValue ((UInt32)1 << kNumTopBits) 17 | 18 | #define kNumBitModelTotalBits 11 19 | #define kBitModelTotal (1 << kNumBitModelTotalBits) 20 | #define kNumMoveBits 5 21 | 22 | #define RC_READ_BYTE (*buffer++) 23 | #define RC_TEST { if (buffer == bufferLim) return SZ_ERROR_DATA; } 24 | #define RC_INIT2 code = 0; range = 0xFFFFFFFF; \ 25 | { int i; for (i = 0; i < 5; i++) { RC_TEST; code = (code << 8) | RC_READ_BYTE; }} 26 | 27 | #define NORMALIZE if (range < kTopValue) { RC_TEST; range <<= 8; code = (code << 8) | RC_READ_BYTE; } 28 | 29 | #define IF_BIT_0(p) ttt = *(p); bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) 30 | #define UPDATE_0(p) range = bound; *(p) = (CProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); NORMALIZE; 31 | #define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CProb)(ttt - (ttt >> kNumMoveBits)); NORMALIZE; 32 | 33 | int Bcj2_Decode( 34 | const Byte *buf0, SizeT size0, 35 | const Byte *buf1, SizeT size1, 36 | const Byte *buf2, SizeT size2, 37 | const Byte *buf3, SizeT size3, 38 | Byte *outBuf, SizeT outSize) 39 | { 40 | CProb p[256 + 2]; 41 | SizeT inPos = 0, outPos = 0; 42 | 43 | const Byte *buffer, *bufferLim; 44 | UInt32 range, code; 45 | Byte prevByte = 0; 46 | 47 | unsigned int i; 48 | for (i = 0; i < sizeof(p) / sizeof(p[0]); i++) 49 | p[i] = kBitModelTotal >> 1; 50 | 51 | buffer = buf3; 52 | bufferLim = buffer + size3; 53 | RC_INIT2 54 | 55 | if (outSize == 0) 56 | return SZ_OK; 57 | 58 | for (;;) 59 | { 60 | Byte b; 61 | CProb *prob; 62 | UInt32 bound; 63 | UInt32 ttt; 64 | 65 | SizeT limit = size0 - inPos; 66 | if (outSize - outPos < limit) 67 | limit = outSize - outPos; 68 | while (limit != 0) 69 | { 70 | Byte b = buf0[inPos]; 71 | outBuf[outPos++] = b; 72 | if (IsJ(prevByte, b)) 73 | break; 74 | inPos++; 75 | prevByte = b; 76 | limit--; 77 | } 78 | 79 | if (limit == 0 || outPos == outSize) 80 | break; 81 | 82 | b = buf0[inPos++]; 83 | 84 | if (b == 0xE8) 85 | prob = p + prevByte; 86 | else if (b == 0xE9) 87 | prob = p + 256; 88 | else 89 | prob = p + 257; 90 | 91 | IF_BIT_0(prob) 92 | { 93 | UPDATE_0(prob) 94 | prevByte = b; 95 | } 96 | else 97 | { 98 | UInt32 dest; 99 | const Byte *v; 100 | UPDATE_1(prob) 101 | if (b == 0xE8) 102 | { 103 | v = buf1; 104 | if (size1 < 4) 105 | return SZ_ERROR_DATA; 106 | buf1 += 4; 107 | size1 -= 4; 108 | } 109 | else 110 | { 111 | v = buf2; 112 | if (size2 < 4) 113 | return SZ_ERROR_DATA; 114 | buf2 += 4; 115 | size2 -= 4; 116 | } 117 | dest = (((UInt32)v[0] << 24) | ((UInt32)v[1] << 16) | 118 | ((UInt32)v[2] << 8) | ((UInt32)v[3])) - ((UInt32)outPos + 4); 119 | outBuf[outPos++] = (Byte)dest; 120 | if (outPos == outSize) 121 | break; 122 | outBuf[outPos++] = (Byte)(dest >> 8); 123 | if (outPos == outSize) 124 | break; 125 | outBuf[outPos++] = (Byte)(dest >> 16); 126 | if (outPos == outSize) 127 | break; 128 | outBuf[outPos++] = prevByte = (Byte)(dest >> 24); 129 | } 130 | } 131 | return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA; 132 | } 133 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Bcj2.h: -------------------------------------------------------------------------------- 1 | /* Bcj2.h -- Converter for x86 code (BCJ2) 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __BCJ2_H 5 | #define __BCJ2_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /* 14 | Conditions: 15 | outSize <= FullOutputSize, 16 | where FullOutputSize is full size of output stream of x86_2 filter. 17 | 18 | If buf0 overlaps outBuf, there are two required conditions: 19 | 1) (buf0 >= outBuf) 20 | 2) (buf0 + size0 >= outBuf + FullOutputSize). 21 | 22 | Returns: 23 | SZ_OK 24 | SZ_ERROR_DATA - Data error 25 | */ 26 | 27 | int Bcj2_Decode( 28 | const Byte *buf0, SizeT size0, 29 | const Byte *buf1, SizeT size1, 30 | const Byte *buf2, SizeT size2, 31 | const Byte *buf3, SizeT size3, 32 | Byte *outBuf, SizeT outSize); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Bra.c: -------------------------------------------------------------------------------- 1 | /* Bra.c -- Converters for RISC code 2 | 2010-04-16 : Igor Pavlov : Public domain */ 3 | 4 | #include "Bra.h" 5 | 6 | SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) 7 | { 8 | SizeT i; 9 | if (size < 4) 10 | return 0; 11 | size -= 4; 12 | ip += 8; 13 | for (i = 0; i <= size; i += 4) 14 | { 15 | if (data[i + 3] == 0xEB) 16 | { 17 | UInt32 dest; 18 | UInt32 src = ((UInt32)data[i + 2] << 16) | ((UInt32)data[i + 1] << 8) | (data[i + 0]); 19 | src <<= 2; 20 | if (encoding) 21 | dest = ip + (UInt32)i + src; 22 | else 23 | dest = src - (ip + (UInt32)i); 24 | dest >>= 2; 25 | data[i + 2] = (Byte)(dest >> 16); 26 | data[i + 1] = (Byte)(dest >> 8); 27 | data[i + 0] = (Byte)dest; 28 | } 29 | } 30 | return i; 31 | } 32 | 33 | SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) 34 | { 35 | SizeT i; 36 | if (size < 4) 37 | return 0; 38 | size -= 4; 39 | ip += 4; 40 | for (i = 0; i <= size; i += 2) 41 | { 42 | if ((data[i + 1] & 0xF8) == 0xF0 && 43 | (data[i + 3] & 0xF8) == 0xF8) 44 | { 45 | UInt32 dest; 46 | UInt32 src = 47 | (((UInt32)data[i + 1] & 0x7) << 19) | 48 | ((UInt32)data[i + 0] << 11) | 49 | (((UInt32)data[i + 3] & 0x7) << 8) | 50 | (data[i + 2]); 51 | 52 | src <<= 1; 53 | if (encoding) 54 | dest = ip + (UInt32)i + src; 55 | else 56 | dest = src - (ip + (UInt32)i); 57 | dest >>= 1; 58 | 59 | data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7)); 60 | data[i + 0] = (Byte)(dest >> 11); 61 | data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7)); 62 | data[i + 2] = (Byte)dest; 63 | i += 2; 64 | } 65 | } 66 | return i; 67 | } 68 | 69 | SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) 70 | { 71 | SizeT i; 72 | if (size < 4) 73 | return 0; 74 | size -= 4; 75 | for (i = 0; i <= size; i += 4) 76 | { 77 | if ((data[i] >> 2) == 0x12 && (data[i + 3] & 3) == 1) 78 | { 79 | UInt32 src = ((UInt32)(data[i + 0] & 3) << 24) | 80 | ((UInt32)data[i + 1] << 16) | 81 | ((UInt32)data[i + 2] << 8) | 82 | ((UInt32)data[i + 3] & (~3)); 83 | 84 | UInt32 dest; 85 | if (encoding) 86 | dest = ip + (UInt32)i + src; 87 | else 88 | dest = src - (ip + (UInt32)i); 89 | data[i + 0] = (Byte)(0x48 | ((dest >> 24) & 0x3)); 90 | data[i + 1] = (Byte)(dest >> 16); 91 | data[i + 2] = (Byte)(dest >> 8); 92 | data[i + 3] &= 0x3; 93 | data[i + 3] |= dest; 94 | } 95 | } 96 | return i; 97 | } 98 | 99 | SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) 100 | { 101 | UInt32 i; 102 | if (size < 4) 103 | return 0; 104 | size -= 4; 105 | for (i = 0; i <= size; i += 4) 106 | { 107 | if ((data[i] == 0x40 && (data[i + 1] & 0xC0) == 0x00) || 108 | (data[i] == 0x7F && (data[i + 1] & 0xC0) == 0xC0)) 109 | { 110 | UInt32 src = 111 | ((UInt32)data[i + 0] << 24) | 112 | ((UInt32)data[i + 1] << 16) | 113 | ((UInt32)data[i + 2] << 8) | 114 | ((UInt32)data[i + 3]); 115 | UInt32 dest; 116 | 117 | src <<= 2; 118 | if (encoding) 119 | dest = ip + i + src; 120 | else 121 | dest = src - (ip + i); 122 | dest >>= 2; 123 | 124 | dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000; 125 | 126 | data[i + 0] = (Byte)(dest >> 24); 127 | data[i + 1] = (Byte)(dest >> 16); 128 | data[i + 2] = (Byte)(dest >> 8); 129 | data[i + 3] = (Byte)dest; 130 | } 131 | } 132 | return i; 133 | } 134 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Bra.h: -------------------------------------------------------------------------------- 1 | /* Bra.h -- Branch converters for executables 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __BRA_H 5 | #define __BRA_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /* 14 | These functions convert relative addresses to absolute addresses 15 | in CALL instructions to increase the compression ratio. 16 | 17 | In: 18 | data - data buffer 19 | size - size of data 20 | ip - current virtual Instruction Pinter (IP) value 21 | state - state variable for x86 converter 22 | encoding - 0 (for decoding), 1 (for encoding) 23 | 24 | Out: 25 | state - state variable for x86 converter 26 | 27 | Returns: 28 | The number of processed bytes. If you call these functions with multiple calls, 29 | you must start next call with first byte after block of processed bytes. 30 | 31 | Type Endian Alignment LookAhead 32 | 33 | x86 little 1 4 34 | ARMT little 2 2 35 | ARM little 4 0 36 | PPC big 4 0 37 | SPARC big 4 0 38 | IA64 little 16 0 39 | 40 | size must be >= Alignment + LookAhead, if it's not last block. 41 | If (size < Alignment + LookAhead), converter returns 0. 42 | 43 | Example: 44 | 45 | UInt32 ip = 0; 46 | for () 47 | { 48 | ; size must be >= Alignment + LookAhead, if it's not last block 49 | SizeT processed = Convert(data, size, ip, 1); 50 | data += processed; 51 | size -= processed; 52 | ip += processed; 53 | } 54 | */ 55 | 56 | #define x86_Convert_Init(state) { state = 0; } 57 | SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding); 58 | SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 59 | SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 60 | SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 61 | SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 62 | SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Bra86.c: -------------------------------------------------------------------------------- 1 | /* Bra86.c -- Converter for x86 code (BCJ) 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #include "Bra.h" 5 | 6 | #define Test86MSByte(b) ((b) == 0 || (b) == 0xFF) 7 | 8 | const Byte kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0}; 9 | const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3}; 10 | 11 | SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding) 12 | { 13 | SizeT bufferPos = 0, prevPosT; 14 | UInt32 prevMask = *state & 0x7; 15 | if (size < 5) 16 | return 0; 17 | ip += 5; 18 | prevPosT = (SizeT)0 - 1; 19 | 20 | for (;;) 21 | { 22 | Byte *p = data + bufferPos; 23 | Byte *limit = data + size - 4; 24 | for (; p < limit; p++) 25 | if ((*p & 0xFE) == 0xE8) 26 | break; 27 | bufferPos = (SizeT)(p - data); 28 | if (p >= limit) 29 | break; 30 | prevPosT = bufferPos - prevPosT; 31 | if (prevPosT > 3) 32 | prevMask = 0; 33 | else 34 | { 35 | prevMask = (prevMask << ((int)prevPosT - 1)) & 0x7; 36 | if (prevMask != 0) 37 | { 38 | Byte b = p[4 - kMaskToBitNumber[prevMask]]; 39 | if (!kMaskToAllowedStatus[prevMask] || Test86MSByte(b)) 40 | { 41 | prevPosT = bufferPos; 42 | prevMask = ((prevMask << 1) & 0x7) | 1; 43 | bufferPos++; 44 | continue; 45 | } 46 | } 47 | } 48 | prevPosT = bufferPos; 49 | 50 | if (Test86MSByte(p[4])) 51 | { 52 | UInt32 src = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]); 53 | UInt32 dest; 54 | for (;;) 55 | { 56 | Byte b; 57 | int index; 58 | if (encoding) 59 | dest = (ip + (UInt32)bufferPos) + src; 60 | else 61 | dest = src - (ip + (UInt32)bufferPos); 62 | if (prevMask == 0) 63 | break; 64 | index = kMaskToBitNumber[prevMask] * 8; 65 | b = (Byte)(dest >> (24 - index)); 66 | if (!Test86MSByte(b)) 67 | break; 68 | src = dest ^ ((1 << (32 - index)) - 1); 69 | } 70 | p[4] = (Byte)(~(((dest >> 24) & 1) - 1)); 71 | p[3] = (Byte)(dest >> 16); 72 | p[2] = (Byte)(dest >> 8); 73 | p[1] = (Byte)dest; 74 | bufferPos += 5; 75 | } 76 | else 77 | { 78 | prevMask = ((prevMask << 1) & 0x7) | 1; 79 | bufferPos++; 80 | } 81 | } 82 | prevPosT = bufferPos - prevPosT; 83 | *state = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7)); 84 | return bufferPos; 85 | } 86 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/CpuArch.c: -------------------------------------------------------------------------------- 1 | /* CpuArch.c -- CPU specific code 2 | 2010-10-26: Igor Pavlov : Public domain */ 3 | 4 | #include "CpuArch.h" 5 | 6 | #ifdef MY_CPU_X86_OR_AMD64 7 | 8 | #if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__) 9 | #define USE_ASM 10 | #endif 11 | 12 | #if defined(USE_ASM) && !defined(MY_CPU_AMD64) 13 | static UInt32 CheckFlag(UInt32 flag) 14 | { 15 | #ifdef _MSC_VER 16 | __asm pushfd; 17 | __asm pop EAX; 18 | __asm mov EDX, EAX; 19 | __asm xor EAX, flag; 20 | __asm push EAX; 21 | __asm popfd; 22 | __asm pushfd; 23 | __asm pop EAX; 24 | __asm xor EAX, EDX; 25 | __asm push EDX; 26 | __asm popfd; 27 | __asm and flag, EAX; 28 | #else 29 | __asm__ __volatile__ ( 30 | "pushf\n\t" 31 | "pop %%EAX\n\t" 32 | "movl %%EAX,%%EDX\n\t" 33 | "xorl %0,%%EAX\n\t" 34 | "push %%EAX\n\t" 35 | "popf\n\t" 36 | "pushf\n\t" 37 | "pop %%EAX\n\t" 38 | "xorl %%EDX,%%EAX\n\t" 39 | "push %%EDX\n\t" 40 | "popf\n\t" 41 | "andl %%EAX, %0\n\t": 42 | "=c" (flag) : "c" (flag)); 43 | #endif 44 | return flag; 45 | } 46 | #define CHECK_CPUID_IS_SUPPORTED if (CheckFlag(1 << 18) == 0 || CheckFlag(1 << 21) == 0) return False; 47 | #else 48 | #define CHECK_CPUID_IS_SUPPORTED 49 | #endif 50 | 51 | static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d) 52 | { 53 | #ifdef USE_ASM 54 | 55 | #ifdef _MSC_VER 56 | 57 | UInt32 a2, b2, c2, d2; 58 | __asm xor EBX, EBX; 59 | __asm xor ECX, ECX; 60 | __asm xor EDX, EDX; 61 | __asm mov EAX, function; 62 | __asm cpuid; 63 | __asm mov a2, EAX; 64 | __asm mov b2, EBX; 65 | __asm mov c2, ECX; 66 | __asm mov d2, EDX; 67 | 68 | *a = a2; 69 | *b = b2; 70 | *c = c2; 71 | *d = d2; 72 | 73 | #else 74 | 75 | __asm__ volatile ( 76 | "cpuid" 77 | : "=a" (*a) , 78 | "=S" (*b) , 79 | "=c" (*c) , 80 | "=d" (*d) 81 | : "0" (function)) ; 82 | 83 | #endif 84 | 85 | #else 86 | 87 | int CPUInfo[4]; 88 | __cpuid(CPUInfo, function); 89 | *a = CPUInfo[0]; 90 | *b = CPUInfo[1]; 91 | *c = CPUInfo[2]; 92 | *d = CPUInfo[3]; 93 | 94 | #endif 95 | } 96 | 97 | Bool x86cpuid_CheckAndRead(Cx86cpuid *p) 98 | { 99 | CHECK_CPUID_IS_SUPPORTED 100 | MyCPUID(0, &p->maxFunc, &p->vendor[0], &p->vendor[2], &p->vendor[1]); 101 | MyCPUID(1, &p->ver, &p->b, &p->c, &p->d); 102 | return True; 103 | } 104 | 105 | static UInt32 kVendors[][3] = 106 | { 107 | { 0x756E6547, 0x49656E69, 0x6C65746E}, 108 | { 0x68747541, 0x69746E65, 0x444D4163}, 109 | { 0x746E6543, 0x48727561, 0x736C7561} 110 | }; 111 | 112 | int x86cpuid_GetFirm(const Cx86cpuid *p) 113 | { 114 | unsigned i; 115 | for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[i]); i++) 116 | { 117 | const UInt32 *v = kVendors[i]; 118 | if (v[0] == p->vendor[0] && 119 | v[1] == p->vendor[1] && 120 | v[2] == p->vendor[2]) 121 | return (int)i; 122 | } 123 | return -1; 124 | } 125 | 126 | Bool CPU_Is_InOrder() 127 | { 128 | Cx86cpuid p; 129 | int firm; 130 | UInt32 family, model; 131 | if (!x86cpuid_CheckAndRead(&p)) 132 | return True; 133 | family = x86cpuid_GetFamily(&p); 134 | model = x86cpuid_GetModel(&p); 135 | firm = x86cpuid_GetFirm(&p); 136 | switch (firm) 137 | { 138 | case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && model == 0x100C)); 139 | case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA))); 140 | case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF)); 141 | } 142 | return True; 143 | } 144 | 145 | #if !defined(MY_CPU_AMD64) && defined(_WIN32) 146 | static Bool CPU_Sys_Is_SSE_Supported() 147 | { 148 | OSVERSIONINFO vi; 149 | vi.dwOSVersionInfoSize = sizeof(vi); 150 | if (!GetVersionEx(&vi)) 151 | return False; 152 | return (vi.dwMajorVersion >= 5); 153 | } 154 | #define CHECK_SYS_SSE_SUPPORT if (!CPU_Sys_Is_SSE_Supported()) return False; 155 | #else 156 | #define CHECK_SYS_SSE_SUPPORT 157 | #endif 158 | 159 | Bool CPU_Is_Aes_Supported() 160 | { 161 | Cx86cpuid p; 162 | CHECK_SYS_SSE_SUPPORT 163 | if (!x86cpuid_CheckAndRead(&p)) 164 | return False; 165 | return (p.c >> 25) & 1; 166 | } 167 | 168 | #endif 169 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/CpuArch.h: -------------------------------------------------------------------------------- 1 | /* CpuArch.h -- CPU specific code 2 | 2010-10-26: Igor Pavlov : Public domain */ 3 | 4 | #ifndef __CPU_ARCH_H 5 | #define __CPU_ARCH_H 6 | 7 | #include "Types.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | /* 12 | MY_CPU_LE means that CPU is LITTLE ENDIAN. 13 | If MY_CPU_LE is not defined, we don't know about that property of platform (it can be LITTLE ENDIAN). 14 | 15 | MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses. 16 | If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of platform. 17 | */ 18 | 19 | #if defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__) 20 | #define MY_CPU_AMD64 21 | #endif 22 | 23 | #if defined(MY_CPU_AMD64) || defined(_M_IA64) 24 | #define MY_CPU_64BIT 25 | #endif 26 | 27 | #if defined(_M_IX86) || defined(__i386__) 28 | #define MY_CPU_X86 29 | #endif 30 | 31 | #if defined(MY_CPU_X86) || defined(MY_CPU_AMD64) 32 | #define MY_CPU_X86_OR_AMD64 33 | #endif 34 | 35 | #if defined(MY_CPU_X86) || defined(_M_ARM) 36 | #define MY_CPU_32BIT 37 | #endif 38 | 39 | #if defined(_WIN32) && defined(_M_ARM) 40 | #define MY_CPU_ARM_LE 41 | #endif 42 | 43 | #if defined(_WIN32) && defined(_M_IA64) 44 | #define MY_CPU_IA64_LE 45 | #endif 46 | 47 | #if defined(MY_CPU_X86_OR_AMD64) 48 | #define MY_CPU_LE_UNALIGN 49 | #endif 50 | 51 | #if defined(MY_CPU_X86_OR_AMD64) || defined(MY_CPU_ARM_LE) || defined(MY_CPU_IA64_LE) || defined(__ARMEL__) || defined(__MIPSEL__) || defined(__LITTLE_ENDIAN__) 52 | #define MY_CPU_LE 53 | #endif 54 | 55 | #if defined(__BIG_ENDIAN__) 56 | #define MY_CPU_BE 57 | #endif 58 | 59 | #if defined(MY_CPU_LE) && defined(MY_CPU_BE) 60 | Stop_Compiling_Bad_Endian 61 | #endif 62 | 63 | #ifdef MY_CPU_LE_UNALIGN 64 | 65 | #define GetUi16(p) (*(const UInt16 *)(p)) 66 | #define GetUi32(p) (*(const UInt32 *)(p)) 67 | #define GetUi64(p) (*(const UInt64 *)(p)) 68 | #define SetUi16(p, d) *(UInt16 *)(p) = (d); 69 | #define SetUi32(p, d) *(UInt32 *)(p) = (d); 70 | #define SetUi64(p, d) *(UInt64 *)(p) = (d); 71 | 72 | #else 73 | 74 | #define GetUi16(p) (((const Byte *)(p))[0] | ((UInt16)((const Byte *)(p))[1] << 8)) 75 | 76 | #define GetUi32(p) ( \ 77 | ((const Byte *)(p))[0] | \ 78 | ((UInt32)((const Byte *)(p))[1] << 8) | \ 79 | ((UInt32)((const Byte *)(p))[2] << 16) | \ 80 | ((UInt32)((const Byte *)(p))[3] << 24)) 81 | 82 | #define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32)) 83 | 84 | #define SetUi16(p, d) { UInt32 _x_ = (d); \ 85 | ((Byte *)(p))[0] = (Byte)_x_; \ 86 | ((Byte *)(p))[1] = (Byte)(_x_ >> 8); } 87 | 88 | #define SetUi32(p, d) { UInt32 _x_ = (d); \ 89 | ((Byte *)(p))[0] = (Byte)_x_; \ 90 | ((Byte *)(p))[1] = (Byte)(_x_ >> 8); \ 91 | ((Byte *)(p))[2] = (Byte)(_x_ >> 16); \ 92 | ((Byte *)(p))[3] = (Byte)(_x_ >> 24); } 93 | 94 | #define SetUi64(p, d) { UInt64 _x64_ = (d); \ 95 | SetUi32(p, (UInt32)_x64_); \ 96 | SetUi32(((Byte *)(p)) + 4, (UInt32)(_x64_ >> 32)); } 97 | 98 | #endif 99 | 100 | #if defined(MY_CPU_LE_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300) 101 | 102 | #pragma intrinsic(_byteswap_ulong) 103 | #pragma intrinsic(_byteswap_uint64) 104 | #define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p)) 105 | #define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p)) 106 | 107 | #else 108 | 109 | #define GetBe32(p) ( \ 110 | ((UInt32)((const Byte *)(p))[0] << 24) | \ 111 | ((UInt32)((const Byte *)(p))[1] << 16) | \ 112 | ((UInt32)((const Byte *)(p))[2] << 8) | \ 113 | ((const Byte *)(p))[3] ) 114 | 115 | #define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4)) 116 | 117 | #endif 118 | 119 | #define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1]) 120 | 121 | 122 | #ifdef MY_CPU_X86_OR_AMD64 123 | 124 | typedef struct 125 | { 126 | UInt32 maxFunc; 127 | UInt32 vendor[3]; 128 | UInt32 ver; 129 | UInt32 b; 130 | UInt32 c; 131 | UInt32 d; 132 | } Cx86cpuid; 133 | 134 | enum 135 | { 136 | CPU_FIRM_INTEL, 137 | CPU_FIRM_AMD, 138 | CPU_FIRM_VIA 139 | }; 140 | 141 | Bool x86cpuid_CheckAndRead(Cx86cpuid *p); 142 | int x86cpuid_GetFirm(const Cx86cpuid *p); 143 | 144 | #define x86cpuid_GetFamily(p) (((p)->ver >> 8) & 0xFF00F) 145 | #define x86cpuid_GetModel(p) (((p)->ver >> 4) & 0xF00F) 146 | #define x86cpuid_GetStepping(p) ((p)->ver & 0xF) 147 | 148 | Bool CPU_Is_InOrder(); 149 | Bool CPU_Is_Aes_Supported(); 150 | 151 | #endif 152 | 153 | EXTERN_C_END 154 | 155 | #endif 156 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Lzma2Dec.h: -------------------------------------------------------------------------------- 1 | /* Lzma2Dec.h -- LZMA2 Decoder 2 | 2009-05-03 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __LZMA2_DEC_H 5 | #define __LZMA2_DEC_H 6 | 7 | #include "LzmaDec.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /* ---------- State Interface ---------- */ 14 | 15 | typedef struct 16 | { 17 | CLzmaDec decoder; 18 | UInt32 packSize; 19 | UInt32 unpackSize; 20 | int state; 21 | Byte control; 22 | Bool needInitDic; 23 | Bool needInitState; 24 | Bool needInitProp; 25 | } CLzma2Dec; 26 | 27 | #define Lzma2Dec_Construct(p) LzmaDec_Construct(&(p)->decoder) 28 | #define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc); 29 | #define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc); 30 | 31 | SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc); 32 | SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc); 33 | void Lzma2Dec_Init(CLzma2Dec *p); 34 | 35 | 36 | /* 37 | finishMode: 38 | It has meaning only if the decoding reaches output limit (*destLen or dicLimit). 39 | LZMA_FINISH_ANY - use smallest number of input bytes 40 | LZMA_FINISH_END - read EndOfStream marker after decoding 41 | 42 | Returns: 43 | SZ_OK 44 | status: 45 | LZMA_STATUS_FINISHED_WITH_MARK 46 | LZMA_STATUS_NOT_FINISHED 47 | LZMA_STATUS_NEEDS_MORE_INPUT 48 | SZ_ERROR_DATA - Data error 49 | */ 50 | 51 | SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, 52 | const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); 53 | 54 | SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, 55 | const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); 56 | 57 | 58 | /* ---------- One Call Interface ---------- */ 59 | 60 | /* 61 | finishMode: 62 | It has meaning only if the decoding reaches output limit (*destLen). 63 | LZMA_FINISH_ANY - use smallest number of input bytes 64 | LZMA_FINISH_END - read EndOfStream marker after decoding 65 | 66 | Returns: 67 | SZ_OK 68 | status: 69 | LZMA_STATUS_FINISHED_WITH_MARK 70 | LZMA_STATUS_NOT_FINISHED 71 | SZ_ERROR_DATA - Data error 72 | SZ_ERROR_MEM - Memory allocation error 73 | SZ_ERROR_UNSUPPORTED - Unsupported properties 74 | SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). 75 | */ 76 | 77 | SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, 78 | Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/LzmaDec.h: -------------------------------------------------------------------------------- 1 | /* LzmaDec.h -- LZMA Decoder 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __LZMA_DEC_H 5 | #define __LZMA_DEC_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /* #define _LZMA_PROB32 */ 14 | /* _LZMA_PROB32 can increase the speed on some CPUs, 15 | but memory usage for CLzmaDec::probs will be doubled in that case */ 16 | 17 | #ifdef _LZMA_PROB32 18 | #define CLzmaProb UInt32 19 | #else 20 | #define CLzmaProb UInt16 21 | #endif 22 | 23 | 24 | /* ---------- LZMA Properties ---------- */ 25 | 26 | #define LZMA_PROPS_SIZE 5 27 | 28 | typedef struct _CLzmaProps 29 | { 30 | unsigned lc, lp, pb; 31 | UInt32 dicSize; 32 | } CLzmaProps; 33 | 34 | /* LzmaProps_Decode - decodes properties 35 | Returns: 36 | SZ_OK 37 | SZ_ERROR_UNSUPPORTED - Unsupported properties 38 | */ 39 | 40 | SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); 41 | 42 | 43 | /* ---------- LZMA Decoder state ---------- */ 44 | 45 | /* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case. 46 | Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */ 47 | 48 | #define LZMA_REQUIRED_INPUT_MAX 20 49 | 50 | typedef struct 51 | { 52 | CLzmaProps prop; 53 | CLzmaProb *probs; 54 | Byte *dic; 55 | const Byte *buf; 56 | UInt32 range, code; 57 | SizeT dicPos; 58 | SizeT dicBufSize; 59 | UInt32 processedPos; 60 | UInt32 checkDicSize; 61 | unsigned state; 62 | UInt32 reps[4]; 63 | unsigned remainLen; 64 | int needFlush; 65 | int needInitState; 66 | UInt32 numProbs; 67 | unsigned tempBufSize; 68 | Byte tempBuf[LZMA_REQUIRED_INPUT_MAX]; 69 | } CLzmaDec; 70 | 71 | #define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } 72 | 73 | void LzmaDec_Init(CLzmaDec *p); 74 | 75 | /* There are two types of LZMA streams: 76 | 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. 77 | 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ 78 | 79 | typedef enum 80 | { 81 | LZMA_FINISH_ANY, /* finish at any point */ 82 | LZMA_FINISH_END /* block must be finished at the end */ 83 | } ELzmaFinishMode; 84 | 85 | /* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! 86 | 87 | You must use LZMA_FINISH_END, when you know that current output buffer 88 | covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. 89 | 90 | If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, 91 | and output value of destLen will be less than output buffer size limit. 92 | You can check status result also. 93 | 94 | You can use multiple checks to test data integrity after full decompression: 95 | 1) Check Result and "status" variable. 96 | 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. 97 | 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. 98 | You must use correct finish mode in that case. */ 99 | 100 | typedef enum 101 | { 102 | LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */ 103 | LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ 104 | LZMA_STATUS_NOT_FINISHED, /* stream was not finished */ 105 | LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ 106 | LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ 107 | } ELzmaStatus; 108 | 109 | /* ELzmaStatus is used only as output value for function call */ 110 | 111 | 112 | /* ---------- Interfaces ---------- */ 113 | 114 | /* There are 3 levels of interfaces: 115 | 1) Dictionary Interface 116 | 2) Buffer Interface 117 | 3) One Call Interface 118 | You can select any of these interfaces, but don't mix functions from different 119 | groups for same object. */ 120 | 121 | 122 | /* There are two variants to allocate state for Dictionary Interface: 123 | 1) LzmaDec_Allocate / LzmaDec_Free 124 | 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs 125 | You can use variant 2, if you set dictionary buffer manually. 126 | For Buffer Interface you must always use variant 1. 127 | 128 | LzmaDec_Allocate* can return: 129 | SZ_OK 130 | SZ_ERROR_MEM - Memory allocation error 131 | SZ_ERROR_UNSUPPORTED - Unsupported properties 132 | */ 133 | 134 | SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); 135 | void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); 136 | 137 | SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); 138 | void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); 139 | 140 | /* ---------- Dictionary Interface ---------- */ 141 | 142 | /* You can use it, if you want to eliminate the overhead for data copying from 143 | dictionary to some other external buffer. 144 | You must work with CLzmaDec variables directly in this interface. 145 | 146 | STEPS: 147 | LzmaDec_Constr() 148 | LzmaDec_Allocate() 149 | for (each new stream) 150 | { 151 | LzmaDec_Init() 152 | while (it needs more decompression) 153 | { 154 | LzmaDec_DecodeToDic() 155 | use data from CLzmaDec::dic and update CLzmaDec::dicPos 156 | } 157 | } 158 | LzmaDec_Free() 159 | */ 160 | 161 | /* LzmaDec_DecodeToDic 162 | 163 | The decoding to internal dictionary buffer (CLzmaDec::dic). 164 | You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! 165 | 166 | finishMode: 167 | It has meaning only if the decoding reaches output limit (dicLimit). 168 | LZMA_FINISH_ANY - Decode just dicLimit bytes. 169 | LZMA_FINISH_END - Stream must be finished after dicLimit. 170 | 171 | Returns: 172 | SZ_OK 173 | status: 174 | LZMA_STATUS_FINISHED_WITH_MARK 175 | LZMA_STATUS_NOT_FINISHED 176 | LZMA_STATUS_NEEDS_MORE_INPUT 177 | LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK 178 | SZ_ERROR_DATA - Data error 179 | */ 180 | 181 | SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, 182 | const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); 183 | 184 | 185 | /* ---------- Buffer Interface ---------- */ 186 | 187 | /* It's zlib-like interface. 188 | See LzmaDec_DecodeToDic description for information about STEPS and return results, 189 | but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need 190 | to work with CLzmaDec variables manually. 191 | 192 | finishMode: 193 | It has meaning only if the decoding reaches output limit (*destLen). 194 | LZMA_FINISH_ANY - Decode just destLen bytes. 195 | LZMA_FINISH_END - Stream must be finished after (*destLen). 196 | */ 197 | 198 | SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, 199 | const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); 200 | 201 | 202 | /* ---------- One Call Interface ---------- */ 203 | 204 | /* LzmaDecode 205 | 206 | finishMode: 207 | It has meaning only if the decoding reaches output limit (*destLen). 208 | LZMA_FINISH_ANY - Decode just destLen bytes. 209 | LZMA_FINISH_END - Stream must be finished after (*destLen). 210 | 211 | Returns: 212 | SZ_OK 213 | status: 214 | LZMA_STATUS_FINISHED_WITH_MARK 215 | LZMA_STATUS_NOT_FINISHED 216 | LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK 217 | SZ_ERROR_DATA - Data error 218 | SZ_ERROR_MEM - Memory allocation error 219 | SZ_ERROR_UNSUPPORTED - Unsupported properties 220 | SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). 221 | */ 222 | 223 | SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, 224 | const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, 225 | ELzmaStatus *status, ISzAlloc *alloc); 226 | 227 | #ifdef __cplusplus 228 | } 229 | #endif 230 | 231 | #endif 232 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Ppmd.h: -------------------------------------------------------------------------------- 1 | /* Ppmd.h -- PPMD codec common code 2 | 2010-03-12 : Igor Pavlov : Public domain 3 | This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ 4 | 5 | #ifndef __PPMD_H 6 | #define __PPMD_H 7 | 8 | #include "Types.h" 9 | #include "CpuArch.h" 10 | 11 | EXTERN_C_BEGIN 12 | 13 | #ifdef MY_CPU_32BIT 14 | #define PPMD_32BIT 15 | #endif 16 | 17 | #define PPMD_INT_BITS 7 18 | #define PPMD_PERIOD_BITS 7 19 | #define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS)) 20 | 21 | #define PPMD_GET_MEAN_SPEC(summ, shift, round) (((summ) + (1 << ((shift) - (round)))) >> (shift)) 22 | #define PPMD_GET_MEAN(summ) PPMD_GET_MEAN_SPEC((summ), PPMD_PERIOD_BITS, 2) 23 | #define PPMD_UPDATE_PROB_0(prob) ((prob) + (1 << PPMD_INT_BITS) - PPMD_GET_MEAN(prob)) 24 | #define PPMD_UPDATE_PROB_1(prob) ((prob) - PPMD_GET_MEAN(prob)) 25 | 26 | #define PPMD_N1 4 27 | #define PPMD_N2 4 28 | #define PPMD_N3 4 29 | #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4) 30 | #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4) 31 | 32 | /* SEE-contexts for PPM-contexts with masked symbols */ 33 | typedef struct 34 | { 35 | UInt16 Summ; /* Freq */ 36 | Byte Shift; /* Speed of Freq change; low Shift is for fast change */ 37 | Byte Count; /* Count to next change of Shift */ 38 | } CPpmd_See; 39 | 40 | #define Ppmd_See_Update(p) if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) \ 41 | { (p)->Summ <<= 1; (p)->Count = (Byte)(3 << (p)->Shift++); } 42 | 43 | typedef struct 44 | { 45 | Byte Symbol; 46 | Byte Freq; 47 | UInt16 SuccessorLow; 48 | UInt16 SuccessorHigh; 49 | } CPpmd_State; 50 | 51 | typedef 52 | #ifdef PPMD_32BIT 53 | CPpmd_State * 54 | #else 55 | UInt32 56 | #endif 57 | CPpmd_State_Ref; 58 | 59 | typedef 60 | #ifdef PPMD_32BIT 61 | void * 62 | #else 63 | UInt32 64 | #endif 65 | CPpmd_Void_Ref; 66 | 67 | typedef 68 | #ifdef PPMD_32BIT 69 | Byte * 70 | #else 71 | UInt32 72 | #endif 73 | CPpmd_Byte_Ref; 74 | 75 | #define PPMD_SetAllBitsIn256Bytes(p) \ 76 | { unsigned i; for (i = 0; i < 256 / sizeof(p[0]); i += 8) { \ 77 | p[i+7] = p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = ~(size_t)0; }} 78 | 79 | EXTERN_C_END 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Ppmd7.h: -------------------------------------------------------------------------------- 1 | /* Ppmd7.h -- PPMdH compression codec 2 | 2010-03-12 : Igor Pavlov : Public domain 3 | This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ 4 | 5 | /* This code supports virtual RangeDecoder and includes the implementation 6 | of RangeCoder from 7z, instead of RangeCoder from original PPMd var.H. 7 | If you need the compatibility with original PPMd var.H, you can use external RangeDecoder */ 8 | 9 | #ifndef __PPMD7_H 10 | #define __PPMD7_H 11 | 12 | #include "Ppmd.h" 13 | 14 | EXTERN_C_BEGIN 15 | 16 | #define PPMD7_MIN_ORDER 2 17 | #define PPMD7_MAX_ORDER 64 18 | 19 | #define PPMD7_MIN_MEM_SIZE (1 << 11) 20 | #define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3) 21 | 22 | struct CPpmd7_Context_; 23 | 24 | typedef 25 | #ifdef PPMD_32BIT 26 | struct CPpmd7_Context_ * 27 | #else 28 | UInt32 29 | #endif 30 | CPpmd7_Context_Ref; 31 | 32 | typedef struct CPpmd7_Context_ 33 | { 34 | UInt16 NumStats; 35 | UInt16 SummFreq; 36 | CPpmd_State_Ref Stats; 37 | CPpmd7_Context_Ref Suffix; 38 | } CPpmd7_Context; 39 | 40 | #define Ppmd7Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq) 41 | 42 | typedef struct 43 | { 44 | CPpmd7_Context *MinContext, *MaxContext; 45 | CPpmd_State *FoundState; 46 | unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder, HiBitsFlag; 47 | Int32 RunLength, InitRL; /* must be 32-bit at least */ 48 | 49 | UInt32 Size; 50 | UInt32 GlueCount; 51 | Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart; 52 | UInt32 AlignOffset; 53 | 54 | Byte Indx2Units[PPMD_NUM_INDEXES]; 55 | Byte Units2Indx[128]; 56 | CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES]; 57 | Byte NS2Indx[256], NS2BSIndx[256], HB2Flag[256]; 58 | CPpmd_See DummySee, See[25][16]; 59 | UInt16 BinSumm[128][64]; 60 | } CPpmd7; 61 | 62 | void Ppmd7_Construct(CPpmd7 *p); 63 | Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc); 64 | void Ppmd7_Free(CPpmd7 *p, ISzAlloc *alloc); 65 | void Ppmd7_Init(CPpmd7 *p, unsigned maxOrder); 66 | #define Ppmd7_WasAllocated(p) ((p)->Base != NULL) 67 | 68 | 69 | /* ---------- Internal Functions ---------- */ 70 | 71 | extern const Byte PPMD7_kExpEscape[16]; 72 | 73 | #ifdef PPMD_32BIT 74 | #define Ppmd7_GetPtr(p, ptr) (ptr) 75 | #define Ppmd7_GetContext(p, ptr) (ptr) 76 | #define Ppmd7_GetStats(p, ctx) ((ctx)->Stats) 77 | #else 78 | #define Ppmd7_GetPtr(p, offs) ((void *)((p)->Base + (offs))) 79 | #define Ppmd7_GetContext(p, offs) ((CPpmd7_Context *)Ppmd7_GetPtr((p), (offs))) 80 | #define Ppmd7_GetStats(p, ctx) ((CPpmd_State *)Ppmd7_GetPtr((p), ((ctx)->Stats))) 81 | #endif 82 | 83 | void Ppmd7_Update1(CPpmd7 *p); 84 | void Ppmd7_Update1_0(CPpmd7 *p); 85 | void Ppmd7_Update2(CPpmd7 *p); 86 | void Ppmd7_UpdateBin(CPpmd7 *p); 87 | 88 | #define Ppmd7_GetBinSumm(p) \ 89 | &p->BinSumm[Ppmd7Context_OneState(p->MinContext)->Freq - 1][p->PrevSuccess + \ 90 | p->NS2BSIndx[Ppmd7_GetContext(p, p->MinContext->Suffix)->NumStats - 1] + \ 91 | (p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]) + \ 92 | 2 * p->HB2Flag[Ppmd7Context_OneState(p->MinContext)->Symbol] + \ 93 | ((p->RunLength >> 26) & 0x20)] 94 | 95 | CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *scale); 96 | 97 | 98 | /* ---------- Decode ---------- */ 99 | 100 | typedef struct 101 | { 102 | UInt32 (*GetThreshold)(void *p, UInt32 total); 103 | void (*Decode)(void *p, UInt32 start, UInt32 size); 104 | UInt32 (*DecodeBit)(void *p, UInt32 size0); 105 | } IPpmd7_RangeDec; 106 | 107 | typedef struct 108 | { 109 | IPpmd7_RangeDec p; 110 | UInt32 Range; 111 | UInt32 Code; 112 | IByteIn *Stream; 113 | } CPpmd7z_RangeDec; 114 | 115 | void Ppmd7z_RangeDec_CreateVTable(CPpmd7z_RangeDec *p); 116 | Bool Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec *p); 117 | #define Ppmd7z_RangeDec_IsFinishedOK(p) ((p)->Code == 0) 118 | 119 | int Ppmd7_DecodeSymbol(CPpmd7 *p, IPpmd7_RangeDec *rc); 120 | 121 | 122 | /* ---------- Encode ---------- */ 123 | 124 | typedef struct 125 | { 126 | UInt64 Low; 127 | UInt32 Range; 128 | Byte Cache; 129 | UInt64 CacheSize; 130 | IByteOut *Stream; 131 | } CPpmd7z_RangeEnc; 132 | 133 | void Ppmd7z_RangeEnc_Init(CPpmd7z_RangeEnc *p); 134 | void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p); 135 | 136 | void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol); 137 | 138 | EXTERN_C_END 139 | 140 | #endif 141 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Ppmd7Dec.c: -------------------------------------------------------------------------------- 1 | /* Ppmd7Dec.c -- PPMdH Decoder 2 | 2010-03-12 : Igor Pavlov : Public domain 3 | This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ 4 | 5 | #include "Ppmd7.h" 6 | 7 | #define kTopValue (1 << 24) 8 | 9 | Bool Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec *p) 10 | { 11 | unsigned i; 12 | p->Code = 0; 13 | p->Range = 0xFFFFFFFF; 14 | if (p->Stream->Read((void *)p->Stream) != 0) 15 | return False; 16 | for (i = 0; i < 4; i++) 17 | p->Code = (p->Code << 8) | p->Stream->Read((void *)p->Stream); 18 | return (p->Code < 0xFFFFFFFF); 19 | } 20 | 21 | static UInt32 Range_GetThreshold(void *pp, UInt32 total) 22 | { 23 | CPpmd7z_RangeDec *p = (CPpmd7z_RangeDec *)pp; 24 | return (p->Code) / (p->Range /= total); 25 | } 26 | 27 | static void Range_Normalize(CPpmd7z_RangeDec *p) 28 | { 29 | if (p->Range < kTopValue) 30 | { 31 | p->Code = (p->Code << 8) | p->Stream->Read((void *)p->Stream); 32 | p->Range <<= 8; 33 | if (p->Range < kTopValue) 34 | { 35 | p->Code = (p->Code << 8) | p->Stream->Read((void *)p->Stream); 36 | p->Range <<= 8; 37 | } 38 | } 39 | } 40 | 41 | static void Range_Decode(void *pp, UInt32 start, UInt32 size) 42 | { 43 | CPpmd7z_RangeDec *p = (CPpmd7z_RangeDec *)pp; 44 | p->Code -= start * p->Range; 45 | p->Range *= size; 46 | Range_Normalize(p); 47 | } 48 | 49 | static UInt32 Range_DecodeBit(void *pp, UInt32 size0) 50 | { 51 | CPpmd7z_RangeDec *p = (CPpmd7z_RangeDec *)pp; 52 | UInt32 newBound = (p->Range >> 14) * size0; 53 | UInt32 symbol; 54 | if (p->Code < newBound) 55 | { 56 | symbol = 0; 57 | p->Range = newBound; 58 | } 59 | else 60 | { 61 | symbol = 1; 62 | p->Code -= newBound; 63 | p->Range -= newBound; 64 | } 65 | Range_Normalize(p); 66 | return symbol; 67 | } 68 | 69 | void Ppmd7z_RangeDec_CreateVTable(CPpmd7z_RangeDec *p) 70 | { 71 | p->p.GetThreshold = Range_GetThreshold; 72 | p->p.Decode = Range_Decode; 73 | p->p.DecodeBit = Range_DecodeBit; 74 | } 75 | 76 | 77 | #define MASK(sym) ((signed char *)charMask)[sym] 78 | 79 | int Ppmd7_DecodeSymbol(CPpmd7 *p, IPpmd7_RangeDec *rc) 80 | { 81 | size_t charMask[256 / sizeof(size_t)]; 82 | if (p->MinContext->NumStats != 1) 83 | { 84 | CPpmd_State *s = Ppmd7_GetStats(p, p->MinContext); 85 | unsigned i; 86 | UInt32 count, hiCnt; 87 | if ((count = rc->GetThreshold(rc, p->MinContext->SummFreq)) < (hiCnt = s->Freq)) 88 | { 89 | Byte symbol; 90 | rc->Decode(rc, 0, s->Freq); 91 | p->FoundState = s; 92 | symbol = s->Symbol; 93 | Ppmd7_Update1_0(p); 94 | return symbol; 95 | } 96 | p->PrevSuccess = 0; 97 | i = p->MinContext->NumStats - 1; 98 | do 99 | { 100 | if ((hiCnt += (++s)->Freq) > count) 101 | { 102 | Byte symbol; 103 | rc->Decode(rc, hiCnt - s->Freq, s->Freq); 104 | p->FoundState = s; 105 | symbol = s->Symbol; 106 | Ppmd7_Update1(p); 107 | return symbol; 108 | } 109 | } 110 | while (--i); 111 | if (count >= p->MinContext->SummFreq) 112 | return -2; 113 | p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]; 114 | rc->Decode(rc, hiCnt, p->MinContext->SummFreq - hiCnt); 115 | PPMD_SetAllBitsIn256Bytes(charMask); 116 | MASK(s->Symbol) = 0; 117 | i = p->MinContext->NumStats - 1; 118 | do { MASK((--s)->Symbol) = 0; } while (--i); 119 | } 120 | else 121 | { 122 | UInt16 *prob = Ppmd7_GetBinSumm(p); 123 | if (rc->DecodeBit(rc, *prob) == 0) 124 | { 125 | Byte symbol; 126 | *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob); 127 | symbol = (p->FoundState = Ppmd7Context_OneState(p->MinContext))->Symbol; 128 | Ppmd7_UpdateBin(p); 129 | return symbol; 130 | } 131 | *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob); 132 | p->InitEsc = PPMD7_kExpEscape[*prob >> 10]; 133 | PPMD_SetAllBitsIn256Bytes(charMask); 134 | MASK(Ppmd7Context_OneState(p->MinContext)->Symbol) = 0; 135 | p->PrevSuccess = 0; 136 | } 137 | for (;;) 138 | { 139 | CPpmd_State *ps[256], *s; 140 | UInt32 freqSum, count, hiCnt; 141 | CPpmd_See *see; 142 | unsigned i, num, numMasked = p->MinContext->NumStats; 143 | do 144 | { 145 | p->OrderFall++; 146 | if (!p->MinContext->Suffix) 147 | return -1; 148 | p->MinContext = Ppmd7_GetContext(p, p->MinContext->Suffix); 149 | } 150 | while (p->MinContext->NumStats == numMasked); 151 | hiCnt = 0; 152 | s = Ppmd7_GetStats(p, p->MinContext); 153 | i = 0; 154 | num = p->MinContext->NumStats - numMasked; 155 | do 156 | { 157 | int k = (int)(MASK(s->Symbol)); 158 | hiCnt += (s->Freq & k); 159 | ps[i] = s++; 160 | i -= k; 161 | } 162 | while (i != num); 163 | 164 | see = Ppmd7_MakeEscFreq(p, numMasked, &freqSum); 165 | freqSum += hiCnt; 166 | count = rc->GetThreshold(rc, freqSum); 167 | 168 | if (count < hiCnt) 169 | { 170 | Byte symbol; 171 | CPpmd_State **pps = ps; 172 | for (hiCnt = 0; (hiCnt += (*pps)->Freq) <= count; pps++); 173 | s = *pps; 174 | rc->Decode(rc, hiCnt - s->Freq, s->Freq); 175 | Ppmd_See_Update(see); 176 | p->FoundState = s; 177 | symbol = s->Symbol; 178 | Ppmd7_Update2(p); 179 | return symbol; 180 | } 181 | if (count >= freqSum) 182 | return -2; 183 | rc->Decode(rc, hiCnt, freqSum - hiCnt); 184 | see->Summ = (UInt16)(see->Summ + freqSum); 185 | do { MASK(ps[--i]->Symbol) = 0; } while (i != 0); 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /DecRawso/jni/7zC/Types.h: -------------------------------------------------------------------------------- 1 | /* Types.h -- Basic types 2 | 2010-10-09 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_TYPES_H 5 | #define __7Z_TYPES_H 6 | 7 | #include 8 | 9 | #ifdef _WIN32 10 | #include 11 | #endif 12 | 13 | #ifndef EXTERN_C_BEGIN 14 | #ifdef __cplusplus 15 | #define EXTERN_C_BEGIN extern "C" { 16 | #define EXTERN_C_END } 17 | #else 18 | #define EXTERN_C_BEGIN 19 | #define EXTERN_C_END 20 | #endif 21 | #endif 22 | 23 | EXTERN_C_BEGIN 24 | 25 | #define SZ_OK 0 26 | 27 | #define SZ_ERROR_DATA 1 28 | #define SZ_ERROR_MEM 2 29 | #define SZ_ERROR_CRC 3 30 | #define SZ_ERROR_UNSUPPORTED 4 31 | #define SZ_ERROR_PARAM 5 32 | #define SZ_ERROR_INPUT_EOF 6 33 | #define SZ_ERROR_OUTPUT_EOF 7 34 | #define SZ_ERROR_READ 8 35 | #define SZ_ERROR_WRITE 9 36 | #define SZ_ERROR_PROGRESS 10 37 | #define SZ_ERROR_FAIL 11 38 | #define SZ_ERROR_THREAD 12 39 | 40 | #define SZ_ERROR_ARCHIVE 16 41 | #define SZ_ERROR_NO_ARCHIVE 17 42 | 43 | typedef int SRes; 44 | 45 | #ifdef _WIN32 46 | typedef DWORD WRes; 47 | #else 48 | typedef int WRes; 49 | #endif 50 | 51 | #ifndef RINOK 52 | #define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } 53 | #endif 54 | 55 | typedef unsigned char Byte; 56 | typedef short Int16; 57 | typedef unsigned short UInt16; 58 | 59 | #ifdef _LZMA_UINT32_IS_ULONG 60 | typedef long Int32; 61 | typedef unsigned long UInt32; 62 | #else 63 | typedef int Int32; 64 | typedef unsigned int UInt32; 65 | #endif 66 | 67 | #ifdef _SZ_NO_INT_64 68 | 69 | /* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. 70 | NOTES: Some code will work incorrectly in that case! */ 71 | 72 | typedef long Int64; 73 | typedef unsigned long UInt64; 74 | 75 | #else 76 | 77 | #if defined(_MSC_VER) || defined(__BORLANDC__) 78 | typedef __int64 Int64; 79 | typedef unsigned __int64 UInt64; 80 | #define UINT64_CONST(n) n 81 | #else 82 | typedef long long int Int64; 83 | typedef unsigned long long int UInt64; 84 | #define UINT64_CONST(n) n ## ULL 85 | #endif 86 | 87 | #endif 88 | 89 | #ifdef _LZMA_NO_SYSTEM_SIZE_T 90 | typedef UInt32 SizeT; 91 | #else 92 | typedef size_t SizeT; 93 | #endif 94 | 95 | typedef int Bool; 96 | #define True 1 97 | #define False 0 98 | 99 | 100 | #ifdef _WIN32 101 | #define MY_STD_CALL __stdcall 102 | #else 103 | #define MY_STD_CALL 104 | #endif 105 | 106 | #ifdef _MSC_VER 107 | 108 | #if _MSC_VER >= 1300 109 | #define MY_NO_INLINE __declspec(noinline) 110 | #else 111 | #define MY_NO_INLINE 112 | #endif 113 | 114 | #define MY_CDECL __cdecl 115 | #define MY_FAST_CALL __fastcall 116 | 117 | #else 118 | 119 | #define MY_CDECL 120 | #define MY_FAST_CALL 121 | 122 | #endif 123 | 124 | 125 | /* The following interfaces use first parameter as pointer to structure */ 126 | 127 | typedef struct 128 | { 129 | Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */ 130 | } IByteIn; 131 | 132 | typedef struct 133 | { 134 | void (*Write)(void *p, Byte b); 135 | } IByteOut; 136 | 137 | typedef struct 138 | { 139 | SRes (*Read)(void *p, void *buf, size_t *size); 140 | /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. 141 | (output(*size) < input(*size)) is allowed */ 142 | } ISeqInStream; 143 | 144 | /* it can return SZ_ERROR_INPUT_EOF */ 145 | SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size); 146 | SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType); 147 | SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf); 148 | 149 | typedef struct 150 | { 151 | size_t (*Write)(void *p, const void *buf, size_t size); 152 | /* Returns: result - the number of actually written bytes. 153 | (result < size) means error */ 154 | } ISeqOutStream; 155 | 156 | typedef enum 157 | { 158 | SZ_SEEK_SET = 0, 159 | SZ_SEEK_CUR = 1, 160 | SZ_SEEK_END = 2 161 | } ESzSeek; 162 | 163 | typedef struct 164 | { 165 | SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ 166 | SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); 167 | } ISeekInStream; 168 | 169 | typedef struct 170 | { 171 | SRes (*Look)(void *p, const void **buf, size_t *size); 172 | /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. 173 | (output(*size) > input(*size)) is not allowed 174 | (output(*size) < input(*size)) is allowed */ 175 | SRes (*Skip)(void *p, size_t offset); 176 | /* offset must be <= output(*size) of Look */ 177 | 178 | SRes (*Read)(void *p, void *buf, size_t *size); 179 | /* reads directly (without buffer). It's same as ISeqInStream::Read */ 180 | SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); 181 | } ILookInStream; 182 | 183 | SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size); 184 | SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); 185 | 186 | /* reads via ILookInStream::Read */ 187 | SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); 188 | SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); 189 | 190 | #define LookToRead_BUF_SIZE (1 << 14) 191 | 192 | typedef struct 193 | { 194 | ILookInStream s; 195 | ISeekInStream *realStream; 196 | size_t pos; 197 | size_t size; 198 | Byte buf[LookToRead_BUF_SIZE]; 199 | } CLookToRead; 200 | 201 | void LookToRead_CreateVTable(CLookToRead *p, int lookahead); 202 | void LookToRead_Init(CLookToRead *p); 203 | 204 | typedef struct 205 | { 206 | ISeqInStream s; 207 | ILookInStream *realStream; 208 | } CSecToLook; 209 | 210 | void SecToLook_CreateVTable(CSecToLook *p); 211 | 212 | typedef struct 213 | { 214 | ISeqInStream s; 215 | ILookInStream *realStream; 216 | } CSecToRead; 217 | 218 | void SecToRead_CreateVTable(CSecToRead *p); 219 | 220 | typedef struct 221 | { 222 | SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); 223 | /* Returns: result. (result != SZ_OK) means break. 224 | Value (UInt64)(Int64)-1 for size means unknown value. */ 225 | } ICompressProgress; 226 | 227 | typedef struct 228 | { 229 | void *(*Alloc)(void *p, size_t size); 230 | void (*Free)(void *p, void *address); /* address can be 0 */ 231 | } ISzAlloc; 232 | 233 | #define IAlloc_Alloc(p, size) (p)->Alloc((p), size) 234 | #define IAlloc_Free(p, a) (p)->Free((p), a) 235 | 236 | #ifdef _WIN32 237 | 238 | #define CHAR_PATH_SEPARATOR '\\' 239 | #define WCHAR_PATH_SEPARATOR L'\\' 240 | #define STRING_PATH_SEPARATOR "\\" 241 | #define WSTRING_PATH_SEPARATOR L"\\" 242 | 243 | #else 244 | 245 | #define CHAR_PATH_SEPARATOR '/' 246 | #define WCHAR_PATH_SEPARATOR L'/' 247 | #define STRING_PATH_SEPARATOR "/" 248 | #define WSTRING_PATH_SEPARATOR L"/" 249 | 250 | #endif 251 | 252 | EXTERN_C_END 253 | 254 | #endif 255 | -------------------------------------------------------------------------------- /DecRawso/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := DecRawso 6 | LOCAL_SRC_FILES := 7zMain.c \ 7 | 7zC\7zAlloc.c \ 8 | 7zC\7zBuf.c \ 9 | 7zC\7zCrc.c \ 10 | 7zC\7zCrcOpt.c \ 11 | 7zC\7zDec.c \ 12 | 7zC\7zFile.c \ 13 | 7zC\7zIn.c \ 14 | 7zC\7zStream.c \ 15 | 7zC\Bcj2.c \ 16 | 7zC\Bra.c \ 17 | 7zC\Bra86.c \ 18 | 7zC\CpuArch.c \ 19 | 7zC\Lzma2Dec.c \ 20 | 7zC\LzmaDec.c \ 21 | 7zC\Ppmd7.c \ 22 | 7zC\Ppmd7Dec.c 23 | 24 | LOCAL_LDLIBS += -llog -landroid 25 | LOCAL_CFLAGS += -DUNICODE -Wno-format-security -std=c99 26 | ifeq ($(TARGET_ARCH_ABI),x86) 27 | LOCAL_CFLAGS += -D_M_IX86 28 | else 29 | LOCAL_CFLAGS += -D_M_ARM 30 | endif 31 | 32 | include $(BUILD_SHARED_LIBRARY) 33 | 34 | #--------------------------------------------------- 35 | 36 | include $(CLEAR_VARS) 37 | 38 | LOCAL_MODULE := DecRawso22 39 | ifeq ($(TARGET_ARCH_ABI),x86) 40 | else 41 | LOCAL_SRC_FILES := 7zMain.c \ 42 | 7zC\7zAlloc.c \ 43 | 7zC\7zBuf.c \ 44 | 7zC\7zCrc.c \ 45 | 7zC\7zCrcOpt.c \ 46 | 7zC\7zDec.c \ 47 | 7zC\7zFile.c \ 48 | 7zC\7zIn.c \ 49 | 7zC\7zStream.c \ 50 | 7zC\Bcj2.c \ 51 | 7zC\Bra.c \ 52 | 7zC\Bra86.c \ 53 | 7zC\CpuArch.c \ 54 | 7zC\Lzma2Dec.c \ 55 | 7zC\LzmaDec.c \ 56 | 7zC\Ppmd7.c \ 57 | 7zC\Ppmd7Dec.c 58 | 59 | LOCAL_LDLIBS += -llog 60 | LOCAL_CFLAGS += -DUNICODE -DANDROID22 -Wno-format-security -std=c99 61 | LOCAL_CFLAGS += -D_M_ARM 62 | endif 63 | include $(BUILD_SHARED_LIBRARY) 64 | 65 | -------------------------------------------------------------------------------- /DecRawso/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi x86 -------------------------------------------------------------------------------- /DecRawso/jni/DecRawso.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /DecRawso/libs/armeabi/libDecRawso.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/libs/armeabi/libDecRawso.so -------------------------------------------------------------------------------- /DecRawso/libs/armeabi/libDecRawso22.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/libs/armeabi/libDecRawso22.so -------------------------------------------------------------------------------- /DecRawso/libs/x86/libDecRawso.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/libs/x86/libDecRawso.so -------------------------------------------------------------------------------- /DecRawso/libs/x86/libDecRawso22.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/libs/x86/libDecRawso22.so -------------------------------------------------------------------------------- /DecRawso/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /DecRawso/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-17 15 | android.library=true 16 | -------------------------------------------------------------------------------- /DecRawso/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /DecRawso/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /DecRawso/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /DecRawso/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /DecRawso/res/values-de-rDE/string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Restart 5 | fortsetzen 6 | OK 7 | Optimierung 8 | Optimierung vollständig, wirksam nach Restart 9 | Nicht genügend Speicher, starten Sie Ihr Gerät 10 | Zu wenig Stauraum, mehr Platz 11 | Unbekannter Fehler 12 | 13 | Anfängliche Fehler 14 | Verlassen 15 | Initialisieren 16 | Bitte warten 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso/res/values-en-rUS/string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Restart 5 | Continue 6 | OK 7 | Optimization 8 | Optimization complete,take effect after restart 9 | Insufficient memory, reboot your device 10 | Insufficient storage space, free up some space 11 | Unknown Error 12 | 13 | Initial Error 14 | Quit 15 | Initializing 16 | Please Wait 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso/res/values-fr-rFR/string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redémarrer 5 | continuer 6 | bien 7 | Optimisation 8 | Optimisation complète, prend effet après redémarrage 9 | Mémoire insuffisante, redémarrez votre appareil 10 | Espace de stockage insuffisant, libérez de lespace 11 | Erreur inconnue 12 | 13 | Erreur initiale 14 | Quitter 15 | Initialisation 16 | Attendez sil vous plaît 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso/res/values-ja-rJP/string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 重启 5 | 続ける 6 | 确定 7 | 最適化 8 | 最適化が完了すると、再起動後に有効になります 9 | メモリが不足し、お使いのデバイスを再起動 10 | 不十分な収納スペースは、いくつかの領域を解放 11 | 不明なエラー 12 | 13 | 初期誤差 14 | やめる 15 | 初期化 16 | しばらくお待ちください 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso/res/values-ko-rKR/string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 재부팅 5 | 계속 6 | OK 7 | 최적화 8 | 최적화 완료, 다시 시작하면 적용 9 | 메모리가 부족하여 장치를 다시 부팅 10 | 저장 공간이 부족은 공간을 확보 11 | 알 수없는 오류 12 | 13 | 초기 오류 14 | 종료 15 | 초기화 16 | 기다려주십시오 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso/res/values-ru-rRU/string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | перезапуск 5 | продолжать 6 | хорошо 7 | оптимизация 8 | Оптимизация полной, вступают в силу после перезагрузки 9 | Недостаточно памяти, перезагрузить устройство 10 | Недостаточно места для хранения, освободить место 11 | Неизвестная ошибка 12 | 13 | начальная ошибка 14 | выход 15 | Инициализация 16 | Ждите 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DecRawso/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /DecRawso/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /DecRawso/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /DecRawso/res/values-zh-rCN/string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 重启 5 | 继续 6 | 确定 7 | 优化 8 | 优化完成,重启软件生效 9 | 内存不足,请重启设备 10 | 存储空间不足,请删除其它应用 11 | 未知错误 12 | 13 | 初始化错误 14 | 退出 15 | 正在初始化 16 | 请等待 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso/res/values-zh-rTW/string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 重啟 5 | 繼續 6 | 確定 7 | 優化 8 | 優化完成,重啟軟件生效 9 | 內存不足,請重啟設備 10 | 存儲空間不足,請刪除其它應用 11 | 未知錯誤 12 | 13 | 初始化錯誤 14 | 退出 15 | 正在初始化 16 | 請等待 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /DecRawso/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Restart 5 | Continue 6 | OK 7 | Optimization 8 | Optimization complete,take effect after restart 9 | Insufficient memory, reboot your device 10 | Insufficient storage space, free up some space 11 | Unknown Error 12 | 13 | Initial Error 14 | Quit 15 | Initializing 16 | Please Wait 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /DecRawso/src/com/library/decrawso/CloudDownloader.java: -------------------------------------------------------------------------------- 1 | package com.library.decrawso; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileInputStream; 6 | import java.io.FileNotFoundException; 7 | import java.io.FileOutputStream; 8 | import java.io.IOException; 9 | import java.io.InputStream; 10 | import java.io.InputStreamReader; 11 | import java.io.OutputStream; 12 | import java.net.HttpURLConnection; 13 | import java.net.URL; 14 | import java.nio.ByteBuffer; 15 | import java.nio.channels.FileChannel; 16 | import java.security.MessageDigest; 17 | import java.security.NoSuchAlgorithmException; 18 | 19 | import android.content.BroadcastReceiver; 20 | import android.content.Context; 21 | import android.content.Intent; 22 | import android.content.IntentFilter; 23 | import android.net.NetworkInfo; 24 | import android.net.wifi.WifiManager; 25 | import android.os.Parcelable; 26 | 27 | public class CloudDownloader { 28 | private Thread mCloudThread=null; 29 | private HttpURLConnection httpURLConnection=null; 30 | private NetworkConnectChangedReceiver mNetworkStateReceiver; 31 | private final static int TIMEOUT = 10 * 1000;// 32 | private String sAppFilePathClound; 33 | private Context mAppContextClound; 34 | //private UtilsFunc mUtils = new UtilsFunc(); 35 | 36 | public void RegisterCloudDownloader(Context mc, String spath) 37 | { 38 | mAppContextClound = mc; 39 | sAppFilePathClound = spath; 40 | IntentFilter filter = new IntentFilter(); 41 | filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); 42 | mNetworkStateReceiver = new NetworkConnectChangedReceiver(); 43 | mAppContextClound.registerReceiver(mNetworkStateReceiver, filter); 44 | } 45 | 46 | private String getMD5(String filename) { 47 | String MD5Value=null; 48 | String hashType = "MD5"; 49 | FileInputStream fStream = null; 50 | try { 51 | MessageDigest md5 = MessageDigest.getInstance(hashType); 52 | fStream = new FileInputStream(filename); 53 | FileChannel fChannel = fStream.getChannel(); 54 | ByteBuffer buffer = ByteBuffer.allocate(8 * 1024); 55 | //long s = System.currentTimeMillis(); 56 | for (int count = fChannel.read(buffer); count != -1; count = fChannel 57 | .read(buffer)) { 58 | buffer.flip(); 59 | md5.update(buffer); 60 | if (!buffer.hasRemaining()) { 61 | // System.out.println("count:"+count); 62 | buffer.clear(); 63 | } 64 | } 65 | //s = System.currentTimeMillis() - s; 66 | MD5Value = new String(md5.digest(),"UTF-8"); 67 | 68 | } catch (NoSuchAlgorithmException e) { 69 | // TODO Auto-generated catch block 70 | e.printStackTrace(); 71 | } catch (FileNotFoundException e) { 72 | // TODO Auto-generated catch block 73 | e.printStackTrace(); 74 | } catch (IOException e) { 75 | // TODO Auto-generated catch block 76 | e.printStackTrace(); 77 | } finally { 78 | try { 79 | if (fStream != null) 80 | fStream.close(); 81 | } catch (IOException e) { 82 | e.printStackTrace(); 83 | } 84 | } 85 | return MD5Value; 86 | } 87 | 88 | private boolean downloadCloudFile(String down_url, String file) 89 | throws Exception { 90 | int down_step = 5;// step 91 | long totalSize;// totalsize 92 | long downloadCount = 0; 93 | int updateCount = 0; 94 | InputStream inputStream; 95 | OutputStream outputStream; 96 | 97 | URL url = new URL(down_url); 98 | httpURLConnection = (HttpURLConnection) url 99 | .openConnection(); 100 | httpURLConnection.setConnectTimeout(TIMEOUT); 101 | //httpURLConnection.setReadTimeout(TIMEOUT); 102 | httpURLConnection.setRequestProperty("Accept-Encoding", "identity"); 103 | //httpURLConnection.setRequestMethod("GET"); 104 | //httpURLConnection.setRequestProperty("Connection", "Keep-Alive"); 105 | //httpURLConnection.connect(); 106 | // 107 | totalSize = httpURLConnection.getContentLength(); 108 | if (httpURLConnection.getResponseCode() == 404 || totalSize<=0) { 109 | throw new Exception("fail!"); 110 | } 111 | if (httpURLConnection != null) { 112 | httpURLConnection.disconnect(); 113 | } 114 | 115 | File downloadis = new File(file); 116 | if(downloadis.exists()) 117 | downloadCount = downloadis.length(); 118 | 119 | if(downloadCount= updateCount) { 144 | updateCount += down_step; 145 | // 146 | // notification.setLatestEventInfo(this, "downloading...", updateCount 147 | // + "%" + "", pendingIntent); 148 | } 149 | } 150 | inputStream.close(); 151 | outputStream.close(); 152 | 153 | if (httpURLConnection != null) { 154 | httpURLConnection.disconnect(); 155 | httpURLConnection = null; 156 | } 157 | } 158 | 159 | return downloadCount>=totalSize; 160 | } 161 | 162 | class NetworkConnectChangedReceiver extends BroadcastReceiver { 163 | @Override 164 | public void onReceive(Context context, Intent intent) { 165 | if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(intent.getAction())) { 166 | Parcelable parcelableExtra = intent 167 | .getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO); 168 | if (null != parcelableExtra) { 169 | NetworkInfo networkInfo = (NetworkInfo) parcelableExtra; 170 | if (networkInfo.getState() == android.net.NetworkInfo.State.CONNECTED) { 171 | checkCloud(); 172 | } 173 | } 174 | } 175 | } 176 | } 177 | 178 | private void checkCloud() 179 | { 180 | if(mCloudThread!=null) 181 | { 182 | try { 183 | if (httpURLConnection != null) { 184 | httpURLConnection.disconnect(); 185 | httpURLConnection = null; 186 | } 187 | mCloudThread.join(); 188 | } catch (InterruptedException e1) { 189 | // TODO Auto-generated catch block 190 | e1.printStackTrace(); 191 | } 192 | } 193 | 194 | mCloudThread = new Thread(new Runnable() { 195 | @Override 196 | public void run() { 197 | File filex = new File(sAppFilePathClound+"/DecRawsoLib/cloud.txt"); 198 | if(filex.exists()) //need download 199 | { 200 | try { 201 | BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( filex ) ), 1000); 202 | String cloudURL = reader.readLine(); 203 | //String MD5String = reader.readLine(); 204 | reader.close(); 205 | 206 | //if(cloudtype == "LINK") 207 | if(downloadCloudFile(cloudURL,sAppFilePathClound+"/DecRawsoLib/cloudrawso")) 208 | { 209 | //todo: md5 check or not? md5 check may be wrong 210 | filex.delete(); 211 | mAppContextClound.unregisterReceiver(mNetworkStateReceiver); 212 | DecRawso.GetInstance().Dec7zCloudLib(); 213 | //mUtils.showToastInThread(mAppContextClound.getResources().getString(mUtils.getIdByName(mAppContextClound,"string","DecRawso_TackEffect_Restart")),mAppContextClound); 214 | } 215 | } catch (FileNotFoundException e) { 216 | // TODO Auto-generated catch block 217 | e.printStackTrace(); 218 | } catch (IOException e) { 219 | // TODO Auto-generated catch block 220 | e.printStackTrace(); 221 | } catch (Exception e) { 222 | // TODO Auto-generated catch block 223 | e.printStackTrace(); 224 | } 225 | } 226 | } 227 | }); 228 | mCloudThread.start(); 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /DecRawso/src/com/library/decrawso/DecRawso.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso/src/com/library/decrawso/DecRawso.java -------------------------------------------------------------------------------- /DecRawso/src/com/library/decrawso/UtilsFunc.java: -------------------------------------------------------------------------------- 1 | package com.library.decrawso; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileNotFoundException; 6 | import java.io.IOException; 7 | import java.lang.reflect.Field; 8 | import java.nio.ByteBuffer; 9 | import java.nio.channels.FileChannel; 10 | import java.security.MessageDigest; 11 | import java.security.NoSuchAlgorithmException; 12 | import java.util.List; 13 | 14 | import dalvik.system.BaseDexClassLoader; 15 | import dalvik.system.DexClassLoader; 16 | import dalvik.system.PathClassLoader; 17 | import android.annotation.SuppressLint; 18 | import android.content.Context; 19 | import android.os.Build; 20 | import android.os.Looper; 21 | import android.widget.Toast; 22 | 23 | public class UtilsFunc { 24 | private Context mUtilsFuncContext; 25 | 26 | class ToastThread implements Runnable 27 | { 28 | private String msgstr; 29 | private Looper lp; 30 | public ToastThread(String _msgstr,Context mc) 31 | { 32 | msgstr = _msgstr; 33 | mUtilsFuncContext = mc; 34 | } 35 | public Looper getItLooper() 36 | { 37 | return lp; 38 | } 39 | @Override 40 | public void run() { 41 | Looper.prepare(); 42 | lp = Looper.myLooper(); 43 | Toast.makeText(mUtilsFuncContext,msgstr,Toast.LENGTH_LONG).show(); 44 | Looper.loop(); 45 | } 46 | } 47 | public boolean showToastInThread(String msgstr,Context mc) 48 | { 49 | ToastThread runToast = new ToastThread(msgstr,mc); 50 | Thread tmpToastThread = new Thread(runToast); 51 | tmpToastThread.start(); 52 | try { 53 | tmpToastThread.join(5000); 54 | runToast.getItLooper().quit(); 55 | tmpToastThread.join(); 56 | } catch (InterruptedException e) { 57 | // TODO Auto-generated catch block 58 | e.printStackTrace(); 59 | } 60 | return true; 61 | } 62 | 63 | public void HackLibPath(String pname) 64 | { 65 | /* 66 | if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.ICE_CREAM_SANDWICH) 67 | HackSystemICS(pname); 68 | else 69 | { 70 | if(!HackSystemLow1(pname)) 71 | { 72 | if(!HackSystemLow2(pname)) 73 | HackSystemLow3(pname); 74 | } 75 | } 76 | */ //--leyou find sansumg s4 will use HackSystemLow1? 77 | HackSystemICS(pname); 78 | HackSystemLow1(pname); 79 | HackSystemLow2(pname); 80 | HackSystemLow3(pname); 81 | } 82 | 83 | @SuppressLint("NewApi") 84 | private void HackSystemICS(String pname) 85 | { 86 | try{ 87 | Field fieldSysPath = BaseDexClassLoader.class.getDeclaredField("pathList"); 88 | fieldSysPath.setAccessible(true); 89 | Object paths = (Object)fieldSysPath.get(this.getClass().getClassLoader()); 90 | Class c = paths.getClass(); 91 | Field Libpaths = c.getDeclaredField("nativeLibraryDirectories"); 92 | Libpaths.setAccessible(true); 93 | 94 | File[] nativepaths = (File[])Libpaths.get(paths); 95 | File[] tmp = new File[nativepaths.length+1]; 96 | System.arraycopy(nativepaths,0,tmp,1,nativepaths.length); 97 | tmp[0] = new File(pname); 98 | Libpaths.set(paths, tmp); 99 | 100 | }catch (Exception e) { 101 | e.printStackTrace(); 102 | }catch (java.lang.Error e)//NoClassDefFoundError 103 | { 104 | e.printStackTrace(); 105 | } 106 | } 107 | 108 | private boolean HackSystemLow3(String pname) //even older 109 | { 110 | boolean bret = true; 111 | Field fieldSysPath; 112 | 113 | try{ 114 | fieldSysPath = DexClassLoader.class.getDeclaredField("mLibPaths"); 115 | fieldSysPath.setAccessible(true); 116 | 117 | String[] paths = (String[])fieldSysPath.get(this.getClass().getClassLoader()); 118 | String[] tmp= new String[paths.length+1]; 119 | System.arraycopy(paths,0,tmp,0,paths.length); 120 | tmp[paths.length] = pname; 121 | fieldSysPath.set(this.getClass().getClassLoader(), tmp); 122 | 123 | }catch (Exception e) { 124 | e.printStackTrace(); 125 | bret = false; 126 | }catch (java.lang.Error e)//NoClassDefFoundError 127 | { 128 | e.printStackTrace(); 129 | } 130 | return bret; 131 | } 132 | 133 | private boolean HackSystemLow2(String pname) //for 2.2 134 | { 135 | boolean bret = true; 136 | try{ 137 | Field fieldSysPath = PathClassLoader.class.getDeclaredField("mLibPaths"); 138 | fieldSysPath.setAccessible(true); 139 | 140 | String[] paths = (String[])fieldSysPath.get(this.getClass().getClassLoader()); 141 | String[] tmp= new String[paths.length+1]; 142 | System.arraycopy(paths,0,tmp,0,paths.length); 143 | tmp[paths.length] = pname; 144 | fieldSysPath.set(this.getClass().getClassLoader(), tmp); 145 | 146 | }catch (Exception e) { 147 | e.printStackTrace(); 148 | bret = false; 149 | }catch (java.lang.Error e)//NoClassDefFoundError 150 | { 151 | e.printStackTrace(); 152 | } 153 | return bret; 154 | } 155 | 156 | private boolean HackSystemLow1(String pname) //for 2.3 157 | { 158 | boolean bret = true; 159 | try{ 160 | Field fieldSysPath = PathClassLoader.class.getDeclaredField("libraryPathElements"); 161 | fieldSysPath.setAccessible(true); 162 | 163 | List paths = (List)fieldSysPath.get(this.getClass().getClassLoader()); 164 | paths.add(pname); 165 | //fieldSysPath.set(paths, paths); 166 | 167 | }catch (Exception e) { 168 | e.printStackTrace(); 169 | bret = false; 170 | }catch (java.lang.Error e) //NoClassDefFoundError 171 | { 172 | e.printStackTrace(); 173 | } 174 | return bret; 175 | } 176 | 177 | public int getIdByName(Context context, String className, String name) { 178 | String packageName = context.getPackageName(); 179 | Class r = null; 180 | int id = 0; 181 | try { 182 | r = Class.forName(packageName + ".R"); 183 | 184 | Class[] classes = r.getClasses(); 185 | Class desireClass = null; 186 | 187 | for (int i = 0; i < classes.length; ++i) { 188 | if (classes[i].getName().split("\\$")[1].equals(className)) { 189 | desireClass = classes[i]; 190 | break; 191 | } 192 | } 193 | 194 | if (desireClass != null) 195 | id = desireClass.getField(name).getInt(desireClass); 196 | } catch (ClassNotFoundException e) { 197 | e.printStackTrace(); 198 | } catch (IllegalArgumentException e) { 199 | e.printStackTrace(); 200 | } catch (SecurityException e) { 201 | e.printStackTrace(); 202 | } catch (IllegalAccessException e) { 203 | e.printStackTrace(); 204 | } catch (NoSuchFieldException e) { 205 | e.printStackTrace(); 206 | } 207 | 208 | return id; 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /DecRawso_Jar/libs/DecRawso.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso_Jar/libs/DecRawso.jar -------------------------------------------------------------------------------- /DecRawso_Jar/libs/armeabi/libDecRawso.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso_Jar/libs/armeabi/libDecRawso.so -------------------------------------------------------------------------------- /DecRawso_Jar/libs/armeabi/libDecRawso22.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso_Jar/libs/armeabi/libDecRawso22.so -------------------------------------------------------------------------------- /DecRawso_Jar/libs/x86/libDecRawso.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso_Jar/libs/x86/libDecRawso.so -------------------------------------------------------------------------------- /DecRawso_Jar/libs/x86/libDecRawso22.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/DecRawso_Jar/libs/x86/libDecRawso22.so -------------------------------------------------------------------------------- /DecRawso_Jar/res/values-de-rDE/decrawso_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Restart 5 | fortsetzen 6 | OK 7 | Optimierung 8 | Optimierung vollständig, wirksam nach Restart 9 | Nicht genügend Speicher, starten Sie Ihr Gerät 10 | Zu wenig Stauraum, mehr Platz 11 | Unbekannter Fehler 12 | 13 | Anfängliche Fehler 14 | Verlassen 15 | Initialisieren 16 | Bitte warten 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso_Jar/res/values-en-rUS/decrawso_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Restart 5 | Continue 6 | OK 7 | Optimization 8 | Optimization complete,take effect after restart 9 | Insufficient memory, reboot your device 10 | Insufficient storage space, free up some space 11 | Unknown Error 12 | 13 | Initial Error 14 | Quit 15 | Initializing 16 | Please Wait 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso_Jar/res/values-fr-rFR/decrawso_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redémarrer 5 | continuer 6 | bien 7 | Optimisation 8 | Optimisation complète, prend effet après redémarrage 9 | Mémoire insuffisante, redémarrez votre appareil 10 | Espace de stockage insuffisant, libérez de lespace 11 | Erreur inconnue 12 | 13 | Erreur initiale 14 | Quitter 15 | Initialisation 16 | Attendez sil vous plaît 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso_Jar/res/values-ja-rJP/decrawso_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 重启 5 | 続ける 6 | 确定 7 | 最適化 8 | 最適化が完了すると、再起動後に有効になります 9 | メモリが不足し、お使いのデバイスを再起動 10 | 不十分な収納スペースは、いくつかの領域を解放 11 | 不明なエラー 12 | 13 | 初期誤差 14 | やめる 15 | 初期化 16 | しばらくお待ちください 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso_Jar/res/values-ko-rKR/decrawso_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 재부팅 5 | 계속 6 | OK 7 | 최적화 8 | 최적화 완료, 다시 시작하면 적용 9 | 메모리가 부족하여 장치를 다시 부팅 10 | 저장 공간이 부족은 공간을 확보 11 | 알 수없는 오류 12 | 13 | 초기 오류 14 | 종료 15 | 초기화 16 | 기다려주십시오 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso_Jar/res/values-ru-rRU/decrawso_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | перезапуск 5 | продолжать 6 | хорошо 7 | оптимизация 8 | Оптимизация полной, вступают в силу после перезагрузки 9 | Недостаточно памяти, перезагрузить устройство 10 | Недостаточно места для хранения, освободить место 11 | Неизвестная ошибка 12 | 13 | начальная ошибка 14 | выход 15 | Инициализация 16 | Ждите 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso_Jar/res/values-zh-rCN/decrawso_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 重启 5 | 继续 6 | 确定 7 | 优化 8 | 优化完成,重启软件生效 9 | 内存不足,请重启设备 10 | 存储空间不足,请删除其它应用 11 | 未知错误 12 | 13 | 初始化错误 14 | 退出 15 | 正在初始化 16 | 请等待 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso_Jar/res/values-zh-rTW/decrawso_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 重啟 5 | 繼續 6 | 確定 7 | 優化 8 | 優化完成,重啟軟件生效 9 | 內存不足,請重啟設備 10 | 存儲空間不足,請刪除其它應用 11 | 未知錯誤 12 | 13 | 初始化錯誤 14 | 退出 15 | 正在初始化 16 | 請等待 17 | 18 | 19 | -------------------------------------------------------------------------------- /DecRawso_Jar/res/values/decrawso_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Restart 5 | Continue 6 | OK 7 | Optimization 8 | Optimization complete,take effect after restart 9 | Insufficient memory, reboot your device 10 | Insufficient storage space, free up some space 11 | Unknown Error 12 | 13 | Initial Error 14 | Quit 15 | Initializing 16 | Please Wait 17 | 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 liyuming1978 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Licenses/License-7z.txt: -------------------------------------------------------------------------------- 1 | 7-Zip 2 | ~~~~~ 3 | License for use and distribution 4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | 7-Zip Copyright (C) 1999-2010 Igor Pavlov. 7 | 8 | Licenses for files are: 9 | 10 | 1) 7z.dll: GNU LGPL + unRAR restriction 11 | 2) All other files: GNU LGPL 12 | 13 | The GNU LGPL + unRAR restriction means that you must follow both 14 | GNU LGPL rules and unRAR restriction rules. 15 | 16 | 17 | Note: 18 | You can use 7-Zip on any computer, including a computer in a commercial 19 | organization. You don't need to register or pay for 7-Zip. 20 | 21 | 22 | GNU LGPL information 23 | -------------------- 24 | 25 | This library is free software; you can redistribute it and/or 26 | modify it under the terms of the GNU Lesser General Public 27 | License as published by the Free Software Foundation; either 28 | version 2.1 of the License, or (at your option) any later version. 29 | 30 | This library is distributed in the hope that it will be useful, 31 | but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 33 | Lesser General Public License for more details. 34 | 35 | You can receive a copy of the GNU Lesser General Public License from 36 | http://www.gnu.org/ 37 | 38 | 39 | unRAR restriction 40 | ----------------- 41 | 42 | The decompression engine for RAR archives was developed using source 43 | code of unRAR program. 44 | All copyrights to original unRAR code are owned by Alexander Roshal. 45 | 46 | The license for original unRAR code has the following restriction: 47 | 48 | The unRAR sources cannot be used to re-create the RAR compression algorithm, 49 | which is proprietary. Distribution of modified unRAR sources in separate form 50 | or as a part of other software is permitted, provided that it is clearly 51 | stated in the documentation and source comments that the code may 52 | not be used to develop a RAR (WinRAR) compatible archiver. 53 | 54 | 55 | -- 56 | Igor Pavlov 57 | -------------------------------------------------------------------------------- /Licenses/License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) <2014> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 

NativeLibCompression

2 | 3 |

====================

4 | 5 |

There are lots of NDK apps on Google software market. To 6 | reduce package size, some ISV will only release Separate APK. A native library 7 | compression sdk is given to solve the apk size problem. It is easy to integrate 8 | and will get max 50% size decreasing. Beside sdk, a Java tool for package is 9 | provided to convert normal apk to compressed apk.

10 | 11 |

 

12 | 13 |

HOW TO USE IT:

14 | 15 |

1.Include DecRawso into your project (if you use ant, 16 | please copy DecRawso_Jar to your project , and add the 17 | Decrawso.jar, do not use the jar in the sdk bin folder)

18 | 19 |

2.Call DecRawso.NewInstance before any native 20 | library loading!!!

21 | 22 |

3.Replace all system.loadlibrary(***) to 23 | system.load(DecRawso . GetInstance ().GetPath(***))

24 | 25 |

       now, it is 26 | recommend to change to system.load, but system.loadlibrary also work.

27 | 28 |

--- build your apk as usual, and run your apk as usual 29 | when in your development, the apk is not compressed.

30 | 31 |

 

32 | 33 |

HOW TO COMPRESS THE APK: -- Use compress tool : 34 | ApkLibCompress/bin/ ComPressApk.jar

35 | 36 |

1.You can use it as:  ComPressApk.jar -a 37 | C:/my/test.apk -k c:/key storepass keypass alias [your keyname] -x86 38 | http://www.test.com

39 | 40 |

2.if “-k” is missing, eclipse default test key will be 41 | used to sign this apk. 

42 | 43 |

3.[you keyname] is optional, if not have it. the 44 | defalt CERT will be used

45 | 46 |

4.If -x86 with link is used, then x86 library will be 47 | stored on http://www.test.com/cloudrawso_x86,   you must store the lib on 48 | the network bu manuanlly.

49 | 50 |

5.you can put arm lib on x86 folder to 51 | avoid library miss on x86 devices, use -nox86check to forbidden the 52 | check (x86 directly cal arm lib is unsafed)

53 | 54 |

6.you can copy all of "DecRawso_Jar" 55 | into your project if you use "ant" to package your project

56 | 57 |

7.new flag

58 | 59 |

  -o outputfilename     define 60 | the finaly output file name

61 | 62 |

    -slience         63 |     no popup window, that is suitable for ant package

64 | 65 |

    -nosign         66 |     do not sign the apk, that is suitable for ant package , due to 67 | the ant will sign apk

68 | 69 |

-nox86check      do not check x86 library missing and mix use of arm 70 | issue (x86 directly call arm library is forbidden default)

71 | 72 |

-noarm            do 73 | not compress arm lib. just put x86 lib on the cloud (with –x86)

74 | 75 |

8.how to know the result (when you use ant)

76 | 77 |

    now will create 3 files in the 78 | ApkLibCompress.jar folder

79 | 80 |

    :Done.flag      you can check whether the file is exist , if 81 | exist , then compression is ok

82 | 83 |

    :error.log        if generation fail, the log will has the 84 | reason

85 | 86 |

    :porting.log      it will show the x86/arm mix using or x86 87 | lib missing issue

88 | 89 | http://blog.csdn.net/onlySound/article/details/58620502 90 | -------------------------------------------------------------------------------- /readme.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/readme.docx -------------------------------------------------------------------------------- /压缩工具问答.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/压缩工具问答.docx -------------------------------------------------------------------------------- /安卓压缩工具集说明文档.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuming1978/NativeLibCompression/5981440802f6d701a912abd3f3b1c97cec04c6b3/安卓压缩工具集说明文档.docx --------------------------------------------------------------------------------