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 9d6942d0e..d893694a4 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 @@ -656,16 +656,16 @@ public class AVM2Code implements Cloneable { } public Object execute(HashMap arguments, AVM2ConstantPool constants) throws AVM2ExecutionException { - return execute(arguments, constants, AVM2Runtime.UNKNOWN, 0); + return execute(arguments, constants, null); } - public Object execute(HashMap arguments, AVM2ConstantPool constants, AVM2Runtime runtime, int runtimeVersoin) throws AVM2ExecutionException { + public Object execute(HashMap arguments, AVM2ConstantPool constants, AVM2RuntimeInfo runtimeInfo) throws AVM2ExecutionException { int pos = 0; LocalDataArea lda = new LocalDataArea(); lda.methodName = "methodName"; // todo: needed for VerifyError exception message lda.localRegisters = arguments; - lda.runtime = runtime; - lda.runtimeVersion = runtimeVersoin; + lda.runtimeInfo = runtimeInfo; + for (AVM2Instruction ins : code) { ins.definition.verify(lda, constants, ins); } @@ -680,7 +680,7 @@ public class AVM2Code implements Cloneable { try { pos = adr2pos(lda.jump); } catch (ConvertException ex) { - throw new AVM2VerifyErrorException(AVM2VerifyErrorException.BRANCH_TARGET_INVALID_INSTRUCTION); + throw new AVM2VerifyErrorException(AVM2VerifyErrorException.BRANCH_TARGET_INVALID_INSTRUCTION, lda.isDebug()); } lda.jump = null; } else { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2RuntimeInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2RuntimeInfo.java new file mode 100644 index 000000000..020e216c1 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2RuntimeInfo.java @@ -0,0 +1,35 @@ +/* + * 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; + +/** + * + * @author JPEXS + */ +public class AVM2RuntimeInfo { + + public AVM2Runtime runtime; + + public int version; + + public boolean debug; + + public AVM2RuntimeInfo(AVM2Runtime runtime, int version, boolean debug) { + this.runtime = runtime; + this.version = version; + this.debug = debug; + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/LocalDataArea.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/LocalDataArea.java index b689c43cb..5dc309659 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/LocalDataArea.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/LocalDataArea.java @@ -35,9 +35,7 @@ public class LocalDataArea { public String executionException; - public AVM2Runtime runtime; - - public int runtimeVersion; + public AVM2RuntimeInfo runtimeInfo; private byte[] domainMemory; @@ -46,12 +44,20 @@ public class LocalDataArea { public byte[] getDomainMemory() { if (domainMemory == null) { - domainMemory = new byte[1024 * 1024]; + domainMemory = new byte[1024]; // in flash player this is the default size } return domainMemory; } + public AVM2Runtime getRuntime() { + return runtimeInfo == null ? AVM2Runtime.UNKNOWN : runtimeInfo.runtime; + } + + public boolean isDebug() { + return runtimeInfo != null && runtimeInfo.debug; + } + public void clear() { operandStack.clear(); scopeStack.clear(); 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 index d872ed70f..ee4dbc125 100644 --- 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 @@ -21,23 +21,23 @@ package com.jpexs.decompiler.flash.abc.avm2.exceptions; */ public class AVM2RangeErrorException extends AVM2ExecutionException { - public AVM2RangeErrorException(int code) { - super(codeToMessage(code, null)); + public AVM2RangeErrorException(int code, boolean debug) { + super(codeToMessage(code, debug, null)); } - public AVM2RangeErrorException(int code, Object[] params) { - super(codeToMessage(code, params)); + public AVM2RangeErrorException(int code, boolean debug, Object[] params) { + super(codeToMessage(code, debug, params)); } - private static String codeToMessage(int code, Object[] params) { + private static String codeToMessage(int code, boolean debug, Object[] params) { String msg = null; switch (code) { } String result = "RangeError: Error #" + code; - /*if (msg != null) { - result += ": " + msg; - }*/ + if (debug && msg != null) { + result += ": " + msg; + } return result; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2TypeErrorException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2TypeErrorException.java index 88bcc8e92..4299af88e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2TypeErrorException.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2TypeErrorException.java @@ -21,23 +21,23 @@ package com.jpexs.decompiler.flash.abc.avm2.exceptions; */ public class AVM2TypeErrorException extends AVM2ExecutionException { - public AVM2TypeErrorException(int code) { - super(codeToMessage(code, null)); + public AVM2TypeErrorException(int code, boolean debug) { + super(codeToMessage(code, debug, null)); } - public AVM2TypeErrorException(int code, Object[] params) { - super(codeToMessage(code, params)); + public AVM2TypeErrorException(int code, boolean debug, Object[] params) { + super(codeToMessage(code, debug, params)); } - private static String codeToMessage(int code, Object[] params) { + private static String codeToMessage(int code, boolean debug, Object[] params) { String msg = null; switch (code) { } String result = "TypeError: Error #" + code; - /*if (msg != null) { - result += ": " + msg; - }*/ + if (debug && msg != null) { + result += ": " + msg; + } return result; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2VerifyErrorException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2VerifyErrorException.java index 68b00c36c..63a40a822 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2VerifyErrorException.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2VerifyErrorException.java @@ -27,15 +27,15 @@ public class AVM2VerifyErrorException extends AVM2ExecutionException { public static final int CPOOL_INDEX_OUT_OF_RANGE = 1032; - public AVM2VerifyErrorException(int code) { - super(codeToMessage(code, null)); + public AVM2VerifyErrorException(int code, boolean debug) { + super(codeToMessage(code, debug, null)); } - public AVM2VerifyErrorException(int code, Object[] params) { - super(codeToMessage(code, params)); + public AVM2VerifyErrorException(int code, boolean debug, Object[] params) { + super(codeToMessage(code, debug, params)); } - private static String codeToMessage(int code, Object[] params) { + private static String codeToMessage(int code, boolean debug, Object[] params) { String msg = null; switch (code) { case ILLEGAL_OPCODE: @@ -56,9 +56,9 @@ public class AVM2VerifyErrorException extends AVM2ExecutionException { } String result = "VerifyError: Error #" + code; - /*if (msg != null) { - result += ": " + msg; - }*/ + if (debug && msg != null) { + result += ": " + msg; + } return result; } 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 8baa92396..b413533fb 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 @@ -98,27 +98,27 @@ public abstract class InstructionDefinition implements Serializable { if (operand == AVM2Code.DAT_MULTINAME_INDEX) { int idx = ins.operands[i]; if (idx <= 0 || idx >= constants.getMultinameCount()) { - throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, new Object[]{idx, constants.getMultinameCount()}); + throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, lda.isDebug(), new Object[]{idx, constants.getMultinameCount()}); } } else if (operand == AVM2Code.DAT_DOUBLE_INDEX) { int idx = ins.operands[i]; if (idx <= 0 || idx >= constants.getDoubleCount()) { - throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, new Object[]{idx, constants.getDoubleCount()}); + throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, lda.isDebug(), new Object[]{idx, constants.getDoubleCount()}); } } else if (operand == AVM2Code.DAT_INT_INDEX) { int idx = ins.operands[i]; if (idx <= 0 || idx >= constants.getIntCount()) { - throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, new Object[]{idx, constants.getIntCount()}); + throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, lda.isDebug(), new Object[]{idx, constants.getIntCount()}); } } else if (operand == AVM2Code.DAT_UINT_INDEX) { int idx = ins.operands[i]; if (idx <= 0 || idx >= constants.getUIntCount()) { - throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, new Object[]{idx, constants.getUIntCount()}); + throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, lda.isDebug(), new Object[]{idx, constants.getUIntCount()}); } } else if (operand == AVM2Code.DAT_STRING_INDEX) { int idx = ins.operands[i]; if (idx <= 0 || idx >= constants.getStringCount()) { - throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, new Object[]{idx, constants.getStringCount()}); + throw new AVM2VerifyErrorException(AVM2VerifyErrorException.CPOOL_INDEX_OUT_OF_RANGE, lda.isDebug(), new Object[]{idx, constants.getStringCount()}); } } } @@ -130,7 +130,7 @@ public abstract class InstructionDefinition implements Serializable { } protected void illegalOpCode(LocalDataArea lda, AVM2Instruction ins) throws AVM2VerifyErrorException { - throw new AVM2VerifyErrorException(AVM2VerifyErrorException.ILLEGAL_OPCODE, new Object[]{lda.methodName, instructionCode, ins.getOffset()}); + throw new AVM2VerifyErrorException(AVM2VerifyErrorException.ILLEGAL_OPCODE, lda.isDebug(), new Object[]{lda.methodName, instructionCode, ins.getOffset()}); } public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) throws InterruptedException { 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 8fef0b1b2..0dda95b8f 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,8 +17,9 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions; 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.exceptions.AVM2ExecutionException; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; /** * @@ -31,8 +32,12 @@ public class UnknownInstruction extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { illegalOpCode(lda, ins); + } + + @Override + public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { return false; } } 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 81e94169d..a44b84b9a 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 @@ -41,10 +41,10 @@ public class Lf32Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } // todo: get 32 bits float 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 258fbc70a..6cf474673 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 @@ -41,10 +41,10 @@ public class Lf64Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } // todo: get 64 bits float 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 afcfdec0e..475262208 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 @@ -41,10 +41,10 @@ public class Li16Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } // todo: get 16 bits 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 9a3486986..658a656e9 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 @@ -41,10 +41,10 @@ public class Li32Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } // todo: get 32 bits 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 d08ba4ed6..be32bd042 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 @@ -41,10 +41,10 @@ public class Li8Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } lda.operandStack.push((Double) (double) (domainMemory[addr])); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Sf32Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Sf32Ins.java index 74593e1c9..1fdda79f0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Sf32Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Sf32Ins.java @@ -41,10 +41,10 @@ public class Sf32Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } Double value = (double) EcmaScript.toNumber(lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Sf64Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Sf64Ins.java index 15ae9b872..6cf197468 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Sf64Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Sf64Ins.java @@ -41,10 +41,10 @@ public class Sf64Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } Double value = (double) EcmaScript.toNumber(lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si16Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si16Ins.java index 121c01d49..315ca79ef 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si16Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si16Ins.java @@ -41,10 +41,10 @@ public class Si16Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } int value = EcmaScript.toInt32(lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si32Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si32Ins.java index 4e53ec514..adefe531d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si32Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si32Ins.java @@ -41,10 +41,10 @@ public class Si32Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } int value = EcmaScript.toInt32(lda.operandStack.pop()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si8Ins.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si8Ins.java index c58401ca0..479544301 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si8Ins.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/Si8Ins.java @@ -41,10 +41,10 @@ public class Si8Ins extends InstructionDefinition implements AlchemyTypeIns { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2RangeErrorException { - int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop()); + int addr = EcmaScript.toInt32(lda.operandStack.pop()); byte[] domainMemory = lda.getDomainMemory(); if (addr < 0 || addr >= domainMemory.length) { - throw new AVM2RangeErrorException(1506); + throw new AVM2RangeErrorException(1506, lda.isDebug()); } int value = EcmaScript.toInt32(lda.operandStack.pop()); 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 9f90cfaa1..baf360cf0 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class AbsJumpIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 bc48e179f..1f2783e66 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class AddDIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 264cb6a6d..ae1fed227 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,9 +18,9 @@ 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.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,11 +31,11 @@ public class AddPIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 04f00f511..cac8b58f8 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class AllocIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 b098b79c3..123301093 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,9 +18,9 @@ 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.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,11 +31,11 @@ public class CallInterfaceIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 fc311a993..676d65e36 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,9 +17,9 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -30,11 +30,11 @@ public class CallSuperIdIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 e4728d47d..4cb1120ea 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class CodeGenOpIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 6b59f1c78..c6749475f 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class ConcatIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 b71b65449..3800ce1b0 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class ConvertF4Ins extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 ad8582119..878a9e307 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class ConvertMIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 fb86edc4e..94d62fab7 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,9 +19,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -32,12 +32,12 @@ public class ConvertMPIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 70e21a69b..2f7ea9bd2 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,9 +18,9 @@ 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.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,11 +31,11 @@ public class DecLocalPIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 bc3fb7b8d..350d8ada0 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class DecodeIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 67b6da267..4481e5dda 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,9 +18,9 @@ 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.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,11 +31,11 @@ public class DecrementPIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 7b0d93c4d..fbdbc8a76 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class DelDescendantsIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 18e3e3515..a3566244b 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class DeletePropertyLateIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 6adc51326..bf02971a3 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,9 +19,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -32,12 +32,12 @@ public class DividePIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 bb783a52a..cd038554c 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class DoubleToAtomIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 d90fe442c..e0b96d026 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,9 +19,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -32,12 +32,12 @@ public class FindPropGlobalIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 45e1a7bc4..9e062a856 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,9 +18,9 @@ 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.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,11 +31,11 @@ public class IncLocalPIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 8cdc03b72..b9b7a37c4 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,9 +18,9 @@ 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.AVM2Runtime; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,11 +31,11 @@ public class IncrementPIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 72f71b1fe..1e97d607e 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,9 +17,9 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -30,11 +30,11 @@ public class InvalidIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 e6b7f11d5..af574891f 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,9 +17,9 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -30,11 +30,11 @@ public class Lf32x4Ins extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 e476255f4..bd323f158 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class MarkIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 3dcf35ca8..dbf16df8b 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,9 +19,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -32,12 +32,12 @@ public class ModuloPIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 9a2dab268..ca74a8076 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,9 +19,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -32,12 +32,12 @@ public class MultiplyPIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 062afc50a..83b960898 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,9 +19,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -32,12 +32,12 @@ public class NegatePIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 22cafa038..1fe7a3524 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class PrologueIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 a8849b433..fd6d3946c 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,9 +19,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -32,12 +32,12 @@ public class PushConstantIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 aba296041..5b36e1975 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class PushDNanIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 8b9a4d3e4..267eb7155 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,9 +19,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -32,12 +32,12 @@ public class PushDecimalIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 a58fbf37d..c92c5c723 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,9 +17,9 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -30,11 +30,11 @@ public class PushFloat4Ins extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 32ccf4526..fbdfda3d9 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class SendEnterIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 44f4e9848..b211cbc9e 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class SetPropertyLateIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 499efed70..2a16a203e 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,9 +17,9 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; -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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -30,11 +30,11 @@ public class Sf32x4Ins extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } } 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 cd5acfd06..752dd523a 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,9 +19,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -32,12 +32,12 @@ public class SubtractPIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 ae088e222..ee0238bc5 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class SweepIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 ee94a6104..582073743 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class VerifyOpIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 33cf262e4..27d2a9bf0 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class VerifyPassIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 92ebd8824..68444043f 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,9 +18,9 @@ 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.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.exceptions.AVM2VerifyErrorException; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -31,12 +31,12 @@ public class WbIns extends InstructionDefinition { } @Override - public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { - if (lda.runtime == AVM2Runtime.ADOBE_FLASH) { + public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException { + if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) { illegalOpCode(lda, ins); } - return super.execute(lda, constants, ins); + super.verify(lda, constants, ins); } @Override 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 f4461176f..b3e5159ff 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,9 +20,9 @@ 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.LocalDataArea; 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; import com.jpexs.decompiler.flash.abc.avm2.model.CoerceAVM2Item; @@ -46,7 +46,7 @@ public class CoerceIns extends InstructionDefinition implements CoerceOrConvertT public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException { Multiname multiname = (Multiname) ins.getParam(constants, 0); if (multiname == null) { - throw new AVM2TypeErrorException(1034); + throw new AVM2TypeErrorException(1034, lda.isDebug()); } Object value = lda.operandStack.pop(); @@ -54,13 +54,22 @@ public class CoerceIns extends InstructionDefinition implements CoerceOrConvertT value = Null.INSTANCE; } + //push and pop coerced value to specified type EcmaType type = EcmaScript.type(value); - if (type != EcmaType.NULL && type != EcmaType.OBJECT) { - throw new AVM2TypeErrorException(1034); + switch (type) { + case NUMBER: + case BOOLEAN: + lda.operandStack.push(EcmaScript.toString(value)); + break; + case NULL: + case OBJECT: + case STRING: + lda.operandStack.push(value); + break; + default: + throw new AVM2TypeErrorException(1034, lda.isDebug()); } - //push and pop coerced value to specified type - lda.operandStack.push(value); 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 ca570446e..871fb5c3b 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 @@ -42,11 +42,11 @@ public class ConvertOIns extends InstructionDefinition implements CoerceOrConver public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2TypeErrorException { Object obj = lda.operandStack.peek(); if (EcmaScript.type(obj) == EcmaType.NULL) { - throw new AVM2TypeErrorException(1009); + throw new AVM2TypeErrorException(1009, lda.isDebug()); } if (EcmaScript.type(obj) == EcmaType.UNDEFINED) { - throw new AVM2TypeErrorException(1010); + throw new AVM2TypeErrorException(1010, lda.isDebug()); } //throw if pop is not object 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 d8c8b48af..68fa59b86 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 @@ -69,6 +69,10 @@ public class EcmaScript { return Double.NaN; } + if (o instanceof String && ((String) o).isEmpty()) { + return Double.NaN; + } + return toNumber(o); } @@ -213,14 +217,22 @@ public class EcmaScript { } public static boolean strictEquals(Object x, Object y) { + return strictEquals(false, x, y); + } + + public static boolean equals(Object x, Object y) { + return equals(false, x, y); + } + + public static boolean strictEquals(boolean as2, Object x, Object y) { if (type(x) != type(y)) { return false; } - return equals(x, y); + return equals(as2, x, y); } - public static boolean equals(Object x, Object y) { + public static boolean equals(boolean as2, Object x, Object y) { EcmaType typeX = type(x); EcmaType typeY = type(y); if (typeX == typeY) { @@ -279,16 +291,16 @@ public class EcmaScript { } if ((typeX == EcmaType.NUMBER) && (typeY == EcmaType.STRING)) { - return equals(x, toNumber(y)); + return equals(as2, x, as2 ? toNumberAs2(y) : toNumber(y)); } if ((typeX == EcmaType.STRING) && (typeY == EcmaType.NUMBER)) { - return equals(toNumber(x), y); + return equals(as2, as2 ? toNumberAs2(x) : toNumber(x), y); } if (typeX == EcmaType.BOOLEAN) { - return equals(toNumber(x), y); + return equals(as2, as2 ? toNumberAs2(x) : toNumber(x), y); } if (typeY == EcmaType.BOOLEAN) { - return equals(x, toNumber(y)); + return equals(as2, x, as2 ? toNumberAs2(y) : toNumber(y)); } if (typeX == EcmaType.STRING || typeX == EcmaType.NUMBER) { //y is object diff --git a/test/com/jpexs/decompiler/flash/gui/AS2ExecuteTask.java b/test/com/jpexs/decompiler/flash/gui/AS2ExecuteTask.java index c0cff956d..764b442a9 100644 --- a/test/com/jpexs/decompiler/flash/gui/AS2ExecuteTask.java +++ b/test/com/jpexs/decompiler/flash/gui/AS2ExecuteTask.java @@ -31,7 +31,5 @@ public class AS2ExecuteTask { public String flashResult; - public String ffdecTranslateResult; - public String ffdecResult; } diff --git a/test/com/jpexs/decompiler/flash/gui/FlashPlayerTest.java b/test/com/jpexs/decompiler/flash/gui/FlashPlayerTest.java index 448299406..53522c372 100644 --- a/test/com/jpexs/decompiler/flash/gui/FlashPlayerTest.java +++ b/test/com/jpexs/decompiler/flash/gui/FlashPlayerTest.java @@ -16,18 +16,16 @@ */ 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.AVM2Runtime; +import com.jpexs.decompiler.flash.abc.avm2.AVM2RuntimeInfo; 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; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.ActionList; import com.jpexs.decompiler.flash.action.ActionLocalData; import com.jpexs.decompiler.flash.action.LocalDataArea; import com.jpexs.decompiler.flash.action.swf4.ActionAdd; @@ -74,33 +72,20 @@ import com.jpexs.decompiler.flash.action.swf6.ActionStringGreater; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.ecma.Undefined; -import com.jpexs.decompiler.flash.tags.DoABC2Tag; -import com.jpexs.decompiler.flash.tags.Tag; -import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.graph.Graph; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; -import com.jpexs.javactivex.ActiveX; -import com.jpexs.javactivex.ActiveXEvent; -import com.jpexs.javactivex.ActiveXEventListener; -import com.jpexs.javactivex.Reference; -import com.jpexs.javactivex.example.controls.flash.ShockwaveFlash; -import java.awt.Panel; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; +import com.jpexs.helpers.Helper; +import com.jpexs.helpers.utf8.Utf8Helper; import java.io.IOException; -import java.io.OutputStream; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Random; -import org.testng.Assert; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; +import org.testng.annotations.Test; /** * @@ -108,70 +93,67 @@ import static org.testng.Assert.fail; */ public class FlashPlayerTest { - private final Object lockObj = new Object(); - private final Random random = new Random(); + private final AVM2RuntimeInfo adobeRuntime = new AVM2RuntimeInfo(AVM2Runtime.ADOBE_FLASH, 19, false); + //@Test - public void test1() throws IOException, InterruptedException { - final Reference resultRef = new Reference<>(null); + public void testAs3Pushes() throws IOException, InterruptedException { + AdobeFlashExecutor adobeExecutor = new AdobeFlashExecutor(); - ShockwaveFlash flash = ActiveX.createObject(ShockwaveFlash.class, new Panel()); - flash.setAllowScriptAccess("always"); - flash.setAllowNetworking("all"); - flash.addFSCommandListener(new ActiveXEventListener() { + adobeExecutor.loadTestSwf(); + ABC abc = adobeExecutor.as3TestSwfAbcTag.getABC(); + abc.constants.ensureStringCapacity(1000000); + abc.constants.ensureMultinameCapacity(1000000); + AVM2Instruction[] pushes = getAs3Pushes(abc); - @Override - public void onEvent(ActiveXEvent axe) { - resultRef.setVal((String) axe.args.get("args")); - synchronized (lockObj) { - lockObj.notify(); - } + List tasks = new ArrayList<>(); + for (int p1 = 0; p1 < pushes.length; p1++) { + 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(pushes[p1].clone()); + code.add(new AVM2Instruction(0, AVM2Instructions.ReturnValue, null)); + ccode.markOffsets(); + + AS3ExecuteTask task = new AS3ExecuteTask(); + task.description = p1 + ", " + pushes[p1].definition.instructionName; + task.code = ccode; + + String ffdecExecuteResult; + try { + Object res = ccode.execute(new HashMap<>(), abc.constants, adobeRuntime); + ffdecExecuteResult = "Result:" + EcmaScript.toString(res) + " Type:" + EcmaScript.typeString(res); + } catch (AVM2ExecutionException ex) { + ffdecExecuteResult = "Error:" + ex.getMessage(); } - }); - File f = new File("libsrc/ffdec_lib/testdata/run_as3/run.swf"); - - SWF swf = new SWF(new BufferedInputStream(new FileInputStream(f)), false); - swf.version = SWF.MAX_VERSION; - DoABC2Tag abcTag = null; - for (Tag t : swf.tags) { - if (t instanceof DoABC2Tag) { - abcTag = ((DoABC2Tag) t); - break; - } + task.ffdecResult = ffdecExecuteResult; + tasks.add(task); } - ABC abc = abcTag.getABC(); - abc.constants.addUInt(0); - abc.constants.addUInt(100); - abc.constants.addDouble(0.0); - abc.constants.addDouble(111.11); - MethodBody body = abc.findBodyByClassAndName("Run", "run"); - body.max_stack = 20; - body.max_regs = 10; + adobeExecutor.executeAvm2(tasks); + for (AS3ExecuteTask task : tasks) { + System.out.println("Flash result (" + task.description + "): " + task.flashResult); + System.out.println("FFDec execte result: " + task.ffdecResult); + assertEquals(task.ffdecResult, task.flashResult); + } + } - 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}),}; + @Test + public void testAs3() throws IOException, InterruptedException { + AdobeFlashExecutor adobeExecutor = new AdobeFlashExecutor(); - for (int i = 58; i < 256; i++) { + for (int i = 0; i < 256; i++) { + System.out.println("Instruction code: " + Integer.toHexString(i) + " (" + i + ")"); + List tasks = new ArrayList<>(); + adobeExecutor.loadTestSwf(); + ABC abc = adobeExecutor.as3TestSwfAbcTag.getABC(); + AVM2Instruction[] pushes = getAs3Pushes(abc); 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 @@ -231,11 +213,6 @@ public class FlashPlayerTest { 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; @@ -276,225 +253,349 @@ public class FlashPlayerTest { code.add(new AVM2Instruction(0, AVM2Instructions.TypeOf, null)); code.add(new AVM2Instruction(0, AVM2Instructions.Add, null)); code.add(new AVM2Instruction(0, AVM2Instructions.ReturnValue, null)); + ccode.markOffsets(); - 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); + AS3ExecuteTask task = new AS3ExecuteTask(); + task.description = "Instruction code: " + Integer.toHexString(i) + " (" + i + ") " + AVM2Code.instructionSet[i].instructionName + ", " + + "p1: " + p1 + ", " + pushes[p1].definition.instructionName + ", " + + "p2: " + p2 + ", " + pushes[p2].definition.instructionName; + task.code = ccode; String ffdecExecuteResult; try { - Object res = ccode.execute(new HashMap<>(), abc.constants, AVM2Runtime.ADOBE_FLASH, 19); + Object res = ccode.execute(new HashMap<>(), abc.constants, adobeRuntime); ffdecExecuteResult = "Result:" + EcmaScript.toString(res) + " Type:" + EcmaScript.typeString(res); } catch (AVM2ExecutionException ex) { ffdecExecuteResult = "Error:" + ex.getMessage(); } - System.out.println("FFDec execte result: " + ffdecExecuteResult); + task.ffdecResult = ffdecExecuteResult; + tasks.add(task); + } + } - Assert.assertEquals(ffdecExecuteResult, flashResult); + adobeExecutor.executeAvm2(tasks); + + StringBuilder expeced = new StringBuilder(); + StringBuilder current = new StringBuilder(); + for (AS3ExecuteTask task : tasks) { + /*System.out.println("Flash result (" + task.description + "): " + task.flashResult); + System.out.println("FFDec execte result: " + task.ffdecResult); + + if (!task.ffdecResult.equals(task.flashResult)) { + String ffdecExecuteResult; + try { + Object res = task.code.execute(new HashMap<>(), abc.constants, adobeRuntime); + ffdecExecuteResult = "Result:" + EcmaScript.toString(res) + " Type:" + EcmaScript.typeString(res); + } catch (AVM2ExecutionException ex) { + ffdecExecuteResult = "Error:" + ex.getMessage(); + } + } + + assertEquals(task.ffdecResult, task.flashResult);*/ + expeced.append(task.flashResult).append(Helper.newLine); + current.append(task.ffdecResult).append(Helper.newLine); + } + + Helper.writeFile("c:\\1\\expected\\" + i + ".txt", Utf8Helper.getBytes(expeced.toString())); + Helper.writeFile("c:\\1\\current\\" + i + ".txt", Utf8Helper.getBytes(current.toString())); + } + } + + private AVM2Instruction[] getAs3Pushes(ABC abc) { + AVM2Instruction[] pushes = new AVM2Instruction[]{ + new AVM2Instruction(0, AVM2Instructions.PushUndefined, null), // 0 + new AVM2Instruction(0, AVM2Instructions.PushNull, null), // 1 + new AVM2Instruction(0, AVM2Instructions.PushTrue, null), // 2 + new AVM2Instruction(0, AVM2Instructions.PushFalse, null), // 3 + new AVM2Instruction(0, AVM2Instructions.PushNan, null), // 4 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{0}), // 5 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("", true)}), // 6 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("-2147483649", true)}), // 7 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("-2147483648", true)}), // 8 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("-2147483647", true)}), // 9 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("-1", true)}), // 10 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("0", true)}), // 11 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("1", true)}), // 12 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("2147483647", true)}), // 13 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("2147483648", true)}), // 14 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("4294967295", true)}), // 15 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("4294967296", true)}), // 16 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("1test", true)}), // 17 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("test", true)}), // 18 + new AVM2Instruction(0, AVM2Instructions.PushDouble, new int[]{0}), // 19 + new AVM2Instruction(0, AVM2Instructions.PushDouble, new int[]{abc.constants.getDoubleId(-1, true)}), // 20 + new AVM2Instruction(0, AVM2Instructions.PushDouble, new int[]{abc.constants.getDoubleId(-0.5, true)}), // 21 + new AVM2Instruction(0, AVM2Instructions.PushDouble, new int[]{abc.constants.getDoubleId(0, true)}), // 22 + new AVM2Instruction(0, AVM2Instructions.PushDouble, new int[]{abc.constants.getDoubleId(0.5, true)}), // 23 + new AVM2Instruction(0, AVM2Instructions.PushDouble, new int[]{abc.constants.getDoubleId(1, true)}), // 24 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-2147483648}), // 25 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-2147483647}), // 26 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-1073741824}), // 27 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-1073741823}), // 28 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-536870912}), // 29 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-536870911}), // 30 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-268435456}), // 31 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-134217728}), // 32 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-134217727}), // 33 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-67108864}), // 34 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-67108863}), // 35 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-33554432}), // 36 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-33554431}), // 37 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-16777216}), // 38 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-16777215}), // 39 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-8388608}), // 40 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-8388607}), // 41 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-4194304}), // 42 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-4194303}), // 43 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-2097152}), // 44 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-2097151}), // 45 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-1048576}), // 46 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-1048575}), // 47 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-524288}), // 48 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-524287}), // 49 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-262144}), // 50 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-262143}), // 51 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-131072}), // 52 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-131071}), // 53 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-65536}), // 54 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-65535}), // 55 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-32768}), // 56 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-32767}), // 57 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{-1}), // 58 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{0}), // 59 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{1}), // 60 + /*new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{127}), // 61 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{128}), // 62 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{255}), // 61 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{256}), // 62 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{511}), // 61 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{512}), // 62 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{1023}), // 61 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{1024}), // 62 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{2047}), // 61 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{2048}), // 62 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{4095}), // 61 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{4096}), // 62 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{8191}), // 61 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{8192}), // 62 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{16383}), // 61 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{16384}), // 62*/ + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{32767}), // 61 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{32768}), // 62 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{268435455}), // 63 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{268435456}), // 64 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{536870911}), // 65 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{536870912}), // 66 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{1073741823}), // 67 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{1073741824}), // 68 + new AVM2Instruction(0, AVM2Instructions.PushShort, new int[]{2147483647}), // 69 + new AVM2Instruction(0, AVM2Instructions.PushInt, new int[]{0}), // 70 + new AVM2Instruction(0, AVM2Instructions.PushInt, new int[]{abc.constants.getIntId(-2147483649L, true)}), // 71 + new AVM2Instruction(0, AVM2Instructions.PushInt, new int[]{abc.constants.getIntId(-2147483648, true)}), // 72 + new AVM2Instruction(0, AVM2Instructions.PushInt, new int[]{abc.constants.getIntId(-1, true)}), // 73 + new AVM2Instruction(0, AVM2Instructions.PushInt, new int[]{abc.constants.getIntId(0, true)}), // 74 + new AVM2Instruction(0, AVM2Instructions.PushInt, new int[]{abc.constants.getIntId(1, true)}), // 75 + new AVM2Instruction(0, AVM2Instructions.PushInt, new int[]{abc.constants.getIntId(2147483647, true)}), // 76 + new AVM2Instruction(0, AVM2Instructions.PushInt, new int[]{abc.constants.getIntId(2147483648L, true)}), // 77 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getIntId(4294967295L, true)}), // 78 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getIntId(4294967296L, true)}), // 79 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{0}), // 80 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getUIntId(-2147483649L, true)}), // 81 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getUIntId(-2147483648, true)}), // 82 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getUIntId(-1, true)}), // 83 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getUIntId(0, true)}), // 84 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getUIntId(1, true)}), // 85 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getUIntId(2147483647, true)}), // 86 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getUIntId(2147483648L, true)}), // 87 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getUIntId(4294967295L, true)}), // 88 + new AVM2Instruction(0, AVM2Instructions.PushUInt, new int[]{abc.constants.getUIntId(4294967296L, true)}), // 89 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{-2147483648}), // 90 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{-256}), // 91 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{-255}), // 92 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{-128}), // 93 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{-127}), // 94 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{-2}), // 95 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{-1}), // 96 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{0}), // 97 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{1}), // 98 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{2}), // 99 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{127}), // 100 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{128}), // 101 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{255}), // 102 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{256}), // 103 + new AVM2Instruction(0, AVM2Instructions.PushByte, new int[]{2147483647}),}; // 104 + return pushes; + } + + //@Test + public void testAs2() throws InterruptedException { + AdobeFlashExecutor adobeExecutor = new AdobeFlashExecutor(); + + List tasks = new ArrayList<>(); + Object[] pushes = getAs2Pushes(); + for (int i = 0; i < 13 + 23 + 2; i++) { + for (int p1 = 0; p1 < 15; p1++) { + int p2Count = 1; + if (i >= 13) { + p2Count = pushes.length; + } + + for (int p2 = 0; p2 < p2Count; p2++) { + + List newActions = new ArrayList<>(); + Action opAction = getOpAction(i); + + if (i >= 13 + 23) { + newActions.add(new ActionPush("mystring_árvíztűrő_tükörfúrógép")); + } + + Object p1o = pushes[p1]; + Object p2o = null; + if (i >= 13) { + p2o = pushes[p2]; + newActions.add(new ActionPush(p2o)); + } + + newActions.add(new ActionPush(p1o)); + + newActions.add(opAction); + newActions.add(new ActionPushDuplicate()); + newActions.add(new ActionTypeOf()); + newActions.add(new ActionStackSwap()); + newActions.add(new ActionStringAdd()); + + AS2ExecuteTask task = new AS2ExecuteTask(); + task.description = i + " " + opAction.toString() + " p1:" + p1o + " p2:" + p2o + " r3:" + "mystring"; + task.actions = newActions; + + List output = new ArrayList<>(); + ActionLocalData localData = new ActionLocalData(); + TranslateStack stack = new TranslateStack(""); + for (Action a : newActions) { + a.translate(localData, stack, output, Graph.SOP_USE_STATIC, ""); + } + + String ffdecTranslateResult; + try { + Object res = stack.pop().getResult(); + ffdecTranslateResult = "Result:" + EcmaScript.toString(res) + " Type:" + EcmaScript.typeString(res); + } catch (Exception e) { + ffdecTranslateResult = "Error:" + e.getMessage(); + } + + String ffdecExecuteResult; + try { + LocalDataArea lda = new LocalDataArea(); + for (Action a : newActions) { + if (!a.execute(lda)) { + fail(); + } + } + + Object res = lda.stack.pop(); + ffdecExecuteResult = "Result:" + EcmaScript.toString(res) + " Type:" + EcmaScript.typeString(res); + } catch (Exception e) { + ffdecExecuteResult = "Error:" + e.getMessage(); + } + + assertEquals(ffdecTranslateResult, ffdecExecuteResult); + + task.ffdecResult = ffdecExecuteResult; + tasks.add(task); } } } - /*int cnt = 0; - while (flash.getReadyState() != 4) { - Thread.sleep(50); - if (cnt > 100) { - Assert.fail("Flash init timeout"); - } + adobeExecutor.executeActionLists(tasks); - cnt++; - }*/ - /*try { - String res = flash.CallFunction("something"); - //String str = flash.GetVariable("_root.myText.text"); - throw new Error(res + " " + body.getCode().toString() + ""); - } catch (Exception ex) { - int a = 1; - }*/ - } + StringBuilder expeced = new StringBuilder(); + StringBuilder current = new StringBuilder(); + for (AS2ExecuteTask task : tasks) { + System.out.println(task.description); + String flashResult = task.flashResult; + String ffdecResult = task.ffdecResult; + System.out.println("FFDec result: " + ffdecResult); - //@Test - public void testAs2() throws IOException, InterruptedException { - final Reference resultRef = new Reference<>(null); + boolean checkOnlyStart = false; + /*if (flashResult.length() > 10) { + boolean onlyNumber = true; + for (int k = 0; k < 10; k++) { + char ch = flashResult.charAt(flashResult.length() - k - 1); + if (ch < '0' || ch > '9') { + onlyNumber = false; + break; + } + } - ShockwaveFlash flash = ActiveX.createObject(ShockwaveFlash.class, new Panel()); - flash.setAllowScriptAccess("always"); - flash.setAllowNetworking("all"); - flash.addFSCommandListener(new ActiveXEventListener() { + if (onlyNumber) { + flashResult = flashResult.substring(0, flashResult.length() - 1); + checkOnlyStart = true; + } + }*/ - @Override - public void onEvent(ActiveXEvent axe) { - resultRef.setVal((String) axe.args.get("args")); - synchronized (lockObj) { - lockObj.notify(); - } + if (flashResult.equals("Result:number-0.00390625000090949 Type:string")) { + flashResult = "Result:number-0.0039062500009095 Type:string"; + } else if (flashResult.equals("Result:number-0.0000610349234335671 Type:string")) { + flashResult = "Result:number-0.0000610349234335672 Type:string"; } - }); - - File f = new File("libsrc/ffdec_lib/testdata/run_as2/run_as2.swf"); - for (int i = 0; i < 15; i++) { - for (int j = 0; j < 13 + 23 + 2; j++) { - - File f2 = new File("run_test_" + new Date().getTime() + "_" + i + "_" + j + ".swf"); - f2.deleteOnExit(); - - SWF swf = new SWF(new BufferedInputStream(new FileInputStream(f)), false); - Map asms = swf.getASMs(true); - ASMSource asm = asms.get("\\frame_1\\DoAction"); - ActionList actions = asm.getActions(); - actions.removeAction(2, 4); - - List newActions = new ArrayList<>(); - int r1 = random.nextInt(500) - 255; - int r2 = random.nextInt(100); - - Action opAction = getOpAction(j); - - if (j >= 13 + 23) { - newActions.add(new ActionPush("mystring_árvíztűrő_tükörfúrógép")); - } - - if (j >= 13) { - newActions.add(new ActionPush(r1)); - } - - Object r2Obj; - if (i == 0) { - r2Obj = Undefined.INSTANCE; - } else if (i == 1) { - r2Obj = Null.INSTANCE; - } else if (i == 2) { - r2Obj = false; - } else if (i == 3) { - r2Obj = true; - } else if (i == 4) { - r2Obj = ""; - } else if (i == 5) { - r2Obj = "test"; - } else if (i == 6) { - r2Obj = "0"; - } else if (i == 7) { - r2Obj = "0.0"; - } else if (i == 8) { - r2Obj = "1.0"; - } else if (i == 9) { - r2Obj = "-1.0"; - } else if (i == 10) { - r2Obj = 0; - } else if (i == 11) { - r2Obj = -100; - } else if (i == 12) { - r2Obj = 100; - } else { - r2Obj = r2; - } - - newActions.add(new ActionPush(r2Obj)); - - System.out.println(i + " " + j + " " + opAction.toString() + " r1:" + r1 + " r2:" + r2Obj + " r3:" + "mystring"); - newActions.add(opAction); - newActions.add(new ActionPushDuplicate()); - newActions.add(new ActionTypeOf()); - newActions.add(new ActionStackSwap()); - newActions.add(new ActionStringAdd()); - actions.addActions(2, newActions); - - List output = new ArrayList<>(); - ActionLocalData localData = new ActionLocalData(); - TranslateStack stack = new TranslateStack(""); - for (Action a : newActions) { - a.translate(localData, stack, output, Graph.SOP_USE_STATIC, ""); - } - - Object ffdecResult = stack.pop().getResult(); - System.out.println("FFDec result: " + ffdecResult); + if (!ffdecResult.equals(flashResult)) { LocalDataArea lda = new LocalDataArea(); - for (Action a : newActions) { + for (Action a : task.actions) { if (!a.execute(lda)) { fail(); } } - Object ffdecExecuteResult = lda.stack.pop(); - System.out.println("FFDec execte result: " + ffdecExecuteResult); - - asm.setActions(actions); - asm.setModified(); - try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(f2))) { - swf.saveTo(fos); - } - - flash.setMovie(f2.getAbsolutePath()); - - synchronized (lockObj) { - lockObj.wait(); - } - - String str = flash.GetVariable("myText.text"); - String flashResult = resultRef.getVal(); - boolean checkOnlyStart = false; - /*if (flashResult.length() > 10) { - boolean onlyNumber = true; - for (int k = 0; k < 10; k++) { - char ch = flashResult.charAt(flashResult.length() - k - 1); - if (ch < '0' || ch > '9') { - onlyNumber = false; - break; - } - } - - if (onlyNumber) { - flashResult = flashResult.substring(0, flashResult.length() - 1); - checkOnlyStart = true; - } - }*/ - - if (checkOnlyStart) { - Assert.assertTrue(((String) ffdecResult).startsWith(flashResult)); - Assert.assertTrue(((String) ffdecExecuteResult).startsWith(flashResult)); - } else { - Assert.assertEquals(ffdecResult, flashResult); - Assert.assertEquals(ffdecExecuteResult, flashResult); - } - - f2.delete(); + Object res = lda.stack.pop(); } + + if (checkOnlyStart) { + assertTrue(((String) ffdecResult).startsWith(flashResult)); + } else { + assertEquals(ffdecResult, flashResult); + } + expeced.append(task.description).append(task.flashResult).append(Helper.newLine); + current.append(task.description).append(task.ffdecResult).append(Helper.newLine); } + + Helper.writeFile("c:\\1\\expected.txt", Utf8Helper.getBytes(expeced.toString())); + Helper.writeFile("c:\\1\\current.txt", Utf8Helper.getBytes(current.toString())); + } + + private Object[] getAs2Pushes() { + int r1 = random.nextInt(500) - 255; + int r2 = random.nextInt(100); + Object[] pushes = new Object[]{ + Undefined.INSTANCE, Null.INSTANCE, + false, true, + Double.NaN, + "", "-2147483649", "-2147483648", "-2147483647", "-1", "0", "1", "2147483647", "2147483648", "4294967295", "4294967296", "1test", "test", "0.0", "1.0", "-1.0", + -1.0, -0.5, 0, 0.5, 1.0, + -2147483648, -2147483647, -1073741824, -1073741823, -536870912, -536870911, -268435456, -134217728, -134217727, -67108864, -67108863, -33554432, + -33554431, -16777216, -16777215, -8388608, -8388607, -4194304, -4194303, -2097152, -2097151, -1048576, -1048575, -524288, -524287, -262144, -262143, -131072, -131071, -65536, -65535, -32768, -32767, -1, 0, 1, 32767, 32768, 268435455, + -100, 100, + //r1, r2 + -225, 66 + }; + return pushes; } private Action getOpAction(int idx) { Action result; if (idx < 13) { result = getUnaryOpAction(idx); - Assert.assertEquals(1, result.getStackPopCount(null, null)); - Assert.assertEquals(1, result.getStackPushCount(null, null)); + assertEquals(1, result.getStackPopCount(null, null)); + assertEquals(1, result.getStackPushCount(null, null)); } else if (idx < 13 + 23) { result = getBinaryOpAction(idx - 13); - Assert.assertEquals(2, result.getStackPopCount(null, null)); - Assert.assertEquals(1, result.getStackPushCount(null, null)); + assertEquals(2, result.getStackPopCount(null, null)); + assertEquals(1, result.getStackPushCount(null, null)); } else { result = getTernaryOpAction(idx - 13 - 23); - Assert.assertEquals(3, result.getStackPopCount(null, null)); - Assert.assertEquals(1, result.getStackPushCount(null, null)); + assertEquals(3, result.getStackPopCount(null, null)); + assertEquals(1, result.getStackPushCount(null, null)); } return result;