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/CoerceSIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java index a16f49eb7..4b239da1d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.CoerceAVM2Item; +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.graph.DottedChain; @@ -47,7 +48,7 @@ public class CoerceSIns extends InstructionDefinition implements CoerceOrConvert if (value == Null.INSTANCE) { lda.operandStack.push(value); } else { - lda.operandStack.push(value.toString()); + lda.operandStack.push(EcmaScript.toString(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/abc/avm2/instructions/types/ConvertSIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java index c5bfdecc4..7e7980946 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.ConvertAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; @@ -38,7 +39,7 @@ public class ConvertSIns extends InstructionDefinition implements CoerceOrConver @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { Object obj = lda.operandStack.pop(); - lda.operandStack.push(obj.toString()); + lda.operandStack.push(EcmaScript.toString(obj)); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java index aa84db229..2adfd9433 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.EscapeXAttrAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -35,8 +36,8 @@ public class EscXAttrIns extends InstructionDefinition { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - String s = lda.operandStack.pop().toString(); - //escape + String s = EcmaScript.toString(lda.operandStack.pop()); + // todo: escape lda.operandStack.push(s); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java index 626dc4d91..e8b4e0120 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.model.EscapeXElemAVM2Item; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import java.util.List; @@ -35,8 +36,8 @@ public class EscXElemIns extends InstructionDefinition { @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - String s = lda.operandStack.pop().toString(); - //escape + String s = EcmaScript.toString(lda.operandStack.pop()); + // todo: escape lda.operandStack.push(s); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index a3e2b4b27..522d91cfa 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -163,12 +163,7 @@ public final class MethodBody implements Cloneable { } public void markOffsets() { - long offset = 0; - AVM2Code code = getCode(); - for (int i = 0; i < code.code.size(); i++) { - code.code.get(i).offset = offset; - offset += code.code.get(i).getBytesLength(); - } + getCode().markOffsets(); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java index a41df4917..12de23eb8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionAsciiToChar; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -51,11 +52,11 @@ public class AsciiToCharActionItem extends ActionItem { @Override public Object getResult() { - return getResult(value.getResultAsNumber()); + return getResult(value.getResult()); } - public static String getResult(Double ascii) { - int res = (int) (double) ascii; + public static String getResult(Object ascii) { + int res = (char) EcmaScript.toInt32(ascii); if (res == 0) { return ""; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java index cb14919bd..a002422bf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionMBAsciiToChar; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -51,11 +52,11 @@ public class MBAsciiToCharActionItem extends ActionItem { @Override public Object getResult() { - return getResult(value.getResultAsNumber()); + return getResult(value.getResult()); } - public static String getResult(Double ascii) { - int res = (int) (double) ascii; + public static String getResult(Object ascii) { + int res = (char) EcmaScript.toInt32(ascii); if (res == 0) { return ""; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java index cbe0f1705..22616b035 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java @@ -46,7 +46,7 @@ public class MBStringExtractActionItem extends ActionItem { } public MBStringExtractActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value, GraphTargetItem index, GraphTargetItem count) { - super(instruction, lineStartIns, PRECEDENCE_PRIMARY, value); + super(instruction, lineStartIns, PRECEDENCE_PRIMARY, value); this.index = index; this.count = count; } @@ -80,10 +80,10 @@ public class MBStringExtractActionItem extends ActionItem { public static String getResult(Object count, Object index, Object value) { String str = EcmaScript.toString(value); - int idx = (int) (double) EcmaScript.toNumberAs2(index); + int idx = EcmaScript.toInt32(index); idx--; // index seems to be 1 based - int cnt = (int) (double) EcmaScript.toNumberAs2(count); + int cnt = EcmaScript.toInt32(count); /*if (idx < 0) { idx = str.length() + idx; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java index 5669b31b1..675d1ab96 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java @@ -36,7 +36,7 @@ public class StringExtractActionItem extends ActionItem { public GraphTargetItem count; public StringExtractActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value, GraphTargetItem index, GraphTargetItem count) { - super(instruction, lineStartIns, PRECEDENCE_PRIMARY, value); + super(instruction, lineStartIns, PRECEDENCE_PRIMARY, value); this.index = index; this.count = count; } @@ -69,10 +69,10 @@ public class StringExtractActionItem extends ActionItem { public static String getResult(Object count, Object index, Object value) { String str = EcmaScript.toString(value); - int idx = (int) (double) EcmaScript.toNumberAs2(index); + int idx = EcmaScript.toInt32(index); idx--; // index seems to be 1 based - int cnt = (int) (double) EcmaScript.toNumberAs2(count); + int cnt = EcmaScript.toInt32(count); /*if (idx < 0) { idx = str.length() + idx; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java index 6ccac07ff..722942ed3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionToInteger; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -51,11 +52,11 @@ public class ToIntegerActionItem extends ActionItem { @Override public Object getResult() { - return getResult(value.getResultAsNumber()); + return getResult(value.getResult()); } - public static long getResult(Double num) { - return Math.round(num); + public static long getResult(Object num) { + return EcmaScript.toInt32(num); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java index 33af0fbaf..6e95586cb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitAnd; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -34,11 +35,11 @@ public class BitAndActionItem extends BinaryOpItem { @Override public Object getResult() { - return getResult(rightSide.getResultAsNumber(), leftSide.getResultAsNumber()); + return getResult(rightSide.getResult(), leftSide.getResult()); } - public static long getResult(Double rightResult, Double leftResult) { - return ((long) (double) leftResult) & ((long) (double) rightResult); + public static long getResult(Object rightResult, Object leftResult) { + return EcmaScript.toInt32(leftResult) & EcmaScript.toInt32(rightResult); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java index 9f93388e0..b9a70584b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitOr; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -34,11 +35,11 @@ public class BitOrActionItem extends BinaryOpItem { @Override public Object getResult() { - return getResult(rightSide.getResultAsNumber(), leftSide.getResultAsNumber()); + return getResult(rightSide.getResult(), leftSide.getResult()); } - public static long getResult(Double rightResult, Double leftResult) { - return ((long) (double) leftResult) | ((long) (double) rightResult); + public static long getResult(Object rightResult, Object leftResult) { + return EcmaScript.toInt32(leftResult) | EcmaScript.toInt32(rightResult); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java index 274dd1e5c..798377e9f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.action.swf5.ActionBitXor; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -37,11 +38,11 @@ public class BitXorActionItem extends BinaryOpItem { @Override public Object getResult() { - return getResult(rightSide.getResultAsNumber(), leftSide.getResultAsNumber()); + return getResult(rightSide.getResult(), leftSide.getResult()); } - public static long getResult(Double rightResult, Double leftResult) { - return ((long) (double) leftResult) ^ ((long) (double) rightResult); + public static long getResult(Object rightResult, Object leftResult) { + return EcmaScript.toInt32(leftResult) ^ EcmaScript.toInt32(rightResult); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java index e51f4be62..29b6ff898 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java @@ -46,7 +46,7 @@ public class EqActionItem extends BinaryOpItem implements LogicalOpItem, EqualsT public static Boolean getResult(Object rightResult, Object leftResult, boolean version2) { if (version2) { - return EcmaScript.equals(leftResult, rightResult); + return EcmaScript.equals(true, leftResult, rightResult); } else { //For SWF 4 and older, it should return 1 or 0 return (Action.toFloatPoint(leftResult) == Action.toFloatPoint(rightResult)); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java index dad04f9db..f67c82e2a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java @@ -44,13 +44,13 @@ public class GtActionItem extends BinaryOpItem implements LogicalOpItem { } public static Object getResult(Object rightResult, Object leftResult) { - Object ret = EcmaScript.compare(rightResult, leftResult, true); + Object ret = EcmaScript.compare(leftResult, rightResult, true); if (ret == Undefined.INSTANCE) { return ret; } int reti = (int) ret; - return reti == -1; + return reti == 1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java index 902e90a3d..c938b861e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitLShift; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -34,11 +35,11 @@ public class LShiftActionItem extends BinaryOpItem { @Override public Object getResult() { - return getResult(rightSide.getResultAsNumber(), leftSide.getResultAsNumber()); + return getResult(rightSide.getResult(), leftSide.getResult()); } - public static int getResult(Double rightResult, Double leftResult) { - return ((int) (double) leftResult) << ((int) (double) rightResult); + public static int getResult(Object rightResult, Object leftResult) { + return EcmaScript.toInt32(leftResult) << EcmaScript.toInt32(rightResult); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java index b7cd57e95..cb420be83 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java @@ -41,13 +41,13 @@ public class LeActionItem extends BinaryOpItem implements LogicalOpItem, Inverte @Override public Object getResult() { - Object ret = EcmaScript.compare(rightSide.getResult(), leftSide.getResult(), true); + Object ret = EcmaScript.compare(leftSide.getResult(), rightSide.getResult(), true); if (ret == Undefined.INSTANCE) { return ret; } int reti = (int) ret; - return reti != -1; + return reti != 1; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java index ac746bcc8..55e418ee6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java @@ -38,10 +38,10 @@ public class ModuloActionItem extends BinaryOpItem { } public static Number getResult(Double rightResult, Double leftResult) { - if (Double.isNaN(rightResult) || Double.compare(rightResult, 0) == 0) { + if (Double.isNaN(leftResult) || Double.isNaN(rightResult) || Double.compare(rightResult, 0) == 0) { return Double.NaN; } - return ((long) (double) leftResult) % ((long) (double) rightResult); + return ((double) leftResult) % ((double) rightResult); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java index 15f7b0be1..d712f32b3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java @@ -42,7 +42,7 @@ public class NeqActionItem extends BinaryOpItem implements LogicalOpItem, Invert @Override public Object getResult() { if (version2) { - return !EcmaScript.equals(leftSide.getResult(), rightSide.getResult()); + return !EcmaScript.equals(true, leftSide.getResult(), rightSide.getResult()); } else { //For SWF 4 and older, it should return 1 or 0 return (Action.toFloatPoint(leftSide.getResult()) != Action.toFloatPoint(rightSide.getResult())); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java index 74f233633..57abf6491 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitRShift; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -34,12 +35,12 @@ public class RShiftActionItem extends BinaryOpItem { @Override public Object getResult() { - return getResult(rightSide.getResultAsNumber(), leftSide.getResultAsNumber()); + return getResult(rightSide.getResult(), leftSide.getResult()); } - public static long getResult(Double rightResult, Double leftResult) { - long rightResult2 = ((long) (double) rightResult) & 0x1f; - return ((long) (double) leftResult) >> rightResult2; + public static long getResult(Object rightResult, Object leftResult) { + long rightResult2 = EcmaScript.toInt32(rightResult) & 0x1f; + return EcmaScript.toInt32(leftResult) >> rightResult2; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java index 6bf67ae99..6ce55e972 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java @@ -43,8 +43,7 @@ public class StrictEqActionItem extends BinaryOpItem implements LogicalOpItem, I public static boolean getResult(Object rightResult, Object leftResult) { Object x = leftResult; Object y = rightResult; - return EcmaScript.type(x) == EcmaScript.type(y) - && EcmaScript.equals(x, y); + return EcmaScript.strictEquals(true, x, y); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java index 817c6a4b3..c795148cb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java @@ -39,8 +39,7 @@ public class StrictNeqActionItem extends BinaryOpItem implements LogicalOpItem, public Object getResult() { Object x = leftSide.getResult(); Object y = rightSide.getResult(); - return EcmaScript.type(x) != EcmaScript.type(y) - || (!EcmaScript.equals(x, y)); + return !EcmaScript.strictEquals(true, x, y); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionAsciiToChar.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionAsciiToChar.java index 2f7e8ce38..6ad6a64b8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionAsciiToChar.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionAsciiToChar.java @@ -45,7 +45,7 @@ public class ActionAsciiToChar extends Action { return false; } - lda.stack.push(AsciiToCharActionItem.getResult(lda.popAsNumber())); + lda.stack.push(AsciiToCharActionItem.getResult(lda.pop())); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionMBAsciiToChar.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionMBAsciiToChar.java index 3d0213865..fa0829056 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionMBAsciiToChar.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionMBAsciiToChar.java @@ -44,7 +44,7 @@ public class ActionMBAsciiToChar extends Action { return false; } - lda.stack.push(MBAsciiToCharActionItem.getResult(lda.popAsNumber())); + lda.stack.push(MBAsciiToCharActionItem.getResult(lda.pop())); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index f256685b4..64fc253ff 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -46,6 +46,7 @@ import com.jpexs.helpers.Helper; import com.jpexs.helpers.utf8.Utf8Helper; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Set; @@ -254,6 +255,13 @@ public class ActionPush extends Action { updateLength(); } + public ActionPush(Object[] values) { + super(0x96, 0); + this.values = new ArrayList<>(); + this.values.addAll(Arrays.asList(values)); + updateLength(); + } + public ActionPush(FlasmLexer lexer, List constantPool) throws IOException, ActionParseException { super(0x96, 0); this.constantPool = constantPool; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionToInteger.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionToInteger.java index c3dcd8b0c..cdfce0a51 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionToInteger.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionToInteger.java @@ -44,7 +44,7 @@ public class ActionToInteger extends Action { return false; } - lda.stack.push(ToIntegerActionItem.getResult(lda.popAsNumber())); + lda.stack.push(ToIntegerActionItem.getResult(lda.pop())); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitAnd.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitAnd.java index 0a2505c44..0ba4451fc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitAnd.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitAnd.java @@ -44,7 +44,7 @@ public class ActionBitAnd extends Action { return false; } - lda.stack.push(BitAndActionItem.getResult(lda.popAsNumber(), lda.popAsNumber())); + lda.stack.push(BitAndActionItem.getResult(lda.pop(), lda.pop())); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitLShift.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitLShift.java index bc1a4649a..cbd0c2d96 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitLShift.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitLShift.java @@ -44,7 +44,7 @@ public class ActionBitLShift extends Action { return false; } - lda.stack.push(LShiftActionItem.getResult(lda.popAsNumber(), lda.popAsNumber())); + lda.stack.push(LShiftActionItem.getResult(lda.pop(), lda.pop())); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitOr.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitOr.java index aff79e988..a717ecc05 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitOr.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitOr.java @@ -44,7 +44,7 @@ public class ActionBitOr extends Action { return false; } - lda.stack.push(BitOrActionItem.getResult(lda.popAsNumber(), lda.popAsNumber())); + lda.stack.push(BitOrActionItem.getResult(lda.pop(), lda.pop())); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitRShift.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitRShift.java index 90fd8387c..663aca3e3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitRShift.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitRShift.java @@ -44,7 +44,7 @@ public class ActionBitRShift extends Action { return false; } - lda.stack.push(RShiftActionItem.getResult(lda.popAsNumber(), lda.popAsNumber())); + lda.stack.push(RShiftActionItem.getResult(lda.pop(), lda.pop())); return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitXor.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitXor.java index 8d31521fa..6f6c3093b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitXor.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitXor.java @@ -44,7 +44,7 @@ public class ActionBitXor extends Action { return false; } - lda.stack.push(BitXorActionItem.getResult(lda.popAsNumber(), lda.popAsNumber())); + lda.stack.push(BitXorActionItem.getResult(lda.pop(), lda.pop())); return true; } 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..47a8531f6 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); } @@ -184,6 +188,15 @@ public class EcmaScript { if (sx.equals(sy)) { return 0; } + if (as2) { + // in AS2 an empty string is greater than a non-empty string... + if (sx.isEmpty()) { + return 1; + } + if (sy.isEmpty()) { + return -1; + } + } if (sx.startsWith(sy)) { return 1; } @@ -213,14 +226,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 +300,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/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ExecuteTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ExecuteTest.java new file mode 100644 index 000000000..194b2317d --- /dev/null +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3ExecuteTest.java @@ -0,0 +1,141 @@ +/* + * 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; + +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.types.MethodBody; +import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter; +import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.tags.DoABC2Tag; +import com.jpexs.decompiler.flash.tags.Tag; +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.fail; +import org.testng.annotations.BeforeClass; + +/** + * + * @author JPEXS + */ +public class ActionScript3ExecuteTest { + + private SWF swf; + + private ABC abc; + + @BeforeClass + public void init() throws IOException, InterruptedException { + //Main.initLogging(false); + swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/run_as3/run.swf")), false); + /*try (InputStream is = new BufferedInputStream(new FileInputStream("testdata/run_as3/run.swf"))) { + swf = new SWF(is, false); + }*/ + DoABC2Tag tag = null; + for (Tag t : swf.tags) { + if (t instanceof DoABC2Tag) { + tag = (DoABC2Tag) t; + break; + } + } + assertNotNull(tag); + this.abc = tag.getABC(); + Configuration.autoDeobfuscate.set(false); + Configuration.decompile.set(true); + Configuration.registerNameFormat.set("_loc%d_"); + Configuration.showMethodBodyId.set(false); + } + + //@Test + public void testRun() throws IOException, InterruptedException { + MethodBody body = abc.findBodyByClassAndName("Run", "run"); + Object result; + try { + result = body.getCode().execute(new HashMap<>(), abc.constants, new AVM2RuntimeInfo(AVM2Runtime.ADOBE_FLASH, 19, true)); + assertEquals(result, "Test"); + } catch (AVM2ExecutionException ex) { + fail(); + } + } + + //@Test + public void testAddMethod() throws IOException, InterruptedException { + int classId = abc.findClassByName("Run"); + MethodBody runBody = abc.findBodyByClassAndName("Run", "runInstance"); + runBody.max_stack = 10; + + AVM2Code ccode = new AVM2Code(); + ccode.code = new ArrayList<>(); + List code = ccode.code; + code.add(new AVM2Instruction(0, AVM2Instructions.GetLocal0, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.PushScope, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("", true)})); + + for (int testMethodId = 1; testMethodId < 10; testMethodId++) { + AVM2Code ccode2 = new AVM2Code(); + ccode2.code = new ArrayList<>(); + List code2 = ccode2.code; + code2.add(new AVM2Instruction(0, AVM2Instructions.GetLocal0, null)); + code2.add(new AVM2Instruction(0, AVM2Instructions.PushScope, null)); + code2.add(new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId(testMethodId + ""/* + "\r\n"*/, true)})); + code2.add(new AVM2Instruction(0, AVM2Instructions.ReturnValue, null)); + + boolean isStatic = testMethodId % 2 == 0; + int multinameId = addMethod(classId, "test" + testMethodId, isStatic, ccode2); + if (isStatic) { + code.add(new AVM2Instruction(0, AVM2Instructions.FindPropertyStrict, new int[]{multinameId})); + } else { + code.add(new AVM2Instruction(0, AVM2Instructions.GetLocal0, null)); + } + + code.add(new AVM2Instruction(0, AVM2Instructions.CallProperty, new int[]{multinameId, 0})); + code.add(new AVM2Instruction(0, AVM2Instructions.Add, null)); + code.add(new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("\r\n", true)})); + code.add(new AVM2Instruction(0, AVM2Instructions.Add, null)); + } + + code.add(new AVM2Instruction(0, AVM2Instructions.ReturnValue, null)); + runBody.setCode(ccode); + runBody.markOffsets(); + } + + private int addMethod(int classId, String name, boolean isStatic, AVM2Code code) { + TraitMethodGetterSetter methodTrait = abc.addMethod(classId, name, isStatic); + MethodInfo methodInfo = abc.method_info.get(methodTrait.method_info); + MethodBody methodBody = methodInfo.getBody(); + methodBody.max_stack = 10; + methodBody.max_regs = 10; + methodBody.init_scope_depth = 3; + methodBody.max_scope_depth = 10; + + methodBody.setCode(code); + methodBody.markOffsets(); + + return methodTrait.name_index; + } +} diff --git a/libsrc/ffdec_lib/testdata/run_as2/run_as2.fla b/libsrc/ffdec_lib/testdata/run_as2/run_as2.fla new file mode 100644 index 000000000..610d7e796 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/run_as2/run_as2.fla differ diff --git a/libsrc/ffdec_lib/testdata/run_as2/run_as2.html b/libsrc/ffdec_lib/testdata/run_as2/run_as2.html new file mode 100644 index 000000000..6a7b1dcbe --- /dev/null +++ b/libsrc/ffdec_lib/testdata/run_as2/run_as2.html @@ -0,0 +1,49 @@ + + + + run_as2 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + Get Adobe Flash player + + + + + +
+ + diff --git a/libsrc/ffdec_lib/testdata/run_as3/RunMain.as b/libsrc/ffdec_lib/testdata/run_as3/RunMain.as index 39de9aae4..218074ace 100644 --- a/libsrc/ffdec_lib/testdata/run_as3/RunMain.as +++ b/libsrc/ffdec_lib/testdata/run_as3/RunMain.as @@ -1,21 +1,24 @@ -package { - +package +{ + import flash.display.*; import flash.text.TextField; import flash.events.MouseEvent; import flash.external.ExternalInterface; import flash.system.fscommand; - - public class RunMain extends MovieClip { - + + public class RunMain extends MovieClip + { + private var myTextBox:TextField; - - public function RunMain() { - myTextBox = new TextField(); + + public function RunMain() + { + myTextBox = new TextField(); myTextBox.text = ""; myTextBox.width = 400; myTextBox.multiline = true; - addChild(myTextBox); + addChild(myTextBox); var rectangleShape:Shape = new Shape(); rectangleShape.graphics.beginFill(0xFF0000); @@ -39,30 +42,36 @@ simpleButton.y = 100; simpleButton.addEventListener(MouseEvent.CLICK, this.clickListener); addChild(simpleButton); - - ExternalInterface.addCallback("testFunc", testFunction); - - var result; - try { - result = testFunction(); - } catch (e) { - result = e.toString(); + + if (ExternalInterface.available) + { + ExternalInterface.addCallback("testFunc", testFunction); } - + + var result = testFunction(); + myText.text = result; fscommand("run", result); } - - function testFunction() { - try { + + function testFunction() + { + try + { var result = Run.run(); return "Result:" + result + " Type:" + typeof(result); - } catch (ex) { + } + catch (ex) + { return "Error:" + ex; } } - function clickListener(e:MouseEvent) { - myTextBox.text = testFunction(); + function clickListener(e:MouseEvent) + { + var result = testFunction(); + myTextBox.text = result; + + fscommand("run", result); } } -} +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/run_as3/run.fla b/libsrc/ffdec_lib/testdata/run_as3/run.fla index 951c0323b..9a3405990 100644 Binary files a/libsrc/ffdec_lib/testdata/run_as3/run.fla and b/libsrc/ffdec_lib/testdata/run_as3/run.fla differ 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..ee1141ddf 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,32 +72,17 @@ 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 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; /** @@ -108,70 +91,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 +211,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 +251,348 @@ 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); - - Assert.assertEquals(ffdecExecuteResult, flashResult); + task.ffdecResult = ffdecExecuteResult; + tasks.add(task); } } + + adobeExecutor.executeAvm2(tasks); + + StringBuilder expeced = new StringBuilder(); + StringBuilder current = new StringBuilder(); + for (AS3ExecuteTask task : tasks) { + if (!task.flashResult.equals(task.ffdecResult)) { + System.out.println("Flash result (" + task.description + "): " + task.flashResult); + System.out.println("FFDec execte result: " + task.ffdecResult); + expeced.append(task.flashResult).append(Helper.newLine); + current.append(task.ffdecResult).append(Helper.newLine); + } + + /*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); + } + + //Helper.writeFile("expected\\" + i + ".txt", Utf8Helper.getBytes(expeced.toString())); + //Helper.writeFile("current\\" + i + ".txt", Utf8Helper.getBytes(current.toString())); } + } - /*int cnt = 0; - while (flash.getReadyState() != 4) { - Thread.sleep(50); - if (cnt > 100) { - Assert.fail("Flash init timeout"); - } - - 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; - }*/ + 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.PushString, new int[]{abc.constants.getStringId("test2", true)}), // 18 + new AVM2Instruction(0, AVM2Instructions.PushString, new int[]{abc.constants.getStringId("test3", 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 IOException, InterruptedException { - final Reference resultRef = new Reference<>(null); + public void testAs2() throws InterruptedException { + AdobeFlashExecutor adobeExecutor = new AdobeFlashExecutor(); - ShockwaveFlash flash = ActiveX.createObject(ShockwaveFlash.class, new Panel()); - flash.setAllowScriptAccess("always"); - flash.setAllowNetworking("all"); - flash.addFSCommandListener(new ActiveXEventListener() { - - @Override - public void onEvent(ActiveXEvent axe) { - resultRef.setVal((String) axe.args.get("args")); - synchronized (lockObj) { - lockObj.notify(); - } - } - }); - - 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")); + 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; } - if (j >= 13) { - newActions.add(new ActionPush(r1)); - } + for (int p2 = 0; p2 < p2Count; p2++) { - 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; - } + List newActions = new ArrayList<>(); + Action opAction = getOpAction(i); - 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); - - LocalDataArea lda = new LocalDataArea(); - for (Action a : newActions) { - if (!a.execute(lda)) { - fail(); + 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(); + String desc = i + " " + opAction.toString() + " p1:" + + (p1o instanceof String ? "'" + p1o + "'" : p1o) + " p2:" + + (p2o instanceof String ? "'" + p2o + "'" : p2o) + " r3:" + "mystring"; + task.description = desc; + 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); } - - 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(); } } + + adobeExecutor.executeActionLists(tasks); + + StringBuilder expeced = new StringBuilder(); + StringBuilder current = new StringBuilder(); + for (AS2ExecuteTask task : tasks) { + if (!task.flashResult.equals(task.ffdecResult)) { + System.out.println("Flash result (" + task.description + "): " + task.flashResult); + System.out.println("FFDec result: " + task.ffdecResult); + expeced.append(task.description).append(task.flashResult).append(Helper.newLine); + current.append(task.description).append(task.ffdecResult).append(Helper.newLine); + } + + 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 (!ffdecResult.equals(flashResult)) { + LocalDataArea lda = new LocalDataArea(); + for (Action a : task.actions) { + if (!a.execute(lda)) { + fail(); + } + } + + Object res = lda.stack.pop(); + }*/ + if (checkOnlyStart) { + assertTrue(((String) task.ffdecResult).startsWith(task.flashResult)); + } else { + assertEquals(task.ffdecResult, task.flashResult); + } + } + + //Helper.writeFile("expected.txt", Utf8Helper.getBytes(expeced.toString())); + //Helper.writeFile("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", "test2", "test3", "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;