Various mixin/injector additions

This commit is contained in:
Lucas
2019-06-08 11:58:34 +02:00
parent ffcb7b8b45
commit 2c38de7061
37 changed files with 852 additions and 158 deletions

View File

@@ -527,7 +527,7 @@ public class Inject
return Type.getType("L" + finalType.getName().replace('.', '/') + ";", type.getDimensions());
}
Type apiTypeToDeobfuscatedType(Type type) throws InjectionException
Type apiTypeToDeobfuscatedType(Type type)
{
if (type.isPrimitive())
{

View File

@@ -48,6 +48,7 @@ import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
import net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction;
import net.runelite.asm.attributes.code.instruction.types.ReturnInstruction;
import net.runelite.asm.attributes.code.instructions.ALoad;
import net.runelite.asm.attributes.code.instructions.ANewArray;
import net.runelite.asm.attributes.code.instructions.CheckCast;
import net.runelite.asm.attributes.code.instructions.GetField;
import net.runelite.asm.attributes.code.instructions.ILoad;
@@ -229,10 +230,10 @@ public class MixinInjector
cf.addField(copy);
if (injectedFields.containsKey(field.getName()))
if (injectedFields.containsKey(field.getName()) && !field.getName().equals(ASSERTION_FIELD))
{
java.util.logging.Logger.getAnonymousLogger().severe("Duplicate field : "+ field.getName());
//throw new InjectionException("Injected field names must be globally unique");
throw new InjectionException("Injected field names must be globally unique");
}
injectedFields.put(field.getName(), copy);
@@ -654,6 +655,21 @@ public class MixinInjector
{
Instruction i = iterator.next();
if (i instanceof ANewArray)
{
Type type = ((ANewArray) i).getType_();
ClassFile deobCf = inject.getDeobfuscated().findClass(type.toString().replace("Lnet/runelite/rs/api/RS", "").replace(";", ""));
if (deobCf != null)
{
ClassFile obReturnTypeClass = inject.toObClass(deobCf);
Type newType = new Type("L" + obReturnTypeClass.getName() + ";");
((ANewArray) i).setType(newType);
logger.info("Replaced {} type {} with type {}", i, type, newType);
}
}
if (i instanceof InvokeInstruction)
{
InvokeInstruction ii = (InvokeInstruction) i;

View File

@@ -22,7 +22,7 @@ public class RenderDraw
private static final net.runelite.asm.pool.Method renderDraw = new net.runelite.asm.pool.Method(
new Class("net.runelite.client.callback.Hooks"),
"renderDraw",
new Signature("(Lapi/Renderable;IIIIIIIIJ)V")
new Signature("(Lnet/runelite/api/Renderable;IIIIIIIIJ)V")
);
private final Inject inject;