diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java index 34ef527df..e2ed433b0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -1848,6 +1848,18 @@ public class Graph { //makeAllCommands(out2, stack); makeAllCommands(onTrue, trueStack); makeAllCommands(onFalse, falseStack); + GraphTargetItem addAfterIf = null; + if (!onTrue.isEmpty() && !onFalse.isEmpty() + && (onTrue.get(onTrue.size() - 1) instanceof ContinueItem) + && (onFalse.get(onFalse.size() - 1) instanceof ContinueItem)) { + ContinueItem contTrue = (ContinueItem) onTrue.get(onTrue.size() - 1); + ContinueItem contFalse = (ContinueItem) onFalse.get(onFalse.size() - 1); + if (contTrue.loopId == contFalse.loopId) { + onTrue.remove(onTrue.size() - 1); + onFalse.remove(onFalse.size() - 1); + addAfterIf = contTrue; + } + } List filteredOnTrue = filter(onTrue); List filteredOnFalse = filter(onFalse); @@ -1903,6 +1915,9 @@ public class Graph { } } } + if (addAfterIf != null) { + currentRet.add(addAfterIf); + } //currentRet.addAll(out2); if (next != null) { printGraph(foundGotos, partCodes, partCodePos, visited, localData, stack, allParts, part, next, stopPart, loops, currentRet, staticOperation, path, recursionLevel + 1); @@ -1944,7 +1959,7 @@ public class Graph { stopContPart.add(currentLoop.loopContinue); GraphPart precoBackup = currentLoop.loopPreContinue; currentLoop.loopPreContinue = null; - loopItem.commands.addAll(printGraph(foundGotos, partCodes, partCodePos, visited, localData, new TranslateStack(path), allParts, null, precoBackup, stopContPart, loops, null, staticOperation, path, recursionLevel + 1)); + loopItem.commands.addAll(printGraph(foundGotos, partCodes, partCodePos, visited, localData, stack, allParts, null, precoBackup, stopContPart, loops, null, staticOperation, path, recursionLevel + 1)); checkContinueAtTheEnd(loopItem.commands, currentLoop); } } diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ClassTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ClassTest.java index 5226614b3..d77bcaaa6 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ClassTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ClassTest.java @@ -24,7 +24,7 @@ public class ActionScript3ClassTest extends ActionScript3DecompileTestBase { @BeforeClass public void init() throws IOException, InterruptedException { - addSwf("standard", "testdata/flashdevelop/bin/flashdevelop.swf"); + addSwf("standard", "testdata/flashdevelop/bin/Main.flex.swf"); } private void decompileScriptPack(String path, String expectedResult) { diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ClassicDecompileTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ClassicDecompileTest.java index 14a9c26e0..168a28cee 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ClassicDecompileTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ClassicDecompileTest.java @@ -12,7 +12,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes @BeforeClass public void init() throws IOException, InterruptedException { - addSwf("classic", "testdata/flashdevelop/bin/flashdevelop.swf"); + addSwf("classic", "testdata/flashdevelop/bin/Main.flex.swf"); } @Test diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3OptinalParametersTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3OptinalParametersTest.java index 43b7594c8..64b3e614a 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3OptinalParametersTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3OptinalParametersTest.java @@ -21,7 +21,7 @@ public class ActionScript3OptinalParametersTest extends ActionScript3DecompileTe @BeforeClass public void init() throws IOException, InterruptedException { - addSwf("standard", "testdata/flashdevelop/bin/flashdevelop.swf"); + addSwf("standard", "testdata/flashdevelop/bin/Main.flex.swf"); } @Test public void testOptionalParameters() { diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java index 0acfabd45..6c220e782 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java @@ -170,7 +170,7 @@ public class AS3Generator { Configuration.autoDeobfuscate.set(false); - useFile("ActionScript3ClassicDecompileTest", new String[][]{{"testdata/flashdevelop/bin/flashdevelop.swf", "classic"}}, false); + useFile("ActionScript3ClassicDecompileTest", new String[][]{{"testdata/flashdevelop/bin/Main.flex.swf", "classic"}}, false); useFile("ActionScript3CrossCompileDecompileTest", new String[][]{ {"testdata/cross_compile/bin/Main.flex.swf", "flex"}, {"testdata/cross_compile/bin/Main.air.swf", "air"} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/Main.air.swf b/libsrc/ffdec_lib/testdata/flashdevelop/bin/Main.air.swf new file mode 100644 index 000000000..979a2b2ce Binary files /dev/null and b/libsrc/ffdec_lib/testdata/flashdevelop/bin/Main.air.swf differ diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/Main.flex.swf b/libsrc/ffdec_lib/testdata/flashdevelop/bin/Main.flex.swf new file mode 100644 index 000000000..2be5ec89b Binary files /dev/null and b/libsrc/ffdec_lib/testdata/flashdevelop/bin/Main.flex.swf differ diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf b/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf deleted file mode 100644 index 0fb90acee..000000000 Binary files a/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf and /dev/null differ diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop_asc2.swf b/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop_asc2.swf deleted file mode 100644 index f03ccb95a..000000000 Binary files a/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop_asc2.swf and /dev/null differ diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop_flex.swf b/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop_flex.swf deleted file mode 100644 index 1d4874e92..000000000 Binary files a/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop_flex.swf and /dev/null differ diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/build_air_debug.bat b/libsrc/ffdec_lib/testdata/flashdevelop/build_air_debug.bat new file mode 100644 index 000000000..232d09b75 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/build_air_debug.bat @@ -0,0 +1,3 @@ +@echo off +set COMPILERKIND=air +call c:\air\bin\mxmlc.bat -warnings=false -debug=true -output bin/Main.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1 \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/build_flex_debug.bat b/libsrc/ffdec_lib/testdata/flashdevelop/build_flex_debug.bat new file mode 100644 index 000000000..76c857b14 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/build_flex_debug.bat @@ -0,0 +1,3 @@ +@echo off +set COMPILERKIND=flex +c:\flex\bin\mxmlc.exe -warnings=false -debug=true -output bin/Main.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1 \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/flashdevelop.as3proj b/libsrc/ffdec_lib/testdata/flashdevelop/flashdevelop.as3proj index dc5a96974..a8df93d1c 100644 --- a/libsrc/ffdec_lib/testdata/flashdevelop/flashdevelop.as3proj +++ b/libsrc/ffdec_lib/testdata/flashdevelop/flashdevelop.as3proj @@ -4,7 +4,7 @@ - + @@ -12,6 +12,7 @@ + @@ -81,7 +82,7 @@ - + build_air_debug.bat