mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 00:37:55 +00:00
Adapter updates
This commit is contained in:
@@ -11,6 +11,7 @@ import java.io.IOException;
|
||||
* @author Everel
|
||||
*/
|
||||
public class Core {
|
||||
public static boolean mDebug;
|
||||
private static boolean debug;
|
||||
private static boolean verbose;
|
||||
private static boolean dump;
|
||||
@@ -114,6 +115,8 @@ public class Core {
|
||||
}
|
||||
|
||||
public static void debug(int i) {
|
||||
System.out.println("DEBUG: " + i);
|
||||
if(mDebug) {
|
||||
System.out.println("DEBUG: " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,19 @@ public class AddCallbackAdapter implements Injectable, Opcodes {
|
||||
InsnList inject = new InsnList();
|
||||
Label l0 = new Label();
|
||||
inject.add(new LabelNode(l0));
|
||||
int offset = 0;
|
||||
for (int arg : args) {
|
||||
inject.add(new VarInsnNode(ASMUtils.getLoadOpcode(types[arg]
|
||||
.getDescriptor()), Modifier.isStatic(method.access) ? arg : arg + 1));
|
||||
if(Modifier.isStatic(method.access)) {
|
||||
int loadOpcode = ASMUtils.getLoadOpcode(types[arg]
|
||||
.getDescriptor());
|
||||
inject.add(new VarInsnNode(loadOpcode, arg + offset));
|
||||
if(loadOpcode == Opcodes.LLOAD) {
|
||||
offset++;
|
||||
}
|
||||
} else {
|
||||
inject.add(new VarInsnNode(ASMUtils.getLoadOpcode(types[arg]
|
||||
.getDescriptor()), arg + 1));
|
||||
}
|
||||
}
|
||||
inject.add(new MethodInsnNode(INVOKESTATIC,
|
||||
this.invokeClass, this.invokeMethod,
|
||||
|
||||
@@ -129,6 +129,18 @@ public class AddGetterAdapter implements Opcodes, Injectable {
|
||||
if (!staticField) {
|
||||
method.visitVarInsn(ALOAD, 0);
|
||||
}
|
||||
if(staticField) {
|
||||
if (!Modifier.isPublic(fieldNode.access)) {
|
||||
if (Modifier.isPrivate(fieldNode.access)) {
|
||||
fieldNode.access = fieldNode.access & (~ACC_PRIVATE);
|
||||
}
|
||||
if (Modifier.isProtected(fieldNode.access)) {
|
||||
fieldNode.access = fieldNode.access & (~ACC_PROTECTED);
|
||||
}
|
||||
fieldNode.access = fieldNode.access | ACC_PUBLIC;
|
||||
//mn.access = mn.access | ACC_SYNCHRONIZED;
|
||||
}
|
||||
}
|
||||
method.visitFieldInsn(staticField ? GETSTATIC : GETFIELD,
|
||||
fieldLocation.name, fieldNode.name, fieldNode.desc);
|
||||
if (!fieldNode.desc.equals(returnDesc)) {
|
||||
|
||||
@@ -67,6 +67,7 @@ public class AddInvokerAdapter implements Opcodes, Injectable {
|
||||
mn.access = mn.access & (~ACC_PROTECTED);
|
||||
}
|
||||
mn.access = mn.access | ACC_PUBLIC;
|
||||
//mn.access = mn.access | ACC_SYNCHRONIZED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.parabot.core.ui.components.VerboseLoader;
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class ClassPath {
|
||||
public final ArrayList<String> classNames;
|
||||
public final HashMap<String, ClassNode> classes;
|
||||
public final Map<String, URL> resources;
|
||||
public URL lastParsed;
|
||||
@@ -51,6 +52,7 @@ public class ClassPath {
|
||||
}
|
||||
|
||||
public ClassPath(final boolean isJar) {
|
||||
this.classNames = new ArrayList<String>();
|
||||
this.classes = new HashMap<String, ClassNode>();
|
||||
this.resources = new HashMap<String, URL>();
|
||||
this.classRemapper = new ClassRemapper();
|
||||
@@ -198,6 +200,7 @@ public class ClassPath {
|
||||
/*RemappingClassAdapter rca = new RemappingClassAdapter(cn,classRemapper);
|
||||
ClassNode remapped = new ClassNode();
|
||||
cn.accept(rca);*/
|
||||
classNames.add(cn.name.replace('/', '.'));
|
||||
classes.put(cn.name, cn);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user