class172.java: this.field2982 = ((1 * this.field2963 & -65536) + this.field2982 * 1) * -402105799; not working.
This commit is contained in:
@@ -31,6 +31,7 @@ public class IMul extends Instruction
|
||||
ins.pop(one, two);
|
||||
|
||||
Encryption encryption = frame.getExecution().getEncryption();
|
||||
int encKey = 0;
|
||||
if (encryption != null)
|
||||
{
|
||||
if (one.encryption != 0)
|
||||
@@ -52,9 +53,12 @@ public class IMul extends Instruction
|
||||
// {
|
||||
// System.out.println("decrr");
|
||||
// }
|
||||
encKey = one.encryption;
|
||||
}
|
||||
else if (two.encryption != 0)
|
||||
{
|
||||
assert one.encryption == 0;
|
||||
|
||||
PushConstantInstruction pci = (PushConstantInstruction) one.getPushed().getInstruction();
|
||||
int other = (int) pci.getConstant().getObject();
|
||||
|
||||
@@ -64,10 +68,12 @@ public class IMul extends Instruction
|
||||
|
||||
encryption.change(pci, o);
|
||||
}
|
||||
encKey = two.encryption;
|
||||
}
|
||||
}
|
||||
|
||||
StackContext ctx = new StackContext(ins, int.class);
|
||||
ctx.encryption = encKey;
|
||||
stack.push(ctx);
|
||||
|
||||
ins.push(ctx);
|
||||
|
||||
@@ -3,6 +3,8 @@ package net.runelite.deob.attributes.code.instructions;
|
||||
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.PushConstantInstruction;
|
||||
import net.runelite.deob.deobfuscators.arithmetic.Encryption;
|
||||
import net.runelite.deob.execution.Frame;
|
||||
import net.runelite.deob.execution.InstructionContext;
|
||||
import net.runelite.deob.execution.Stack;
|
||||
@@ -26,7 +28,52 @@ public class ISub extends Instruction
|
||||
|
||||
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);
|
||||
ctx.encryption = encKey;
|
||||
stack.push(ctx);
|
||||
|
||||
ins.push(ctx);
|
||||
|
||||
@@ -210,60 +210,60 @@ public class ModArith implements Deobfuscator
|
||||
// }
|
||||
}
|
||||
|
||||
private List<Field> getFieldsInExpression(InstructionContext ctx, List<Integer> constants)
|
||||
{
|
||||
return check(ctx, new HashSet<InstructionContext>(), constants);
|
||||
}
|
||||
|
||||
private List<Field> check(InstructionContext context, Set<InstructionContext> visited, List<Integer> constants)
|
||||
{
|
||||
List<Field> fields = new ArrayList<>();
|
||||
|
||||
if (visited.contains(context))
|
||||
return fields;
|
||||
|
||||
visited.add(context);
|
||||
|
||||
if (context.getInstruction() instanceof InvokeInstruction)
|
||||
{
|
||||
// field = func(field * constant), the output of the function isn't directly related to the result of field * constant
|
||||
return fields;
|
||||
}
|
||||
|
||||
if (context.getInstruction() instanceof FieldInstruction)
|
||||
{
|
||||
FieldInstruction fi = (FieldInstruction) context.getInstruction();
|
||||
Field myf = fi.getMyField();
|
||||
if (myf != null)
|
||||
fields.add(myf);
|
||||
}
|
||||
|
||||
if (context.getInstruction() instanceof PushConstantInstruction)
|
||||
{
|
||||
PushConstantInstruction pci = (PushConstantInstruction) context.getInstruction();
|
||||
int i = (int) pci.getConstant().getObject();
|
||||
constants.add(i);
|
||||
}
|
||||
|
||||
for (StackContext ctx : context.getPops())
|
||||
{
|
||||
InstructionContext i = ctx.getPushed();
|
||||
|
||||
fields.addAll(check(i, visited, constants));
|
||||
}
|
||||
|
||||
for (StackContext ctx : context.getPushes())
|
||||
{
|
||||
InstructionContext i = ctx.getPopped();
|
||||
|
||||
if (i == null)
|
||||
continue;
|
||||
|
||||
fields.addAll(check(i, visited, constants));
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
// private List<Field> getFieldsInExpression(InstructionContext ctx, List<Integer> constants)
|
||||
// {
|
||||
// return check(ctx, new HashSet<InstructionContext>(), constants);
|
||||
// }
|
||||
//
|
||||
// private List<Field> check(InstructionContext context, Set<InstructionContext> visited, List<Integer> constants)
|
||||
// {
|
||||
// List<Field> fields = new ArrayList<>();
|
||||
//
|
||||
// if (visited.contains(context))
|
||||
// return fields;
|
||||
//
|
||||
// visited.add(context);
|
||||
//
|
||||
// if (context.getInstruction() instanceof InvokeInstruction)
|
||||
// {
|
||||
// // field = func(field * constant), the output of the function isn't directly related to the result of field * constant
|
||||
// return fields;
|
||||
// }
|
||||
//
|
||||
// if (context.getInstruction() instanceof FieldInstruction)
|
||||
// {
|
||||
// FieldInstruction fi = (FieldInstruction) context.getInstruction();
|
||||
// Field myf = fi.getMyField();
|
||||
// if (myf != null)
|
||||
// fields.add(myf);
|
||||
// }
|
||||
//
|
||||
// if (context.getInstruction() instanceof PushConstantInstruction)
|
||||
// {
|
||||
// PushConstantInstruction pci = (PushConstantInstruction) context.getInstruction();
|
||||
// int i = (int) pci.getConstant().getObject();
|
||||
// constants.add(i);
|
||||
// }
|
||||
//
|
||||
// for (StackContext ctx : context.getPops())
|
||||
// {
|
||||
// InstructionContext i = ctx.getPushed();
|
||||
//
|
||||
// fields.addAll(check(i, visited, constants));
|
||||
// }
|
||||
//
|
||||
// for (StackContext ctx : context.getPushes())
|
||||
// {
|
||||
// InstructionContext i = ctx.getPopped();
|
||||
//
|
||||
// if (i == null)
|
||||
// continue;
|
||||
//
|
||||
// fields.addAll(check(i, visited, constants));
|
||||
// }
|
||||
//
|
||||
// return fields;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void run(ClassGroup group)
|
||||
|
||||
Reference in New Issue
Block a user