removed some unnecessary parameters + small fixes

This commit is contained in:
2015-10-21 08:54:25 +02:00
parent a093b2580e
commit 099bffdf68
70 changed files with 270 additions and 158 deletions
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.BaseLocalData;
import com.jpexs.decompiler.flash.DisassemblyListener;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscatorSimpleFast;
import com.jpexs.decompiler.flash.action.model.ActionItem;
import com.jpexs.decompiler.flash.action.model.ConstantPool;
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
@@ -64,6 +65,7 @@ import com.jpexs.decompiler.flash.helpers.CodeFormatting;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin;
import com.jpexs.decompiler.flash.helpers.collections.MyEntry;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.graph.Graph;
@@ -817,13 +819,20 @@ public abstract class Action implements GraphSourceItem {
List<GraphTargetItem> tree = null;
Throwable convertException = null;
int timeout = Configuration.decompilationTimeoutSingleMethod.get();
final int version = asm == null ? SWF.DEFAULT_VERSION : asm.getSwf().version;
final SWF swf = asm == null ? null : asm.getSwf();
final int version = swf == null ? SWF.DEFAULT_VERSION : swf.version;
try {
tree = CancellableWorker.call(new Callable<List<GraphTargetItem>>() {
@Override
public List<GraphTargetItem> call() throws Exception {
int staticOperation = Graph.SOP_USE_STATIC; //(Boolean) Configuration.getConfig("autoDeobfuscate", true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC;
List<GraphTargetItem> tree = actionsToTree(new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path);
SWFDecompilerPlugin.fireActionTreeCreated(tree, swf);
int deobfuscationMode = Configuration.autoDeobfuscate.get() ? (Configuration.deobfuscationOldMode.get() ? 0 : 1) : -1;
if (deobfuscationMode == 1) {
new ActionDeobfuscatorSimpleFast().actionTreeCreated(tree, swf);
}
Graph.graphToString(tree, new NulWriter(), new LocalData());
return tree;
}
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.deobfuscation;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.ActionList;
import com.jpexs.decompiler.flash.action.ActionLocalData;
@@ -419,6 +420,10 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener {
public void methodBodyParsed(MethodBody body, SWF swf) {
}
@Override
public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException {
}
class ExecutionResult {
public int idx = -1;
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.deobfuscation;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.ActionList;
import com.jpexs.decompiler.flash.action.ActionListReader;
@@ -652,6 +653,10 @@ public class ActionDeobfuscatorSimpleFast implements SWFDecompilerListener {
public void methodBodyParsed(MethodBody body, SWF swf) {
}
@Override
public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException {
}
class ExecutionResult {
public ActionItem item = null;
@@ -176,8 +176,8 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
if (value instanceof RegisterNumber) {
return writer.append(((RegisterNumber) value).translate());
}
return writer.append(value.toString());
//return writer.append(EcmaScript.toString(value, true)); // todo, use this line
//return writer.append(value.toString());
return writer.append(EcmaScript.toString(value, true)); // todo, use this line
}
@Override
@@ -64,7 +64,7 @@ public class GetVariableActionItem extends ActionItem {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
if (((name instanceof DirectValueActionItem)) && (((DirectValueActionItem) name).isString()) && (!IdentifiersDeobfuscation.isValidName(false, ((DirectValueActionItem) name).toStringNoQuotes(localData), "this", "super"))) {
if (((name instanceof DirectValueActionItem)) && (((DirectValueActionItem) name).isString()) && (!IdentifiersDeobfuscation.isValidNameWithDot(false, ((DirectValueActionItem) name).toStringNoQuotes(localData), "this", "super"))) {
return IdentifiersDeobfuscation.appendObfuscatedIdentifier(((DirectValueActionItem) name).toStringNoQuotes(localData), writer);
} else if ((!(name instanceof DirectValueActionItem)) || (!((DirectValueActionItem) name).isString())) {
writer.append("eval(");
@@ -85,7 +85,7 @@ public class ActionIf extends Action {
@Override
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
long address = getAddress() + getTotalActionLength() + offset;
long address = getTargetAddress();
String ofsStr = Helper.formatAddress(address);
return "If loc" + ofsStr + (!jumpUsed ? " ;compileTimeIgnore" : (!ignoreUsed ? " ;compileTimeJump" : ""));
}
@@ -85,7 +85,7 @@ public class ActionJump extends Action {
@Override
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
long address = getAddress() + getTotalActionLength() + offset;
long address = getTargetAddress();
String ofsStr = Helper.formatAddress(address);
return "Jump loc" + ofsStr;
}