Even more... you guessed it! REFACTORING. Removes the need for @Export for methods overriding base java methods
This commit is contained in:
@@ -33,6 +33,7 @@ import net.runelite.asm.ClassGroup;
|
||||
import net.runelite.asm.Method;
|
||||
import net.runelite.asm.Type;
|
||||
import net.runelite.asm.attributes.Annotations;
|
||||
import net.runelite.asm.attributes.Code;
|
||||
import net.runelite.asm.attributes.annotation.Annotation;
|
||||
import net.runelite.asm.attributes.code.Instruction;
|
||||
import net.runelite.asm.attributes.code.InstructionType;
|
||||
@@ -89,9 +90,9 @@ public class InjectHookMethod
|
||||
obfuscatedClassName = DeobAnnotations.getObfuscatedName(cf.getAnnotations());
|
||||
|
||||
// might be a constructor
|
||||
if (obfuscatedMethodName == null && method.getName().equals("<init>"))
|
||||
if (obfuscatedMethodName == null)
|
||||
{
|
||||
obfuscatedMethodName = "<init>";
|
||||
obfuscatedMethodName = method.getName();
|
||||
}
|
||||
|
||||
assert obfuscatedClassName != null : "hook on method in class with no obfuscated name";
|
||||
@@ -110,7 +111,12 @@ public class InjectHookMethod
|
||||
|
||||
private void injectHookMethod(Method hookMethod, String hookName, boolean end, Method deobMethod, Method vanillaMethod, boolean useHooks) throws InjectionException
|
||||
{
|
||||
Instructions instructions = vanillaMethod.getCode().getInstructions();
|
||||
Code code = vanillaMethod.getCode();
|
||||
if (code == null)
|
||||
{
|
||||
logger.warn(vanillaMethod + " code is null");
|
||||
}
|
||||
Instructions instructions = code.getInstructions();
|
||||
|
||||
Signature.Builder builder = new Signature.Builder()
|
||||
.setReturnType(Type.VOID); // Hooks always return void
|
||||
|
||||
@@ -181,4 +181,17 @@ public class InjectUtil
|
||||
|
||||
throw new InjectionException(String.format("Mapped field \"%s\" could not be found.", name));
|
||||
}
|
||||
|
||||
public static Method findStaticDeob(Inject inject, String name) throws InjectionException
|
||||
{
|
||||
for (ClassFile cf : inject.getDeobfuscated().getClasses())
|
||||
{
|
||||
if (cf.findMethod(name) != null)
|
||||
{
|
||||
return cf.findMethod(name);
|
||||
}
|
||||
}
|
||||
|
||||
throw new InjectionException("Fycj you");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class RenderDraw
|
||||
private static final Logger log = LoggerFactory.getLogger(RenderDraw.class);
|
||||
private static final net.runelite.asm.pool.Method renderDraw = new net.runelite.asm.pool.Method(
|
||||
new Class("net.runelite.client.callback.Hooks"),
|
||||
"draw",
|
||||
"renderDraw",
|
||||
new Signature("(Lnet/runelite/api/Renderable;IIIIIIIIJ)V")
|
||||
);
|
||||
private final Inject inject;
|
||||
|
||||
Reference in New Issue
Block a user