Search in sources :

Example 61 with ClassGroup

use of net.runelite.asm.ClassGroup in project runelite by runelite.

the class Injector method main.

public static void main(String[] args) throws IOException, InjectionException {
    if (args.length < 3) {
        System.exit(-1);
    }
    ClassGroup deobfuscated = JarUtil.loadJar(new File(args[0]));
    ClassGroup vanilla = JarUtil.loadJar(new File(args[1]));
    Injector u = new Injector(deobfuscated, vanilla);
    u.inject();
    InjectorValidator iv = new InjectorValidator(vanilla);
    iv.validate();
    u.save(new File(args[2]));
}
Also used : ClassGroup(net.runelite.asm.ClassGroup) File(java.io.File)

Example 62 with ClassGroup

use of net.runelite.asm.ClassGroup in project runelite by runelite.

the class DrawAfterWidgetsTest method testInjectDrawWidgetsRev160.

@Test
public void testInjectDrawWidgetsRev160() throws Exception {
    // Rev 160 does not have the drawWidgets call inlined
    ClassFile deobClient = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Client_deob160.class"));
    ClassFile deobRasterizer = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Rasterizer2D_deob160.class"));
    ClassGroup deob = new ClassGroup();
    deob.addClass(deobClient);
    deob.addClass(deobRasterizer);
    ClassFile obClient = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Client_ob160.class"));
    ClassFile obRasterizer = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Rasterizer2D_ob160.class"));
    ClassGroup vanilla = new ClassGroup();
    vanilla.addClass(obClient);
    vanilla.addClass(obRasterizer);
    Inject inject = new Inject(deob, vanilla);
    new DrawAfterWidgets(inject).inject();
}
Also used : Inject(net.runelite.injector.Inject) ClassFile(net.runelite.asm.ClassFile) ClassGroup(net.runelite.asm.ClassGroup) Test(org.junit.Test)

Example 63 with ClassGroup

use of net.runelite.asm.ClassGroup in project runelite by runelite.

the class DrawAfterWidgetsTest method testInjectDrawWidgetsRev153.

@Test
public void testInjectDrawWidgetsRev153() throws Exception {
    // Rev 153 has the drawWidgets call inlined
    ClassFile deobClient = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Client_deob153.class"));
    ClassFile deobRasterizer = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Rasterizer2D_deob153.class"));
    ClassGroup deob = new ClassGroup();
    deob.addClass(deobClient);
    deob.addClass(deobRasterizer);
    ClassFile obClient = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Client_ob153.class"));
    ClassFile obRasterizer = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Rasterizer2D_ob153.class"));
    ClassGroup vanilla = new ClassGroup();
    vanilla.addClass(obClient);
    vanilla.addClass(obRasterizer);
    Inject inject = new Inject(deob, vanilla);
    new DrawAfterWidgets(inject).inject();
}
Also used : Inject(net.runelite.injector.Inject) ClassFile(net.runelite.asm.ClassFile) ClassGroup(net.runelite.asm.ClassGroup) Test(org.junit.Test)

Example 64 with ClassGroup

use of net.runelite.asm.ClassGroup in project runelite by runelite.

the class InstanceOf method lookup.

@Override
public void lookup() {
    ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
    myClass = group.findClass(type.getInternalName());
}
Also used : ClassGroup(net.runelite.asm.ClassGroup)

Example 65 with ClassGroup

use of net.runelite.asm.ClassGroup in project runelite by runelite.

the class InvokeInterface method lookupMethods.

private List<net.runelite.asm.Method> lookupMethods() {
    ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
    ClassFile otherClass = group.findClass(method.getClazz().getName());
    if (otherClass == null) {
        // not our class
        return null;
    }
    net.runelite.asm.Method m = otherClass.findMethod(method.getName(), method.getType());
    if (m == null) {
        return null;
    }
    return VirtualMethods.getVirtualMethods(m);
}
Also used : ClassFile(net.runelite.asm.ClassFile) ClassGroup(net.runelite.asm.ClassGroup)

Aggregations

ClassGroup (net.runelite.asm.ClassGroup)66 Test (org.junit.Test)41 Code (net.runelite.asm.attributes.Code)29 ClassFile (net.runelite.asm.ClassFile)28 Instruction (net.runelite.asm.attributes.code.Instruction)28 Instructions (net.runelite.asm.attributes.code.Instructions)28 LDC (net.runelite.asm.attributes.code.instructions.LDC)28 VReturn (net.runelite.asm.attributes.code.instructions.VReturn)26 IStore (net.runelite.asm.attributes.code.instructions.IStore)23 Deobfuscator (net.runelite.deob.Deobfuscator)22 ILoad (net.runelite.asm.attributes.code.instructions.ILoad)21 Execution (net.runelite.asm.execution.Execution)21 IMul (net.runelite.asm.attributes.code.instructions.IMul)18 Method (net.runelite.asm.Method)12 IAdd (net.runelite.asm.attributes.code.instructions.IAdd)11 Pop (net.runelite.asm.attributes.code.instructions.Pop)11 File (java.io.File)9 Label (net.runelite.asm.attributes.code.Label)9 Type (net.runelite.asm.Type)8 Signature (net.runelite.asm.signature.Signature)8