mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-06 08:45:53 +00:00
Fixed: #2338 AS2 Reading large classes with incorrect if jumps on the beginning
Fixed: #2338 AS1/2/3 Obfuscated code - jump to jump handling
This commit is contained in:
@@ -75,7 +75,7 @@ public class ActionScript2AssemblerTest extends ActionScript2TestBase {
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
|
||||
try {
|
||||
Action.actionsToSource(new HashMap<>(),doa, doa.getActions(), "", writer, swf.getCharset());
|
||||
Action.actionsToSource(new HashMap<>(), doa, doa.getActions(), "", writer, swf.getCharset());
|
||||
} catch (InterruptedException ex) {
|
||||
fail();
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class ActionScript2AssemblerTest extends ActionScript2TestBase {
|
||||
DoActionTag doa = getFirstActionTag();
|
||||
doa.setActionBytes(Action.actionsToBytes(actions, true, swf.version));
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
Action.actionsToSource(new HashMap<>(),doa, doa.getActions(), "", writer, swf.getCharset());
|
||||
Action.actionsToSource(new HashMap<>(), doa, doa.getActions(), "", writer, swf.getCharset());
|
||||
writer.finishHilights();
|
||||
String actualResult = writer.toString();
|
||||
writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
@@ -175,6 +175,52 @@ public class ActionScript2AssemblerTest extends ActionScript2TestBase {
|
||||
+ "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJumpAfterFunctionFix() {
|
||||
String res = decompilePcode("ConstantPool \"F\", \"A\", \"f\", \"B\", \"C\"\n"
|
||||
+ "DefineFunction \"f\", 0 {\n"
|
||||
+ "Push \"F\"\n"
|
||||
+ "Trace\n"
|
||||
+ "Push 1, 1\n"
|
||||
+ "Equals2\n"
|
||||
+ "If loc005b\n"
|
||||
+ "Push \"G\"\n"
|
||||
+ "Trace\n"
|
||||
+ "}\n"
|
||||
+ "Push \"A\"\n"
|
||||
+ "Trace\n"
|
||||
+ "Push 0\n"
|
||||
+ "Push \"f\"\n"
|
||||
+ "CallFunction\n"
|
||||
+ "Pop\n"
|
||||
+ "Push \"B\"\n"
|
||||
+ "Trace\n"
|
||||
+ "Push 1\n"
|
||||
+ "loc005b:Push 2\n"
|
||||
+ "Equals2\n"
|
||||
+ "If loc006e\n"
|
||||
+ "Push \"C\"\n"
|
||||
+ "Trace\n"
|
||||
+ "loc006e:Stop");
|
||||
res = cleanPCode(res);
|
||||
assertEquals(res, "function f()\n"
|
||||
+ "{\n"
|
||||
+ "trace(\"F\");\n"
|
||||
+ "if(1 != 1)\n"
|
||||
+ "{\n"
|
||||
+ "trace(\"G\");\n"
|
||||
+ "}\n"
|
||||
+ "}\n"
|
||||
+ "trace(\"A\");\n"
|
||||
+ "f();\n"
|
||||
+ "trace(\"B\");\n"
|
||||
+ "if(1 != 2)\n"
|
||||
+ "{\n"
|
||||
+ "trace(\"C\");\n"
|
||||
+ "}\n"
|
||||
+ "stop();");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefineFuncRegCleaner() {
|
||||
String res = decompilePcode("ConstantPool \"Math\" \"randi\" \"random\" \"b\" \"a\" \"floor\" \"randf\" \"randa\" \"arguments\" \"rande\" \"sign\" \"abs\"\n"
|
||||
|
||||
Reference in New Issue
Block a user