diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index dd1cfa414..3ba71ee9e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -382,21 +382,7 @@ public class AVM2Graph extends Graph { ret = new ArrayList<>(); ret.addAll(output); return ret; - } - if(part.nextParts.size() == 2){ - if(stack.peek() instanceof StrictNeqTreeItem){ - System.out.println("1"); - if(part.nextParts.get(1).getHeight() >= 2){ - System.out.println("2"); - if(code.code.get(code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns){ - System.out.println("3"); - if(code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns){ - System.out.println("4"); - } - } - } - } - } + } if (((part.nextParts.size() == 2) && (!stack.isEmpty()) && (stack.peek() instanceof StrictEqTreeItem) diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java index 895f9c917..9bb7030e8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -278,7 +278,10 @@ public class ActionGraph extends Graph { });*/ //GraphPart breakPart = breakParts.isEmpty() ? null : breakParts.get(0); - GraphPart breakPart = getMostCommonPart(caseBodyParts, loops); + List mcp=new ArrayList<>(); + mcp.addAll(caseBodyParts); + mcp.add(defaultPart2); + GraphPart breakPart = getMostCommonPart(mcp, loops); if ((defaultPart2 != breakPart) && (defaultCommands.isEmpty())) { defaultPart = defaultPart2; } @@ -302,6 +305,7 @@ public class ActionGraph extends Graph { GraphTargetItem ti = checkLoop(next, stopPart, loops); currentLoop = new Loop(loops.size(), null, next); + currentLoop.phase = 1; loops.add(currentLoop); //switchLoc.getNextPartPath(new ArrayList()); List valuesMapping = new ArrayList<>(); @@ -325,6 +329,15 @@ public class ActionGraph extends Graph { stopPart2x.add(next); defaultCommands = printGraph(new ArrayList(), localData, stack, allParts, null, defaultPart, stopPart2x, loops); } + + if(!defaultCommands.isEmpty()){ + if(defaultCommands.get(defaultCommands.size()-1) instanceof BreakItem){ + BreakItem bi=(BreakItem)defaultCommands.get(defaultCommands.size()-1); + if(bi.loopId==currentLoop.id){ + defaultCommands.remove(defaultCommands.size()-1); + } + } + } List ignored = new ArrayList<>(); for (Loop l : loops) { @@ -382,7 +395,7 @@ public class ActionGraph extends Graph { ret.addAll(output); SwitchItem sti = new SwitchItem(null, currentLoop, switchedObject, caseValues, caseCommands, defaultCommands, valuesMapping); ret.add(sti); - + currentLoop.phase = 2; if (next != null) { if (ti != null) { ret.add(ti); diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java index 00c237048..70577f88f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java @@ -551,10 +551,10 @@ public class Graph { System.out.println("");*/ getPrecontinues(null, heads.get(0), loops, null); /*System.err.println(""); - for (Loop el : loops) { - System.err.println(el); - } - System.err.println("");//*/ + for (Loop el : loops) { + System.err.println(el); + } + System.err.println("");//*/ List ret = printGraph(new ArrayList(), localData, stack, allParts, null, heads.get(0), null, loops); processIfs(ret); @@ -1743,7 +1743,7 @@ public class Graph { vis.add(p); } first = false; - } + } SwitchItem sw = new SwitchItem(null, swLoop, switchedItem, caseValues, caseCommands, defaultCommands, valueMappings); currentRet.add(sw); swLoop.phase = 2;