setConstant

This commit is contained in:
Adam
2015-09-13 19:38:36 -04:00
parent 309595a09b
commit 98e3b7ec9e
20 changed files with 29 additions and 23 deletions

View File

@@ -1,10 +1,11 @@
package net.runelite.deob.attributes.code.instruction.types;
import net.runelite.deob.attributes.code.Instruction;
import net.runelite.deob.pool.PoolEntry;
public interface PushConstantInstruction
{
public PoolEntry getConstant();
public void setConstant(PoolEntry entry);
public Instruction setConstant(PoolEntry entry);
}

View File

@@ -55,7 +55,7 @@ public class BiPush extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class DConst_0 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class DConst_1 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class FConst_0 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class FConst_1 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class FConst_2 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class IConst_0 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,8 +40,8 @@ public class IConst_1 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
return new LDC_W(this.getInstructions(), entry);
}
}

View File

@@ -40,7 +40,7 @@ public class IConst_2 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class IConst_3 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class IConst_4 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class IConst_5 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class IConst_M1 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class LConst_0 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -40,7 +40,7 @@ public class LConst_1 extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -55,8 +55,9 @@ public class LDC2_W extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
value = entry;
return this;
}
}

View File

@@ -105,8 +105,9 @@ public class LDC_W extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
value = entry;
return this;
}
}

View File

@@ -55,7 +55,7 @@ public class SiPush extends Instruction implements PushConstantInstruction
}
@Override
public void setConstant(PoolEntry entry)
public Instruction setConstant(PoolEntry entry)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@@ -747,7 +747,8 @@ public class ModularArithmeticDeobfuscation implements Deobfuscator
//assert m.setter == modInverse(m.getter);
int newConstant = constant * m.setter;
pc.setConstant(new net.runelite.deob.pool.Integer(newConstant));
Instruction i2 = pc.setConstant(new net.runelite.deob.pool.Integer(newConstant));
assert i2 == (Instruction) pc;
if (newConstant != 1)
System.out.println("new constant: " + newConstant);
else
@@ -775,7 +776,8 @@ public class ModularArithmeticDeobfuscation implements Deobfuscator
// field = setter * value, solve for value by * modInverse(setter)
int newConstant = constant * m.getter;
pi.setConstant(new net.runelite.deob.pool.Integer(newConstant));
Instruction i2 = pi.setConstant(new net.runelite.deob.pool.Integer(newConstant));
assert i2 == (Instruction) pi;
++replaced;
}
else if (value.getPushed().getInstruction() instanceof IMul)
@@ -810,7 +812,8 @@ public class ModularArithmeticDeobfuscation implements Deobfuscator
// field = expression * constant
int newConstant = constant * m.getter;
pc.setConstant(new net.runelite.deob.pool.Integer(newConstant));
Instruction i2 = pc.setConstant(new net.runelite.deob.pool.Integer(newConstant));
assert i2 == (Instruction) pc;
++replaced;
}
}