diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1fb7b6e..b911aa5aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,6 +99,8 @@ All notable changes to this project will be documented in this file. - [#2525] AMF editor (like in Sol cookie editor) - saving empty standard array `[]` - AS3 - names with custom namespaces not being deobfuscated - AS Debugger - order of trace commands +- AS1/2 print/printNum/printAsBitmap/printAsBitmapNum not correctly + handling bmovie boundingBox parameter ### Changed - Icon of "Deobfuscation options" menu from pile of pills to medkit diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintActionItem.java index f9eae0480..c62c03ef0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintActionItem.java @@ -93,6 +93,12 @@ public class PrintActionItem extends ActionItem { private List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; String charset = asGenerator.getCharset(); + if (boundingBox instanceof DirectValueActionItem) { + DirectValueActionItem directValue = ((DirectValueActionItem) boundingBox); + if (directValue.isString() && "bmovie".equals(directValue.getAsString())) { + return toSourceMerge(localData, generator, asGenerator.pushConstTargetItem("print:"), target, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null); + } + } return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("print:#"), boundingBox, true), target, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapActionItem.java index 2038bfed4..55d04b8c2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapActionItem.java @@ -93,6 +93,12 @@ public class PrintAsBitmapActionItem extends ActionItem { private List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; String charset = asGenerator.getCharset(); + if (boundingBox instanceof DirectValueActionItem) { + DirectValueActionItem directValue = ((DirectValueActionItem) boundingBox); + if (directValue.isString() && "bmovie".equals(directValue.getAsString())) { + return toSourceMerge(localData, generator, asGenerator.pushConstTargetItem("printasbitmap:"), target, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null); + } + } return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), target, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapNumActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapNumActionItem.java index d937004b5..f2f434145 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapNumActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapNumActionItem.java @@ -100,6 +100,13 @@ public class PrintAsBitmapNumActionItem extends ActionItem { } else { lev = new StringAddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num); } + + if (boundingBox instanceof DirectValueActionItem) { + DirectValueActionItem directValue = ((DirectValueActionItem) boundingBox); + if (directValue.isString() && "bmovie".equals(directValue.getAsString())) { + return toSourceMerge(localData, generator, asGenerator.pushConstTargetItem("printasbitmap:"), lev, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null); + } + } return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), lev, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintNumActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintNumActionItem.java index ccdf8f1ca..9a48403ee 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintNumActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PrintNumActionItem.java @@ -100,6 +100,12 @@ public class PrintNumActionItem extends ActionItem { } else { lev = new StringAddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num); } + if (boundingBox instanceof DirectValueActionItem) { + DirectValueActionItem directValue = ((DirectValueActionItem) boundingBox); + if (directValue.isString() && "bmovie".equals(directValue.getAsString())) { + return toSourceMerge(localData, generator, asGenerator.pushConstTargetItem("print:"), lev, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null); + } + } return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("print:#"), boundingBox, true), lev, new ActionGetURL2(0, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java index 998893f40..3f135da7f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java @@ -258,6 +258,12 @@ public class ActionGetURL2 extends Action { } else if (urlStr.startsWith(fscommandPrefix)) { urlString = new DirectValueActionItem(urlStr.substring(fscommandPrefix.length())); doFSCommand = true; + } else if (urlStr.equals("print:")) { + printType = new DirectValueActionItem("bmovie"); + doPrint = true; + } else if (urlStr.equals("printasbitmap:")) { + printType = new DirectValueActionItem("bmovie"); + doPrintAsBitmap = true; } } else if (urlString instanceof StringAddActionItem) { StringAddActionItem sa = (StringAddActionItem) urlString; @@ -289,8 +295,7 @@ public class ActionGetURL2 extends Action { if (doUnload) { output.add(new UnLoadMovieNumActionItem(this, lineStartAction, num)); } else if (doPrint) { - output.add(new PrintNumActionItem(this, lineStartAction, num, - printType)); + output.add(new PrintNumActionItem(this, lineStartAction, num, printType)); } else if (doPrintAsBitmap) { output.add(new PrintAsBitmapNumActionItem(this, lineStartAction, num, printType)); } else {