diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index 2040c4eaf..2b43b0efc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -499,7 +499,7 @@ public class SWFInputStream extends InputStream { */ public static List readActionList(ReReadableInputStream rri, int version, int ip) throws IOException { List retdups = new ArrayList(); - ConstantPool cpool = null; + ConstantPool cpool = new ConstantPool(); Stack stack = new Stack(); @@ -530,9 +530,7 @@ public class SWFInputStream extends InputStream { last = a; } String s = null; - ByteArrayInputStream bais = new ByteArrayInputStream(Action.actionsToBytes(ret, false, version)); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - CopyOutputStream cos = new CopyOutputStream(baos, bais); + Action.setConstantPool(ret, cpool); try { s = Highlighting.stripHilights(Action.actionsToString(ret, null, version)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index ca7249337..ee0f3f8c5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.action.parser.ParsedSymbol; import com.jpexs.decompiler.flash.action.swf4.*; import com.jpexs.decompiler.flash.action.swf5.*; import com.jpexs.decompiler.flash.action.swf6.ActionEnumerate2; +import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2; import com.jpexs.decompiler.flash.action.swf7.ActionTry; import com.jpexs.decompiler.flash.action.treemodel.*; import com.jpexs.decompiler.flash.action.treemodel.clauses.*; @@ -982,4 +983,24 @@ public class Action implements GraphSourceItem { } return ret; } + + public static void setConstantPool(List actions,ConstantPool cpool){ + for(Action a:actions){ + if (a instanceof ActionPush) { + if (cpool != null) { + ((ActionPush) a).constantPool = cpool.constants; + } + } + if (a instanceof ActionDefineFunction) { + if (cpool != null) { + ((ActionDefineFunction) a).setConstantPool(cpool.constants); + } + } + if (a instanceof ActionDefineFunction2) { + if (cpool != null) { + ((ActionDefineFunction2) a).setConstantPool(cpool.constants); + } + } + } + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java index f6e638531..2081f8d5a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java @@ -101,6 +101,6 @@ public class ActionIf extends Action { @Override public boolean ignoredLoops() { - return compileTime; + return false; //compileTime; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index df265a156..62ee1cf97 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -214,7 +214,7 @@ public class ActionPush extends Action { for (Object o : values) { if (o instanceof ConstantIndex) { if ((constantPool == null) || (((ConstantIndex) o).index >= constantPool.size())) { - o = "CONSTNOTFOUND"; + o = "CONSTANT"+((ConstantIndex) o).index; } else { o = constantPool.get(((ConstantIndex) o).index); } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java index 8e42f3c38..1869c7f75 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java @@ -460,6 +460,15 @@ public class Graph { //EMPTY STACK } } + if (part.nextParts.size() == 2) { + if(part.nextParts.get(0)==part.nextParts.get(1)){ + if(!stack.isEmpty()) { + stack.pop(); + } + part.nextParts.remove(0); + } + } + if (part.nextParts.size() == 2) { if ((stack.size() >= 2) && (stack.get(stack.size() - 1) instanceof NotItem) && (((NotItem) (stack.get(stack.size() - 1))).getOriginal() == stack.get(stack.size() - 2))) { @@ -849,10 +858,6 @@ public class Graph { return ret; }*/ - if ((part.nextParts.size() == 1) && (!stack.isEmpty()) && (stack.peek() instanceof DirectValueTreeItem) && ((DirectValueTreeItem) stack.peek()).value instanceof Boolean) { - System.out.println("dd"); - } - List retChecked = null; if ((retChecked = check(code, localData, allParts, stack, parent, part, stopPart, loops, output, forFinalCommands)) != null) { ret.addAll(retChecked); @@ -1182,7 +1187,7 @@ public class Graph { GraphPart p = part.nextParts.get(0); GraphTargetItem lop = checkLoop(p, stopPart, loops); if (lop == null) { - if (p.path.length() == part.path.length()) { + if (p.path.length() >= part.path.length()) { ret.addAll(printGraph(localData, stack, allParts, part, p, stopPart, loops, forFinalCommands)); } else { if ((p != stopPart) && (p.refs.size() > 1)) { @@ -1336,7 +1341,7 @@ public class Graph { } else if (ins.isBranch()) { part.end = ip; allBlocks.add(part); - List branches = ins.getBranches(code); + List branches = ins.getBranches(code); for (int i = 0; i < branches.size(); i++) { part.nextParts.add(g = makeGraph(part, path + i, code, branches.get(i), ip, allBlocks, refs, visited2)); g.refs.add(part);