diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 988a2255f..32dcd95dd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -2037,6 +2037,12 @@ public class AVM2Code implements Serializable { if ((ins instanceof AVM2Instruction) && (((AVM2Instruction) ins).definition instanceof PopIns)) { GraphTargetItem top = stack.peek(); for (GraphSourceItemPos p : top.getNeededSources()) { + if (p == null) { + continue; + } + if (p.item == null) { + continue; + } if (p.item.isIgnored()) { ins.setIgnored(true); break; diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java index a22542e98..81999cd9b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java @@ -1326,9 +1326,9 @@ public class Graph { if (part.ignored) { return ret; } - + List loopContinues = getLoopsContinues(loops); - boolean isLoop = false; + boolean isLoop = false; Loop currentLoop = null; for (Loop el : loops) { if ((el.loopContinue == part) && (el.phase == 0)) { @@ -1337,7 +1337,7 @@ public class Graph { isLoop = true; break; } - } + } if (debugMode) { System.err.println("loopsize:" + loops.size()); diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/IntegerValueItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/IntegerValueItem.java index f7fdacb32..abf4fe124 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/IntegerValueItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/IntegerValueItem.java @@ -45,8 +45,4 @@ public class IntegerValueItem extends GraphTargetItem { public Object getResult() { return Double.valueOf(intValue); } - - - - } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index d1605f98d..8b28053c1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -1749,7 +1749,6 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection if (searchDialog.result) { final String txt = searchDialog.searchField.getText(); if (!txt.equals("")) { - Main.startWork(translate("work.searching") + " \"" + txt + "\"..."); if (abcPanel != null) { (new Thread() { @Override @@ -1760,7 +1759,6 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection } else { JOptionPane.showMessageDialog(null, translate("message.search.notfound").replace("%searchtext%", txt), translate("message.search.notfound.title"), JOptionPane.INFORMATION_MESSAGE); } - Main.stopWork(); } }).start(); } else { @@ -1772,7 +1770,6 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection } else { JOptionPane.showMessageDialog(null, translate("message.search.notfound").replace("%searchtext%", txt), translate("message.search.notfound.title"), JOptionPane.INFORMATION_MESSAGE); } - Main.stopWork(); } }).start(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 6275e3c9b..7ef1e7568 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -100,7 +100,15 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { } else { pat = Pattern.compile(Pattern.quote(txt), ignoreCase ? Pattern.CASE_INSENSITIVE : 0); } + int pos = 0; for (MyEntry item : allpacks) { + pos++; + String workText = translate("work.searching"); + String decAdd = ""; + if (!decompiledTextArea.isCached(item.value)) { + decAdd = ", " + translate("work.decompiling"); + } + Main.startWork(workText + " \"" + txt + "\"" + decAdd + " - (" + pos + "/" + allpacks.size() + ") " + item.key.toString() + "... "); decompiledTextArea.cacheScriptPack(item.value, list); if (pat.matcher(decompiledTextArea.getCachedText(item.value)).find()) { found.add(item.value); @@ -108,8 +116,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { } System.gc(); - - //found = decompiledTextArea.searchCache(txt, ignoreCase, regexp); + Main.stopWork(); if (found.isEmpty()) { searchPanel.setVisible(false); return false; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index b1dc1b102..c0dd8d521 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -253,6 +253,10 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL cache.remove(pack); } + public boolean isCached(ScriptPack pack) { + return cache.contains(pack); + } + private CachedDecompilation getCached(ScriptPack pack) { if (!cache.contains(pack)) { cacheScriptPack(pack, abcList); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index 02ec63dd8..7a13560b4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -53,6 +53,8 @@ import java.io.StringReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import java.util.regex.Pattern; import javax.swing.BoxLayout; import javax.swing.JButton; @@ -157,6 +159,10 @@ public class ActionPanel extends JPanel implements ActionListener { return (CachedScript) cache.get(pack); } + private boolean isCached(ASMSource src) { + return cache.contains(src); + } + private void cacheScript(ASMSource src) { if (!cache.contains(src)) { List as = src.getActions(SWF.DEFAULT_VERSION); @@ -167,14 +173,22 @@ public class ActionPanel extends JPanel implements ActionListener { } } - private List getASMs(List nodes) { - List ret = new ArrayList<>(); + private Map getASMs(String path, List nodes) { + Map ret = new HashMap<>(); for (TagNode n : nodes) { + String subPath = path + "/" + n.toString(); if (n.tag instanceof ASMSource) { //cacheScript((ASMSource) n.tag); - ret.add((ASMSource) n.tag); + String npath = subPath; + int ppos = 1; + while (ret.containsKey(npath)) { + ppos++; + npath = subPath + "[" + ppos + "]"; + } + ret.put(subPath, (ASMSource) n.tag); } - ret.addAll(getASMs(n.subItems)); + + ret.putAll(getASMs(subPath, n.subItems)); } return ret; } @@ -185,7 +199,7 @@ public class ActionPanel extends JPanel implements ActionListener { searchRegexp = regexp; List tags = new ArrayList(Main.swf.tags); List list = Main.swf.createASTagList(tags, null); - List asms = getASMs(list); + Map asms = getASMs("", list); found = new ArrayList<>(); Pattern pat = null; if (regexp) { @@ -193,13 +207,23 @@ public class ActionPanel extends JPanel implements ActionListener { } else { pat = Pattern.compile(Pattern.quote(txt), ignoreCase ? Pattern.CASE_INSENSITIVE : 0); } - for (ASMSource s : asms) { - cacheScript(s); - if (pat.matcher(getCached(s).text).find()) { - found.add(s); + int pos = 0; + for (Entry item : asms.entrySet()) { + pos++; + String workText = translate("work.searching"); + String decAdd = ""; + if (!isCached(item.getValue())) { + decAdd = ", " + translate("work.decompiling"); + } + Main.startWork(workText + " \"" + txt + "\"" + decAdd + " - (" + pos + "/" + asms.size() + ") " + item.getKey() + "... "); + + cacheScript(item.getValue()); + if (pat.matcher(getCached(item.getValue()).text).find()) { + found.add(item.getValue()); } } + Main.stopWork(); if (found.isEmpty()) { searchPanel.setVisible(false); return false;