diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/graph/AVM2Graph.java b/trunk/src/com/jpexs/asdec/abc/avm2/graph/AVM2Graph.java index 968a34de9..4a3a33d08 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/graph/AVM2Graph.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/graph/AVM2Graph.java @@ -124,7 +124,9 @@ public class AVM2Graph extends Graph { private List getLoopsContinues(List loops) { List ret = new ArrayList(); for (Loop l : loops) { - ret.add(l.loopContinue); + if (l.loopContinue != null) { + ret.add(l.loopContinue); + } } return ret; } @@ -310,14 +312,12 @@ public class AVM2Graph extends Graph { List> caseCommands = new ArrayList>(); GraphPart next = null; - List loopContinues = new ArrayList(); - for (Loop l : loops) { - if (l.loopContinue != null) { - loopContinues.add(l.loopContinue); - } - } + List loopContinues = getLoopsContinues(loops); next = switchLoc.getNextPartPath(loopContinues); + if (next == null) { + next = switchLoc.getNextSuperPartPath(loopContinues); + } /*for (GraphPart p : allParts) { if (p.start == switchLoc.end + 1) { next = p; @@ -326,7 +326,8 @@ public class AVM2Graph extends Graph { }*/ TreeItem ti = checkLoop(next, stopPart, loops); - loops.add(new Loop(null, next)); + Loop currentLoop = new Loop(null, next); + loops.add(currentLoop); //switchLoc.getNextPartPath(new ArrayList()); List valuesMapping = new ArrayList(); List caseBodies = new ArrayList(); @@ -375,7 +376,7 @@ public class AVM2Graph extends Graph { SwitchTreeItem sti = new SwitchTreeItem(null, next == null ? -1 : next.start, switchedObject, caseValues, caseCommands, defaultCommands, valuesMapping); ret.add(sti); - + loops.remove(currentLoop); if (next != null) { if (ti != null) { ret.add(ti); @@ -539,9 +540,12 @@ public class AVM2Graph extends Graph { if (ip != part.start) { part = null; for (GraphPart p : allParts) { - if (p.start == ip) { - part = p; - break; + List ps = p.getSubParts(); + for (GraphPart p2 : ps) { + if (p2.start == ip) { + part = p2; + break; + } } } ret.addAll(output); @@ -810,7 +814,8 @@ public class AVM2Graph extends Graph { } else { if ((p != stopPart) && (p.refs.size() > 1)) { ContinueTreeItem cti = new ContinueTreeItem(null, -1); - p.forContinues.add(cti); + //p.forContinues.add(cti); + ret.add(new CommentTreeItem(null, "Unknown jump")); ret.add(cti); } }