mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 10:50:47 +00:00
WIP Safe strings handling
This commit is contained in:
@@ -4354,9 +4354,9 @@ public class CommandLineArgumentParser {
|
||||
if (dcs != null) {
|
||||
if (dcs.contains(".")) {
|
||||
DottedChain dc = DottedChain.parseWithSuffix(dcs);
|
||||
pw.println("documentClass=" + dc.toPrintableString(true));
|
||||
pw.println("documentClass=" + dc.toPrintableString(swf, true));
|
||||
} else {
|
||||
pw.println("documentClass=" + IdentifiersDeobfuscation.printIdentifier(true, dcs));
|
||||
pw.println("documentClass=" + IdentifiersDeobfuscation.printIdentifier(swf, true, dcs));
|
||||
}
|
||||
} else {
|
||||
pw.println("documentClass=");
|
||||
|
||||
@@ -391,13 +391,13 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
CharacterTag ct = (CharacterTag) o;
|
||||
String exportName = ct.getExportName();
|
||||
if (exportName != null) {
|
||||
return Helper.escapeExportname(exportName, false);
|
||||
return Helper.escapeExportname(ct.getSwf(), exportName, false);
|
||||
}
|
||||
Set<String> classNames = ct.getClassNames();
|
||||
if (!classNames.isEmpty()) {
|
||||
List<String> escapedList = new ArrayList<>();
|
||||
for (String className : classNames) {
|
||||
escapedList.add(DottedChain.parseNoSuffix(className).toPrintableString(true));
|
||||
escapedList.add(DottedChain.parseNoSuffix(className).toPrintableString(ct.getSwf(), true));
|
||||
}
|
||||
return String.join(", ", escapedList);
|
||||
}
|
||||
|
||||
@@ -755,7 +755,7 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
pkg = pkg.substring(pkg.indexOf(":") + 1);
|
||||
}
|
||||
|
||||
name = swfHash + ":" + DottedChain.parseWithSuffix(pkg).addWithSuffix(clsNameWithSuffix).toPrintableString(con.isAS3);
|
||||
name = swfHash + ":" + DottedChain.parseWithSuffix(pkg).addWithSuffix(clsNameWithSuffix).toPrintableString(Main.getRunningSWF()/*???*/, con.isAS3);
|
||||
}
|
||||
} else {
|
||||
if (name.contains(":")) {
|
||||
|
||||
@@ -258,9 +258,9 @@ public class FolderListPanel extends JPanel {
|
||||
if (expName != null && !expName.isEmpty()) {
|
||||
String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName};
|
||||
if (expName.startsWith("__Packages.")) {
|
||||
s = IdentifiersDeobfuscation.printIdentifier(false, pathParts[pathParts.length - 1]);
|
||||
s = IdentifiersDeobfuscation.printIdentifier(tag.getSwf(), false, pathParts[pathParts.length - 1]);
|
||||
} else {
|
||||
s = Helper.escapeExportname(expName, false);
|
||||
s = Helper.escapeExportname(tag.getSwf(), expName, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,8 +161,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
super.paint(g, c);
|
||||
}
|
||||
});
|
||||
setCellRenderer(new MyTreeCellRenderer());
|
||||
setCellEditor(new MyTreeCellEditor(this));
|
||||
setCellRenderer(new MyTreeCellRenderer());
|
||||
setInvokesStopCellEditing(true);
|
||||
|
||||
}
|
||||
@@ -293,9 +292,11 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
private final JTree tree;
|
||||
|
||||
private FieldNode fnode;
|
||||
private final SWF swf;
|
||||
|
||||
public MyTreeCellEditor(JTree tree) {
|
||||
public MyTreeCellEditor(JTree tree, SWF swf) {
|
||||
this.tree = tree;
|
||||
this.swf = swf;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -361,7 +362,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
} else if (type.equals(boolean.class) || type.equals(Boolean.class)) {
|
||||
editor = new BooleanEditor(field.getName(), obj, field, index, type);
|
||||
} else if (type.equals(String.class)) {
|
||||
editor = new StringEditor(field.getName(), obj, field, index, type, multiline != null);
|
||||
editor = new StringEditor(field.getName(), obj, field, index, type, multiline != null, swf);
|
||||
} else if (type.equals(RGB.class) || type.equals(RGBA.class) || type.equals(ARGB.class)) {
|
||||
editor = new ColorEditor(field.getName(), obj, field, index, type);
|
||||
} else if (type.equals(byte[].class) || type.equals(ByteArrayRange.class)) {
|
||||
@@ -794,12 +795,13 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
private MyTreeModel model;
|
||||
|
||||
private Object parentObject;
|
||||
private final SWF swf;
|
||||
|
||||
public Object getParentObject() {
|
||||
return parentObject;
|
||||
}
|
||||
|
||||
public FieldNode(Object parent, MyTreeModel model, Tag tag, Object obj, FieldSet fieldSet, int index) {
|
||||
public FieldNode(Object parent, MyTreeModel model, Tag tag, Object obj, FieldSet fieldSet, int index, SWF swf) {
|
||||
this.tag = tag;
|
||||
this.obj = obj;
|
||||
this.fieldSet = fieldSet;
|
||||
@@ -820,6 +822,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.swf = swf;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -911,9 +914,9 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
DottedIdentifier di = field.getAnnotation(DottedIdentifier.class);
|
||||
if (val instanceof String && di != null) {
|
||||
if (di.exportName()) {
|
||||
valStr += " = " + escapeHtml(Helper.escapeExportname(val.toString(), true));
|
||||
valStr += " = " + escapeHtml(Helper.escapeExportname(swf, val.toString(), true));
|
||||
} else {
|
||||
valStr += " = " + escapeHtml(DottedChain.parseNoSuffix(val.toString()).toPrintableString(di.as3()));
|
||||
valStr += " = " + escapeHtml(DottedChain.parseNoSuffix(val.toString()).toPrintableString(swf, di.as3()));
|
||||
}
|
||||
} else if (val instanceof byte[]) {
|
||||
valStr += " = " + ((byte[]) val).length + " byte";
|
||||
@@ -1216,15 +1219,15 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
|
||||
private Object getChild(Object parent, int index, boolean limited) {
|
||||
if (parent == mtroot) {
|
||||
return new FieldNode(null, this, mtroot, mtroot, filterFields(mtroot.getSwf(), this, mtroot.getClass().getSimpleName(), mtroot.getClass(), limited, mtroot.getId()).get(index), -1);
|
||||
return new FieldNode(null, this, mtroot, mtroot, filterFields(mtroot.getSwf(), this, mtroot.getClass().getSimpleName(), mtroot.getClass(), limited, mtroot.getId()).get(index), -1, mtroot.getSwf());
|
||||
}
|
||||
FieldNode fnode = (FieldNode) parent;
|
||||
Field field = fnode.fieldSet.get(FIELD_INDEX);
|
||||
if (ReflectionTools.needsIndex(field) && (fnode.index == -1)) { //Arrays ot Lists
|
||||
return new FieldNode(parent, this, mtroot, fnode.obj, fnode.fieldSet, index);
|
||||
return new FieldNode(parent, this, mtroot, fnode.obj, fnode.fieldSet, index, mtroot.getSwf());
|
||||
}
|
||||
parent = fnode.getValue(FIELD_INDEX);
|
||||
return new FieldNode(parent, this, mtroot, parent, filterFields(mtroot.getSwf(), this, getNodePathName(fnode), parent.getClass(), limited, mtroot.getId()).get(index), -1);
|
||||
return new FieldNode(parent, this, mtroot, parent, filterFields(mtroot.getSwf(), this, getNodePathName(fnode), parent.getClass(), limited, mtroot.getId()).get(index), -1, mtroot.getSwf());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1314,6 +1317,9 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
tree.stopEditing();
|
||||
}
|
||||
tree.setEditable(edit);
|
||||
if (editedTag != null) {
|
||||
tree.setCellEditor(new MyTreeCellEditor(tree, editedTag.getSwf()));
|
||||
}
|
||||
refreshTree();
|
||||
}
|
||||
|
||||
|
||||
@@ -2010,7 +2010,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (!oldName.equals(newName)) {
|
||||
|
||||
if (oldName.equals(abcPanel.decompiledTextArea.getScriptLeaf().getClassPath().className)) {
|
||||
scriptName = abcPanel.decompiledTextArea.getScriptLeaf().getClassPath().packageStr.add(newName, "").toPrintableString(true);
|
||||
scriptName = abcPanel.decompiledTextArea.getScriptLeaf().getClassPath().packageStr.add(newName, "").toPrintableString(swf, true);
|
||||
}
|
||||
|
||||
final String fScriptName = scriptName;
|
||||
@@ -2849,7 +2849,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
String documentClass = swf.getDocumentClass();
|
||||
if (documentClass != null && currentView != VIEW_DUMP) {
|
||||
String documentClassPrintable = DottedChain.parseNoSuffix(documentClass).toPrintableString(true);
|
||||
String documentClassPrintable = DottedChain.parseNoSuffix(documentClass).toPrintableString(swf, true);
|
||||
List<ABCContainerTag> abcList = swf.getAbcList();
|
||||
if (!abcList.isEmpty()) {
|
||||
ABCPanel abcPanel = getABCPanel();
|
||||
|
||||
@@ -967,9 +967,9 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
if (found) {
|
||||
DottedChain scriptNameDc = abc.script_info.get(scriptIndex).getSimplePackName(abc);
|
||||
if (scriptNameDc == null && scriptTraitIndex > -1) {
|
||||
scriptNameDc = abc.script_info.get(scriptIndex).traits.traits.get(scriptTraitIndex).getName(abc).getNameWithNamespace(abc.constants, false);
|
||||
scriptNameDc = abc.script_info.get(scriptIndex).traits.traits.get(scriptTraitIndex).getName(abc).getNameWithNamespace(abc, abc.constants, false);
|
||||
}
|
||||
String scriptName = (scriptNameDc == null ? "script_" + scriptIndex : scriptNameDc.toPrintableString(true));
|
||||
String scriptName = (scriptNameDc == null ? "script_" + scriptIndex : scriptNameDc.toPrintableString(abc.getSwf(), true));
|
||||
//mainPanel.gotoScriptTrait(abc.getSwf(), scriptName, classIndex, globalTraitIndex);
|
||||
mainPanel.gotoScriptMethod(abc.getSwf(), scriptName, searchMethodInfo);
|
||||
}
|
||||
@@ -1000,7 +1000,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
case SCRIPT_INFO:
|
||||
scriptIndex = vwi.getIndex();
|
||||
DottedChain scriptNameDc = abc.script_info.get(scriptIndex).getSimplePackName(abc);
|
||||
String scriptName = (scriptNameDc == null ? "script_" + scriptIndex : scriptNameDc.toPrintableString(true));
|
||||
String scriptName = (scriptNameDc == null ? "script_" + scriptIndex : scriptNameDc.toPrintableString(abc.getSwf(), true));
|
||||
mainPanel.gotoScriptName(abc.getSwf(), scriptName);
|
||||
break;
|
||||
case METHOD_BODY:
|
||||
@@ -1033,9 +1033,9 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
if (scriptIndex != -1) {
|
||||
DottedChain scriptNameDc2 = abc.script_info.get(scriptIndex).getSimplePackName(abc);
|
||||
if (scriptNameDc2 == null && scriptTraitIndex != -1) {
|
||||
scriptNameDc2 = abc.script_info.get(scriptIndex).traits.traits.get(scriptTraitIndex).getName(abc).getNameWithNamespace(abc.constants, false);
|
||||
scriptNameDc2 = abc.script_info.get(scriptIndex).traits.traits.get(scriptTraitIndex).getName(abc).getNameWithNamespace(abc, abc.constants, false);
|
||||
}
|
||||
String scriptName2 = (scriptNameDc2 == null ? "script_" + scriptIndex : scriptNameDc2.toPrintableString(true));
|
||||
String scriptName2 = (scriptNameDc2 == null ? "script_" + scriptIndex : scriptNameDc2.toPrintableString(abc.getSwf(), true));
|
||||
mainPanel.gotoScriptTrait(abc.getSwf(), scriptName2, classIndex, GraphTextWriter.TRAIT_CLASS_INITIALIZER);
|
||||
}
|
||||
break;
|
||||
@@ -1086,10 +1086,10 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
if (scriptIndex != -1) {
|
||||
DottedChain scriptNameDc = abc.script_info.get(scriptIndex).getSimplePackName(abc);
|
||||
if (scriptNameDc == null && scriptTraitIndex != -1) {
|
||||
scriptNameDc = abc.script_info.get(scriptIndex).traits.traits.get(scriptTraitIndex).getName(abc).getNameWithNamespace(abc.constants, false);
|
||||
scriptNameDc = abc.script_info.get(scriptIndex).traits.traits.get(scriptTraitIndex).getName(abc).getNameWithNamespace(abc, abc.constants, false);
|
||||
}
|
||||
|
||||
String scriptName = (scriptNameDc == null ? "script_" + scriptIndex : scriptNameDc.toPrintableString(true));
|
||||
String scriptName = (scriptNameDc == null ? "script_" + scriptIndex : scriptNameDc.toPrintableString(abc.getSwf(), true));
|
||||
mainPanel.gotoScriptTrait(abc.getSwf(), scriptName, classIndex, globalTraitIndex);
|
||||
}
|
||||
|
||||
@@ -1656,7 +1656,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
StringBuilderTextWriter miParamStrSbW = new StringBuilderTextWriter(new CodeFormatting(), miStrSb);
|
||||
mi.getParamStr(miParamStrSbW, abc.constants, null, abc, new ArrayList<>());
|
||||
miStrSb.append("): ");
|
||||
String miReturnType = mi.getReturnTypeRaw(abc.constants, new ArrayList<>());
|
||||
String miReturnType = mi.getReturnTypeRaw(abc, abc.constants, new ArrayList<>());
|
||||
miStrSb.append(miReturnType);
|
||||
return new ValueWithIndex(parent, currentLevelIndex, index, valueType, mi, miStrSb.toString(), title);
|
||||
case METHOD_BODY:
|
||||
@@ -1678,7 +1678,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
if (ii.name_index >= abc.constants.getMultinameCount() || ii.getName(abc.constants).namespace_index >= abc.constants.getNamespaceCount()) {
|
||||
iiName = "";
|
||||
} else {
|
||||
iiName = "\"" + Helper.escapePCodeString(ii.getName(abc.constants).getNameWithNamespace(abc.constants, false).toRawString()) + "\"";
|
||||
iiName = "\"" + Helper.escapePCodeString(ii.getName(abc.constants).getNameWithNamespace(abc, abc.constants, false).toRawString()) + "\"";
|
||||
}
|
||||
return new ValueWithIndex(parent, currentLevelIndex, index, TreeType.INSTANCE_INFO, ii, iiName + (ii.instance_traits.traits.isEmpty() ? "" : ", " + ii.instance_traits.traits.size() + " traits"), title);
|
||||
case CLASS_INFO:
|
||||
|
||||
@@ -936,9 +936,9 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
decompiledTextArea.addScriptListener(setTrait);
|
||||
String scriptName;
|
||||
if (classIndex > -1) {
|
||||
scriptName = newAbc.instance_info.get(classIndex).getName(newAbc.constants).getNameWithNamespace(newAbc.constants, true).toPrintableString(true);
|
||||
scriptName = newAbc.instance_info.get(classIndex).getName(newAbc.constants).getNameWithNamespace(newAbc, newAbc.constants, true).toPrintableString(newAbc.getSwf(), true);
|
||||
} else if (scriptIndex > -1) {
|
||||
scriptName = newAbc.script_info.get(classIndex).getSimplePackName(newAbc).toPrintableString(true);
|
||||
scriptName = newAbc.script_info.get(classIndex).getSimplePackName(newAbc).toPrintableString(newAbc.getSwf(), true);
|
||||
} else {
|
||||
scriptName = "";
|
||||
}
|
||||
@@ -1011,7 +1011,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
swfRef.setVal(ci.abc.getSwf());
|
||||
}
|
||||
|
||||
String scriptNamePrintable = DottedChain.parseWithSuffix(scriptName.toString()).toPrintableString(true);
|
||||
String scriptNamePrintable = DottedChain.parseWithSuffix(scriptName.toString()).toPrintableString(ci.abc.getSwf(), true);
|
||||
|
||||
if (swfRef.getVal() == abc.getSwf()) {
|
||||
hilightScript(getOpenable(), scriptNamePrintable);
|
||||
@@ -1166,7 +1166,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
if (tmgs.kindType == Trait.TRAIT_SETTER) {
|
||||
int[] paramTypes = ti.abc.method_info.get(tmgs.method_info).param_types;
|
||||
if (paramTypes.length == 1) {
|
||||
type = new Path(ti.abc.constants.getMultiname(paramTypes[0]).getNameWithNamespace(ti.abc.constants, false).getStringParts());
|
||||
type = new Path(ti.abc.constants.getMultiname(paramTypes[0]).getNameWithNamespace(ti.abc, ti.abc.constants, false).getStringParts());
|
||||
callType = null;
|
||||
} else {
|
||||
continue;
|
||||
@@ -1548,7 +1548,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
continue;
|
||||
}
|
||||
|
||||
List<Integer> mids = a.constants.getMultinameIds(m, usedAbc.constants);
|
||||
List<Integer> mids = a.constants.getMultinameIds(m, a, usedAbc, usedAbc.constants);
|
||||
for (int mid : mids) {
|
||||
usages.addAll(a.findMultinameDefinition(mid));
|
||||
}
|
||||
@@ -1601,7 +1601,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
if (a == usedAbc) {
|
||||
continue;
|
||||
}
|
||||
List<Integer> mids = a.constants.getMultinameIds(m, usedAbc.constants);
|
||||
List<Integer> mids = a.constants.getMultinameIds(m, a, usedAbc, usedAbc.constants);
|
||||
for (int mid : mids) {
|
||||
usages.addAll(a.findMultinameDefinition(mid));
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class ClassesListTreeModel extends AS3ClassTreeItem implements TreeModel
|
||||
}
|
||||
|
||||
if (flat) {
|
||||
String fullName = packageStr.toPrintableString(true);
|
||||
String fullName = packageStr.toPrintableString(abc.getSwf(), true);
|
||||
boolean defaultPackage = false;
|
||||
if (fullName.length() == 0) {
|
||||
fullName = AppResources.translate("package.default");
|
||||
|
||||
@@ -314,7 +314,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
Highlighting ch = Highlighting.searchPos(highlightedText.getClassHighlights(), pos);
|
||||
int cindex = (int) ch.getProperties().index;
|
||||
ABC abc = getABC();
|
||||
type.setVal(abc.instance_info.get(cindex).getName(abc.constants).getNameWithNamespace(abc.constants, true));
|
||||
type.setVal(abc.instance_info.get(cindex).getName(abc.constants).getNameWithNamespace(abc, abc.constants, true));
|
||||
linkTypeRef.setVal(LinkType.LINK_THIS_SCRIPT);
|
||||
return ch.startPos;
|
||||
}
|
||||
@@ -599,7 +599,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
for (int i = 1; i < abc.constants.getMultinameCount(); i++) {
|
||||
Multiname m = abc.constants.getMultiname(i);
|
||||
if (m != null) {
|
||||
if (typeName.equals(m.getNameWithNamespace(abc.constants, true).toRawString())) {
|
||||
if (typeName.equals(m.getNameWithNamespace(abc, abc.constants, true).toRawString())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -660,7 +660,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
if (tm != null) {
|
||||
String name = "";
|
||||
if (classIndex > -1) {
|
||||
name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants, true).toPrintableString(true);
|
||||
name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc, abc.constants, true).toPrintableString(abc.getSwf(), true);
|
||||
}
|
||||
|
||||
Trait currentTrait = null;
|
||||
@@ -671,7 +671,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
currentTrait = getCurrentTrait();
|
||||
isStatic = abc.isStaticTraitId(classIndex, lastTraitIndex);
|
||||
if (currentTrait != null) {
|
||||
name += ":" + currentTrait.getName(abc).getName(abc.constants, null, false, true);
|
||||
name += ":" + currentTrait.getName(abc).getName(abc, abc.constants, null, false, true);
|
||||
}
|
||||
|
||||
if (currentTrait instanceof TraitSlotConst) {
|
||||
@@ -729,14 +729,14 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
}
|
||||
currentMethodHighlight = null;
|
||||
//currentTrait = null;
|
||||
String name = classIndex == -1 ? "" : abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants, true).toPrintableString(true);
|
||||
String name = classIndex == -1 ? "" : abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc, abc.constants, true).toPrintableString(abc.getSwf(), true);
|
||||
currentTrait = getCurrentTrait();
|
||||
isStatic = abc.isStaticTraitId(classIndex, lastTraitIndex);
|
||||
if (currentTrait != null) {
|
||||
if (!name.isEmpty()) {
|
||||
name += ":";
|
||||
}
|
||||
name += currentTrait.getName(abc).getName(abc.constants, null, false, true);
|
||||
name += currentTrait.getName(abc).getName(abc, abc.constants, null, false, true);
|
||||
}
|
||||
|
||||
int methodId;
|
||||
|
||||
@@ -303,7 +303,7 @@ public class DetailPanel extends JPanel implements TagEditorPanel {
|
||||
traitNameLabel.setText("-");
|
||||
} else if (abcPanel != null) {
|
||||
Multiname traitName = trait.getName(abc);
|
||||
String traitNameStr = traitName == null ? "" : traitName.getName(abc.constants, null, false, true);
|
||||
String traitNameStr = traitName == null ? "" : traitName.getName(abc, abc.constants, null, false, true);
|
||||
traitNameLabel.setText(traitNameStr);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -80,9 +80,9 @@ public class TraitsListItem {
|
||||
return "__" + STR_SCRIPT_INITIALIZER;
|
||||
}
|
||||
if (isStatic) {
|
||||
return abc.class_info.get(classIndex).static_traits.traits.get(index).getName(abc).getName(abc.constants, null, false, true);
|
||||
return abc.class_info.get(classIndex).static_traits.traits.get(index).getName(abc).getName(abc, abc.constants, null, false, true);
|
||||
} else {
|
||||
return abc.instance_info.get(classIndex).instance_traits.traits.get(index).getName(abc).getName(abc.constants, null, false, true);
|
||||
return abc.instance_info.get(classIndex).instance_traits.traits.get(index).getName(abc).getName(abc, abc.constants, null, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public class UsageFrame extends AppDialog implements MouseListener {
|
||||
if (a == abc) {
|
||||
continue;
|
||||
}
|
||||
List<Integer> mids = a.constants.getMultinameIds(m, abc.constants);
|
||||
List<Integer> mids = a.constants.getMultinameIds(m, a, abc, abc.constants);
|
||||
for (int mid : mids) {
|
||||
usages.addAll(definitions ? a.findMultinameDefinition(mid) : a.findMultinameUsage(mid, exactMatch));
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public class UsageFrame extends AppDialog implements MouseListener {
|
||||
cont.add(new FasterScrollPane(usageList), BorderLayout.CENTER);
|
||||
cont.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
setSize(400, 300);
|
||||
setTitle((definitions ? translate("dialog.title.declaration") : translate("dialog.title")) + abc.constants.getMultiname(multinameIndex).getNameWithNamespace(abc.constants, true).toPrintableString(true));
|
||||
setTitle((definitions ? translate("dialog.title.declaration") : translate("dialog.title")) + abc.constants.getMultiname(multinameIndex).getNameWithNamespace(abc, abc.constants, true).toPrintableString(abc.getSwf(), true));
|
||||
View.centerScreen(this);
|
||||
View.setWindowIcon(this);
|
||||
}
|
||||
@@ -164,9 +164,9 @@ public class UsageFrame extends AppDialog implements MouseListener {
|
||||
decompiledTextArea.addScriptListener(setTrait);
|
||||
String scriptName;
|
||||
if (icu.getClassIndex() > -1) {
|
||||
scriptName = icu.getAbc().instance_info.get(icu.getClassIndex()).getName(icu.getAbc().constants).getNameWithNamespace(icu.getAbc().constants, true).toPrintableString(true);
|
||||
scriptName = icu.getAbc().instance_info.get(icu.getClassIndex()).getName(icu.getAbc().constants).getNameWithNamespace(icu.getAbc(), icu.getAbc().constants, true).toPrintableString(icu.getAbc().getSwf(), true);
|
||||
} else if (icu.getScriptIndex() > -1) {
|
||||
scriptName = icu.getAbc().script_info.get(icu.getScriptIndex()).getSimplePackName(icu.getAbc()).toPrintableString(true);
|
||||
scriptName = icu.getAbc().script_info.get(icu.getScriptIndex()).getSimplePackName(icu.getAbc()).toPrintableString(icu.getAbc().getSwf(), true);
|
||||
} else {
|
||||
scriptName = "";
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class MultinameTableModel implements TableModel {
|
||||
if (abc.constants.getMultiname(rowIndex).name_index == -1) {
|
||||
return "";
|
||||
}
|
||||
return abc.constants.getMultiname(rowIndex).getName(abc.constants, null, true, true);
|
||||
return abc.constants.getMultiname(rowIndex).getName(abc, abc.constants, null, true, true);
|
||||
case 3:
|
||||
if (rowIndex == 0) {
|
||||
return "";
|
||||
|
||||
@@ -106,9 +106,9 @@ public class DebuggerTools {
|
||||
int debuggerNs = a.constants.getNamespaceId(Namespace.KIND_PACKAGE, debuggerPkg, 0, true);
|
||||
for (int i = 1; i < a.constants.getMultinameCount(); i++) {
|
||||
Multiname m = a.constants.getMultiname(i);
|
||||
String rawNsName = m.getNameWithNamespace(a.constants, true).toRawString();
|
||||
String rawNsName = m.getNameWithNamespace(a, a.constants, true).toRawString();
|
||||
if (m.kind == Multiname.MULTINAME) {
|
||||
String simpleName = m.getName(a.constants, new ArrayList<>(), true, false);
|
||||
String simpleName = m.getName(a, a.constants, new ArrayList<>(), true, false);
|
||||
String nsToSearch;
|
||||
if (displayTypes.contains(simpleName)) {
|
||||
nsToSearch = "flash.display";
|
||||
@@ -120,7 +120,7 @@ public class DebuggerTools {
|
||||
|
||||
int nsFoundId = -1;
|
||||
for (int ns : a.constants.getNamespaceSet(m.namespace_set_index).namespaces) {
|
||||
String nsString = a.constants.namespaceToString(ns);
|
||||
String nsString = a.constants.namespaceToString(a, ns);
|
||||
if (nsString != null) {
|
||||
if (nsString.equals(nsToSearch)) {
|
||||
nsFoundId = ns;
|
||||
@@ -132,7 +132,7 @@ public class DebuggerTools {
|
||||
m.kind = Multiname.QNAME;
|
||||
m.namespace_index = nsFoundId;
|
||||
m.namespace_set_index = 0;
|
||||
rawNsName = m.getNameWithNamespace(a.constants, true).toRawString();
|
||||
rawNsName = m.getNameWithNamespace(a, a.constants, true).toRawString();
|
||||
}
|
||||
}
|
||||
if (null != rawNsName) {
|
||||
@@ -177,7 +177,7 @@ public class DebuggerTools {
|
||||
ABC a = ct.getABC();
|
||||
for (int i = 1; i < a.constants.getMultinameCount(); i++) {
|
||||
Multiname m = a.constants.getMultiname(i);
|
||||
if ("trace".equals(m.getNameWithNamespace(a.constants, true).toRawString())) {
|
||||
if ("trace".equals(m.getNameWithNamespace(a, a.constants, true).toRawString())) {
|
||||
m.namespace_index = a.constants.getNamespaceId(Namespace.KIND_PACKAGE, debuggerPkg, 0, true);
|
||||
m.name_index = a.constants.getStringId(fname, true);
|
||||
((Tag) ct).setModified(true);
|
||||
@@ -200,7 +200,7 @@ public class DebuggerTools {
|
||||
ABC a = ct.getABC();
|
||||
for (int i = 1; i < a.constants.getMultinameCount(); i++) {
|
||||
Multiname m = a.constants.getMultiname(i);
|
||||
String packageStr = m.getNameWithNamespace(a.constants, true).toString();
|
||||
String packageStr = m.getNameWithNamespace(a, a.constants, true).toString();
|
||||
if (isDebuggerClass(packageStr, "debugTrace")
|
||||
|| isDebuggerClass(packageStr, "debugAlert")
|
||||
|| isDebuggerClass(packageStr, "debugSocket")
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.generictageditors;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.types.annotations.DottedIdentifier;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.helpers.Helper;
|
||||
@@ -44,6 +45,7 @@ public class StringEditor extends JTextArea implements GenericTagEditor {
|
||||
private String fieldName;
|
||||
|
||||
private boolean multiline;
|
||||
private final SWF swf;
|
||||
|
||||
@Override
|
||||
public boolean getScrollableTracksViewportWidth() {
|
||||
@@ -67,7 +69,7 @@ public class StringEditor extends JTextArea implements GenericTagEditor {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public StringEditor(String fieldName, Object obj, Field field, int index, Class<?> type, boolean multiline) {
|
||||
public StringEditor(String fieldName, Object obj, Field field, int index, Class<?> type, boolean multiline, SWF swf) {
|
||||
setLineWrap(true);
|
||||
this.obj = obj;
|
||||
this.field = field;
|
||||
@@ -75,13 +77,14 @@ public class StringEditor extends JTextArea implements GenericTagEditor {
|
||||
this.type = type;
|
||||
this.fieldName = fieldName;
|
||||
this.multiline = multiline;
|
||||
this.swf = swf;
|
||||
if (multiline) {
|
||||
Dimension d = new Dimension(500, 200);
|
||||
setPreferredSize(d);
|
||||
setSize(d);
|
||||
}
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
@@ -90,9 +93,9 @@ public class StringEditor extends JTextArea implements GenericTagEditor {
|
||||
DottedIdentifier di = field.getAnnotation(DottedIdentifier.class);
|
||||
if (di != null) {
|
||||
if (di.exportName()) {
|
||||
newValue = Helper.escapeExportname(newValue, false);
|
||||
newValue = Helper.escapeExportname(swf, newValue, false);
|
||||
} else {
|
||||
newValue = DottedChain.parseNoSuffix(newValue).toPrintableString(di.as3());
|
||||
newValue = DottedChain.parseNoSuffix(newValue).toPrintableString(swf, di.as3());
|
||||
}
|
||||
}
|
||||
setText(newValue);
|
||||
|
||||
@@ -632,4 +632,7 @@ config.name.skipDetectionOfUnitializedClassFields = AS2: Skip detection of unini
|
||||
config.description.skipDetectionOfUnitializedClassFields = Skips detection of uninitialized attributes in AS2 classes which includes decompilation of all scripts in current SWF before accessing any class. Set this to true if you have large obfuscated file and you want to see at least something (= incomplete class).
|
||||
|
||||
config.name.showHeapStatusWidget = Show heap status widget
|
||||
config.description.showHeapStatusWidget = Displays used memory widget in the titlebar.
|
||||
config.description.showHeapStatusWidget = Displays used memory widget in the titlebar.
|
||||
|
||||
config.name.useSafeStr = Use SafeStr notation
|
||||
config.description.useSafeStr = Obfuscated names that are not valid identifiers will be printed as _SafeStr_XX.
|
||||
@@ -352,9 +352,9 @@ public class TagTree extends AbstractTagTree {
|
||||
if (expName != null && !expName.isEmpty()) {
|
||||
String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName};
|
||||
if (expName.startsWith("__Packages.")) {
|
||||
return IdentifiersDeobfuscation.printIdentifier(false, pathParts[pathParts.length - 1]);
|
||||
return IdentifiersDeobfuscation.printIdentifier(tag.getSwf(), false, pathParts[pathParts.length - 1]);
|
||||
} else {
|
||||
return Helper.escapeExportname(expName, false);
|
||||
return Helper.escapeExportname(tag.getSwf(), expName, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3071,7 +3071,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
DottedChain classDottedChain = new DottedChain(parts);
|
||||
|
||||
try {
|
||||
List<Action> regActions = regParser.actionsFromString("Object.registerClass(\"" + Helper.escapePCodeString(identifier) + "\"," + classDottedChain.toPrintableString(false) + ");", swf.getCharset());
|
||||
List<Action> regActions = regParser.actionsFromString("Object.registerClass(\"" + Helper.escapePCodeString(identifier) + "\"," + classDottedChain.toPrintableString(swf, false) + ");", swf.getCharset());
|
||||
regDoInit.setActions(regActions);
|
||||
} catch (ActionParseException | IOException | CompilationException | InterruptedException ex) {
|
||||
//ignore
|
||||
@@ -3116,7 +3116,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
DottedChain dcParent = new DottedChain(partsParent);
|
||||
|
||||
try {
|
||||
List<Action> actions = parser.actionsFromString("class " + classDottedChain.toPrintableString(false) + (classParent.isEmpty() ? "" : " extends " + dcParent.toPrintableString(false)) + "{}", swf.getCharset());
|
||||
List<Action> actions = parser.actionsFromString("class " + classDottedChain.toPrintableString(swf, false) + (classParent.isEmpty() ? "" : " extends " + dcParent.toPrintableString(swf, false)) + "{}", swf.getCharset());
|
||||
classDoInit.setActions(actions);
|
||||
} catch (ActionParseException | IOException | CompilationException | InterruptedException ex) {
|
||||
//ignore
|
||||
@@ -3259,9 +3259,9 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
ActionScript3Parser parser = new ActionScript3Parser(abcIndex);
|
||||
|
||||
DottedChain dc = new DottedChain(pkgParts);
|
||||
String script = "package " + dc.toPrintableString(true) + " {"
|
||||
String script = "package " + dc.toPrintableString(swf, true) + " {"
|
||||
+ (parentClassName.isEmpty() ? "" : "import " + parentClassName + ";")
|
||||
+ "public class " + IdentifiersDeobfuscation.printIdentifier(true, classSimpleName) + (parentClassName.isEmpty() ? "" : " extends " + parentClassName) + " {"
|
||||
+ "public class " + IdentifiersDeobfuscation.printIdentifier(swf, true, classSimpleName) + (parentClassName.isEmpty() ? "" : " extends " + parentClassName) + " {"
|
||||
+ " }"
|
||||
+ "}";
|
||||
parser.addScript(script, fileName, 0, 0, swf.getDocumentClass(), selectedAbcContainer.getABC());
|
||||
@@ -3357,16 +3357,16 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
AbstractTagTreeModel model = mainPanel.getCurrentTree().getFullModel();
|
||||
TreeItem it = pkg;
|
||||
List<String> pkgParts = new ArrayList<>();
|
||||
SWF swf = (SWF) pkg.getOpenable();
|
||||
while (it instanceof AS2Package) {
|
||||
pkg = (AS2Package) it;
|
||||
if (!pkg.isDefaultPackage()) {
|
||||
pkgParts.add(0, DottedChain.parseNoSuffix(pkg.getName()).toPrintableString(false));
|
||||
pkgParts.add(0, DottedChain.parseNoSuffix(pkg.getName()).toPrintableString(swf, false));
|
||||
}
|
||||
it = model.getParent(it);
|
||||
}
|
||||
pkgParts.remove(0);
|
||||
String fullPkgName = String.join(".", pkgParts);
|
||||
SWF swf = (SWF) pkg.getOpenable();
|
||||
AddScriptDialog addScriptDialog = new AddScriptDialog(Main.getDefaultDialogsOwner(), swf);
|
||||
String prefix = fullPkgName;
|
||||
if (!prefix.isEmpty()) {
|
||||
@@ -3489,8 +3489,8 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
ActionScript3Parser parser = new ActionScript3Parser(abcIndex);
|
||||
|
||||
DottedChain dc = new DottedChain(pkgParts);
|
||||
String script = "package " + dc.toPrintableString(true) + " {"
|
||||
+ "public class " + IdentifiersDeobfuscation.printIdentifier(true, classSimpleName) + " {"
|
||||
String script = "package " + dc.toPrintableString(doAbc.getSwf(), true) + " {"
|
||||
+ "public class " + IdentifiersDeobfuscation.printIdentifier(swf, true, classSimpleName) + " {"
|
||||
+ " }"
|
||||
+ "}";
|
||||
parser.addScript(script, fileName, 0, 0, swf.getDocumentClass(), doAbc.getABC());
|
||||
@@ -3946,7 +3946,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
DottedChain dc = new DottedChain(parts);
|
||||
|
||||
try {
|
||||
List<Action> actions = parser.actionsFromString("class " + dc.toPrintableString(false) + "{}", swf.getCharset());
|
||||
List<Action> actions = parser.actionsFromString("class " + dc.toPrintableString(swf, false) + "{}", swf.getCharset());
|
||||
doInit.setActions(actions);
|
||||
} catch (ActionParseException | IOException | CompilationException
|
||||
| InterruptedException ex) {
|
||||
|
||||
Reference in New Issue
Block a user