Try and pull packet info out of source. gamepack 16 and 17 are actually identical, I didn't realize. Interestingly i found if I attempt to map deobbed client that is rebuilt vs the deobbed client, it can't map everything. Some of that might have to do with the packet handling stuff, this currently npes in iinc so I can't tell how many is due to that yet.
This commit is contained in:
@@ -8,9 +8,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.runelite.deob.ClassFile;
|
||||
import net.runelite.deob.ClassGroup;
|
||||
import net.runelite.deob.Field;
|
||||
import net.runelite.deob.Method;
|
||||
import net.runelite.deob.attributes.Annotations;
|
||||
import net.runelite.deob.attributes.code.Instruction;
|
||||
import net.runelite.deob.execution.ParallellMappingExecutor;
|
||||
import net.runelite.deob.signature.Type;
|
||||
|
||||
public class Mapper
|
||||
{
|
||||
@@ -36,7 +39,7 @@ public class Mapper
|
||||
|
||||
finalm.merge(mapStaticMethods(source, target));
|
||||
finalm.merge(mapMethods(source, target));
|
||||
finalm.merge(mapPackets(source, target));
|
||||
finalm.merge(mapPackets(finalm, source, target));
|
||||
|
||||
mapping = finalm;
|
||||
}
|
||||
@@ -145,16 +148,24 @@ public class Mapper
|
||||
}
|
||||
}
|
||||
|
||||
private ParallelExecutorMapping mapPackets(ClassGroup group1, ClassGroup group2)
|
||||
private ParallelExecutorMapping mapPackets(ParallelExecutorMapping pem, ClassGroup group1, ClassGroup group2)
|
||||
{
|
||||
// XXX PULL THESE FROM PREVIOUS MAPPINGS
|
||||
group1.findClass("client").findField("field446").packetHandler = true;
|
||||
group2.findClass("client").findField("field324").packetHandler = true;
|
||||
Method packetMethod = this.findPacketMethod();
|
||||
Field packetField = this.findPacketField();
|
||||
|
||||
Method m1 = group1.findClass("client").findMethod("vmethod3096");
|
||||
Method m2 = group2.findClass("client").findMethod("vmethod2975");
|
||||
assert packetMethod != null;
|
||||
assert packetField != null;
|
||||
|
||||
ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2);
|
||||
Method otherPacketMethod = (Method) pem.get(packetMethod);
|
||||
Field otherPacketField = (Field) pem.get(packetField);
|
||||
|
||||
assert otherPacketMethod != null;
|
||||
assert otherPacketField != null;
|
||||
|
||||
packetField.packetHandler = true;
|
||||
otherPacketField.packetHandler = true;
|
||||
|
||||
ParallelExecutorMapping mappings = MappingExecutorUtil.map(packetMethod, otherPacketMethod);
|
||||
|
||||
System.out.println(mappings.packetHandler1.size() + " vs " + mappings.packetHandler2.size() + " handlers");
|
||||
|
||||
@@ -196,4 +207,41 @@ public class Mapper
|
||||
ParallellMappingExecutor.enable = false;
|
||||
return all;
|
||||
}
|
||||
|
||||
|
||||
private static final Type OBFUSCATED_NAME = new Type("Lnet/runelite/mapping/Export;");
|
||||
|
||||
private Field findPacketField()
|
||||
{
|
||||
for (ClassFile cf : source.getClasses())
|
||||
{
|
||||
for (Field f : cf.getFields().getFields())
|
||||
{
|
||||
Annotations an = f.getAttributes().getAnnotations();
|
||||
|
||||
if (an == null || an.find(OBFUSCATED_NAME) == null)
|
||||
continue;
|
||||
|
||||
if (an.find(OBFUSCATED_NAME).getElement().getString().equals("packetOpcode"))
|
||||
return f;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Method findPacketMethod()
|
||||
{
|
||||
for (Method m : source.findClass("client").getMethods().getMethods())
|
||||
{
|
||||
Annotations an = m.getAttributes().getAnnotations();
|
||||
|
||||
if (an == null || an.find(OBFUSCATED_NAME) == null)
|
||||
continue;
|
||||
|
||||
if (an.find(OBFUSCATED_NAME).getElement().getString().equals("packetHandler"))
|
||||
return m;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class MapStaticTest
|
||||
}
|
||||
}
|
||||
|
||||
private void summary(ParallelExecutorMapping finalm, ClassGroup in)
|
||||
public static void summary(ParallelExecutorMapping finalm, ClassGroup in)
|
||||
{
|
||||
int fields = 0, staticMethod = 0, method = 0, total = 0;
|
||||
for (Entry<Object, Object> e : finalm.getMap().entrySet())
|
||||
@@ -441,7 +441,7 @@ public class MapStaticTest
|
||||
}
|
||||
}
|
||||
|
||||
private String print(ClassGroup cg)
|
||||
public static String print(ClassGroup cg)
|
||||
{
|
||||
int methods = 0, fields = 0, classes = 0;
|
||||
for (ClassFile cf : cg.getClasses())
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package net.runelite.deob.deobfuscators.rename;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import net.runelite.deob.ClassGroup;
|
||||
import static net.runelite.deob.deobfuscators.rename.MapStaticTest.print;
|
||||
import static net.runelite.deob.deobfuscators.rename.MapStaticTest.summary;
|
||||
import net.runelite.deob.util.JarUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MapperTest
|
||||
{
|
||||
private static final String JAR1 = "C:\\Users\\Adam\\.m2\\repository\\net\\runelite\\rs\\rs-client\\1.0-SNAPSHOT\\rs-client-1.0-SNAPSHOT.jar",//"d:/rs/07/gamepack_v16_deobbed.jar",
|
||||
JAR2 = "d:/rs/07/gamepack_v17_deobbed.jar";
|
||||
// private static final String JAR1 = MapStaticTest.class.getResource("/adamin1.jar").getFile(),
|
||||
// JAR2 = MapStaticTest.class.getResource("/adamin2.jar").getFile();
|
||||
|
||||
@Test
|
||||
public void testRun() throws IOException
|
||||
{
|
||||
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
||||
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
||||
|
||||
Mapper mapper = new Mapper(group1, group2);
|
||||
mapper.run();
|
||||
ParallelExecutorMapping mapping = mapper.getMapping();
|
||||
|
||||
summary(mapping, group1);
|
||||
|
||||
String sg1 = print(group1),
|
||||
sg2 = print(group2);
|
||||
|
||||
System.out.println("GROUP 1 " + sg1);
|
||||
System.out.println("GROUP 2 " + sg2);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,3 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package net.runelite.deob.injection;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
Reference in New Issue
Block a user