mirror of
https://github.com/revanced/smali.git
synced 2025-05-02 15:44:30 +02:00
Change DexInputEntry.loadDexFile to accept an Opcodes object instead of an api
This commit is contained in:
parent
8f27f45fb1
commit
7f20300b92
@ -100,10 +100,9 @@ public abstract class DexInputCommand extends Command {
|
||||
* framework/arm/framework.oat/"system/framework/framework.jar:classes2.dex"
|
||||
*
|
||||
* @param input The name of a dex, apk, odex or oat file/entry.
|
||||
* @param apiLevel The api level to load the dex file with
|
||||
* @param opcodes The set of opcodes to load the dex file with.
|
||||
*/
|
||||
@Nonnull
|
||||
protected void loadDexFile(@Nonnull String input, int apiLevel) {
|
||||
protected void loadDexFile(@Nonnull String input, Opcodes opcodes) {
|
||||
File file = new File(input);
|
||||
|
||||
while (file != null && !file.exists()) {
|
||||
@ -132,13 +131,13 @@ public abstract class DexInputCommand extends Command {
|
||||
inputEntry = dexEntry;
|
||||
|
||||
try {
|
||||
dexFile = DexFileFactory.loadDexEntry(file, dexEntry, exactMatch, Opcodes.forApi(apiLevel));
|
||||
dexFile = DexFileFactory.loadDexEntry(file, dexEntry, exactMatch, opcodes);
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
dexFile = DexFileFactory.loadDexFile(file, Opcodes.forApi(apiLevel));
|
||||
dexFile = DexFileFactory.loadDexFile(file, opcodes);
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import com.beust.jcommander.ParametersDelegate;
|
||||
import com.beust.jcommander.validators.PositiveInteger;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.jf.dexlib2.Opcodes;
|
||||
import org.jf.dexlib2.util.SyntheticAccessorResolver;
|
||||
import org.jf.util.StringWrapper;
|
||||
import org.jf.util.jcommander.ExtendedParameter;
|
||||
@ -149,7 +150,7 @@ public class DisassembleCommand extends DexInputCommand {
|
||||
}
|
||||
|
||||
String input = inputList.get(0);
|
||||
loadDexFile(input, 15);
|
||||
loadDexFile(input, Opcodes.getDefault());
|
||||
|
||||
if (showDeodexWarning() && dexFile.hasOdexOpcodes()) {
|
||||
StringWrapper.printWrappedString(System.err,
|
||||
|
@ -34,6 +34,7 @@ package org.jf.baksmali;
|
||||
import com.beust.jcommander.JCommander;
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import org.jf.dexlib2.Opcodes;
|
||||
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
|
||||
import org.jf.dexlib2.dexbacked.raw.RawDexFile;
|
||||
import org.jf.dexlib2.dexbacked.raw.util.DexAnnotator;
|
||||
@ -77,7 +78,7 @@ public class DumpCommand extends DexInputCommand {
|
||||
}
|
||||
|
||||
String input = inputList.get(0);
|
||||
loadDexFile(input, 15);
|
||||
loadDexFile(input, Opcodes.getDefault());
|
||||
|
||||
try {
|
||||
dump(dexFile, System.out, apiLevel);
|
||||
|
@ -34,8 +34,8 @@ package org.jf.baksmali;
|
||||
import com.beust.jcommander.JCommander;
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import org.jf.dexlib2.iface.reference.Reference;
|
||||
import org.jf.dexlib2.util.ReferenceUtil;
|
||||
import org.jf.dexlib2.Opcodes;
|
||||
import org.jf.dexlib2.iface.ClassDef;
|
||||
import org.jf.util.jcommander.ExtendedParameters;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -68,10 +68,10 @@ public class ListClassesCommand extends DexInputCommand {
|
||||
}
|
||||
|
||||
String input = inputList.get(0);
|
||||
loadDexFile(input, 15);
|
||||
loadDexFile(input, Opcodes.getDefault());
|
||||
|
||||
for (Reference reference: dexFile.getClasses()) {
|
||||
System.out.println(ReferenceUtil.getReferenceString(reference));
|
||||
for (ClassDef classDef: dexFile.getClasses()) {
|
||||
System.out.println(classDef.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import com.beust.jcommander.JCommander;
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import com.beust.jcommander.ParametersDelegate;
|
||||
import org.jf.dexlib2.Opcodes;
|
||||
import org.jf.dexlib2.analysis.ClassProto;
|
||||
import org.jf.dexlib2.iface.ClassDef;
|
||||
import org.jf.dexlib2.iface.reference.FieldReference;
|
||||
@ -75,7 +76,7 @@ public class ListFieldOffsetsCommand extends DexInputCommand {
|
||||
}
|
||||
|
||||
String input = inputList.get(0);
|
||||
loadDexFile(input, 15);
|
||||
loadDexFile(input, Opcodes.getDefault());
|
||||
BaksmaliOptions options = getOptions();
|
||||
|
||||
try {
|
||||
|
@ -33,6 +33,7 @@ package org.jf.baksmali;
|
||||
|
||||
import com.beust.jcommander.JCommander;
|
||||
import com.beust.jcommander.Parameter;
|
||||
import org.jf.dexlib2.Opcodes;
|
||||
import org.jf.dexlib2.iface.reference.Reference;
|
||||
import org.jf.dexlib2.util.ReferenceUtil;
|
||||
|
||||
@ -65,7 +66,7 @@ public abstract class ListReferencesCommand extends DexInputCommand {
|
||||
}
|
||||
|
||||
String input = inputList.get(0);
|
||||
loadDexFile(input, 15);
|
||||
loadDexFile(input, Opcodes.getDefault());
|
||||
|
||||
for (Reference reference: dexFile.getReferences(referenceType)) {
|
||||
System.out.println(ReferenceUtil.getReferenceString(reference));
|
||||
|
@ -37,6 +37,7 @@ import com.beust.jcommander.Parameters;
|
||||
import com.beust.jcommander.ParametersDelegate;
|
||||
import org.jf.baksmali.AnalysisArguments.CheckPackagePrivateArgument;
|
||||
import org.jf.dexlib2.AccessFlags;
|
||||
import org.jf.dexlib2.Opcodes;
|
||||
import org.jf.dexlib2.analysis.ClassProto;
|
||||
import org.jf.dexlib2.iface.ClassDef;
|
||||
import org.jf.dexlib2.iface.Method;
|
||||
@ -91,7 +92,7 @@ public class ListVtablesCommand extends DexInputCommand {
|
||||
}
|
||||
|
||||
String input = inputList.get(0);
|
||||
loadDexFile(input, 15);
|
||||
loadDexFile(input, Opcodes.getDefault());
|
||||
|
||||
BaksmaliOptions options = getOptions();
|
||||
if (options == null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user