Search in sources :

Example 1 with Class

use of net.runelite.asm.pool.Class in project runelite by runelite.

the class MaxMemoryTransformer method insert.

private void insert(Instructions ins, int idx) {
    Class randomClass = new net.runelite.asm.pool.Class("java/util/Random");
    ins.getInstructions().remove(idx);
    // pop runtime
    ins.getInstructions().add(idx++, new Pop(ins));
    ins.getInstructions().add(idx++, new New(ins, randomClass));
    ins.getInstructions().add(idx++, new Dup(ins));
    // new Random
    ins.getInstructions().add(idx++, new InvokeSpecial(ins, new net.runelite.asm.pool.Method(randomClass, "<init>", new Signature("()V"))));
    ins.getInstructions().add(idx++, new LDC(ins, 31457280));
    // nextInt(31457280)
    ins.getInstructions().add(idx++, new InvokeVirtual(ins, new net.runelite.asm.pool.Method(randomClass, "nextInt", new Signature("(I)I"))));
    ins.getInstructions().add(idx++, new LDC(ins, 230686720));
    // 230686720 + nextInt(31457280)
    ins.getInstructions().add(idx++, new IAdd(ins));
    ins.getInstructions().add(idx++, new I2L(ins));
}
Also used : New(net.runelite.asm.attributes.code.instructions.New) I2L(net.runelite.asm.attributes.code.instructions.I2L) InvokeSpecial(net.runelite.asm.attributes.code.instructions.InvokeSpecial) LDC(net.runelite.asm.attributes.code.instructions.LDC) Method(net.runelite.asm.Method) Pop(net.runelite.asm.attributes.code.instructions.Pop) InvokeVirtual(net.runelite.asm.attributes.code.instructions.InvokeVirtual) Signature(net.runelite.asm.signature.Signature) Class(net.runelite.asm.pool.Class) IAdd(net.runelite.asm.attributes.code.instructions.IAdd) Dup(net.runelite.asm.attributes.code.instructions.Dup)

Example 2 with Class

use of net.runelite.asm.pool.Class in project runelite by runelite.

the class GetStatic method getMyField.

@Override
public net.runelite.asm.Field getMyField() {
    Class clazz = field.getClazz();
    ClassFile cf = this.getInstructions().getCode().getMethod().getClassFile().getGroup().findClass(clazz.getName());
    if (cf == null) {
        return null;
    }
    net.runelite.asm.Field f2 = cf.findFieldDeep(field.getName(), field.getType());
    return f2;
}
Also used : ClassFile(net.runelite.asm.ClassFile) Class(net.runelite.asm.pool.Class)

Example 3 with Class

use of net.runelite.asm.pool.Class in project runelite by runelite.

the class Inject method validateTypeIsConvertibleTo.

private boolean validateTypeIsConvertibleTo(Type from, Type to) throws InjectionException {
    if (from.getDimensions() != to.getDimensions()) {
        throw new InjectionException("Array dimension mismatch");
    }
    if (from.isPrimitive()) {
        return true;
    }
    ClassFile vanillaClass = vanilla.findClass(from.getInternalName());
    if (vanillaClass == null) {
        return true;
    }
    boolean okay = false;
    for (Class inter : vanillaClass.getInterfaces().getInterfaces()) {
        java.lang.Class c;
        try {
            c = java.lang.Class.forName(inter.getName().replace('/', '.'));
        } catch (ClassNotFoundException ex) {
            continue;
        }
        okay |= check(c, to);
    }
    return okay;
}
Also used : ClassFile(net.runelite.asm.ClassFile) Class(net.runelite.asm.pool.Class)

Example 4 with Class

use of net.runelite.asm.pool.Class in project runelite by runelite.

the class PutField method getMyField.

@Override
public net.runelite.asm.Field getMyField() {
    Class clazz = field.getClazz();
    ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
    ClassFile cf = group.findClass(clazz.getName());
    if (cf == null) {
        return null;
    }
    net.runelite.asm.Field f2 = cf.findFieldDeep(field.getName(), field.getType());
    return f2;
}
Also used : ClassFile(net.runelite.asm.ClassFile) ClassGroup(net.runelite.asm.ClassGroup) Class(net.runelite.asm.pool.Class)

Example 5 with Class

use of net.runelite.asm.pool.Class in project runelite by runelite.

the class PutStatic method getMyField.

@Override
public net.runelite.asm.Field getMyField() {
    Class clazz = field.getClazz();
    ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
    ClassFile cf = group.findClass(clazz.getName());
    if (cf == null) {
        return null;
    }
    net.runelite.asm.Field f2 = cf.findFieldDeep(field.getName(), field.getType());
    return f2;
}
Also used : ClassFile(net.runelite.asm.ClassFile) ClassGroup(net.runelite.asm.ClassGroup) Class(net.runelite.asm.pool.Class)

Aggregations

Class (net.runelite.asm.pool.Class)10 ClassFile (net.runelite.asm.ClassFile)6 ClassGroup (net.runelite.asm.ClassGroup)3 Method (net.runelite.asm.Method)2 Type (net.runelite.asm.Type)2 Annotations (net.runelite.asm.attributes.Annotations)2 Annotation (net.runelite.asm.attributes.annotation.Annotation)2 Dup (net.runelite.asm.attributes.code.instructions.Dup)2 IAdd (net.runelite.asm.attributes.code.instructions.IAdd)2 LDC (net.runelite.asm.attributes.code.instructions.LDC)2 DeobAnnotations (net.runelite.deob.DeobAnnotations)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Field (net.runelite.asm.Field)1 Interfaces (net.runelite.asm.Interfaces)1 Code (net.runelite.asm.attributes.Code)1 Instruction (net.runelite.asm.attributes.code.Instruction)1 Instructions (net.runelite.asm.attributes.code.Instructions)1 AConstNull (net.runelite.asm.attributes.code.instructions.AConstNull)1 Dup_X1 (net.runelite.asm.attributes.code.instructions.Dup_X1)1