arraystore: map values field
This commit is contained in:
@@ -4,6 +4,7 @@ import net.runelite.deob.Field;
|
|||||||
import net.runelite.deob.attributes.code.Instruction;
|
import net.runelite.deob.attributes.code.Instruction;
|
||||||
import net.runelite.deob.attributes.code.InstructionType;
|
import net.runelite.deob.attributes.code.InstructionType;
|
||||||
import net.runelite.deob.attributes.code.Instructions;
|
import net.runelite.deob.attributes.code.Instructions;
|
||||||
|
import net.runelite.deob.attributes.code.instruction.types.ArrayLoad;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.ArrayStoreInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.ArrayStoreInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
|
||||||
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
|
||||||
@@ -48,6 +49,28 @@ public abstract class ArrayStore extends Instruction implements ArrayStoreInstru
|
|||||||
otherField = ((ArrayStore) other.getInstruction()).getMyField(other);
|
otherField = ((ArrayStore) other.getInstruction()).getMyField(other);
|
||||||
|
|
||||||
mapping.map(myField, otherField);
|
mapping.map(myField, otherField);
|
||||||
|
|
||||||
|
// map value
|
||||||
|
|
||||||
|
StackContext object1 = ctx.getPops().get(0), // value set to.
|
||||||
|
object2 = other.getPops().get(0);
|
||||||
|
|
||||||
|
InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
|
||||||
|
InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
|
||||||
|
|
||||||
|
if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
|
||||||
|
{
|
||||||
|
GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
|
||||||
|
gf2 = (GetFieldInstruction) base2.getInstruction();
|
||||||
|
|
||||||
|
net.runelite.deob.Field f1 = gf1.getMyField(),
|
||||||
|
f2 = gf2.getMyField();
|
||||||
|
|
||||||
|
if (f1 != null && f2 != null)
|
||||||
|
{
|
||||||
|
mapping.map(f1, f2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ public class PutField extends Instruction implements SetFieldInstruction
|
|||||||
mapping.map(f1, f2);
|
mapping.map(f1, f2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX also map value here?
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,20 +7,17 @@ import java.util.stream.Collectors;
|
|||||||
import net.runelite.deob.ClassGroup;
|
import net.runelite.deob.ClassGroup;
|
||||||
import net.runelite.deob.Method;
|
import net.runelite.deob.Method;
|
||||||
import net.runelite.deob.attributes.code.Instruction;
|
import net.runelite.deob.attributes.code.Instruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.ComparisonInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.ArrayLoad;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.DupInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.DupInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.InvokeInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.InvokeInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.LVTInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.LVTInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.ReturnInstruction;
|
|
||||||
import net.runelite.deob.attributes.code.instruction.types.SetFieldInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.SetFieldInstruction;
|
||||||
import net.runelite.deob.attributes.code.instructions.AALoad;
|
|
||||||
import net.runelite.deob.attributes.code.instructions.InvokeStatic;
|
import net.runelite.deob.attributes.code.instructions.InvokeStatic;
|
||||||
import net.runelite.deob.execution.Execution;
|
import net.runelite.deob.execution.Execution;
|
||||||
import net.runelite.deob.execution.Frame;
|
import net.runelite.deob.execution.Frame;
|
||||||
import net.runelite.deob.execution.InstructionContext;
|
import net.runelite.deob.execution.InstructionContext;
|
||||||
import net.runelite.deob.execution.MethodContext;
|
|
||||||
import net.runelite.deob.execution.ParallellMappingExecutor;
|
import net.runelite.deob.execution.ParallellMappingExecutor;
|
||||||
import net.runelite.deob.execution.StackContext;
|
import net.runelite.deob.execution.StackContext;
|
||||||
import net.runelite.deob.execution.VariableContext;
|
import net.runelite.deob.execution.VariableContext;
|
||||||
@@ -272,10 +269,10 @@ public class MappingExecutorUtil
|
|||||||
return resolve(s.getPushed(), s);
|
return resolve(s.getPushed(), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.getInstruction() instanceof AALoad)
|
if (ctx.getInstruction() instanceof ArrayLoad)
|
||||||
{
|
{
|
||||||
// might be multidimensional array
|
// might be multidimensional array
|
||||||
StackContext s = ctx.getPops().get(1);
|
StackContext s = ctx.getPops().get(1); // the array
|
||||||
return resolve(s.getPushed(), s);
|
return resolve(s.getPushed(), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import org.junit.Test;
|
|||||||
public class AnnotationMapperTest
|
public class AnnotationMapperTest
|
||||||
{
|
{
|
||||||
private static final String JAR1 = "C:\\Users\\Adam\\.m2\\repository\\net\\runelite\\rs\\rs-client\\1.0-SNAPSHOT\\rs-client-1.0-SNAPSHOT.jar",
|
private static final String JAR1 = "C:\\Users\\Adam\\.m2\\repository\\net\\runelite\\rs\\rs-client\\1.0-SNAPSHOT\\rs-client-1.0-SNAPSHOT.jar",
|
||||||
JAR2 = "c:/rs/gamepack_v18_deobbed.jar",
|
JAR2 = "d:/rs/07/gamepack_v18_deobbed.jar",
|
||||||
OUT = "c:/rs/adamout.jar";
|
OUT = "d:/rs/07/adamout.jar";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun() throws IOException
|
public void testRun() throws IOException
|
||||||
|
|||||||
@@ -614,20 +614,22 @@ public class MapStaticTest
|
|||||||
@Test
|
@Test
|
||||||
public void testPacket() throws IOException
|
public void testPacket() throws IOException
|
||||||
{
|
{
|
||||||
|
String JAR1 = "C:\\Users\\Adam\\.m2\\repository\\net\\runelite\\rs\\rs-client\\1.0-SNAPSHOT\\rs-client-1.0-SNAPSHOT.jar",
|
||||||
|
JAR2 = "d:/rs/07/gamepack_v18_deobbed.jar";
|
||||||
|
|
||||||
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
||||||
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
||||||
|
|
||||||
group1.findClass("client").findField("field446").packetHandler = true;
|
group1.findClass("client").findField("field333").packetHandler = true;
|
||||||
group2.findClass("client").findField("field324").packetHandler = true;
|
group2.findClass("client").findField("field488").packetHandler = true;
|
||||||
|
|
||||||
Method m1 = group1.findClass("client").findMethod("vmethod3096");
|
Method m1 = group1.findClass("client").findMethod("vmethod2968");
|
||||||
Method m2 = group2.findClass("client").findMethod("vmethod2975");
|
Method m2 = group2.findClass("client").findMethod("vmethod3044");
|
||||||
|
|
||||||
ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2);
|
ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2);
|
||||||
|
|
||||||
// var55 = class17.method214(); vs var107 = class25.field625[++class25.field624 - 1];
|
PacketHandler h1 = mappings.findPacketHandler1(9);
|
||||||
PacketHandler h1 = mappings.findPacketHandler1(127);
|
PacketHandler h2 = mappings.findPacketHandler2(25);
|
||||||
PacketHandler h2 = mappings.findPacketHandler2(160);
|
|
||||||
|
|
||||||
ParallelExecutorMapping mapping = MappingExecutorUtil.mapFrame(group1, group2, h1.getFirstInsOfHandler(), h2.getFirstInsOfHandler());
|
ParallelExecutorMapping mapping = MappingExecutorUtil.mapFrame(group1, group2, h1.getFirstInsOfHandler(), h2.getFirstInsOfHandler());
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,37 @@
|
|||||||
package net.runelite.deob.deobfuscators.rename;
|
package net.runelite.deob.deobfuscators.rename;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import net.runelite.deob.ClassGroup;
|
import net.runelite.deob.ClassGroup;
|
||||||
import static net.runelite.deob.deobfuscators.rename.MapStaticTest.print;
|
import static net.runelite.deob.deobfuscators.rename.MapStaticTest.print;
|
||||||
import static net.runelite.deob.deobfuscators.rename.MapStaticTest.summary;
|
import static net.runelite.deob.deobfuscators.rename.MapStaticTest.summary;
|
||||||
import net.runelite.deob.util.JarUtil;
|
import net.runelite.deob.util.JarUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
// Compares two deobfuscated versions of the client
|
// Compares two deobfuscated versions of the client
|
||||||
public class MapperTest
|
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",
|
private static final String JAR1 = "C:\\Users\\Adam\\.m2\\repository\\net\\runelite\\rs\\rs-client\\1.0-SNAPSHOT\\rs-client-1.0-SNAPSHOT.jar",
|
||||||
JAR2 = MapperTest.class.getResource("/gamepack_v16_deobbed.jar").getFile();
|
JAR2 = "c:/rs/gamepack_v18_deobbed.jar";
|
||||||
// private static final String JAR1 = MapStaticTest.class.getResource("/adamin1.jar").getFile(),
|
// private static final String JAR1 = MapStaticTest.class.getResource("/adamin1.jar").getFile(),
|
||||||
// JAR2 = MapStaticTest.class.getResource("/adamin2.jar").getFile();
|
// JAR2 = MapStaticTest.class.getResource("/adamin2.jar").getFile();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun() throws IOException
|
public void testRun() throws IOException
|
||||||
{
|
{
|
||||||
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
||||||
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
||||||
|
|
||||||
Mapper mapper = new Mapper(group1, group2);
|
Mapper mapper = new Mapper(group1, group2);
|
||||||
mapper.run();
|
mapper.run();
|
||||||
ParallelExecutorMapping mapping = mapper.getMapping();
|
ParallelExecutorMapping mapping = mapper.getMapping();
|
||||||
|
|
||||||
summary(mapping, group1);
|
summary(mapping, group1);
|
||||||
|
|
||||||
String sg1 = print(group1),
|
String sg1 = print(group1),
|
||||||
sg2 = print(group2);
|
sg2 = print(group2);
|
||||||
|
|
||||||
System.out.println("GROUP 1 " + sg1);
|
System.out.println("GROUP 1 " + sg1);
|
||||||
System.out.println("GROUP 2 " + sg2);
|
System.out.println("GROUP 2 " + sg2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user