save
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package net.runelite.deob.deobfuscators.arithmetic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.runelite.deob.ClassGroup;
|
||||
import net.runelite.deob.Deobfuscator;
|
||||
@@ -17,6 +18,8 @@ public class MultiplicationDeobfuscator implements Deobfuscator
|
||||
{
|
||||
private ClassGroup group;
|
||||
|
||||
// find a chain of multiplication instructions, evaluate and set one to the constant and the others to 1
|
||||
|
||||
@Override
|
||||
public void run(ClassGroup group)
|
||||
{
|
||||
@@ -27,6 +30,16 @@ public class MultiplicationDeobfuscator implements Deobfuscator
|
||||
System.out.println("Simplified " + i + " multiplication");
|
||||
}
|
||||
|
||||
private List<InstructionContext> getConstants(InstructionContext ctx)
|
||||
{
|
||||
List<InstructionContext> l = new ArrayList<>();
|
||||
|
||||
for (StackContext sctx : ctx.getPops())
|
||||
{
|
||||
InstructionContext i = sctx.getPushed();
|
||||
}
|
||||
}
|
||||
|
||||
private int runOnce()
|
||||
{
|
||||
Execution e = new Execution(group);
|
||||
@@ -41,32 +54,32 @@ public class MultiplicationDeobfuscator implements Deobfuscator
|
||||
if (!(ictx.getInstruction() instanceof IMul))
|
||||
continue;
|
||||
|
||||
Instructions ins = ictx.getInstruction().getInstructions();
|
||||
List<Instruction> ilist = ins.getInstructions();
|
||||
|
||||
if (!ilist.contains(ictx.getInstruction()))
|
||||
continue; // already done
|
||||
|
||||
StackContext one = ictx.getPops().get(0);
|
||||
StackContext two = ictx.getPops().get(1);
|
||||
|
||||
if (one.getPushed().getInstruction() instanceof PushConstantInstruction
|
||||
&& two.getPushed().getInstruction() instanceof PushConstantInstruction)
|
||||
{
|
||||
PushConstantInstruction pci1 = (PushConstantInstruction) one.getPushed().getInstruction(),
|
||||
pci2 = (PushConstantInstruction) two.getPushed().getInstruction();
|
||||
|
||||
int i1 = (int) pci1.getConstant().getObject(),
|
||||
i2 = (int) pci2.getConstant().getObject();
|
||||
|
||||
int result = i1 * i2;
|
||||
|
||||
ictx.removeStack(1);
|
||||
ictx.removeStack(0);
|
||||
|
||||
ins.replace(ictx.getInstruction(), new LDC_W(ins, new net.runelite.deob.pool.Integer(result)));
|
||||
++count;
|
||||
}
|
||||
// Instructions ins = ictx.getInstruction().getInstructions();
|
||||
// List<Instruction> ilist = ins.getInstructions();
|
||||
//
|
||||
// if (!ilist.contains(ictx.getInstruction()))
|
||||
// continue; // already done
|
||||
//
|
||||
// StackContext one = ictx.getPops().get(0);
|
||||
// StackContext two = ictx.getPops().get(1);
|
||||
//
|
||||
// if (one.getPushed().getInstruction() instanceof PushConstantInstruction
|
||||
// && two.getPushed().getInstruction() instanceof PushConstantInstruction)
|
||||
// {
|
||||
// PushConstantInstruction pci1 = (PushConstantInstruction) one.getPushed().getInstruction(),
|
||||
// pci2 = (PushConstantInstruction) two.getPushed().getInstruction();
|
||||
//
|
||||
// int i1 = (int) pci1.getConstant().getObject(),
|
||||
// i2 = (int) pci2.getConstant().getObject();
|
||||
//
|
||||
// int result = i1 * i2;
|
||||
//
|
||||
// ictx.removeStack(1);
|
||||
// ictx.removeStack(0);
|
||||
//
|
||||
// ins.replace(ictx.getInstruction(), new LDC_W(ins, new net.runelite.deob.pool.Integer(result)));
|
||||
// ++count;
|
||||
// }
|
||||
}
|
||||
|
||||
return count;
|
||||
|
||||
Reference in New Issue
Block a user