Allow Transformers to throw AnalyzerException

master
Graham 5 years ago
parent b27763a699
commit 3978ee9ea0
  1. 15
      asm/src/main/java/dev/openrs2/asm/Transformer.java
  2. 3
      deob/src/main/java/dev/openrs2/deob/ClassNamePrefixer.java
  3. 5
      deob/src/main/java/dev/openrs2/deob/Deobfuscator.java

@ -4,9 +4,10 @@ import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.analysis.AnalyzerException;
public abstract class Transformer {
public final void transform(Library library) {
public void transform(Library library) throws AnalyzerException {
preTransform(library);
for (var clazz : library) {
@ -28,27 +29,27 @@ public abstract class Transformer {
postTransform(library);
}
public void preTransform(Library library) {
public void preTransform(Library library) throws AnalyzerException {
/* empty */
}
public void transformClass(ClassNode clazz) {
public void transformClass(ClassNode clazz) throws AnalyzerException {
/* empty */
}
public void transformField(ClassNode clazz, FieldNode field) {
public void transformField(ClassNode clazz, FieldNode field) throws AnalyzerException {
/* empty */
}
public void transformMethod(ClassNode clazz, MethodNode method) {
public void transformMethod(ClassNode clazz, MethodNode method) throws AnalyzerException {
/* empty */
}
public void transformCode(ClassNode clazz, MethodNode method) {
public void transformCode(ClassNode clazz, MethodNode method) throws AnalyzerException {
/* empty */
}
public void postTransform(Library library) {
public void postTransform(Library library) throws AnalyzerException {
/* empty */
}
}

@ -8,9 +8,10 @@ import dev.openrs2.deob.transform.ClassForNameTransformer;
import org.objectweb.asm.commons.ClassRemapper;
import org.objectweb.asm.commons.SimpleRemapper;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.analysis.AnalyzerException;
public final class ClassNamePrefixer {
public static void addPrefix(Library library, String prefix) {
public static void addPrefix(Library library, String prefix) throws AnalyzerException {
var mapping = new HashMap<String, String>();
for (var clazz : library) {
if (TypedRemapper.EXCLUDED_CLASSES.contains(clazz.name)) {

@ -19,6 +19,7 @@ import dev.openrs2.deob.transform.ExceptionTracingTransformer;
import dev.openrs2.deob.transform.FieldOrderTransformer;
import dev.openrs2.deob.transform.OpaquePredicateTransformer;
import dev.openrs2.deob.transform.OriginalNameTransformer;
import org.objectweb.asm.tree.analysis.AnalyzerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -34,7 +35,7 @@ public final class Deobfuscator {
new FieldOrderTransformer()
);
public static void main(String[] args) throws IOException {
public static void main(String[] args) throws IOException, AnalyzerException {
var deobfuscator = new Deobfuscator(Paths.get("nonfree/code"), Paths.get("nonfree/code/deob"));
deobfuscator.run();
}
@ -46,7 +47,7 @@ public final class Deobfuscator {
this.output = output;
}
public void run() throws IOException {
public void run() throws IOException, AnalyzerException {
/* read input jars/packs */
logger.info("Reading input jars");
var unpacker = Library.readJar(input.resolve("game_unpacker.dat"));

Loading…
Cancel
Save