This can map some but not nearly enough. Main problem seems to be the order of the packet handlers is scrambled, as well as their ids.
Maybe try detecting/treating the packet handlers as separate "functions" and compare them by seeing if PME can run over both? Maybe try hardening PME mapper to fail more easily (eg setfield of field of two different types, or invoke with wrong signatures?), and then try and brute force methods in general. Can also map methods with unique signatures that are non static method<->method. client clinit?
This commit is contained in:
@@ -15,6 +15,7 @@ import net.runelite.deob.ClassGroup;
|
||||
import net.runelite.deob.Deob;
|
||||
import net.runelite.deob.Field;
|
||||
import net.runelite.deob.Method;
|
||||
import net.runelite.deob.execution.ParallellMappingExecutor;
|
||||
import net.runelite.deob.util.JarUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -120,6 +121,12 @@ public class MapStaticTest
|
||||
HashMap<Object, Object> all = new HashMap();
|
||||
List<ParallelExecutorMapping> pmes = new ArrayList<>();
|
||||
map(all, pmes, m1, m2);
|
||||
|
||||
ParallelExecutorMapping finalm = new ParallelExecutorMapping();
|
||||
for (ParallelExecutorMapping pme : pmes)
|
||||
finalm.merge(pme);
|
||||
|
||||
summary(finalm);
|
||||
}
|
||||
|
||||
//@Test
|
||||
@@ -141,6 +148,31 @@ public class MapStaticTest
|
||||
}
|
||||
}
|
||||
|
||||
private void summary(ParallelExecutorMapping finalm)
|
||||
{
|
||||
int fields = 0, staticMethod = 0, method = 0, total = 0;
|
||||
for (Entry<Object, Object> e : finalm.getMap().entrySet())
|
||||
{
|
||||
System.out.println(e.getKey() + " <-> " + e.getValue());
|
||||
|
||||
Object o = e.getKey();
|
||||
if (o instanceof Field)
|
||||
++fields;
|
||||
else if (o instanceof Method)
|
||||
{
|
||||
Method m = (Method) o;
|
||||
|
||||
if (m.isStatic())
|
||||
++staticMethod;
|
||||
else
|
||||
++method;
|
||||
}
|
||||
|
||||
++total;
|
||||
}
|
||||
System.out.println("Total " + total + ". " + fields + " fields, " + staticMethod + " static methods, " + method + " methods");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllMap() throws Exception
|
||||
{
|
||||
@@ -168,33 +200,20 @@ public class MapStaticTest
|
||||
for (ParallelExecutorMapping pme : pmes)
|
||||
finalm.merge(pme);
|
||||
|
||||
int fields = 0, staticMethod = 0, method = 0, total = 0;
|
||||
for (Entry<Object, Object> e : finalm.getMap().entrySet())
|
||||
{
|
||||
System.out.println(e.getKey() + " <-> " + e.getValue());
|
||||
|
||||
Object o = e.getKey();
|
||||
if (o instanceof Field)
|
||||
++fields;
|
||||
else if (o instanceof Method)
|
||||
{
|
||||
Method m = (Method) o;
|
||||
|
||||
if (m.isStatic())
|
||||
++staticMethod;
|
||||
else
|
||||
++method;
|
||||
}
|
||||
|
||||
++total;
|
||||
}
|
||||
System.out.println("Total " + total + ". " + fields + " fields, " + staticMethod + " static methods, " + method + " methods");
|
||||
summary(finalm);
|
||||
print(group1);
|
||||
System.out.println("db step " + ParallellMappingExecutor.doubleStep.size());
|
||||
|
||||
for (Method m : group1.findClass("client").getMethods().getMethods())
|
||||
{
|
||||
if (!finalm.getMap().containsKey(m) && !m.isStatic())
|
||||
System.out.println("missing " + m);
|
||||
}
|
||||
for (Field m : group1.findClass("client").getFields().getFields())
|
||||
{
|
||||
if (!finalm.getMap().containsKey(m))
|
||||
System.out.println("missing " + m);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Method> getInitialMethods(ClassGroup group)
|
||||
@@ -242,6 +261,15 @@ public class MapStaticTest
|
||||
if (m1.getCode() == null)
|
||||
return;
|
||||
|
||||
// XXX this is the packet stuff..
|
||||
if (m1.getName().equals("vmethod3096"))
|
||||
return;
|
||||
|
||||
if (m1.getName().equals("method32"))
|
||||
{
|
||||
int i=5;
|
||||
}
|
||||
|
||||
ParallelExecutorMapping mappings;
|
||||
try
|
||||
{
|
||||
@@ -249,6 +277,7 @@ public class MapStaticTest
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
System.err.println("Error mapping " + m1 + " to " + m2);
|
||||
//if (test)
|
||||
// throw ex;
|
||||
|
||||
Reference in New Issue
Block a user