diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index e24cdd082..c98ca06d9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -861,5 +861,32 @@ public class ABC { for (int i = 0; i < bodies.length; i++) { bodies[i].autoFillStats(this); } + } + + public int findMethodBodyByName(int classId,String methodName){ + if(classId>-1){ + for(Trait t:instance_info[classId].instance_traits.traits){ + if(t instanceof TraitMethodGetterSetter){ + if(t.getName(this).getName(constants, new ArrayList()).equals(methodName)){ + return findBodyIndex(((TraitMethodGetterSetter)t).method_info); + } + } + } + } + return -1; + } + public int findMethodBodyByName(String className,String methodName){ + int classId=findClassByName(className); + return findMethodBodyByName(classId,methodName); + } + + public int findClassByName(String name){ + for(int c=0;c()); List valuesMapping = new ArrayList(); @@ -1496,7 +1497,14 @@ public class AVM2Graph extends Graph { } @Override - protected void finalProcess(List list) { + protected void finalProcess(List list, int level) { + if(level==0){ + if(!list.isEmpty()){ + if(list.get(list.size()-1) instanceof ReturnVoidTreeItem){ + list.remove(list.size()-1); + } + } + } for(int i=0;i list) { + protected void finalProcess(List list,int level) { List ret = Action.checkClass(list); if (ret != list) { list.clear(); @@ -178,7 +178,7 @@ public class ActionGraph extends Graph { next = breakPart; GraphTargetItem ti = checkLoop(next, stopPart, loops); - Loop currentLoop = new Loop(null, next); + Loop currentLoop = new Loop(loops.size(),null, next); loops.add(currentLoop); //switchLoc.getNextPartPath(new ArrayList()); List valuesMapping = new ArrayList(); diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java index 563828b24..40858115e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java @@ -291,23 +291,23 @@ public class Graph { populateParts(head, allParts); } List ret = printGraph(localData, new Stack(), allParts, null, heads.get(0), null, new ArrayList(), new HashMap>()); - finalProcessAll(ret); + finalProcessAll(ret,0); return ret; } - private void finalProcessAll(List list) { - finalProcess(list); + private void finalProcessAll(List list,int level) { + finalProcess(list,level); for (GraphTargetItem item : list) { if (item instanceof Block) { List> subs = ((Block) item).getSubs(); for (List sub : subs) { - finalProcessAll(sub); + finalProcessAll(sub,level+1); } } } } - protected void finalProcess(List list) { + protected void finalProcess(List list,int level) { } protected List getLoopsContinues(List loops) { @@ -831,7 +831,7 @@ public class Graph { if ((!part.nextParts.isEmpty()) && part.nextParts.get(0).leadsTo(part, loopContinues)) { if ((part.nextParts.size() > 1) && part.nextParts.get(1).leadsTo(part, loopContinues)) { if (output.isEmpty()) { - whileTrueLoop = new Loop(part, null); + whileTrueLoop = new Loop(loops.size(),part, null); loops.add(whileTrueLoop); whileTrue = true; } else { @@ -851,8 +851,9 @@ public class Graph { if (loop && output.isEmpty()) { doWhile = false; } - Loop currentLoop = new Loop(part, null); + Loop currentLoop = null; if (loop) { + currentLoop=new Loop(loops.size(),part, null); loops.add(currentLoop); } @@ -863,7 +864,7 @@ public class Graph { } } - if ((part.nextParts.size() > 1) && (!doWhile)) { + if (loop && (part.nextParts.size() > 1) && (!doWhile)) { currentLoop.loopBreak = part.nextParts.get(reversed ? 0 : 1); } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/Loop.java b/trunk/src/com/jpexs/decompiler/flash/graph/Loop.java index daa9014bc..3d0c7569f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/Loop.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Loop.java @@ -25,12 +25,10 @@ public class Loop { public GraphPart loopContinue; public GraphPart loopBreak; public long id; - static long maxLoopId = 0; - public Loop(GraphPart loopContinue, GraphPart loopBreak) { + public Loop(long id, GraphPart loopContinue, GraphPart loopBreak) { this.loopContinue = loopContinue; this.loopBreak = loopBreak; - id = maxLoopId; - maxLoopId++; + this.id=id; } }