Changed: AS1/2: Export names are deobfuscated only when start with __Packages.,

if not, then classical escaping is performed (with quotes)
This commit is contained in:
Jindra Petřík
2025-07-21 20:56:01 +02:00
parent a9763c7151
commit 41118564b3
21 changed files with 163 additions and 37 deletions
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.tags.DoInitActionTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.timeline.FrameScript;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.SerializableImage;
import java.awt.Color;
import java.awt.Dimension;
@@ -256,7 +257,11 @@ public class FolderListPanel extends JPanel {
String expName = tag.getSwf().getExportName(tag.getCharacterId());
if (expName != null && !expName.isEmpty()) {
String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName};
s = IdentifiersDeobfuscation.printIdentifier(false, pathParts[pathParts.length - 1]);
if (expName.startsWith("__Packages.")) {
s = IdentifiersDeobfuscation.printIdentifier(false, pathParts[pathParts.length - 1]);
} else {
s = Helper.escapeExportname(expName, false);
}
}
}
if (s == null) {
@@ -63,6 +63,7 @@ import com.jpexs.decompiler.flash.types.filters.CONVOLUTIONFILTER;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.helpers.ByteArrayRange;
import com.jpexs.helpers.ConcreteClasses;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.ReflectionTools;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -909,7 +910,11 @@ public class GenericTagTreePanel extends GenericTagPanel {
DottedIdentifier di = field.getAnnotation(DottedIdentifier.class);
if (val instanceof String && di != null) {
valStr += " = " + DottedChain.parseNoSuffix(val.toString()).toPrintableString(di.as3());
if (di.exportName()) {
valStr += " = " + Helper.escapeExportname(val.toString(), true);
} else {
valStr += " = " + DottedChain.parseNoSuffix(val.toString()).toPrintableString(di.as3());
}
} else if (val instanceof byte[]) {
valStr += " = " + ((byte[]) val).length + " byte";
} else if (val instanceof ByteArrayRange) {
@@ -89,7 +89,11 @@ public class StringEditor extends JTextArea implements GenericTagEditor {
String newValue = (String) ReflectionTools.getValue(obj, field, index);
DottedIdentifier di = field.getAnnotation(DottedIdentifier.class);
if (di != null) {
newValue = DottedChain.parseNoSuffix(newValue).toPrintableString(di.as3());
if (di.exportName()) {
newValue = Helper.escapeExportname(newValue, false);
} else {
newValue = DottedChain.parseNoSuffix(newValue).toPrintableString(di.as3());
}
}
setText(newValue);
} catch (IllegalArgumentException | IllegalAccessException ex) {
@@ -104,7 +108,11 @@ public class StringEditor extends JTextArea implements GenericTagEditor {
String newValue = getText();
DottedIdentifier di = field.getAnnotation(DottedIdentifier.class);
if (di != null) {
newValue = DottedChain.parsePrintable(newValue).toRawString();
if (di.exportName()) {
newValue = Helper.unescapeExportname(newValue);
} else {
newValue = DottedChain.parsePrintable(newValue).toRawString();
}
}
if (Objects.equals(oldValue, newValue)) {
@@ -90,6 +90,7 @@ import com.jpexs.decompiler.flash.treeitems.AS3ClassTreeItem;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.OpenableList;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.helpers.Helper;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component;
@@ -350,7 +351,11 @@ public class TagTree extends AbstractTagTree {
String expName = tag.getSwf().getExportName(tag.getCharacterId());
if (expName != null && !expName.isEmpty()) {
String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName};
return IdentifiersDeobfuscation.printIdentifier(false, pathParts[pathParts.length - 1]);
if (expName.startsWith("__Packages.")) {
return IdentifiersDeobfuscation.printIdentifier(false, pathParts[pathParts.length - 1]);
} else {
return Helper.escapeExportname(expName, false);
}
}
}
if (value != null) {