Fix ise
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package net.runelite.deob.deobfuscators;
|
package net.runelite.deob.deobfuscators;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -17,14 +18,14 @@ import net.runelite.asm.attributes.code.instructions.Goto;
|
|||||||
import net.runelite.asm.attributes.code.instructions.If;
|
import net.runelite.asm.attributes.code.instructions.If;
|
||||||
import net.runelite.asm.attributes.code.instructions.New;
|
import net.runelite.asm.attributes.code.instructions.New;
|
||||||
import net.runelite.asm.execution.Execution;
|
import net.runelite.asm.execution.Execution;
|
||||||
import net.runelite.asm.execution.Frame;
|
|
||||||
import net.runelite.asm.execution.InstructionContext;
|
import net.runelite.asm.execution.InstructionContext;
|
||||||
|
import net.runelite.asm.execution.MethodContext;
|
||||||
|
|
||||||
public class IllegalStateExceptions implements Deobfuscator
|
public class IllegalStateExceptions implements Deobfuscator
|
||||||
{
|
{
|
||||||
private int count;
|
private int count;
|
||||||
private Set<Instruction> interesting = new HashSet<>();
|
private Set<Instruction> interesting = new HashSet<>();
|
||||||
private InstructionContext currentInstruction;
|
private List<InstructionContext> toRemove = new ArrayList<>();
|
||||||
|
|
||||||
/* find if, new, ..., athrow, replace with goto */
|
/* find if, new, ..., athrow, replace with goto */
|
||||||
private void findInteresting(ClassGroup group)
|
private void findInteresting(ClassGroup group)
|
||||||
@@ -66,24 +67,25 @@ public class IllegalStateExceptions implements Deobfuscator
|
|||||||
{
|
{
|
||||||
if (interesting.contains(ic.getInstruction()))
|
if (interesting.contains(ic.getInstruction()))
|
||||||
{
|
{
|
||||||
assert currentInstruction == null;
|
toRemove.add(ic);
|
||||||
currentInstruction = ic;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void visit(Frame f)
|
private void visit(MethodContext ctx)
|
||||||
{
|
{
|
||||||
if (currentInstruction == null)
|
for (InstructionContext ictx : toRemove)
|
||||||
return;
|
processOne(ictx);
|
||||||
|
toRemove.clear();
|
||||||
processOne(currentInstruction);
|
|
||||||
currentInstruction = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processOne(InstructionContext ic)
|
private void processOne(InstructionContext ic)
|
||||||
{
|
{
|
||||||
Instruction ins = ic.getInstruction();
|
Instruction ins = ic.getInstruction();
|
||||||
Instructions instructions = ins.getInstructions();
|
Instructions instructions = ins.getInstructions();
|
||||||
|
|
||||||
|
if (instructions == null)
|
||||||
|
return;
|
||||||
|
|
||||||
List<Instruction> ilist = instructions.getInstructions();
|
List<Instruction> ilist = instructions.getInstructions();
|
||||||
|
|
||||||
JumpingInstruction jumpIns = (JumpingInstruction) ins;
|
JumpingInstruction jumpIns = (JumpingInstruction) ins;
|
||||||
@@ -132,11 +134,9 @@ public class IllegalStateExceptions implements Deobfuscator
|
|||||||
|
|
||||||
Execution execution = new Execution(group);
|
Execution execution = new Execution(group);
|
||||||
execution.addExecutionVisitor(i -> visit(i));
|
execution.addExecutionVisitor(i -> visit(i));
|
||||||
execution.addFrameVisitor(i -> visit(i));
|
execution.addMethodContextVisitor(i -> visit(i));
|
||||||
execution.populateInitialMethods();
|
execution.populateInitialMethods();
|
||||||
execution.run();
|
execution.run();
|
||||||
|
|
||||||
assert currentInstruction == null;
|
|
||||||
|
|
||||||
System.out.println("Removed " + count + " illegal state exceptions");
|
System.out.println("Removed " + count + " illegal state exceptions");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user