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 e225317c2..b8a16368a 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 @@ -25,6 +25,8 @@ import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorGetSet; import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorJumps; import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorRegisters; import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorSimple; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph; import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphSource; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGetSet.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGetSet.java index 794c3b257..c2b8ed498 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGetSet.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGetSet.java @@ -95,10 +95,10 @@ public class AVM2DeobfuscatorGetSet implements SWFDecompilerListener { } return new AVM2Instruction(0, AVM2Instructions.PushFalse, null); } - if (ovalue instanceof Null) { + if (ovalue == Null.INSTANCE) { return new AVM2Instruction(0, AVM2Instructions.PushNull, null); } - if (ovalue instanceof Undefined) { + if (ovalue == Undefined.INSTANCE) { return new AVM2Instruction(0, AVM2Instructions.PushUndefined, null); } return null; @@ -281,5 +281,4 @@ public class AVM2DeobfuscatorGetSet implements SWFDecompilerListener { removeUnreachableInstructions(code, body); removeObfuscationGetSets(classIndex, isStatic, scriptIndex, abc, body, new ArrayList<>()); } - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ExecutionException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2ExecutionException.java similarity index 93% rename from libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ExecutionException.java rename to libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2ExecutionException.java index 4b6d1542a..4414653fa 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ExecutionException.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2ExecutionException.java @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ -package com.jpexs.decompiler.flash.abc.avm2; +package com.jpexs.decompiler.flash.abc.avm2.exceptions; /** * diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2RangeErrorException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2RangeErrorException.java new file mode 100644 index 000000000..d872ed70f --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2RangeErrorException.java @@ -0,0 +1,44 @@ +/* + * 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. */ +package com.jpexs.decompiler.flash.abc.avm2.exceptions; + +/** + * + * @author JPEXS + */ +public class AVM2RangeErrorException extends AVM2ExecutionException { + + public AVM2RangeErrorException(int code) { + super(codeToMessage(code, null)); + } + + public AVM2RangeErrorException(int code, Object[] params) { + super(codeToMessage(code, params)); + } + + private static String codeToMessage(int code, Object[] params) { + String msg = null; + switch (code) { + } + + String result = "RangeError: Error #" + code; + /*if (msg != null) { + result += ": " + msg; + }*/ + + return result; + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2TypeErrorException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2TypeErrorException.java similarity index 95% rename from libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2TypeErrorException.java rename to libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2TypeErrorException.java index ca9a9758c..88bcc8e92 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2TypeErrorException.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2TypeErrorException.java @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ -package com.jpexs.decompiler.flash.abc.avm2; +package com.jpexs.decompiler.flash.abc.avm2.exceptions; /** * diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2VerifyErrorException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2VerifyErrorException.java similarity index 97% rename from libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2VerifyErrorException.java rename to libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2VerifyErrorException.java index 190ab13b4..3216ad21b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2VerifyErrorException.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2VerifyErrorException.java @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ -package com.jpexs.decompiler.flash.abc.avm2; +package com.jpexs.decompiler.flash.abc.avm2.exceptions; /** * 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 4600f2614..d49fe575c 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 @@ -20,8 +20,8 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; -import com.jpexs.decompiler.flash.abc.avm2.AVM2VerifyErrorException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.DecLocalIIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.DecLocalIns; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/UnknownInstruction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/UnknownInstruction.java index ffb0f4d8b..8fef0b1b2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/UnknownInstruction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/UnknownInstruction.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Lf32Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Lf32Ins.java index 45bfe2e29..f0c0b7a14 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Lf32Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Lf32Ins.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2RangeErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item; @@ -39,10 +40,15 @@ public class Lf32Ins extends InstructionDefinition implements AlchemyTypeIns { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + byte[] domainMemory = lda.getDomainMemory(); + if (addr < 0 || addr >= domainMemory.length) { + throw new AVM2RangeErrorException(1506); + } + // todo: get 32 bits float - lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr])); + lda.operandStack.push((Double) (double) (domainMemory[addr])); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Lf64Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Lf64Ins.java index c186dbd0d..b434277a7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Lf64Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Lf64Ins.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2RangeErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item; @@ -39,10 +40,15 @@ public class Lf64Ins extends InstructionDefinition implements AlchemyTypeIns { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + byte[] domainMemory = lda.getDomainMemory(); + if (addr < 0 || addr >= domainMemory.length) { + throw new AVM2RangeErrorException(1506); + } + // todo: get 64 bits float - lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr])); + lda.operandStack.push((Double) (double) (domainMemory[addr])); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li16Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li16Ins.java index af2c0a625..35d94b3ef 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li16Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li16Ins.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2RangeErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item; @@ -39,10 +40,15 @@ public class Li16Ins extends InstructionDefinition implements AlchemyTypeIns { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + byte[] domainMemory = lda.getDomainMemory(); + if (addr < 0 || addr >= domainMemory.length) { + throw new AVM2RangeErrorException(1506); + } + // todo: get 16 bits - lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr])); + lda.operandStack.push((Double) (double) (domainMemory[addr])); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li32Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li32Ins.java index 6a36230dd..49cf1785e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li32Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li32Ins.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2RangeErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item; @@ -39,10 +40,15 @@ public class Li32Ins extends InstructionDefinition implements AlchemyTypeIns { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + byte[] domainMemory = lda.getDomainMemory(); + if (addr < 0 || addr >= domainMemory.length) { + throw new AVM2RangeErrorException(1506); + } + // todo: get 32 bits - lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr])); + lda.operandStack.push((Double) (double) (domainMemory[addr])); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li8Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li8Ins.java index 488199e50..3138e49d4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li8Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Li8Ins.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2RangeErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item; @@ -39,9 +40,14 @@ public class Li8Ins extends InstructionDefinition implements AlchemyTypeIns { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); - lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr])); + byte[] domainMemory = lda.getDomainMemory(); + if (addr < 0 || addr >= domainMemory.length) { + throw new AVM2RangeErrorException(1506); + } + + lda.operandStack.push((Double) (double) (domainMemory[addr])); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIIns.java index c7e39fa03..8ee36e9c3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIIns.java @@ -18,17 +18,36 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; +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 com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.EcmaType; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; -public class AddIIns extends AddIns { +public class AddIIns extends InstructionDefinition { public AddIIns() { - instructionName = "add_i"; - instructionCode = 0xc5; + super(0xc5, "add_i", new int[]{}, true); + } + + @Override + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + Object right = lda.operandStack.pop(); + Object left = lda.operandStack.pop(); + if (EcmaScript.type(left) == EcmaType.STRING || EcmaScript.type(right) == EcmaType.STRING) { + String ret = EcmaScript.toString(left) + EcmaScript.toString(right); + lda.operandStack.push(ret); + } else { + int ret = EcmaScript.toInt32(left) + EcmaScript.toInt32(right); + lda.operandStack.push(ret); + } + + return true; } @Override 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 158c94b88..908f9999a 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 @@ -37,7 +37,7 @@ public class DecrementIIns extends InstructionDefinition { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj = lda.operandStack.pop(); - lda.operandStack.push(EcmaScript.toNumber(obj) - 1); + lda.operandStack.push(EcmaScript.toInt32(obj) - 1); return true; } 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 c37677f15..5cc5f27f6 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 @@ -37,7 +37,7 @@ public class DecrementIns extends InstructionDefinition { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj = lda.operandStack.pop(); - lda.operandStack.push(EcmaScript.toInt32(obj) - 1); + lda.operandStack.push(EcmaScript.toNumber(obj) - 1); return true; } 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 03552ff4c..f4820ff00 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 @@ -23,6 +23,7 @@ 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 com.jpexs.decompiler.flash.abc.avm2.model.operations.DivideAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -35,31 +36,10 @@ public class DivideIns extends InstructionDefinition { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Object o2 = lda.operandStack.pop(); - Object o1 = lda.operandStack.pop(); - if ((o1 instanceof Long) && ((o2 instanceof Long))) { - Long l1 = (Long) o1; - Long l2 = (Long) o2; - if (l1 % l2 == 0) { - Long ret = l1 / l2; - lda.operandStack.push(ret); - } else { - Double ret = l1.doubleValue() / l2.doubleValue(); - lda.operandStack.push(ret); - } - } else if ((o1 instanceof Double) && ((o2 instanceof Double))) { - Double ret = ((Double) o1) / ((Double) o2); - lda.operandStack.push(ret); - } else if ((o1 instanceof Long) && ((o2 instanceof Double))) { - Double ret = ((Long) o1) / ((Double) o2); - lda.operandStack.push(ret); - } else if ((o1 instanceof Double) && ((o2 instanceof Long))) { - Double ret = ((Double) o1) / ((Long) o2); - lda.operandStack.push(ret); - } else { - lda.executionException = "Cannot divide"; - return false; - } + Object right = lda.operandStack.pop(); + Object left = lda.operandStack.pop(); + Double ret = EcmaScript.toNumber(left) / EcmaScript.toNumber(right); + lda.operandStack.push(ret); return true; } 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 b68c06bc3..7254f5d6c 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 @@ -23,6 +23,7 @@ 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 com.jpexs.decompiler.flash.abc.avm2.model.operations.ModuloAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -35,16 +36,10 @@ public class ModuloIns extends InstructionDefinition { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Object o1 = lda.operandStack.pop(); - Object o2 = lda.operandStack.pop(); - - if ((o1 instanceof Long) && ((o2 instanceof Long))) { - Long ret = ((Long) o2) % ((Long) o1); - lda.operandStack.push(ret); - } else { - lda.executionException = "Cannot modulo"; - return false; - } + Object right = lda.operandStack.pop(); + Object left = lda.operandStack.pop(); + Double ret = EcmaScript.toNumber(left) % EcmaScript.toNumber(right); + lda.operandStack.push(ret); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIIns.java index 10b3bd121..4cbb4a704 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIIns.java @@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; +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 com.jpexs.decompiler.flash.abc.avm2.model.operations.MultiplyAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -31,6 +34,15 @@ public class MultiplyIIns extends InstructionDefinition { super(0xc7, "multiply_i", new int[]{}, true); } + @Override + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + Object right = lda.operandStack.pop(); + Object left = lda.operandStack.pop(); + int ret = EcmaScript.toInt32(left) * EcmaScript.toInt32(right); + lda.operandStack.push(ret); + return true; + } + @Override public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) { GraphTargetItem v2 = stack.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 d5086e41a..079d12e63 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 @@ -23,6 +23,7 @@ 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 com.jpexs.decompiler.flash.abc.avm2.model.operations.MultiplyAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -35,24 +36,10 @@ public class MultiplyIns extends InstructionDefinition { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Object o1 = lda.operandStack.pop(); - Object o2 = lda.operandStack.pop(); - if ((o1 instanceof Long) && ((o2 instanceof Long))) { - Long ret = ((Long) o1) * ((Long) o2); - lda.operandStack.push(ret); - } else if ((o1 instanceof Double) && ((o2 instanceof Double))) { - Double ret = ((Double) o1) * ((Double) o2); - lda.operandStack.push(ret); - } else if ((o1 instanceof Long) && ((o2 instanceof Double))) { - Double ret = ((Long) o1) * ((Double) o2); - lda.operandStack.push(ret); - } else if ((o1 instanceof Double) && ((o2 instanceof Long))) { - Double ret = ((Double) o1) * ((Long) o2); - lda.operandStack.push(ret); - } else { - lda.executionException = "Cannot multiply"; - return false; - } + Object right = lda.operandStack.pop(); + Object left = lda.operandStack.pop(); + Double ret = EcmaScript.toNumber(left) * EcmaScript.toNumber(right); + lda.operandStack.push(ret); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIIns.java index 9dff573f4..c7192b0c7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIIns.java @@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; +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 com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -31,6 +34,15 @@ public class SubtractIIns extends InstructionDefinition { super(0xc6, "subtract_i", new int[]{}, true); } + @Override + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + Object right = lda.operandStack.pop(); + Object left = lda.operandStack.pop(); + int ret = EcmaScript.toInt32(left) - EcmaScript.toInt32(right); + lda.operandStack.push(ret); + return true; + } + @Override public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) { GraphTargetItem v2 = stack.pop(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIns.java index c04150d7e..27ebbd6a6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIns.java @@ -40,7 +40,6 @@ public class SubtractIns extends InstructionDefinition { Object left = lda.operandStack.pop(); Double ret = EcmaScript.toNumber(left) - EcmaScript.toNumber(right); lda.operandStack.push(ret); - return true; } 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 fb4a341f3..8a9f5c7bd 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 @@ -23,6 +23,7 @@ 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 com.jpexs.decompiler.flash.abc.avm2.model.operations.LShiftAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -35,9 +36,9 @@ public class LShiftIns extends InstructionDefinition { @Override public boolean 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); + int value2 = EcmaScript.toInt32(lda.operandStack.pop()) & 0x1F; + long value1 = EcmaScript.toInt32(lda.operandStack.pop()); + long value3 = value1 << value2; lda.operandStack.push(value3); return true; } 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 6cd68f985..eb08e5c5f 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 @@ -23,6 +23,7 @@ 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 com.jpexs.decompiler.flash.abc.avm2.model.operations.RShiftAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -35,9 +36,9 @@ public class RShiftIns extends InstructionDefinition { @Override public boolean 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); + int value2 = EcmaScript.toInt32(lda.operandStack.pop()) & 0x1F; + long value1 = EcmaScript.toInt32(lda.operandStack.pop()); + long value3 = value1 >> value2; lda.operandStack.push(value3); return true; } 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 8bf5ad80e..2296bca3a 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 @@ -23,6 +23,7 @@ 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 com.jpexs.decompiler.flash.abc.avm2.model.operations.URShiftAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -35,9 +36,9 @@ public class URShiftIns extends InstructionDefinition { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Long value2 = ((Long) lda.operandStack.pop() & 0x1F); - Long value1 = (Long) lda.operandStack.pop(); - Long value3 = value1 >>> value2; + int value2 = EcmaScript.toInt32(lda.operandStack.pop()) & 0x1F; + long value1 = EcmaScript.toInt32(lda.operandStack.pop()); + long value3 = value1 >>> value2; lda.operandStack.push(value3); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfEqIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfEqIns.java index 2db2c36f9..ef889c26f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfEqIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfEqIns.java @@ -40,10 +40,10 @@ public class IfEqIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (left == right) { + if (EcmaScript.equals(leftObj, rightObj)) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGeIns.java index dd33f2a54..c00bf627b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGeIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.HashMap; @@ -40,10 +41,11 @@ public class IfGeIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (left >= right) { + Object cmp = EcmaScript.compare(leftObj, rightObj); + if (cmp != Undefined.INSTANCE && ((int) cmp) != -1) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGtIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGtIns.java index 7af0f20ac..c00cd3f37 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGtIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGtIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.HashMap; @@ -40,10 +41,11 @@ public class IfGtIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (left > right) { + Object cmp = EcmaScript.compare(leftObj, rightObj); + if (cmp != Undefined.INSTANCE && ((int) cmp) == 1) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLeIns.java index 94ed1bc62..b59518893 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLeIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.HashMap; @@ -40,10 +41,11 @@ public class IfLeIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (left <= right) { + Object cmp = EcmaScript.compare(leftObj, rightObj); + if (cmp != Undefined.INSTANCE && ((int) cmp) != 1) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLtIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLtIns.java index c713e2592..7e922aeb4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLtIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLtIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.HashMap; @@ -40,10 +41,11 @@ public class IfLtIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (left < right) { + Object cmp = EcmaScript.compare(leftObj, rightObj); + if (cmp != Undefined.INSTANCE && ((int) cmp) == -1) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGeIns.java index 0c632f238..63815d9cf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGeIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.HashMap; @@ -40,10 +41,11 @@ public class IfNGeIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (!(left >= right)) { + Object cmp = EcmaScript.compare(leftObj, rightObj); + if (cmp == Undefined.INSTANCE || ((int) cmp) == -1) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGtIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGtIns.java index 50e1f6a0f..cbbc92511 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGtIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGtIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.HashMap; @@ -40,10 +41,11 @@ public class IfNGtIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (!(left > right)) { + Object cmp = EcmaScript.compare(leftObj, rightObj); + if (cmp == Undefined.INSTANCE || ((int) cmp) != 1) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLeIns.java index aaecf89cb..01c571763 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLeIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.HashMap; @@ -40,10 +41,11 @@ public class IfNLeIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (!(left <= right)) { + Object cmp = EcmaScript.compare(leftObj, rightObj); + if (cmp == Undefined.INSTANCE || ((int) cmp) == 1) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLtIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLtIns.java index 80f5f12e7..76506f008 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLtIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLtIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.HashMap; @@ -40,10 +41,11 @@ public class IfNLtIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (!(left < right)) { + Object cmp = EcmaScript.compare(leftObj, rightObj); + if (cmp == Undefined.INSTANCE || ((int) cmp) != -1) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNeIns.java index 65da1e8f3..9275760d4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNeIns.java @@ -40,10 +40,10 @@ public class IfNeIns extends InstructionDefinition implements IfTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Double right = EcmaScript.toNumber(lda.operandStack.pop()); - Double left = EcmaScript.toNumber(lda.operandStack.pop()); + Object rightObj = lda.operandStack.pop(); + Object leftObj = lda.operandStack.pop(); - if (left != right) { + if (!EcmaScript.equals(leftObj, rightObj)) { lda.jump = ins.getParamAsLong(constants, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ThrowIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ThrowIns.java index bcfee3e16..ffc8e8b24 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ThrowIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ThrowIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; 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; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AbsJumpIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AbsJumpIns.java index 9dd224041..9f90cfaa1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AbsJumpIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AbsJumpIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddDIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddDIns.java index 612d0c4b5..bc48e179f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddDIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddDIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddPIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddPIns.java index e68a02fac..264cb6a6d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddPIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AddPIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AllocIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AllocIns.java index b58e99b18..04f00f511 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AllocIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/AllocIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/BkptIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/BkptIns.java index 01cb98e59..51597e993 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/BkptIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/BkptIns.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; 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; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/BkptLineIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/BkptLineIns.java index 17831555e..24dc023b8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/BkptLineIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/BkptLineIns.java @@ -17,6 +17,10 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; +import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; +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; public class BkptLineIns extends InstructionDefinition { @@ -24,4 +28,10 @@ public class BkptLineIns extends InstructionDefinition { public BkptLineIns() { super(0xF2, "bkptline", new int[]{AVM2Code.OPT_U30}, false /*?*/); } + + @Override + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { + // do nothing + return true; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CallInterfaceIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CallInterfaceIns.java index 362f66927..b098b79c3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CallInterfaceIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CallInterfaceIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CallSuperIdIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CallSuperIdIns.java index ee6863832..fc311a993 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CallSuperIdIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CallSuperIdIns.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CodeGenOpIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CodeGenOpIns.java index e7f0479a5..e4728d47d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CodeGenOpIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CodeGenOpIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CoerceOIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CoerceOIns.java index 4082ec60f..5d800c23e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CoerceOIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/CoerceOIns.java @@ -38,7 +38,7 @@ public class CoerceOIns extends InstructionDefinition implements CoerceOrConvert public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object value = lda.operandStack.pop(); // The only action appears to be to convert undefined to null. - if (value instanceof Undefined) { + if (value == Undefined.INSTANCE) { value = Null.INSTANCE; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConcatIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConcatIns.java index c8c480300..6b59f1c78 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConcatIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConcatIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertF4Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertF4Ins.java index 7471d74df..b71b65449 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertF4Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertF4Ins.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertMIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertMIns.java index 190d87fa8..ad8582119 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertMIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertMIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertMPIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertMPIns.java index 89dc899cc..fb86edc4e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertMPIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ConvertMPIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecLocalPIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecLocalPIns.java index 0324cb89a..70e21a69b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecLocalPIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecLocalPIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecodeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecodeIns.java index bbfe9bfdf..bc3fb7b8d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecodeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecodeIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecrementPIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecrementPIns.java index 645617fb6..67b6da267 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecrementPIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DecrementPIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DelDescendantsIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DelDescendantsIns.java index 90386972e..7b0d93c4d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DelDescendantsIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DelDescendantsIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DeletePropertyLateIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DeletePropertyLateIns.java index 4ef893580..18e3e3515 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DeletePropertyLateIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DeletePropertyLateIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DividePIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DividePIns.java index b3a50c806..6adc51326 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DividePIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DividePIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DoubleToAtomIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DoubleToAtomIns.java index af353255d..bb783a52a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DoubleToAtomIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/DoubleToAtomIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/FindPropGlobalIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/FindPropGlobalIns.java index b8bd7fd33..d90fe442c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/FindPropGlobalIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/FindPropGlobalIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/IncLocalPIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/IncLocalPIns.java index bfbc9747f..45e1a7bc4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/IncLocalPIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/IncLocalPIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/IncrementPIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/IncrementPIns.java index 70ee25de1..8cdc03b72 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/IncrementPIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/IncrementPIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/InvalidIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/InvalidIns.java index 445a014ff..72f71b1fe 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/InvalidIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/InvalidIns.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/Lf32x4Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/Lf32x4Ins.java index 6a40e0b65..e6b7f11d5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/Lf32x4Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/Lf32x4Ins.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/MarkIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/MarkIns.java index 8546891aa..e476255f4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/MarkIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/MarkIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ModuloPIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ModuloPIns.java index 57cc5443f..3dcf35ca8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ModuloPIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/ModuloPIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/MultiplyPIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/MultiplyPIns.java index 25c408f02..9a2dab268 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/MultiplyPIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/MultiplyPIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/NegatePIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/NegatePIns.java index 209b3d1cf..062afc50a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/NegatePIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/NegatePIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PrologueIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PrologueIns.java index a82737919..22cafa038 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PrologueIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PrologueIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushConstantIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushConstantIns.java index c51b863f7..a8849b433 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushConstantIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushConstantIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushDNanIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushDNanIns.java index dd643205c..aba296041 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushDNanIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushDNanIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushDecimalIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushDecimalIns.java index 2bfce685a..8b9a4d3e4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushDecimalIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushDecimalIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushFloat4Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushFloat4Ins.java index 5ea663fb4..a58fbf37d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushFloat4Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/PushFloat4Ins.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SendEnterIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SendEnterIns.java index c91446e83..32ccf4526 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SendEnterIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SendEnterIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SetPropertyLateIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SetPropertyLateIns.java index 7ff26a34e..44f4e9848 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SetPropertyLateIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SetPropertyLateIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/Sf32x4Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/Sf32x4Ins.java index ec7a70e8d..499efed70 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/Sf32x4Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/Sf32x4Ins.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SubtractPIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SubtractPIns.java index 16eb64c6b..cd5acfd06 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SubtractPIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SubtractPIns.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SweepIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SweepIns.java index 2f277675f..ae088e222 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SweepIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/SweepIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/VerifyOpIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/VerifyOpIns.java index 916e1107b..ee94a6104 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/VerifyOpIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/VerifyOpIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/VerifyPassIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/VerifyPassIns.java index 5656cf6ae..33cf262e4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/VerifyPassIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/VerifyPassIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/WbIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/WbIns.java index 78def4ead..92ebd8824 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/WbIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other2/WbIns.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; 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 4008011fb..9fdb66d23 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 @@ -20,8 +20,8 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; -import com.jpexs.decompiler.flash.abc.avm2.AVM2TypeErrorException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2TypeErrorException; 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; @@ -30,6 +30,8 @@ import com.jpexs.decompiler.flash.abc.avm2.parser.script.PropertyAVM2Item; import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.ecma.EcmaType; +import com.jpexs.decompiler.flash.ecma.Null; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -48,6 +50,10 @@ public class CoerceIns extends InstructionDefinition implements CoerceOrConvertT } Object value = lda.operandStack.pop(); + if (value == Undefined.INSTANCE) { + value = Null.INSTANCE; + } + EcmaType type = EcmaScript.type(value); if (type != EcmaType.NULL && type != EcmaType.OBJECT) { throw new AVM2TypeErrorException(1034); 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 bdd89b211..d6be3c765 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 @@ -23,6 +23,8 @@ 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 com.jpexs.decompiler.flash.abc.avm2.model.CoerceAVM2Item; +import com.jpexs.decompiler.flash.ecma.Null; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; @@ -37,8 +39,17 @@ public class CoerceSIns extends InstructionDefinition implements CoerceOrConvert @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - Object obj = lda.operandStack.pop(); - lda.operandStack.push(obj.toString()); + Object value = lda.operandStack.pop(); + if (value == Undefined.INSTANCE) { + value = Null.INSTANCE; + } + + if (value == Null.INSTANCE) { + lda.operandStack.push(value); + } else { + lda.operandStack.push(value.toString()); + } + return true; } 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 0fa6c9a20..b721e5e9b 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 @@ -19,10 +19,13 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.types; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2TypeErrorException; 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 com.jpexs.decompiler.flash.abc.avm2.model.ConvertAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.EcmaType; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; @@ -36,7 +39,12 @@ public class ConvertOIns extends InstructionDefinition implements CoerceOrConver } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2TypeErrorException { + Object obj = lda.operandStack.peek(); + if (EcmaScript.type(obj) == EcmaType.UNDEFINED) { + throw new AVM2TypeErrorException(1010); + } + //throw if pop is not object return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/TypeOfIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/TypeOfIns.java index 05768bfb0..c71be05e1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/TypeOfIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/TypeOfIns.java @@ -24,7 +24,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.operations.TypeOfAVM2Item; import com.jpexs.decompiler.flash.ecma.EcmaScript; -import com.jpexs.decompiler.flash.ecma.EcmaType; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -38,34 +37,7 @@ public class TypeOfIns extends InstructionDefinition { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object res = lda.operandStack.pop(); - EcmaType type = EcmaScript.type(res); - String typeStr; - switch (type) { - case STRING: - typeStr = "string"; - break; - case BOOLEAN: - typeStr = "boolean"; - break; - case NUMBER: - typeStr = "number"; - break; - case OBJECT: - typeStr = "object"; - break; - case UNDEFINED: - typeStr = "undefined"; - break; - case NULL: - // note: null is object in AS3 - typeStr = "object"; - break; - default: - //TODO: function,movieclip - typeStr = "object"; - break; - } - + String typeStr = EcmaScript.typeString(res); lda.operandStack.push(typeStr); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java index 19021b7a6..5e2493ff6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java @@ -78,10 +78,10 @@ public class CoerceAVM2Item extends AVM2Item { Object ret = value.getResult(); switch (typeObj.toString()) { case "String": - if (ret instanceof Null) { + if (ret == Null.INSTANCE) { return ret; } - if (ret instanceof Undefined) { + if (ret == Undefined.INSTANCE) { return Null.INSTANCE; } return ret.toString(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java index 609e89661..dc95c3631 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java @@ -20,6 +20,7 @@ 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.ecma.Undefined; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -54,13 +55,12 @@ public class GeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi @Override public Object getResult() { Object ret = EcmaScript.compare(leftSide.getResult(), rightSide.getResult()); - if (ret == Boolean.TRUE) { - return Boolean.FALSE; + if (ret == Undefined.INSTANCE) { + return ret; } - if (ret == Boolean.FALSE) { - return Boolean.TRUE; - } - return ret;//undefined + + int reti = (int) ret; + return reti != -1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java index 75d805478..0f5ca5030 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java @@ -20,6 +20,7 @@ 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.ecma.Undefined; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -53,7 +54,13 @@ public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi @Override public Object getResult() { - return EcmaScript.compare(rightSide.getResult(), leftSide.getResult()); + Object ret = EcmaScript.compare(rightSide.getResult(), leftSide.getResult()); + if (ret == Undefined.INSTANCE) { + return ret; + } + + int reti = (int) ret; + return reti == -1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java index edc949e31..b63447a26 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java @@ -20,6 +20,7 @@ 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.ecma.Undefined; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -54,13 +55,12 @@ public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi @Override public Object getResult() { Object ret = EcmaScript.compare(rightSide.getResult(), leftSide.getResult()); - if (ret == Boolean.TRUE) { - return Boolean.FALSE; + if (ret == Undefined.INSTANCE) { + return ret; } - if (ret == Boolean.FALSE) { - return Boolean.TRUE; - } - return ret;//undefined + + int reti = (int) ret; + return reti != -1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java index 678b86322..a0efc0725 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java @@ -20,6 +20,7 @@ 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.ecma.Undefined; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -53,7 +54,13 @@ public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi @Override public Object getResult() { - return EcmaScript.compare(leftSide.getResult(), rightSide.getResult()); + Object ret = EcmaScript.compare(leftSide.getResult(), rightSide.getResult()); + if (ret == Undefined.INSTANCE) { + return ret; + } + + int reti = (int) ret; + return reti == -1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java index 7943573d3..65a4b7c23 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java @@ -737,7 +737,7 @@ public abstract class Action implements GraphSourceItem { protected long popLong(TranslateStack stack) { GraphTargetItem item = stack.pop(); if (item instanceof DirectValueActionItem) { - return (long) (double) EcmaScript.toNumber(((DirectValueActionItem) item).value); + return (long) (double) EcmaScript.toNumberAs2(((DirectValueActionItem) item).value); } return 0; @@ -1021,7 +1021,7 @@ public abstract class Action implements GraphSourceItem { } //return in for..in - if ((action instanceof ActionPush) && (((ActionPush) action).values.size() == 1) && (((ActionPush) action).values.get(0) instanceof Null)) { + if ((action instanceof ActionPush) && (((ActionPush) action).values.size() == 1) && (((ActionPush) action).values.get(0) == Null.INSTANCE)) { if (ip + 3 <= end) { if ((actions.get(ip + 1) instanceof ActionEquals) || (actions.get(ip + 1) instanceof ActionEquals2)) { if (actions.get(ip + 2) instanceof ActionNot) { @@ -1355,10 +1355,10 @@ public abstract class Action implements GraphSourceItem { if (o instanceof Long) { return (Long) o; } - if (o instanceof Null) { + if (o == Null.INSTANCE) { return Double.NaN; } - if (o instanceof Undefined) { + if (o == Undefined.INSTANCE) { return Double.NaN; } if (o instanceof Boolean) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java index f66eb1605..2ae244172 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -168,7 +168,7 @@ public class ActionGraph extends Graph { NeqActionItem ne = (NeqActionItem) wi.expression.get(wi.expression.size() - 1); if (ne.rightSide instanceof DirectValueActionItem) { DirectValueActionItem dv = (DirectValueActionItem) ne.rightSide; - if (dv.value instanceof Null) { + if (dv.value == Null.INSTANCE) { GraphTargetItem en = list.get(t - 1); if (en instanceof EnumerateActionItem) { EnumerateActionItem eti = (EnumerateActionItem) en; @@ -467,7 +467,7 @@ public class ActionGraph extends Graph { int oldIp = ip; //return in for..in GraphSourceItem action = code.get(ip); - if ((action instanceof ActionPush) && (((ActionPush) action).values.size() == 1) && (((ActionPush) action).values.get(0) instanceof Null)) { + if ((action instanceof ActionPush) && (((ActionPush) action).values.size() == 1) && (((ActionPush) action).values.get(0) == Null.INSTANCE)) { if (ip + 4 < code.size()) { if ((code.get(ip + 1) instanceof ActionEquals) || (code.get(ip + 1) instanceof ActionEquals2)) { if (code.get(ip + 2) instanceof ActionNot) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/LocalDataArea.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/LocalDataArea.java index 81c929bf5..f07d373df 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/LocalDataArea.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/LocalDataArea.java @@ -59,6 +59,6 @@ public class LocalDataArea { } public Double popAsNumber() { - return EcmaScript.toNumber(stack.pop()); + return EcmaScript.toNumberAs2(stack.pop()); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java index 89525e035..5bf3d0681 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java @@ -58,7 +58,7 @@ public class CallMethodActionItem extends ActionItem { boolean blankMethod = false; boolean dvai = methodName instanceof DirectValueActionItem; if (dvai) { - if (((DirectValueActionItem) methodName).value instanceof Undefined) { + if (((DirectValueActionItem) methodName).value == Undefined.INSTANCE) { blankMethod = true; } if (((DirectValueActionItem) methodName).value instanceof String) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java index 48d4c4203..a35895232 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java @@ -188,7 +188,7 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue { } dependencies.add(computedRegValue); } - return (value instanceof Double) || (value instanceof Float) || (value instanceof Boolean) || (value instanceof Long) || (value instanceof Null) || (computedRegValue != null && computedRegValue.isCompileTime(dependencies)) || (value instanceof String) || (value instanceof ConstantIndex); + return (value instanceof Double) || (value instanceof Float) || (value instanceof Boolean) || (value instanceof Long) || (value == Null.INSTANCE) || (computedRegValue != null && computedRegValue.isCompileTime(dependencies)) || (value instanceof String) || (value instanceof ConstantIndex); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java index 24c239588..5a9a0a5ea 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java @@ -80,10 +80,10 @@ public class MBStringExtractActionItem extends ActionItem { public static String getResult(Object count, Object index, Object value) { String str = EcmaScript.toString(value); - int idx = (int) (double) EcmaScript.toNumber(index); + int idx = (int) (double) EcmaScript.toNumberAs2(index); idx--; // index seems to be 1 based - int cnt = (int) (double) EcmaScript.toNumber(count); + int cnt = (int) (double) EcmaScript.toNumberAs2(count); /*if (idx < 0) { idx = str.length() + idx; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java index f6b13e42a..cb4320a80 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java @@ -63,7 +63,7 @@ public class MBStringLengthActionItem extends ActionItem { } public static Double getResult(Object obj) { - return EcmaScript.toNumber(EcmaScript.toString(obj).length()); + return EcmaScript.toNumberAs2(EcmaScript.toString(obj).length()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java index c247af9d6..05640c772 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java @@ -56,7 +56,7 @@ public class NewMethodActionItem extends ActionItem { public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { boolean blankMethod = false; if (methodName instanceof DirectValueActionItem) { - if (((DirectValueActionItem) methodName).value instanceof Undefined) { + if (((DirectValueActionItem) methodName).value == Undefined.INSTANCE) { blankMethod = true; } else if (((DirectValueActionItem) methodName).value instanceof String) { if (((DirectValueActionItem) methodName).value.equals("")) { @@ -71,7 +71,7 @@ public class NewMethodActionItem extends ActionItem { if (!blankMethod) { writer.append("."); if (methodName instanceof DirectValueActionItem) { - if (((DirectValueActionItem) methodName).value instanceof Undefined) { + if (((DirectValueActionItem) methodName).value == Undefined.INSTANCE) { } else if (((DirectValueActionItem) methodName).value instanceof String) { ((DirectValueActionItem) methodName).toStringNoQuotes(writer, localData); } else { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java index c85cb5116..4380726ce 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java @@ -69,10 +69,10 @@ public class StringExtractActionItem extends ActionItem { public static String getResult(Object count, Object index, Object value) { String str = EcmaScript.toString(value); - int idx = (int) (double) EcmaScript.toNumber(index); + int idx = (int) (double) EcmaScript.toNumberAs2(index); idx--; // index seems to be 1 based - int cnt = (int) (double) EcmaScript.toNumber(count); + int cnt = (int) (double) EcmaScript.toNumberAs2(count); /*if (idx < 0) { idx = str.length() + idx; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringLengthActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringLengthActionItem.java index 2f43332a3..6fa8217e6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringLengthActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringLengthActionItem.java @@ -55,7 +55,7 @@ public class StringLengthActionItem extends ActionItem { } public static Double getResult(Object obj) { - return EcmaScript.toNumber(EcmaScript.toString(obj).length()); + return EcmaScript.toNumberAs2(EcmaScript.toString(obj).length()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java index 030246a1e..8ebb97d6e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java @@ -71,7 +71,7 @@ public class AddActionItem extends BinaryOpItem { if (EcmaScript.type(leftResult) == EcmaType.STRING || EcmaScript.type(rightResult) == EcmaType.STRING) { return EcmaScript.toString(leftResult) + EcmaScript.toString(rightResult); } - return EcmaScript.toNumber(leftResult) + EcmaScript.toNumber(rightResult); + return EcmaScript.toNumberAs2(leftResult) + EcmaScript.toNumberAs2(rightResult); } else { return Action.toFloatPoint(leftResult) + Action.toFloatPoint(rightResult); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java index 9c188065a..6bce7b5bf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.action.swf4.ActionLess; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf5.ActionLess2; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -44,14 +45,13 @@ public class GeActionItem extends BinaryOpItem implements LogicalOpItem, Inverte @Override public Object getResult() { if (version2) { - Object ret = EcmaScript.compare(leftSide.getResult(), rightSide.getResult()); - if (ret == Boolean.TRUE) { - return Boolean.FALSE; + Object ret = EcmaScript.compare(leftSide.getResult(), rightSide.getResult(), true); + if (ret == Undefined.INSTANCE) { + return ret; } - if (ret == Boolean.FALSE) { - return Boolean.TRUE; - } - return ret;//undefined + + int reti = (int) ret; + return reti != -1; } else { //For SWF 4 and older, it should return 1 or 0 return Action.toFloatPoint(leftSide.getResult()) >= Action.toFloatPoint(rightSide.getResult()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java index 7af539b62..4454aee67 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.action.swf4.ActionLess; import com.jpexs.decompiler.flash.action.swf5.ActionLess2; import com.jpexs.decompiler.flash.action.swf6.ActionGreater; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -43,7 +44,13 @@ public class GtActionItem extends BinaryOpItem implements LogicalOpItem { } public static Object getResult(Object rightResult, Object leftResult) { - return EcmaScript.compare(rightResult, leftResult); + Object ret = EcmaScript.compare(rightResult, leftResult, true); + if (ret == Undefined.INSTANCE) { + return ret; + } + + int reti = (int) ret; + return reti == -1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java index b54194960..ae37479a1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf5.ActionLess2; import com.jpexs.decompiler.flash.action.swf6.ActionGreater; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -40,14 +41,13 @@ public class LeActionItem extends BinaryOpItem implements LogicalOpItem, Inverte @Override public Object getResult() { - Object ret = EcmaScript.compare(rightSide.getResult(), leftSide.getResult()); - if (ret == Boolean.TRUE) { - return Boolean.FALSE; + Object ret = EcmaScript.compare(rightSide.getResult(), leftSide.getResult(), true); + if (ret == Undefined.INSTANCE) { + return ret; } - if (ret == Boolean.FALSE) { - return Boolean.TRUE; - } - return ret;//undefined + + int reti = (int) ret; + return reti != -1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java index 71f6cbac6..3ad9c90df 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionLess; import com.jpexs.decompiler.flash.action.swf5.ActionLess2; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -47,7 +48,13 @@ public class LtActionItem extends BinaryOpItem implements LogicalOpItem { public static Object getResult(Object rightResult, Object leftResult, boolean version2) { if (version2) { - return EcmaScript.compare(leftResult, rightResult); + Object ret = EcmaScript.compare(leftResult, rightResult, true); + if (ret == Undefined.INSTANCE) { + return ret; + } + + int reti = (int) ret; + return reti == -1; } else { //For SWF 4 and older, it should return 1 or 0 return Action.toFloatPoint(leftResult) < Action.toFloatPoint(rightResult); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index c3c42fcb9..bb7c11454 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -144,9 +144,9 @@ public class ActionPush extends Action { } else if (o instanceof Float) { sos.writeUI8(1); sos.writeFLOAT((Float) o); - } else if (o instanceof Null) { + } else if (o == Null.INSTANCE) { sos.writeUI8(2); - } else if (o instanceof Undefined) { + } else if (o == Undefined.INSTANCE) { sos.writeUI8(3); } else if (o instanceof RegisterNumber) { sos.writeUI8(4); @@ -194,9 +194,9 @@ public class ActionPush extends Action { res += Utf8Helper.getBytesLength((String) o) + 2; } else if (o instanceof Float) { res += 5; - } else if (o instanceof Null) { + } else if (o == Null.INSTANCE) { res++; - } else if (o instanceof Undefined) { + } else if (o == Undefined.INSTANCE) { res++; } else if (o instanceof RegisterNumber) { res += 2; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java index c540f456b..67e491335 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java @@ -29,11 +29,11 @@ public class EcmaScript { if (o == null) { return 0.0; } - if (o instanceof Undefined) { + if (o == Undefined.INSTANCE) { return Double.NaN; } - if (o instanceof Null) { - return Double.NaN; + if (o == Null.INSTANCE) { + return 0.0; } if (o instanceof Boolean) { return (Boolean) o ? 1.0 : 0.0; @@ -59,6 +59,14 @@ public class EcmaScript { return 0.0; } + public static Double toNumberAs2(Object o) { + if (o == Null.INSTANCE) { + return Double.NaN; + } + + return toNumber(o); + } + public static EcmaType type(Object o) { if (o == null) { return EcmaType.NULL; @@ -87,7 +95,43 @@ public class EcmaScript { return EcmaType.OBJECT; } + public static String typeString(Object o) { + EcmaType type = EcmaScript.type(o); + String typeStr; + switch (type) { + case STRING: + typeStr = "string"; + break; + case BOOLEAN: + typeStr = "boolean"; + break; + case NUMBER: + typeStr = "number"; + break; + case OBJECT: + typeStr = "object"; + break; + case UNDEFINED: + typeStr = "undefined"; + break; + case NULL: + // note: null is object in AS3 + typeStr = "object"; + break; + default: + // todo: function,movieclip + typeStr = "object"; + break; + } + + return typeStr; + } + public static Object compare(Object x, Object y) { + return compare(x, y, false); + } + + public static Object compare(Object x, Object y, boolean as2) { Object px = x; Object py = y; /*if (leftFirst) { @@ -98,45 +142,48 @@ public class EcmaScript { px = x; //toPrimitive }*/ if (type(px) != EcmaType.STRING || type(py) != EcmaType.STRING) { - Double nx = toNumber(px); - Double ny = toNumber(py); + Double nx = as2 ? toNumberAs2(px) : toNumber(px); + Double ny = as2 ? toNumberAs2(py) : toNumber(py); if (nx.isNaN() || ny.isNaN()) { return Undefined.INSTANCE; } - if ((nx).compareTo(ny) == 0) { - return false; + if (nx.compareTo(ny) == 0) { + return 0; } - if ((Double.compare(nx, -0.0) == 0) && (Double.compare(ny, 0.0) == 0)) { - return false; + if (Double.compare(nx, -0.0) == 0 && Double.compare(ny, 0.0) == 0) { + return 0; } - if ((Double.compare(nx, 0.0) == 0) && (Double.compare(ny, -0.0) == 0)) { - return false; + if (Double.compare(nx, 0.0) == 0 && Double.compare(ny, -0.0) == 0) { + return 0; } if (nx.isInfinite() && nx > 0) { - return false; + return 1; } if (ny.isInfinite() && ny > 0) { - return true; + return -1; } if (nx.isInfinite() && nx < 0) { - return false; + return 1; } if (ny.isInfinite() && ny < 0) { - return true; + return -1; } if (nx.compareTo(ny) < 0) { - return true; + return -1; } - return false; + return 1; } else {//Both are STRING String sx = (String) px; String sy = (String) py; + if (sx.equals(sy)) { + return 0; + } if (sx.startsWith(sy)) { - return false; + return 1; } if (sy.startsWith(sx)) { - return true; + return -1; } int len = sx.length() > sy.length() ? sx.length() : sy.length(); for (int k = 0; k < len; k++) { @@ -150,13 +197,13 @@ public class EcmaScript { } if (m != n) { if (m < n) { - return true; + return -1; } else { - return false; + return 1; } } } - return false; + return 0; } } @@ -253,10 +300,10 @@ public class EcmaScript { if (o == null) { return false; } - if (o instanceof Undefined) { + if (o == Undefined.INSTANCE) { return false; } - if (o instanceof Null) { + if (o == Null.INSTANCE) { return false; } if (o instanceof Boolean) { 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 f0bda395c..17c548edf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java @@ -231,7 +231,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { } public Double getResultAsNumber() { - return EcmaScript.toNumber(getResult()); + return EcmaScript.toNumberAs2(getResult()); } public String toStringNoQuotes(LocalData localData) { @@ -390,7 +390,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { public long getAsLong() { if (this instanceof DirectValueActionItem) { DirectValueActionItem dvai = (DirectValueActionItem) this; - return (long) (double) EcmaScript.toNumber(dvai.value); + return (long) (double) EcmaScript.toNumberAs2(dvai.value); } return 0; diff --git a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java index 2dcdd6168..630bc5a20 100644 --- a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.gui.player; import com.jpexs.decompiler.flash.gui.FlashUnsupportedException; import com.jpexs.decompiler.flash.gui.Main; -import com.jpexs.decompiler.flash.gui.View; import com.jpexs.javactivex.ActiveX; import com.jpexs.javactivex.ActiveXEvent; import com.jpexs.javactivex.ActiveXException; @@ -36,11 +35,8 @@ import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Stack; import java.util.Timer; import java.util.TimerTask; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -253,6 +249,7 @@ public final class FlashPlayerPanel extends Panel implements Closeable, MediaDis private String movieToPlay = null; private Thread playQueue; + private Object queueLock = new Object(); public synchronized void displaySWF(final String flashName, final Color bgColor, final float frameRate) { diff --git a/test/com/jpexs/decompiler/flash/gui/FlashPlayerTest.java b/test/com/jpexs/decompiler/flash/gui/FlashPlayerTest.java index ee39aa6d1..448299406 100644 --- a/test/com/jpexs/decompiler/flash/gui/FlashPlayerTest.java +++ b/test/com/jpexs/decompiler/flash/gui/FlashPlayerTest.java @@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; 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.instructions.IfTypeIns; @@ -151,153 +151,166 @@ public class FlashPlayerTest { body.max_stack = 20; body.max_regs = 10; - for (int i = 0; i < 256; i++) { - if (i == AVM2Instructions.ReturnVoid) { - // todo: fails for some reason - continue; - } + AVM2Instruction[] pushes = new AVM2Instruction[]{ + new AVM2Instruction(0, AVM2Instructions.PushUndefined, null), + new AVM2Instruction(0, AVM2Instructions.PushNull, null), + new AVM2Instruction(0, AVM2Instructions.PushTrue, null), + new AVM2Instruction(0, AVM2Instructions.PushFalse, null), + new AVM2Instruction(0, AVM2Instructions.PushNan, null), + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{1}), + new AVM2Instruction(0, AVM2Instructions.PushDouble, new int[]{1}), + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{1}), + new AVM2Instruction(0, AVM2Instructions.PushInt, new int[]{1}), + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{1}), + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{-2}), + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{-1}), + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{0}), + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{1}), + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{2}),}; - // todo: the following instructions are not implemented - if (i == AVM2Instructions.GetSuper - || i == AVM2Instructions.SetSuper - || i == AVM2Instructions.DXNS - || i == AVM2Instructions.DXNSLate - || i == AVM2Instructions.Kill - || i == AVM2Instructions.LookupSwitch - || i == AVM2Instructions.PushWith - || i == AVM2Instructions.NextName - || i == AVM2Instructions.HasNext - || i == AVM2Instructions.NextValue - || i == AVM2Instructions.PushScope - || i == AVM2Instructions.PushNamespace - || i == AVM2Instructions.HasNext2 - || i == AVM2Instructions.NewFunction - || i == AVM2Instructions.Call - || i == AVM2Instructions.Construct - || i == AVM2Instructions.CallMethod - || i == AVM2Instructions.CallStatic - || i == AVM2Instructions.CallSuper - || i == AVM2Instructions.CallProperty - || i == AVM2Instructions.ReturnVoid - || i == AVM2Instructions.ConstructSuper - || i == AVM2Instructions.ConstructProp - || i == AVM2Instructions.CallPropLex - || i == AVM2Instructions.CallSuperVoid - || i == AVM2Instructions.CallPropVoid - || i == AVM2Instructions.ApplyType - || i == AVM2Instructions.NewObject - || i == AVM2Instructions.NewArray - || i == AVM2Instructions.NewActivation - || i == AVM2Instructions.NewClass - || i == AVM2Instructions.GetDescendants - || i == AVM2Instructions.NewCatch - || i == AVM2Instructions.FindPropGlobal - || i == AVM2Instructions.FindPropertyStrict - || i == AVM2Instructions.FindProperty - || i == AVM2Instructions.FindDef - || i == AVM2Instructions.GetLex - || i == AVM2Instructions.SetProperty - || i == AVM2Instructions.GetGlobalScope - || i == AVM2Instructions.GetScopeObject - || i == AVM2Instructions.GetProperty - || i == AVM2Instructions.GetOuterScope - || i == AVM2Instructions.InitProperty - || i == AVM2Instructions.DeleteProperty - || i == AVM2Instructions.GetSlot - || i == AVM2Instructions.SetSlot - || i == AVM2Instructions.GetGlobalSlot - || i == AVM2Instructions.SetGlobalSlot - || i == AVM2Instructions.CheckFilter - || i == AVM2Instructions.AsType // todo: fix - || i == AVM2Instructions.AsTypeLate - || i == AVM2Instructions.InstanceOf - || i == AVM2Instructions.IsType - || i == AVM2Instructions.IsTypeLate - || i == AVM2Instructions.In - || i == AVM2Instructions.SubtractI // todo: implement - || i == AVM2Instructions.MultiplyI // todo: implement - || i == AVM2Instructions.BkptLine // todo: implement - ) { - continue; - } - - System.out.println("Instruction code: " + Integer.toHexString(i) + " (" + i + ") " + AVM2Code.instructionSet[i].instructionName); - int j = 1; - File f2 = new File("run_test_" + new Date().getTime() + "_" + i + "_" + j + ".swf"); - f2.deleteOnExit(); - - AVM2Code ccode = new AVM2Code(); - ccode.code = new ArrayList<>(); - List code = ccode.code; - code.add(new AVM2Instruction(0, AVM2Instructions.GetLocal0, null)); - code.add(new AVM2Instruction(0, AVM2Instructions.PushScope, null)); - code.add(new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{10})); - code.add(new AVM2Instruction(0, AVM2Instructions.SetLocal0, null)); - code.add(new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{11})); - code.add(new AVM2Instruction(0, AVM2Instructions.SetLocal1, null)); - code.add(new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{0})); - code.add(new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{1})); - code.add(new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{2})); - - InstructionDefinition ins = AVM2Code.instructionSet[i]; - int[] params = null; - boolean ifType = false; - if (ins.operands.length > 0) { - params = new int[ins.operands.length]; - if (!(ins instanceof IfTypeIns)) { - for (int k = 0; k < params.length; k++) { - params[k] = 1; + for (int i = 58; i < 256; i++) { + for (int p1 = 0; p1 < pushes.length; p1++) { + for (int p2 = 0; p2 < pushes.length; p2++) { + System.out.println("p1: " + p1 + " p2: " + p2); + // todo: the following instructions are not implemented + if (i == AVM2Instructions.GetSuper + || i == AVM2Instructions.SetSuper + || i == AVM2Instructions.DXNS + || i == AVM2Instructions.DXNSLate + || i == AVM2Instructions.Kill + || i == AVM2Instructions.LookupSwitch + || i == AVM2Instructions.PushWith + || i == AVM2Instructions.NextName + || i == AVM2Instructions.HasNext + || i == AVM2Instructions.NextValue + || i == AVM2Instructions.PushScope + || i == AVM2Instructions.PushNamespace + || i == AVM2Instructions.HasNext2 + || i == AVM2Instructions.NewFunction + || i == AVM2Instructions.Call + || i == AVM2Instructions.Construct + || i == AVM2Instructions.CallMethod + || i == AVM2Instructions.CallStatic + || i == AVM2Instructions.CallSuper + || i == AVM2Instructions.CallProperty + || i == AVM2Instructions.ConstructSuper + || i == AVM2Instructions.ConstructProp + || i == AVM2Instructions.CallPropLex + || i == AVM2Instructions.CallSuperVoid + || i == AVM2Instructions.CallPropVoid + || i == AVM2Instructions.ApplyType + || i == AVM2Instructions.NewObject + || i == AVM2Instructions.NewArray + || i == AVM2Instructions.NewActivation + || i == AVM2Instructions.NewClass + || i == AVM2Instructions.GetDescendants + || i == AVM2Instructions.NewCatch + || i == AVM2Instructions.FindPropGlobal + || i == AVM2Instructions.FindPropertyStrict + || i == AVM2Instructions.FindProperty + || i == AVM2Instructions.FindDef + || i == AVM2Instructions.GetLex + || i == AVM2Instructions.SetProperty + || i == AVM2Instructions.GetGlobalScope + || i == AVM2Instructions.GetScopeObject + || i == AVM2Instructions.GetProperty + || i == AVM2Instructions.GetOuterScope + || i == AVM2Instructions.InitProperty + || i == AVM2Instructions.DeleteProperty + || i == AVM2Instructions.GetSlot + || i == AVM2Instructions.SetSlot + || i == AVM2Instructions.GetGlobalSlot + || i == AVM2Instructions.SetGlobalSlot + || i == AVM2Instructions.CheckFilter + || i == AVM2Instructions.AsType // todo: fix + || i == AVM2Instructions.AsTypeLate + || i == AVM2Instructions.InstanceOf + || i == AVM2Instructions.IsType + || i == AVM2Instructions.IsTypeLate + || i == AVM2Instructions.In) { + continue; } - } - ifType = ins instanceof IfTypeIns; - if (ifType) { - params[0] = 3; + System.out.println("Instruction code: " + Integer.toHexString(i) + " (" + i + ") " + AVM2Code.instructionSet[i].instructionName); + int j = 1; + File f2 = new File("run_test_" + new Date().getTime() + "_" + i + "_" + j + ".swf"); + f2.deleteOnExit(); + + AVM2Code ccode = new AVM2Code(); + ccode.code = new ArrayList<>(); + List code = ccode.code; + code.add(new AVM2Instruction(0, AVM2Instructions.GetLocal0, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.PushScope, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{10})); + code.add(new AVM2Instruction(0, AVM2Instructions.SetLocal0, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{11})); + code.add(new AVM2Instruction(0, AVM2Instructions.SetLocal1, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{0})); + code.add(pushes[p1].clone()); + code.add(pushes[p2].clone()); + + InstructionDefinition ins = AVM2Code.instructionSet[i]; + int[] params = null; + boolean ifType = false; + if (ins.operands.length > 0) { + params = new int[ins.operands.length]; + if (!(ins instanceof IfTypeIns)) { + for (int param = 0; param < params.length; param++) { + params[param] = 1; + } + } + + ifType = ins instanceof IfTypeIns; + if (ifType) { + params[0] = 3; + } + } + + code.add(new AVM2Instruction(0, ins, params)); + if (ifType) { + code.add(new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{1})); + code.add(new AVM2Instruction(0, AVM2Instructions.ReturnValue, null)); + } + + code.add(new AVM2Instruction(0, AVM2Instructions.Dup, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.TypeOf, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.Add, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.ReturnValue, null)); + + body.setCode(ccode); + body.markOffsets(); + //String pcode = ccode.toASMSource(); + //String as = body.toSource(); + + abcTag.setModified(true); + try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(f2))) { + swf.saveTo(fos); + } + + flash.setMovie(f2.getAbsolutePath()); + + synchronized (lockObj) { + lockObj.wait(); + } + + f2.delete(); + + String flashResult = resultRef.getVal(); + System.out.println("Flash result: " + flashResult); + + String ffdecExecuteResult; + try { + Object res = ccode.execute(new HashMap<>(), abc.constants, AVM2Runtime.ADOBE_FLASH, 19); + ffdecExecuteResult = "Result:" + EcmaScript.toString(res) + " Type:" + EcmaScript.typeString(res); + } catch (AVM2ExecutionException ex) { + ffdecExecuteResult = "Error:" + ex.getMessage(); + } + + System.out.println("FFDec execte result: " + ffdecExecuteResult); + + Assert.assertEquals(ffdecExecuteResult, flashResult); } } - - code.add(new AVM2Instruction(0, ins, params)); - if (ifType) { - code.add(new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{1})); - code.add(new AVM2Instruction(0, AVM2Instructions.ReturnValue, null)); - } - - code.add(new AVM2Instruction(0, AVM2Instructions.Dup, null)); - code.add(new AVM2Instruction(0, AVM2Instructions.TypeOf, null)); - code.add(new AVM2Instruction(0, AVM2Instructions.Add, null)); - code.add(new AVM2Instruction(0, AVM2Instructions.ReturnValue, null)); - - body.setCode(ccode); - body.markOffsets(); - /*String pcode = ccode.toASMSource(); - String as = body.toSource();*/ - - abcTag.setModified(true); - try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(f2))) { - swf.saveTo(fos); - } - - flash.setMovie(f2.getAbsolutePath()); - - synchronized (lockObj) { - lockObj.wait(); - } - - f2.delete(); - - String flashResult = resultRef.getVal(); - System.out.println("Flash result: " + flashResult); - - String ffdecExecuteResult; - try { - ffdecExecuteResult = EcmaScript.toString(ccode.execute(new HashMap<>(), abc.constants, AVM2Runtime.ADOBE_FLASH, 19)); - } catch (AVM2ExecutionException ex) { - ffdecExecuteResult = ex.getMessage(); - } - - System.out.println("FFDec execte result: " + ffdecExecuteResult); - - Assert.assertEquals(ffdecExecuteResult, flashResult); } /*int cnt = 0; @@ -373,20 +386,22 @@ public class FlashPlayerTest { } else if (i == 3) { r2Obj = true; } else if (i == 4) { - r2Obj = "test"; + r2Obj = ""; } else if (i == 5) { - r2Obj = "0"; + r2Obj = "test"; } else if (i == 6) { - r2Obj = "0.0"; + r2Obj = "0"; } else if (i == 7) { - r2Obj = "1.0"; + r2Obj = "0.0"; } else if (i == 8) { - r2Obj = "-1.0"; + r2Obj = "1.0"; } else if (i == 9) { - r2Obj = 0; + r2Obj = "-1.0"; } else if (i == 10) { - r2Obj = -100; + r2Obj = 0; } else if (i == 11) { + r2Obj = -100; + } else if (i == 12) { r2Obj = 100; } else { r2Obj = r2;