Added: AS3 Document class is underlined and has different icon

This commit is contained in:
Jindra Petřík
2025-10-05 19:00:51 +02:00
parent 5db66ae32b
commit bd47698c1a
9 changed files with 47 additions and 7 deletions

View File

@@ -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

View File

@@ -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<String> usedDeobfuscations, AbcIndexing abcIndex, GraphTextWriter writer, List<Trait> 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<DottedChain> 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;
}
}

View File

@@ -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) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -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())) {

View File

@@ -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 = "<html><u>" + txt.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;") + "</u></html>";
}
}
setText(txt);
return this;
}