711 vs 742 but not the same

This commit is contained in:
Adam
2016-01-25 13:44:08 -05:00
parent a0a2054187
commit 951a6699c8
6 changed files with 116 additions and 20 deletions

View File

@@ -33,7 +33,24 @@ public class IfACmpNe extends If
return true;
}
}
else if (otherIc.getInstruction() instanceof IfACmpEq)
{
return true;
}
return false;
}
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
if (other.getInstruction() instanceof IfACmpEq)
{
super.mapOtherBranch(mapping, ctx, other);
}
else
{
super.map(mapping, ctx, other);
}
}
}

View File

@@ -2,8 +2,10 @@ package net.runelite.deob.attributes.code.instructions;
import net.runelite.deob.attributes.code.InstructionType;
import net.runelite.deob.attributes.code.Instructions;
import static net.runelite.deob.attributes.code.instructions.IfICmpEq.isZero;
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
import net.runelite.deob.execution.InstructionContext;
import net.runelite.deob.execution.StackContext;
public class IfEq extends If0
{
@@ -22,6 +24,14 @@ public class IfEq extends If0
{
return true;
}
else if (otherIc.getInstruction() instanceof IfICmpNe)
{
StackContext s1 = otherIc.getPops().get(0),
s2 = otherIc.getPops().get(1);
if (isZero(s1) || isZero(s2))
return true;
}
return false;
}
@@ -29,7 +39,7 @@ public class IfEq extends If0
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
if (other.getInstruction() instanceof IfNe)
if (other.getInstruction() instanceof IfNe || other.getInstruction() instanceof IfICmpNe)
{
super.mapOtherBranch(mapping, ctx, other);
}

View File

@@ -2,6 +2,8 @@ package net.runelite.deob.attributes.code.instructions;
import net.runelite.deob.attributes.code.InstructionType;
import net.runelite.deob.attributes.code.Instructions;
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
import net.runelite.deob.execution.InstructionContext;
public class IfGt extends If0
{
@@ -10,4 +12,30 @@ public class IfGt extends If0
super(instructions, type, pc);
}
@Override
public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
{
if (super.isSame(thisIc, otherIc))
return true;
if (otherIc.getInstruction() instanceof IfLe)
{
return true;
}
return false;
}
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
if (other.getInstruction() instanceof IfLe)
{
super.mapOtherBranch(mapping, ctx, other);
}
else
{
super.map(mapping, ctx, other);
}
}
}

View File

@@ -14,7 +14,7 @@ public class IfICmpEq extends If
super(instructions, type, pc);
}
private static boolean isZero(StackContext s)
static boolean isZero(StackContext s)
{
if (s.getPushed().getInstruction() instanceof PushConstantInstruction)
{

View File

@@ -2,6 +2,7 @@ package net.runelite.deob.attributes.code.instructions;
import net.runelite.deob.attributes.code.InstructionType;
import net.runelite.deob.attributes.code.Instructions;
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
import net.runelite.deob.execution.InstructionContext;
import net.runelite.deob.execution.StackContext;
@@ -18,7 +19,7 @@ public class IfNull extends If0
if (super.isSame(thisIc, otherIc))
return true;
if (otherIc.getInstruction() instanceof IfACmpEq)
if (otherIc.getInstruction() instanceof IfACmpEq || otherIc.getInstruction() instanceof IfACmpNe)
{
StackContext s1 = otherIc.getPops().get(0),
s2 = otherIc.getPops().get(1);
@@ -32,7 +33,24 @@ public class IfNull extends If0
return true;
}
}
else if (otherIc.getInstruction() instanceof IfNull)
{
return true;
}
return false;
}
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
if (other.getInstruction() instanceof IfACmpNe || other.getInstruction() instanceof IfNull)
{
super.mapOtherBranch(mapping, ctx, other);
}
else
{
super.map(mapping, ctx, other);
}
}
}