diff --git a/CHANGELOG.md b/CHANGELOG.md index b6486caef..563399ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ All notable changes to this project will be documented in this file. - AS3 Metadata single value (null item key) - [#1981] AS3 star import collisions +### Changed +- AS1/2/3 P-code - format Number values with EcmaScript toString function + ## [18.3.6] - 2023-02-25 ### Fixed - [#1970] FLA export - do not strip empty frames at the end of timeline diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index 0c630ac25..5a70b3bd2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.abc.types.Float4; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphSource; @@ -327,7 +328,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { } else { s.append(" "); try { - s.append(constants.getDouble(operands[i])); + s.append(EcmaScript.toString(constants.getDouble(operands[i]))); } catch (IndexOutOfBoundsException iob) { s.append("Unknown(").append(operands[i]).append(")"); } @@ -339,7 +340,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { } else { s.append(" "); try { - s.append(constants.getFloat(operands[i])); + s.append(EcmaScript.toString(constants.getFloat(operands[i]))); } catch (IndexOutOfBoundsException iob) { s.append("Unknown(").append(operands[i]).append(")"); } @@ -351,10 +352,10 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { } else { try { Float4 f4 = constants.getFloat4(operands[i]); - s.append(" ").append(f4.values[0]); - s.append(" ").append(f4.values[1]); - s.append(" ").append(f4.values[2]); - s.append(" ").append(f4.values[3]); + s.append(" ").append(EcmaScript.toString(f4.values[0])); + s.append(" ").append(EcmaScript.toString(f4.values[1])); + s.append(" ").append(EcmaScript.toString(f4.values[2])); + s.append(" ").append(EcmaScript.toString(f4.values[3])); } catch (IndexOutOfBoundsException iob) { s.append(" Unknown(").append(operands[i]).append(")"); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ValueKind.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ValueKind.java index 62d13be93..e4a58d639 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ValueKind.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ValueKind.java @@ -180,7 +180,7 @@ public class ValueKind { ret = "UInteger(" + constants.getUInt(value_index) + ")"; break; case CONSTANT_Double: - ret = "Double(" + constants.getDouble(value_index) + ")"; + ret = "Double(" + EcmaScript.toString(constants.getDouble(value_index)) + ")"; break; case CONSTANT_DecimalOrFloat: ret = "Decimal(" + constants.getDecimal(value_index) + ")"; 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 676abf38f..3c542f2ec 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 @@ -32,6 +32,7 @@ import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol; import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.dumpview.DumpInfo; +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.exporters.modes.ScriptExportMode; @@ -346,6 +347,8 @@ public class ActionPush extends Action { ret = "\"" + Helper.escapeActionScriptString((String) value) + "\""; } else if (value instanceof RegisterNumber) { ret = ((RegisterNumber) value).toStringNoName(); + } else if ((value instanceof Float)||(value instanceof Double)) { + ret = EcmaScript.toString(value); } else { ret = value.toString(); }