Add interface injector

This commit is contained in:
Adam
2015-11-22 19:57:11 -06:00
parent e2b0c90e7a
commit 0d7b1ff89a
2 changed files with 15 additions and 2 deletions

View File

@@ -5,11 +5,13 @@ import java.io.IOException;
import net.runelite.deob.ClassFile;
import net.runelite.deob.ClassGroup;
import net.runelite.deob.Field;
import net.runelite.deob.Interfaces;
import net.runelite.deob.attributes.Annotations;
import net.runelite.deob.attributes.AttributeType;
import net.runelite.deob.attributes.annotation.Annotation;
import net.runelite.deob.attributes.annotation.Element;
import net.runelite.deob.pool.UTF8;
import net.runelite.deob.runeloader.inject.AddInterfaceInstruction;
import net.runelite.deob.runeloader.inject.GetterInjectInstruction;
import net.runelite.deob.runeloader.inject.InjectionModscript;
import net.runelite.deob.signature.Type;
@@ -27,6 +29,7 @@ public class MappingImporter
private static final Type OBFUSCATED_NAME = new Type("Lnet/runelite/mapping/ObfuscatedName;");
private static final Type EXPORT = new Type("Lnet/runelite/mapping/Export;");
private static final Type IMPLEMENTS = new Type("Lnet/runelite/mapping/Implements;");
private ClassGroup group;
@@ -116,5 +119,15 @@ public class MappingImporter
f.getAttributes().addAnnotation(EXPORT, "value", new UTF8(attrName));
}
for (AddInterfaceInstruction aii : mod.getAddInterfaceInjects())
{
ClassFile cf = this.findClassWithObfuscatedName(aii.getClientClass());
Assert.assertNotNull(cf);
String iface = aii.getInterfaceClass();
cf.getAttributes().addAnnotation(IMPLEMENTS, "value", new UTF8(iface));
}
}
}

View File

@@ -11,7 +11,7 @@ import org.objectweb.asm.tree.AbstractInsnNode;
public class InjectionModscript {
private List<GetterInjectInstruction> getterInjects = new LinkedList<>();
private List superChangeInjects = new LinkedList();
private List addInterfaceInjects = new LinkedList();
private List<AddInterfaceInstruction> addInterfaceInjects = new LinkedList();
private List methodMods = new LinkedList();
private List addMethods = new LinkedList();
private List newMethodMods = new LinkedList();
@@ -40,7 +40,7 @@ public class InjectionModscript {
return this.superChangeInjects;
}
public List getAddInterfaceInjects() {
public List<AddInterfaceInstruction> getAddInterfaceInjects() {
return this.addInterfaceInjects;
}