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));
}
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;
}
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;
}
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;
}
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;
}
Aggregations