mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-19 11:48:08 +00:00
AS3 better deobfuscation
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package com.jpexs.decompiler.flash;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.gui.AboutDialog;
|
||||
import com.jpexs.decompiler.flash.gui.LoadingDialog;
|
||||
import com.jpexs.decompiler.flash.gui.MainFrame;
|
||||
@@ -25,7 +24,6 @@ import com.jpexs.decompiler.flash.gui.ModeFrame;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
|
||||
import com.jpexs.decompiler.flash.gui.proxy.ProxyFrame;
|
||||
import com.jpexs.decompiler.flash.helpers.Highlighting;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
@@ -529,13 +529,13 @@ public class SWFInputStream extends InputStream {
|
||||
stack.pop();
|
||||
getConstantPool(localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).offset)) : ip + 1, ip, constantPools, visited);
|
||||
} else {
|
||||
if(ins instanceof ActionIf){
|
||||
if (ins instanceof ActionIf) {
|
||||
stack.pop();
|
||||
}
|
||||
visited.add(ip);
|
||||
List<Integer> branches = ins.getBranches(code);
|
||||
for (int b : branches) {
|
||||
Stack<GraphTargetItem> brStack=(Stack<GraphTargetItem>)stack.clone();
|
||||
Stack<GraphTargetItem> brStack = (Stack<GraphTargetItem>) stack.clone();
|
||||
if (b >= 0) {
|
||||
getConstantPool(localData, brStack, output, code, b, ip, constantPools, visited);
|
||||
} else {
|
||||
@@ -619,7 +619,7 @@ public class SWFInputStream extends InputStream {
|
||||
//Action.setConstantPool(ret, cpool);
|
||||
|
||||
try {
|
||||
s = Highlighting.stripHilights(Action.actionsToString(ret, null, version,false));
|
||||
s = Highlighting.stripHilights(Action.actionsToString(ret, null, version, false));
|
||||
ret = ASMParser.parse(false, new ByteArrayInputStream(s.getBytes()), SWF.DEFAULT_VERSION);
|
||||
} catch (ParseException ex) {
|
||||
Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE, "parsing error", ex);
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ABC {
|
||||
public int removeTraps() {
|
||||
int rem = 0;
|
||||
for (MethodBody body : bodies) {
|
||||
rem += body.removeTraps(constants);
|
||||
rem += body.removeTraps(constants, this);
|
||||
}
|
||||
return rem;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.ABCInputStream;
|
||||
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphSource;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
@@ -49,6 +50,8 @@ import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
|
||||
import com.jpexs.decompiler.flash.graph.Graph;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemPos;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import com.jpexs.decompiler.flash.helpers.Highlighting;
|
||||
@@ -125,11 +128,11 @@ public class AVM2Code implements Serializable {
|
||||
new CoerceSIns(),
|
||||
new InstructionDefinition(0x88, "coerce_u", new int[]{}), //stack:-1+1
|
||||
new InstructionDefinition(0x9a, "concat", new int[]{}) {
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -2 + 1; //?
|
||||
}
|
||||
},
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
return -2 + 1; //?
|
||||
}
|
||||
},
|
||||
new ConstructIns(),
|
||||
new ConstructPropIns(),
|
||||
new ConstructSuperIns(),
|
||||
@@ -141,11 +144,11 @@ public class AVM2Code implements Serializable {
|
||||
new ConvertSIns(),
|
||||
new InstructionDefinition(0x79, "convert_m", new int[]{}), //-1 +1
|
||||
new InstructionDefinition(0x7a, "convert_m_p", new int[]{AVM2Code.OPT_U30 /*param (?)*/}) {
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
},
|
||||
@Override
|
||||
public int getStackDelta(AVM2Instruction ins, ABC abc) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
},
|
||||
new DebugIns(),
|
||||
new DebugFileIns(),
|
||||
new DebugLineIns(),
|
||||
@@ -725,9 +728,9 @@ public class AVM2Code implements Serializable {
|
||||
int largeLimit = 20000;
|
||||
boolean markOffsets = code.size() <= largeLimit;
|
||||
for (AVM2Instruction ins : code) {
|
||||
if(hex){
|
||||
if (hex) {
|
||||
ret.append("<ffdec:hex>");
|
||||
ret.append(Helper.bytesToHexString(ins.getBytes()));
|
||||
ret.append(Helper.bytesToHexString(ins.getBytes()));
|
||||
ret.append("</ffdec:hex>\n");
|
||||
}
|
||||
if (ins.labelname != null) {
|
||||
@@ -1671,163 +1674,184 @@ public class AVM2Code implements Serializable {
|
||||
code.add(pos, instruction);
|
||||
}
|
||||
|
||||
public int removeTraps(ConstantPool constants, MethodBody body) {
|
||||
public int removeTraps(ConstantPool constants, MethodBody body, ABC abc) {
|
||||
|
||||
removeDeadCode(constants, body);
|
||||
boolean isSecure = true;
|
||||
try {
|
||||
if (code.size() > 4) {
|
||||
AVM2Instruction first = code.get(0);
|
||||
AVM2Instruction second = code.get(1);
|
||||
boolean firstValue = false;
|
||||
boolean secondValue = false;
|
||||
if (first.definition instanceof PushFalseIns) {
|
||||
firstValue = false;
|
||||
} else if (first.definition instanceof PushTrueIns) {
|
||||
firstValue = true;
|
||||
} else {
|
||||
isSecure = false;
|
||||
}
|
||||
if (isSecure) {
|
||||
if (second.definition instanceof PushFalseIns) {
|
||||
secondValue = false;
|
||||
} else if (second.definition instanceof PushTrueIns) {
|
||||
secondValue = true;
|
||||
} else {
|
||||
isSecure = false;
|
||||
}
|
||||
if (isSecure) {
|
||||
int pos = 2;
|
||||
AVM2Instruction third = code.get(pos);
|
||||
if (third.definition instanceof SwapIns) {
|
||||
pos++;
|
||||
boolean dup = firstValue;
|
||||
firstValue = secondValue;
|
||||
secondValue = dup;
|
||||
third.ignored = true;
|
||||
}
|
||||
while (third.definition instanceof JumpIns) {
|
||||
pos = adr2pos(pos2adr(pos) + third.getBytes().length + third.operands[0]);
|
||||
third = code.get(pos);
|
||||
}
|
||||
AVM2Instruction firstSet = code.get(pos);
|
||||
while (firstSet.definition instanceof JumpIns) {
|
||||
pos = adr2pos(pos2adr(pos) + firstSet.getBytes().length + firstSet.operands[0]);
|
||||
firstSet = code.get(pos);
|
||||
}
|
||||
pos++;
|
||||
AVM2Instruction secondSet = code.get(pos);
|
||||
while (secondSet.definition instanceof JumpIns) {
|
||||
pos = adr2pos(pos2adr(pos) + secondSet.getBytes().length + secondSet.operands[0]);
|
||||
secondSet = code.get(pos);
|
||||
}
|
||||
int trueIndex = -1;
|
||||
int falseIndex = -1;
|
||||
if (firstSet.definition instanceof SetLocalTypeIns) {
|
||||
if (secondValue == true) {
|
||||
trueIndex = ((SetLocalTypeIns) firstSet.definition).getRegisterId(firstSet);
|
||||
}
|
||||
if (secondValue == false) {
|
||||
falseIndex = ((SetLocalTypeIns) firstSet.definition).getRegisterId(firstSet);
|
||||
}
|
||||
} else {
|
||||
isSecure = false;
|
||||
}
|
||||
if (isSecure) {
|
||||
if (secondSet.definition instanceof SetLocalTypeIns) {
|
||||
if (firstValue == true) {
|
||||
trueIndex = ((SetLocalTypeIns) secondSet.definition).getRegisterId(secondSet);
|
||||
}
|
||||
if (firstValue == false) {
|
||||
falseIndex = ((SetLocalTypeIns) secondSet.definition).getRegisterId(secondSet);
|
||||
}
|
||||
secondSet.ignored = true;
|
||||
firstSet.ignored = true;
|
||||
first.ignored = true;
|
||||
second.ignored = true;
|
||||
boolean found;
|
||||
do {
|
||||
found = false;
|
||||
for (int ip = 0; ip < code.size(); ip++) {
|
||||
if (code.get(ip).ignored) {
|
||||
continue;
|
||||
}
|
||||
if (code.get(ip).definition instanceof GetLocalTypeIns) {
|
||||
int regIndex = ((GetLocalTypeIns) code.get(ip).definition).getRegisterId(code.get(ip));
|
||||
if ((regIndex == trueIndex) || (regIndex == falseIndex)) {
|
||||
found = true;
|
||||
Stack<Boolean> myStack = new Stack<Boolean>();
|
||||
do {
|
||||
AVM2Instruction ins = code.get(ip);
|
||||
/*if (ins.ignored) {
|
||||
ip++;
|
||||
continue;
|
||||
} else*/ if (ins.definition instanceof GetLocalTypeIns) {
|
||||
regIndex = ((GetLocalTypeIns) ins.definition).getRegisterId(ins);
|
||||
if (regIndex == trueIndex) {
|
||||
myStack.push(true);
|
||||
}
|
||||
if (regIndex == falseIndex) {
|
||||
myStack.push(false);
|
||||
}
|
||||
ip++;
|
||||
ins.ignored = true;
|
||||
} else if (ins.definition instanceof DupIns) {
|
||||
Boolean b = myStack.pop();
|
||||
myStack.push(b);
|
||||
myStack.push(b);
|
||||
ins.ignored = true;
|
||||
ip++;
|
||||
} else if (ins.definition instanceof PopIns) {
|
||||
myStack.pop();
|
||||
ins.ignored = true;
|
||||
ip++;
|
||||
} else if (ins.definition instanceof IfTrueIns) {
|
||||
boolean val = myStack.pop();
|
||||
if (val) {
|
||||
code.get(ip).definition = new JumpIns();
|
||||
ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]);
|
||||
} else {
|
||||
code.get(ip).ignored = true;
|
||||
ip++;
|
||||
}
|
||||
} else if (ins.definition instanceof IfFalseIns) {
|
||||
boolean val = myStack.pop();
|
||||
if (!val) {
|
||||
code.get(ip).definition = new JumpIns();
|
||||
ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]);
|
||||
} else {
|
||||
code.get(ip).ignored = true;
|
||||
ip++;
|
||||
}
|
||||
} else if (ins.definition instanceof JumpIns) {
|
||||
ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]);
|
||||
} else {
|
||||
ip++;
|
||||
}
|
||||
/* boolean isSecure = true;
|
||||
try {
|
||||
if (code.size() > 4) {
|
||||
AVM2Instruction first = code.get(0);
|
||||
AVM2Instruction second = code.get(1);
|
||||
boolean firstValue = false;
|
||||
boolean secondValue = false;
|
||||
if (first.definition instanceof PushFalseIns) {
|
||||
firstValue = false;
|
||||
} else if (first.definition instanceof PushTrueIns) {
|
||||
firstValue = true;
|
||||
} else {
|
||||
isSecure = false;
|
||||
}
|
||||
if (isSecure) {
|
||||
if (second.definition instanceof PushFalseIns) {
|
||||
secondValue = false;
|
||||
} else if (second.definition instanceof PushTrueIns) {
|
||||
secondValue = true;
|
||||
} else {
|
||||
isSecure = false;
|
||||
}
|
||||
if (isSecure) {
|
||||
int pos = 2;
|
||||
AVM2Instruction third = code.get(pos);
|
||||
if (third.definition instanceof SwapIns) {
|
||||
pos++;
|
||||
boolean dup = firstValue;
|
||||
firstValue = secondValue;
|
||||
secondValue = dup;
|
||||
third.ignored = true;
|
||||
}
|
||||
while (third.definition instanceof JumpIns) {
|
||||
pos = adr2pos(pos2adr(pos) + third.getBytes().length + third.operands[0]);
|
||||
third = code.get(pos);
|
||||
}
|
||||
AVM2Instruction firstSet = code.get(pos);
|
||||
while (firstSet.definition instanceof JumpIns) {
|
||||
pos = adr2pos(pos2adr(pos) + firstSet.getBytes().length + firstSet.operands[0]);
|
||||
firstSet = code.get(pos);
|
||||
}
|
||||
pos++;
|
||||
AVM2Instruction secondSet = code.get(pos);
|
||||
while (secondSet.definition instanceof JumpIns) {
|
||||
pos = adr2pos(pos2adr(pos) + secondSet.getBytes().length + secondSet.operands[0]);
|
||||
secondSet = code.get(pos);
|
||||
}
|
||||
int trueIndex = -1;
|
||||
int falseIndex = -1;
|
||||
if (firstSet.definition instanceof SetLocalTypeIns) {
|
||||
if (secondValue == true) {
|
||||
trueIndex = ((SetLocalTypeIns) firstSet.definition).getRegisterId(firstSet);
|
||||
}
|
||||
if (secondValue == false) {
|
||||
falseIndex = ((SetLocalTypeIns) firstSet.definition).getRegisterId(firstSet);
|
||||
}
|
||||
} else {
|
||||
isSecure = false;
|
||||
}
|
||||
if (isSecure) {
|
||||
if (secondSet.definition instanceof SetLocalTypeIns) {
|
||||
if (firstValue == true) {
|
||||
trueIndex = ((SetLocalTypeIns) secondSet.definition).getRegisterId(secondSet);
|
||||
}
|
||||
if (firstValue == false) {
|
||||
falseIndex = ((SetLocalTypeIns) secondSet.definition).getRegisterId(secondSet);
|
||||
}
|
||||
secondSet.ignored = true;
|
||||
firstSet.ignored = true;
|
||||
first.ignored = true;
|
||||
second.ignored = true;
|
||||
boolean found;
|
||||
do {
|
||||
found = false;
|
||||
for (int ip = 0; ip < code.size(); ip++) {
|
||||
if (code.get(ip).ignored) {
|
||||
continue;
|
||||
}
|
||||
if (code.get(ip).definition instanceof GetLocalTypeIns) {
|
||||
int regIndex = ((GetLocalTypeIns) code.get(ip).definition).getRegisterId(code.get(ip));
|
||||
if ((regIndex == trueIndex) || (regIndex == falseIndex)) {
|
||||
found = true;
|
||||
Stack<Boolean> myStack = new Stack<Boolean>();
|
||||
do {
|
||||
AVM2Instruction ins = code.get(ip);
|
||||
if (ins.definition instanceof GetLocalTypeIns) {
|
||||
regIndex = ((GetLocalTypeIns) ins.definition).getRegisterId(ins);
|
||||
if (regIndex == trueIndex) {
|
||||
myStack.push(true);
|
||||
}
|
||||
if (regIndex == falseIndex) {
|
||||
myStack.push(false);
|
||||
}
|
||||
ip++;
|
||||
ins.ignored = true;
|
||||
} else if (ins.definition instanceof DupIns) {
|
||||
Boolean b = myStack.pop();
|
||||
myStack.push(b);
|
||||
myStack.push(b);
|
||||
ins.ignored = true;
|
||||
ip++;
|
||||
} else if (ins.definition instanceof PopIns) {
|
||||
myStack.pop();
|
||||
ins.ignored = true;
|
||||
ip++;
|
||||
} else if (ins.definition instanceof IfTrueIns) {
|
||||
boolean val = myStack.pop();
|
||||
if (val) {
|
||||
code.get(ip).definition = new JumpIns();
|
||||
ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]);
|
||||
} else {
|
||||
code.get(ip).ignored = true;
|
||||
ip++;
|
||||
}
|
||||
} else if (ins.definition instanceof IfFalseIns) {
|
||||
boolean val = myStack.pop();
|
||||
if (!val) {
|
||||
code.get(ip).definition = new JumpIns();
|
||||
ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]);
|
||||
} else {
|
||||
code.get(ip).ignored = true;
|
||||
ip++;
|
||||
}
|
||||
} else if (ins.definition instanceof JumpIns) {
|
||||
ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]);
|
||||
} else {
|
||||
ip++;
|
||||
}
|
||||
|
||||
} while (myStack.size() > 0);
|
||||
} while (myStack.size() > 0 && ip < code.size());
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} while (found);
|
||||
removeIgnored(constants, body);
|
||||
removeDeadCode(constants, body);
|
||||
} else {
|
||||
//isSecure = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (found);
|
||||
removeIgnored(constants, body);
|
||||
removeDeadCode(constants, body);
|
||||
} else {
|
||||
//isSecure = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ConvertException cex) {
|
||||
}
|
||||
int ret = isSecure ? 1 : 0;
|
||||
ret += visitCodeTrap(body, new int[code.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ConvertException cex) {
|
||||
}
|
||||
int ret = isSecure ? 1 : 0;
|
||||
ret += visitCodeTrap(body, new int[code.size()]);*/
|
||||
|
||||
//definition.translate((Boolean) localData.get(0), (Integer) localData.get(1),
|
||||
//(HashMap<Integer, GraphTargetItem>) localData.get(2), stack,
|
||||
//(Stack<GraphTargetItem>) localData.get(3), (ConstantPool) localData.get(4), this,
|
||||
//(MethodInfo[]) localData.get(5), output,
|
||||
//(MethodBody) localData.get(6), (ABC) localData.get(7),
|
||||
//(HashMap<Integer, String>) localData.get(8), (List<String>) localData.get(8));
|
||||
|
||||
List localData = new ArrayList();
|
||||
localData.add((Boolean) false); //isStatic
|
||||
localData.add((Integer) 0); //classIndex
|
||||
localData.add(new HashMap<Integer, GraphTargetItem>());
|
||||
localData.add(new Stack<GraphTargetItem>());
|
||||
localData.add(abc.constants);
|
||||
localData.add(abc.method_info);
|
||||
localData.add(body);
|
||||
localData.add(abc);
|
||||
localData.add(new HashMap<Integer, String>()); //localRegNames
|
||||
localData.add(new ArrayList<String>()); //fullyQualifiedNames
|
||||
localData.add(new ArrayList<ABCException>());
|
||||
localData.add(new ArrayList<Integer>());
|
||||
localData.add(new ArrayList<Integer>());
|
||||
int ret = 0;
|
||||
ret += removeTraps(localData, new AVM2GraphSource(this, false, 0, new HashMap<Integer, GraphTargetItem>(), new Stack<GraphTargetItem>(), abc, body, new HashMap<Integer, String>(), new ArrayList<String>()), 0);
|
||||
removeIgnored(constants, body);
|
||||
removeDeadCode(constants, body);
|
||||
|
||||
@@ -2257,7 +2281,7 @@ public class AVM2Code implements Serializable {
|
||||
invalidateCache();
|
||||
try {
|
||||
List<Integer> outputMap = new ArrayList<Integer>();
|
||||
String src = Highlighting.stripHilights(toASMSource(constants, body, outputMap,false));
|
||||
String src = Highlighting.stripHilights(toASMSource(constants, body, outputMap, false));
|
||||
|
||||
AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(src.getBytes()), constants, null, body);
|
||||
for (int i = 0; i < acode.code.size(); i++) {
|
||||
@@ -2297,7 +2321,7 @@ public class AVM2Code implements Serializable {
|
||||
public void removeIgnored(ConstantPool constants, MethodBody body) {
|
||||
try {
|
||||
List<Integer> outputMap = new ArrayList<Integer>();
|
||||
String src = toASMSource(constants, body, outputMap,false);
|
||||
String src = toASMSource(constants, body, outputMap, false);
|
||||
AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(src.getBytes()), constants, body);
|
||||
for (int i = 0; i < acode.code.size(); i++) {
|
||||
if (outputMap.size() > i) {
|
||||
@@ -2367,4 +2391,78 @@ public class AVM2Code implements Serializable {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static int removeTraps(List localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, AVM2GraphSource code, int ip, int lastIp, List<Integer> visited) {
|
||||
boolean debugMode = false;
|
||||
int ret = 0;
|
||||
while ((ip > -1) && ip < code.size()) {
|
||||
if (visited.contains(ip)) {
|
||||
break;
|
||||
}
|
||||
visited.add(ip);
|
||||
lastIp = ip;
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
if (debugMode) {
|
||||
System.out.println("Visit " + ip + ": " + ins + " stack:" + Highlighting.stripHilights(stack.toString()));
|
||||
}
|
||||
if ((ins instanceof AVM2Instruction) && (((AVM2Instruction) ins).definition instanceof NewFunctionIns)) {
|
||||
stack.push(new BooleanTreeItem(null, true));
|
||||
} else {
|
||||
ins.translate(localData, stack, output);
|
||||
}
|
||||
if (ins.isExit()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ins.isBranch() || ins.isJump()) {
|
||||
List<Integer> branches = ins.getBranches(code);
|
||||
if (ins.isBranch() && !stack.isEmpty() && (stack.peek().isCompileTime())) {
|
||||
boolean condition = stack.peek().toBoolean();
|
||||
if (debugMode) {
|
||||
if (condition) {
|
||||
System.out.println("JUMP");
|
||||
} else {
|
||||
System.out.println("SKIP");
|
||||
}
|
||||
}
|
||||
if (condition) {
|
||||
((AVM2Instruction) ins).definition = new JumpIns();
|
||||
} else {
|
||||
ins.setIgnored(true);
|
||||
}
|
||||
GraphTargetItem tar = stack.pop();
|
||||
for (GraphSourceItemPos pos : tar.getNeededSources()) {
|
||||
pos.item.setIgnored(true);
|
||||
}
|
||||
|
||||
ret += removeTraps(localData, stack, output, code, condition ? branches.get(0) : branches.get(1), ip, visited);
|
||||
} else {
|
||||
if (ins.isBranch()) {
|
||||
stack.pop();
|
||||
}
|
||||
|
||||
for (int b : branches) {
|
||||
Stack<GraphTargetItem> brStack = (Stack<GraphTargetItem>) stack.clone();
|
||||
if (b >= 0) {
|
||||
ret += removeTraps(localData, brStack, output, code, b, ip, visited);
|
||||
} else {
|
||||
if (debugMode) {
|
||||
System.out.println("Negative branch:" + b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
ip++;
|
||||
};
|
||||
if (ip < 0) {
|
||||
System.out.println("Visited Negative: " + ip);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static int removeTraps(List localData, AVM2GraphSource code, int addr) {
|
||||
return removeTraps(localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0, new ArrayList<Integer>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,6 +224,7 @@ public class AVM2Instruction implements Serializable, GraphSourceItem {
|
||||
return " ;" + comment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIgnored() {
|
||||
return ignored;
|
||||
}
|
||||
@@ -243,7 +244,7 @@ public class AVM2Instruction implements Serializable, GraphSourceItem {
|
||||
|
||||
@Override
|
||||
public void translate(List localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output) {
|
||||
definition.translate((Boolean) localData.get(0), (Integer) localData.get(1), (HashMap<Integer, GraphTargetItem>) localData.get(2), stack, (Stack<GraphTargetItem>) localData.get(3), (ConstantPool) localData.get(4), this, (MethodInfo[]) localData.get(5), output, (MethodBody) localData.get(6), (ABC) localData.get(7), (HashMap<Integer, String>) localData.get(8), (List<String>) localData.get(8));
|
||||
definition.translate((Boolean) localData.get(0), (Integer) localData.get(1), (HashMap<Integer, GraphTargetItem>) localData.get(2), stack, (Stack<GraphTargetItem>) localData.get(3), (ConstantPool) localData.get(4), this, (MethodInfo[]) localData.get(5), output, (MethodBody) localData.get(6), (ABC) localData.get(7), (HashMap<Integer, String>) localData.get(8), (List<String>) localData.get(9));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -288,4 +289,9 @@ public class AVM2Instruction implements Serializable, GraphSourceItem {
|
||||
public boolean ignoredLoops() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIgnored(boolean ignored) {
|
||||
this.ignored = ignored;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,8 +138,8 @@ public class ASM3Parser {
|
||||
}
|
||||
ABCException ex = new ABCException();
|
||||
|
||||
ex.name_index = checkMultinameIndex(constants,(int) (long) (Long) exName.value,lexer.yyline());
|
||||
ex.type_index = checkMultinameIndex(constants,(int) (long) (Long) exType.value,lexer.yyline());
|
||||
ex.name_index = checkMultinameIndex(constants, (int) (long) (Long) exName.value, lexer.yyline());
|
||||
ex.type_index = checkMultinameIndex(constants, (int) (long) (Long) exType.value, lexer.yyline());
|
||||
exceptions.add(ex);
|
||||
exceptionIndices.add((int) (long) (Long) exIndex.value);
|
||||
continue;
|
||||
@@ -155,7 +155,7 @@ public class ASM3Parser {
|
||||
switch (def.operands[i]) {
|
||||
case AVM2Code.DAT_MULTINAME_INDEX:
|
||||
if (parsedOperand.type == ParsedSymbol.TYPE_MULTINAME) {
|
||||
operandsList.add(checkMultinameIndex(constants,(int) (long) (Long) parsedOperand.value,lexer.yyline()));
|
||||
operandsList.add(checkMultinameIndex(constants, (int) (long) (Long) parsedOperand.value, lexer.yyline()));
|
||||
} else {
|
||||
throw new ParseException("Multiname expected", lexer.yyline());
|
||||
}
|
||||
|
||||
@@ -44,4 +44,19 @@ public class BooleanTreeItem extends TreeItem {
|
||||
public boolean isTrue() {
|
||||
return value == true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return value ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompileTime() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,14 @@ public class FloatValueTreeItem extends NumberValueTreeItem {
|
||||
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
return hilight("" + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompileTime() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,14 @@ public class IntegerValueTreeItem extends NumberValueTreeItem {
|
||||
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
return hilight("" + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompileTime() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,19 @@ public class LocalRegTreeItem extends TreeItem {
|
||||
public GraphTargetItem getThroughRegister() {
|
||||
return computedValue.getThroughRegister();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return computedValue.toNumber();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return computedValue.toBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompileTime() {
|
||||
return computedValue.isCompileTime();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,4 +31,19 @@ public class NullTreeItem extends TreeItem {
|
||||
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
return hilight("null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompileTime() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,32 +16,36 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class AddTreeItem extends BinaryOpTreeItem {
|
||||
public class AddTreeItem extends BinaryOpItem {
|
||||
|
||||
public AddTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
public String toString(List localData) {
|
||||
if (rightSide.precedence >= precedence) {
|
||||
String ret = "";
|
||||
if (leftSide.precedence > precedence) {
|
||||
ret += "(" + leftSide.toString(constants, localRegNames, fullyQualifiedNames) + ")";
|
||||
ret += "(" + leftSide.toString(localData) + ")";
|
||||
} else {
|
||||
ret += leftSide.toString(constants, localRegNames, fullyQualifiedNames);
|
||||
ret += leftSide.toString(localData);
|
||||
}
|
||||
ret += hilight(operator);
|
||||
ret += "(" + rightSide.toString(constants, localRegNames, fullyQualifiedNames) + ")";
|
||||
ret += "(" + rightSide.toString(localData) + ")";
|
||||
return ret;
|
||||
} else {
|
||||
return super.toString(constants, localRegNames, fullyQualifiedNames);
|
||||
return super.toString(localData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return leftSide.toNumber() + rightSide.toNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphPart;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class AndTreeItem extends BinaryOpTreeItem {
|
||||
public class AndTreeItem extends BinaryOpItem {
|
||||
|
||||
public GraphPart firstPart;
|
||||
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class AsTypeTreeItem extends BinaryOpTreeItem {
|
||||
public class AsTypeTreeItem extends BinaryOpItem {
|
||||
|
||||
public AsTypeTreeItem(AVM2Instruction instruction, GraphTargetItem value, GraphTargetItem type) {
|
||||
super(instruction, PRECEDENCE_RELATIONAL, value, type, " as ");
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2013 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BinaryOpTreeItem extends TreeItem {
|
||||
|
||||
public GraphTargetItem leftSide;
|
||||
public GraphTargetItem rightSide;
|
||||
protected String operator = "";
|
||||
|
||||
public BinaryOpTreeItem(AVM2Instruction instruction, int precedence, GraphTargetItem leftSide, GraphTargetItem rightSide, String operator) {
|
||||
super(instruction, precedence);
|
||||
this.leftSide = leftSide;
|
||||
this.rightSide = rightSide;
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
String ret = "";
|
||||
if (leftSide.precedence > precedence) {
|
||||
ret += "(" + leftSide.toString(constants, localRegNames, fullyQualifiedNames) + ")";
|
||||
} else {
|
||||
ret += leftSide.toString(constants, localRegNames, fullyQualifiedNames);
|
||||
}
|
||||
ret += hilight(operator);
|
||||
if (rightSide.precedence > precedence) {
|
||||
ret += "(" + rightSide.toString(constants, localRegNames, fullyQualifiedNames) + ")";
|
||||
} else {
|
||||
ret += rightSide.toString(constants, localRegNames, fullyQualifiedNames);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class BitAndTreeItem extends BinaryOpTreeItem {
|
||||
public class BitAndTreeItem extends BinaryOpItem {
|
||||
|
||||
public BitAndTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_BITWISEAND, leftSide, rightSide, "&");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return ((int) leftSide.toNumber()) & ((int) rightSide.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,18 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.UnaryOpItem;
|
||||
|
||||
public class BitNotTreeItem extends UnaryOpTreeItem {
|
||||
public class BitNotTreeItem extends UnaryOpItem {
|
||||
|
||||
public BitNotTreeItem(AVM2Instruction instruction, GraphTargetItem value) {
|
||||
public BitNotTreeItem(GraphSourceItem instruction, GraphTargetItem value) {
|
||||
super(instruction, PRECEDENCE_UNARY, value, "~");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return ~((int) value.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class BitOrTreeItem extends BinaryOpTreeItem {
|
||||
public class BitOrTreeItem extends BinaryOpItem {
|
||||
|
||||
public BitOrTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_BITWISEOR, leftSide, rightSide, "|");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return ((int) leftSide.toNumber()) | ((int) rightSide.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class BitXorTreeItem extends BinaryOpTreeItem {
|
||||
public class BitXorTreeItem extends BinaryOpItem {
|
||||
|
||||
public BitXorTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_BITWISEXOR, leftSide, rightSide, "^");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return ((int) leftSide.toNumber()) ^ ((int) rightSide.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class DivideTreeItem extends BinaryOpTreeItem {
|
||||
public class DivideTreeItem extends BinaryOpItem {
|
||||
|
||||
public DivideTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return leftSide.toNumber() / rightSide.toNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,24 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.LogicalOpItem;
|
||||
|
||||
public class EqTreeItem extends BinaryOpTreeItem implements LogicalOpItem {
|
||||
public class EqTreeItem extends BinaryOpItem implements LogicalOpItem {
|
||||
|
||||
public EqTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
public EqTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "==");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return (leftSide.toBoolean() == rightSide.toBoolean()) && (leftSide.toNumber() == rightSide.toNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
return new NeqTreeItem(instruction, leftSide, rightSide);
|
||||
return new NeqTreeItem(src, leftSide, rightSide);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,24 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.LogicalOpItem;
|
||||
|
||||
public class GeTreeItem extends BinaryOpTreeItem implements LogicalOpItem {
|
||||
public class GeTreeItem extends BinaryOpItem implements LogicalOpItem {
|
||||
|
||||
public GeTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
public GeTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">=");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
return new LtTreeItem(instruction, leftSide, rightSide);
|
||||
return new LtTreeItem(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return leftSide.toNumber() >= rightSide.toNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,24 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.LogicalOpItem;
|
||||
|
||||
public class GtTreeItem extends BinaryOpTreeItem implements LogicalOpItem {
|
||||
public class GtTreeItem extends BinaryOpItem implements LogicalOpItem {
|
||||
|
||||
public GtTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
public GtTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
return new LeTreeItem(instruction, leftSide, rightSide);
|
||||
return new LeTreeItem(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return leftSide.toNumber() > rightSide.toNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class InTreeItem extends BinaryOpTreeItem {
|
||||
public class InTreeItem extends BinaryOpItem {
|
||||
|
||||
public InTreeItem(AVM2Instruction instruction, GraphTargetItem name, GraphTargetItem object) {
|
||||
super(instruction, PRECEDENCE_RELATIONAL, name, object, " in ");
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class InstanceOfTreeItem extends BinaryOpTreeItem {
|
||||
public class InstanceOfTreeItem extends BinaryOpItem {
|
||||
|
||||
public InstanceOfTreeItem(AVM2Instruction instruction, GraphTargetItem value, GraphTargetItem type) {
|
||||
super(instruction, PRECEDENCE_RELATIONAL, value, type, " instanceof ");
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class IsTypeTreeItem extends BinaryOpTreeItem {
|
||||
public class IsTypeTreeItem extends BinaryOpItem {
|
||||
|
||||
public IsTypeTreeItem(AVM2Instruction instruction, GraphTargetItem value, GraphTargetItem type) {
|
||||
super(instruction, PRECEDENCE_RELATIONAL, value, type, " is ");
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class LShiftTreeItem extends BinaryOpTreeItem {
|
||||
public class LShiftTreeItem extends BinaryOpItem {
|
||||
|
||||
public LShiftTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return ((int) leftSide.toNumber()) << ((int) rightSide.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,24 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.LogicalOpItem;
|
||||
|
||||
public class LeTreeItem extends BinaryOpTreeItem implements LogicalOpItem {
|
||||
public class LeTreeItem extends BinaryOpItem implements LogicalOpItem {
|
||||
|
||||
public LeTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
public LeTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<=");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
return new GtTreeItem(instruction, leftSide, rightSide);
|
||||
return new GtTreeItem(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return leftSide.toNumber() <= rightSide.toNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,24 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.LogicalOpItem;
|
||||
|
||||
public class LtTreeItem extends BinaryOpTreeItem implements LogicalOpItem {
|
||||
public class LtTreeItem extends BinaryOpItem implements LogicalOpItem {
|
||||
|
||||
public LtTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
public LtTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
return new GeTreeItem(instruction, leftSide, rightSide);
|
||||
return new GeTreeItem(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return leftSide.toNumber() < rightSide.toNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class ModuloTreeItem extends BinaryOpTreeItem {
|
||||
public class ModuloTreeItem extends BinaryOpItem {
|
||||
|
||||
public ModuloTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return ((int) leftSide.toNumber()) % ((int) rightSide.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class MultiplyTreeItem extends BinaryOpTreeItem {
|
||||
public class MultiplyTreeItem extends BinaryOpItem {
|
||||
|
||||
public MultiplyTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return leftSide.toNumber() * rightSide.toNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,16 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.UnaryOpItem;
|
||||
|
||||
public class NegTreeItem extends UnaryOpTreeItem {
|
||||
public class NegTreeItem extends UnaryOpItem {
|
||||
|
||||
public NegTreeItem(AVM2Instruction instruction, GraphTargetItem value) {
|
||||
super(instruction, PRECEDENCE_UNARY, value, "-");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return -value.toNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,24 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.LogicalOpItem;
|
||||
|
||||
public class NeqTreeItem extends BinaryOpTreeItem implements LogicalOpItem {
|
||||
public class NeqTreeItem extends BinaryOpItem implements LogicalOpItem {
|
||||
|
||||
public NeqTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
public NeqTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return (leftSide.toNumber() != rightSide.toNumber()) || (leftSide.toBoolean() != rightSide.toBoolean());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
return new EqTreeItem(instruction, leftSide, rightSide);
|
||||
return new EqTreeItem(src, leftSide, rightSide);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,20 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphPart;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class OrTreeItem extends BinaryOpTreeItem {
|
||||
public class OrTreeItem extends BinaryOpItem {
|
||||
|
||||
public GraphPart firstPart;
|
||||
|
||||
public OrTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return leftSide.toBoolean() || rightSide.toBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,9 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.AssignmentTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.UnaryOpItem;
|
||||
|
||||
public class PreDecrementTreeItem extends UnaryOpTreeItem implements AssignmentTreeItem {
|
||||
public class PreDecrementTreeItem extends UnaryOpItem implements AssignmentTreeItem {
|
||||
|
||||
public PreDecrementTreeItem(AVM2Instruction instruction, GraphTargetItem object) {
|
||||
super(instruction, PRECEDENCE_UNARY, object, "--");
|
||||
|
||||
@@ -18,8 +18,9 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.UnaryOpItem;
|
||||
|
||||
public class PreIncrementTreeItem extends UnaryOpTreeItem {
|
||||
public class PreIncrementTreeItem extends UnaryOpItem {
|
||||
|
||||
public PreIncrementTreeItem(AVM2Instruction instruction, GraphTargetItem object) {
|
||||
super(instruction, PRECEDENCE_UNARY, object, "++");
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class RShiftTreeItem extends BinaryOpTreeItem {
|
||||
public class RShiftTreeItem extends BinaryOpItem {
|
||||
|
||||
public RShiftTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return ((int) leftSide.toNumber()) >> ((int) rightSide.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,24 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.LogicalOpItem;
|
||||
|
||||
public class StrictEqTreeItem extends BinaryOpTreeItem implements LogicalOpItem {
|
||||
public class StrictEqTreeItem extends BinaryOpItem implements LogicalOpItem {
|
||||
|
||||
public StrictEqTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
public StrictEqTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "===");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return (leftSide.toBoolean() == rightSide.toBoolean()) && (leftSide.toNumber() == rightSide.toNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
return new StrictNeqTreeItem(instruction, leftSide, rightSide);
|
||||
return new StrictNeqTreeItem(src, leftSide, rightSide);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,24 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.LogicalOpItem;
|
||||
|
||||
public class StrictNeqTreeItem extends BinaryOpTreeItem implements LogicalOpItem {
|
||||
public class StrictNeqTreeItem extends BinaryOpItem implements LogicalOpItem {
|
||||
|
||||
public StrictNeqTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
public StrictNeqTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!==");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem invert() {
|
||||
return new StrictEqTreeItem(instruction, leftSide, rightSide);
|
||||
return new StrictEqTreeItem(src, leftSide, rightSide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
return (leftSide.toBoolean() != rightSide.toBoolean()) && (leftSide.toNumber() != rightSide.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class SubtractTreeItem extends BinaryOpTreeItem {
|
||||
public class SubtractTreeItem extends BinaryOpItem {
|
||||
|
||||
public SubtractTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return leftSide.toNumber() - rightSide.toNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,9 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.graph.UnaryOpItem;
|
||||
|
||||
public class TypeOfTreeItem extends UnaryOpTreeItem {
|
||||
public class TypeOfTreeItem extends UnaryOpItem {
|
||||
|
||||
public TypeOfTreeItem(AVM2Instruction instruction, GraphTargetItem value) {
|
||||
super(instruction, PRECEDENCE_UNARY, value, "typeof ");
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.graph.BinaryOpItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
public class URShiftTreeItem extends BinaryOpTreeItem {
|
||||
public class URShiftTreeItem extends BinaryOpItem {
|
||||
|
||||
public URShiftTreeItem(AVM2Instruction instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
return ((int) leftSide.toNumber()) >>> ((int) rightSide.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2013 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class UnaryOpTreeItem extends TreeItem {
|
||||
|
||||
public GraphTargetItem value;
|
||||
public String operator;
|
||||
|
||||
public UnaryOpTreeItem(AVM2Instruction instruction, int precedence, GraphTargetItem value, String operator) {
|
||||
super(instruction, precedence);
|
||||
this.value = value;
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
String s = value.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames));
|
||||
if (value.precedence > precedence) {
|
||||
s = "(" + s + ")";
|
||||
}
|
||||
return hilight(operator) + s;
|
||||
}
|
||||
}
|
||||
@@ -44,33 +44,31 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
private DecompiledEditorPane decompiledEditor;
|
||||
private boolean ignoreCarret = false;
|
||||
private String name;
|
||||
private String textWithHex="";
|
||||
private String textNoHex="";
|
||||
private boolean hex=false;
|
||||
private String textWithHex = "";
|
||||
private String textNoHex = "";
|
||||
private boolean hex = false;
|
||||
|
||||
public boolean isHex() {
|
||||
return hex;
|
||||
}
|
||||
|
||||
public void switchHex(){
|
||||
public void switchHex() {
|
||||
setHex(!hex);
|
||||
}
|
||||
|
||||
|
||||
public void setHex(boolean hex) {
|
||||
if(this.hex==hex){
|
||||
if (this.hex == hex) {
|
||||
return;
|
||||
}
|
||||
this.hex = hex;
|
||||
long oldOffset=getSelectedOffset();
|
||||
if(hex){
|
||||
long oldOffset = getSelectedOffset();
|
||||
if (hex) {
|
||||
setText(textWithHex);
|
||||
}else{
|
||||
} else {
|
||||
setText(textNoHex);
|
||||
}
|
||||
hilighOffset(oldOffset);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setIgnoreCarret(boolean ignoreCarret) {
|
||||
this.ignoreCarret = ignoreCarret;
|
||||
@@ -105,10 +103,10 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
this.bodyIndex = bodyIndex;
|
||||
this.abc = abc;
|
||||
this.name = name;
|
||||
String textWithHexTags=abc.bodies[bodyIndex].code.toASMSource(abc.constants, abc.bodies[bodyIndex],true);
|
||||
textWithHex=Helper.hexToComments(textWithHexTags);
|
||||
textNoHex=Helper.stripComments(textWithHexTags);
|
||||
setText(hex?textWithHex:textNoHex);
|
||||
String textWithHexTags = abc.bodies[bodyIndex].code.toASMSource(abc.constants, abc.bodies[bodyIndex], true);
|
||||
textWithHex = Helper.hexToComments(textWithHexTags);
|
||||
textNoHex = Helper.stripComments(textWithHexTags);
|
||||
setText(hex ? textWithHex : textNoHex);
|
||||
}
|
||||
|
||||
public void graph() {
|
||||
@@ -143,7 +141,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
disassembledHilights = Highlighting.getInstrHighlights(t);
|
||||
t = Highlighting.stripHilights(t);
|
||||
super.setText(t);
|
||||
}
|
||||
}
|
||||
|
||||
public void selectInstruction(int pos) {
|
||||
String text = getText();
|
||||
@@ -200,8 +198,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
requestFocus();
|
||||
}
|
||||
|
||||
|
||||
public long getSelectedOffset(){
|
||||
public long getSelectedOffset() {
|
||||
int pos = getCaretPosition();
|
||||
Highlighting lastH = new Highlighting(0, 0, 0);
|
||||
for (Highlighting h : disassembledHilights) {
|
||||
@@ -212,8 +209,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
}
|
||||
return lastH.offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void caretUpdate(CaretEvent e) {
|
||||
if (isEditable()) {
|
||||
@@ -223,7 +219,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
return;
|
||||
}
|
||||
getCaret().setVisible(true);
|
||||
|
||||
|
||||
decompiledEditor.hilightOffset(getSelectedOffset());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
@@ -69,8 +69,8 @@ public class MethodBody implements Cloneable, Serializable {
|
||||
code.restoreControlFlow(constants, this);
|
||||
}
|
||||
|
||||
public int removeTraps(ConstantPool constants) {
|
||||
return code.removeTraps(constants, this);
|
||||
public int removeTraps(ConstantPool constants, ABC abc) {
|
||||
return code.removeTraps(constants, this, abc);
|
||||
}
|
||||
|
||||
public HashMap<Integer, String> getLocalRegNames(ABC abc) {
|
||||
@@ -115,7 +115,7 @@ public class MethodBody implements Cloneable, Serializable {
|
||||
MethodBody b = (MethodBody) Helper.deepCopy(this);
|
||||
deobfuscated = b.code;
|
||||
deobfuscated.markMappedOffsets();
|
||||
deobfuscated.removeTraps(constants, b);
|
||||
deobfuscated.removeTraps(constants, b, abc);
|
||||
//deobfuscated.restoreControlFlow(constants, b);
|
||||
try {
|
||||
s += deobfuscated.toSource(path, isStatic, classIndex, abc, constants, method_info, b, hilight, getLocalRegNames(abc), scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits);
|
||||
|
||||
@@ -189,10 +189,11 @@ public class TraitClass extends Trait {
|
||||
}
|
||||
}
|
||||
|
||||
private void parseImportsUsagesFromMethodInfo(List<DoABCTag> abcTags, ABC abc, int method_index, List<String> imports, List<String> uses, String ignorePackage, List<String> fullyQualifiedNames) {
|
||||
private void parseImportsUsagesFromMethodInfo(List<DoABCTag> abcTags, ABC abc, int method_index, List<String> imports, List<String> uses, String ignorePackage, List<String> fullyQualifiedNames, List<Integer> visitedMethods) {
|
||||
if (method_index > abc.method_info.length) {
|
||||
return;
|
||||
}
|
||||
visitedMethods.add(method_index);
|
||||
if (abc.method_info[method_index].ret_type != 0) {
|
||||
parseImportsUsagesFromMultiname(abcTags, abc, imports, uses, abc.constants.constant_multiname[abc.method_info[method_index].ret_type], ignorePackage, fullyQualifiedNames);
|
||||
}
|
||||
@@ -209,7 +210,11 @@ public class TraitClass extends Trait {
|
||||
}
|
||||
for (AVM2Instruction ins : body.code.code) {
|
||||
if (ins.definition instanceof NewFunctionIns) {
|
||||
parseImportsUsagesFromMethodInfo(abcTags, abc, ins.operands[0], imports, uses, ignorePackage, fullyQualifiedNames);
|
||||
if (ins.operands[0] != method_index) {
|
||||
if (!visitedMethods.contains(ins.operands[0])) {
|
||||
parseImportsUsagesFromMethodInfo(abcTags, abc, ins.operands[0], imports, uses, ignorePackage, fullyQualifiedNames, visitedMethods);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ins.definition instanceof FindPropertyStrictIns)
|
||||
|| (ins.definition instanceof FindPropertyIns)
|
||||
@@ -244,7 +249,7 @@ public class TraitClass extends Trait {
|
||||
TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t;
|
||||
parseImportsUsagesFromMultiname(abcTags, abc, imports, uses, abc.constants.constant_multiname[tm.name_index], ignorePackage, fullyQualifiedNames);
|
||||
if (tm.method_info != 0) {
|
||||
parseImportsUsagesFromMethodInfo(abcTags, abc, tm.method_info, imports, uses, ignorePackage, fullyQualifiedNames);
|
||||
parseImportsUsagesFromMethodInfo(abcTags, abc, tm.method_info, imports, uses, ignorePackage, fullyQualifiedNames, new ArrayList<Integer>());
|
||||
}
|
||||
}
|
||||
parseImportsUsagesFromMultiname(abcTags, abc, imports, uses, t.getName(abc), ignorePackage, fullyQualifiedNames);
|
||||
@@ -274,14 +279,14 @@ public class TraitClass extends Trait {
|
||||
parseImportsUsagesFromTraits(abcTags, abc, abc.class_info[class_info].static_traits, imports, uses, packageName, fullyQualifiedNames);
|
||||
|
||||
//static initializer
|
||||
parseImportsUsagesFromMethodInfo(abcTags, abc, abc.class_info[class_info].cinit_index, imports, uses, packageName, fullyQualifiedNames);
|
||||
parseImportsUsagesFromMethodInfo(abcTags, abc, abc.class_info[class_info].cinit_index, imports, uses, packageName, fullyQualifiedNames, new ArrayList<Integer>());
|
||||
|
||||
//instance
|
||||
parseImportsUsagesFromTraits(abcTags, abc, abc.instance_info[class_info].instance_traits, imports, uses, packageName, fullyQualifiedNames);
|
||||
|
||||
|
||||
//instance initializer
|
||||
parseImportsUsagesFromMethodInfo(abcTags, abc, abc.instance_info[class_info].iinit_index, imports, uses, packageName, fullyQualifiedNames);
|
||||
parseImportsUsagesFromMethodInfo(abcTags, abc, abc.instance_info[class_info].iinit_index, imports, uses, packageName, fullyQualifiedNames, new ArrayList<Integer>());
|
||||
return imports;
|
||||
}
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ public class Action implements GraphSourceItem {
|
||||
* @return ASM source as String
|
||||
*/
|
||||
public static String actionsToString(List<Action> list, List<Long> importantOffsets, int version, boolean hex) {
|
||||
return actionsToString(list, importantOffsets, new ArrayList<String>(), version,hex);
|
||||
return actionsToString(list, importantOffsets, new ArrayList<String>(), version, hex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,8 +363,8 @@ public class Action implements GraphSourceItem {
|
||||
|
||||
offset = 0;
|
||||
for (Action a : list) {
|
||||
if(hex){
|
||||
ret+="<ffdec:hex>"+Helper.bytesToHexString((a instanceof ActionContainer)?((ActionContainer)a).getHeaderBytes():a.getBytes(version))+"</ffdec:hex>\r\n";
|
||||
if (hex) {
|
||||
ret += "<ffdec:hex>" + Helper.bytesToHexString((a instanceof ActionContainer) ? ((ActionContainer) a).getHeaderBytes() : a.getBytes(version)) + "</ffdec:hex>\r\n";
|
||||
}
|
||||
offset = a.getAddress();
|
||||
if (importantOffsets.contains(offset)) {
|
||||
@@ -378,10 +378,10 @@ public class Action implements GraphSourceItem {
|
||||
}
|
||||
} else {
|
||||
if (a.beforeInsert != null) {
|
||||
ret += a.beforeInsert.getASMSource(importantOffsets, constantPool, version,hex) + "\r\n";
|
||||
ret += a.beforeInsert.getASMSource(importantOffsets, constantPool, version, hex) + "\r\n";
|
||||
}
|
||||
//if (!(a instanceof ActionNop)) {
|
||||
ret += Highlighting.hilighOffset("", offset) + a.getASMSource(importantOffsets, constantPool, version,hex) + (a.ignored ? "; ignored" : "") + "\r\n";
|
||||
ret += Highlighting.hilighOffset("", offset) + a.getASMSource(importantOffsets, constantPool, version, hex) + (a.ignored ? "; ignored" : "") + "\r\n";
|
||||
//}
|
||||
}
|
||||
offset += a.getBytes(version).length;
|
||||
@@ -540,6 +540,16 @@ public class Action implements GraphSourceItem {
|
||||
return new ArrayList<Integer>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIgnored() {
|
||||
return ignored;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIgnored(boolean ignored) {
|
||||
this.ignored = ignored;
|
||||
}
|
||||
|
||||
private static class Loop {
|
||||
|
||||
public long loopContinue;
|
||||
@@ -1001,7 +1011,7 @@ public class Action implements GraphSourceItem {
|
||||
List<Action> ret = actions;
|
||||
String s = null;
|
||||
try {
|
||||
s = Highlighting.stripHilights(Action.actionsToString(ret, null, version,false));
|
||||
s = Highlighting.stripHilights(Action.actionsToString(ret, null, version, false));
|
||||
ret = ASMParser.parse(true, new ByteArrayInputStream(s.getBytes()), SWF.DEFAULT_VERSION);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE, "parsing error", ex);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
private String srcWithHex;
|
||||
private String srcNoHex;
|
||||
|
||||
public void setText(String text){
|
||||
public void setText(String text) {
|
||||
int pos = editor.getCaretPosition();
|
||||
Highlighting lastH = new Highlighting(0, 0, 0);
|
||||
for (Highlighting h : disassembledHilights) {
|
||||
@@ -81,7 +81,7 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
}
|
||||
lastH = h;
|
||||
}
|
||||
long offset=lastH.offset;
|
||||
long offset = lastH.offset;
|
||||
disassembledHilights = Highlighting.getInstrHighlights(text);
|
||||
editor.setText(Highlighting.stripHilights(text));
|
||||
for (Highlighting h : disassembledHilights) {
|
||||
@@ -90,9 +90,9 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setHex(boolean hex) {
|
||||
setText(hex ? srcWithHex : srcNoHex);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
decompiledEditor.setEditable(false);
|
||||
|
||||
|
||||
JButton graphButton = new JButton(View.getIcon("graph16"));
|
||||
JButton graphButton = new JButton(View.getIcon("graph16"));
|
||||
graphButton.setActionCommand("GRAPH");
|
||||
graphButton.addActionListener(this);
|
||||
graphButton.setToolTipText("View Graph");
|
||||
@@ -154,18 +154,18 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
topButtonsPan.setLayout(new BoxLayout(topButtonsPan, BoxLayout.X_AXIS));
|
||||
topButtonsPan.add(graphButton);
|
||||
topButtonsPan.add(hexButton);
|
||||
JPanel panCode=new JPanel(new BorderLayout());
|
||||
JPanel panCode = new JPanel(new BorderLayout());
|
||||
panCode.add(new JScrollPane(editor), BorderLayout.CENTER);
|
||||
panCode.add(topButtonsPan, BorderLayout.NORTH);
|
||||
|
||||
|
||||
JPanel panB = new JPanel();
|
||||
panB.setLayout(new BorderLayout());
|
||||
asmLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
asmLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
|
||||
panB.add(asmLabel, BorderLayout.NORTH);
|
||||
panB.add(panCode,BorderLayout.CENTER);
|
||||
|
||||
|
||||
panB.add(panCode, BorderLayout.CENTER);
|
||||
|
||||
|
||||
|
||||
JPanel buttonsPan = new JPanel();
|
||||
buttonsPan.setLayout(new FlowLayout());
|
||||
@@ -176,7 +176,7 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
//buttonsPan.add(saveHexButton);
|
||||
//buttonsPan.add(loadHexButton);
|
||||
panB.add(buttonsPan, BorderLayout.SOUTH);
|
||||
|
||||
|
||||
|
||||
saveHexButton.addActionListener(this);
|
||||
saveHexButton.setActionCommand("SAVEHEXACTION");
|
||||
@@ -289,7 +289,7 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
cancelButton.setVisible(true);
|
||||
editor.getCaret().setVisible(true);
|
||||
} else {
|
||||
setText(hexButton.isSelected()?srcWithHex:srcNoHex);
|
||||
setText(hexButton.isSelected() ? srcWithHex : srcNoHex);
|
||||
editor.setEditable(false);
|
||||
saveButton.setVisible(false);
|
||||
editButton.setVisible(true);
|
||||
|
||||
@@ -5,5 +5,6 @@ package com.jpexs.decompiler.flash.action.special;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface ActionContainer {
|
||||
|
||||
public byte[] getHeaderBytes();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class ActionWith extends Action implements ActionContainer{
|
||||
public class ActionWith extends Action implements ActionContainer {
|
||||
|
||||
public List<Action> actions;
|
||||
public int size;
|
||||
@@ -69,7 +69,7 @@ public class ActionWith extends Action implements ActionContainer{
|
||||
}
|
||||
return baos2.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public byte[] getBytes(int version) {
|
||||
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
|
||||
@@ -88,7 +88,7 @@ public class ActionWith extends Action implements ActionContainer{
|
||||
|
||||
@Override
|
||||
public String getASMSource(List<Long> knownAddreses, List<String> constantPool, int version, boolean hex) {
|
||||
return "With {\r\n" + Action.actionsToString(actions, knownAddreses, constantPool, version,hex) + "}";
|
||||
return "With {\r\n" + Action.actionsToString(actions, knownAddreses, constantPool, version, hex) + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,6 +100,4 @@ public class ActionWith extends Action implements ActionContainer{
|
||||
public List<Action> getAllIfsOrJumps() {
|
||||
return Action.getActionsAllIfsOrJumps(actions);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class ActionTry extends Action {
|
||||
public String getASMSource(List<Long> knownAddreses, List<String> constantPool, int version, boolean hex) {
|
||||
String ret = "";
|
||||
ret += "Try {";
|
||||
ret += Action.actionsToString(tryBody, knownAddreses, constantPool, version,hex);
|
||||
ret += Action.actionsToString(tryBody, knownAddreses, constantPool, version, hex);
|
||||
ret += "}";
|
||||
if (catchBlockFlag) {
|
||||
ret += "\r\nCatch ";
|
||||
@@ -176,12 +176,12 @@ public class ActionTry extends Action {
|
||||
ret += "\"" + Helper.escapeString(catchName) + "\"";
|
||||
}
|
||||
ret += " {\r\n";
|
||||
ret += Action.actionsToString(catchBody, knownAddreses, constantPool, version,hex);
|
||||
ret += Action.actionsToString(catchBody, knownAddreses, constantPool, version, hex);
|
||||
ret += "}";
|
||||
}
|
||||
if (finallyBlockFlag) {
|
||||
ret += "\r\nFinally {\r\n";
|
||||
ret += Action.actionsToString(finallyBody, knownAddreses, constantPool, version,hex);
|
||||
ret += Action.actionsToString(finallyBody, knownAddreses, constantPool, version, hex);
|
||||
ret += "}";
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.util.List;
|
||||
|
||||
public class DefineLocalTreeItem extends TreeItem implements SetTypeTreeItem{
|
||||
public class DefineLocalTreeItem extends TreeItem implements SetTypeTreeItem {
|
||||
|
||||
public GraphTargetItem name;
|
||||
public GraphTargetItem value;
|
||||
@@ -46,7 +46,7 @@ public class DefineLocalTreeItem extends TreeItem implements SetTypeTreeItem{
|
||||
ret.addAll(name.getNeededSources());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getObject() {
|
||||
return new DefineLocalTreeItem(src, name, null);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ForInTreeItem extends LoopTreeItem implements Block {
|
||||
public String toString(ConstantPool constants) {
|
||||
String ret = "";
|
||||
ret += "loop" + loop.id + ":\r\n";
|
||||
ret += hilight("for(") + ((variableName instanceof DirectValueTreeItem)&&(((DirectValueTreeItem)variableName).value instanceof RegisterNumber)?"var ":"")+stripQuotes(variableName) + " in " + enumVariable.toString(constants) + ")\r\n{\r\n";
|
||||
ret += hilight("for(") + ((variableName instanceof DirectValueTreeItem) && (((DirectValueTreeItem) variableName).value instanceof RegisterNumber) ? "var " : "") + stripQuotes(variableName) + " in " + enumVariable.toString(constants) + ")\r\n{\r\n";
|
||||
for (GraphTargetItem ti : commands) {
|
||||
ret += ti.toStringSemicoloned(constants) + "\r\n";
|
||||
}
|
||||
|
||||
@@ -22,4 +22,8 @@ public interface GraphSourceItem {
|
||||
public boolean ignoredLoops();
|
||||
|
||||
public List<Integer> getBranches(GraphSource code);
|
||||
|
||||
public boolean isIgnored();
|
||||
|
||||
public void setIgnored(boolean ignored);
|
||||
}
|
||||
|
||||
@@ -1263,7 +1263,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
} else {
|
||||
int bi = abcPanel.detailPanel.methodTraitPanel.methodCodePanel.getBodyIndex();
|
||||
if (bi != -1) {
|
||||
cnt += abcPanel.abc.bodies[bi].removeTraps(abcPanel.abc.constants);
|
||||
cnt += abcPanel.abc.bodies[bi].removeTraps(abcPanel.abc.constants, abcPanel.abc);
|
||||
}
|
||||
abcPanel.detailPanel.methodTraitPanel.methodCodePanel.setBodyIndex(bi, abcPanel.abc);
|
||||
}
|
||||
@@ -1319,6 +1319,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
Main.stopWork();
|
||||
JOptionPane.showMessageDialog(null, "Identifiers renamed: " + cnt);
|
||||
abcPanel.reload();
|
||||
doFilter();
|
||||
return true;
|
||||
}
|
||||
}.execute();
|
||||
@@ -1354,9 +1355,9 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
if (deobfuscationDialog.codeProcessingLevel.getValue() == DeobfuscationDialog.LEVEL_REMOVE_DEAD_CODE) {
|
||||
abcPanel.abc.bodies[bi].removeDeadCode(abcPanel.abc.constants);
|
||||
} else if (deobfuscationDialog.codeProcessingLevel.getValue() == DeobfuscationDialog.LEVEL_REMOVE_TRAPS) {
|
||||
abcPanel.abc.bodies[bi].removeTraps(abcPanel.abc.constants);
|
||||
abcPanel.abc.bodies[bi].removeTraps(abcPanel.abc.constants, abcPanel.abc);
|
||||
} else if (deobfuscationDialog.codeProcessingLevel.getValue() == DeobfuscationDialog.LEVEL_RESTORE_CONTROL_FLOW) {
|
||||
abcPanel.abc.bodies[bi].removeTraps(abcPanel.abc.constants);
|
||||
abcPanel.abc.bodies[bi].removeTraps(abcPanel.abc.constants, abcPanel.abc);
|
||||
abcPanel.abc.bodies[bi].restoreControlFlow(abcPanel.abc.constants);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public class TagNode {
|
||||
}
|
||||
String ret;
|
||||
if (isPcode) {
|
||||
ret = Highlighting.stripHilights(((ASMSource) node.tag).getASMSource(SWF.DEFAULT_VERSION,false));
|
||||
ret = Highlighting.stripHilights(((ASMSource) node.tag).getASMSource(SWF.DEFAULT_VERSION, false));
|
||||
} else {
|
||||
List<Action> as = ((ASMSource) node.tag).getActions(SWF.DEFAULT_VERSION);
|
||||
Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION);
|
||||
|
||||
@@ -38,8 +38,8 @@ public class FlashPlayerPanel extends Panel {
|
||||
IntByReference ibr = new IntByReference();
|
||||
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{2}, 1, ibr, null);
|
||||
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{
|
||||
(byte) (getWidth() / 256), (byte) (getWidth() % 256),
|
||||
(byte) (getHeight() / 256), (byte) (getHeight() % 256),}, 4, ibr, null);
|
||||
(byte) (getWidth() / 256), (byte) (getWidth() % 256),
|
||||
(byte) (getHeight() / 256), (byte) (getHeight() % 256),}, 4, ibr, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,6 @@ public class SHELLEXECUTEINFO extends Structure {
|
||||
@Override
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"cbSize", "fMask", "hwnd", "lpVerb", "lpFile", "lpParameters", "lpDirectory", "nShow", "hInstApp", "lpIDList",
|
||||
"lpClass", "hKeyClass", "dwHotKey", "hMonitor", "hProcess"});
|
||||
"lpClass", "hKeyClass", "dwHotKey", "hMonitor", "hProcess"});
|
||||
}
|
||||
}
|
||||
@@ -610,7 +610,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
*/
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"left", "top", "right",
|
||||
"bottom"});
|
||||
"bottom"});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -89,8 +89,8 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"cbSize", "flags",
|
||||
"hwndActive", "hwndFocus", "hwndCapture", "hwndMenuOwner",
|
||||
"hwndMoveSize", "hwndCaret", "rcCaret"});
|
||||
"hwndActive", "hwndFocus", "hwndCapture", "hwndMenuOwner",
|
||||
"hwndMoveSize", "hwndCaret", "rcCaret"});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +109,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"cbSize", "rcWindow",
|
||||
"rcClient", "dwStyle", "dwExStyle", "dwWindowStatus",
|
||||
"cxWindowBorders", "cyWindowBorders", "atomWindowType",
|
||||
"wCreatorVersion"});
|
||||
"rcClient", "dwStyle", "dwExStyle", "dwWindowStatus",
|
||||
"cxWindowBorders", "cyWindowBorders", "atomWindowType",
|
||||
"wCreatorVersion"});
|
||||
}
|
||||
}
|
||||
int GWL_EXSTYLE = -20;
|
||||
@@ -168,7 +168,7 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"hWnd", "message", "wParam",
|
||||
"lParam", "time", "pt"});
|
||||
"lParam", "time", "pt"});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"cbSize", "hWnd", "dwFlags",
|
||||
"uCount", "dwTimeout"});
|
||||
"uCount", "dwTimeout"});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"BlendOp", "BlendFlags",
|
||||
"SourceConstantAlpha", "AlphaFormat"});
|
||||
"SourceConstantAlpha", "AlphaFormat"});
|
||||
}
|
||||
}
|
||||
int VK_SHIFT = 16;
|
||||
@@ -332,7 +332,7 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"vkCode", "scanCode", "flags",
|
||||
"time", "dwExtraInfo"});
|
||||
"time", "dwExtraInfo"});
|
||||
}
|
||||
}
|
||||
int SM_CXSCREEN = 0;
|
||||
@@ -690,7 +690,7 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"wVk", "wScan", "dwFlags",
|
||||
"time", "dwExtraInfo"});
|
||||
"time", "dwExtraInfo"});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"dx", "dy", "mouseData",
|
||||
"dwFlags", "time", "dwExtraInfo"});
|
||||
"dwFlags", "time", "dwExtraInfo"});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -834,9 +834,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
@Override
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[]{"cbSize", "style",
|
||||
"lpfnWndProc", "cbClsExtra", "cbWndExtra", "hInstance",
|
||||
"hIcon", "hCursor", "hbrBackground", "lpszMenuName",
|
||||
"lpszClassName", "hIconSm"});
|
||||
"lpfnWndProc", "cbClsExtra", "cbWndExtra", "hInstance",
|
||||
"hIcon", "hCursor", "hbrBackground", "lpszMenuName",
|
||||
"lpszClassName", "hIconSm"});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,9 +185,10 @@ public class Helper {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static String bytesToHexString(byte bytes[]){
|
||||
return bytesToHexString(bytes,0);
|
||||
public static String bytesToHexString(byte bytes[]) {
|
||||
return bytesToHexString(bytes, 0);
|
||||
}
|
||||
|
||||
public static String bytesToHexString(byte bytes[], int start) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (start < bytes.length) {
|
||||
@@ -323,12 +324,12 @@ public class Helper {
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public static String stripComments(String str){
|
||||
|
||||
public static String stripComments(String str) {
|
||||
return str.replaceAll("<ffdec:hex>[^\r\n]*</ffdec:hex>\r?\n", "");
|
||||
}
|
||||
|
||||
public static String hexToComments(String str){
|
||||
|
||||
public static String hexToComments(String str) {
|
||||
return str.replaceAll("<ffdec:hex>([^\r\n]*)</ffdec:hex>(\r?\n)", "; $1$2");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,8 +115,8 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT
|
||||
* @param version SWF version
|
||||
* @return ASM source
|
||||
*/
|
||||
public String getASMSource(int version,boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version,hex);
|
||||
public String getASMSource(int version, boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version, hex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -71,8 +71,8 @@ public class DoActionTag extends Tag implements ASMSource {
|
||||
* @return ASM source
|
||||
*/
|
||||
@Override
|
||||
public String getASMSource(int version,boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version,hex);
|
||||
public String getASMSource(int version, boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version, hex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -93,8 +93,8 @@ public class DoInitActionTag extends CharacterTag implements ASMSource {
|
||||
* @return ASM source
|
||||
*/
|
||||
@Override
|
||||
public String getASMSource(int version,boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version,hex);
|
||||
public String getASMSource(int version, boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version, hex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface ASMSource {
|
||||
* @param hex Add hexadecimal?
|
||||
* @return ASM source
|
||||
*/
|
||||
public String getASMSource(int version,boolean hex);
|
||||
public String getASMSource(int version, boolean hex);
|
||||
|
||||
/**
|
||||
* Whether or not this object contains ASM source
|
||||
|
||||
@@ -111,8 +111,8 @@ public class BUTTONCONDACTION implements ASMSource {
|
||||
* @param version SWF version
|
||||
* @return ASM source
|
||||
*/
|
||||
public String getASMSource(int version,boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version,hex);
|
||||
public String getASMSource(int version, boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version, hex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,8 +78,8 @@ public class CLIPACTIONRECORD implements ASMSource {
|
||||
* @param version SWF version
|
||||
* @return ASM source
|
||||
*/
|
||||
public String getASMSource(int version,boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version,hex);
|
||||
public String getASMSource(int version, boolean hex) {
|
||||
return Action.actionsToString(getActions(version), null, version, hex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user