mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-23 08:15:33 +00:00
Added: Harman AIR 51 float support compatibility
This commit is contained in:
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
|
||||
## [Unreleased]
|
||||
### Added
|
||||
- Updated Flash player to SWF version map
|
||||
- Harman AIR 51 float support compatibility
|
||||
|
||||
### Fixed
|
||||
- [#2266] StartSound/2 and VideoFrame tags, classNames not taken as dependencies (needed chars)
|
||||
|
||||
@@ -784,6 +784,14 @@ public class ABC implements Openable {
|
||||
public boolean hasFloatSupport() {
|
||||
return minVersionCheck(47, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the ABC has float4 support
|
||||
* @return Whether the ABC has float4 support
|
||||
*/
|
||||
public boolean hasFloat4Support() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets float support.
|
||||
@@ -927,6 +935,8 @@ public class ABC implements Openable {
|
||||
}
|
||||
ais.endDumpLevel();
|
||||
}
|
||||
}
|
||||
if (hasFloat4Support()) {
|
||||
// constant float4
|
||||
int constant_float4_pool_count = ais.readU30("float4_count");
|
||||
if (constant_float4_pool_count > 1) {
|
||||
@@ -1125,6 +1135,8 @@ public class ABC implements Openable {
|
||||
for (int i = 1; i < constants.getFloatCount(); i++) {
|
||||
aos.writeFloat(constants.getFloat(i));
|
||||
}
|
||||
}
|
||||
if (hasFloat4Support()) {
|
||||
aos.writeU30(constants.getFloat4Count());
|
||||
for (int i = 1; i < constants.getFloat4Count(); i++) {
|
||||
aos.writeFloat4(constants.getFloat4(i));
|
||||
@@ -2400,7 +2412,7 @@ public class ABC implements Openable {
|
||||
}
|
||||
break;
|
||||
case ValueKind.CONSTANT_Float4:
|
||||
if (hasFloatSupport()) {
|
||||
if (hasFloat4Support()) {
|
||||
valueMergeMap = mergeFloat4Map;
|
||||
}
|
||||
break;
|
||||
@@ -2675,7 +2687,7 @@ public class ABC implements Openable {
|
||||
}
|
||||
break;
|
||||
case ValueKind.CONSTANT_Float4:
|
||||
if (hasFloatSupport()) {
|
||||
if (hasFloat4Support()) {
|
||||
valueMergeMap = mergeFloat4Map;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -700,7 +700,7 @@ public class ABCInputStream implements AutoCloseable {
|
||||
*/
|
||||
public Float readFloat(String name) throws IOException {
|
||||
newDumpLevel(name, "Float");
|
||||
int intBits = (readInternal()) + (readInternal() << 8);
|
||||
int intBits = (readInternal()) + (readInternal() << 8) + (readInternal() << 16) + (readInternal() << 24);
|
||||
float ret = Float.intBitsToFloat(intBits);
|
||||
endDumpLevel(ret);
|
||||
return ret;
|
||||
|
||||
@@ -580,7 +580,7 @@ public class AVM2Code implements Cloneable {
|
||||
/*0x20*/ new PushNullIns(),
|
||||
/*0x21*/ new PushUndefinedIns(),
|
||||
/*0x22*/ new PushFloatIns(), //major 47+
|
||||
/*0x22*/ new PushConstantIns(), //before major 47
|
||||
/*0x22*/ //new PushConstantIns(), //before major 47
|
||||
/*0x23*/ new NextValueIns(),
|
||||
/*0x24*/ new PushByteIns(),
|
||||
/*0x25*/ new PushShortIns(),
|
||||
|
||||
@@ -87,6 +87,12 @@ public class CoerceAVM2Item extends AVM2Item {
|
||||
&& !valueReturnType.equals(TypeItem.UINT)
|
||||
&& !valueReturnType.equals(TypeItem.UNBOUNDED);
|
||||
break;
|
||||
case "float":
|
||||
displayCoerce = !valueReturnType.equals(TypeItem.INT)
|
||||
&& !valueReturnType.equals(new TypeItem("float"))
|
||||
&& !valueReturnType.equals(TypeItem.UINT)
|
||||
&& !valueReturnType.equals(TypeItem.UNBOUNDED);
|
||||
break;
|
||||
case "int":
|
||||
displayCoerce = !valueReturnType.equals(TypeItem.INT)
|
||||
&& !valueReturnType.equals(TypeItem.UNBOUNDED);
|
||||
|
||||
@@ -75,6 +75,12 @@ public class ConvertAVM2Item extends AVM2Item {
|
||||
&& !valueReturnType.equals(TypeItem.UINT)
|
||||
&& !valueReturnType.equals(TypeItem.UNBOUNDED);
|
||||
break;
|
||||
case "float":
|
||||
displayConvert = !valueReturnType.equals(TypeItem.INT)
|
||||
&& !valueReturnType.equals(new TypeItem("float"))
|
||||
&& !valueReturnType.equals(TypeItem.UINT)
|
||||
&& !valueReturnType.equals(TypeItem.UNBOUNDED);
|
||||
break;
|
||||
case "int":
|
||||
displayConvert = !valueReturnType.equals(TypeItem.INT)
|
||||
&& !valueReturnType.equals(TypeItem.UNBOUNDED);
|
||||
|
||||
@@ -84,7 +84,7 @@ public class FloatValueAVM2Item extends NumberValueAVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem returnType() {
|
||||
return TypeItem.NUMBER;
|
||||
return new TypeItem("float");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2489,7 +2489,7 @@ public class ActionScript3Parser {
|
||||
allowMemberOrCall = true;
|
||||
break;
|
||||
case FLOAT4:
|
||||
if (!abc.hasFloatSupport()) {
|
||||
if (!abc.hasFloat4Support()) {
|
||||
//parse again as method call
|
||||
lexer.yypushbackstr(lexer.yytext().substring("float4".length()));
|
||||
lexer.pushback(new ParsedSymbol(SymbolGroup.IDENTIFIER, SymbolType.IDENTIFIER, "float4"));
|
||||
|
||||
@@ -276,7 +276,8 @@ public class ABCCleaner {
|
||||
}
|
||||
newCpool.addFloat(abc.constants.getFloat(i));
|
||||
}
|
||||
|
||||
}
|
||||
if (abc.hasFloat4Support()) {
|
||||
for (int i = 1; i < abc.constants.getFloat4Count(); i++) {
|
||||
if (notReferencedIndices.get(ABCSimpleUsageDetector.ItemKind.FLOAT4).contains(i)) {
|
||||
continue;
|
||||
|
||||
BIN
libsrc/ffdec_lib/testdata/float/bin/float.air_harman.swf
vendored
Normal file
BIN
libsrc/ffdec_lib/testdata/float/bin/float.air_harman.swf
vendored
Normal file
Binary file not shown.
10
libsrc/ffdec_lib/testdata/float/build_air_harman_debug.bat
vendored
Normal file
10
libsrc/ffdec_lib/testdata/float/build_air_harman_debug.bat
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
@echo off
|
||||
set COMPILERKIND=air_harman
|
||||
set SWFNAME=float
|
||||
rem call c:\air_harman\bin\mxmlc.bat -debug=true -output bin/%SWFNAME%.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1
|
||||
set batdir=%~dp0
|
||||
echo %batdir%bin\%SWFNAME%.%COMPILERKIND%.xml
|
||||
cd c:\air_harman\bin
|
||||
adl.exe -nodebug %batdir%bin\%SWFNAME%.%COMPILERKIND%.xml
|
||||
rem -cmd
|
||||
pause
|
||||
24
libsrc/ffdec_lib/testdata/float/src/Main.as
vendored
Normal file
24
libsrc/ffdec_lib/testdata/float/src/Main.as
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
package
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class Main extends Sprite
|
||||
{
|
||||
|
||||
public function Main()
|
||||
{
|
||||
if (stage) init();
|
||||
else addEventListener(Event.ADDED_TO_STAGE, init);
|
||||
}
|
||||
|
||||
private function init(e:Event = null):void
|
||||
{
|
||||
removeEventListener(Event.ADDED_TO_STAGE, init);
|
||||
|
||||
var a:float = 10f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -404,6 +404,8 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
}
|
||||
if (abc.hasFloatSupport()) {
|
||||
cpTabbedPane.addTab("fl (" + Math.max(0, abc.constants.getFloatCount() - 1) + ")", View.getIcon(TreeType.CONSTANT_FLOAT.getIcon().getFile()), makeTreePanel(abc, TreeType.CONSTANT_FLOAT));
|
||||
}
|
||||
if (abc.hasFloat4Support()) {
|
||||
cpTabbedPane.addTab("fl4 (" + Math.max(0, abc.constants.getFloat4Count() - 1) + ")", View.getIcon(TreeType.CONSTANT_FLOAT_4.getIcon().getFile()), makeTreePanel(abc, TreeType.CONSTANT_FLOAT_4));
|
||||
}
|
||||
cpTabbedPane.addTab("str (" + Math.max(0, abc.constants.getStringCount() - 1) + ")", View.getIcon(TreeType.CONSTANT_STRING.getIcon().getFile()), makeTreePanel(abc, TreeType.CONSTANT_STRING));
|
||||
@@ -424,7 +426,8 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
+ Math.max(0, abc.constants.getNamespaceSetCount() - 1)
|
||||
+ Math.max(0, abc.constants.getMultinameCount() - 1)
|
||||
+ (abc.hasDecimalSupport() ? Math.max(0, abc.constants.getDecimalCount() - 1) : 0)
|
||||
+ (abc.hasFloatSupport() ? (Math.max(0, abc.constants.getFloatCount() - 1) + Math.max(0, abc.constants.getFloat4Count() - 1)) : 0);
|
||||
+ (abc.hasFloatSupport() ? Math.max(0, abc.constants.getFloatCount() - 1) : 0)
|
||||
+ (abc.hasFloat4Support() ? Math.max(0, abc.constants.getFloat4Count() - 1) : 0);
|
||||
mainTabbedPane.addTab("cp (" + cpCount + ")", View.getIcon("abcconstantpool16"), cpPanel);
|
||||
mainTabbedPane.addTab("mi (" + abc.method_info.size() + ")", View.getIcon(TreeType.METHOD_INFO.getIcon().getFile()), makeTreePanel(abc, TreeType.METHOD_INFO));
|
||||
mainTabbedPane.addTab("md (" + abc.metadata_info.size() + ")", View.getIcon(TreeType.METADATA_INFO.getIcon().getFile()), makeTreePanel(abc, TreeType.METADATA_INFO));
|
||||
@@ -558,7 +561,10 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
stringOffset = 1;
|
||||
}
|
||||
if (getSelectedAbc().hasFloatSupport()) {
|
||||
stringOffset = 2;
|
||||
stringOffset++;
|
||||
}
|
||||
if (getSelectedAbc().hasFloat4Support()) {
|
||||
stringOffset++;
|
||||
}
|
||||
switch (selectedType) {
|
||||
case CONSTANT_INT:
|
||||
@@ -588,7 +594,7 @@ public class ABCExplorerDialog extends AppDialog {
|
||||
cpTabbedPane.setSelectedIndex(3);
|
||||
break;
|
||||
case CONSTANT_FLOAT_4:
|
||||
if (!getSelectedAbc().hasFloatSupport()) {
|
||||
if (!getSelectedAbc().hasFloat4Support()) {
|
||||
return;
|
||||
}
|
||||
mainTabbedPane.setSelectedIndex(0);
|
||||
|
||||
Reference in New Issue
Block a user