mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-23 01:35:35 +00:00
swap item
This commit is contained in:
@@ -30,6 +30,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.SimpleValue;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.DuplicateItem;
|
||||
import com.jpexs.decompiler.graph.model.PopItem;
|
||||
import com.jpexs.decompiler.graph.model.PushItem;
|
||||
import com.jpexs.decompiler.graph.model.SwapItem;
|
||||
import java.util.List;
|
||||
@@ -64,12 +65,12 @@ public class SwapIns extends InstructionDefinition {
|
||||
GraphTargetItem o2 = stack.pop();
|
||||
|
||||
|
||||
stack.push(o1);
|
||||
/*stack.push(o1);
|
||||
stack.push(o2);
|
||||
o1.getMoreSrc().add(new GraphSourceItemPos(ins, 0));
|
||||
o2.getMoreSrc().add(new GraphSourceItemPos(ins, 0));
|
||||
|
||||
/*if (((o1 instanceof ExceptionAVM2Item) && (o2 instanceof ExceptionAVM2Item))
|
||||
*/
|
||||
if (((o1 instanceof ExceptionAVM2Item) && (o2 instanceof ExceptionAVM2Item))
|
||||
||
|
||||
(
|
||||
(
|
||||
@@ -93,11 +94,14 @@ public class SwapIns extends InstructionDefinition {
|
||||
return;
|
||||
}
|
||||
|
||||
stack.moveToOutput(output, false);
|
||||
output.add(new PushItem(o2));
|
||||
output.add(new PushItem(o1));
|
||||
output.add(new SwapItem(AVM2GraphTargetDialect.INSTANCE, ins, localData.lineStartInstruction));
|
||||
*/
|
||||
stack.finishBlock(output);
|
||||
if (!(o2 instanceof PopItem)) {
|
||||
output.add(new PushItem(o2));
|
||||
}
|
||||
if (!(o2 instanceof PopItem && o1 instanceof PopItem)) {
|
||||
output.add(new PushItem(o1));
|
||||
}
|
||||
output.add(new SwapItem(AVM2GraphTargetDialect.INSTANCE, ins, localData.lineStartInstruction));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -340,7 +340,13 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
|
||||
@Test
|
||||
public void testPushWhile() {
|
||||
decompileMethod("assembled", "testPushWhile", "var _loc3_:int = 5;\r\n"
|
||||
+ "§§push(obfuscated[\"xxx\"] = new (getDefinitionByName(\"flash.utils\"+\".\"+§§dupsrc(\"ByteArray\")))());\r\n"
|
||||
+ "§§push(§§dupsrc(new (getDefinitionByName(\"flash.utils\"+\".\"+§§dupsrc(\"ByteArray\")))()));\r\n"
|
||||
+ "§§push(§§dup(new (getDefinitionByName(\"flash.utils\"+\".\"+§§dupsrc(\"ByteArray\")))()));\r\n"
|
||||
+ "§§push(obfuscated);\r\n"
|
||||
+ "§§swap();\r\n"
|
||||
+ "§§push(\"xxx\");\r\n"
|
||||
+ "§§swap();\r\n"
|
||||
+ "§§pop()[§§pop()] = §§pop();\r\n"
|
||||
+ "§§push(50);\r\n"
|
||||
+ "while(true)\r\n"
|
||||
+ "{\r\n"
|
||||
@@ -350,10 +356,12 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
|
||||
+ "break;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "§§push(§§pop() - 1);\r\n"
|
||||
+ "§§swap();\r\n"
|
||||
+ "§§push(§§dupsrc(§§pop()));\r\n"
|
||||
+ "§§dupsrc(§§dup(§§pop()))[§§dup(§§dup(§§pop())).length] = 0x29 ^ 0x6F;\r\n"
|
||||
+ "§§push(§§dupsrc(§§pop()));\r\n"
|
||||
+ "§§dupsrc(§§dup(§§pop()))[§§dup(§§dup(§§pop())).length] = 9 ^ 0x54;\r\n"
|
||||
+ "§§swap();\r\n"
|
||||
+ "}\r\n"
|
||||
+ "§§pop();\r\n"
|
||||
+ "§§pop();\r\n",
|
||||
|
||||
Reference in New Issue
Block a user