mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-10 19:53:25 +00:00
#869 Negative float reading fixed
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
@@ -46,6 +47,22 @@ public class ActionScript2AssemblerTest extends ActionStript2TestBase {
|
||||
swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/as2/as2.swf")), false);
|
||||
}
|
||||
|
||||
private String recompilePcode(String pcode) {
|
||||
try {
|
||||
List<Action> actions = ASMParser.parse(0, true, pcode, swf.version, false);
|
||||
|
||||
DoActionTag doa = getFirstActionTag();
|
||||
doa.setActionBytes(Action.actionsToBytes(actions, true, swf.version));
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
doa.getASMSource(ScriptExportMode.PCODE, writer, null);
|
||||
return writer.toString();
|
||||
} catch (IOException | ActionParseException | InterruptedException ex) {
|
||||
fail();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModifiedConstantPools() {
|
||||
String actionsString = "ConstantPool \"ok\"\n"
|
||||
@@ -74,4 +91,11 @@ public class ActionScript2AssemblerTest extends ActionStript2TestBase {
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNegativeFloatValue() {
|
||||
String actionsString = "Push -0.25";
|
||||
String decompiled = recompilePcode(actionsString);
|
||||
assertTrue(decompiled.contains("Push -0.25"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user