diff --git a/CHANGELOG.md b/CHANGELOG.md index 03de1a76d..faf6cd991 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 +- AS3 Document class is underlined and has different icon + ### Fixed - [#2536] AS3 switches detection incorrectly replaces basic ifs with strict equals - [#2536] AS3 switches detection not handling loops diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 938f95379..18e6e360d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -264,7 +264,7 @@ public class ScriptPack extends AS3ClassTreeItem { if (getOpenable() instanceof SWF) { swfVersion = ((SWF) getOpenable()).version; } - + int sinit_index = abc.script_info.get(scriptIndex).init_index; int sinit_bodyIndex = abc.findBodyIndex(sinit_index); if (sinit_bodyIndex != -1 && (isSimple || traitIndices.isEmpty())) { @@ -283,7 +283,7 @@ public class ScriptPack extends AS3ClassTreeItem { } ScopeStack scopeStack = new ScopeStack(); scopeStack.push(new GlobalAVM2Item(null, null)); - + for (int t : traitIndices) { Trait trait = traits.get(t); Multiname name = trait.getName(abc); @@ -312,12 +312,12 @@ public class ScriptPack extends AS3ClassTreeItem { */ @SuppressWarnings("unchecked") private void appendTo(Set usedDeobfuscations, AbcIndexing abcIndex, GraphTextWriter writer, List traits, ConvertData convertData, ScriptExportMode exportMode, boolean parallel, boolean exportAllClasses) throws InterruptedException { - + int swfVersion = -1; if (getOpenable() instanceof SWF) { swfVersion = ((SWF) getOpenable()).version; } - + boolean first = true; //script initializer int script_init = abc.script_info.get(scriptIndex).init_index; @@ -344,7 +344,7 @@ public class ScriptPack extends AS3ClassTreeItem { Trait trait = traits.get(t); traitList.add(trait); } - + List fullyQualifiedNames = new ArrayList<>(); for (int t = 0; t < traitList.size(); t++) { @@ -371,7 +371,6 @@ public class ScriptPack extends AS3ClassTreeItem { t--; } - if (!first) { writer.newLine(); } @@ -1079,4 +1078,14 @@ public class ScriptPack extends AS3ClassTreeItem { } } } + + public boolean isDocumentClass() { + String documentClass = abc.getSwf().getDocumentClass(); + if (documentClass != null) { + if (documentClass.equals(getClassPath().toRawString())) { + return true; + } + } + return false; + } } diff --git a/src/com/jpexs/decompiler/flash/gui/FolderListPanel.java b/src/com/jpexs/decompiler/flash/gui/FolderListPanel.java index 899f47eab..f810e6d90 100644 --- a/src/com/jpexs/decompiler/flash/gui/FolderListPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/FolderListPanel.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.IdentifiersDeobfuscation; +import com.jpexs.decompiler.flash.abc.ScriptPack; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.gui.tagtree.AbstractTagTree; import com.jpexs.decompiler.flash.tags.DoInitActionTag; @@ -251,6 +252,14 @@ public class FolderListPanel extends JPanel { } Icon icon = ICONS.get(type); + + if (treeItem instanceof ScriptPack) { + ScriptPack sp = (ScriptPack) treeItem; + if (sp.isDocumentClass()) { + icon = View.getIcon("asclassmain32"); + } + } + icon.paintIcon(l, g, x * CELL_WIDTH + BORDER_SIZE + PREVIEW_SIZE / 2 - icon.getIconWidth() / 2, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE / 2 - icon.getIconHeight() / 2); String s = null; if (treeItem instanceof DoInitActionTag) { diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asclassmain16.png b/src/com/jpexs/decompiler/flash/gui/graphics/asclassmain16.png new file mode 100644 index 000000000..fb4a3be6a Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asclassmain16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/asclassmain32.png b/src/com/jpexs/decompiler/flash/gui/graphics/asclassmain32.png new file mode 100644 index 000000000..0e218e25e Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/asclassmain32.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/gotomainclass16.png b/src/com/jpexs/decompiler/flash/gui/graphics/gotomainclass16.png index 4240e722c..fb4a3be6a 100644 Binary files a/src/com/jpexs/decompiler/flash/gui/graphics/gotomainclass16.png and b/src/com/jpexs/decompiler/flash/gui/graphics/gotomainclass16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/gotomainclass32.png b/src/com/jpexs/decompiler/flash/gui/graphics/gotomainclass32.png index 6bb02d2d8..0e218e25e 100644 Binary files a/src/com/jpexs/decompiler/flash/gui/graphics/gotomainclass32.png and b/src/com/jpexs/decompiler/flash/gui/graphics/gotomainclass32.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/AbstractTagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/AbstractTagTree.java index d735d5e20..99d0e940f 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/AbstractTagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/AbstractTagTree.java @@ -229,6 +229,13 @@ public abstract class AbstractTagTree extends JTree { type = TreeNodeType.FOLDER_OPEN; } + if (val instanceof ScriptPack) { + ScriptPack sp = (ScriptPack) val; + if (sp.isDocumentClass()) { + return View.getIcon("asclassmain16"); + } + } + if ((type == TreeNodeType.FOLDER || type == TreeNodeType.FOLDER_OPEN) && val instanceof FolderItem) { FolderItem si = (FolderItem) val; if (!TagTreeRoot.FOLDER_ROOT.equals(si.getName())) { diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java index d1df29356..effa5491f 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.gui.tagtree; import com.jpexs.decompiler.flash.IdentifiersDeobfuscation; +import com.jpexs.decompiler.flash.abc.ScriptPack; import com.jpexs.decompiler.flash.gui.AppStrings; import com.jpexs.decompiler.flash.gui.MainPanel; import com.jpexs.decompiler.flash.gui.TreeNodeType; @@ -243,9 +244,20 @@ public class TagTree extends AbstractTagTree { semiTransparent = true; } int itemIndex = aTree.getFullModel().getItemIndex(val); + + String txt = val.toString(); if (itemIndex > 1) { - setText(val.toString() + " [" + itemIndex + "]"); + txt = txt + " [" + itemIndex + "]"; } + + if (val instanceof ScriptPack) { + ScriptPack sp = (ScriptPack) val; + if (sp.isDocumentClass()) { + txt = "" + txt.replace("&", "&").replace("<", "<").replace(">", ">") + ""; + } + } + + setText(txt); return this; }