diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java index 472aa6bdd..5fadb3a3d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java @@ -155,6 +155,16 @@ public class AVM2DeobfuscatorSimpleOld extends SWFDecompilerAdapter { return false; } + // find jump targets + List jumpTargets = new ArrayList(); + for (int i = 0; i < code.code.size(); i++) { + AVM2Instruction ins = code.code.get(i); + if (ins.definition instanceof JumpIns) { + long address = ins.getTargetAddress(); + jumpTargets.add( code.adr2pos(address) ); + } + } + AVM2LocalData localData = newLocalData(scriptIndex, abc, abc.constants, body, isStatic, classIndex); int localReservedCount = body.getLocalReservedCount(); for (int i = 0; i < code.code.size(); i++) { @@ -168,7 +178,7 @@ public class AVM2DeobfuscatorSimpleOld extends SWFDecompilerAdapter { localData.localRegs.clear(); initLocalRegs(localData, localReservedCount, body.max_regs); - executeInstructions(staticRegs, body, abc, code, localData, i, code.code.size() - 1, null, inlineIns); + executeInstructions(staticRegs, body, abc, code, localData, i, code.code.size() - 1, null, inlineIns, jumpTargets); } return false; @@ -218,7 +228,7 @@ public class AVM2DeobfuscatorSimpleOld extends SWFDecompilerAdapter { } } - private void executeInstructions(Map staticRegs, MethodBody body, ABC abc, AVM2Code code, AVM2LocalData localData, int idx, int endIdx, ExecutionResult result, List inlineIns) throws InterruptedException { + private void executeInstructions(Map staticRegs, MethodBody body, ABC abc, AVM2Code code, AVM2LocalData localData, int idx, int endIdx, ExecutionResult result, List inlineIns, List jumpTargets) throws InterruptedException { List output = new ArrayList<>(); FixItemCounterTranslateStack stack = new FixItemCounterTranslateStack(""); @@ -284,9 +294,13 @@ public class AVM2DeobfuscatorSimpleOld extends SWFDecompilerAdapter { if (inlineIns.contains(ins)) { if (def instanceof SetLocalTypeIns) { - int regId = ((SetLocalTypeIns) def).getRegisterId(ins); - staticRegs.put(regId, localData.localRegs.get(regId).getNotCoerced()); - code.replaceInstruction(idx, new AVM2Instruction(0, DeobfuscatePopIns.getInstance(), null), body); + InstructionDefinition prevDef = code.code.get(idx-1).definition; + if ((prevDef instanceof DupIns && !jumpTargets.contains(idx-2)) || !jumpTargets.contains(idx-1)) + { + int regId = ((SetLocalTypeIns) def).getRegisterId(ins); + staticRegs.put(regId, localData.localRegs.get(regId).getNotCoerced()); + code.replaceInstruction(idx, new AVM2Instruction(0, DeobfuscatePopIns.getInstance(), null), body); + } } } if (def instanceof GetLocalTypeIns) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewFunctionIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewFunctionIns.java index a2360d9d5..c24b2756a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewFunctionIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewFunctionIns.java @@ -39,7 +39,7 @@ public class NewFunctionIns extends InstructionDefinition { @Override public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) { int methodIndex = ins.operands[0]; - NewFunctionAVM2Item function = new NewFunctionAVM2Item(ins, localData.lineStartInstruction, "", path, localData.isStatic, localData.scriptIndex, localData.classIndex, localData.abc, localData.fullyQualifiedNames, methodIndex); + NewFunctionAVM2Item function = new NewFunctionAVM2Item(ins, localData.lineStartInstruction, "", path, false, localData.scriptIndex, localData.classIndex, localData.abc, localData.fullyQualifiedNames, methodIndex); stack.push(function); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java index 423dbc074..3d1159eaf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java @@ -108,6 +108,8 @@ public abstract class AVM2Item extends GraphTargetItem { } if (propertyName instanceof FullMultinameAVM2Item) { if (((FullMultinameAVM2Item) propertyName).name != null) { + if (((FullMultinameAVM2Item) propertyName).namespace != null) + writer.append("."); return propertyName.toString(writer, localData); } else { writer.append("."); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/RegExpAvm2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/RegExpAvm2Item.java index b8fda568a..26b7a666f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/RegExpAvm2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/RegExpAvm2Item.java @@ -60,8 +60,6 @@ public class RegExpAvm2Item extends AVM2Item implements Callable { ret.append("\\b"); } else if (c == '\f') { ret.append("\\f"); - } else if (c == '/') { - ret.append("\\/"); } else if (c < 32) { ret.append("\\x").append(Helper.byteToHex((byte) c)); } else {