diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a467ece6..c02b05393 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added +- [#2321] Commandline option to generate HTML docs for AS1/2 Actions + ### Fixed - [#2319] AS3 Compound assignments problems in some cases - [#2319] AS3 direct editation - class gets removed after pressing cancel @@ -3574,6 +3577,7 @@ Major version of SWF to XML export changed to 2. [alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9 [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 +[#2321]: https://www.free-decompiler.com/flash/issues/2321 [#2319]: https://www.free-decompiler.com/flash/issues/2319 [#2320]: https://www.free-decompiler.com/flash/issues/2320 [#943]: https://www.free-decompiler.com/flash/issues/943 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As12PCodeDocs.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As12PCodeDocs.java index 5be621560..877fa863f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As12PCodeDocs.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As12PCodeDocs.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.docs; import com.jpexs.decompiler.flash.ApplicationInfo; +import static com.jpexs.decompiler.flash.docs.As3PCodeDocs.NEWLINE; import com.jpexs.helpers.Helper; import com.jpexs.helpers.utf8.Utf8Helper; import java.io.InputStream; @@ -297,6 +298,8 @@ public class As12PCodeDocs extends AbstractDocs { jsData += "var txt_filter_order_name = \"" + getProperty("ui.filter.order.name") + "\";" + NEWLINE; jsData += "var order_set = \"name\";"; + jsData += "var flags_set = {};" + NEWLINE; + jsData += "var flags = null;" + NEWLINE; StringBuilder sb = new StringBuilder(); sb.append(htmlHeader(jsData + getJs(), getStyle(), nightMode)); sb.append(""; t += ""; - t += "
"; - t += "" + txt_filter_hide + "
"; - for (var flag in flags) { - var flagDesc = flags[flag]; - var flagSet = flags_set[flag]; - t += '
'; + if (flags !== null) { + t += "
"; + + t += "" + txt_filter_hide + "
"; + + for (var flag in flags) { + var flagDesc = flags[flag]; + var flagSet = flags_set[flag]; + t += '
'; + } + t += "
"; } t += "
"; @@ -137,7 +142,6 @@ function init() { t += ""; t += ""; t += "
"; - t += "
"; t += ""; //.filter diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index da6d1536f..d7c1cb6c8 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -53,6 +53,7 @@ import com.jpexs.decompiler.flash.amf.amf3.Traits; import com.jpexs.decompiler.flash.amf.amf3.types.ObjectType; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.configuration.ConfigurationItem; +import com.jpexs.decompiler.flash.docs.As12PCodeDocs; import com.jpexs.decompiler.flash.docs.As3PCodeDocs; import com.jpexs.decompiler.flash.exporters.BinaryDataExporter; import com.jpexs.decompiler.flash.exporters.DualPdfGraphics2D; @@ -409,6 +410,7 @@ public class CommandLineArgumentParser { if (filter == null || filter.equals("doc")) { out.println(PREFIX + "-doc -type as3.pcode.instructions -format html"); + out.println(PREFIX + "-doc -type as12.pcode.instructions -format html"); out.println(PREFIX + "-doc -type as3.pcode.instructions -format html -locale en -out as3_docs_en.html"); exampleFound = true; } @@ -3467,12 +3469,7 @@ public class CommandLineArgumentParser { if (format == null) { format = "html"; } - if (type == null) { - badArguments("doc"); - } else if (!type.equals("as3.pcode.instructions")) { - badArguments("doc"); - } - + if (!format.equals("html")) { badArguments("doc"); } @@ -3480,8 +3477,16 @@ public class CommandLineArgumentParser { Locale.setDefault(Locale.forLanguageTag(locale)); } - String doc = As3PCodeDocs.getAllInstructionDocs(nightMode); - + String doc = ""; + if (type == null) { + badArguments("doc"); + } else if (type.equals("as3.pcode.instructions")) { + doc = As3PCodeDocs.getAllInstructionDocs(nightMode); + } else if (type.equals("as12.pcode.instructions")) { + doc = As12PCodeDocs.getAllInstructionDocs(nightMode); + } else { + badArguments("doc"); + } PrintStream outStream; if (out == null) { diff --git a/src/com/jpexs/decompiler/flash/console/help.txt b/src/com/jpexs/decompiler/flash/console/help.txt index 8188a8344..37a57cda1 100644 --- a/src/com/jpexs/decompiler/flash/console/help.txt +++ b/src/com/jpexs/decompiler/flash/console/help.txt @@ -197,8 +197,9 @@ alias /? -doc -type [-out ] [-format ] [-locale ] Generate documentation. -type Selects documentation type - can be currently only: as3.pcode.instructions for list - of ActionScript3 AVM2 instructions + can be: + as3.pcode.instructions - AVM2 instruction list + as12.pcode.instructions - AVM1 action list -out (optional) If specified, output is written to instead of stdout -format (optional, html is default) Selects output format