Search in sources :

Example 1 with I2L

use of net.runelite.asm.attributes.code.instructions.I2L 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)

Aggregations

Method (net.runelite.asm.Method)1 Dup (net.runelite.asm.attributes.code.instructions.Dup)1 I2L (net.runelite.asm.attributes.code.instructions.I2L)1 IAdd (net.runelite.asm.attributes.code.instructions.IAdd)1 InvokeSpecial (net.runelite.asm.attributes.code.instructions.InvokeSpecial)1 InvokeVirtual (net.runelite.asm.attributes.code.instructions.InvokeVirtual)1 LDC (net.runelite.asm.attributes.code.instructions.LDC)1 New (net.runelite.asm.attributes.code.instructions.New)1 Pop (net.runelite.asm.attributes.code.instructions.Pop)1 Class (net.runelite.asm.pool.Class)1 Signature (net.runelite.asm.signature.Signature)1