From a4f4dd3604627e92ee023fa3025bf3ab73119a82 Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Fri, 23 Oct 2015 12:56:27 +0200 Subject: [PATCH] small improvements, little bit faster decompilation by caching the number values of the strings --- .../decompiler/flash/abc/avm2/AVM2Code.java | 10 +-- .../deobfuscation/AVM2DeobfuscatorSimple.java | 18 +++--- .../flash/abc/avm2/graph/AVM2Graph.java | 3 +- .../avm2/instructions/AVM2Instruction.java | 64 ++++++++----------- .../instructions/InstructionDefinition.java | 2 +- .../avm2/instructions/arithmetic/AddIns.java | 2 +- .../arithmetic/DecrementIIns.java | 2 +- .../instructions/arithmetic/DecrementIns.java | 2 +- .../instructions/arithmetic/DivideIns.java | 2 +- .../instructions/arithmetic/ModuloIns.java | 2 +- .../instructions/arithmetic/MultiplyIns.java | 2 +- .../avm2/instructions/bitwise/BitAndIns.java | 2 +- .../avm2/instructions/bitwise/BitNotIns.java | 2 +- .../avm2/instructions/bitwise/BitOrIns.java | 2 +- .../avm2/instructions/bitwise/BitXorIns.java | 2 +- .../avm2/instructions/bitwise/LShiftIns.java | 2 +- .../avm2/instructions/bitwise/RShiftIns.java | 2 +- .../avm2/instructions/bitwise/URShiftIns.java | 2 +- .../instructions/comparison/EqualsIns.java | 2 +- .../construction/ConstructIns.java | 4 +- .../construction/ConstructPropIns.java | 6 +- .../construction/ConstructSuperIns.java | 4 +- .../avm2/instructions/debug/DebugFileIns.java | 3 +- .../abc/avm2/instructions/debug/DebugIns.java | 3 +- .../avm2/instructions/debug/DebugLineIns.java | 3 +- .../avm2/instructions/executing/CallIns.java | 4 +- .../instructions/executing/CallMethodIns.java | 6 +- .../executing/CallPropVoidIns.java | 6 +- .../executing/CallPropertyIns.java | 6 +- .../instructions/executing/CallStaticIns.java | 6 +- .../instructions/executing/CallSuperIns.java | 6 +- .../executing/CallSuperVoidIns.java | 6 +- .../instructions/localregs/DecLocalIIns.java | 4 +- .../instructions/localregs/DecLocalIns.java | 4 +- .../instructions/localregs/GetLocal0Ins.java | 2 +- .../instructions/localregs/GetLocal1Ins.java | 2 +- .../instructions/localregs/GetLocal2Ins.java | 2 +- .../instructions/localregs/GetLocal3Ins.java | 2 +- .../instructions/localregs/GetLocalIns.java | 5 +- .../instructions/other/DeletePropertyIns.java | 4 +- .../instructions/other/FindPropertyIns.java | 4 +- .../other/FindPropertyStrictIns.java | 4 +- .../instructions/other/GetDescendantsIns.java | 4 +- .../instructions/other/GetGlobalScopeIns.java | 2 +- .../abc/avm2/instructions/other/LabelIns.java | 3 +- .../abc/avm2/instructions/other/NopIns.java | 3 +- .../abc/avm2/instructions/stack/DupIns.java | 2 +- .../abc/avm2/instructions/stack/PopIns.java | 2 +- .../avm2/instructions/stack/PopScopeIns.java | 2 +- .../avm2/instructions/stack/PushByteIns.java | 4 +- .../instructions/stack/PushDoubleIns.java | 4 +- .../avm2/instructions/stack/PushFalseIns.java | 2 +- .../avm2/instructions/stack/PushIntIns.java | 4 +- .../avm2/instructions/stack/PushScopeIns.java | 2 +- .../avm2/instructions/stack/PushShortIns.java | 4 +- .../instructions/stack/PushStringIns.java | 4 +- .../avm2/instructions/stack/PushTrueIns.java | 2 +- .../avm2/instructions/stack/PushUIntIns.java | 4 +- .../abc/avm2/instructions/stack/SwapIns.java | 2 +- .../avm2/instructions/types/ApplyTypeIns.java | 4 +- .../avm2/instructions/types/AsTypeIns.java | 4 +- .../instructions/types/AsTypeLateIns.java | 2 +- .../avm2/instructions/types/CoerceAIns.java | 2 +- .../avm2/instructions/types/CoerceIns.java | 4 +- .../avm2/instructions/types/CoerceSIns.java | 2 +- .../avm2/instructions/types/ConvertBIns.java | 2 +- .../avm2/instructions/types/ConvertDIns.java | 2 +- .../avm2/instructions/types/ConvertIIns.java | 2 +- .../avm2/instructions/types/ConvertOIns.java | 2 +- .../avm2/instructions/types/ConvertSIns.java | 2 +- .../avm2/instructions/types/ConvertUIns.java | 2 +- .../avm2/instructions/xml/CheckFilterIns.java | 2 +- .../abc/avm2/instructions/xml/DXNSIns.java | 5 +- .../avm2/instructions/xml/DXNSLateIns.java | 2 +- .../avm2/instructions/xml/EscXAttrIns.java | 2 +- .../avm2/instructions/xml/EscXElemIns.java | 2 +- .../flash/abc/avm2/model/ConvertAVM2Item.java | 4 +- .../abc/avm2/model/DecrementAVM2Item.java | 3 +- .../abc/avm2/model/IncrementAVM2Item.java | 3 +- .../abc/avm2/model/LocalRegAVM2Item.java | 5 ++ .../flash/abc/avm2/model/StringAVM2Item.java | 22 ++++++- .../flash/abc/avm2/model/XMLAVM2Item.java | 2 +- .../avm2/model/operations/BitAndAVM2Item.java | 3 +- .../avm2/model/operations/BitNotAVM2Item.java | 3 +- .../avm2/model/operations/BitOrAVM2Item.java | 3 +- .../avm2/model/operations/BitXorAVM2Item.java | 3 +- .../avm2/model/operations/DivideAVM2Item.java | 11 ++-- .../avm2/model/operations/LShiftAVM2Item.java | 3 +- .../avm2/model/operations/ModuloAVM2Item.java | 7 +- .../model/operations/MultiplyAVM2Item.java | 3 +- .../avm2/model/operations/NegAVM2Item.java | 3 +- .../avm2/model/operations/RShiftAVM2Item.java | 3 +- .../model/operations/SubtractAVM2Item.java | 3 +- .../model/operations/URShiftAVM2Item.java | 3 +- .../parser/script/AVM2SourceGenerator.java | 4 +- .../parser/script/ActionScript3Parser.java | 3 +- .../action/model/AsciiToCharActionItem.java | 3 +- .../action/model/DecrementActionItem.java | 12 ++-- .../action/model/IncrementActionItem.java | 12 ++-- .../action/model/MBAsciiToCharActionItem.java | 3 +- .../action/model/PostDecrementActionItem.java | 3 +- .../action/model/PostIncrementActionItem.java | 3 +- .../action/model/StartDragActionItem.java | 5 +- .../action/model/ToIntegerActionItem.java | 3 +- .../action/model/ToNumberActionItem.java | 3 +- .../model/operations/BitAndActionItem.java | 12 ++-- .../model/operations/BitOrActionItem.java | 12 ++-- .../model/operations/BitXorActionItem.java | 12 ++-- .../model/operations/DivideActionItem.java | 5 +- .../model/operations/LShiftActionItem.java | 12 ++-- .../model/operations/ModuloActionItem.java | 5 +- .../model/operations/MultiplyActionItem.java | 12 ++-- .../operations/PreDecrementActionItem.java | 9 ++- .../operations/PreIncrementActionItem.java | 9 ++- .../model/operations/RShiftActionItem.java | 5 +- .../model/operations/SubtractActionItem.java | 12 ++-- .../model/operations/URShiftActionItem.java | 5 +- .../flash/action/swf4/ActionStartDrag.java | 5 +- .../decompiler/graph/GraphTargetItem.java | 4 ++ .../decompiler/graph/model/DuplicateItem.java | 5 ++ 120 files changed, 291 insertions(+), 288 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 7ceb59309..2a291e09f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -648,13 +648,13 @@ public class AVM2Code implements Cloneable { while (true) { AVM2Instruction ins = code.get(pos); if (ins.definition instanceof JumpIns) { - pos = adr2pos((Long) ins.getParamsAsList(constants).get(0)); + pos = adr2pos(ins.getParamAsLong(constants, 0)); continue; } if (ins.definition instanceof IfFalseIns) { Boolean b = (Boolean) lda.operandStack.pop(); if (b == false) { - pos = adr2pos((Long) ins.getParamsAsList(constants).get(0)); + pos = adr2pos(ins.getParamAsLong(constants, 0)); } else { pos++; } @@ -663,7 +663,7 @@ public class AVM2Code implements Cloneable { if (ins.definition instanceof IfTrueIns) { Boolean b = (Boolean) lda.operandStack.pop(); if (b == true) { - pos = adr2pos((Long) ins.getParamsAsList(constants).get(0)); + pos = adr2pos(ins.getParamAsLong(constants, 0)); } else { pos++; } @@ -675,7 +675,7 @@ public class AVM2Code implements Cloneable { if (ins.definition instanceof ReturnVoidIns) { return null; } - ins.definition.execute(lda, constants, ins.getParamsAsList(constants)); + ins.definition.execute(lda, constants, ins); pos++; } } catch (ConvertException e) { @@ -853,7 +853,7 @@ public class AVM2Code implements Cloneable { if (instr != null) { int[] actualOperands = null; - if (instructionCode == 0x1b) { // switch + if (instructionCode == AVM2Instructions.LookupSwitch) { // switch int firstOperand = ais.readS24("default_offset"); int case_count = ais.readU30("case_count"); long afterCasePos = ais.getPosition() + 3 * (case_count + 1); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java index 0c9b1beb9..fcd99a650 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java @@ -155,7 +155,7 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener { return makePush(fv.value, cpool); } else if (graphTargetItem instanceof StringAVM2Item) { StringAVM2Item fv = (StringAVM2Item) graphTargetItem; - return makePush(fv.value, cpool); + return makePush(fv.getValue(), cpool); } else if (graphTargetItem instanceof TrueItem) { return makePush(Boolean.TRUE, cpool); } else if (graphTargetItem instanceof FalseItem) { @@ -335,8 +335,8 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener { || def instanceof SubtractIIns || def instanceof ModuloIns || def instanceof MultiplyIns - || def instanceof MultiplyIIns - || def instanceof DivideIns + || def instanceof MultiplyIIns// + || def instanceof DivideIns// || def instanceof BitAndIns || def instanceof BitXorIns || def instanceof BitOrIns @@ -345,12 +345,12 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener { || def instanceof URShiftIns || def instanceof EqualsIns || def instanceof NotIns - || def instanceof NegateIns - || def instanceof NegateIIns - || def instanceof IncrementIns - || def instanceof IncrementIIns - || def instanceof DecrementIns - || def instanceof DecrementIIns + || def instanceof NegateIns// + || def instanceof NegateIIns// + || def instanceof IncrementIns// + || def instanceof IncrementIIns// + || def instanceof DecrementIns// + || def instanceof DecrementIIns // || def instanceof IfTypeIns || def instanceof JumpIns || def instanceof EqualsIns diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index 23b54aa9f..81bbe5bea 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -55,7 +55,6 @@ import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictEqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictNeqAVM2Item; import com.jpexs.decompiler.flash.abc.types.ABCException; import com.jpexs.decompiler.flash.abc.types.MethodBody; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.Graph; import com.jpexs.decompiler.graph.GraphPart; @@ -673,7 +672,7 @@ public class AVM2Graph extends Graph { if (stack != null && swip != -1) { AVM2Instruction swIns = avm2code.code.get(swip); GraphTargetItem t = stack.pop(); - Double dval = EcmaScript.toNumber(t.getResult()); + Double dval = t.getResultAsNumber(); int val = (int) (double) dval; if (swIns.definition instanceof LookupSwitchIns) { List branches = swIns.getBranches(code); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index f3a8e641a..5b54679b7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -171,48 +171,40 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { } break; } - } + return ret; } - public List getParamsAsList(AVM2ConstantPool constants) { - List s = new ArrayList<>(); - for (int i = 0; i < definition.operands.length; i++) { - switch (definition.operands[i]) { - case AVM2Code.DAT_MULTINAME_INDEX: - s.add(constants.getMultiname(operands[i])); - break; - case AVM2Code.DAT_STRING_INDEX: - s.add(constants.getString(operands[i])); - break; - case AVM2Code.DAT_INT_INDEX: - s.add(constants.getInt(operands[i])); - break; - case AVM2Code.DAT_UINT_INDEX: - s.add(constants.getUInt(operands[i])); - break; - case AVM2Code.DAT_DOUBLE_INDEX: - s.add(constants.getDouble(operands[i])); - break; - case AVM2Code.DAT_OFFSET: - s.add(offset + operands[i] + getBytesLength()); - break; - case AVM2Code.DAT_CASE_BASEOFFSET: - s.add(offset + operands[i]); - break; - case AVM2Code.OPT_CASE_OFFSETS: - s.add((long) operands[i]); - for (int j = i + 1; j < operands.length; j++) { - s.add(offset + operands[j]); - } - break; - default: - s.add((long) operands[i]); - } + public Object getParam(AVM2ConstantPool constants, int idx) { + //if (idx < 0 || idx >= definition.operands.length) { + // return null; + //} + switch (definition.operands[idx]) { + case AVM2Code.DAT_MULTINAME_INDEX: + return constants.getMultiname(operands[idx]); + case AVM2Code.DAT_STRING_INDEX: + return constants.getString(operands[idx]); + case AVM2Code.DAT_INT_INDEX: + return constants.getInt(operands[idx]); + case AVM2Code.DAT_UINT_INDEX: + return constants.getUInt(operands[idx]); + case AVM2Code.DAT_DOUBLE_INDEX: + return constants.getDouble(operands[idx]); + case AVM2Code.DAT_OFFSET: + return offset + operands[idx] + getBytesLength(); + case AVM2Code.DAT_CASE_BASEOFFSET: + return offset + operands[idx]; + case AVM2Code.OPT_CASE_OFFSETS: + return (long) operands[idx]; // offsets: offset + operands[i]; + default: + return (long) operands[idx]; } - return s; + } + + public Long getParamAsLong(AVM2ConstantPool constants, int idx) { + return (Long) getParam(constants, idx); } public String getParams(AVM2ConstantPool constants, List fullyQualifiedNames) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java index 2a70069ff..6fae70698 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java @@ -84,7 +84,7 @@ public abstract class InstructionDefinition implements Serializable { return s.toString(); } - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { throw new UnsupportedOperationException("Instruction " + instructionName + " not implemented"); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java index c0a2a71e9..067d3d834 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java @@ -34,7 +34,7 @@ public class AddIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object o1 = lda.operandStack.pop(); Object o2 = lda.operandStack.pop(); if ((o1 instanceof Long) && ((o2 instanceof Long))) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIIns.java index 3c0351d65..9b55c6d27 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIIns.java @@ -34,7 +34,7 @@ public class DecrementIIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj = lda.operandStack.pop(); if (obj instanceof Long) { Long obj2 = ((Long) obj) - 1; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIns.java index c4d446f28..d999ab21f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIns.java @@ -34,7 +34,7 @@ public class DecrementIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj = lda.operandStack.pop(); if (obj instanceof Long) { Long obj2 = ((Long) obj) - 1; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java index a542627f2..d8a6ef1f8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java @@ -34,7 +34,7 @@ public class DivideIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object o2 = lda.operandStack.pop(); Object o1 = lda.operandStack.pop(); if ((o1 instanceof Long) && ((o2 instanceof Long))) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java index bbba93712..6524a05f0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java @@ -34,7 +34,7 @@ public class ModuloIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object o1 = lda.operandStack.pop(); Object o2 = lda.operandStack.pop(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java index 6e31d031c..44e86a8d0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java @@ -34,7 +34,7 @@ public class MultiplyIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object o1 = lda.operandStack.pop(); Object o2 = lda.operandStack.pop(); if ((o1 instanceof Long) && ((o2 instanceof Long))) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitAndIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitAndIns.java index 01474428a..34a9d50dc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitAndIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitAndIns.java @@ -34,7 +34,7 @@ public class BitAndIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Long value2 = (Long) lda.operandStack.pop(); Long value1 = (Long) lda.operandStack.pop(); Long value3 = value1 & value2; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java index a807b69f7..0472fde3f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java @@ -34,7 +34,7 @@ public class BitNotIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Long value = (Long) lda.operandStack.pop(); Long ret = -value; lda.operandStack.push(ret); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitOrIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitOrIns.java index 438b2be74..3ef874f8e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitOrIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitOrIns.java @@ -34,7 +34,7 @@ public class BitOrIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Long value2 = (Long) lda.operandStack.pop(); Long value1 = (Long) lda.operandStack.pop(); Long value3 = value1 | value2; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitXorIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitXorIns.java index 631e033a4..4f5d4aa72 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitXorIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitXorIns.java @@ -34,7 +34,7 @@ public class BitXorIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Long value2 = (Long) lda.operandStack.pop(); Long value1 = (Long) lda.operandStack.pop(); Long value3 = value1 ^ value2; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/LShiftIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/LShiftIns.java index bef0cf1bd..eb6f36de0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/LShiftIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/LShiftIns.java @@ -34,7 +34,7 @@ public class LShiftIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { int value2 = (int) ((Long) lda.operandStack.pop() & 0x1F); int value1 = ((Long) lda.operandStack.pop()).intValue(); Long value3 = (long) (value1 << value2); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/RShiftIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/RShiftIns.java index a27753fe8..08ed8bc80 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/RShiftIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/RShiftIns.java @@ -34,7 +34,7 @@ public class RShiftIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { int value2 = (int) ((Long) lda.operandStack.pop() & 0x1F); int value1 = ((Long) lda.operandStack.pop()).intValue(); Long value3 = (long) (value1 >> value2); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/URShiftIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/URShiftIns.java index 3716f0e5e..dc8ade7c5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/URShiftIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/URShiftIns.java @@ -34,7 +34,7 @@ public class URShiftIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Long value2 = ((Long) lda.operandStack.pop() & 0x1F); Long value1 = (Long) lda.operandStack.pop(); Long value3 = value1 >>> value2; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/EqualsIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/EqualsIns.java index 4da636b67..988329903 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/EqualsIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparison/EqualsIns.java @@ -34,7 +34,7 @@ public class EqualsIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj1 = lda.operandStack.pop(); Object obj2 = lda.operandStack.pop(); Boolean res = obj1.equals(obj2); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java index 06715d1b8..04c289c6a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java @@ -45,8 +45,8 @@ public class ConstructIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int argCount = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int argCount = ins.getParamAsLong(constants, 0).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java index 1b2755cc1..8a1d89c72 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java @@ -38,9 +38,9 @@ public class ConstructPropIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int multinameIndex = ins.getParamAsLong(constants, 0).intValue(); + int argCount = ins.getParamAsLong(constants, 1).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java index 8f072f211..74b6cb6d4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java @@ -36,8 +36,8 @@ public class ConstructSuperIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int argCount = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int argCount = ins.getParamAsLong(constants, 0).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugFileIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugFileIns.java index 9fa629b86..55afdb90d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugFileIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugFileIns.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.debug; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import java.util.List; @@ -29,6 +30,6 @@ public class DebugFileIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugIns.java index efe5dccd1..33f10d420 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugIns.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.debug; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import java.util.List; @@ -29,6 +30,6 @@ public class DebugIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugLineIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugLineIns.java index 865fbf900..67d535c99 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugLineIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugLineIns.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.debug; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import java.util.List; @@ -29,6 +30,6 @@ public class DebugLineIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java index e7f7e8a8c..4d5155f44 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java @@ -36,8 +36,8 @@ public class CallIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int argCount = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int argCount = ins.getParamAsLong(constants, 0).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java index 8aedaf2c5..d92cf136f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java @@ -36,9 +36,9 @@ public class CallMethodIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method - int argCount = (int) ((Long) arguments.get(1)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int methodIndex = ins.getParamAsLong(constants, 0).intValue(); //index of object's method + int argCount = ins.getParamAsLong(constants, 1).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java index 3e0ce2e49..e64fa04d3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java @@ -37,11 +37,11 @@ public class CallPropVoidIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { //same as callproperty /* - int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); + int multinameIndex = ins.getParamAsLong(constants, 0).intValue(); + int argCount = ins.getParamAsLong(constants, 1).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java index 8e36c4641..d8976a12c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java @@ -37,9 +37,9 @@ public class CallPropertyIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int multinameIndex = ins.getParamAsLong(constants, 0).intValue(); + int argCount = ins.getParamAsLong(constants, 1).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java index 1e64c093c..a6d01b2a2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java @@ -36,9 +36,9 @@ public class CallStaticIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info - int argCount = (int) ((Long) arguments.get(1)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int methodIndex = ins.getParamAsLong(constants, 0).intValue(); //index of method_info + int argCount = ins.getParamAsLong(constants, 1).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java index cecce19fb..080409a34 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java @@ -37,9 +37,9 @@ public class CallSuperIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int multinameIndex = ins.getParamAsLong(constants, 0).intValue(); + int argCount = ins.getParamAsLong(constants, 1).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java index c04d79b62..c78cd07ff 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java @@ -37,9 +37,9 @@ public class CallSuperVoidIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int multinameIndex = ins.getParamAsLong(constants, 0).intValue(); + int argCount = ins.getParamAsLong(constants, 1).intValue(); List passArguments = new ArrayList(); for (int i = argCount - 1; i >= 0; i--) { passArguments.set(i, lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java index 0f7f74e9e..44bfb190b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java @@ -36,8 +36,8 @@ public class DecLocalIIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - int locRegIndex = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + int locRegIndex = ins.getParamAsLong(constants, 0).intValue(); Object obj = lda.localRegisters.get(locRegIndex); if (obj instanceof Long) { Long obj2 = ((Long) obj) - 1; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java index ac14150e4..1a41b1ee0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java @@ -36,8 +36,8 @@ public class DecLocalIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - int locRegIndex = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + int locRegIndex = ins.getParamAsLong(constants, 0).intValue(); Object obj = lda.localRegisters.get(locRegIndex); if (obj instanceof Long) { Long obj2 = ((Long) obj) - 1; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal0Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal0Ins.java index 33ec50c82..85838ea5b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal0Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal0Ins.java @@ -28,7 +28,7 @@ public class GetLocal0Ins extends GetLocalTypeIns { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { lda.operandStack.push(lda.localRegisters.get(0)); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal1Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal1Ins.java index fd7d447e0..9765a584f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal1Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal1Ins.java @@ -28,7 +28,7 @@ public class GetLocal1Ins extends GetLocalTypeIns { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { lda.operandStack.push(lda.localRegisters.get(1)); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal2Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal2Ins.java index d2d34a85f..dec29ec41 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal2Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal2Ins.java @@ -28,7 +28,7 @@ public class GetLocal2Ins extends GetLocalTypeIns { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { lda.operandStack.push(lda.localRegisters.get(2)); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal3Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal3Ins.java index 118d1636e..f89ba96d0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal3Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal3Ins.java @@ -28,7 +28,7 @@ public class GetLocal3Ins extends GetLocalTypeIns { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { lda.operandStack.push(lda.localRegisters.get(3)); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocalIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocalIns.java index 879888422..2aaccf240 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocalIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocalIns.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import java.util.List; public class GetLocalIns extends GetLocalTypeIns { @@ -29,8 +28,8 @@ public class GetLocalIns extends GetLocalTypeIns { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - lda.operandStack.push(lda.localRegisters.get((int) (long) (Long) arguments.get(0))); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + lda.operandStack.push(lda.localRegisters.get(ins.getParamAsLong(constants, 0).intValue())); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java index 2d06501de..23d3708da 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java @@ -36,8 +36,8 @@ public class DeletePropertyIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int multiIndex = ins.getParamAsLong(constants, 0).intValue(); //if multiname[multinameIndex] is runtime //pop(name) pop(ns) Object obj = lda.operandStack.pop(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java index f22c236d1..cd797740c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java @@ -36,8 +36,8 @@ public class FindPropertyIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - //int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + //int multiIndex = ins.getParamAsLong(constants, 0).intValue(); //if is runtime //pop(name), pop(ns) throw new RuntimeException("Cannot find property"); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java index b7408ad06..d3268d864 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java @@ -36,8 +36,8 @@ public class FindPropertyStrictIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - //int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + //int multiIndex = ins.getParamAsLong(constants, 0).intValue(); //if is runtime //pop(name), pop(ns) throw new RuntimeException("Cannot find property"); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java index 95de7ae5e..ae7476fe6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java @@ -36,8 +36,8 @@ public class GetDescendantsIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - /*int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + /*int multiIndex = ins.getParamAsLong(constants, 0).intValue(); //if is runtime //pop(name), pop(ns) Object obj = lda.operandStack.pop();*/ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java index c14db1e9d..7904646a3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java @@ -35,7 +35,7 @@ public class GetGlobalScopeIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { throw new RuntimeException("getglobalscope not working"); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/LabelIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/LabelIns.java index a27bb2453..2e218b1bb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/LabelIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/LabelIns.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import java.util.List; @@ -29,6 +30,6 @@ public class LabelIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NopIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NopIns.java index aa25a7da6..c5aa21637 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NopIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NopIns.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import java.util.List; @@ -28,6 +29,6 @@ public class NopIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java index 1baefd897..bc6580ebf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java @@ -34,7 +34,7 @@ public class DupIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj = lda.operandStack.pop(); lda.operandStack.push(obj); lda.operandStack.push(obj); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopIns.java index 62b63276a..e7ede0c19 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopIns.java @@ -34,7 +34,7 @@ public class PopIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { lda.operandStack.pop(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopScopeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopScopeIns.java index 87dd211a4..3c3954867 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopScopeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopScopeIns.java @@ -35,7 +35,7 @@ public class PopScopeIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { lda.scopeStack.pop(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java index e54f00c8e..b331c7a3b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java @@ -35,8 +35,8 @@ public class PushByteIns extends InstructionDefinition implements PushIntegerTyp } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - lda.operandStack.push(arguments.get(0)); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + lda.operandStack.push(ins.getParam(constants, 0)); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java index 6e24f999b..d7201e4c9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java @@ -35,8 +35,8 @@ public class PushDoubleIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - lda.operandStack.push(arguments.get(0)); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + lda.operandStack.push(ins.getParam(constants, 0)); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java index 672dc63f7..c122696bd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java @@ -34,7 +34,7 @@ public class PushFalseIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { lda.operandStack.push(Boolean.FALSE); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushIntIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushIntIns.java index 952535807..df02ab7b2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushIntIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushIntIns.java @@ -35,8 +35,8 @@ public class PushIntIns extends InstructionDefinition implements PushIntegerType } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - lda.operandStack.push(arguments.get(0)); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + lda.operandStack.push(ins.getParam(constants, 0)); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushScopeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushScopeIns.java index 4941f2517..4829cd6f4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushScopeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushScopeIns.java @@ -33,7 +33,7 @@ public class PushScopeIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { lda.scopeStack.push(lda.operandStack.pop()); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java index a0dffd235..3aa0565b2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java @@ -35,8 +35,8 @@ public class PushShortIns extends InstructionDefinition implements PushIntegerTy } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - lda.operandStack.push((long) ((Number) arguments.get(0)).shortValue()); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + lda.operandStack.push(((Number) ins.getParam(constants, 0)).longValue()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushStringIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushStringIns.java index 30b5a1182..56b3b8c02 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushStringIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushStringIns.java @@ -35,8 +35,8 @@ public class PushStringIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - lda.operandStack.push(arguments.get(0)); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + lda.operandStack.push(ins.getParam(constants, 0)); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java index a8e5a677b..959e84937 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java @@ -34,7 +34,7 @@ public class PushTrueIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { lda.operandStack.push(Boolean.TRUE); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java index 60f47e816..5c511da2c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java @@ -35,8 +35,8 @@ public class PushUIntIns extends InstructionDefinition implements PushIntegerTyp } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - lda.operandStack.push(arguments.get(0)); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + lda.operandStack.push(ins.getParam(constants, 0)); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/SwapIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/SwapIns.java index a466b3deb..d31e682a2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/SwapIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/SwapIns.java @@ -34,7 +34,7 @@ public class SwapIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj1 = lda.operandStack.pop(); Object obj2 = lda.operandStack.pop(); lda.operandStack.push(obj1); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java index b56a0f9ba..b1a1ceec3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java @@ -37,8 +37,8 @@ public class ApplyTypeIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - int argCount = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + int argCount = ins.getParamAsLong(constants, 0).intValue(); List params = new ArrayList<>(); for (int i = 0; i < argCount; i++) { params.add(lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java index ec23898a9..b34e523b6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java @@ -36,8 +36,8 @@ public class AsTypeIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - //Long typeIndex = (Long) arguments.get(0); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + //Long typeIndex = ins.getParamAsLong(constants, 0); Object obj = lda.operandStack.pop(); //if multiname[typeIndex]==obj lda.operandStack.push(obj); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java index 35a6dd8c0..506fa1c06 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java @@ -34,7 +34,7 @@ public class AsTypeLateIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { //Object objClass = lda.operandStack.pop(); Object obj = lda.operandStack.pop(); //if obj.class=objClass diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java index 76e62f5dd..e68fb64ca 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java @@ -39,7 +39,7 @@ public class CoerceAIns extends InstructionDefinition implements CoerceOrConvert } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { //coerce any type } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java index f4f31ad6e..9d601fa06 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java @@ -36,8 +36,8 @@ public class CoerceIns extends InstructionDefinition implements CoerceOrConvertT } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - //int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + //int multinameIndex = ins.getParamAsLong(constants, 0).intValue(); //push and pop coerced value to specified type } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java index e81b5317c..be5fc96dc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java @@ -36,7 +36,7 @@ public class CoerceSIns extends InstructionDefinition implements CoerceOrConvert } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj = lda.operandStack.pop(); lda.operandStack.push(obj.toString()); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java index 5d8eb4558..90e271641 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java @@ -36,7 +36,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object value = lda.operandStack.pop(); boolean bval; if (value instanceof Boolean) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java index 21fbdf339..edc29eb92 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java @@ -36,7 +36,7 @@ public class ConvertDIns extends InstructionDefinition implements CoerceOrConver } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object value = lda.operandStack.pop(); double ret; if (value == null) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java index f44e144a9..5108a6387 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java @@ -36,7 +36,7 @@ public class ConvertIIns extends InstructionDefinition implements CoerceOrConver } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object value = lda.operandStack.pop(); long ret; if (value == null) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java index 5fbbca17c..db61121f5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java @@ -36,7 +36,7 @@ public class ConvertOIns extends InstructionDefinition implements CoerceOrConver } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { //throw if pop is not object } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java index 1973c5af5..3fb42db20 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java @@ -36,7 +36,7 @@ public class ConvertSIns extends InstructionDefinition implements CoerceOrConver } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj = lda.operandStack.pop(); lda.operandStack.push(obj.toString()); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java index 787f1849c..3d6c15c6a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java @@ -36,7 +36,7 @@ public class ConvertUIns extends InstructionDefinition implements CoerceOrConver } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { throw new UnsupportedOperationException("Cannot convert to uint "); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/CheckFilterIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/CheckFilterIns.java index fcb500a3a..76ca329c7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/CheckFilterIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/CheckFilterIns.java @@ -34,7 +34,7 @@ public class CheckFilterIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { //if pop() is not XML|XMLList throw } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSIns.java index 0c8c08d69..3e180f698 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSIns.java @@ -35,11 +35,10 @@ public class DXNSIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { - int strIndex = (int) ((Long) arguments.get(0)).longValue(); + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + int strIndex = ins.getParamAsLong(constants, 0).intValue(); String s = constants.getString(strIndex); System.out.println("Set default XML space " + s); - } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSLateIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSLateIns.java index aa6a9de07..59b7d5f96 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSLateIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSLateIns.java @@ -34,7 +34,7 @@ public class DXNSLateIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { String s = lda.operandStack.pop().toString(); System.out.println("Set default XML space " + s); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java index aa6625e1b..525e95ef3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java @@ -34,7 +34,7 @@ public class EscXAttrIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { String s = lda.operandStack.pop().toString(); //escape lda.operandStack.push(s); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java index 461e331a8..7a5500a13 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java @@ -34,7 +34,7 @@ public class EscXElemIns extends InstructionDefinition { } @Override - public void execute(LocalDataArea lda, AVM2ConstantPool constants, List arguments) { + public void execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { String s = lda.operandStack.pop().toString(); //escape lda.operandStack.push(s); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ConvertAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ConvertAVM2Item.java index df8f80b4e..ad814fd7e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ConvertAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ConvertAVM2Item.java @@ -54,9 +54,9 @@ public class ConvertAVM2Item extends AVM2Item { case "Boolean": return EcmaScript.toBoolean(value.getResult()); case "Number": - return EcmaScript.toNumber(value.getResult()); + return value.getResultAsNumber(); case "int": - return (int) (double) EcmaScript.toNumber(value.getResult()); + return (int) (double) value.getResultAsNumber(); case "uint": return (int) (double) EcmaScript.toUint32(value.getResult()); case "String": diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DecrementAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DecrementAVM2Item.java index 3bdcfd139..9a73cf644 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DecrementAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DecrementAVM2Item.java @@ -17,7 +17,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; @@ -47,7 +46,7 @@ public class DecrementAVM2Item extends AVM2Item { @Override public Object getResult() { - return EcmaScript.toNumber(value.getResult()) - 1; + return value.getResultAsNumber() - 1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/IncrementAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/IncrementAVM2Item.java index 771d54b2e..ab53423d4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/IncrementAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/IncrementAVM2Item.java @@ -17,7 +17,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; @@ -47,7 +46,7 @@ public class IncrementAVM2Item extends AVM2Item { @Override public Object getResult() { - return EcmaScript.toNumber(value.getResult()) + 1; + return value.getResultAsNumber() + 1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/LocalRegAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/LocalRegAVM2Item.java index faaa142ba..5f05a19ab 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/LocalRegAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/LocalRegAVM2Item.java @@ -80,6 +80,11 @@ public class LocalRegAVM2Item extends AVM2Item { return computedValue.getResult(); } + @Override + public Double getResultAsNumber() { + return computedValue.getResultAsNumber(); + } + @Override public boolean isCompileTime(Set dependencies) { return computedValue instanceof UndefinedAVM2Item; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/StringAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/StringAVM2Item.java index 5adc103c2..13e3a30f7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/StringAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/StringAVM2Item.java @@ -34,7 +34,9 @@ import java.util.Set; public class StringAVM2Item extends AVM2Item implements SimpleValue { - public String value; + private String value; + + private Double numberValue; public StringAVM2Item(AVM2Instruction instruction, String value) { super(instruction, PRECEDENCE_PRIMARY); @@ -56,6 +58,15 @@ public class StringAVM2Item extends AVM2Item implements SimpleValue { return value; } + @Override + public Double getResultAsNumber() { + if (numberValue == null) { + numberValue = super.getResultAsNumber(); + } + + return numberValue; + } + @Override public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, @@ -77,4 +88,13 @@ public class StringAVM2Item extends AVM2Item implements SimpleValue { public boolean isSimpleValue() { return true; } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + numberValue = null; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/XMLAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/XMLAVM2Item.java index f97b007f1..18a05d174 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/XMLAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/XMLAVM2Item.java @@ -41,7 +41,7 @@ public class XMLAVM2Item extends AVM2Item { public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { for (GraphTargetItem part : parts) { if (part instanceof StringAVM2Item) { - writer.append(((StringAVM2Item) part).value); + writer.append(((StringAVM2Item) part).getValue()); } else { part.toString(writer, localData); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java index 987124682..0452f90c7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -36,7 +35,7 @@ public class BitAndAVM2Item extends BinaryOpItem { @Override public Object getResult() { - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) & ((long) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((long) (double) leftSide.getResultAsNumber()) & ((long) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java index 9c4bd920a..586aba2c6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -36,7 +35,7 @@ public class BitNotAVM2Item extends UnaryOpItem { @Override public Object getResult() { - return ~((long) (double) EcmaScript.toNumber(value.getResult())); + return ~((long) (double) value.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java index b8632f9ff..de28af2f5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -36,7 +35,7 @@ public class BitOrAVM2Item extends BinaryOpItem { @Override public Object getResult() { - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) | ((long) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((long) (double) leftSide.getResultAsNumber()) | ((long) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java index 96ee3b91a..8e663b43b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -36,7 +35,7 @@ public class BitXorAVM2Item extends BinaryOpItem { @Override public Object getResult() { - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) ^ ((long) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((long) (double) leftSide.getResultAsNumber()) ^ ((long) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java index b0c4b74c0..30912810c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -38,11 +37,13 @@ public class DivideAVM2Item extends BinaryOpItem { @Override public Object getResult() { - Object rightResult = rightSide.getResult(); - if (Double.compare(EcmaScript.toNumber(rightResult), 0) == 0) { - return Double.NaN; + Double leftResult = leftSide.getResultAsNumber(); + Double rightResult = rightSide.getResultAsNumber(); + if (Double.compare(rightResult, 0) == 0) { + return leftResult < 0 ? Double.NEGATIVE_INFINITY + : leftResult > 0 ? Double.POSITIVE_INFINITY : Double.NaN; } - return (EcmaScript.toNumber(leftSide.getResult())) / (EcmaScript.toNumber(rightResult)); + return leftResult / rightResult; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java index 6d026df91..69bea41f5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -36,7 +35,7 @@ public class LShiftAVM2Item extends BinaryOpItem { @Override public Object getResult() { - return ((int) (double) EcmaScript.toNumber(leftSide.getResult())) << ((int) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((int) (double) leftSide.getResultAsNumber()) << ((int) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java index 91477dcef..fca83a776 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -38,11 +37,11 @@ public class ModuloAVM2Item extends BinaryOpItem { @Override public Object getResult() { - Object rightResult = rightSide.getResult(); - if (Double.compare(EcmaScript.toNumber(rightResult), 0) == 0) { + Double rightResult = rightSide.getResultAsNumber(); + if (Double.isNaN(rightResult) || Double.compare(rightResult, 0) == 0) { return Double.NaN; } - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) % ((long) (double) EcmaScript.toNumber(rightResult)); + return ((long) (double) leftSide.getResultAsNumber()) % ((long) (double) rightResult); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java index ad3f95104..c9806b363 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -38,7 +37,7 @@ public class MultiplyAVM2Item extends BinaryOpItem { @Override public Object getResult() { - return (EcmaScript.toNumber(leftSide.getResult())) * (EcmaScript.toNumber(rightSide.getResult())); + return leftSide.getResultAsNumber() * rightSide.getResultAsNumber(); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java index aba09fb56..bf2521667 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -36,7 +35,7 @@ public class NegAVM2Item extends UnaryOpItem { @Override public Object getResult() { - return -EcmaScript.toNumber(value.getResult()); + return -value.getResultAsNumber(); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java index 88f7681a9..1891f0706 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -36,7 +35,7 @@ public class RShiftAVM2Item extends BinaryOpItem { @Override public Object getResult() { - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) >> ((long) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((long) (double) leftSide.getResultAsNumber()) >> ((long) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java index 1e3bf974f..c22819b20 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -39,7 +38,7 @@ public class SubtractAVM2Item extends BinaryOpItem { @Override public Object getResult() { - return EcmaScript.toNumber(leftSide.getResult()) - EcmaScript.toNumber(rightSide.getResult()); + return leftSide.getResultAsNumber() - rightSide.getResultAsNumber(); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java index 8aca7ff80..3bbf6d6f6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -36,7 +35,7 @@ public class URShiftAVM2Item extends BinaryOpItem { @Override public Object getResult() { - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) >>> ((long) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((long) (double) leftSide.getResultAsNumber()) >>> ((long) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index 3814ad1c7..047a85998 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -1809,9 +1809,9 @@ public class AVM2SourceGenerator implements SourceGenerator { if (val instanceof StringAVM2Item) { StringAVM2Item sval = (StringAVM2Item) val; if (isNs) { - return new ValueKind(namespace(Namespace.KIND_NAMESPACE, sval.value), ValueKind.CONSTANT_Namespace); + return new ValueKind(namespace(Namespace.KIND_NAMESPACE, sval.getValue()), ValueKind.CONSTANT_Namespace); } else { - return new ValueKind(str(sval.value), ValueKind.CONSTANT_Utf8); + return new ValueKind(str(sval.getValue()), ValueKind.CONSTANT_Utf8); } } if (val instanceof IntegerValueAVM2Item) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java index 8ca4f6d93..39e11fbe1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java @@ -1074,7 +1074,8 @@ public class ActionScript3Parser { private void addS(List rets, StringBuilder sb) { if (sb.length() > 0) { if (!rets.isEmpty() && (rets.get(rets.size() - 1) instanceof StringAVM2Item)) { - ((StringAVM2Item) rets.get(rets.size() - 1)).value += sb.toString(); + StringAVM2Item stringItem = ((StringAVM2Item) rets.get(rets.size() - 1)); + stringItem.setValue(stringItem.getValue() + sb.toString()); } else { rets.add(new StringAVM2Item(null, sb.toString())); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java index ced11c1e0..4a7f71f8c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionAsciiToChar; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -52,7 +51,7 @@ public class AsciiToCharActionItem extends ActionItem { @Override public Object getResult() { - int res = (int) (double) (EcmaScript.toNumber(value.getResult())); + int res = (int) (double) (value.getResultAsNumber()); if (res == 0) { return ""; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DecrementActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DecrementActionItem.java index 088a01842..6dc40165b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DecrementActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DecrementActionItem.java @@ -1,23 +1,23 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionDecrement; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -62,7 +62,7 @@ public class DecrementActionItem extends ActionItem { @Override public Object getResult() { - return EcmaScript.toNumber(object.getResult()) - 1; + return object.getResultAsNumber() - 1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/IncrementActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/IncrementActionItem.java index f05d28070..4dca32f79 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/IncrementActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/IncrementActionItem.java @@ -1,23 +1,23 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionIncrement; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -62,7 +62,7 @@ public class IncrementActionItem extends ActionItem { @Override public Object getResult() { - return EcmaScript.toNumber(object.getResult()) + 1; + return object.getResultAsNumber() + 1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java index b22d6c62b..f28d44c57 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionMBAsciiToChar; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -52,7 +51,7 @@ public class MBAsciiToCharActionItem extends ActionItem { @Override public Object getResult() { - int res = (int) (double) (EcmaScript.toNumber(value.getResult())); + int res = (int) (double) (value.getResultAsNumber()); if (res == 0) { return ""; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PostDecrementActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PostDecrementActionItem.java index 7be5bca5a..a6a9516b2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PostDecrementActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PostDecrementActionItem.java @@ -27,7 +27,6 @@ import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionDecrement; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -63,7 +62,7 @@ public class PostDecrementActionItem extends ActionItem implements SetTypeAction @Override public Object getResult() { - return EcmaScript.toNumber(object.getResult()); + return object.getResultAsNumber(); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PostIncrementActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PostIncrementActionItem.java index c7937c878..bc386ed23 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PostIncrementActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/PostIncrementActionItem.java @@ -27,7 +27,6 @@ import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionIncrement; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -63,7 +62,7 @@ public class PostIncrementActionItem extends ActionItem implements SetTypeAction @Override public Object getResult() { - return EcmaScript.toNumber(object.getResult()); + return object.getResultAsNumber(); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java index 4dd9207d2..4554b746d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionStartDrag; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -59,7 +58,7 @@ public class StartDragActionItem extends ActionItem { public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { boolean hasConstrains = true; if (constrain instanceof DirectValueActionItem) { - if (Double.compare(EcmaScript.toNumber(constrain.getResult()), 0) == 0) { + if (Double.compare(constrain.getResultAsNumber(), 0) == 0) { hasConstrains = false; } } @@ -98,7 +97,7 @@ public class StartDragActionItem extends ActionItem { public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { boolean hasConstrains = true; if (constrain instanceof DirectValueActionItem) { - if (Double.compare(EcmaScript.toNumber(constrain.getResult()), 0) == 0) { + if (Double.compare(constrain.getResultAsNumber(), 0) == 0) { hasConstrains = false; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java index 66929a8ac..0fcbf53fd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionToInteger; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -52,7 +51,7 @@ public class ToIntegerActionItem extends ActionItem { @Override public Object getResult() { - return Math.round(EcmaScript.toNumber(value.getResult())); + return Math.round(value.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToNumberActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToNumberActionItem.java index 5a06d8904..3ab026823 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToNumberActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToNumberActionItem.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionToNumber; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -52,7 +51,7 @@ public class ToNumberActionItem extends ActionItem { @Override public Object getResult() { - return EcmaScript.toNumber(value.getResult()); + return value.getResultAsNumber(); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java index c3c8a0eb7..ec7ec4b89 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java @@ -1,23 +1,23 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitAnd; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -34,7 +34,7 @@ public class BitAndActionItem extends BinaryOpItem { @Override public Object getResult() { - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) & ((long) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((long) (double) leftSide.getResultAsNumber()) & ((long) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java index b70f50a63..eba667b5c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java @@ -1,23 +1,23 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitOr; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -34,7 +34,7 @@ public class BitOrActionItem extends BinaryOpItem { @Override public Object getResult() { - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) | ((long) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((long) (double) leftSide.getResultAsNumber()) | ((long) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java index a13c6a555..1106420d6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java @@ -1,24 +1,24 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.action.swf5.ActionBitXor; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -37,7 +37,7 @@ public class BitXorActionItem extends BinaryOpItem { @Override public Object getResult() { - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) ^ ((long) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((long) (double) leftSide.getResultAsNumber()) ^ ((long) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java index 1905188d5..45d6dbad9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionDivide; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -35,8 +34,8 @@ public class DivideActionItem extends BinaryOpItem { @Override public Object getResult() { - Double leftResult = EcmaScript.toNumber(leftSide.getResult()); - Double rightResult = EcmaScript.toNumber(rightSide.getResult()); + Double leftResult = leftSide.getResultAsNumber(); + Double rightResult = rightSide.getResultAsNumber(); if (Double.compare(rightResult, 0) == 0) { return leftResult < 0 ? Double.NEGATIVE_INFINITY : leftResult > 0 ? Double.POSITIVE_INFINITY : Double.NaN; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java index 43d43a6e0..f2f40ac39 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java @@ -1,23 +1,23 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitLShift; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -34,7 +34,7 @@ public class LShiftActionItem extends BinaryOpItem { @Override public Object getResult() { - return ((int) (double) EcmaScript.toNumber(leftSide.getResult())) << ((int) (double) EcmaScript.toNumber(rightSide.getResult())); + return ((int) (double) leftSide.getResultAsNumber()) << ((int) (double) rightSide.getResultAsNumber()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java index 50397792e..4d841a834 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionModulo; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -35,11 +34,11 @@ public class ModuloActionItem extends BinaryOpItem { @Override public Object getResult() { - Double rightResult = EcmaScript.toNumber(rightSide.getResult()); + Double rightResult = rightSide.getResultAsNumber(); if (Double.isNaN(rightResult) || Double.compare(rightResult, 0) == 0) { return Double.NaN; } - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) % ((long) (double) rightResult); + return ((long) (double) leftSide.getResultAsNumber()) % ((long) (double) rightResult); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java index 34b394ef4..cedd1b070 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java @@ -1,23 +1,23 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionMultiply; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -34,7 +34,7 @@ public class MultiplyActionItem extends BinaryOpItem { @Override public Object getResult() { - return (EcmaScript.toNumber(leftSide.getResult())) * (EcmaScript.toNumber(rightSide.getResult())); + return leftSide.getResultAsNumber() * rightSide.getResultAsNumber(); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java index 9997baa0d..adf264941 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ @@ -30,7 +30,6 @@ import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionDecrement; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -47,7 +46,7 @@ public class PreDecrementActionItem extends UnaryOpItem { @Override public Object getResult() { - return EcmaScript.toNumber(value.getResult()) - 1; + return value.getResultAsNumber() - 1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java index e43762deb..4cbc8f822 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ @@ -30,7 +30,6 @@ import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionIncrement; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -47,7 +46,7 @@ public class PreIncrementActionItem extends UnaryOpItem { @Override public Object getResult() { - return EcmaScript.toNumber(value.getResult()) + 1; + return value.getResultAsNumber() + 1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java index 3d5512c75..d14d2fcfe 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitRShift; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -35,8 +34,8 @@ public class RShiftActionItem extends BinaryOpItem { @Override public Object getResult() { - long rightResult = ((long) (double) EcmaScript.toNumber(rightSide.getResult())) & 0x1f; - return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) >> rightResult; + long rightResult = ((long) (double) rightSide.getResultAsNumber()) & 0x1f; + return ((long) (double) leftSide.getResultAsNumber()) >> rightResult; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java index 415fe40db..097975a94 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java @@ -1,24 +1,24 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.action.swf4.ActionSubtract; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -37,7 +37,7 @@ public class SubtractActionItem extends BinaryOpItem { @Override public Object getResult() { - return EcmaScript.toNumber(leftSide.getResult()) - EcmaScript.toNumber(rightSide.getResult()); + return leftSide.getResultAsNumber() - rightSide.getResultAsNumber(); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java index b0ae31e4a..41c8b75db 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitURShift; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -35,8 +34,8 @@ public class URShiftActionItem extends BinaryOpItem { @Override public Object getResult() { - long leftResult = ((long) (double) EcmaScript.toNumber(leftSide.getResult())) & 0xffffffffL; - long rightResult = ((long) (double) EcmaScript.toNumber(rightSide.getResult())) & 0x1f; + long leftResult = ((long) (double) leftSide.getResultAsNumber()) & 0xffffffffL; + long rightResult = ((long) (double) rightSide.getResultAsNumber()) & 0x1f; return leftResult >>> rightResult; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java index e9b4a6000..e9e730f07 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.BaseLocalData; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.action.model.StartDragActionItem; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.HashMap; @@ -45,7 +44,7 @@ public class ActionStartDrag extends Action { boolean hasConstrains = true; if (constrain instanceof DirectValueActionItem) { - if (Double.compare(EcmaScript.toNumber(constrain.getResult()), 0) == 0) { + if (Double.compare(constrain.getResultAsNumber(), 0) == 0) { hasConstrains = false; } } @@ -70,7 +69,7 @@ public class ActionStartDrag extends Action { GraphTargetItem constrain = stack.peek(3); boolean hasConstrains = true; if (constrain instanceof DirectValueActionItem) { - if (Double.compare(EcmaScript.toNumber(constrain.getResult()), 0) == 0) { + if (Double.compare(constrain.getResultAsNumber(), 0) == 0) { hasConstrains = false; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java index 106470a0a..f0bda395c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java @@ -230,6 +230,10 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { return null; } + public Double getResultAsNumber() { + return EcmaScript.toNumber(getResult()); + } + public String toStringNoQuotes(LocalData localData) { // todo: honfika: this method should not be called, maybe we should throw an exception return toString(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DuplicateItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DuplicateItem.java index 1e281d25a..e37a500f5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DuplicateItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DuplicateItem.java @@ -42,6 +42,11 @@ public class DuplicateItem extends GraphTargetItem implements SimpleValue { return value.getResult(); } + @Override + public Double getResultAsNumber() { + return value.getResultAsNumber(); + } + @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if ((value instanceof SimpleValue) && (((SimpleValue) value).isSimpleValue())) {