Better float support.

Removed methodinfo parser.
This commit is contained in:
Jindra Petřík
2024-08-12 19:51:40 +02:00
parent 9f661ec84c
commit e685022fd7
28 changed files with 3369 additions and 4699 deletions
@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.ecma;
import com.jpexs.decompiler.flash.abc.types.Float4;
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
import com.jpexs.helpers.utf8.Utf8Helper;
import java.io.ByteArrayOutputStream;
@@ -52,6 +53,9 @@ public class EcmaScript {
if (o instanceof Float) {
o = (double) (float) (Float) o;
}
if (o instanceof Float4) {
return Double.NaN;
}
if (o instanceof Double) {
return (Double) o;
}
@@ -69,7 +73,7 @@ public class EcmaScript {
}
try {
return Double.parseDouble(str);
return Double.valueOf(str);
} catch (NumberFormatException nfe) {
return Double.NaN;
}
@@ -204,6 +208,12 @@ public class EcmaScript {
if (o.getClass() == Undefined.class) {
return EcmaType.UNDEFINED;
}
if (o.getClass() == Float.class) {
return EcmaType.FLOAT;
}
if (o.getClass() == Float4.class) {
return EcmaType.FLOAT4;
}
return EcmaType.OBJECT;
}
@@ -225,6 +235,12 @@ public class EcmaScript {
case NUMBER:
typeStr = "number";
break;
case FLOAT:
typeStr = "float";
break;
case FLOAT4:
typeStr = "float4";
break;
case OBJECT:
typeStr = "object";
break;
@@ -236,7 +252,7 @@ public class EcmaScript {
typeStr = "object";
break;
default:
// todo: function,movieclip
// todo: function,movieclip,xml
typeStr = "object";
break;
}
@@ -46,8 +46,16 @@ public enum EcmaType {
/**
* Boolean
*/
BOOLEAN("Boolean");
BOOLEAN("Boolean"),
/**
* Float
*/
FLOAT("float"),
/**
* Float 4
*/
FLOAT4("float4");
private final String clsName;
private EcmaType(String clsName) {