arraystore: map values field

This commit is contained in:
Adam
2016-03-18 20:41:52 -04:00
parent 39e2c0420f
commit 5a0c8ee21d
6 changed files with 76 additions and 52 deletions

View File

@@ -4,6 +4,7 @@ import net.runelite.deob.Field;
import net.runelite.deob.attributes.code.Instruction;
import net.runelite.deob.attributes.code.InstructionType;
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.GetFieldInstruction;
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);
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

View File

@@ -131,6 +131,8 @@ public class PutField extends Instruction implements SetFieldInstruction
mapping.map(f1, f2);
}
}
// XXX also map value here?
}
@Override

View File

@@ -7,20 +7,17 @@ import java.util.stream.Collectors;
import net.runelite.deob.ClassGroup;
import net.runelite.deob.Method;
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.InvokeInstruction;
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.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.instructions.AALoad;
import net.runelite.deob.attributes.code.instructions.InvokeStatic;
import net.runelite.deob.execution.Execution;
import net.runelite.deob.execution.Frame;
import net.runelite.deob.execution.InstructionContext;
import net.runelite.deob.execution.MethodContext;
import net.runelite.deob.execution.ParallellMappingExecutor;
import net.runelite.deob.execution.StackContext;
import net.runelite.deob.execution.VariableContext;
@@ -272,10 +269,10 @@ public class MappingExecutorUtil
return resolve(s.getPushed(), s);
}
if (ctx.getInstruction() instanceof AALoad)
if (ctx.getInstruction() instanceof ArrayLoad)
{
// might be multidimensional array
StackContext s = ctx.getPops().get(1);
StackContext s = ctx.getPops().get(1); // the array
return resolve(s.getPushed(), s);
}