mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-13 03:22:36 +00:00
goto document class with multiple opened swfs issue fixed
This commit is contained in:
@@ -305,6 +305,7 @@ public class Main {
|
||||
|
||||
@Override
|
||||
protected Object doInBackground() throws Exception {
|
||||
boolean first = true;
|
||||
for (SWFSourceInfo sourceInfo : sourceInfos) {
|
||||
SWF swf = null;
|
||||
try {
|
||||
@@ -319,6 +320,8 @@ public class Main {
|
||||
}
|
||||
|
||||
final SWF swf1 = swf;
|
||||
final boolean first1 = first;
|
||||
first = false;
|
||||
try {
|
||||
Main.startWork(AppStrings.translate("work.creatingwindow") + "...");
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
@@ -331,7 +334,7 @@ public class Main {
|
||||
mainFrame = new MainFrameClassic();
|
||||
}
|
||||
}
|
||||
mainFrame.getPanel().load(swf1);
|
||||
mainFrame.getPanel().load(swf1, first1);
|
||||
if (errorState) {
|
||||
mainFrame.getPanel().setErrorState();
|
||||
}
|
||||
|
||||
@@ -848,11 +848,9 @@ public final class MainFramePanel extends JPanel implements ActionListener, Tree
|
||||
enableDrop(true);
|
||||
}
|
||||
|
||||
public void load(SWF swf) {
|
||||
public void load(SWF swf, boolean first) {
|
||||
List<ContainerItem> objs = new ArrayList<>();
|
||||
if (swf != null) {
|
||||
objs.addAll(swf.tags);
|
||||
}
|
||||
objs.addAll(swf.tags);
|
||||
|
||||
ArrayList<ABCContainerTag> abcList = new ArrayList<>();
|
||||
getActionScript3(objs, abcList);
|
||||
@@ -868,7 +866,7 @@ public final class MainFramePanel extends JPanel implements ActionListener, Tree
|
||||
displayPanel.add(abcPanel, CARDACTIONSCRIPT3PANEL);
|
||||
detailPanel.add(abcPanel.tabbedPane, DETAILCARDAS3NAVIGATOR);
|
||||
}
|
||||
abcPanel.setSwf(abcList, swf);
|
||||
abcPanel.setSwf(swf);
|
||||
} else {
|
||||
if (actionPanel == null) {
|
||||
actionPanel = new ActionPanel(this);
|
||||
@@ -907,6 +905,10 @@ public final class MainFramePanel extends JPanel implements ActionListener, Tree
|
||||
showDetail(DETAILCARDEMPTYPANEL);
|
||||
showCard(CARDEMPTYPANEL);
|
||||
updateUi(swf);
|
||||
|
||||
if (first && Configuration.gotoMainClassOnStartup.get()) {
|
||||
gotoDocumentClass(swf);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUi(final SWF swf) {
|
||||
@@ -918,7 +920,7 @@ public final class MainFramePanel extends JPanel implements ActionListener, Tree
|
||||
boolean hasAbc = !abcList.isEmpty();
|
||||
|
||||
if (hasAbc) {
|
||||
abcPanel.setSwf(abcList, swf);
|
||||
abcPanel.setSwf(swf);
|
||||
}
|
||||
|
||||
if (isWelcomeScreen) {
|
||||
@@ -1067,9 +1069,6 @@ public final class MainFramePanel extends JPanel implements ActionListener, Tree
|
||||
|
||||
splitPos = splitPane2.getDividerLocation();
|
||||
splitsInited = true;
|
||||
if (Configuration.gotoMainClassOnStartup.get()) {
|
||||
gotoDocumentClass(getCurrentSwf());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1535,6 +1534,7 @@ public final class MainFramePanel extends JPanel implements ActionListener, Tree
|
||||
if (documentClass != null) {
|
||||
showDetail(DETAILCARDAS3NAVIGATOR);
|
||||
showCard(CARDACTIONSCRIPT3PANEL);
|
||||
abcPanel.setSwf(swf);
|
||||
abcPanel.hilightScript(documentClass);
|
||||
}
|
||||
}
|
||||
@@ -1796,7 +1796,7 @@ public final class MainFramePanel extends JPanel implements ActionListener, Tree
|
||||
protected Object doInBackground() throws Exception {
|
||||
int cnt = 0;
|
||||
if (all) {
|
||||
for (ABCContainerTag tag : abcPanel.list) {
|
||||
for (ABCContainerTag tag : abcPanel.swf.abcList) {
|
||||
tag.getABC().restoreControlFlow();
|
||||
}
|
||||
} else {
|
||||
@@ -1881,7 +1881,7 @@ public final class MainFramePanel extends JPanel implements ActionListener, Tree
|
||||
protected Object doInBackground() throws Exception {
|
||||
try {
|
||||
if (deobfuscationDialog.processAllCheckbox.isSelected()) {
|
||||
for (ABCContainerTag tag : abcPanel.list) {
|
||||
for (ABCContainerTag tag : abcPanel.swf.abcList) {
|
||||
if (deobfuscationDialog.codeProcessingLevel.getValue() == DeobfuscationDialog.LEVEL_REMOVE_DEAD_CODE) {
|
||||
tag.getABC().removeDeadCode();
|
||||
} else if (deobfuscationDialog.codeProcessingLevel.getValue() == DeobfuscationDialog.LEVEL_REMOVE_TRAPS) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.FrameNode;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.StringNode;
|
||||
import com.jpexs.decompiler.flash.TagNode;
|
||||
import com.jpexs.decompiler.flash.TreeElementItem;
|
||||
import com.jpexs.decompiler.flash.TreeNode;
|
||||
import com.jpexs.decompiler.flash.gui.abc.ClassesListTreeModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.TreeElement;
|
||||
@@ -210,18 +211,18 @@ public class TagTreeModel implements TreeModel {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private List<Object> searchTag(Object obj, Object parent, List<Object> path) {
|
||||
List<Object> ret = null;
|
||||
private List<TreeNode> searchTag(TreeElementItem obj, TreeNode parent, List<TreeNode> path) {
|
||||
List<TreeNode> ret = null;
|
||||
int cnt = getChildCount(parent);
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
Object n = getChild(parent, i);
|
||||
List<Object> newPath = new ArrayList<>();
|
||||
TreeNode n = getChild(parent, i);
|
||||
List<TreeNode> newPath = new ArrayList<>();
|
||||
newPath.addAll(path);
|
||||
newPath.add(n);
|
||||
|
||||
if (n instanceof TreeElement) {
|
||||
TreeElement te = (TreeElement) n;
|
||||
Object it = te.getItem();
|
||||
TreeElementItem it = te.getItem();
|
||||
if (obj == it) {
|
||||
return newPath;
|
||||
}
|
||||
@@ -240,8 +241,8 @@ public class TagTreeModel implements TreeModel {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public TreePath getTagPath(Object obj) {
|
||||
List<Object> path = new ArrayList<>();
|
||||
public TreePath getTagPath(TreeElementItem obj) {
|
||||
List<TreeNode> path = new ArrayList<>();
|
||||
path.add(getRoot());
|
||||
path = searchTag(obj, getRoot(), path);
|
||||
TreePath tp = new TreePath(path.toArray(new Object[path.size()]));
|
||||
|
||||
@@ -84,7 +84,6 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
|
||||
public TraitsList navigator;
|
||||
public ClassesListTree classTree;
|
||||
public ABC abc;
|
||||
public List<ABCContainerTag> list;
|
||||
public SWF swf;
|
||||
public JComboBox abcComboBox;
|
||||
public int listIndex = -1;
|
||||
@@ -143,7 +142,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
|
||||
|
||||
@Override
|
||||
public Void doInBackground() throws Exception {
|
||||
decompiledTextArea.cacheScriptPack(item.value, list);
|
||||
decompiledTextArea.cacheScriptPack(item.value, swf.abcList);
|
||||
if (pat.matcher(decompiledTextArea.getCachedText(item.value)).find()) {
|
||||
found.add(item.value);
|
||||
foundPath.add(item.key);
|
||||
@@ -168,7 +167,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
|
||||
return false;
|
||||
} else {
|
||||
foundPos = 0;
|
||||
decompiledTextArea.setScript(found.get(foundPos), list);
|
||||
decompiledTextArea.setScript(found.get(foundPos), swf.abcList);
|
||||
searchPanel.setVisible(true);
|
||||
searchFor = txt;
|
||||
updateSearchPos();
|
||||
@@ -270,7 +269,6 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void clearSwf() {
|
||||
this.list = null;
|
||||
this.swf = null;
|
||||
this.abc = null;
|
||||
constantTable.setModel(new DefaultTableModel());
|
||||
@@ -280,17 +278,18 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setSwf(List<ABCContainerTag> list, SWF swf) {
|
||||
this.list = list;
|
||||
this.swf = swf;
|
||||
listIndex = -1;
|
||||
switchAbc(0); // todo honika: do we need this?
|
||||
abcComboBox.setModel(new ABCComboBoxModel(list));
|
||||
if (list.size() > 0) {
|
||||
this.abc = list.get(0).getABC();
|
||||
}
|
||||
public void setSwf(SWF swf) {
|
||||
if (this.swf != swf) {
|
||||
this.swf = swf;
|
||||
listIndex = -1;
|
||||
switchAbc(0); // todo honika: do we need this?
|
||||
abcComboBox.setModel(new ABCComboBoxModel(swf.abcList));
|
||||
if (swf.abcList.size() > 0) {
|
||||
this.abc = swf.abcList.get(0).getABC();
|
||||
}
|
||||
|
||||
navigator.setABC(list, abc);
|
||||
navigator.setABC(swf.abcList, abc);
|
||||
}
|
||||
}
|
||||
|
||||
public void switchAbc(int index) {
|
||||
@@ -298,7 +297,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
|
||||
classTree.setSwf(swf);
|
||||
|
||||
if (index != -1) {
|
||||
this.abc = list.get(index).getABC();
|
||||
this.abc = swf.abcList.get(index).getABC();
|
||||
}
|
||||
updateConstList();
|
||||
}
|
||||
@@ -525,7 +524,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
|
||||
}
|
||||
int multinameIndex = constantTable.convertRowIndexToModel(rowIndex);
|
||||
if (multinameIndex > 0) {
|
||||
UsageFrame usageFrame = new UsageFrame(t.list, abc, multinameIndex, t);
|
||||
UsageFrame usageFrame = new UsageFrame(t.swf.abcList, abc, multinameIndex, t);
|
||||
usageFrame.setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -602,7 +601,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
|
||||
searchPos.setText((foundPos + 1) + "/" + found.size());
|
||||
ScriptPack pack = found.get(foundPos);
|
||||
setAbc(pack.abc);
|
||||
decompiledTextArea.setScript(pack, list);
|
||||
decompiledTextArea.setScript(pack, swf.abcList);
|
||||
hilightScript(found.get(foundPos));
|
||||
decompiledTextArea.setCaretPosition(0);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@@ -97,9 +97,10 @@ public final class ClassesListTree extends JTree implements TreeSelectionListene
|
||||
public void setSwf(SWF swf) {
|
||||
if (swf != this.swf) {
|
||||
this.swf = swf;
|
||||
ClassesListTreeModel model = new ClassesListTreeModel(swf);
|
||||
this.swf.classTreeModel = model;
|
||||
setModel(model);
|
||||
if (swf.classTreeModel == null) {
|
||||
swf.classTreeModel = new ClassesListTreeModel(swf);
|
||||
}
|
||||
setModel(swf.classTreeModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.tags.base;
|
||||
|
||||
import com.jpexs.decompiler.flash.DisassemblyListener;
|
||||
import com.jpexs.decompiler.flash.TreeElementItem;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.ExportMode;
|
||||
@@ -27,7 +28,7 @@ import java.util.List;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface ASMSource {
|
||||
public interface ASMSource extends TreeElementItem {
|
||||
|
||||
/**
|
||||
* Converts actions to ASM source
|
||||
|
||||
Reference in New Issue
Block a user