use of net.runelite.asm.attributes.code.instructions.InvokeVirtual in project runelite by runelite.
the class ReflectionTransformer method transformGetInt.
// invokevirtual java/lang/reflect/Field/getInt(Ljava/lang/Object;)I
private void transformGetInt(Instructions instructions, Instruction i) {
if (!(i instanceof InvokeVirtual)) {
return;
}
InvokeVirtual iv = (InvokeVirtual) i;
if (iv.getMethod().getClazz().getName().equals("java/lang/reflect/Field") && iv.getMethod().getName().equals("getInt")) {
InvokeStatic is = new InvokeStatic(instructions, new net.runelite.asm.pool.Method(new net.runelite.asm.pool.Class("net/runelite/rs/Reflection"), "getInt", new Signature("(Ljava/lang/reflect/Field;Ljava/lang/Object;)I")));
instructions.replace(iv, is);
logger.info("Transformed Field.getInt call");
}
}
use of net.runelite.asm.attributes.code.instructions.InvokeVirtual in project runelite by runelite.
the class ReflectionTransformer method transformGetDeclaredField.
// invokevirtual java/lang/Class/getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
// to
// invokestatic net/runelite/rs/Reflection/findField
private void transformGetDeclaredField(Instructions instructions, Instruction i) {
if (!(i instanceof InvokeVirtual)) {
return;
}
InvokeVirtual iv = (InvokeVirtual) i;
if (iv.getMethod().getClazz().getName().equals("java/lang/Class") && iv.getMethod().getName().equals("getDeclaredField")) {
InvokeStatic is = new InvokeStatic(instructions, new net.runelite.asm.pool.Method(new net.runelite.asm.pool.Class("net/runelite/rs/Reflection"), "findField", new Signature("(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/reflect/Field;")));
instructions.replace(iv, is);
logger.info("Transformed Class.getDeclaredField call");
}
}
use of net.runelite.asm.attributes.code.instructions.InvokeVirtual in project runelite by runelite.
the class ReflectionTransformer method transformSetInt.
// invokevirtual java/lang/reflect/Field/setInt(Ljava/lang/Object;I)V
private void transformSetInt(Instructions instructions, Instruction i) {
if (!(i instanceof InvokeVirtual)) {
return;
}
InvokeVirtual iv = (InvokeVirtual) i;
if (iv.getMethod().getClazz().getName().equals("java/lang/reflect/Field") && iv.getMethod().getName().equals("setInt")) {
InvokeStatic is = new InvokeStatic(instructions, new net.runelite.asm.pool.Method(new net.runelite.asm.pool.Class("net/runelite/rs/Reflection"), "setInt", new Signature("(Ljava/lang/reflect/Field;Ljava/lang/Object;I)V")));
instructions.replace(iv, is);
logger.info("Transformed Field.setInt call");
}
}
use of net.runelite.asm.attributes.code.instructions.InvokeVirtual in project runelite by runelite.
the class ReflectionTransformer method transformGetParameterTypes.
// invokevirtual java/lang/reflect/Method/getParameterTypes()[Ljava/lang/Class;
// to
// invokestatic net/runelite/rs/Reflection/getParameterTypes(Ljava/lang/reflect/Method;)[Ljava/lang/Class;
private void transformGetParameterTypes(Instructions instructions, Instruction i) {
if (!(i instanceof InvokeVirtual)) {
return;
}
InvokeVirtual iv = (InvokeVirtual) i;
if (iv.getMethod().getClazz().getName().equals("java/lang/reflect/Method") && iv.getMethod().getName().equals("getParameterTypes")) {
InvokeStatic is = new InvokeStatic(instructions, new net.runelite.asm.pool.Method(new net.runelite.asm.pool.Class("net/runelite/rs/Reflection"), "getParameterTypes", new Signature("(Ljava/lang/reflect/Method;)[Ljava/lang/Class;")));
instructions.replace(iv, is);
logger.info("Transformed Method.getParameterTypes call");
}
}
use of net.runelite.asm.attributes.code.instructions.InvokeVirtual in project runelite by runelite.
the class RuneliteBufferTransformer method injectPacketFinish.
private void injectPacketFinish(ClassGroup group) {
PacketFlushFinder pff = new PacketFlushFinder(group);
pff.find();
for (InstructionContext queueForWriteCtx : pff.getQueueForWrite()) {
Instruction before = // socket
queueForWriteCtx.getPops().get(3).getPushed().getInstruction();
GetStatic getBuffer;
try {
getBuffer = (GetStatic) // buffer
queueForWriteCtx.getPops().get(2).getPushed().getPops().get(// getstatic
0).getPushed().getInstruction();
} catch (ClassCastException ex) {
continue;
}
Instructions instructions = before.getInstructions();
int idx = instructions.getInstructions().indexOf(before);
assert idx != -1;
instructions.addInstruction(idx++, getBuffer.clone());
net.runelite.asm.pool.Method method = new net.runelite.asm.pool.Method(new net.runelite.asm.pool.Class(getBuffer.getField().getType().getInternalName()), RUNELITE_FINISH_PACKET, new Signature("()V"));
instructions.addInstruction(idx++, new InvokeVirtual(instructions, method));
}
}
Aggregations