diff --git a/CHANGELOG.md b/CHANGELOG.md index 7acf5e37f..9cd459790 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,7 @@ All notable changes to this project will be documented in this file. - FreeTransform not showing in situations like GFX or importAssets - [#2237] AS3 direct editation - usages of import colliding with toplevel classes must be fully qualified +- [#2234] AS1/2 postincrement/decrement inside DefineFunction2 ### Changed - [#2185] MochiCrypt no longer offered for auto decrypt, user needs to choose variant from "Use unpacker" menu @@ -3472,6 +3473,7 @@ Major version of SWF to XML export changed to 2. [#2253]: https://www.free-decompiler.com/flash/issues/2253 [#2239]: https://www.free-decompiler.com/flash/issues/2239 [#2237]: https://www.free-decompiler.com/flash/issues/2237 +[#2234]: https://www.free-decompiler.com/flash/issues/2234 [#2206]: https://www.free-decompiler.com/flash/issues/2206 [#2100]: https://www.free-decompiler.com/flash/issues/2100 [#2123]: https://www.free-decompiler.com/flash/issues/2123 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPop.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPop.java index d7d89c517..9d166b46c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPop.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPop.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SecondPassData; import com.jpexs.decompiler.graph.TranslateStack; +import com.jpexs.decompiler.graph.model.AnyItem; import com.jpexs.helpers.utf8.Utf8Helper; import java.util.HashMap; import java.util.List; @@ -59,6 +60,9 @@ public class ActionPop extends Action { @Override public void translate(Map> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartAction, TranslateStack stack, List output, HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { GraphTargetItem val = stack.pop(); + if (val instanceof AnyItem) { + return; + } output.add(val); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java index 1c73fecf4..b480ef502 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java @@ -42,6 +42,7 @@ import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SecondPassData; import com.jpexs.decompiler.graph.TranslateStack; +import com.jpexs.decompiler.graph.model.AnyItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import java.io.IOException; import java.util.HashMap; @@ -148,7 +149,7 @@ public class ActionStoreRegister extends Action implements StoreTypeAction { if (!stack.isEmpty() && stack.peek().valueEquals(obj)) { stack.pop(); stack.push(new PostIncrementActionItem(this, lineStartAction, obj)); - stack.push(obj); + stack.push(new AnyItem()); //to avoid leaving popped item on output return; } } @@ -157,7 +158,7 @@ public class ActionStoreRegister extends Action implements StoreTypeAction { if (!stack.isEmpty() && stack.peek().valueEquals(obj)) { stack.pop(); stack.push(new PostDecrementActionItem(this, lineStartAction, obj)); - stack.push(obj); + stack.push(new AnyItem()); //to avoid leaving popped item on output return; } } diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java index b42203e1a..1bf269871 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java @@ -2452,4 +2452,17 @@ public class ActionScript2Test extends ActionScript2TestBase { + "trace(\"finish\");\r\n" ); } + + @Test + public void frame89_functionPostIncrementTest() { + compareSrc(89, "function myFunc()\r\n" + + "{\r\n" + + "var _loc2_ = 0;\r\n" + + "var _loc1_ = {};\r\n" + + "var _loc4_ = _loc1_[_loc2_++];\r\n" + + "var _loc3_ = _loc1_[_loc2_--];\r\n" + + "}\r\n" + + "trace(\"functionPostIncrementTest\");\r\n" + ); + } } diff --git a/libsrc/ffdec_lib/testdata/as2/as2.swf b/libsrc/ffdec_lib/testdata/as2/as2.swf index b09d4e27a..be08037ad 100644 Binary files a/libsrc/ffdec_lib/testdata/as2/as2.swf and b/libsrc/ffdec_lib/testdata/as2/as2.swf differ diff --git a/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml b/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml index 07bbf7558..718ca4fbb 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml @@ -31,7 +31,7 @@ - + @@ -761,9 +761,9 @@ +!3050 7457[3050 7441 3159 7239!3159 7239[3270 7033 3327 6947!3327 6947[3353 6908 3412 6794!3412 6794[3470 6682 3500 6639!3500 6639[3602 6491 3649 6692!3649 6692|3713 6670!3713 6670[3760 6655 3782 6655!3782 6655[3942 6655 3985 6781!3985 + 6781[4007 6844 3996 6914!3996 6914[3996 6948 3999 6995!3999 6995[4000 7031 3993 7054!3993 7054[3976 7106 3860 7224!3860 7224[3847 7237 3741 7292!3741 7292[3638 7346 3616 7372!3616 7372[3594 7396 3511 7442!3511 7442[3435 7483 3427 7483 +!3427 7483[3409 7483 3407 7468!3407 7468[3405 7453 3386 7453!3386 7453[3361 7468 3330 7483!3330 7483[3270 7512 3235 7512!3235 7512[3220 7512 3156 7501!3156 7501[3091 7490 3054 7490!3054 7490[3050 7494 3050 7457"/> + + + + + + @@ -3371,6 +3384,12 @@ trace("finish");]]> + + + + + + @@ -3385,11 +3404,5 @@ trace("finish");]]> - - - - - - \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/NineSlice.xml b/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/NineSlice.xml index bd9a31d14..84d7e0a40 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/NineSlice.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/NineSlice.xml @@ -37,23 +37,30 @@ + - - - - - - - - - - + + + + + + + + + diff --git a/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/blue.xml b/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/blue.xml index 56636e13c..32e670e1f 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/blue.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/blue.xml @@ -36,8 +36,8 @@ trace("init_blue"); - + diff --git a/libsrc/ffdec_lib/testdata/as2/as2/META-INF/metadata.xml b/libsrc/ffdec_lib/testdata/as2/as2/META-INF/metadata.xml index 16c34fecc..2a74b2c4e 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/META-INF/metadata.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/META-INF/metadata.xml @@ -5,8 +5,8 @@ xmlns:xmp="http://ns.adobe.com/xap/1.0/"> Adobe Flash CS4 Professional 2010-08-03T10:48:58+02:00 - 2024-03-17T00:50:46-07:00 - 2024-03-17T00:50:46-07:00 + 2024-08-01T11:46:08-07:00 + 2024-08-01T11:46:08-07:00 @@ -22,7 +22,7 @@ xmp.did:8DD71700DC9EDF1194ADAC9B23608190 xmp.did:F0EB4FF7CAC3ED11AC9DC078F41E1AA7 - xmp.iid:7B15281033E4EE1187F5B2EA9E0AA389 + xmp.iid:D9738656C14FEF119527A7276211BF58 xmp.did:8DD71700DC9EDF1194ADAC9B23608190 @@ -458,6 +458,12 @@ 2010-08-03T10:48:58+02:00 Adobe Flash Professional CS6 - build 481 + + created + xmp.iid:D9738656C14FEF119527A7276211BF58 + 2010-08-03T10:48:58+02:00 + Adobe Flash Professional CS6 - build 481 + diff --git a/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache b/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache index 4210680dc..009e01aac 100644 Binary files a/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache and b/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache differ