use of net.runelite.asm.pool.Method in project runelite by runelite.
the class PacketWriteDeobfuscator method translate.
private Instruction translate(Instruction i) {
if (!(i instanceof InvokeVirtual)) {
return i;
}
InvokeVirtual ii = (InvokeVirtual) i;
Method invoked = ii.getMethod();
assert invoked.getType().size() == 1;
Type argumentType = invoked.getType().getTypeOfArg(0);
Method invokeMethod;
if (argumentType.equals(Type.BYTE)) {
invokeMethod = new Method(ii.getMethod().getClazz(), "runeliteWriteByte", new Signature("(B)V"));
} else if (argumentType.equals(Type.SHORT)) {
invokeMethod = new Method(ii.getMethod().getClazz(), "runeliteWriteShort", new Signature("(S)V"));
} else if (argumentType.equals(Type.INT)) {
invokeMethod = new Method(ii.getMethod().getClazz(), "runeliteWriteInt", new Signature("(I)V"));
} else if (argumentType.equals(Type.LONG)) {
invokeMethod = new Method(ii.getMethod().getClazz(), "runeliteWriteLong", new Signature("(J)V"));
} else if (argumentType.equals(Type.STRING)) {
invokeMethod = new Method(ii.getMethod().getClazz(), "runeliteWriteString", new Signature("(Ljava/lang/String;)V"));
} else {
throw new IllegalStateException("Unknown type " + argumentType);
}
return new InvokeVirtual(i.getInstructions(), invokeMethod);
}
use of net.runelite.asm.pool.Method in project runelite by runelite.
the class InvokeVirtual method removeParameter.
@Override
public void removeParameter(int idx) {
net.runelite.asm.pool.Class clazz = method.getClazz();
// create new signature
Signature sig = new Signature(method.getType());
sig.remove(idx);
// create new method pool object
method = new Method(clazz, method.getName(), sig);
}
use of net.runelite.asm.pool.Method in project runelite by runelite.
the class InvokeSpecial method removeParameter.
@Override
public void removeParameter(int idx) {
net.runelite.asm.pool.Class clazz = method.getClazz();
// create new signature
Signature sig = new Signature(method.getType());
sig.remove(idx);
// create new method pool object
method = new Method(clazz, method.getName(), sig);
}
use of net.runelite.asm.pool.Method in project runelite by runelite.
the class PacketWriteDeobfuscator method isEnd.
private boolean isEnd(InstructionContext ctx) {
// conditions where packet write ends:
// any invoke that isn't to the packet buffer
// any variable assignment
// any field assignment
// any conditional jump
// any return
Instruction i = ctx.getInstruction();
if (i instanceof InvokeInstruction) {
InvokeInstruction ii = (InvokeInstruction) i;
Method method = ii.getMethod();
if (!method.getClazz().equals(rw.getSecretBuffer().getPoolClass()) && !method.getClazz().equals(rw.getBuffer().getPoolClass())) {
return true;
}
}
if (i instanceof LVTInstruction) {
LVTInstruction lvt = (LVTInstruction) i;
if (lvt.store()) {
return true;
}
}
if (i instanceof SetFieldInstruction) {
return true;
}
if (i instanceof If || i instanceof If0) {
return true;
}
if (i instanceof ReturnInstruction) {
return true;
}
return false;
}
use of net.runelite.asm.pool.Method in project runelite by runelite.
the class InvokeInterface method removeParameter.
@Override
public void removeParameter(int idx) {
net.runelite.asm.pool.Class clazz = method.getClazz();
// create new signature
Signature sig = new Signature(method.getType());
sig.remove(idx);
// create new method pool object
method = new Method(clazz, method.getName(), sig);
}
Aggregations