Merge origin/master

Conflicts:
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java
This commit is contained in:
Jindra Petřík
2015-07-06 17:56:59 +02:00
27 changed files with 89 additions and 85 deletions
@@ -204,7 +204,7 @@ public class ScriptPack extends AS3ClassTreeItem {
appendTo(writer, traits, exportMode, parallel);
}
public File export(String directory, ScriptExportSettings exportSettings, boolean parallel) throws IOException {
public File export(String directory, ScriptExportSettings exportSettings, boolean parallel) throws IOException, InterruptedException {
File file = null;
if (!exportSettings.singleFile) {
@@ -212,12 +212,8 @@ public class ScriptPack extends AS3ClassTreeItem {
}
try (FileTextWriter writer = exportSettings.singleFile ? null : new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(file))) {
try {
FileTextWriter writer2 = exportSettings.singleFile ? exportSettings.singleFileWriter : writer;
toSource(writer2, abc.script_info.get(scriptIndex).traits.traits, exportSettings.mode, parallel);
} catch (InterruptedException ex) {
logger.log(Level.SEVERE, null, ex);
}
FileTextWriter writer2 = exportSettings.singleFile ? exportSettings.singleFileWriter : writer;
toSource(writer2, abc.script_info.get(scriptIndex).traits.traits, exportSettings.mode, parallel);
} catch (FileNotFoundException ex) {
logger.log(Level.SEVERE, "The file path is probably too long", ex);
}
@@ -1394,25 +1394,21 @@ public class AVM2Code implements Cloneable {
private Map<Integer, Set<Integer>> killedRegs = new HashMap<>();
public void calcKilledStats(MethodBody body) {
public void calcKilledStats(MethodBody body) throws InterruptedException {
killedRegs.clear();
try {
HashMap<Integer, List<Integer>> vis = visitCode(body);
for (int k = 0; k < code.size(); k++) {
if (vis.get(k).isEmpty()) {
continue;
}
if (code.get(k).definition instanceof KillIns) {
int regid = code.get(k).operands[0];
if (!killedRegs.containsKey(regid)) {
killedRegs.put(regid, new HashSet<>());
}
killedRegs.get(regid).add(k);
}
}
HashMap<Integer, List<Integer>> vis = visitCode(body);
} catch (InterruptedException ex) {
// ignored
for (int k = 0; k < code.size(); k++) {
if (vis.get(k).isEmpty()) {
continue;
}
if (code.get(k).definition instanceof KillIns) {
int regid = code.get(k).operands[0];
if (!killedRegs.containsKey(regid)) {
killedRegs.put(regid, new HashSet<>());
}
killedRegs.get(regid).add(k);
}
}
}
@@ -193,7 +193,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
action.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");
//if (!(def instanceof KillIns))
//if (!(def instanceof KillIns))
if (def instanceof SetLocalTypeIns) {
int regId = ((SetLocalTypeIns) def).getRegisterId(action);
if (!ignored.contains(regId)) {
@@ -226,7 +226,7 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener {
return localData;
}
private void executeActions(Map<Integer, GraphTargetItem> staticRegs, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, List<AVM2Instruction> inlineIns) {
private void executeActions(Map<Integer, GraphTargetItem> staticRegs, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, List<AVM2Instruction> inlineIns) throws InterruptedException {
List<GraphTargetItem> output = new ArrayList<>();
AVM2LocalData localData = newLocalData(scriptIndex, abc, abc.constants, body, isStatic, classIndex);
@@ -395,6 +395,8 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener {
break;
}
}
} catch (InterruptedException ex) {
throw ex;
} catch (Exception ex) {
//ignore
}