everything else

This commit is contained in:
Lucwousin
2019-07-18 15:31:24 +02:00
parent 25ce6c2ee9
commit 1050644394
17 changed files with 459 additions and 79 deletions

View File

@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import net.runelite.asm.pool.Class;
import net.runelite.deob.DeobAnnotations;
public class Interfaces
{
@@ -89,4 +90,21 @@ public class Interfaces
}
return false;
}
public List<String> getIntfNames()
{
final List<String> names = new ArrayList<>();
for (ClassFile c : getMyInterfaces())
{
String name = DeobAnnotations.getObfuscatedName(c.getAnnotations());
if (name == null)
{
continue;
}
names.add(name);
}
return names;
}
}

View File

@@ -81,11 +81,9 @@ public class Deob
ClassGroup group = JarUtil.loadJar(new File(args[0]));
if (args.length > 2 && args[2].equals("rl"))
{
run(group, new StaticShouldBeInstance());
}
else
run(group, new StaticShouldBeInstance());
if (args.length <= 2 || !args[2].equals("rl"))
{
// remove except RuntimeException
run(group, new RuntimeExceptions());

View File

@@ -83,11 +83,6 @@ public class DeobAnnotations
return getAnnotationValue(cf.getAnnotations(), IMPLEMENTS);
}
public static String getHookName(Annotations an)
{
return getAnnotationValue(an, HOOK);
}
public static Number getObfuscatedGetter(Field field)
{
if (field == null || field.getAnnotations() == null)
@@ -104,7 +99,7 @@ public class DeobAnnotations
return (Number) an.getElement().getValue();
}
public static String getObfuscatedValue(Method method)
public static String getDecoder(Method method)
{
if (method == null || method.getAnnotations() == null)
{
@@ -126,7 +121,7 @@ public class DeobAnnotations
return (String) elements.get(1).getValue();
}
private static String getAnnotationValue(Annotations an, Type type)
public static String getAnnotationValue(Annotations an, Type type)
{
if (an == null)
{

View File

@@ -246,7 +246,8 @@ public class AnnotationIntegrityChecker
Import im = method.getAnnotation(Import.class);
if (im != null && im.value().equals(name))
{
return true;
logger.debug(name);
return false;
}
}

View File

@@ -159,6 +159,14 @@ public class Mapper
continue;
}
//if (cf.getInterfaces().getMyInterfaces().size() != 0)
//{
// for (Method m : cf.getMethods())
// {
// if (m.)
// }
//}
List<Method> methods1 = cf.getMethods().stream()
.filter(m -> !m.isStatic())
.filter(m -> !m.getName().equals("<init>"))

View File

@@ -72,6 +72,7 @@ public enum ScriptOpcode
CC_SETSCROLLSIZE(1120),
CC_RESUME_PAUSEBUTTON(1121),
CC_SETFILLCOLOUR(1123),
CC_SETFILLMODE(1125),
CC_SETLINEDIRECTION(1126),
CC_SETMODELTRANSPARENT(1127),
CC_SETOBJECT(1200),
@@ -134,9 +135,11 @@ public enum ScriptOpcode
CC_GETMODELANGLE_X(1606),
CC_GETMODELANGLE_Z(1607),
CC_GETMODELANGLE_Y(1608),
CC_GETTRANS(1609),
CC_GETTRANSTOP(1609),
CC_GETTRANSBOT(1610),
CC_GETCOLOUR(1611),
CC_GETFILLCOLOUR(1612),
CC_GETFILLMODE(1613),
CC_GETMODELTRANSPARENT(1614),
CC_GETINVOBJECT(1700),
CC_GETINVCOUNT(1701),
@@ -172,6 +175,8 @@ public enum ScriptOpcode
IF_SETSCROLLSIZE(2120),
IF_RESUME_PAUSEBUTTON(2121),
IF_SETFILLCOLOUR(2123),
IF_SETTRANSBOT(2124),
IF_SETFILLMODE(2125),
IF_SETLINEDIRECTION(2126),
IF_SETOBJECT(2200),
IF_SETNPCHEAD(2201),
@@ -233,9 +238,11 @@ public enum ScriptOpcode
IF_GETMODELANGLE_X(2606),
IF_GETMODELANGLE_Z(2607),
IF_GETMODELANGLE_Y(2608),
IF_GETTRANS(2609),
IF_GETTRANSTOP(2609),
IF_GETTRANSBOT(2610),
IF_GETCOLOUR(2611),
IF_GETFILLCOLOUR(2612),
IF_GETFILLMODE(2613),
IF_GETMODELTRANSPARENT(2614),
IF_GETINVOBJECT(2700),
IF_GETINVCOUNT(2701),

View File

@@ -51,24 +51,14 @@ public class ParameterRenamer
{
for (Method sourceM : sourceCF.getMethods())
{
Method destM;
if (sourceM.getName().equals("<init>"))
{
ClassFile destCF = (ClassFile) mapping.get(sourceCF);
destM = destCF.findMethod("<init>", sourceM.getDescriptor());
}
else
{
destM = (Method) mapping.get(sourceM);
}
if (sourceM.getParameters() != null && !sourceM.getParameters().isEmpty() && destM.getParameters().size() >= 1)
Method destM = (Method) mapping.get(sourceM);
if (destM != null && destM.getParameters().size() > 0 && sourceM.getParameters() != null && !sourceM.getParameters().isEmpty() && sourceM.getParameters().size() >= 1)
{
List<Parameter> oldParams = destM.getParameters();
for (int i = 0; i < sourceM.getParameters().size(); i++)
{
String name = sourceM.getParameters().get(i).getName();
if (name.matches("arg[0-9]") || name.length() <= 2 && (name.charAt(0) != 'x' || name.charAt(0) != 'y'))
if (name.matches("var[0-9]") || name.length() <= 2 && (name.charAt(0) != 'x' || name.charAt(0) != 'y' || name.charAt(0) != 'z'))
{
continue;
}