diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java index 9d8b74c0e..79ca4d1dc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java @@ -122,6 +122,7 @@ public class AVM2ConstantPool implements Cloneable { public synchronized int addInt(long value) { ensureDefault(constant_int); + value = (int) value; constant_int.add(value); return constant_int.size() - 1; } @@ -150,6 +151,7 @@ public class AVM2ConstantPool implements Cloneable { public synchronized int addUInt(long value) { ensureDefault(constant_uint); + value &= 0xffffffffl; constant_uint.add(value); return constant_uint.size() - 1; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java index 36e1dd9ba..37d4be16f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java @@ -36,13 +36,13 @@ public class PushByteIns extends InstructionDefinition implements PushIntegerTyp @Override public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) { - lda.operandStack.push(ins.getParam(constants, 0)); + lda.operandStack.push((long) (byte) ins.operands[0]); return true; } @Override public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) { - stack.push(new IntegerValueAVM2Item(ins, (long) ins.operands[0])); + stack.push(new IntegerValueAVM2Item(ins, (long) (byte) ins.operands[0])); } @Override 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 8482ecb5a..d8c8b48af 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 @@ -48,8 +48,13 @@ public class EcmaScript { return (double) (int) (Integer) o; } if (o instanceof String) { + String str = (String) o; + if (str.isEmpty()) { + return 0.0; + } + try { - return Double.parseDouble((String) o); + return Double.parseDouble(str); } catch (NumberFormatException nfe) { return Double.NaN; } diff --git a/test/com/jpexs/decompiler/flash/gui/AS2ExecuteTask.java b/test/com/jpexs/decompiler/flash/gui/AS2ExecuteTask.java new file mode 100644 index 000000000..c0cff956d --- /dev/null +++ b/test/com/jpexs/decompiler/flash/gui/AS2ExecuteTask.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010-2015 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui; + +import com.jpexs.decompiler.flash.action.Action; +import java.util.List; + +/** + * + * @author JPEXS + */ +public class AS2ExecuteTask { + + public String description; + + public List actions; + + public String flashResult; + + public String ffdecTranslateResult; + + public String ffdecResult; +}