Carry encryption over in iadd and dup x1, this needs to be handled a better way.
This commit is contained in:
@@ -29,16 +29,19 @@ public class Dup_X1 extends Instruction
|
|||||||
ins.pop(one, two);
|
ins.pop(one, two);
|
||||||
|
|
||||||
StackContext ctx = new StackContext(ins, one.getType());
|
StackContext ctx = new StackContext(ins, one.getType());
|
||||||
|
ctx.encryption = one.encryption;
|
||||||
stack.push(ctx);
|
stack.push(ctx);
|
||||||
|
|
||||||
ins.push(ctx);
|
ins.push(ctx);
|
||||||
|
|
||||||
ctx = new StackContext(ins, two.getType());
|
ctx = new StackContext(ins, two.getType());
|
||||||
|
ctx.encryption = two.encryption;
|
||||||
stack.push(ctx);
|
stack.push(ctx);
|
||||||
|
|
||||||
ins.push(ctx);
|
ins.push(ctx);
|
||||||
|
|
||||||
ctx = new StackContext(ins, one.getType());
|
ctx = new StackContext(ins, one.getType());
|
||||||
|
ctx.encryption = one.encryption;
|
||||||
stack.push(ctx);
|
stack.push(ctx);
|
||||||
|
|
||||||
ins.push(ctx);
|
ins.push(ctx);
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package net.runelite.deob.attributes.code.instructions;
|
|||||||
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.PushConstantInstruction;
|
||||||
|
import net.runelite.deob.deobfuscators.arithmetic.DMath;
|
||||||
|
import net.runelite.deob.deobfuscators.arithmetic.Encryption;
|
||||||
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.Stack;
|
import net.runelite.deob.execution.Stack;
|
||||||
@@ -26,7 +29,52 @@ public class IAdd extends Instruction
|
|||||||
|
|
||||||
ins.pop(two, one);
|
ins.pop(two, one);
|
||||||
|
|
||||||
|
Encryption encryption = frame.getExecution().getEncryption();
|
||||||
|
int encKey = 0;
|
||||||
|
if (encryption != null)
|
||||||
|
{
|
||||||
|
if (one.encryption != 0)
|
||||||
|
{
|
||||||
|
assert two.encryption == 0;
|
||||||
|
|
||||||
|
if (two.getPushed().getInstruction() instanceof PushConstantInstruction)
|
||||||
|
{
|
||||||
|
PushConstantInstruction pci = (PushConstantInstruction) two.getPushed().getInstruction();
|
||||||
|
int value = (int) pci.getConstant().getObject();
|
||||||
|
|
||||||
|
if (value != 0 && value != 1)
|
||||||
|
{
|
||||||
|
int o = value * one.encryption;
|
||||||
|
|
||||||
|
encryption.change(pci, o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
encKey = one.encryption;
|
||||||
|
}
|
||||||
|
else if (two.encryption != 0)
|
||||||
|
{
|
||||||
|
assert one.encryption == 0;
|
||||||
|
|
||||||
|
if (one.getPushed().getInstruction() instanceof PushConstantInstruction)
|
||||||
|
{
|
||||||
|
PushConstantInstruction pci = (PushConstantInstruction) one.getPushed().getInstruction();
|
||||||
|
int value = (int) pci.getConstant().getObject();
|
||||||
|
|
||||||
|
if (value != 0 && value != 1)
|
||||||
|
{
|
||||||
|
int o = value * two.encryption;
|
||||||
|
|
||||||
|
encryption.change(pci, o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
encKey = two.encryption;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StackContext ctx = new StackContext(ins, int.class);
|
StackContext ctx = new StackContext(ins, int.class);
|
||||||
|
ctx.encryption = encKey;
|
||||||
stack.push(ctx);
|
stack.push(ctx);
|
||||||
|
|
||||||
ins.push(ctx);
|
ins.push(ctx);
|
||||||
|
|||||||
Reference in New Issue
Block a user