mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-16 17:41:58 +00:00
AS1/2 execution stub - execute method for nearly all actions. Needs some testing. Still a lot to do.
This commit is contained in:
@@ -710,10 +710,12 @@ public abstract class Action implements GraphSourceItem {
|
||||
return toString();
|
||||
}
|
||||
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
public abstract boolean execute(LocalDataArea lda);
|
||||
|
||||
/* {
|
||||
//throw new UnsupportedOperationException("Action " + toString() + " not implemented");
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Translates this function to stack and output.
|
||||
@@ -1061,7 +1063,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
}
|
||||
|
||||
/*ActionJump && ActionIf removed*/
|
||||
/*if ((action instanceof ActionEnumerate2) || (action instanceof ActionEnumerate)) {
|
||||
/*if ((action instanceof ActionEnumerate2) || (action instanceof ActionEnumerate)) {
|
||||
loopStart = ip + 1;
|
||||
isForIn = true;
|
||||
ip += 4;
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ActionScriptArray extends ActionScriptObject {
|
||||
|
||||
protected List<Object> values = new ArrayList<>();
|
||||
|
||||
//TODO: implement some methods?
|
||||
@Override
|
||||
public List<String> enumerate() {
|
||||
List<String> ret = super.enumerate();
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
ret.add("" + i);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getMember(String path) {
|
||||
if (path.matches("[1-9][0-9]*|0")) {
|
||||
return getValueAtIndex(Integer.parseInt(path));
|
||||
}
|
||||
return super.getMember(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMember(String path, Object value) {
|
||||
if (path.matches("[1-9][0-9]*|0")) {
|
||||
setValueAtIndex(Integer.parseInt(path), value);
|
||||
return;
|
||||
}
|
||||
super.setMember(path, value);
|
||||
}
|
||||
|
||||
public void setValueAtIndex(int index, Object value) {
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
if (index >= values.size()) {
|
||||
int delta = 1 + index - values.size();
|
||||
for (int i = 0; i < delta - 1; i++) {
|
||||
values.add(Undefined.INSTANCE);
|
||||
}
|
||||
values.add(value);
|
||||
} else {
|
||||
values.set(index, value);
|
||||
}
|
||||
trim();
|
||||
}
|
||||
|
||||
public void trim() {
|
||||
for (int i = values.size() - 1; i >= 0; i--) {
|
||||
if (values.get(i) == Undefined.INSTANCE) {
|
||||
values.remove(i);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object getValueAtIndex(int index) {
|
||||
if (index < 0) {
|
||||
return Undefined.INSTANCE; //throw error?
|
||||
}
|
||||
if (index >= values.size()) {
|
||||
return Undefined.INSTANCE;
|
||||
}
|
||||
return values.get(index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ActionScriptFunction extends ActionScriptObject {
|
||||
|
||||
protected long functionOffset;
|
||||
protected long functionLength;
|
||||
protected String functionName;
|
||||
protected List<String> paramNames;
|
||||
protected Map<Integer, String> funcRegNames;
|
||||
|
||||
public ActionScriptFunction(long functionOffset, long functionLength, String functionName, List<String> paramNames, Map<Integer, String> funcRegNames) {
|
||||
this.functionOffset = functionOffset;
|
||||
this.functionLength = functionLength;
|
||||
this.functionName = functionName;
|
||||
this.paramNames = paramNames;
|
||||
this.funcRegNames = funcRegNames;
|
||||
}
|
||||
|
||||
public Object execute(Object thisObj, List<Object> args) {
|
||||
//TODO!!!
|
||||
return null;
|
||||
}
|
||||
|
||||
public long getFunctionLength() {
|
||||
return functionLength;
|
||||
}
|
||||
|
||||
public long getFunctionOffset() {
|
||||
return functionOffset;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ActionScriptObject implements Cloneable {
|
||||
|
||||
protected Map<Integer, Object> properties = new HashMap<>();
|
||||
protected Map<String, Object> members = new HashMap<>();
|
||||
|
||||
protected Object extendsObj;
|
||||
protected List<Object> implementsObjs = new ArrayList<>();
|
||||
|
||||
public List<Object> getImplementsObjs() {
|
||||
return implementsObjs;
|
||||
}
|
||||
|
||||
public void setImplementsObjs(List<Object> implementsObjs) {
|
||||
this.implementsObjs = implementsObjs;
|
||||
}
|
||||
|
||||
public void setExtendsObj(Object extendsObj) {
|
||||
this.extendsObj = extendsObj;
|
||||
}
|
||||
|
||||
public Object getExtendsObj() {
|
||||
return extendsObj;
|
||||
}
|
||||
|
||||
public void removeMember(String path) {
|
||||
String pathParts[];
|
||||
if (path.startsWith("/")) {
|
||||
pathParts = path.substring(1).split("/");
|
||||
} else {
|
||||
pathParts = path.split(".");
|
||||
}
|
||||
ActionScriptObject obj = this;
|
||||
for (int i = 0; i < pathParts.length; i++) {
|
||||
String part = pathParts[i];
|
||||
Object member = obj.getMember(part);
|
||||
if (i == pathParts.length - 1) {
|
||||
obj.members.remove(part);
|
||||
} else if (member instanceof ActionScriptObject) {
|
||||
obj = (ActionScriptObject) member;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> enumerate() {
|
||||
return new ArrayList<>(members.keySet());
|
||||
}
|
||||
|
||||
public void setProperty(int index, Object value) {
|
||||
properties.put(index, value);
|
||||
}
|
||||
|
||||
public Object getProperty(int index) {
|
||||
if (!properties.containsKey(index)) {
|
||||
return Undefined.INSTANCE;
|
||||
}
|
||||
return properties.get(index);
|
||||
}
|
||||
|
||||
public void setMember(String path, Object value) {
|
||||
String pathParts[];
|
||||
if (path.startsWith("/")) {
|
||||
pathParts = path.substring(1).split("/");
|
||||
} else {
|
||||
pathParts = path.split(".");
|
||||
}
|
||||
ActionScriptObject obj = this;
|
||||
for (int i = 0; i < pathParts.length; i++) {
|
||||
String part = pathParts[i];
|
||||
Object member = obj.getMember(part);
|
||||
if (i == pathParts.length - 1) {
|
||||
obj.members.put(part, value);
|
||||
} else if (member instanceof ActionScriptObject) {
|
||||
obj = (ActionScriptObject) member;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
//ignore
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMemberPath(Object obj) {
|
||||
if (obj == this) {
|
||||
return "";
|
||||
}
|
||||
|
||||
for (String memberName : members.keySet()) {
|
||||
Object member = members.get(memberName);
|
||||
if (member == obj) {
|
||||
return memberName;
|
||||
}
|
||||
if (member instanceof ActionScriptObject) {
|
||||
String ret = ((ActionScriptObject) member).getMemberPath(obj);
|
||||
if (ret != null) {
|
||||
return memberName + "." + ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object getMember(String path) {
|
||||
String pathParts[];
|
||||
if (path.startsWith("/")) {
|
||||
pathParts = path.substring(1).split("/");
|
||||
} else {
|
||||
pathParts = path.split(".");
|
||||
}
|
||||
ActionScriptObject obj = this;
|
||||
for (int i = 0; i < pathParts.length; i++) {
|
||||
String part = pathParts[i];
|
||||
Object member = obj.getMember(part);
|
||||
if (i == pathParts.length - 1) {
|
||||
return member;
|
||||
} else if (member instanceof ActionScriptObject) {
|
||||
obj = (ActionScriptObject) member;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ActionScriptWith {
|
||||
|
||||
protected ActionScriptObject obj;
|
||||
protected long startAddr;
|
||||
protected long length;
|
||||
|
||||
public ActionScriptWith(ActionScriptObject obj, long startAddr, long length) {
|
||||
this.obj = obj;
|
||||
this.startAddr = startAddr;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DisplayObject extends ActionScriptObject {
|
||||
|
||||
protected Map<Integer, Object> displayList = new HashMap<>();
|
||||
|
||||
protected int totalFrames;
|
||||
protected int currentFrame;
|
||||
protected boolean paused = false;
|
||||
protected boolean dragging = false;
|
||||
|
||||
public void startDrag() {
|
||||
dragging = true;
|
||||
}
|
||||
|
||||
public void stopDrag() {
|
||||
dragging = false;
|
||||
}
|
||||
|
||||
public int getCurrentFrame() {
|
||||
return currentFrame;
|
||||
}
|
||||
|
||||
public int getTotalFrames() {
|
||||
return totalFrames;
|
||||
}
|
||||
|
||||
public void gotoLabel(String label) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
public void gotoFrame(int frame) {
|
||||
if (frame < 1) {
|
||||
frame = 1;
|
||||
}
|
||||
if (frame > totalFrames) {
|
||||
frame = totalFrames;
|
||||
}
|
||||
this.currentFrame = frame;
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
paused = true;
|
||||
}
|
||||
|
||||
public void play() {
|
||||
paused = false;
|
||||
}
|
||||
|
||||
public void callFrame(int frame) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
public void addToDisplayList(int depth, Object obj) {
|
||||
displayList.put(depth, obj);
|
||||
}
|
||||
|
||||
public Object removeFromDisplayList(int depth) {
|
||||
return displayList.remove(depth);
|
||||
}
|
||||
|
||||
public Object getFromDisplayList(int depth) {
|
||||
return displayList.get(depth);
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,12 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
@@ -32,7 +35,17 @@ public class LocalDataArea {
|
||||
|
||||
public Stack<Object> stack = new Stack<>();
|
||||
|
||||
public HashMap<String, Object> localVariables = new HashMap<>();
|
||||
public List<Object> functions = new ArrayList<>();
|
||||
|
||||
public Map<String, Object> localVariables = new HashMap<>();
|
||||
|
||||
public List<ActionScriptWith> withs = new ArrayList<>();
|
||||
|
||||
public Map<Integer, Object> localRegisters = new HashMap<>();
|
||||
|
||||
public Object target;
|
||||
|
||||
public Stage stage;
|
||||
|
||||
public Long jump;
|
||||
|
||||
@@ -40,10 +53,14 @@ public class LocalDataArea {
|
||||
|
||||
public String executionException;
|
||||
|
||||
public LocalDataArea() {
|
||||
public LocalDataArea(Stage stage) {
|
||||
this.stage = stage;
|
||||
this.target = this.stage;
|
||||
}
|
||||
|
||||
public LocalDataArea(boolean preserveVariableOrder) {
|
||||
public LocalDataArea(Stage stage, boolean preserveVariableOrder) {
|
||||
this.stage = stage;
|
||||
target = this.stage;
|
||||
if (preserveVariableOrder) {
|
||||
localVariables = new LinkedHashMap<>();
|
||||
}
|
||||
@@ -56,6 +73,7 @@ public class LocalDataArea {
|
||||
jump = null;
|
||||
returnValue = null;
|
||||
executionException = null;
|
||||
target = stage;
|
||||
}
|
||||
|
||||
public Object pop() {
|
||||
@@ -65,4 +83,8 @@ public class LocalDataArea {
|
||||
public Double popAsNumber() {
|
||||
return EcmaScript.toNumberAs2(stack.pop());
|
||||
}
|
||||
|
||||
public String popAsString() {
|
||||
return EcmaScript.toString(stack.pop());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Stage extends DisplayObject {
|
||||
|
||||
protected long startTime;
|
||||
|
||||
public Stage() {
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return System.currentTimeMillis() - startTime;
|
||||
}
|
||||
|
||||
public void stopSounds() {
|
||||
|
||||
}
|
||||
|
||||
public void toggleQuality() {
|
||||
|
||||
}
|
||||
|
||||
public void getURL(String url, String target) {
|
||||
|
||||
}
|
||||
|
||||
public void trace(Object... val) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.ActionListReader;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.Stage;
|
||||
import com.jpexs.decompiler.flash.action.fastactionlist.ActionItem;
|
||||
import com.jpexs.decompiler.flash.action.fastactionlist.FastActionList;
|
||||
import com.jpexs.decompiler.flash.action.fastactionlist.FastActionListIterator;
|
||||
@@ -195,7 +196,7 @@ public class ActionDeobfuscator extends SWFDecompilerAdapter {
|
||||
actions.removeZeroJumps();
|
||||
|
||||
ActionConstantPool cPool = getConstantPool(actions);
|
||||
LocalDataArea localData = new LocalDataArea(true);
|
||||
LocalDataArea localData = new LocalDataArea(new Stage(), true);
|
||||
localData.stack = new FixItemCounterStack();
|
||||
ExecutionResult result = new ExecutionResult();
|
||||
FastActionListIterator iterator = actions.iterator();
|
||||
@@ -222,7 +223,8 @@ public class ActionDeobfuscator extends SWFDecompilerAdapter {
|
||||
newIstructionCount++;
|
||||
}
|
||||
|
||||
newIstructionCount += 3 * result.variables.size(); /* 2x Push + Set or Define */
|
||||
newIstructionCount += 3 * result.variables.size();
|
||||
/* 2x Push + Set or Define */
|
||||
|
||||
boolean allValueValid = true;
|
||||
for (Object value : result.variables.values()) {
|
||||
@@ -381,7 +383,7 @@ public class ActionDeobfuscator extends SWFDecompilerAdapter {
|
||||
|
||||
Map<String, Object> results = new HashMap<>();
|
||||
|
||||
LocalDataArea localData = new LocalDataArea();
|
||||
LocalDataArea localData = new LocalDataArea(new Stage());
|
||||
localData.stack = new FixItemCounterStack();
|
||||
ExecutionResult result = new ExecutionResult();
|
||||
for (ActionItem actionItem : actions) {
|
||||
@@ -505,10 +507,8 @@ public class ActionDeobfuscator extends SWFDecompilerAdapter {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!action.execute(localData)) {
|
||||
break;
|
||||
}
|
||||
} else if (!action.execute(localData)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!useVariables && (action instanceof ActionDefineLocal
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.flashlite;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.FSCommand2ActionItem;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -66,4 +67,10 @@ public class ActionFSCommand2 extends Action {
|
||||
public int getStackPushCount(BaseLocalData localData, TranslateStack stack) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
return true; //TODO?
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.flashlite;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.StrictModeActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
@@ -67,6 +68,11 @@ public class ActionStrictMode extends Action {
|
||||
return "StrictMode " + mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
return true; //TODO?
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartItem, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
output.add(new StrictModeActionItem(this, lineStartItem, mode));
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionRandomNumber;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -26,6 +27,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.SourceGenerator;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -33,10 +35,16 @@ import java.util.List;
|
||||
*/
|
||||
public class RandomNumberActionItem extends ActionItem {
|
||||
|
||||
private static Random rnd = new Random();
|
||||
|
||||
public RandomNumberActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem maximum) {
|
||||
super(instruction, lineStartIns, PRECEDENCE_PRIMARY, maximum);
|
||||
}
|
||||
|
||||
public static Integer getResult(Object maximum) {
|
||||
return rnd.nextInt(EcmaScript.toInt32(maximum));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
writer.append("random");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.action.special;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -38,6 +39,11 @@ public class ActionNop extends Action {
|
||||
return "Nop";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartItem, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
//output.add(new SimpleActionTreeItem(this, "nop();"));
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.swf3;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.FSCommandActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GetURLActionItem;
|
||||
@@ -49,6 +50,12 @@ public class ActionGetURL extends Action {
|
||||
|
||||
public String targetString;
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
lda.stage.getURL(urlString, targetString);
|
||||
return true;
|
||||
}
|
||||
|
||||
public ActionGetURL(String urlString, String targetString) {
|
||||
super(0x83, 0);
|
||||
this.urlString = urlString;
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.jpexs.decompiler.flash.action.swf3;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.DisplayObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.GotoLabelActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
@@ -53,6 +55,12 @@ public class ActionGoToLabel extends Action {
|
||||
label = sis.readString("label");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
((DisplayObject) lda.target).gotoLabel(label);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoToLabel \"" + Helper.escapeActionScriptString(label) + "\"";
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.jpexs.decompiler.flash.action.swf3;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.DisplayObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.GotoFrameActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
@@ -44,6 +46,12 @@ public class ActionGotoFrame extends Action {
|
||||
this.frame = frame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
((DisplayObject) lda.target).gotoFrame(frame);
|
||||
return true;
|
||||
}
|
||||
|
||||
public ActionGotoFrame(int actionLength, SWFInputStream sis) throws IOException {
|
||||
super(0x81, actionLength);
|
||||
frame = sis.readUI16("frame");
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.DisplayObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.NextFrameActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -41,6 +43,15 @@ public class ActionNextFrame extends Action {
|
||||
return "NextFrame";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
int f = ((DisplayObject) lda.target).getCurrentFrame();
|
||||
if (f < ((DisplayObject) lda.target).getTotalFrames()) {
|
||||
((DisplayObject) lda.target).gotoFrame(f + 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
output.add(new NextFrameActionItem(this, lineStartAction));
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.DisplayObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GotoFrame2ActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GotoFrameActionItem;
|
||||
@@ -44,6 +46,12 @@ public class ActionPlay extends Action {
|
||||
return "Play";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
((DisplayObject) lda.target).play();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
if (!output.isEmpty() && (output.get(output.size() - 1) instanceof GotoFrameActionItem)) {
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.DisplayObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.PrevFrameActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -41,6 +43,15 @@ public class ActionPrevFrame extends Action {
|
||||
return "PrevFrame";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
int f = ((DisplayObject) lda.target).getCurrentFrame();
|
||||
if (f > 1) {
|
||||
((DisplayObject) lda.target).gotoFrame(f - 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
output.add(new PrevFrameActionItem(this, lineStartAction));
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.swf3;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.SetTargetActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
@@ -46,6 +47,16 @@ public class ActionSetTarget extends Action {
|
||||
this.targetName = targetName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (targetName.equals("/")) {
|
||||
lda.target = lda.stage;
|
||||
return true;
|
||||
}
|
||||
lda.target = lda.stage.getMember(targetName);
|
||||
return true;
|
||||
}
|
||||
|
||||
public ActionSetTarget(int actionLength, SWFInputStream sis, int version) throws IOException {
|
||||
super(0x8B, actionLength);
|
||||
//byte[] data = sis.readBytes(actionLength);
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.DisplayObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.StopActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -41,6 +43,12 @@ public class ActionStop extends Action {
|
||||
return "Stop";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
((DisplayObject) lda.target).pause();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
output.add(new StopActionItem(this, lineStartAction));
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.StopAllSoundsActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -41,6 +42,12 @@ public class ActionStopSounds extends Action {
|
||||
return "StopSounds";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
lda.stage.stopSounds();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
output.add(new StopAllSoundsActionItem(this, lineStartAction));
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.action.swf3;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.ToggleHighQualityActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -41,6 +42,12 @@ public class ActionToggleQuality extends Action {
|
||||
return "ToggleQuality";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
lda.stage.toggleQuality();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
output.add(new ToggleHighQualityActionItem(this, lineStartAction));
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraph;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
@@ -51,6 +52,12 @@ public class ActionWaitForFrame extends Action implements ActionStore {
|
||||
|
||||
public List<Action> skipped;
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
//it's already loaded. TODO: check real loaded?
|
||||
return true;
|
||||
}
|
||||
|
||||
public ActionWaitForFrame(int actionLength, SWFInputStream sis) throws IOException {
|
||||
super(0x8A, actionLength);
|
||||
frame = sis.readUI16("frame");
|
||||
|
||||
@@ -18,7 +18,9 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.CallActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -46,6 +48,12 @@ public class ActionCall extends Action {
|
||||
return "Call";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
lda.stage.callFrame(EcmaScript.toInt32(lda.stack.pop()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
output.add(new CallActionItem(this, lineStartAction, stack.pop()));
|
||||
|
||||
@@ -18,7 +18,10 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.CloneSpriteActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -42,6 +45,19 @@ public class ActionCloneSprite extends Action {
|
||||
return "CloneSprite";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
int depth = EcmaScript.toInt32(lda.stack.pop());
|
||||
String source = EcmaScript.toString(lda.stack.pop());
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
lda.stage.setMember(target, ((ActionScriptObject) lda.stage.getMember(source)).clone());
|
||||
lda.stage.addToDisplayList(depth, lda.stage.getMember(target));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem depth = stack.pop();
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.DisplayObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.StopDragActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -41,6 +43,14 @@ public class ActionEndDrag extends Action {
|
||||
return "EndDrag";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.target instanceof DisplayObject) {
|
||||
((DisplayObject) lda.target).stopDrag();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
output.add(new StopDragActionItem(this, lineStartAction));
|
||||
|
||||
@@ -18,8 +18,12 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GetPropertyActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -43,6 +47,22 @@ public class ActionGetProperty extends Action {
|
||||
return "GetProperty";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
int index = EcmaScript.toInt32(lda.stack.pop());
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
Object movieClip = lda.stage.getMember(target);
|
||||
if (movieClip instanceof ActionScriptObject) {
|
||||
lda.stack.push(((ActionScriptObject) movieClip).getProperty(index));
|
||||
return true;
|
||||
}
|
||||
lda.stack.push(Undefined.INSTANCE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem index = stack.pop();
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.GetTimeActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -42,6 +43,12 @@ public class ActionGetTime extends Action {
|
||||
return "GetTime";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
lda.stack.push(lda.stage.getTime());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
stack.push(new GetTimeActionItem(this, lineStartAction));
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GetURL2ActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.LoadMovieActionItem;
|
||||
@@ -34,6 +35,7 @@ import com.jpexs.decompiler.flash.action.model.UnLoadMovieActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.UnLoadMovieNumActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -109,6 +111,18 @@ public class ActionGetURL2 extends Action {
|
||||
sendVarsMethod = (int) lexLong(lexer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
String urlString = EcmaScript.toString(lda.stack.pop());
|
||||
|
||||
//TODO: Execute - Connection
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem targetString = stack.pop();
|
||||
@@ -158,14 +172,12 @@ public class ActionGetURL2 extends Action {
|
||||
} else {
|
||||
output.add(new LoadMovieNumActionItem(this, lineStartAction, urlString, new DirectValueActionItem(null, null, 0, (Long) (long) (int) num, new ArrayList<>()), sendVarsMethod));
|
||||
}
|
||||
} else if (urlStr != null && urlStr.startsWith(printPrefix)) {
|
||||
output.add(new PrintActionItem(this, lineStartAction, targetString, new DirectValueActionItem(urlStr.substring(printPrefix.length()))));
|
||||
} else if (urlStr != null && urlStr.startsWith(printAsBitmapPrefix)) {
|
||||
output.add(new PrintAsBitmapActionItem(this, lineStartAction, targetString, new DirectValueActionItem(urlStr.substring(printAsBitmapPrefix.length()))));
|
||||
} else {
|
||||
if (urlStr != null && urlStr.startsWith(printPrefix)) {
|
||||
output.add(new PrintActionItem(this, lineStartAction, targetString, new DirectValueActionItem(urlStr.substring(printPrefix.length()))));
|
||||
} else if (urlStr != null && urlStr.startsWith(printAsBitmapPrefix)) {
|
||||
output.add(new PrintAsBitmapActionItem(this, lineStartAction, targetString, new DirectValueActionItem(urlStr.substring(printAsBitmapPrefix.length()))));
|
||||
} else {
|
||||
output.add(new GetURL2ActionItem(this, lineStartAction, urlString, targetString, sendVarsMethod));
|
||||
}
|
||||
output.add(new GetURL2ActionItem(this, lineStartAction, urlString, targetString, sendVarsMethod));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,12 @@ import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.DisplayObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.GotoFrame2ActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -104,6 +107,41 @@ public class ActionGotoFrame2 extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 1) {
|
||||
return false;
|
||||
}
|
||||
String frame = EcmaScript.toString(lda.stack.pop());
|
||||
String target = "/";
|
||||
if (frame.contains(":")) {
|
||||
target = frame.substring(0, frame.indexOf(":"));
|
||||
frame = frame.substring(frame.indexOf(":") + 1);
|
||||
}
|
||||
if (frame.matches("[1-9][0-9]*|0")) {
|
||||
int frameNum = Integer.parseInt(frame);
|
||||
if (target.equals("/")) {
|
||||
lda.stage.gotoFrame(frameNum);
|
||||
} else {
|
||||
Object member = lda.stage.getMember(target);
|
||||
if (member instanceof DisplayObject) {
|
||||
((DisplayObject) member).gotoFrame(frameNum);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String frameLabel = frame;
|
||||
if (target.equals("/")) {
|
||||
lda.stage.gotoLabel(frameLabel);
|
||||
} else {
|
||||
Object member = lda.stage.getMember(target);
|
||||
if (member instanceof DisplayObject) {
|
||||
((DisplayObject) member).gotoLabel(frameLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem frame = stack.pop();
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -36,6 +37,15 @@ public class ActionPop extends Action {
|
||||
super(0x17, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
lda.stack.pop();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Pop";
|
||||
|
||||
@@ -367,6 +367,13 @@ public class ActionPush extends Action {
|
||||
ConstantIndex constantIndex = (ConstantIndex) value;
|
||||
List<String> cPool = lda.constantPool != null ? lda.constantPool : constantPool;
|
||||
lda.stack.push(constantIndex.toStringNoQ(cPool, true));
|
||||
} else if (value instanceof RegisterNumber) {
|
||||
int rn = ((RegisterNumber) value).number;
|
||||
if (lda.localRegisters.containsKey(rn)) {
|
||||
lda.stack.push(lda.localRegisters.get(rn));
|
||||
} else {
|
||||
lda.stack.push(Undefined.INSTANCE);
|
||||
}
|
||||
} else {
|
||||
lda.stack.push(value);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.RandomNumberActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -42,6 +43,15 @@ public class ActionRandomNumber extends Action {
|
||||
return "RandomNumber";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 1) {
|
||||
return false;
|
||||
}
|
||||
lda.stack.push(RandomNumberActionItem.getResult(lda.pop()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem maximum = stack.pop();
|
||||
|
||||
@@ -18,7 +18,10 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.RemoveSpriteActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -42,6 +45,16 @@ public class ActionRemoveSprite extends Action {
|
||||
return "RemoveSprite";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
lda.stage.removeMember(target);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem target = stack.pop();
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DecrementActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GetPropertyActionItem;
|
||||
@@ -29,6 +31,7 @@ import com.jpexs.decompiler.flash.action.model.StoreRegisterActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.TemporaryRegister;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.PreDecrementActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.PreIncrementActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -52,6 +55,21 @@ public class ActionSetProperty extends Action {
|
||||
return "SetProperty";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
Object value = lda.pop();
|
||||
int index = (int) (double) lda.popAsNumber();
|
||||
String target = lda.popAsString();
|
||||
Object member = lda.stage.getMember(target);
|
||||
if (member instanceof ActionScriptObject) {
|
||||
((ActionScriptObject) member).setProperty(index, value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem value = stack.pop().getThroughDuplicate();
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.SetTarget2ActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -42,6 +43,16 @@ public class ActionSetTarget2 extends Action {
|
||||
return "SetTarget2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String target = lda.popAsString();
|
||||
lda.target = lda.stage.getMember(target);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem target = stack.pop();
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.DisplayObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.StartDragActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
@@ -43,6 +45,14 @@ public class ActionStartDrag extends Action {
|
||||
return "StartDrag";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.target instanceof DisplayObject) {
|
||||
((DisplayObject) lda.target).startDrag();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem target = stack.pop();
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.TraceActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -42,6 +43,12 @@ public class ActionTrace extends Action {
|
||||
return "Trace";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
lda.stage.trace(lda.pop());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem value = stack.pop();
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraph;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
@@ -138,6 +139,12 @@ public class ActionWaitForFrame2 extends Action implements ActionStore {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
//TODO: Execute - there's no wait yet
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) throws InterruptedException {
|
||||
GraphTargetItem frame = stack.pop();
|
||||
|
||||
@@ -18,6 +18,9 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptFunction;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.CallMethodActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -43,6 +46,26 @@ public class ActionCallMethod extends Action {
|
||||
return "CallMethod";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
String methodName = lda.popAsString();
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
int numArgs = (int) (double) lda.popAsNumber();
|
||||
if (lda.stack.size() < numArgs) {
|
||||
return false;
|
||||
}
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.pop());
|
||||
}
|
||||
|
||||
lda.stack.push(((ActionScriptFunction) obj.getMember(methodName)).execute(obj, args));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem methodName = stack.pop();
|
||||
|
||||
@@ -113,6 +113,7 @@ public class ActionConstantPool extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
lda.constantPool = constantPool;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptFunction;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.FunctionActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
@@ -60,6 +63,15 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
|
||||
public List<String> constantPool;
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
ActionScriptFunction f = new ActionScriptFunction(fileOffset, codeSize, functionName, paramNames, getRegNames());
|
||||
lda.stack.push(f);
|
||||
lda.functions.add(f);
|
||||
((ActionScriptObject) lda.target).setMember(functionName, f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public ActionDefineFunction(String functionName, List<String> paramNames, int codeSize, int version) {
|
||||
super(0x9B, 0);
|
||||
this.functionName = functionName;
|
||||
|
||||
@@ -18,7 +18,10 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DefineLocalActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -52,4 +55,14 @@ public class ActionDefineLocal2 extends Action {
|
||||
public int getStackPopCount(BaseLocalData localData, TranslateStack stack) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lda.localVariables.put(EcmaScript.toString(lda.pop()), Undefined.INSTANCE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,10 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DeleteActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -42,6 +45,16 @@ public class ActionDelete extends Action {
|
||||
return "Delete";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
String memberName = lda.popAsString();
|
||||
Object o = lda.pop();
|
||||
if (o instanceof ActionScriptObject) {
|
||||
((ActionScriptObject) o).setMember(memberName, Undefined.INSTANCE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem propertyName = stack.pop();
|
||||
|
||||
@@ -18,7 +18,10 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DeleteActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -42,6 +45,16 @@ public class ActionDelete2 extends Action {
|
||||
return "Delete2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
String memberName = lda.popAsString();
|
||||
Object o = lda.target; //should be current scope
|
||||
if (o instanceof ActionScriptObject) {
|
||||
((ActionScriptObject) o).setMember(memberName, Undefined.INSTANCE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem propertyName = stack.pop();
|
||||
|
||||
@@ -18,7 +18,10 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.EnumerateActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.Null;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -42,6 +45,25 @@ public class ActionEnumerate extends Action {
|
||||
return "Enumerate";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String objectName = lda.popAsString();
|
||||
lda.stack.push(Null.INSTANCE);
|
||||
|
||||
Object o = lda.stage.getMember(objectName);
|
||||
|
||||
if (o instanceof ActionScriptObject) {
|
||||
List<String> members = ((ActionScriptObject) o).enumerate();
|
||||
for (String m : members) {
|
||||
lda.stack.push(m);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem object = stack.pop();
|
||||
|
||||
@@ -18,7 +18,10 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.GetMemberActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -42,11 +45,26 @@ public class ActionGetMember extends Action {
|
||||
return "GetMember";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
String membername = lda.popAsString();
|
||||
Object obj = lda.pop();
|
||||
if (obj instanceof ActionScriptObject) {
|
||||
lda.stack.push(((ActionScriptObject) obj).getMember(membername));
|
||||
} else {
|
||||
lda.stack.push(Undefined.INSTANCE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem functionName = stack.pop();
|
||||
GraphTargetItem memberName = stack.pop();
|
||||
GraphTargetItem object = stack.pop();
|
||||
stack.push(new GetMemberActionItem(this, lineStartAction, object, functionName));
|
||||
stack.push(new GetMemberActionItem(this, lineStartAction, object, memberName));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptArray;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.InitArrayActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -38,6 +40,23 @@ public class ActionInitArray extends Action {
|
||||
super(0x42, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
int num = (int) (double) lda.popAsNumber();
|
||||
if (lda.stack.size() < num) {
|
||||
return false;
|
||||
}
|
||||
ActionScriptArray arr = new ActionScriptArray();
|
||||
for (int i = 0; i < num; i++) {
|
||||
arr.setValueAtIndex(i, lda.stack.pop());
|
||||
}
|
||||
lda.stack.push(arr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
long numArgs = popLong(stack);
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.InitObjectActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -43,6 +45,25 @@ public class ActionInitObject extends Action {
|
||||
return "InitObject";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
int num = (int) (double) (Double) lda.popAsNumber();
|
||||
if (lda.stack.size() < 2 * num) {
|
||||
return false;
|
||||
}
|
||||
ActionScriptObject obj = new ActionScriptObject();
|
||||
for (int i = 0; i < num; i++) {
|
||||
Object val = lda.pop();
|
||||
String name = lda.popAsString();
|
||||
obj.setMember(name, val);
|
||||
}
|
||||
lda.stack.push(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
long numArgs = popLong(stack);
|
||||
|
||||
@@ -18,6 +18,9 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptFunction;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.NewMethodActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -43,6 +46,28 @@ public class ActionNewMethod extends Action {
|
||||
return "NewMethod";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
String methodName = lda.popAsString();
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
int numArgs = (int) (double) lda.popAsNumber();
|
||||
if (lda.stack.size() < numArgs) {
|
||||
return false;
|
||||
}
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.pop());
|
||||
}
|
||||
ActionScriptObject nobj = new ActionScriptObject();
|
||||
|
||||
((ActionScriptFunction) obj.getMember(methodName)).execute(nobj, args);
|
||||
lda.stack.push(nobj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem methodName = stack.pop();
|
||||
|
||||
@@ -18,6 +18,9 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptFunction;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.NewObjectActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -43,6 +46,28 @@ public class ActionNewObject extends Action {
|
||||
return "NewObject";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
String objectName = lda.popAsString();
|
||||
int numArgs = (int) (double) (Double) lda.popAsNumber();
|
||||
if (lda.stack.size() < numArgs) {
|
||||
return false;
|
||||
}
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.stack.pop());
|
||||
}
|
||||
ActionScriptObject obj = new ActionScriptObject();
|
||||
//TODO:check type
|
||||
ActionScriptFunction constructor = (ActionScriptFunction) lda.stage.getMember(objectName);
|
||||
constructor.execute(obj, args);
|
||||
lda.stack.push(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem objectName = stack.pop();
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.DecrementActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.GetMemberActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.IncrementActionItem;
|
||||
@@ -51,6 +53,20 @@ public class ActionSetMember extends Action {
|
||||
return "SetMember";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
Object value = lda.pop();
|
||||
String memberName = lda.popAsString();
|
||||
Object obj = lda.pop();
|
||||
if (obj instanceof ActionScriptObject) {
|
||||
((ActionScriptObject) obj).setMember(memberName, value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem value = stack.pop().getThroughDuplicate();
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.StoreTypeAction;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.model.DecrementActionItem;
|
||||
@@ -32,6 +33,7 @@ import com.jpexs.decompiler.flash.action.model.TemporaryRegister;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItemPos;
|
||||
@@ -50,6 +52,17 @@ public class ActionStoreRegister extends Action implements StoreTypeAction {
|
||||
|
||||
public int registerNumber;
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object value = lda.pop();
|
||||
lda.localRegisters.put(registerNumber, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public ActionStoreRegister(int registerNumber) {
|
||||
super(0x87, 1);
|
||||
this.registerNumber = registerNumber;
|
||||
|
||||
@@ -18,7 +18,9 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.TargetPathActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -42,6 +44,22 @@ public class ActionTargetPath extends Action {
|
||||
return "TargetPath";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Object obj = lda.pop();
|
||||
|
||||
String path = lda.stage.getMemberPath(obj);
|
||||
if (path == null) {
|
||||
lda.stack.push(Undefined.INSTANCE);
|
||||
} else {
|
||||
lda.stack.push(path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem object = stack.pop();
|
||||
|
||||
@@ -20,6 +20,9 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptWith;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.WithActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
@@ -51,6 +54,17 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
this.codeSize = codeSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
ActionScriptWith w = new ActionScriptWith(obj, fileOffset, codeSize);
|
||||
lda.withs.add(w);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean parseDivision(long size, FlasmLexer lexer) {
|
||||
codeSize = (int) (size - getHeaderSize());
|
||||
|
||||
@@ -18,7 +18,10 @@ package com.jpexs.decompiler.flash.action.swf6;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.EnumerateActionItem;
|
||||
import com.jpexs.decompiler.flash.ecma.Null;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -52,4 +55,21 @@ public class ActionEnumerate2 extends Action {
|
||||
public int getStackPopCount(BaseLocalData localData, TranslateStack stack) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Object o = lda.pop();
|
||||
lda.stack.push(Null.INSTANCE);
|
||||
|
||||
if (o instanceof ActionScriptObject) {
|
||||
List<String> members = ((ActionScriptObject) o).enumerate();
|
||||
for (String m : members) {
|
||||
lda.stack.push(m);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.swf6;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.InstanceOfActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -42,6 +44,45 @@ public class ActionInstanceOf extends Action {
|
||||
return "InstanceOf";
|
||||
}
|
||||
|
||||
public static boolean getInstanceOfResult(Object a, Object b) {
|
||||
ActionScriptObject type = (ActionScriptObject) b;
|
||||
ActionScriptObject obj = (ActionScriptObject) a;
|
||||
|
||||
ActionScriptObject pobj = obj;
|
||||
|
||||
if (pobj.getImplementsObjs().contains(type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
while (pobj.getExtendsObj() != null) {
|
||||
if (pobj.getExtendsObj() == type) {
|
||||
return true;
|
||||
}
|
||||
pobj = (ActionScriptObject) pobj.getExtendsObj();
|
||||
if (pobj.getImplementsObjs().contains(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
Object type = lda.stack.pop();
|
||||
Object obj = lda.stack.pop();
|
||||
if (getInstanceOfResult(obj, type)) {
|
||||
lda.stack.push(Boolean.TRUE);
|
||||
} else {
|
||||
lda.stack.push(Boolean.FALSE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem a = stack.pop();
|
||||
|
||||
@@ -18,7 +18,11 @@ package com.jpexs.decompiler.flash.action.swf7;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.CastOpActionItem;
|
||||
import com.jpexs.decompiler.flash.action.swf6.ActionInstanceOf;
|
||||
import com.jpexs.decompiler.flash.ecma.Null;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
@@ -42,6 +46,21 @@ public class ActionCastOp extends Action {
|
||||
return "CastOp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
ActionScriptObject constr = (ActionScriptObject) lda.pop();
|
||||
if (ActionInstanceOf.getInstanceOfResult(obj, constr)) {
|
||||
lda.stack.push(obj);
|
||||
} else {
|
||||
lda.stack.push(Null.INSTANCE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem object = stack.pop();
|
||||
|
||||
@@ -20,6 +20,9 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptFunction;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.FunctionActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
@@ -85,6 +88,15 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
|
||||
public List<String> constantPool;
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
ActionScriptFunction f = new ActionScriptFunction(fileOffset, codeSize, functionName, paramNames, getRegNames());
|
||||
lda.stack.push(f);
|
||||
lda.functions.add(f);
|
||||
((ActionScriptObject) lda.target).setMember(functionName, f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public ActionDefineFunction2(String functionName, boolean preloadParentFlag, boolean preloadRootFlag, boolean suppressSuperFlag, boolean preloadSuperFlag, boolean suppressArgumentsFlag, boolean preloadArgumentsFlag, boolean suppressThisFlag, boolean preloadThisFlag, boolean preloadGlobalFlag, int registerCount, int codeSize, int version, List<String> paramNames, List<Integer> paramRegisters) {
|
||||
super(0x8E, 0);
|
||||
this.functionName = functionName;
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.swf7;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.ExtendsActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -42,6 +44,24 @@ public class ActionExtends extends Action {
|
||||
return "Extends";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
//TODO: check if its really ActionScriptObject ?
|
||||
ActionScriptObject superClass = (ActionScriptObject) lda.pop();
|
||||
ActionScriptObject subClass = (ActionScriptObject) lda.pop();
|
||||
ActionScriptObject newClass = new ActionScriptObject();
|
||||
newClass.setMember("proto", superClass.getMember("prototype"));
|
||||
newClass.setMember("constructor", superClass);
|
||||
subClass.setMember("prototype", newClass);
|
||||
|
||||
subClass.setExtendsObj(superClass);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem superclass = stack.pop();
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.swf7;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.ImplementsOpActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -43,6 +45,25 @@ public class ActionImplementsOp extends Action {
|
||||
return "ImplementsOp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
//TODO: check if its really scriptobject?
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
int num = (int) (double) lda.popAsNumber();
|
||||
List<Object> interfaces = new ArrayList<>();
|
||||
if (lda.stack.size() < num) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < num; i++) {
|
||||
interfaces.add(lda.stack.pop());
|
||||
}
|
||||
obj.setImplementsObjs(interfaces);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem subclass = stack.pop();
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.swf7;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.ThrowActionItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -42,6 +43,12 @@ public class ActionThrow extends Action {
|
||||
return "Throw";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
//FIXME!!!
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
GraphTargetItem object = stack.pop();
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.ActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.TryActionItem;
|
||||
@@ -70,6 +71,12 @@ public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
|
||||
private final int version;
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
//FIXME!!!
|
||||
return false;
|
||||
}
|
||||
|
||||
public ActionTry(boolean catchInRegisterFlag, boolean finallyBlockFlag, boolean catchBlockFlag, String catchName, int catchRegister, long trySize, long catchSize, long finallySize, int version) {
|
||||
super(0x8F, 0);
|
||||
this.catchInRegisterFlag = catchInRegisterFlag;
|
||||
|
||||
Reference in New Issue
Block a user