@@ -15,10 +15,10 @@ plugins {
|
|||||||
id("se.patrikerdes.use-latest-versions") version "0.2.13"
|
id("se.patrikerdes.use-latest-versions") version "0.2.13"
|
||||||
}
|
}
|
||||||
|
|
||||||
val oprsver = "3.3.1"
|
val oprsver = "3.3.8"
|
||||||
|
|
||||||
group = "com.openosrs"
|
group = "com.openosrs"
|
||||||
version = "1.1.2"
|
version = "1.1.3"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -26,6 +26,7 @@ repositories {
|
|||||||
maven {
|
maven {
|
||||||
url = uri("https://repo.runelite.net")
|
url = uri("https://repo.runelite.net")
|
||||||
url = uri("https://raw.githubusercontent.com/open-osrs/hosting/master")
|
url = uri("https://raw.githubusercontent.com/open-osrs/hosting/master")
|
||||||
|
url = uri("https://repo.openosrs.com/repository/maven")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,19 +7,19 @@
|
|||||||
*/
|
*/
|
||||||
package com.openosrs.injector;
|
package com.openosrs.injector;
|
||||||
|
|
||||||
public class Injexception extends RuntimeException
|
public class InjectException extends RuntimeException
|
||||||
{
|
{
|
||||||
public Injexception(String message)
|
public InjectException(String message)
|
||||||
{
|
{
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Injexception(Throwable cause)
|
public InjectException(Throwable cause)
|
||||||
{
|
{
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Injexception(String message, Throwable cause)
|
public InjectException(String message, Throwable cause)
|
||||||
{
|
{
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public interface InjectUtil
|
|||||||
* @param name The name of the method you want to find
|
* @param name The name of the method you want to find
|
||||||
* @return The obfuscated version of the found method
|
* @return The obfuscated version of the found method
|
||||||
*/
|
*/
|
||||||
static Method findMethod(InjectData data, String name) throws Injexception
|
static Method findMethod(InjectData data, String name) throws InjectException
|
||||||
{
|
{
|
||||||
return findMethod(data, name, null, null);
|
return findMethod(data, name, null, null);
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ public interface InjectUtil
|
|||||||
String name,
|
String name,
|
||||||
String classHint,
|
String classHint,
|
||||||
@Nullable Predicate<Signature> sig)
|
@Nullable Predicate<Signature> sig)
|
||||||
throws Injexception
|
throws InjectException
|
||||||
{
|
{
|
||||||
return findMethod(data, name, classHint, sig, false, false);
|
return findMethod(data, name, classHint, sig, false, false);
|
||||||
}
|
}
|
||||||
@@ -85,13 +85,13 @@ public interface InjectUtil
|
|||||||
* @param data InjectData instance
|
* @param data InjectData instance
|
||||||
* @param name (Exported) method name
|
* @param name (Exported) method name
|
||||||
* @param classHint The (exported) name of a class you expect (or know) the method to be in, or null, if you're not sure
|
* @param classHint The (exported) name of a class you expect (or know) the method to be in, or null, if you're not sure
|
||||||
* @throws Injexception If the hint class couldn't be found, or no method matching the settings was found
|
* @throws InjectException If the hint class couldn't be found, or no method matching the settings was found
|
||||||
*/
|
*/
|
||||||
static Method findMethod(
|
static Method findMethod(
|
||||||
InjectData data,
|
InjectData data,
|
||||||
String name,
|
String name,
|
||||||
@Nullable String classHint)
|
@Nullable String classHint)
|
||||||
throws Injexception
|
throws InjectException
|
||||||
{
|
{
|
||||||
return findMethod(data, name, classHint, null, false, false);
|
return findMethod(data, name, classHint, null, false, false);
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ public interface InjectUtil
|
|||||||
* @param notStatic If this is true, only check non-static methods. If classHint isn't null, check only subclasses
|
* @param notStatic If this is true, only check non-static methods. If classHint isn't null, check only subclasses
|
||||||
* @param returnDeob If this is true, this method will return the deobfuscated method, instead of turning it into vanilla first
|
* @param returnDeob If this is true, this method will return the deobfuscated method, instead of turning it into vanilla first
|
||||||
*
|
*
|
||||||
* @throws Injexception If the hint class couldn't be found, or no method matching the settings was found
|
* @throws InjectException If the hint class couldn't be found, or no method matching the settings was found
|
||||||
*/
|
*/
|
||||||
static Method findMethod(
|
static Method findMethod(
|
||||||
InjectData data,
|
InjectData data,
|
||||||
@@ -115,7 +115,7 @@ public interface InjectUtil
|
|||||||
@Nullable Predicate<Signature> sig,
|
@Nullable Predicate<Signature> sig,
|
||||||
boolean notStatic,
|
boolean notStatic,
|
||||||
boolean returnDeob)
|
boolean returnDeob)
|
||||||
throws Injexception
|
throws InjectException
|
||||||
{
|
{
|
||||||
final ClassGroup deob = data.getDeobfuscated();
|
final ClassGroup deob = data.getDeobfuscated();
|
||||||
if (classHint != null)
|
if (classHint != null)
|
||||||
@@ -144,14 +144,14 @@ public interface InjectUtil
|
|||||||
if (sig == null || sig.test(m.getDescriptor()))
|
if (sig == null || sig.test(m.getDescriptor()))
|
||||||
return returnDeob ? m : data.toVanilla(m);
|
return returnDeob ? m : data.toVanilla(m);
|
||||||
|
|
||||||
throw new Injexception(String.format("Couldn't find %s", name));
|
throw new InjectException(String.format("Couldn't find %s", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClassFile findClassOrThrow(ClassGroup group, String name) throws Injexception
|
static ClassFile findClassOrThrow(ClassGroup group, String name) throws InjectException
|
||||||
{
|
{
|
||||||
ClassFile clazz = group.findClass(name);
|
ClassFile clazz = group.findClass(name);
|
||||||
if (clazz == null)
|
if (clazz == null)
|
||||||
throw new Injexception("Hint class " + name + " doesn't exist");
|
throw new InjectException("Hint class " + name + " doesn't exist");
|
||||||
|
|
||||||
return clazz;
|
return clazz;
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ public interface InjectUtil
|
|||||||
/**
|
/**
|
||||||
* Fail-fast implementation of ClassFile.findMethodDeep, using a predicate for signature
|
* Fail-fast implementation of ClassFile.findMethodDeep, using a predicate for signature
|
||||||
*/
|
*/
|
||||||
static Method findMethodDeep(ClassFile clazz, String name, Predicate<Signature> type) throws Injexception
|
static Method findMethodDeep(ClassFile clazz, String name, Predicate<Signature> type) throws InjectException
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
for (Method method : clazz.getMethods())
|
for (Method method : clazz.getMethods())
|
||||||
@@ -168,7 +168,7 @@ public interface InjectUtil
|
|||||||
return method;
|
return method;
|
||||||
while ((clazz = clazz.getParent()) != null);
|
while ((clazz = clazz.getParent()) != null);
|
||||||
|
|
||||||
throw new Injexception(String.format("Method %s couldn't be found", name + type.toString()));
|
throw new InjectException(String.format("Method %s couldn't be found", name + type.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -176,7 +176,7 @@ public interface InjectUtil
|
|||||||
*
|
*
|
||||||
* well...
|
* well...
|
||||||
*/
|
*/
|
||||||
static Field findStaticField(ClassGroup group, String name) throws Injexception
|
static Field findStaticField(ClassGroup group, String name) throws InjectException
|
||||||
{
|
{
|
||||||
for (ClassFile clazz : group)
|
for (ClassFile clazz : group)
|
||||||
{
|
{
|
||||||
@@ -185,7 +185,7 @@ public interface InjectUtil
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Injexception("Couldn't find static field " + name);
|
throw new InjectException("Couldn't find static field " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -198,7 +198,7 @@ public interface InjectUtil
|
|||||||
*
|
*
|
||||||
* @return The obfuscated version of the found field
|
* @return The obfuscated version of the found field
|
||||||
*/
|
*/
|
||||||
static Field findStaticField(InjectData data, String name, String classHint, Type type) throws Injexception
|
static Field findStaticField(InjectData data, String name, String classHint, Type type) throws InjectException
|
||||||
{
|
{
|
||||||
final ClassGroup deob = data.getDeobfuscated();
|
final ClassGroup deob = data.getDeobfuscated();
|
||||||
Field field;
|
Field field;
|
||||||
@@ -227,13 +227,13 @@ public interface InjectUtil
|
|||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Injexception(String.format("Static field %s doesn't exist", (type != null ? type + " " : "") + name));
|
throw new InjectException(String.format("Static field %s doesn't exist", (type != null ? type + " " : "") + name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fail-fast implementation of ClassGroup.findFieldDeep
|
* Fail-fast implementation of ClassGroup.findFieldDeep
|
||||||
*/
|
*/
|
||||||
static Field findFieldDeep(ClassFile clazz, String name) throws Injexception
|
static Field findFieldDeep(ClassFile clazz, String name) throws InjectException
|
||||||
{
|
{
|
||||||
Field f;
|
Field f;
|
||||||
|
|
||||||
@@ -242,16 +242,16 @@ public interface InjectUtil
|
|||||||
return f;
|
return f;
|
||||||
while ((clazz = clazz.getParent()) != null);
|
while ((clazz = clazz.getParent()) != null);
|
||||||
|
|
||||||
throw new Injexception("Couldn't find field " + name);
|
throw new InjectException("Couldn't find field " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Field findField(InjectData data, String name, String hintClass) throws Injexception
|
static Field findField(InjectData data, String name, String hintClass) throws InjectException
|
||||||
{
|
{
|
||||||
final ClassGroup deob = data.getDeobfuscated();
|
final ClassGroup deob = data.getDeobfuscated();
|
||||||
return data.toVanilla(findField(deob, name, hintClass));
|
return data.toVanilla(findField(deob, name, hintClass));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Field findField(ClassGroup group, String name, String hintClass) throws Injexception
|
static Field findField(ClassGroup group, String name, String hintClass) throws InjectException
|
||||||
{
|
{
|
||||||
Field field;
|
Field field;
|
||||||
if (hintClass != null)
|
if (hintClass != null)
|
||||||
@@ -267,7 +267,7 @@ public interface InjectUtil
|
|||||||
if ((field = clazz.findField(name)) != null)
|
if ((field = clazz.findField(name)) != null)
|
||||||
return field;
|
return field;
|
||||||
|
|
||||||
throw new Injexception("Field " + name + " doesn't exist");
|
throw new InjectException("Field " + name + " doesn't exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClassFile deobFromApiMethod(InjectData data, RSApiMethod apiMethod)
|
static ClassFile deobFromApiMethod(InjectData data, RSApiMethod apiMethod)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class Injection extends InjectData implements InjectTaskHandler
|
|||||||
{
|
{
|
||||||
private static final Logger log = Logging.getLogger(Injection.class);
|
private static final Logger log = Logging.getLogger(Injection.class);
|
||||||
|
|
||||||
public Injection(File vanilla, File rsclient, File mixins, FileTree rsapi) throws Injexception, IOException
|
public Injection(File vanilla, File rsclient, File mixins, FileTree rsapi) throws InjectException, IOException
|
||||||
{
|
{
|
||||||
super(
|
super(
|
||||||
JarUtil.loadJar(vanilla),
|
JarUtil.loadJar(vanilla),
|
||||||
@@ -46,9 +46,9 @@ public class Injection extends InjectData implements InjectTaskHandler
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
log.debug("Starting injection");
|
log.debug("[DEBUG] Starting injection");
|
||||||
|
|
||||||
inject(new InterfaceInjector(this));
|
inject(new InterfaceInjector(this));
|
||||||
|
|
||||||
@@ -86,16 +86,16 @@ public class Injection extends InjectData implements InjectTaskHandler
|
|||||||
|
|
||||||
public void save(File outputJar) throws IOException
|
public void save(File outputJar) throws IOException
|
||||||
{
|
{
|
||||||
log.info("Saving jar to {}", outputJar.toString());
|
log.info("[INFO] Saving jar to {}", outputJar.toString());
|
||||||
|
|
||||||
JarUtil.saveJar(this.getVanilla(), outputJar);
|
JarUtil.saveJar(this.getVanilla(), outputJar);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void inject(Injector injector) throws Injexception
|
private void inject(Injector injector) throws InjectException
|
||||||
{
|
{
|
||||||
final String name = injector.getName();
|
final String name = injector.getName();
|
||||||
|
|
||||||
log.info("Starting {}", name);
|
log.info("[INFO] Starting {}", name);
|
||||||
|
|
||||||
injector.start();
|
injector.start();
|
||||||
|
|
||||||
@@ -107,13 +107,13 @@ public class Injection extends InjectData implements InjectTaskHandler
|
|||||||
validate((Validator) injector);
|
validate((Validator) injector);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate(Validator validator) throws Injexception
|
private void validate(Validator validator) throws InjectException
|
||||||
{
|
{
|
||||||
final String name = validator.getName();
|
final String name = validator.getName();
|
||||||
|
|
||||||
if (!validator.validate())
|
if (!validator.validate())
|
||||||
{
|
{
|
||||||
throw new Injexception(name + " failed validation");
|
throw new InjectException(name + " failed validation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,14 +121,14 @@ public class Injection extends InjectData implements InjectTaskHandler
|
|||||||
{
|
{
|
||||||
final String name = transformer.getName();
|
final String name = transformer.getName();
|
||||||
|
|
||||||
log.info("Starting {}", name);
|
log.info("[INFO] Starting {}", name);
|
||||||
|
|
||||||
transformer.transform();
|
transformer.transform();
|
||||||
|
|
||||||
log.lifecycle("{} {}", name, transformer.getCompletionMsg());
|
log.lifecycle("{} {}", name, transformer.getCompletionMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runChildInjector(Injector injector) throws Injexception
|
public void runChildInjector(Injector injector) throws InjectException
|
||||||
{
|
{
|
||||||
inject(injector);
|
inject(injector);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class InjectorValidator implements Validator
|
|||||||
}
|
}
|
||||||
|
|
||||||
String status = wtf > 0 ? WTF : missing > 0 ? ERROR : OK;
|
String status = wtf > 0 ? WTF : missing > 0 ? ERROR : OK;
|
||||||
log.info("RSApiValidator completed. Status [{}] {} overridden methods, {} missing", status, okay, missing);
|
log.info("[INFO] RSApiValidator completed. Status [{}] {} overridden methods, {} missing", status, okay, missing);
|
||||||
|
|
||||||
// valid, ref to static final field
|
// valid, ref to static final field
|
||||||
return status == OK;
|
return status == OK;
|
||||||
@@ -65,7 +65,7 @@ public class InjectorValidator implements Validator
|
|||||||
|
|
||||||
if (clazz.findMethodDeep(apiMethod.getName(), apiMethod.getSignature()) == null)
|
if (clazz.findMethodDeep(apiMethod.getName(), apiMethod.getSignature()) == null)
|
||||||
{
|
{
|
||||||
log.warn("Class {} implements interface {} but doesn't implement {}",
|
log.warn("[WARN] Class {} implements interface {} but doesn't implement {}",
|
||||||
clazz.getPoolClass(), apiClass.getClazz(), apiMethod.getMethod());
|
clazz.getPoolClass(), apiClass.getClazz(), apiMethod.getMethod());
|
||||||
++missing;
|
++missing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ package com.openosrs.injector.injection;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injectors.Injector;
|
import com.openosrs.injector.injectors.Injector;
|
||||||
import com.openosrs.injector.rsapi.RSApi;
|
import com.openosrs.injector.rsapi.RSApi;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -64,7 +64,7 @@ public abstract class InjectData
|
|||||||
this.toVanilla = initToVanilla();
|
this.toVanilla = initToVanilla();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void runChildInjector(Injector injector) throws Injexception;
|
public abstract void runChildInjector(Injector injector) throws InjectException;
|
||||||
|
|
||||||
private Map<ClassFile, ClassFile> initToVanilla()
|
private Map<ClassFile, ClassFile> initToVanilla()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.openosrs.injector.injection;
|
package com.openosrs.injector.injection;
|
||||||
|
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ public interface InjectTaskHandler
|
|||||||
/**
|
/**
|
||||||
* The actual method that does all the work
|
* The actual method that does all the work
|
||||||
*/
|
*/
|
||||||
void inject() throws Injexception;
|
void inject() throws InjectException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this to save the injected jar to outputJar
|
* Call this to save the injected jar to outputJar
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
package com.openosrs.injector.injectors;
|
package com.openosrs.injector.injectors;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import com.openosrs.injector.rsapi.RSApiMethod;
|
import com.openosrs.injector.rsapi.RSApiMethod;
|
||||||
import static com.openosrs.injector.rsapi.RSApi.CONSTRUCT;
|
import static com.openosrs.injector.rsapi.RSApi.CONSTRUCT;
|
||||||
@@ -63,7 +63,7 @@ public class InjectConstruct extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
for (RSApiMethod apiMethod : inject.getRsApi().getConstructs())
|
for (RSApiMethod apiMethod : inject.getRsApi().getConstructs())
|
||||||
{
|
{
|
||||||
@@ -81,12 +81,12 @@ public class InjectConstruct extends AbstractInjector
|
|||||||
injected++;
|
injected++;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Injected {} constructors", injected);
|
log.info("[INFO] Injected {} constructors", injected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectConstruct(ClassFile targetClass, Method apiMethod) throws Injexception
|
private void injectConstruct(ClassFile targetClass, Method apiMethod) throws InjectException
|
||||||
{
|
{
|
||||||
log.debug("Injecting constructor for {} into {}", apiMethod, targetClass.getPoolClass());
|
log.debug("[DEBUG] Injecting constructor for {} into {}", apiMethod, targetClass.getPoolClass());
|
||||||
|
|
||||||
final Type returnval = apiMethod.getType().getReturnValue();
|
final Type returnval = apiMethod.getType().getReturnValue();
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public class InjectConstruct extends AbstractInjector
|
|||||||
|
|
||||||
final net.runelite.asm.Method constructor = classToConstruct.findMethod("<init>", constr);
|
final net.runelite.asm.Method constructor = classToConstruct.findMethod("<init>", constr);
|
||||||
if (constructor == null)
|
if (constructor == null)
|
||||||
throw new Injexception("Unable to find constructor for " + classToConstruct.getName() + ".<init>" + constr);
|
throw new InjectException("Unable to find constructor for " + classToConstruct.getName() + ".<init>" + constr);
|
||||||
|
|
||||||
|
|
||||||
net.runelite.asm.Method setterMethod = new net.runelite.asm.Method(targetClass, apiMethod.getName(), apiMethod.getType());
|
net.runelite.asm.Method setterMethod = new net.runelite.asm.Method(targetClass, apiMethod.getName(), apiMethod.getType());
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ package com.openosrs.injector.injectors;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -83,17 +83,17 @@ public class InjectHook extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
||||||
injectMethods(entry.getKey(), entry.getValue());
|
injectMethods(entry.getKey(), entry.getValue());
|
||||||
|
|
||||||
injectHooks();
|
injectHooks();
|
||||||
|
|
||||||
log.info("Injected {} field hooks.", injectedHooks);
|
log.info("[INFO] Injected {} field hooks.", injectedHooks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectMethods(Provider<ClassFile> mixinProvider, List<ClassFile> targetClasses) throws Injexception
|
private void injectMethods(Provider<ClassFile> mixinProvider, List<ClassFile> targetClasses) throws InjectException
|
||||||
{
|
{
|
||||||
final ClassFile mixinClass = mixinProvider.get();
|
final ClassFile mixinClass = mixinProvider.get();
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ public class InjectHook extends AbstractInjector
|
|||||||
// idx + 1 to insert after the set
|
// idx + 1 to insert after the set
|
||||||
injectCallback(ins, idx + 1, hookInfo, null, objectStackContext);
|
injectCallback(ins, idx + 1, hookInfo, null, objectStackContext);
|
||||||
}
|
}
|
||||||
catch (Injexception ex)
|
catch (InjectException ex)
|
||||||
{
|
{
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ public class InjectHook extends AbstractInjector
|
|||||||
objectStackContext = arrayReferencePushed.getPops().get(0);
|
objectStackContext = arrayReferencePushed.getPops().get(0);
|
||||||
|
|
||||||
// inject hook after 'i'
|
// inject hook after 'i'
|
||||||
log.debug("Found array injection location for hook {} at instruction {}", hookInfo.method.getName(), i);
|
log.debug("[DEBUG] Found array injection location for hook {} at instruction {}", hookInfo.method.getName(), i);
|
||||||
++injectedHooks;
|
++injectedHooks;
|
||||||
|
|
||||||
int idx = ins.getInstructions().indexOf(i);
|
int idx = ins.getInstructions().indexOf(i);
|
||||||
@@ -250,7 +250,7 @@ public class InjectHook extends AbstractInjector
|
|||||||
else
|
else
|
||||||
injectCallback(ins, idx + 1, hookInfo, index, objectStackContext);
|
injectCallback(ins, idx + 1, hookInfo, index, objectStackContext);
|
||||||
}
|
}
|
||||||
catch (Injexception ex)
|
catch (InjectException ex)
|
||||||
{
|
{
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,8 @@ public class InjectHook extends AbstractInjector
|
|||||||
e.run();
|
e.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectCallbackBefore(Instructions ins, int idx, HookInfo hookInfo, StackContext index, StackContext object, StackContext value) throws Injexception
|
private void injectCallbackBefore(Instructions ins, int idx, HookInfo hookInfo, StackContext index, StackContext object, StackContext value) throws
|
||||||
|
InjectException
|
||||||
{
|
{
|
||||||
Signature signature = hookInfo.method.getDescriptor();
|
Signature signature = hookInfo.method.getDescriptor();
|
||||||
Type methodArgumentType = signature.getTypeOfArg(0);
|
Type methodArgumentType = signature.getTypeOfArg(0);
|
||||||
@@ -267,7 +268,7 @@ public class InjectHook extends AbstractInjector
|
|||||||
if (!hookInfo.method.isStatic())
|
if (!hookInfo.method.isStatic())
|
||||||
{
|
{
|
||||||
if (object == null)
|
if (object == null)
|
||||||
throw new Injexception("null object");
|
throw new InjectException("null object");
|
||||||
|
|
||||||
ins.getInstructions().add(idx++, new Dup(ins)); // dup value
|
ins.getInstructions().add(idx++, new Dup(ins)); // dup value
|
||||||
idx = recursivelyPush(ins, idx, object);
|
idx = recursivelyPush(ins, idx, object);
|
||||||
@@ -321,12 +322,13 @@ public class InjectHook extends AbstractInjector
|
|||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectCallback(Instructions ins, int idx, HookInfo hookInfo, StackContext index, StackContext objectPusher) throws Injexception
|
private void injectCallback(Instructions ins, int idx, HookInfo hookInfo, StackContext index, StackContext objectPusher) throws
|
||||||
|
InjectException
|
||||||
{
|
{
|
||||||
if (!hookInfo.method.isStatic())
|
if (!hookInfo.method.isStatic())
|
||||||
{
|
{
|
||||||
if (objectPusher == null)
|
if (objectPusher == null)
|
||||||
throw new Injexception("Null object pusher");
|
throw new InjectException("Null object pusher");
|
||||||
|
|
||||||
idx = recursivelyPush(ins, idx, objectPusher);
|
idx = recursivelyPush(ins, idx, objectPusher);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
package com.openosrs.injector.injectors;
|
package com.openosrs.injector.injectors;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
@@ -62,15 +62,15 @@ public class InjectHookMethod extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
||||||
injectMethods(entry.getKey(), entry.getValue());
|
injectMethods(entry.getKey(), entry.getValue());
|
||||||
|
|
||||||
log.info("Injected {} method hooks", injected);
|
log.info("[INFO] Injected {} method hooks", injected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectMethods(Provider<ClassFile> mixinProvider, List<ClassFile> targetClasses) throws Injexception
|
private void injectMethods(Provider<ClassFile> mixinProvider, List<ClassFile> targetClasses) throws InjectException
|
||||||
{
|
{
|
||||||
final ClassFile mixinClass = mixinProvider.get();
|
final ClassFile mixinClass = mixinProvider.get();
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public class InjectHookMethod extends AbstractInjector
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!mixinMethod.getDescriptor().isVoid())
|
if (!mixinMethod.getDescriptor().isVoid())
|
||||||
throw new Injexception("Method hook " + mixinMethod.getPoolMethod() + " doesn't have void return type");
|
throw new InjectException("Method hook " + mixinMethod.getPoolMethod() + " doesn't have void return type");
|
||||||
|
|
||||||
final String hookName = methodHook.getElement().getString();
|
final String hookName = methodHook.getElement().getString();
|
||||||
final boolean end = methodHook.getElements().size() == 2 && methodHook.getElements().get(1).getValue().equals(true);
|
final boolean end = methodHook.getElements().size() == 2 && methodHook.getElements().get(1).getValue().equals(true);
|
||||||
@@ -101,7 +101,7 @@ public class InjectHookMethod extends AbstractInjector
|
|||||||
|
|
||||||
inject(targetMethod, hookMethod, end);
|
inject(targetMethod, hookMethod, end);
|
||||||
|
|
||||||
log.debug("Injected method hook {} in {}", hookMethod, targetMethod);
|
log.debug("[DEBUG] Injected method hook {} in {}", hookMethod, targetMethod);
|
||||||
++injected;
|
++injected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.openosrs.injector.injectors;
|
package com.openosrs.injector.injectors;
|
||||||
|
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import net.runelite.asm.Named;
|
import net.runelite.asm.Named;
|
||||||
|
|
||||||
public interface Injector extends Named
|
public interface Injector extends Named
|
||||||
@@ -15,7 +15,7 @@ public interface Injector extends Named
|
|||||||
/**
|
/**
|
||||||
* Where all the injection should be done
|
* Where all the injection should be done
|
||||||
*/
|
*/
|
||||||
void inject() throws Injexception;
|
void inject() throws InjectException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a name the injector is going to be referred to in logging
|
* Get a name the injector is going to be referred to in logging
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class InterfaceInjector extends AbstractInjector
|
|||||||
// forEachPair performs actions on a deob-vanilla pair, which is what's needed here
|
// forEachPair performs actions on a deob-vanilla pair, which is what's needed here
|
||||||
inject.forEachPair(this::injectInterface);
|
inject.forEachPair(this::injectInterface);
|
||||||
|
|
||||||
log.info("Injected {} interfaces", implemented);
|
log.info("[INFO] Injected {} interfaces", implemented);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectInterface(final ClassFile deobCf, final ClassFile vanillaCf)
|
private void injectInterface(final ClassFile deobCf, final ClassFile vanillaCf)
|
||||||
@@ -41,7 +41,7 @@ public class InterfaceInjector extends AbstractInjector
|
|||||||
final String fullName = API_BASE + impls;
|
final String fullName = API_BASE + impls;
|
||||||
if (!inject.getRsApi().hasClass(fullName))
|
if (!inject.getRsApi().hasClass(fullName))
|
||||||
{
|
{
|
||||||
log.debug("Class {} implements nonexistent interface {}, skipping interface injection",
|
log.debug("[DEBUG] Class {} implements nonexistent interface {}, skipping interface injection",
|
||||||
deobCf.getName(),
|
deobCf.getName(),
|
||||||
fullName
|
fullName
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import com.google.common.annotations.VisibleForTesting;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -96,35 +96,35 @@ public class MixinInjector extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
final Map<Provider<ClassFile>, List<ClassFile>> mixinTargets = initTargets();
|
final Map<Provider<ClassFile>, List<ClassFile>> mixinTargets = initTargets();
|
||||||
inject(mixinTargets);
|
inject(mixinTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void inject(Map<Provider<ClassFile>, List<ClassFile>> mixinTargets) throws Injexception
|
void inject(Map<Provider<ClassFile>, List<ClassFile>> mixinTargets) throws InjectException
|
||||||
{
|
{
|
||||||
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
||||||
{
|
{
|
||||||
injectFields(entry.getKey(), entry.getValue());
|
injectFields(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Injected {} fields", injectedFields.size());
|
log.info("[INFO] Injected {} fields", injectedFields.size());
|
||||||
|
|
||||||
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
||||||
{
|
{
|
||||||
findShadowFields(entry.getKey());
|
findShadowFields(entry.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Shadowed {} fields", shadowFields.size());
|
log.info("[INFO] Shadowed {} fields", shadowFields.size());
|
||||||
|
|
||||||
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
for (Map.Entry<Provider<ClassFile>, List<ClassFile>> entry : mixinTargets.entrySet())
|
||||||
{
|
{
|
||||||
injectMethods(entry.getKey(), entry.getValue());
|
injectMethods(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Injected {}, copied {}, replaced {} methods", injected, copied, replaced);
|
log.info("[INFO] Injected {}, copied {}, replaced {} methods", injected, copied, replaced);
|
||||||
|
|
||||||
inject.runChildInjector(new InjectHook(inject, mixinTargets));
|
inject.runChildInjector(new InjectHook(inject, mixinTargets));
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectFields(Provider<ClassFile> mixinProvider, List<ClassFile> targetClasses) throws Injexception
|
private void injectFields(Provider<ClassFile> mixinProvider, List<ClassFile> targetClasses) throws InjectException
|
||||||
{
|
{
|
||||||
final ClassFile mixinClass = mixinProvider.get();
|
final ClassFile mixinClass = mixinProvider.get();
|
||||||
|
|
||||||
@@ -211,14 +211,14 @@ public class MixinInjector extends AbstractInjector
|
|||||||
targetClass.addField(copy);
|
targetClass.addField(copy);
|
||||||
|
|
||||||
if (injectedFields.containsKey(field.getName()) && !ASSERTION_FIELD.equals(field.getName()))
|
if (injectedFields.containsKey(field.getName()) && !ASSERTION_FIELD.equals(field.getName()))
|
||||||
throw new Injexception("Duplicate field: " + field.getName());
|
throw new InjectException("Duplicate field: " + field.getName());
|
||||||
|
|
||||||
injectedFields.put(field.getName(), copy);
|
injectedFields.put(field.getName(), copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void findShadowFields(Provider<ClassFile> mixinProvider) throws Injexception
|
private void findShadowFields(Provider<ClassFile> mixinProvider) throws InjectException
|
||||||
{
|
{
|
||||||
final ClassFile mixinClass = mixinProvider.get();
|
final ClassFile mixinClass = mixinProvider.get();
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!field.isStatic())
|
if (!field.isStatic())
|
||||||
throw new Injexception("Shadowed fields must be static");
|
throw new InjectException("Shadowed fields must be static");
|
||||||
|
|
||||||
String shadowed = shadow.getElement().getString();
|
String shadowed = shadow.getElement().getString();
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((targetField.getAccessFlags() & Opcodes.ACC_PRIVATE) != 0)
|
if ((targetField.getAccessFlags() & Opcodes.ACC_PRIVATE) != 0)
|
||||||
throw new Injexception("Shadowed fields can't be private");
|
throw new InjectException("Shadowed fields can't be private");
|
||||||
|
|
||||||
shadowFields.put(
|
shadowFields.put(
|
||||||
field.getPoolField(),
|
field.getPoolField(),
|
||||||
@@ -255,7 +255,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectMethods(Provider<ClassFile> mixinProvider, List<ClassFile> targetClasses) throws Injexception
|
private void injectMethods(Provider<ClassFile> mixinProvider, List<ClassFile> targetClasses) throws InjectException
|
||||||
{
|
{
|
||||||
for (ClassFile targetClass : targetClasses)
|
for (ClassFile targetClass : targetClasses)
|
||||||
{
|
{
|
||||||
@@ -278,13 +278,13 @@ public class MixinInjector extends AbstractInjector
|
|||||||
Method deobSourceMethod = InjectUtil.findMethod(inject, copiedName, inject.toDeob(targetClass.getName()).getName(), deobSig::equals, notStat, true);
|
Method deobSourceMethod = InjectUtil.findMethod(inject, copiedName, inject.toDeob(targetClass.getName()).getName(), deobSig::equals, notStat, true);
|
||||||
|
|
||||||
if (mixinMethod.isStatic() != deobSourceMethod.isStatic())
|
if (mixinMethod.isStatic() != deobSourceMethod.isStatic())
|
||||||
throw new Injexception("Mixin method " + mixinMethod + " should be " + (deobSourceMethod.isStatic() ? "static" : "non-static"));
|
throw new InjectException("Mixin method " + mixinMethod + " should be " + (deobSourceMethod.isStatic() ? "static" : "non-static"));
|
||||||
|
|
||||||
// The actual method we're copying, including code etc
|
// The actual method we're copying, including code etc
|
||||||
Method sourceMethod = inject.toVanilla(deobSourceMethod);
|
Method sourceMethod = inject.toVanilla(deobSourceMethod);
|
||||||
|
|
||||||
if (mixinMethod.getDescriptor().size() > sourceMethod.getDescriptor().size())
|
if (mixinMethod.getDescriptor().size() > sourceMethod.getDescriptor().size())
|
||||||
throw new Injexception("Mixin methods cannot have more parameters than their corresponding ob method");
|
throw new InjectException("Mixin methods cannot have more parameters than their corresponding ob method");
|
||||||
|
|
||||||
Method copy = new Method(targetClass, "copy$" + copiedName, sourceMethod.getDescriptor());
|
Method copy = new Method(targetClass, "copy$" + copiedName, sourceMethod.getDescriptor());
|
||||||
moveCode(copy, sourceMethod.getCode());
|
moveCode(copy, sourceMethod.getCode());
|
||||||
@@ -317,7 +317,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
if ((hasInject && isInit) || isClinit)
|
if ((hasInject && isInit) || isClinit)
|
||||||
{
|
{
|
||||||
if (!"()V".equals(mixinMethod.getDescriptor().toString()))
|
if (!"()V".equals(mixinMethod.getDescriptor().toString()))
|
||||||
throw new Injexception("Injected constructors cannot have arguments");
|
throw new InjectException("Injected constructors cannot have arguments");
|
||||||
|
|
||||||
Method[] originalMethods = targetClass.getMethods().stream()
|
Method[] originalMethods = targetClass.getMethods().stream()
|
||||||
.filter(m -> m.getName().equals(mixinMethod.getName()))
|
.filter(m -> m.getName().equals(mixinMethod.getName()))
|
||||||
@@ -392,7 +392,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("Injected mixin method {} to {}", copy, targetClass);
|
log.debug("[DEBUG] Injected mixin method {} to {}", copy, targetClass);
|
||||||
++injected;
|
++injected;
|
||||||
}
|
}
|
||||||
else if (hasInject)
|
else if (hasInject)
|
||||||
@@ -406,7 +406,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
|
|
||||||
if (copiedMethods.containsKey(ii.getMethod()))
|
if (copiedMethods.containsKey(ii.getMethod()))
|
||||||
{
|
{
|
||||||
throw new Injexception("Injected methods cannot invoke copied methods");
|
throw new InjectException("Injected methods cannot invoke copied methods");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -421,7 +421,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
|
|
||||||
targetClass.addMethod(copy);
|
targetClass.addMethod(copy);
|
||||||
|
|
||||||
log.debug("Injected mixin method {} to {}", copy, targetClass);
|
log.debug("[DEBUG] Injected mixin method {} to {}", copy, targetClass);
|
||||||
++injected;
|
++injected;
|
||||||
}
|
}
|
||||||
else if (mixinMethod.getAnnotations().find(REPLACE) != null)
|
else if (mixinMethod.getAnnotations().find(REPLACE) != null)
|
||||||
@@ -434,12 +434,12 @@ public class MixinInjector extends AbstractInjector
|
|||||||
|
|
||||||
if (deobMethod == null)
|
if (deobMethod == null)
|
||||||
{
|
{
|
||||||
throw new Injexception("Failed to find the deob method " + replacedName + " for mixin " + mixinClass);
|
throw new InjectException("Failed to find the deob method " + replacedName + " for mixin " + mixinClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mixinMethod.isStatic() != deobMethod.isStatic())
|
if (mixinMethod.isStatic() != deobMethod.isStatic())
|
||||||
{
|
{
|
||||||
throw new Injexception("Mixin method " + mixinMethod + " should be "
|
throw new InjectException("Mixin method " + mixinMethod + " should be "
|
||||||
+ (deobMethod.isStatic() ? "static" : "non-static"));
|
+ (deobMethod.isStatic() ? "static" : "non-static"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
|
|
||||||
if (mixinMethod.getDescriptor().size() > obMethod.getDescriptor().size())
|
if (mixinMethod.getDescriptor().size() > obMethod.getDescriptor().size())
|
||||||
{
|
{
|
||||||
throw new Injexception("Mixin methods cannot have more parameters than their corresponding ob method");
|
throw new InjectException("Mixin methods cannot have more parameters than their corresponding ob method");
|
||||||
}
|
}
|
||||||
|
|
||||||
Type returnType = mixinMethod.getDescriptor().getReturnValue();
|
Type returnType = mixinMethod.getDescriptor().getReturnValue();
|
||||||
@@ -507,7 +507,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
|
|
||||||
setOwnersToTargetClass(mixinClass, targetClass, obMethod, copiedMethods);
|
setOwnersToTargetClass(mixinClass, targetClass, obMethod, copiedMethods);
|
||||||
|
|
||||||
log.debug("Replaced method {} with mixin method {}", obMethod, mixinMethod);
|
log.debug("[DEBUG] Replaced method {} with mixin method {}", obMethod, mixinMethod);
|
||||||
replaced++;
|
replaced++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -531,7 +531,8 @@ public class MixinInjector extends AbstractInjector
|
|||||||
targetMethod.setCode(newCode);
|
targetMethod.setCode(newCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOwnersToTargetClass(ClassFile mixinCf, ClassFile cf, Method method, Map<net.runelite.asm.pool.Method, CopiedMethod> copiedMethods) throws Injexception
|
private void setOwnersToTargetClass(ClassFile mixinCf, ClassFile cf, Method method, Map<net.runelite.asm.pool.Method, CopiedMethod> copiedMethods) throws
|
||||||
|
InjectException
|
||||||
{
|
{
|
||||||
ListIterator<Instruction> iterator = method.getCode().getInstructions().listIterator();
|
ListIterator<Instruction> iterator = method.getCode().getInstructions().listIterator();
|
||||||
|
|
||||||
@@ -549,7 +550,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
Type newType = new Type("L" + inject.toVanilla(deobTypeClass).getName() + ";");
|
Type newType = new Type("L" + inject.toVanilla(deobTypeClass).getName() + ";");
|
||||||
|
|
||||||
((ANewArray) i).setType(newType);
|
((ANewArray) i).setType(newType);
|
||||||
log.debug("Replaced {} type {} with type {}", i, type, newType);
|
log.debug("[DEBUG] Replaced {} type {} with type {}", i, type, newType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i instanceof InvokeInstruction)
|
else if (i instanceof InvokeInstruction)
|
||||||
@@ -628,7 +629,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verify(ClassFile mixinCf, Instruction i) throws Injexception
|
private void verify(ClassFile mixinCf, Instruction i) throws InjectException
|
||||||
{
|
{
|
||||||
if (i instanceof FieldInstruction)
|
if (i instanceof FieldInstruction)
|
||||||
{
|
{
|
||||||
@@ -637,11 +638,11 @@ public class MixinInjector extends AbstractInjector
|
|||||||
if (fi.getField().getClazz().getName().equals(mixinCf.getName()))
|
if (fi.getField().getClazz().getName().equals(mixinCf.getName()))
|
||||||
{
|
{
|
||||||
if (i instanceof PutField || i instanceof GetField)
|
if (i instanceof PutField || i instanceof GetField)
|
||||||
throw new Injexception("Access to non static member field of mixin");
|
throw new InjectException("Access to non static member field of mixin");
|
||||||
|
|
||||||
Field field = fi.getMyField();
|
Field field = fi.getMyField();
|
||||||
if (field != null && !field.isPublic())
|
if (field != null && !field.isPublic())
|
||||||
throw new Injexception("Static access to non public field " + field);
|
throw new InjectException("Static access to non public field " + field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i instanceof InvokeStatic)
|
else if (i instanceof InvokeStatic)
|
||||||
@@ -650,15 +651,15 @@ public class MixinInjector extends AbstractInjector
|
|||||||
|
|
||||||
if (is.getMethod().getClazz() != mixinCf.getPoolClass()
|
if (is.getMethod().getClazz() != mixinCf.getPoolClass()
|
||||||
&& is.getMethod().getClazz().getName().startsWith(MIXIN_BASE))
|
&& is.getMethod().getClazz().getName().startsWith(MIXIN_BASE))
|
||||||
throw new Injexception("Invoking static methods of other mixins is not supported");
|
throw new InjectException("Invoking static methods of other mixins is not supported");
|
||||||
}
|
}
|
||||||
else if (i instanceof InvokeDynamic)
|
else if (i instanceof InvokeDynamic)
|
||||||
// RS classes don't verify under java 7+ due to the
|
// RS classes don't verify under java 7+ due to the
|
||||||
// super() invokespecial being inside of a try{}
|
// super() invokespecial being inside of a try{}
|
||||||
throw new Injexception("Injected bytecode must be Java 6 compatible");
|
throw new InjectException("Injected bytecode must be Java 6 compatible");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Method findDeobMatching(ClassFile deobClass, Method mixinMethod, String deobName) throws Injexception
|
private Method findDeobMatching(ClassFile deobClass, Method mixinMethod, String deobName) throws InjectException
|
||||||
{
|
{
|
||||||
List<Method> matching = new ArrayList<>();
|
List<Method> matching = new ArrayList<>();
|
||||||
|
|
||||||
@@ -674,7 +675,7 @@ public class MixinInjector extends AbstractInjector
|
|||||||
if (matching.size() > 1)
|
if (matching.size() > 1)
|
||||||
// this happens when it has found several deob methods for some mixin method,
|
// this happens when it has found several deob methods for some mixin method,
|
||||||
// to get rid of the error, refine your search by making your mixin method have more parameters
|
// to get rid of the error, refine your search by making your mixin method have more parameters
|
||||||
throw new Injexception("There are several matching methods when there should only be one");
|
throw new InjectException("There are several matching methods when there should only be one");
|
||||||
else if (matching.size() == 1)
|
else if (matching.size() == 1)
|
||||||
return matching.get(0);
|
return matching.get(0);
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
package com.openosrs.injector.injectors;
|
package com.openosrs.injector.injectors;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import com.openosrs.injector.injectors.rsapi.InjectGetter;
|
import com.openosrs.injector.injectors.rsapi.InjectGetter;
|
||||||
import com.openosrs.injector.injectors.rsapi.InjectInvoke;
|
import com.openosrs.injector.injectors.rsapi.InjectInvoke;
|
||||||
@@ -62,7 +62,7 @@ public class RSApiInjector extends AbstractInjector
|
|||||||
super(inject);
|
super(inject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
for (final ClassFile deobClass : inject.getDeobfuscated())
|
for (final ClassFile deobClass : inject.getDeobfuscated())
|
||||||
{
|
{
|
||||||
@@ -74,10 +74,10 @@ public class RSApiInjector extends AbstractInjector
|
|||||||
|
|
||||||
retryFailures();
|
retryFailures();
|
||||||
|
|
||||||
log.info("Injected {} getters, {} setters, and {} invokers", get, set, voke);
|
log.info("[INFO] Injected {} getters, {} setters, and {} invokers", get, set, voke);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectFields(ClassFile deobClass, RSApiClass implementingClass) throws Injexception
|
private void injectFields(ClassFile deobClass, RSApiClass implementingClass) throws InjectException
|
||||||
{
|
{
|
||||||
for (Field deobField : deobClass.getFields())
|
for (Field deobField : deobClass.getFields())
|
||||||
{
|
{
|
||||||
@@ -153,13 +153,13 @@ public class RSApiInjector extends AbstractInjector
|
|||||||
final Number getter = DeobAnnotations.getObfuscatedGetter(deobField);
|
final Number getter = DeobAnnotations.getObfuscatedGetter(deobField);
|
||||||
|
|
||||||
if (deobField.isStatic() != vanillaField.isStatic()) // Can this even happen
|
if (deobField.isStatic() != vanillaField.isStatic()) // Can this even happen
|
||||||
throw new Injexception("Something went horribly wrong, and this should honestly never happen, but you never know. Btw it's the static-ness");
|
throw new InjectException("Something went horribly wrong, and this should honestly never happen, but you never know. Btw it's the static-ness");
|
||||||
|
|
||||||
inject(matching, deobField, vanillaField, getter);
|
inject(matching, deobField, vanillaField, getter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectMethods(ClassFile deobClass, RSApiClass implementingClass) throws Injexception
|
private void injectMethods(ClassFile deobClass, RSApiClass implementingClass) throws InjectException
|
||||||
{
|
{
|
||||||
for (Method deobMethod : deobClass.getMethods())
|
for (Method deobMethod : deobClass.getMethods())
|
||||||
{
|
{
|
||||||
@@ -205,17 +205,17 @@ public class RSApiInjector extends AbstractInjector
|
|||||||
final ClassFile targetClass = InjectUtil.vanillaFromApiMethod(inject, apiMethod);
|
final ClassFile targetClass = InjectUtil.vanillaFromApiMethod(inject, apiMethod);
|
||||||
final Method vanillaMethod = inject.toVanilla(deobMethod);
|
final Method vanillaMethod = inject.toVanilla(deobMethod);
|
||||||
final String garbage = DeobAnnotations.getDecoder(deobMethod);
|
final String garbage = DeobAnnotations.getDecoder(deobMethod);
|
||||||
log.debug("Injecting invoker {} for {} into {}", apiMethod.getMethod(), vanillaMethod.getPoolMethod(), targetClass.getPoolClass());
|
log.debug("[DEBUG] Injecting invoker {} for {} into {}", apiMethod.getMethod(), vanillaMethod.getPoolMethod(), targetClass.getPoolClass());
|
||||||
InjectInvoke.inject(targetClass, apiMethod, vanillaMethod, garbage);
|
InjectInvoke.inject(targetClass, apiMethod, vanillaMethod, garbage);
|
||||||
++voke;
|
++voke;
|
||||||
apiMethod.setInjected(true);
|
apiMethod.setInjected(true);
|
||||||
}
|
}
|
||||||
else if (matching.size() != 0)
|
else if (matching.size() != 0)
|
||||||
throw new Injexception("Multiple api imports matching method " + deobMethod.getPoolMethod());
|
throw new InjectException("Multiple api imports matching method " + deobMethod.getPoolMethod());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void retryFailures() throws Injexception
|
private void retryFailures() throws InjectException
|
||||||
{
|
{
|
||||||
for (Map.Entry<Field, List<RSApiMethod>> entry : retryFields.entrySet())
|
for (Map.Entry<Field, List<RSApiMethod>> entry : retryFields.entrySet())
|
||||||
{
|
{
|
||||||
@@ -225,7 +225,7 @@ public class RSApiInjector extends AbstractInjector
|
|||||||
matched.removeIf(RSApiMethod::isInjected);
|
matched.removeIf(RSApiMethod::isInjected);
|
||||||
|
|
||||||
if (matched.size() > 2)
|
if (matched.size() > 2)
|
||||||
throw new Injexception("More than 2 imported api methods for field " + deobField.getPoolField());
|
throw new InjectException("More than 2 imported api methods for field " + deobField.getPoolField());
|
||||||
|
|
||||||
final Field vanillaField = inject.toVanilla(deobField);
|
final Field vanillaField = inject.toVanilla(deobField);
|
||||||
final Number getter = DeobAnnotations.getObfuscatedGetter(deobField);
|
final Number getter = DeobAnnotations.getObfuscatedGetter(deobField);
|
||||||
@@ -257,7 +257,7 @@ public class RSApiInjector extends AbstractInjector
|
|||||||
return matching;
|
return matching;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void inject(List<RSApiMethod> matched, Field field, Field targetField, Number getter) throws Injexception
|
private void inject(List<RSApiMethod> matched, Field field, Field targetField, Number getter) throws InjectException
|
||||||
{
|
{
|
||||||
for (RSApiMethod apiMethod : matched)
|
for (RSApiMethod apiMethod : matched)
|
||||||
{
|
{
|
||||||
@@ -267,7 +267,7 @@ public class RSApiInjector extends AbstractInjector
|
|||||||
if (apiMethod.getSignature().isVoid())
|
if (apiMethod.getSignature().isVoid())
|
||||||
{
|
{
|
||||||
++set;
|
++set;
|
||||||
log.debug("Injecting setter {} for {} into {}", apiMethod.getMethod(), field.getPoolField(), targetClass.getPoolClass());
|
log.debug("[DEBUG] Injecting setter {} for {} into {}", apiMethod.getMethod(), field.getPoolField(), targetClass.getPoolClass());
|
||||||
InjectSetter.inject(
|
InjectSetter.inject(
|
||||||
targetClass,
|
targetClass,
|
||||||
apiMethod,
|
apiMethod,
|
||||||
@@ -278,7 +278,7 @@ public class RSApiInjector extends AbstractInjector
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
++get;
|
++get;
|
||||||
log.debug("Injecting getter {} for {} into {}", apiMethod.getMethod(), field.getPoolField(), targetClass.getPoolClass());
|
log.debug("[DEBUG] Injecting getter {} for {} into {}", apiMethod.getMethod(), field.getPoolField(), targetClass.getPoolClass());
|
||||||
InjectGetter.inject(
|
InjectGetter.inject(
|
||||||
targetClass,
|
targetClass,
|
||||||
apiMethod,
|
apiMethod,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
package com.openosrs.injector.injectors.raw;
|
package com.openosrs.injector.injectors.raw;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import com.openosrs.injector.injectors.AbstractInjector;
|
import com.openosrs.injector.injectors.AbstractInjector;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -43,7 +43,7 @@ public class AddPlayerToMenu extends AbstractInjector
|
|||||||
super(inject);
|
super(inject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
final Method addPlayerOptions = InjectUtil.findMethod(inject, "addPlayerToMenu");
|
final Method addPlayerOptions = InjectUtil.findMethod(inject, "addPlayerToMenu");
|
||||||
final net.runelite.asm.pool.Method shouldHideAttackOptionFor =
|
final net.runelite.asm.pool.Method shouldHideAttackOptionFor =
|
||||||
@@ -57,11 +57,9 @@ public class AddPlayerToMenu extends AbstractInjector
|
|||||||
injectHideAttack(addPlayerOptions, shouldHideAttackOptionFor);
|
injectHideAttack(addPlayerOptions, shouldHideAttackOptionFor);
|
||||||
injectHideCast(addPlayerOptions, shouldHideAttackOptionFor);
|
injectHideCast(addPlayerOptions, shouldHideAttackOptionFor);
|
||||||
}
|
}
|
||||||
catch (Injexception | AssertionError e)
|
catch (InjectException | AssertionError e)
|
||||||
{
|
{
|
||||||
log.warn(
|
log.warn("[WARN] HidePlayerAttacks failed, but as this doesn't mess up anything other than that functionality, we're carrying on", e);
|
||||||
"HidePlayerAttacks failed, but as this doesn't mess up anything other than that functionality, we're carrying on",
|
|
||||||
e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +91,7 @@ public class AddPlayerToMenu extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void injectHideAttack(Method addPlayerOptions, net.runelite.asm.pool.Method shouldHideAttackOptionFor)
|
private void injectHideAttack(Method addPlayerOptions, net.runelite.asm.pool.Method shouldHideAttackOptionFor)
|
||||||
throws Injexception
|
throws InjectException
|
||||||
{
|
{
|
||||||
final Field AttackOption_hidden =
|
final Field AttackOption_hidden =
|
||||||
InjectUtil.findField(inject, "AttackOption_hidden", "AttackOption").getPoolField();
|
InjectUtil.findField(inject, "AttackOption_hidden", "AttackOption").getPoolField();
|
||||||
@@ -139,7 +137,7 @@ public class AddPlayerToMenu extends AbstractInjector
|
|||||||
i = iterator.next();
|
i = iterator.next();
|
||||||
if (!(i instanceof ComparisonInstruction && i instanceof JumpingInstruction))
|
if (!(i instanceof ComparisonInstruction && i instanceof JumpingInstruction))
|
||||||
{
|
{
|
||||||
log.info("You're not supposed to see this lol");
|
log.info("[INFO] You're not supposed to see this lol");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +158,7 @@ public class AddPlayerToMenu extends AbstractInjector
|
|||||||
|
|
||||||
if (injectIdx <= 0 || label == null && labelIns == null)
|
if (injectIdx <= 0 || label == null && labelIns == null)
|
||||||
{
|
{
|
||||||
throw new Injexception("HidePlayerAttacks failed");
|
throw new InjectException("HidePlayerAttacks failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the player
|
// Load the player
|
||||||
@@ -185,7 +183,7 @@ public class AddPlayerToMenu extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void injectHideCast(Method addPlayerOptions, net.runelite.asm.pool.Method shouldHideAttackOptionFor)
|
private void injectHideCast(Method addPlayerOptions, net.runelite.asm.pool.Method shouldHideAttackOptionFor)
|
||||||
throws Injexception
|
throws InjectException
|
||||||
{
|
{
|
||||||
// LABEL before
|
// LABEL before
|
||||||
// BIPUSH 8
|
// BIPUSH 8
|
||||||
@@ -227,7 +225,7 @@ public class AddPlayerToMenu extends AbstractInjector
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Injexception("3 bipushes? fucking mental, Hide spells failed btw");
|
throw new InjectException("3 bipushes? fucking mental, Hide spells failed btw");
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -249,7 +247,7 @@ public class AddPlayerToMenu extends AbstractInjector
|
|||||||
{
|
{
|
||||||
if (b1 && b2 && iAnd && getstatic)
|
if (b1 && b2 && iAnd && getstatic)
|
||||||
{
|
{
|
||||||
throw new Injexception("@ me in discord if this shit is broken lol, hide spells failed btw");
|
throw new InjectException("@ me in discord if this shit is broken lol, hide spells failed btw");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -266,7 +264,7 @@ public class AddPlayerToMenu extends AbstractInjector
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Injexception("@ me in discord if this shit is broken lol, hide spells failed btw");
|
throw new InjectException("@ me in discord if this shit is broken lol, hide spells failed btw");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the player
|
// Load the player
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
package com.openosrs.injector.injectors.raw;
|
package com.openosrs.injector.injectors.raw;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import static com.openosrs.injector.injection.InjectData.HOOKS;
|
import static com.openosrs.injector.injection.InjectData.HOOKS;
|
||||||
import com.openosrs.injector.injectors.AbstractInjector;
|
import com.openosrs.injector.injectors.AbstractInjector;
|
||||||
@@ -39,7 +39,7 @@ public class ClearColorBuffer extends AbstractInjector
|
|||||||
super(inject);
|
super(inject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This class stops the client from basically painting everything black before the scene is drawn
|
* This class stops the client from basically painting everything black before the scene is drawn
|
||||||
@@ -85,7 +85,7 @@ public class ClearColorBuffer extends AbstractInjector
|
|||||||
|
|
||||||
Instructions ins = instr.getInstructions();
|
Instructions ins = instr.getInstructions();
|
||||||
ins.replace(instr, new InvokeStatic(ins, CLEARBUFFER));
|
ins.replace(instr, new InvokeStatic(ins, CLEARBUFFER));
|
||||||
log.debug("Injected drawRectangle at {}", methodContext.getMethod().getPoolMethod());
|
log.debug("[DEBUG] Injected drawRectangle at {}", methodContext.getMethod().getPoolMethod());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
package com.openosrs.injector.injectors.raw;
|
package com.openosrs.injector.injectors.raw;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import static com.openosrs.injector.injection.InjectData.HOOKS;
|
import static com.openosrs.injector.injection.InjectData.HOOKS;
|
||||||
import com.openosrs.injector.injectors.AbstractInjector;
|
import com.openosrs.injector.injectors.AbstractInjector;
|
||||||
@@ -57,7 +57,7 @@ public class DrawAfterWidgets extends AbstractInjector
|
|||||||
super(inject);
|
super(inject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This call has to be injected using raw injection because the
|
* This call has to be injected using raw injection because the
|
||||||
@@ -107,7 +107,7 @@ public class DrawAfterWidgets extends AbstractInjector
|
|||||||
|
|
||||||
if (noClip == null)
|
if (noClip == null)
|
||||||
{
|
{
|
||||||
throw new Injexception("Mapped method \"Rasterizer2D_resetClip\" could not be found.");
|
throw new InjectException("Mapped method \"Rasterizer2D_resetClip\" could not be found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
net.runelite.asm.pool.Method poolNoClip = noClip.getPoolMethod();
|
net.runelite.asm.pool.Method poolNoClip = noClip.getPoolMethod();
|
||||||
@@ -162,7 +162,7 @@ public class DrawAfterWidgets extends AbstractInjector
|
|||||||
{
|
{
|
||||||
// If we get here, we're either in the wrong method
|
// If we get here, we're either in the wrong method
|
||||||
// or Jagex has removed the "if (535573958 * kl != -1)"
|
// or Jagex has removed the "if (535573958 * kl != -1)"
|
||||||
// log.debug("Could not find the label for jumping to the " + noClip + " call in " + m);
|
// log.debug("[DEBUG] Could not find the label for jumping to the " + noClip + " call in " + m);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ public class DrawAfterWidgets extends AbstractInjector
|
|||||||
|
|
||||||
instructions.addInstruction(instructions.getInstructions().indexOf(l) + 1, invoke);
|
instructions.addInstruction(instructions.getInstructions().indexOf(l) + 1, invoke);
|
||||||
|
|
||||||
log.debug("injectDrawAfterWidgets injected a call after " + l);
|
log.debug("[DEBUG] injectDrawAfterWidgets injected a call after " + l);
|
||||||
|
|
||||||
injected = true;
|
injected = true;
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ public class DrawAfterWidgets extends AbstractInjector
|
|||||||
|
|
||||||
if (!injected)
|
if (!injected)
|
||||||
{
|
{
|
||||||
throw new Injexception("injectDrawAfterWidgets failed to inject!");
|
throw new InjectException("injectDrawAfterWidgets failed to inject!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
package com.openosrs.injector.injectors.raw;
|
package com.openosrs.injector.injectors.raw;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import static com.openosrs.injector.injection.InjectData.HOOKS;
|
import static com.openosrs.injector.injection.InjectData.HOOKS;
|
||||||
import com.openosrs.injector.injectors.AbstractInjector;
|
import com.openosrs.injector.injectors.AbstractInjector;
|
||||||
@@ -42,7 +42,7 @@ public class DrawMenu extends AbstractInjector
|
|||||||
super(inject);
|
super(inject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The drawMenu method can be inlined, so we need this raw injector to find where to inject.
|
* The drawMenu method can be inlined, so we need this raw injector to find where to inject.
|
||||||
@@ -118,7 +118,7 @@ public class DrawMenu extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (injectInvokeAfter == null || labelToJumpTo == null)
|
if (injectInvokeAfter == null || labelToJumpTo == null)
|
||||||
throw new Injexception("Couldn't find the right location for DrawMenu to inject");
|
throw new InjectException("Couldn't find the right location for DrawMenu to inject");
|
||||||
|
|
||||||
final Instructions instrs = mc.getMethod().getCode().getInstructions();
|
final Instructions instrs = mc.getMethod().getCode().getInstructions();
|
||||||
int idx = instrs.getInstructions().indexOf(injectInvokeAfter);
|
int idx = instrs.getInstructions().indexOf(injectInvokeAfter);
|
||||||
@@ -126,6 +126,6 @@ public class DrawMenu extends AbstractInjector
|
|||||||
instrs.addInstruction(++idx, new InvokeStatic(instrs, DRAWMENU));
|
instrs.addInstruction(++idx, new InvokeStatic(instrs, DRAWMENU));
|
||||||
instrs.addInstruction(++idx, new IfNe(instrs, labelToJumpTo));
|
instrs.addInstruction(++idx, new IfNe(instrs, labelToJumpTo));
|
||||||
|
|
||||||
log.info("DrawMenu injected a method call at index {} in method {}. With a comparison jumping to {}", idx, drawLoggedIn, labelToJumpTo);
|
log.info("[INFO] DrawMenu injected a method call at index {} in method {}. With a comparison jumping to {}", idx, drawLoggedIn, labelToJumpTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.openosrs.injector.injectors.raw;
|
package com.openosrs.injector.injectors.raw;
|
||||||
|
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import com.openosrs.injector.injectors.AbstractInjector;
|
import com.openosrs.injector.injectors.AbstractInjector;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
@@ -27,7 +27,7 @@ public class Occluder extends AbstractInjector
|
|||||||
super(inject);
|
super(inject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This class the max view distance length, higher than this is useless though
|
* This class the max view distance length, higher than this is useless though
|
||||||
@@ -64,6 +64,6 @@ public class Occluder extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (replaced != 10)
|
if (replaced != 10)
|
||||||
throw new Injexception("Only found " + replaced + " 25's to replace in occlude instead of expected 10");
|
throw new InjectException("Only found " + replaced + " 25's to replace in occlude instead of expected 10");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ package com.openosrs.injector.injectors.raw;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import com.openosrs.injector.injectors.AbstractInjector;
|
import com.openosrs.injector.injectors.AbstractInjector;
|
||||||
import net.runelite.asm.ClassFile;
|
import net.runelite.asm.ClassFile;
|
||||||
@@ -59,7 +59,7 @@ public class RasterizerAlpha extends AbstractInjector
|
|||||||
/*
|
/*
|
||||||
* This class exists to allow transparency in overlays
|
* This class exists to allow transparency in overlays
|
||||||
*/
|
*/
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
final Field r2dPx = InjectUtil.findField(inject, "Rasterizer2D_pixels", "Rasterizer2D");
|
final Field r2dPx = InjectUtil.findField(inject, "Rasterizer2D_pixels", "Rasterizer2D");
|
||||||
final Method draw = InjectUtil.findMethod(inject, "drawLoggedIn", "Client");
|
final Method draw = InjectUtil.findMethod(inject, "drawLoggedIn", "Client");
|
||||||
@@ -187,17 +187,17 @@ public class RasterizerAlpha extends AbstractInjector
|
|||||||
if (orCount != 0)
|
if (orCount != 0)
|
||||||
{
|
{
|
||||||
counts[0] += orCount;
|
counts[0] += orCount;
|
||||||
log.info("Added {} OR's into {}", orCount, mc.getMethod());
|
log.info("[INFO] Added {} OR's into {}", orCount, mc.getMethod());
|
||||||
}
|
}
|
||||||
if (count != 0)
|
if (count != 0)
|
||||||
{
|
{
|
||||||
counts[1] += count;
|
counts[1] += count;
|
||||||
log.info("Injected {} DrawAlpha invokes into {}", count, mc.getMethod());
|
log.info("[INFO] Injected {} DrawAlpha invokes into {}", count, mc.getMethod());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ex.run();
|
ex.run();
|
||||||
log.info("Injected {} DrawAlpha invokes and {} ors", counts[1], counts[0]);
|
log.info("[INFO] Injected {} DrawAlpha invokes and {} ors", counts[1], counts[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean pushesToSameVar(InstructionContext cA, InstructionContext cB)
|
private static boolean pushesToSameVar(InstructionContext cA, InstructionContext cB)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
package com.openosrs.injector.injectors.raw;
|
package com.openosrs.injector.injectors.raw;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import static com.openosrs.injector.injection.InjectData.HOOKS;
|
import static com.openosrs.injector.injection.InjectData.HOOKS;
|
||||||
import com.openosrs.injector.injectors.AbstractInjector;
|
import com.openosrs.injector.injectors.AbstractInjector;
|
||||||
@@ -36,7 +36,7 @@ public class RenderDraw extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
int replaced = 0;
|
int replaced = 0;
|
||||||
|
|
||||||
@@ -57,13 +57,13 @@ public class RenderDraw extends AbstractInjector
|
|||||||
if (((InvokeVirtual) i).getMethod().equals(draw))
|
if (((InvokeVirtual) i).getMethod().equals(draw))
|
||||||
{
|
{
|
||||||
iterator.set(new InvokeStatic(ins, RENDERDRAW));
|
iterator.set(new InvokeStatic(ins, RENDERDRAW));
|
||||||
log.debug("Replaced method call at {}", i);
|
log.debug("[DEBUG] Replaced method call at {}", i);
|
||||||
++replaced;
|
++replaced;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replaced != EXPECTED)
|
if (replaced != EXPECTED)
|
||||||
throw new Injexception("Didn't replace the expected amount of method calls");
|
throw new InjectException("Didn't replace the expected amount of method calls");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
package com.openosrs.injector.injectors.raw;
|
package com.openosrs.injector.injectors.raw;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import com.openosrs.injector.injectors.AbstractInjector;
|
import com.openosrs.injector.injectors.AbstractInjector;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -71,7 +71,7 @@ public class ScriptVM extends AbstractInjector
|
|||||||
super(inject);
|
super(inject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject() throws Injexception
|
public void inject() throws InjectException
|
||||||
{
|
{
|
||||||
final ClassGroup vanilla = inject.getVanilla();
|
final ClassGroup vanilla = inject.getVanilla();
|
||||||
|
|
||||||
@@ -109,12 +109,12 @@ public class ScriptVM extends AbstractInjector
|
|||||||
final Field scriptInstructions = InjectUtil.findField(inject, "opcodes", "Script");
|
final Field scriptInstructions = InjectUtil.findField(inject, "opcodes", "Script");
|
||||||
final Field scriptStatePC = InjectUtil.findField(inject, "pc", "ScriptFrame");
|
final Field scriptStatePC = InjectUtil.findField(inject, "pc", "ScriptFrame");
|
||||||
|
|
||||||
// Next 4 should be injected by mixins, so don't need fail fast
|
// Next 5 should be injected by mixins, so don't need fail fast
|
||||||
final ClassFile vanillaClient = vanilla.findClass("client");
|
final ClassFile vanillaClient = vanilla.findClass("client");
|
||||||
|
|
||||||
final Method runScript = vanillaClient.findStaticMethod("copy$runScript");
|
final Method runScript = vanillaClient.findStaticMethod("copy$runScript");
|
||||||
final Method vmExecuteOpcode = vanillaClient.findStaticMethod("vmExecuteOpcode");
|
final Method vmExecuteOpcode = vanillaClient.findStaticMethod("vmExecuteOpcode");
|
||||||
final Field currentScriptField = vanillaClient.findField("currentScript");
|
final Method setCurrentScript = vanillaClient.findStaticMethod("setCurrentScript");
|
||||||
final Field currentScriptPCField = vanillaClient.findField("currentScriptPC");
|
final Field currentScriptPCField = vanillaClient.findField("currentScriptPC");
|
||||||
|
|
||||||
Execution e = new Execution(inject.getVanilla());
|
Execution e = new Execution(inject.getVanilla());
|
||||||
@@ -188,7 +188,7 @@ public class ScriptVM extends AbstractInjector
|
|||||||
// This has to run after the first loop because it relies on instructionArrayLocalVar being set
|
// This has to run after the first loop because it relies on instructionArrayLocalVar being set
|
||||||
if (instructionArrayLocalVar == null)
|
if (instructionArrayLocalVar == null)
|
||||||
{
|
{
|
||||||
throw new Injexception("Unable to find local instruction array");
|
throw new InjectException("Unable to find local instruction array");
|
||||||
}
|
}
|
||||||
for (InstructionContext instrCtx : methodContext.getInstructionContexts())
|
for (InstructionContext instrCtx : methodContext.getInstructionContexts())
|
||||||
{
|
{
|
||||||
@@ -227,8 +227,8 @@ public class ScriptVM extends AbstractInjector
|
|||||||
int outerSciptIdx = scriptStores.stream()
|
int outerSciptIdx = scriptStores.stream()
|
||||||
.mapToInt(AStore::getVariableIndex)
|
.mapToInt(AStore::getVariableIndex)
|
||||||
.reduce(Math::min)
|
.reduce(Math::min)
|
||||||
.orElseThrow(() -> new Injexception("Unable to find any Script AStores in runScript"));
|
.orElseThrow(() -> new InjectException("Unable to find any Script AStores in runScript"));
|
||||||
log.debug("Found script index {}", outerSciptIdx);
|
log.debug("[DEBUG] Found script index {}", outerSciptIdx);
|
||||||
|
|
||||||
ListIterator<Instruction> instrIter = instrs.getInstructions().listIterator();
|
ListIterator<Instruction> instrIter = instrs.getInstructions().listIterator();
|
||||||
while (instrIter.hasNext())
|
while (instrIter.hasNext())
|
||||||
@@ -242,7 +242,7 @@ public class ScriptVM extends AbstractInjector
|
|||||||
{
|
{
|
||||||
instrIter.previous();
|
instrIter.previous();
|
||||||
instrIter.add(new Dup(instrs));
|
instrIter.add(new Dup(instrs));
|
||||||
instrIter.add(new PutStatic(instrs, currentScriptField));
|
instrIter.add(new InvokeStatic(instrs, setCurrentScript.getPoolMethod()));
|
||||||
instrIter.next();
|
instrIter.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -253,9 +253,9 @@ public class ScriptVM extends AbstractInjector
|
|||||||
{
|
{
|
||||||
if (pcLocalVar == null)
|
if (pcLocalVar == null)
|
||||||
{
|
{
|
||||||
throw new Injexception("Unable to find ILoad for invokedFromPc IStore");
|
throw new InjectException("Unable to find ILoad for invokedFromPc IStore");
|
||||||
}
|
}
|
||||||
log.debug("Found pc index {}", pcLocalVar);
|
log.debug("[DEBUG] Found pc index {}", pcLocalVar);
|
||||||
|
|
||||||
ListIterator<Instruction> instrIter = instrs.getInstructions().listIterator();
|
ListIterator<Instruction> instrIter = instrs.getInstructions().listIterator();
|
||||||
while (instrIter.hasNext())
|
while (instrIter.hasNext())
|
||||||
@@ -287,10 +287,10 @@ public class ScriptVM extends AbstractInjector
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inject call to vmExecuteOpcode
|
// Inject call to vmExecuteOpcode
|
||||||
log.debug("Found instruction array index {}", instructionArrayLocalVar);
|
log.debug("[DEBUG] Found instruction array index {}", instructionArrayLocalVar);
|
||||||
if (currentOpcodeStore == null)
|
if (currentOpcodeStore == null)
|
||||||
{
|
{
|
||||||
throw new Injexception("Unable to find IStore for current opcode");
|
throw new InjectException("Unable to find IStore for current opcode");
|
||||||
}
|
}
|
||||||
|
|
||||||
int istorepc = instrs.getInstructions().indexOf(currentOpcodeStore);
|
int istorepc = instrs.getInstructions().indexOf(currentOpcodeStore);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
package com.openosrs.injector.injectors.rsapi;
|
package com.openosrs.injector.injectors.rsapi;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.rsapi.RSApiMethod;
|
import com.openosrs.injector.rsapi.RSApiMethod;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.asm.ClassFile;
|
import net.runelite.asm.ClassFile;
|
||||||
@@ -47,10 +47,11 @@ import net.runelite.asm.signature.Signature;
|
|||||||
|
|
||||||
public class InjectGetter
|
public class InjectGetter
|
||||||
{
|
{
|
||||||
public static void inject(ClassFile targetClass, RSApiMethod apiMethod, Field field, Number getter) throws Injexception
|
public static void inject(ClassFile targetClass, RSApiMethod apiMethod, Field field, Number getter) throws
|
||||||
|
InjectException
|
||||||
{
|
{
|
||||||
if (targetClass.findMethod(apiMethod.getName(), apiMethod.getSignature()) != null)
|
if (targetClass.findMethod(apiMethod.getName(), apiMethod.getSignature()) != null)
|
||||||
throw new Injexception("Duplicate getter method " + apiMethod.getMethod().toString());
|
throw new InjectException("Duplicate getter method " + apiMethod.getMethod().toString());
|
||||||
|
|
||||||
final String name = apiMethod.getName();
|
final String name = apiMethod.getName();
|
||||||
final Signature sig = apiMethod.getSignature();
|
final Signature sig = apiMethod.getSignature();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
package com.openosrs.injector.injectors.rsapi;
|
package com.openosrs.injector.injectors.rsapi;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.rsapi.RSApiMethod;
|
import com.openosrs.injector.rsapi.RSApiMethod;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.asm.ClassFile;
|
import net.runelite.asm.ClassFile;
|
||||||
@@ -51,11 +51,12 @@ import net.runelite.asm.signature.Signature;
|
|||||||
|
|
||||||
public class InjectInvoke
|
public class InjectInvoke
|
||||||
{
|
{
|
||||||
public static void inject(ClassFile targetClass, RSApiMethod apiMethod, Method vanillaMethod, String garbage) throws Injexception
|
public static void inject(ClassFile targetClass, RSApiMethod apiMethod, Method vanillaMethod, String garbage) throws
|
||||||
|
InjectException
|
||||||
{
|
{
|
||||||
if (targetClass.findMethod(apiMethod.getName(), apiMethod.getSignature()) != null)
|
if (targetClass.findMethod(apiMethod.getName(), apiMethod.getSignature()) != null)
|
||||||
{
|
{
|
||||||
throw new Injexception("Duplicate invoker method " + apiMethod.getMethod().toString());
|
throw new InjectException("Duplicate invoker method " + apiMethod.getMethod().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
final Method method = new Method(targetClass, apiMethod.getName(), apiMethod.getSignature());
|
final Method method = new Method(targetClass, apiMethod.getName(), apiMethod.getSignature());
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
package com.openosrs.injector.injectors.rsapi;
|
package com.openosrs.injector.injectors.rsapi;
|
||||||
|
|
||||||
import com.openosrs.injector.InjectUtil;
|
import com.openosrs.injector.InjectUtil;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.rsapi.RSApiMethod;
|
import com.openosrs.injector.rsapi.RSApiMethod;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.asm.ClassFile;
|
import net.runelite.asm.ClassFile;
|
||||||
@@ -50,10 +50,11 @@ import net.runelite.asm.signature.Signature;
|
|||||||
|
|
||||||
public class InjectSetter
|
public class InjectSetter
|
||||||
{
|
{
|
||||||
public static void inject(ClassFile targetClass, RSApiMethod apiMethod, Field field, Number getter) throws Injexception
|
public static void inject(ClassFile targetClass, RSApiMethod apiMethod, Field field, Number getter) throws
|
||||||
|
InjectException
|
||||||
{
|
{
|
||||||
if (targetClass.findMethod(apiMethod.getName(), apiMethod.getSignature()) != null)
|
if (targetClass.findMethod(apiMethod.getName(), apiMethod.getSignature()) != null)
|
||||||
throw new Injexception("Duplicate setter method " + apiMethod.getMethod().toString());
|
throw new InjectException("Duplicate setter method " + apiMethod.getMethod().toString());
|
||||||
|
|
||||||
final String name = apiMethod.getName();
|
final String name = apiMethod.getName();
|
||||||
final Signature sig = apiMethod.getSignature();
|
final Signature sig = apiMethod.getSignature();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ package com.openosrs.injector.rsapi;
|
|||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -40,7 +40,7 @@ public class RSApi implements Iterable<RSApiClass>
|
|||||||
|
|
||||||
private ImmutableMap<String, RSApiClass> map;
|
private ImmutableMap<String, RSApiClass> map;
|
||||||
|
|
||||||
public RSApi(FileTree classes) throws Injexception
|
public RSApi(FileTree classes) throws InjectException
|
||||||
{
|
{
|
||||||
for (File file : classes)
|
for (File file : classes)
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ public class RSApi implements Iterable<RSApiClass>
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
throw new Injexception(e);
|
throw new InjectException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ public class SourceChanger extends InjectTransformer
|
|||||||
void transformImpl()
|
void transformImpl()
|
||||||
{
|
{
|
||||||
inject.forEachPair(this::rename);
|
inject.forEachPair(this::rename);
|
||||||
log.info("Changed source file debug information for {} classes", n);
|
log.info("[INFO] Changed source file debug information for {} classes", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rename(ClassFile rsclient, ClassFile vanilla)
|
private void rename(ClassFile rsclient, ClassFile vanilla)
|
||||||
{
|
{
|
||||||
++n;
|
++n;
|
||||||
final String newSrc = rsclient.getSource();
|
final String newSrc = rsclient.getSource();
|
||||||
log.debug("Changing src from {} to {}", vanilla.getSource(), newSrc);
|
log.debug("[DEBUG] Changing src from {} to {}", vanilla.getSource(), newSrc);
|
||||||
vanilla.setSource(newSrc);
|
vanilla.setSource(newSrc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class TestInjection extends InjectData
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runChildInjector(Injector injector) throws Injexception
|
public void runChildInjector(Injector injector) throws InjectException
|
||||||
{
|
{
|
||||||
injector.inject();
|
injector.inject();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.openosrs.injector.transformers;
|
package com.openosrs.injector.transformers;
|
||||||
|
|
||||||
import com.openosrs.injector.Injexception;
|
import com.openosrs.injector.InjectException;
|
||||||
import com.openosrs.injector.injection.InjectData;
|
import com.openosrs.injector.injection.InjectData;
|
||||||
import com.openosrs.injector.injectors.Injector;
|
import com.openosrs.injector.injectors.Injector;
|
||||||
import com.openosrs.injector.transformers.srcchangeclasses.NewName;
|
import com.openosrs.injector.transformers.srcchangeclasses.NewName;
|
||||||
@@ -37,7 +37,8 @@ public class SourceChangerTest
|
|||||||
|
|
||||||
new SourceChanger(
|
new SourceChanger(
|
||||||
new InjectData(new ClassGroup(), new ClassGroup(), null, null) {
|
new InjectData(new ClassGroup(), new ClassGroup(), null, null) {
|
||||||
public void runChildInjector(Injector injector) throws Injexception {}
|
public void runChildInjector(Injector injector) throws InjectException
|
||||||
|
{}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forEachPair(BiConsumer<ClassFile, ClassFile> consumer)
|
public void forEachPair(BiConsumer<ClassFile, ClassFile> consumer)
|
||||||
|
|||||||
Reference in New Issue
Block a user