diff --git a/src/com/jpexs/decompiler/flash/abc/ABC.java b/src/com/jpexs/decompiler/flash/abc/ABC.java index 5385378f7..7f9958f14 100644 --- a/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -341,11 +341,11 @@ public class ABC { minor_version = ais.readU16("minor_version"); major_version = ais.readU16("major_version"); logger.log(Level.FINE, "ABC minor_version: {0}, major_version: {1}", new Object[]{minor_version, major_version}); - + constants = new ConstantPool(); deobfuscation = new AVM2Deobfuscation(constants); ais.newDumpLevel("constant_pool", "cpool_info"); - + //constant integers int constant_int_pool_count = ais.readU30("int_count"); constants.constant_int = new ArrayList<>(constant_int_pool_count); @@ -471,7 +471,7 @@ public class ABC { } ais.endDumpLevel(); } - + ais.endDumpLevel(); //cpool_info //method info diff --git a/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java b/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java index ec2cab905..89742c8c6 100644 --- a/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java +++ b/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java @@ -85,7 +85,7 @@ public class ABCInputStream implements AutoCloseable { dumpInfo.getChildInfos().add(di); dumpInfo = di; } - + return dumpInfo; } @@ -114,7 +114,7 @@ public class ABCInputStream implements AutoCloseable { } return i; } - + public int read(String name) throws IOException { newDumpLevel(name, "byte"); int ret = readInternal(); diff --git a/src/com/jpexs/decompiler/flash/action/ActionList.java b/src/com/jpexs/decompiler/flash/action/ActionList.java index c83b638d7..e7a5c22f2 100644 --- a/src/com/jpexs/decompiler/flash/action/ActionList.java +++ b/src/com/jpexs/decompiler/flash/action/ActionList.java @@ -48,32 +48,32 @@ public class ActionList extends ArrayList { public ActionList(Collection actions) { super(actions); - } + } public void setActions(List list) { clear(); addAll(list); } - + public void removeAction(int index) { ActionListReader.removeAction(this, index, SWF.DEFAULT_VERSION, true); } - + public void removeAction(int index, int count) { if (size() <= index + count - 1) { // Can't remove count elements, only size - index is available count = size() - index; } - + for (int i = 0; i < count; i++) { ActionListReader.removeAction(this, index, SWF.DEFAULT_VERSION, true); } } - + public void addAction(int index, Action action) { ActionListReader.addAction(this, index, action, SWF.DEFAULT_VERSION, false, false); } - + public void fixActionList() { ActionListReader.fixActionList(this, null, SWF.DEFAULT_VERSION); } @@ -81,7 +81,7 @@ public class ActionList extends ArrayList { public List getContainerLastActions(Action action) { return ActionListReader.getContainerLastActions(this, action); } - + public Iterator getReferencesFor(final Action target) { final ActionList diz = this; return new Iterator() { @@ -89,7 +89,7 @@ public class ActionList extends ArrayList { private final Iterator iterator = diz.iterator(); private Action action = getNext(); - + @Override public boolean hasNext() { return action != null; @@ -101,7 +101,7 @@ public class ActionList extends ArrayList { action = getNext(); return a; } - + private Action getNext() { while (iterator.hasNext()) { Action a = iterator.next(); @@ -140,12 +140,12 @@ public class ActionList extends ArrayList { } }; } - + public void removeNops() { for (int i = 0; i < size(); i++) { - if (get(i) instanceof ActionNop) { - removeAction(i); - } + if (get(i) instanceof ActionNop) { + removeAction(i); + } } } @@ -181,5 +181,5 @@ public class ActionList extends ArrayList { Logger.getLogger(EmptySWFDecompilerListener.class.getName()).log(Level.SEVERE, null, ex); } } - + } diff --git a/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 0a50ff6cb..df349fdd9 100644 --- a/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -16,10 +16,10 @@ */ package com.jpexs.decompiler.flash.action; -import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscator; import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.DisassemblyListener; import com.jpexs.decompiler.flash.SWFInputStream; +import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscator; import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscatorSimple; import com.jpexs.decompiler.flash.action.model.ConstantPool; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; @@ -100,7 +100,7 @@ public class ActionListReader { return readActionList(listeners, sis, version, ip, endIp, path, Configuration.deobfuscationMode.get()); } }, Configuration.decompilationTimeoutSingleMethod.get(), TimeUnit.SECONDS); - + return actions; } catch (ExecutionException ex) { Throwable cause = ex.getCause(); @@ -144,7 +144,7 @@ public class ActionListReader { if (actionMap.isEmpty()) { return new ActionList(); } - + List addresses = new ArrayList<>(actionMap.keySet()); // add end action @@ -157,7 +157,7 @@ public class ActionListReader { actionMap.put(aEnd.getAddress(), aEnd); nextOffsets.put(endAddress, endAddress + 1); } - + ActionList actions = fixActionList(new ActionList(actionMap.values()), nextOffsets, version); // jump to the entry action when it is diffrent from the first action in the map @@ -198,13 +198,13 @@ public class ActionListReader { return actions; } - + public static ActionList fixActionList(ActionList actions, Map nextOffsets, int version) { Map> containerLastActions = new HashMap<>(); getContainerLastActions(actions, containerLastActions); ActionList ret = new ActionList(); - + if (nextOffsets != null) { int index = 0; while (index != -1 && index < actions.size()) { @@ -240,7 +240,7 @@ public class ActionListReader { updateJumps(ret, jumps, containerLastActions, endAddress); updateActionStores(ret, jumps); updateContainerSizes(ret, containerLastActions); - + return ret; } @@ -303,15 +303,15 @@ public class ActionListReader { } } - deobfustaceActionListAtPosRecursive(listeners, - new ArrayList(), - new HashMap>(), - new ActionLocalData(), - new TranslateStack(), - new ConstantPool(), - actionMap, ip, retMap, ip, endIp, path, - new HashMap(), false, - new HashMap>(), + deobfustaceActionListAtPosRecursive(listeners, + new ArrayList(), + new HashMap>(), + new ActionLocalData(), + new TranslateStack(), + new ConstantPool(), + actionMap, ip, retMap, ip, endIp, path, + new HashMap(), false, + new HashMap>(), version, 0, maxRecursionLevel); ActionList ret = new ActionList(); @@ -413,7 +413,7 @@ public class ActionListReader { } return lasts; } - + private static void getContainerLastActions(ActionList actions, Map> lastActions) { for (Action a : actions) { if (a instanceof GraphSourceItemContainer) { @@ -540,8 +540,9 @@ public class ActionListReader { } /** - * Removes an action from the action list, and updates all references - * This method will keep the inner actions of the container when you remove the container + * Removes an action from the action list, and updates all references This + * method will keep the inner actions of the container when you remove the + * container * * @param actions * @param index @@ -604,7 +605,8 @@ public class ActionListReader { } /** - * Adds an action to the action list to the specified location, and updates all references + * Adds an action to the action list to the specified location, and updates + * all references * * @param actions * @param index @@ -614,7 +616,7 @@ public class ActionListReader { * @param replaceJump * @return */ - public static boolean addAction(ActionList actions, int index, Action action, + public static boolean addAction(ActionList actions, int index, Action action, int version, boolean addToContainer, boolean replaceJump) { if (index < 0 || actions.size() < index) { @@ -629,7 +631,7 @@ public class ActionListReader { actions.add(aEnd); lastAction = aEnd; } - + long endAddress = lastAction.getAddress(); Map> containerLastActions = new HashMap<>(); @@ -651,7 +653,7 @@ public class ActionListReader { } } } - + if (replaceJump) { for (Action a : jumps.keySet()) { Action targetAction = jumps.get(a); @@ -999,7 +1001,7 @@ public class ActionListReader { TranslateStack subStack = (TranslateStack) stack.clone(); ActionLocalData subLocalData = new ActionLocalData(new HashMap<>(localData.regNames), - new HashMap<>(localData.variables), new HashMap<>(localData.functions)); + new HashMap<>(localData.variables), new HashMap<>(localData.functions)); deobfustaceActionListAtPosRecursive(listeners, output, containers, subLocalData, subStack, cpool, actions, ip + actionLen + aif.getJumpOffset(), ret, startIp, endip, path, visited, indeterminate, decisionStates, version, recursionLevel + 1, maxRecursionLevel); } diff --git a/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscator.java b/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscator.java index ca35d4f71..88319eaaa 100644 --- a/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscator.java +++ b/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscator.java @@ -77,7 +77,7 @@ import java.util.logging.Logger; public class ActionDeobfuscator implements SWFDecompilerListener { private final int executionLimit = 30000; - + @Override public void actionListParsed(ActionList actions, SWF swf) { combinePushs(actions); @@ -88,15 +88,15 @@ public class ActionDeobfuscator implements SWFDecompilerListener { removeZeroJumps(actions); rereadActionList(actions, swf); // this call will fix the contant pool assigments } - + private void combinePushs(ActionList actions) { for (int i = 0; i < actions.size() - 1; i++) { - Action action = actions.get(i); - Action action2 = actions.get(i + 1); + Action action = actions.get(i); + Action action2 = actions.get(i + 1); if (action instanceof ActionPush && action2 instanceof ActionPush) { if (!actions.getReferencesFor(action2).hasNext()) { - ActionPush push = (ActionPush) action; - ActionPush push2 = (ActionPush) action2; + ActionPush push = (ActionPush) action; + ActionPush push2 = (ActionPush) action2; push.values.addAll(push2.values); actions.remove(i + 1); i--; @@ -104,7 +104,7 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } } } - + private boolean rereadActionList(ActionList actions, SWF swf) { byte[] actionBytes = Action.actionsToBytes(actions, true, SWF.DEFAULT_VERSION); try { @@ -116,7 +116,7 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } return true; } - + private boolean removeUnreachableActions(ActionList actions) { Set reachableActions = new HashSet<>(); Set processedActions = new HashSet<>(); @@ -174,7 +174,7 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } } } - + boolean result = false; for (int i = 0; i < actions.size(); i++) { if (!reachableActions.contains(actions.get(i))) { @@ -183,10 +183,10 @@ public class ActionDeobfuscator implements SWFDecompilerListener { result = true; } } - + return result; } - + private boolean removeZeroJumps(ActionList actions) { boolean result = false; for (int i = 0; i < actions.size(); i++) { @@ -199,12 +199,12 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } return result; } - - private boolean removeObfuscationIfs(ActionList actions, Map fakeFunctions) { + + private boolean removeObfuscationIfs(ActionList actions, Map fakeFunctions) { if (actions.size() == 0) { return false; } - + for (int i = 0; i < actions.size(); i++) { ExecutionResult result = new ExecutionResult(); executeActions(actions, i, actions.size() - 1, result, fakeFunctions); @@ -271,11 +271,11 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } } } - + return false; } - private void executeActions(ActionList actions, int idx, int endIdx, ExecutionResult result, Map fakeFunctions) { + private void executeActions(ActionList actions, int idx, int endIdx, ExecutionResult result, Map fakeFunctions) { List output = new ArrayList<>(); ActionLocalData localData = new ActionLocalData(); FixItemCounterTranslateStack stack = new FixItemCounterTranslateStack(); @@ -296,11 +296,10 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } /*System.out.print(action.getASMSource(actions, new ArrayList(), ScriptExportMode.PCODE)); - for (int j = 0; j < stack.size(); j++) { - System.out.print(" '" + stack.get(j).getResult() + "'"); - } - System.out.println();*/ - + for (int j = 0; j < stack.size(); j++) { + System.out.print(" '" + stack.get(j).getResult() + "'"); + } + System.out.println();*/ if (action instanceof ActionConstantPool) { constantPool = (ActionConstantPool) action; } @@ -319,7 +318,7 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } } - if (action instanceof ActionCallFunction){ + if (action instanceof ActionCallFunction) { String functionName = stack.pop().getResult().toString(); long numArgs = EcmaScript.toUint32(stack.pop().getResult()); if (numArgs == 0) { @@ -335,35 +334,35 @@ public class ActionDeobfuscator implements SWFDecompilerListener { action.translate(localData, stack, output, Graph.SOP_USE_STATIC, ""); } - if (!(action instanceof ActionPush || - action instanceof ActionPushDuplicate || - action instanceof ActionAdd || - action instanceof ActionAdd2 || - action instanceof ActionSubtract || - action instanceof ActionModulo || - action instanceof ActionMultiply || - action instanceof ActionBitXor || - action instanceof ActionBitAnd || - action instanceof ActionBitOr || - action instanceof ActionBitLShift || - action instanceof ActionBitRShift || - action instanceof ActionDefineLocal || - action instanceof ActionJump || - action instanceof ActionGetVariable || - action instanceof ActionSetVariable || - action instanceof ActionEquals || - action instanceof ActionNot || - action instanceof ActionIf || - action instanceof ActionConstantPool || - action instanceof ActionCallFunction || - action instanceof ActionReturn || - action instanceof ActionEnd)) { + if (!(action instanceof ActionPush + || action instanceof ActionPushDuplicate + || action instanceof ActionAdd + || action instanceof ActionAdd2 + || action instanceof ActionSubtract + || action instanceof ActionModulo + || action instanceof ActionMultiply + || action instanceof ActionBitXor + || action instanceof ActionBitAnd + || action instanceof ActionBitOr + || action instanceof ActionBitLShift + || action instanceof ActionBitRShift + || action instanceof ActionDefineLocal + || action instanceof ActionJump + || action instanceof ActionGetVariable + || action instanceof ActionSetVariable + || action instanceof ActionEquals + || action instanceof ActionNot + || action instanceof ActionIf + || action instanceof ActionConstantPool + || action instanceof ActionCallFunction + || action instanceof ActionReturn + || action instanceof ActionEnd)) { break; } if (action instanceof ActionPush) { ActionPush push = (ActionPush) action; - boolean ok = true; + boolean ok = true; for (Object value : push.values) { if (value instanceof ConstantIndex || value instanceof RegisterNumber) { ok = false; @@ -376,9 +375,8 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } /*for (String variable : localData.variables.keySet()) { - System.out.println(Helper.byteArrToString(variable.getBytes())); - }*/ - + System.out.println(Helper.byteArrToString(variable.getBytes())); + }*/ idx++; if (action instanceof ActionJump) { @@ -422,8 +420,8 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } if (action instanceof ActionReturn) { - if (output.size() > 0) { - ReturnActionItem ret = (ReturnActionItem) output.get(output.size() - 1); + if (output.size() > 0) { + ReturnActionItem ret = (ReturnActionItem) output.get(output.size() - 1); result.resultValue = ret.value.getResult(); } break; @@ -432,22 +430,22 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } catch (EmptyStackException | TranslateException | InterruptedException ex) { } } - + private Map getFakeFunctionResults(ActionList actions) { /* - DefineFunction "fakeName" 0 { - Push 1777 - Return - } - */ - + DefineFunction "fakeName" 0 { + Push 1777 + Return + } + */ + Map results = new HashMap<>(); - + for (int i = 0; i < actions.size(); i++) { - Action action = actions.get(i); + Action action = actions.get(i); if (action instanceof ActionDefineFunction) { ActionDefineFunction def = (ActionDefineFunction) action; - if(def.paramNames.isEmpty()) { + if (def.paramNames.isEmpty()) { ExecutionResult result = new ExecutionResult(); List lastActions = actions.getContainerLastActions(action); int lastActionIdx = actions.indexOf(lastActions.get(0)); @@ -461,11 +459,12 @@ public class ActionDeobfuscator implements SWFDecompilerListener { } } } - + return results; } - + class ExecutionResult { + public int idx = -1; public int instructionsProcessed = -1; public ActionConstantPool constantPool; diff --git a/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java b/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java index 64820be90..07dd73155 100644 --- a/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java +++ b/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java @@ -56,17 +56,17 @@ import java.util.List; public class ActionDeobfuscatorSimple implements SWFDecompilerListener { private final int executionLimit = 30000; - + @Override public void actionListParsed(ActionList actions, SWF swf) { removeObfuscationIfs(actions); } - + private boolean removeObfuscationIfs(ActionList actions) { if (actions.size() == 0) { return false; } - + for (int i = 0; i < actions.size(); i++) { ExecutionResult result = new ExecutionResult(); executeActions(actions, i, actions.size() - 1, result); @@ -100,7 +100,7 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener { } } } - + return false; } @@ -124,34 +124,33 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener { } /*System.out.print(action.getASMSource(actions, new ArrayList(), ScriptExportMode.PCODE)); - for (int j = 0; j < stack.size(); j++) { - System.out.print(" '" + stack.get(j).getResult() + "'"); - } - System.out.println();*/ - + for (int j = 0; j < stack.size(); j++) { + System.out.print(" '" + stack.get(j).getResult() + "'"); + } + System.out.println();*/ action.translate(localData, stack, output, Graph.SOP_USE_STATIC, ""); - if (!(action instanceof ActionPush || - action instanceof ActionPushDuplicate || - action instanceof ActionAdd || - action instanceof ActionAdd2 || - action instanceof ActionSubtract || - action instanceof ActionModulo || - action instanceof ActionMultiply || - action instanceof ActionBitXor || - action instanceof ActionBitAnd || - action instanceof ActionBitOr || - action instanceof ActionBitLShift || - action instanceof ActionBitRShift || - action instanceof ActionEquals || - action instanceof ActionNot || - action instanceof ActionIf)) { + if (!(action instanceof ActionPush + || action instanceof ActionPushDuplicate + || action instanceof ActionAdd + || action instanceof ActionAdd2 + || action instanceof ActionSubtract + || action instanceof ActionModulo + || action instanceof ActionMultiply + || action instanceof ActionBitXor + || action instanceof ActionBitAnd + || action instanceof ActionBitOr + || action instanceof ActionBitLShift + || action instanceof ActionBitRShift + || action instanceof ActionEquals + || action instanceof ActionNot + || action instanceof ActionIf)) { break; } if (action instanceof ActionPush) { ActionPush push = (ActionPush) action; - boolean ok = true; + boolean ok = true; for (Object value : push.values) { if (value instanceof ConstantIndex || value instanceof RegisterNumber) { ok = false; @@ -187,8 +186,9 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener { } catch (EmptyStackException | TranslateException | InterruptedException ex) { } } - + class ExecutionResult { + public int idx = -1; public int instructionsProcessed = -1; public TranslateStack stack = new TranslateStack(); diff --git a/src/com/jpexs/decompiler/flash/action/deobfuscation/FixItemCounterTranslateStack.java b/src/com/jpexs/decompiler/flash/action/deobfuscation/FixItemCounterTranslateStack.java index 799d7d55d..453c9093f 100644 --- a/src/com/jpexs/decompiler/flash/action/deobfuscation/FixItemCounterTranslateStack.java +++ b/src/com/jpexs/decompiler/flash/action/deobfuscation/FixItemCounterTranslateStack.java @@ -26,7 +26,7 @@ import com.jpexs.decompiler.graph.TranslateStack; public class FixItemCounterTranslateStack extends TranslateStack { private int fixItemCount = Integer.MAX_VALUE; - + @Override public GraphTargetItem pop() { GraphTargetItem result = super.pop(); @@ -44,11 +44,11 @@ public class FixItemCounterTranslateStack extends TranslateStack { } return super.remove(index); } - + public boolean allItemsFixed() { return size() <= fixItemCount; } - + public int getFixItemCount() { return fixItemCount; } diff --git a/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java b/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java index aed21f520..b69a4ebaf 100644 --- a/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java +++ b/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java @@ -418,7 +418,7 @@ public class ASMParser { } else { throw new ParseException("Unknown instruction name :" + instructionName, lexer.yyline()); } - + a.updateLength(version); return a; } diff --git a/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java b/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java index 94dc517d4..e9dd3e3fd 100644 --- a/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java +++ b/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java @@ -279,7 +279,7 @@ public class ActionSourceGenerator implements SourceGenerator { fixLoop(forBody, forBodyLen + forFinalLen + forajmpLen, forBodyLen); return ret; } - + private long uniqLast = 0; public String uniqId() { diff --git a/src/com/jpexs/decompiler/flash/action/special/ActionDeobfuscateJump.java b/src/com/jpexs/decompiler/flash/action/special/ActionDeobfuscateJump.java index 5d1111c9a..181f1d1e1 100644 --- a/src/com/jpexs/decompiler/flash/action/special/ActionDeobfuscateJump.java +++ b/src/com/jpexs/decompiler/flash/action/special/ActionDeobfuscateJump.java @@ -26,7 +26,7 @@ import java.io.IOException; * @author JPEXS */ public class ActionDeobfuscateJump extends ActionJump { - + public ActionDeobfuscateJump(int offset) { super(2); } diff --git a/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java b/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java index 7a516a7ba..24cc4f02d 100644 --- a/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java +++ b/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java @@ -66,7 +66,7 @@ public class ActionWaitForFrame extends Action implements ActionStore { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SWFOutputStream sos = new SWFOutputStream(baos, version); try { - sos.writeUI16(frame); + sos.writeUI16(frame); sos.writeUI8(skipCount); sos.close(); } catch (IOException e) { diff --git a/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index e7fb19d99..fe3e81b91 100644 --- a/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -81,7 +81,7 @@ public class ActionPush extends Action { values = new ArrayList<>(); DumpInfo di = sis.dumpInfo; sis = sis.getLimitedStream(actionLength); - sis.dumpInfo = di; + sis.dumpInfo = di; try { while (sis.available() > 0) { type = sis.readUI8("type"); diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 0bc7e531d..3c4c455aa 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -887,7 +887,7 @@ public class Main { View.showMessageDialog(null, "Failed to load plugin: " + pluginPath); } } - + AppStrings.setResourceClass(MainFrame.class); initLogging(Configuration.debugMode.get()); initLang(); diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java index e31abd7e6..06e6ba843 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java @@ -203,7 +203,6 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { //miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get()); //miAutoDeobfuscation.addActionListener(this); //miAutoDeobfuscation.setActionCommand(ACTION_AUTO_DEOBFUSCATE); - JMenuItem miRenameOneIdentifier = new JMenuItem(translate("menu.tools.deobfuscation.globalrename")); miRenameOneIdentifier.setActionCommand(ACTION_RENAME_ONE_IDENTIFIER); miRenameOneIdentifier.addActionListener(this); @@ -443,13 +442,13 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener { mainFrame.panel.searchAs(); break; /*case ACTION_AUTO_DEOBFUSCATE: - if (View.showConfirmDialog(mainFrame.panel, translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) { - Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected()); - mainFrame.panel.autoDeobfuscateChanged(); - } else { - miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected()); - } - break;*/ + if (View.showConfirmDialog(mainFrame.panel, translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) { + Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected()); + mainFrame.panel.autoDeobfuscateChanged(); + } else { + miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected()); + } + break;*/ case ACTION_EXIT: mainFrame.panel.setVisible(false); if (Main.proxyFrame != null) { diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index 9d680bfbb..91c579664 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -430,7 +430,6 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { //miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get()); //miAutoDeobfuscation.addActionListener(this); //miAutoDeobfuscation.setActionCommand(ACTION_AUTO_DEOBFUSCATE); - miInternalViewer = new JCheckBox(translate("menu.settings.internalflashviewer")); miInternalViewer.setSelected(Configuration.internalFlashViewer.get() || externalFlashPlayerUnavailable); if (externalFlashPlayerUnavailable) { @@ -718,13 +717,13 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { mainFrame.panel.timeline(); break; /*case ACTION_AUTO_DEOBFUSCATE: - if (View.showConfirmDialog(mainFrame.panel, translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) { - Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected()); - mainFrame.panel.autoDeobfuscateChanged(); - } else { - miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected()); - } - break;*/ + if (View.showConfirmDialog(mainFrame.panel, translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) { + Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected()); + mainFrame.panel.autoDeobfuscateChanged(); + } else { + miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected()); + } + break;*/ case ACTION_CLEAR_RECENT_FILES: Configuration.recentFiles.set(null); break; diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 20cc0072e..b0787e818 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -980,7 +980,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec allSwfs.add(swf); } } - + for (int j = 0; j < allSwfs.size(); j++) { List as3scripts = new ArrayList<>(); List images = new ArrayList<>(); @@ -1000,7 +1000,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec if (!allSwfs.contains(selectedNodeSwf)) { allSwfs.add(selectedNodeSwf); } - + if (selectedNodeSwf != swf) { continue; } diff --git a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTreeModel.java b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTreeModel.java index a50322e2f..ece7e4f7f 100644 --- a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTreeModel.java @@ -93,7 +93,7 @@ public class DumpTreeModel implements TreeModel { @Override public int getChildCount(Object o) { - DumpInfo di = (DumpInfo) o; + DumpInfo di = (DumpInfo) o; if (di.tagToResolve != null) { TagStub tagStub = di.tagToResolve; try { diff --git a/src/com/jpexs/decompiler/flash/helpers/EmptySWFDecompilerListener.java b/src/com/jpexs/decompiler/flash/helpers/EmptySWFDecompilerListener.java index 09db64215..128a397b5 100644 --- a/src/com/jpexs/decompiler/flash/helpers/EmptySWFDecompilerListener.java +++ b/src/com/jpexs/decompiler/flash/helpers/EmptySWFDecompilerListener.java @@ -29,5 +29,5 @@ public class EmptySWFDecompilerListener implements SWFDecompilerListener { public void actionListParsed(ActionList actions, SWF swf) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } - + } diff --git a/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java b/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java index c623c9212..aae9d27fa 100644 --- a/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java +++ b/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java @@ -24,6 +24,6 @@ import com.jpexs.decompiler.flash.action.ActionList; * @author JPEXS */ public interface SWFDecompilerListener { - + void actionListParsed(ActionList actions, SWF swf); } diff --git a/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerPlugin.java b/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerPlugin.java index 0aec2e1c7..9c8edf6a0 100644 --- a/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerPlugin.java +++ b/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerPlugin.java @@ -35,12 +35,12 @@ import javax.tools.ToolProvider; public class SWFDecompilerPlugin { public static SWFDecompilerListener listener; - + public static void loadPlugin(String path) { - + // Here we specify the source code of the class to be compiled String src = Helper.readTextFile(path); - + // Full name of the class that will be compiled. // If class should be in some package, // fullName should contain it too @@ -53,8 +53,7 @@ public class SWFDecompilerPlugin { // we create a file manager // (our custom implementation of it) JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - JavaFileManager fileManager = new - ClassFileManager(compiler.getStandardFileManager(null, null, null)); + JavaFileManager fileManager = new ClassFileManager(compiler.getStandardFileManager(null, null, null)); // Dynamic compiling requires specifying // a list of "files" to compile. In our case diff --git a/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index 71ef5b34e..e015cd521 100644 --- a/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -338,7 +338,7 @@ public class DefineTextTag extends TextTag { if (txt == null || (font == null && txt.isEmpty())) { continue; } - + if (font == null) { throw new ParseException("Font not defined", lexer.yyline()); } diff --git a/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java b/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java index fd7ec44bc..6eff63a23 100644 --- a/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java +++ b/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java @@ -401,6 +401,7 @@ public final class TextLexer { /** * Closes the input stream. + * * @throws java.io.IOException */ public final void yyclose() throws java.io.IOException { @@ -436,7 +437,8 @@ public final class TextLexer { /** * Returns the current lexical state. - * @return + * + * @return */ public final int yystate() { return zzLexicalState; @@ -453,7 +455,8 @@ public final class TextLexer { /** * Returns the text matched by the current regular expression. - * @return + * + * @return */ public final String yytext() { return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead); @@ -475,7 +478,8 @@ public final class TextLexer { /** * Returns the length of the matched text region. - * @return + * + * @return */ public final int yylength() { return zzMarkedPos - zzStartRead; diff --git a/src/com/jpexs/decompiler/graph/Graph.java b/src/com/jpexs/decompiler/graph/Graph.java index 9007fa32f..13fc84470 100644 --- a/src/com/jpexs/decompiler/graph/Graph.java +++ b/src/com/jpexs/decompiler/graph/Graph.java @@ -1555,7 +1555,7 @@ public class Graph { List nps; /*nps = new ArrayList<>(part.nextParts); - for(int i=0;i