Search in sources :

Example 76 with StackContext

use of net.runelite.asm.execution.StackContext in project runelite by runelite.

the class DupDeobfuscator method undup_x1.

private void undup_x1(InstructionContext ictx) {
    assert ictx.getInstruction() instanceof Dup_X1;
    Instructions instructions = ictx.getInstruction().getInstructions();
    StackContext duplicated = ictx.getPops().get(0);
    // replace dup_x1 with swap
    int idx = instructions.replace(ictx.getInstruction(), new Swap(instructions));
    // copy imul and insert after idx
    copy(duplicated, instructions, idx + 1);
}
Also used : Swap(net.runelite.asm.attributes.code.instructions.Swap) StackContext(net.runelite.asm.execution.StackContext) Dup_X1(net.runelite.asm.attributes.code.instructions.Dup_X1) Instructions(net.runelite.asm.attributes.code.Instructions)

Example 77 with StackContext

use of net.runelite.asm.execution.StackContext in project runelite by runelite.

the class DupDeobfuscator method undup.

private void undup(InstructionContext ictx) {
    assert ictx.getInstruction() instanceof Dup;
    Instructions instructions = ictx.getInstruction().getInstructions();
    StackContext duplicated = ictx.getPops().get(0);
    int idx = instructions.getInstructions().indexOf(ictx.getInstruction());
    assert idx != -1;
    // replace dup with duplicated instructions
    instructions.remove(ictx.getInstruction());
    // insert copy
    copy(duplicated, instructions, idx);
}
Also used : StackContext(net.runelite.asm.execution.StackContext) Instructions(net.runelite.asm.attributes.code.Instructions) Dup(net.runelite.asm.attributes.code.instructions.Dup)

Example 78 with StackContext

use of net.runelite.asm.execution.StackContext in project runelite by runelite.

the class Pop2 method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext value = stack.pop();
    ins.pop(value);
    if (value.getType().getSize() == 2)
        return ins;
    value = stack.pop();
    ins.pop(value);
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Stack(net.runelite.asm.execution.Stack)

Example 79 with StackContext

use of net.runelite.asm.execution.StackContext in project runelite by runelite.

the class PutField method execute.

@Override
public InstructionContext execute(Frame frame) {
    InstructionContext ins = new InstructionContext(this, frame);
    Stack stack = frame.getStack();
    StackContext value = stack.pop();
    StackContext object = stack.pop();
    ins.pop(value, object);
    if (myField != null) {
        frame.getExecution().order(frame, myField);
    }
    return ins;
}
Also used : InstructionContext(net.runelite.asm.execution.InstructionContext) StackContext(net.runelite.asm.execution.StackContext) Stack(net.runelite.asm.execution.Stack)

Example 80 with StackContext

use of net.runelite.asm.execution.StackContext in project runelite by runelite.

the class PutField method canMap.

@Override
public boolean canMap(InstructionContext thisIc) {
    StackContext value = thisIc.getPops().get(0);
    Instruction i = value.getPushed().getInstruction();
    // which are all constants, so we ignore those mappings here
    if (thisIc.getFrame().getMethod().getName().equals("<init>")) {
        if (i instanceof PushConstantInstruction || i instanceof AConstNull) {
            return false;
        }
    }
    return true;
}
Also used : PushConstantInstruction(net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction) StackContext(net.runelite.asm.execution.StackContext) PushConstantInstruction(net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction) SetFieldInstruction(net.runelite.asm.attributes.code.instruction.types.SetFieldInstruction) GetFieldInstruction(net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction) Instruction(net.runelite.asm.attributes.code.Instruction)

Aggregations

StackContext (net.runelite.asm.execution.StackContext)162 InstructionContext (net.runelite.asm.execution.InstructionContext)153 Stack (net.runelite.asm.execution.Stack)119 Value (net.runelite.asm.execution.Value)47 Field (net.runelite.asm.Field)15 Variables (net.runelite.asm.execution.Variables)14 VariableContext (net.runelite.asm.execution.VariableContext)13 Instruction (net.runelite.asm.attributes.code.Instruction)12 GetFieldInstruction (net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction)12 Instructions (net.runelite.asm.attributes.code.Instructions)8 PushConstantInstruction (net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction)8 LVTInstruction (net.runelite.asm.attributes.code.instruction.types.LVTInstruction)7 Execution (net.runelite.asm.execution.Execution)7 Frame (net.runelite.asm.execution.Frame)7 DupInstruction (net.runelite.asm.attributes.code.instruction.types.DupInstruction)6 InvokeInstruction (net.runelite.asm.attributes.code.instruction.types.InvokeInstruction)6 Method (net.runelite.asm.pool.Method)5 ClassFile (net.runelite.asm.ClassFile)4 Method (net.runelite.asm.Method)4 Type (net.runelite.asm.Type)4