diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 9816c25e7..5eafd49d8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -1913,7 +1913,7 @@ public class SWF { } HashMap typeCounts = new HashMap<>(); - public int deobfuscateIdentifiers(RenameType renameType) { + public int deobfuscateIdentifiers(RenameType renameType) throws InterruptedException { findFileAttributes(); if (fileAttributes == null) { int cnt = 0; @@ -1929,17 +1929,17 @@ public class SWF { } } - public void renameAS2Identifier(String identifier, String newname) { + public void renameAS2Identifier(String identifier, String newname) throws InterruptedException { Map selected = new HashMap<>(); selected.put(identifier, newname); renameAS2Identifiers(null, selected); } - public int deobfuscateAS2Identifiers(RenameType renameType) { + public int deobfuscateAS2Identifiers(RenameType renameType) throws InterruptedException { return renameAS2Identifiers(renameType, null); } - private int renameAS2Identifiers(RenameType renameType, Map selected) { + private int renameAS2Identifiers(RenameType renameType, Map selected) throws InterruptedException { actionsMap = new HashMap<>(); allFunctions = new ArrayList<>(); allVariableNames = new ArrayList<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index b6054b171..109a934ee 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -99,7 +99,7 @@ public class ABC { } } - public int removeTraps() { + public int removeTraps() throws InterruptedException { int rem = 0; for (int s = 0; s < script_info.length; s++) { rem += script_info[s].removeTraps(s, this, ""); 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 e3f62e753..96b55b363 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -1405,7 +1405,7 @@ public class AVM2Code implements Serializable { ignoredIns = new ArrayList<>(); } - public List toGraphTargetItems(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo[] method_info, MethodBody body, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits, int staticOperation, HashMap localRegAssigmentIps, HashMap> refs) { + public List toGraphTargetItems(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo[] method_info, MethodBody body, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits, int staticOperation, HashMap localRegAssigmentIps, HashMap> refs) throws InterruptedException { initToSource(); List list; HashMap localRegs = new HashMap<>(); @@ -1654,7 +1654,7 @@ public class AVM2Code implements Serializable { return ret; } - public int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic, String path) { + public int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException { removeDeadCode(constants, trait, info, body); List localData = new ArrayList<>(); localData.add((Boolean) isStatic); //isStatic @@ -2360,7 +2360,7 @@ public class AVM2Code implements Serializable { } @SuppressWarnings("unchecked") - private static int removeTraps(HashMap> refs, boolean secondPass, boolean indeterminate, List localData, Stack stack, List output, AVM2GraphSource code, int ip, HashMap visited, HashMap> visitedStates, HashMap decisions, String path) { + private static int removeTraps(HashMap> refs, boolean secondPass, boolean indeterminate, List localData, Stack stack, List output, AVM2GraphSource code, int ip, HashMap visited, HashMap> visitedStates, HashMap decisions, String path) throws InterruptedException { boolean debugMode = false; int ret = 0; iploop: @@ -2615,7 +2615,7 @@ public class AVM2Code implements Serializable { return ret; } - public static int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, List localData, AVM2GraphSource code, int addr, String path, HashMap> refs) { + public static int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, List localData, AVM2GraphSource code, int addr, String path, HashMap> refs) throws InterruptedException { HashMap decisions = new HashMap<>(); removeTraps(refs, false, false, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), new HashMap(), new HashMap>(), decisions, path); int cnt = 0; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index 064b52d72..823779865 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -113,7 +113,7 @@ public class AVM2Graph extends Graph { public static final int DATA_FINALLYJUMPS = 11; public static final int DATA_IGNOREDSWITCHES = 12; - public static List translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap localRegs, Stack scopeStack, HashMap localRegNames, List fullyQualifiedNames, int staticOperation, HashMap localRegAssigmentIps, HashMap> refs) { + public static List translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap localRegs, Stack scopeStack, HashMap localRegNames, List fullyQualifiedNames, int staticOperation, HashMap localRegAssigmentIps, HashMap> refs) throws InterruptedException { AVM2Graph g = new AVM2Graph(code, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localRegNames, fullyQualifiedNames, localRegAssigmentIps, refs); List localData = new ArrayList<>(); @@ -186,7 +186,7 @@ public class AVM2Graph extends Graph { } @Override - protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) { + protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) throws InterruptedException { List ret = null; @SuppressWarnings("unchecked") diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index b363cdce1..c4243ff42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -84,7 +84,7 @@ public class MethodBody implements Cloneable, Serializable { code.restoreControlFlow(constants, trait, info, this); } - public int removeTraps(ConstantPool constants, ABC abc, Trait trait, int scriptIndex, int classIndex, boolean isStatic, String path) { + public int removeTraps(ConstantPool constants, ABC abc, Trait trait, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException { return code.removeTraps(constants, trait, abc.method_info[method_info], this, abc, scriptIndex, classIndex, isStatic, path); } @@ -130,7 +130,7 @@ public class MethodBody implements Cloneable, Serializable { try { Callable callable = new Callable() { @Override - public Void call() { + public Void call() throws InterruptedException { MethodBody converted = convertMethodBody(path, isStatic, scriptIndex, classIndex, abc, trait, constants, method_info, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits); HashMap localRegNames = getLocalRegNames(abc); convertedItems = converted.code.toGraphTargetItems(path, isStatic, scriptIndex, classIndex, abc, constants, method_info, converted, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap(), converted.code.visitCode(converted)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java index da0566f24..eb25e1dd7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java @@ -65,7 +65,7 @@ public class ScriptInfo { return ret; } - public int removeTraps(int scriptIndex, ABC abc, String path) { + public int removeTraps(int scriptIndex, ABC abc, String path) throws InterruptedException { return traits.removeTraps(scriptIndex, -1, true, abc, path); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java index f25e98423..dabc290d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java @@ -161,7 +161,7 @@ public abstract class Trait implements Serializable { } } - public abstract int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path); + public abstract int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException; public String getPath(ABC abc) { Multiname name = getName(abc); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index 300067554..2c4a1cc39 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -529,7 +529,7 @@ public class TraitClass extends Trait implements TraitWithSlot { } @Override - public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) { + public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException { int iInitializer = abc.findBodyIndex(abc.instance_info[class_info].iinit_index); int ret = 0; if (iInitializer != -1) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java index c4a45b3ae..6c1c0403b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java @@ -96,7 +96,7 @@ public class TraitFunction extends Trait implements TraitWithSlot { } @Override - public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) { + public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException { int bodyIndex = abc.findBodyIndex(method_info); if (bodyIndex != -1) { return abc.bodies[bodyIndex].removeTraps(abc.constants, abc, this, scriptIndex, classIndex, isStatic, path); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java index f7eb82a0c..909c5c253 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java @@ -101,7 +101,7 @@ public class TraitMethodGetterSetter extends Trait { } @Override - public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) { + public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException { int bodyIndex = abc.findBodyIndex(method_info); if (bodyIndex != -1) { return abc.bodies[bodyIndex].removeTraps(abc.constants, abc, this, scriptIndex, classIndex, isStatic, path); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java index 9c0873e7e..657cb4590 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java @@ -43,7 +43,7 @@ public class Traits implements Serializable { return traits.length - 1; } - public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) { + public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException { int ret = 0; for (Trait t : traits) { ret += t.removeTraps(scriptIndex, classIndex, isStatic, abc, path); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 7ad9f7173..68879f3a4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -617,7 +617,7 @@ public class Action implements GraphSourceItem { * @param staticOperation the value of staticOperation * @param path the value of path */ - public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { + public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) throws InterruptedException { } /** @@ -686,7 +686,7 @@ public class Action implements GraphSourceItem { return -1; } - public static List actionsToTree(List actions, int version, int staticOperation, String path) { + public static List actionsToTree(List actions, int version, int staticOperation, String path) throws InterruptedException { return actionsToTree(new HashMap(), new HashMap(), new HashMap(), actions, version, staticOperation, path); } @@ -755,7 +755,7 @@ public class Action implements GraphSourceItem { * @param path * @return List of treeItems */ - public static List actionsToTree(HashMap regNames, HashMap variables, HashMap functions, List actions, int version, int staticOperation, String path) { + public static List actionsToTree(HashMap regNames, HashMap variables, HashMap functions, List actions, int version, int staticOperation, String path) throws InterruptedException { //Stack stack = new Stack(); return ActionGraph.translateViaGraph(regNames, variables, functions, actions, version, staticOperation, path); //return actionsToTree(regNames, stack, actions, 0, actions.size() - 1, version); @@ -763,7 +763,7 @@ public class Action implements GraphSourceItem { @Override @SuppressWarnings("unchecked") - public void translate(List localData, Stack stack, List output, int staticOperation, String path) { + public void translate(List localData, Stack stack, List output, int staticOperation, String path) throws InterruptedException { translate(stack, output, (HashMap) localData.get(0), (HashMap) localData.get(1), (HashMap) localData.get(2), staticOperation, path); } @@ -824,7 +824,7 @@ public class Action implements GraphSourceItem { logger.fine(s); } - public static List actionsPartToTree(HashMap registerNames, HashMap variables, HashMap functions, Stack stack, List actions, int start, int end, int version, int staticOperation, String path) { + public static List actionsPartToTree(HashMap registerNames, HashMap variables, HashMap functions, Stack stack, List actions, int start, int end, int version, int staticOperation, String path) throws InterruptedException { if (start < actions.size() && (end > 0) && (start > 0)) { log("Entering " + start + "-" + end + (actions.size() > 0 ? (" (" + actions.get(start).toString() + " - " + actions.get(end == actions.size() ? end - 1 : end) + ")") : "")); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java index 422a369b4..c9a9f54c2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -69,7 +69,7 @@ public class ActionGraph extends Graph { }*/ } - public static List translateViaGraph(HashMap registerNames, HashMap variables, HashMap functions, List code, int version, int staticOperation, String path) { + public static List translateViaGraph(HashMap registerNames, HashMap variables, HashMap functions, List code, int version, int staticOperation, String path) throws InterruptedException { ActionGraph g = new ActionGraph(code, registerNames, variables, functions, version); List localData = new ArrayList<>(); @@ -253,7 +253,7 @@ public class ActionGraph extends Graph { } @Override - protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) { + protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) throws InterruptedException { if (!output.isEmpty()) { if (output.get(output.size() - 1) instanceof StoreRegisterActionItem) { StoreRegisterActionItem str = (StoreRegisterActionItem) output.get(output.size() - 1); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java index 1d6795a58..2f81e6455 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java @@ -56,7 +56,7 @@ public class ActionGraphSource extends GraphSource { } @Override - public List translatePart(GraphPart part, List localData, Stack stack, int start, int end, int staticOperation, String path) { + public List translatePart(GraphPart part, List localData, Stack stack, int start, int end, int staticOperation, String path) throws InterruptedException { return (Action.actionsPartToTree(registerNames, variables, functions, stack, actions, start, end, version, staticOperation, path)); } private List posCache = null; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 388f6fda9..21f47d2d0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -150,7 +150,11 @@ public class ActionListReader { updateActionLengths(actions, version); if (deobfuscate) { - actions = deobfuscateActionList(listeners, containerSWFOffset, actions, version, ip, path); + try { + actions = deobfuscateActionList(listeners, containerSWFOffset, actions, version, ip, path); + } catch (InterruptedException ex) { + Logger.getLogger(ActionListReader.class.getName()).log(Level.SEVERE, null, ex); + } updateActionLengths(actions, version); removeZeroJumps(actions, version); } @@ -171,7 +175,7 @@ public class ActionListReader { * @return List of actions * @throws IOException */ - public static List deobfuscateActionList(List listeners, long containerSWFOffset, List actions, int version, int ip, String path) throws IOException { + public static List deobfuscateActionList(List listeners, long containerSWFOffset, List actions, int version, int ip, String path) throws IOException, InterruptedException { if (actions.isEmpty()) { return actions; } @@ -645,7 +649,7 @@ public class ActionListReader { } @SuppressWarnings("unchecked") - private static void deobfustaceActionListAtPosRecursive(List listeners, List output, HashMap> containers, long containerSWFOffset, List localData, Stack stack, ConstantPool cpool, List actions, int pos, int ip, List ret, int startIp, int endip, String path, Map visited, boolean indeterminate, Map> decisionStates, int version) throws IOException { + private static void deobfustaceActionListAtPosRecursive(List listeners, List output, HashMap> containers, long containerSWFOffset, List localData, Stack stack, ConstantPool cpool, List actions, int pos, int ip, List ret, int startIp, int endip, String path, Map visited, boolean indeterminate, Map> decisionStates, int version) throws IOException, InterruptedException { boolean debugMode = false; boolean decideBranch = false; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java index 1db2c55e9..f87c06a42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java @@ -125,7 +125,7 @@ public class ActionWaitForFrame extends Action implements ActionStore { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { + public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) throws InterruptedException { GraphTargetItem frameTi = new DirectValueActionItem(null, 0, new Long(frame), new ArrayList()); List body = ActionGraph.translateViaGraph(regNames, variables, functions, skipped, SWF.DEFAULT_VERSION, staticOperation, path); output.add(new IfFrameLoadedActionItem(frameTi, body, this)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java index c67a2ecac..2dcec2e10 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java @@ -129,7 +129,7 @@ public class ActionWaitForFrame2 extends Action implements ActionStore { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { + public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) throws InterruptedException { GraphTargetItem frame = stack.pop(); List body = ActionGraph.translateViaGraph(regNames, variables, functions, skipped, SWF.DEFAULT_VERSION, staticOperation, path); output.add(new IfFrameLoadedActionItem(frame, body, this)); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java index 44bbb868d..88226886c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/GraphFrame.java @@ -47,7 +47,7 @@ public class GraphFrame extends AppFrame { private int backLinksRight = 0; private GraphPart head; - public GraphPanel(Graph graph) { + public GraphPanel(Graph graph) throws InterruptedException { graph.init(new ArrayList<>()); size = getPartPositions(head = graph.heads.get(0), SPACE_VERTICAL + SPACE_VERTICAL + BLOCK_HEIGHT / 2, getPartWidth(graph.heads.get(0), new HashSet()) * (BLOCK_WIDTH + SPACE_HORIZONTAL) / 2 - SPACE_HORIZONTAL, partPos, true); backLinksLeft = 1; @@ -240,7 +240,7 @@ public class GraphFrame extends AppFrame { int frameWidthDiff; int frameHeightDiff; - public GraphFrame(Graph graph, String name) { + public GraphFrame(Graph graph, String name) throws InterruptedException { setSize(500, 500); Container cnt = getContentPane(); cnt.setLayout(new BorderLayout()); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index a0e34211e..72b34173e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -1873,7 +1873,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel return ret; } - public void renameIdentifier(String identifier) { + public void renameIdentifier(String identifier) throws InterruptedException { String oldName = identifier; String newName = View.showInputDialog(translate("rename.enternew"), oldName); if (newName != null) { @@ -2602,7 +2602,11 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel @Override public void run() { Main.startWork(translate("work.renaming") + "..."); - renameIdentifier(identifier); + try { + renameIdentifier(identifier); + } catch (InterruptedException ex) { + Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); + } Main.stopWork(); } }).start(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java index 75a88428e..70b8bbd15 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -38,6 +38,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Stack; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; @@ -156,8 +158,12 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi } public void graph() { - AVM2Graph gr = new AVM2Graph(abc.bodies[bodyIndex].code, abc, abc.bodies[bodyIndex], false, -1, -1, new HashMap(), new Stack(), new HashMap(), new ArrayList(), new HashMap(), abc.bodies[bodyIndex].code.visitCode(abc.bodies[bodyIndex])); - (new GraphFrame(gr, name)).setVisible(true); + try { + AVM2Graph gr = new AVM2Graph(abc.bodies[bodyIndex].code, abc, abc.bodies[bodyIndex], false, -1, -1, new HashMap(), new Stack(), new HashMap(), new ArrayList(), new HashMap(), abc.bodies[bodyIndex].code.visitCode(abc.bodies[bodyIndex])); + (new GraphFrame(gr, name)).setVisible(true); + } catch (InterruptedException ex) { + Logger.getLogger(ASMSourceEditorPane.class.getName()).log(Level.SEVERE, null, ex); + } } public void exec() { 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 7bb2b7b65..954687cf6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -704,8 +704,12 @@ public class ActionPanel extends JPanel implements ActionListener { } if (e.getActionCommand().equals("GRAPH")) { if (lastCode != null) { - GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap(), new HashMap(), new HashMap(), SWF.DEFAULT_VERSION), ""); - gf.setVisible(true); + try { + GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap(), new HashMap(), new HashMap(), SWF.DEFAULT_VERSION), ""); + gf.setVisible(true); + } catch (InterruptedException ex) { + Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex); + } } } else if (e.getActionCommand().equals("EDITACTION")) { setEditMode(true); diff --git a/trunk/src/com/jpexs/decompiler/graph/Graph.java b/trunk/src/com/jpexs/decompiler/graph/Graph.java index df4f1960f..58feca16a 100644 --- a/trunk/src/com/jpexs/decompiler/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/graph/Graph.java @@ -64,7 +64,7 @@ public class Graph { } - public void init(List localData) { + public void init(List localData) throws InterruptedException { if (heads != null) { return; } @@ -89,17 +89,20 @@ public class Graph { } } - private void fixGraph(List localData, GraphPart part) { + private void fixGraph(List localData, GraphPart part) throws InterruptedException { //if(true) return; try { while (fixGraphOnce(localData, part, new ArrayList(), false)) { } + } catch (InterruptedException ex) { + throw ex; } catch (Exception | Error ex) { + String s = ex.toString(); //ignore } } - private boolean fixGraphOnce(List localData, GraphPart part, List visited, boolean doChildren) { + private boolean fixGraphOnce(List localData, GraphPart part, List visited, boolean doChildren) throws InterruptedException { if (visited.contains(part)) { return false; } @@ -371,11 +374,11 @@ public class Graph { /* public GraphPart getNextCommonPart(GraphPart part, List loops) { return getNextCommonPart(part, new ArrayList(),loops); }*/ - public GraphPart getNextCommonPart(List localData, GraphPart part, List loops) { + public GraphPart getNextCommonPart(List localData, GraphPart part, List loops) throws InterruptedException { return getCommonPart(localData, part.nextParts, loops); } - public GraphPart getCommonPart(List localData, List parts, List loops) { + public GraphPart getCommonPart(List localData, List parts, List loops) throws InterruptedException { if (parts.isEmpty()) { return null; } @@ -435,7 +438,7 @@ public class Graph { return null; } - public GraphPart getMostCommonPart(List localData, List parts, List loops) { + public GraphPart getMostCommonPart(List localData, List parts, List loops) throws InterruptedException { if (parts.isEmpty()) { return null; } @@ -576,13 +579,13 @@ public class Graph { return part; } - public static List translateViaGraph(List localData, String path, GraphSource code, List alternateEntries, int staticOperation) { + public static List translateViaGraph(List localData, String path, GraphSource code, List alternateEntries, int staticOperation) throws InterruptedException { Graph g = new Graph(code, alternateEntries); g.init(localData); return g.translate(localData, staticOperation, path); } - public List translate(List localData, int staticOperation, String path) { + public List translate(List localData, int staticOperation, String path) throws InterruptedException { List allParts = new ArrayList<>(); for (GraphPart head : heads) { populateParts(head, allParts); @@ -778,7 +781,7 @@ public class Graph { return false; } - protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) { + protected List check(GraphSource code, List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, List stopPart, List loops, List output, Loop currentLoop, int staticOperation, String path) throws InterruptedException { return null; } @@ -787,13 +790,13 @@ public class Graph { } @SuppressWarnings("unchecked") - protected GraphTargetItem translatePartGetStack(List localData, GraphPart part, Stack stack, int staticOperation) { + protected GraphTargetItem translatePartGetStack(List localData, GraphPart part, Stack stack, int staticOperation) throws InterruptedException { stack = (Stack) stack.clone(); translatePart(localData, part, stack, staticOperation, null); return stack.pop(); } - protected List translatePart(List localData, GraphPart part, Stack stack, int staticOperation, String path) { + protected List translatePart(List localData, GraphPart part, Stack stack, int staticOperation, String path) throws InterruptedException { List sub = part.getSubParts(); List ret = new ArrayList<>(); int end; @@ -854,7 +857,7 @@ public class Graph { list.remove(list.size() - 1); } - protected List printGraph(List visited, List localData, Stack stack, List allParts, GraphPart parent, GraphPart part, List stopPart, List loops, int staticOperation, String path) { + protected List printGraph(List visited, List localData, Stack stack, List allParts, GraphPart parent, GraphPart part, List stopPart, List loops, int staticOperation, String path) throws InterruptedException { return printGraph(visited, localData, stack, allParts, parent, part, stopPart, loops, null, staticOperation, path); } @@ -862,7 +865,7 @@ public class Graph { return loopItem; } - private void getPrecontinues(List localData, GraphPart parent, GraphPart part, List loops, List stopPart) { + private void getPrecontinues(List localData, GraphPart parent, GraphPart part, List loops, List stopPart) throws InterruptedException { markLevels(localData, part, loops); //Note: this also marks part as precontinue when there is if /* @@ -914,13 +917,13 @@ public class Graph { clearLoops(loops);*/ } - private void markLevels(List localData, GraphPart part, List loops) { + private void markLevels(List localData, GraphPart part, List loops) throws InterruptedException { clearLoops(loops); markLevels(localData, part, loops, new ArrayList(), 1, new ArrayList()); clearLoops(loops); } - private void markLevels(List localData, GraphPart part, List loops, List stopPart, int level, List visited) { + private void markLevels(List localData, GraphPart part, List loops, List stopPart, int level, List visited) throws InterruptedException { boolean debugMode = false; if (stopPart == null) { stopPart = new ArrayList<>(); @@ -1062,13 +1065,13 @@ public class Graph { } } - private void getLoops(List localData, GraphPart part, List loops, List stopPart) { + private void getLoops(List localData, GraphPart part, List loops, List stopPart) throws InterruptedException { clearLoops(loops); getLoops(localData, part, loops, stopPart, true, 1, new ArrayList()); clearLoops(loops); } - private void getLoops(List localData, GraphPart part, List loops, List stopPart, boolean first, int level, List visited) { + private void getLoops(List localData, GraphPart part, List loops, List stopPart, boolean first, int level, List visited) throws InterruptedException { boolean debugMode = false; if (stopPart == null) { @@ -1349,7 +1352,7 @@ public class Graph { } } - protected List printGraph(List visited, List localData, Stack stack, List allParts, GraphPart parent, GraphPart part, List stopPart, List loops, List ret, int staticOperation, String path) { + protected List printGraph(List visited, List localData, Stack stack, List allParts, GraphPart parent, GraphPart part, List stopPart, List loops, List ret, int staticOperation, String path) throws InterruptedException { if (stopPart == null) { stopPart = new ArrayList<>(); } diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphPart.java b/trunk/src/com/jpexs/decompiler/graph/GraphPart.java index ed04b0955..a21275278 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphPart.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphPart.java @@ -60,7 +60,11 @@ public class GraphPart implements Serializable { return time; } - private boolean leadsTo(List localData, Graph gr, GraphSource code, GraphPart part, List visited, List loops) { + private boolean leadsTo(List localData, Graph gr, GraphSource code, GraphPart part, List visited, List loops) throws InterruptedException { + if (Thread.currentThread().isInterrupted()) { + throw new InterruptedException(); + } + GraphPart tpart = gr.checkPart(null, localData, this, null); if (tpart == null) { return false; @@ -121,7 +125,7 @@ public class GraphPart implements Serializable { return false; } - public boolean leadsTo(List localData, Graph gr, GraphSource code, GraphPart part, List loops) { + public boolean leadsTo(List localData, Graph gr, GraphSource code, GraphPart part, List loops) throws InterruptedException { for (Loop l : loops) { l.leadsToMark = 0; } diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphSource.java b/trunk/src/com/jpexs/decompiler/graph/GraphSource.java index ee5e3eb38..c0682b10a 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphSource.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphSource.java @@ -35,7 +35,7 @@ public abstract class GraphSource implements Serializable { public abstract boolean isEmpty(); - public abstract List translatePart(GraphPart part, List localData, Stack stack, int start, int end, int staticOperation, String path); + public abstract List translatePart(GraphPart part, List localData, Stack stack, int start, int end, int staticOperation, String path) throws InterruptedException; private void visitCode(int ip, int lastIp, HashMap> refs, int endIp) { boolean debugMode = false; diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphSourceItem.java b/trunk/src/com/jpexs/decompiler/graph/GraphSourceItem.java index bd4a42850..d571403bc 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphSourceItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphSourceItem.java @@ -26,7 +26,7 @@ import java.util.Stack; */ public interface GraphSourceItem extends Serializable { - public void translate(List localData, Stack stack, List output, int staticOperation, String path); + public void translate(List localData, Stack stack, List output, int staticOperation, String path) throws InterruptedException; public boolean isJump();