resolve as2 constants button

This commit is contained in:
2015-05-02 22:09:28 +02:00
parent 913b3f22e3
commit 0702259c88
15 changed files with 43 additions and 21 deletions
@@ -131,13 +131,11 @@ public class ActionListReader {
* @throws java.lang.InterruptedException
*/
public static ActionList readActionList(List<DisassemblyListener> listeners, SWFInputStream sis, int version, int ip, int endIp, String path, int deobfuscationMode) throws IOException, InterruptedException {
ConstantPool cpool = new ConstantPool();
// Map of the actions. Use TreeMap to sort the keys in ascending order
// actionMap and nextOffsets should contain exaclty the same keys
Map<Long, Action> actionMap = new TreeMap<>();
Map<Long, Long> nextOffsets = new HashMap<>();
Action entryAction = readActionListAtPos(listeners, cpool,
Action entryAction = readActionListAtPos(listeners, null,
sis, actionMap, nextOffsets,
ip, 0, endIp, path, false, new ArrayList<Long>());
@@ -238,12 +236,10 @@ public class ActionListReader {
}
public static List<Action> getOriginalActions(SWFInputStream sis, int startIp, int endIp) throws IOException, InterruptedException {
ConstantPool cpool = new ConstantPool();
// Map of the actions. Use TreeMap to sort the keys in ascending order
Map<Long, Action> actionMap = new TreeMap<>();
Map<Long, Long> nextOffsets = new HashMap<>();
readActionListAtPos(new ArrayList<DisassemblyListener>(), cpool,
readActionListAtPos(new ArrayList<DisassemblyListener>(), null,
sis, actionMap, nextOffsets,
startIp, startIp, endIp + 1, "", false, new ArrayList<Long>());
@@ -690,7 +686,7 @@ public class ActionListReader {
sis.seek((int) ip);
Action a;
if ((a = sis.readAction(cpool)) == null) {
if ((a = sis.readAction()) == null) {
break;
}
@@ -729,10 +725,7 @@ public class ActionListReader {
if (a instanceof ActionPush && cpool != null) {
((ActionPush) a).constantPool = cpool.constants;
} else if (a instanceof ActionConstantPool) {
if (cpool == null) {
cpool = new ConstantPool();
}
cpool.setNew(((ActionConstantPool) a).constantPool);
cpool = new ConstantPool(((ActionConstantPool) a).constantPool);
} else if (a instanceof ActionIf) {
ActionIf aIf = (ActionIf) a;
long nIp = ip + actionLengthWithHeader + aIf.getJumpOffset();
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.parser.pcode;
import com.jpexs.decompiler.flash.action.Action;
@@ -22,7 +22,6 @@ 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.model.ConstantPool;
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;
@@ -46,7 +45,7 @@ public class ActionWaitForFrame extends Action implements ActionStore {
public List<Action> skipped;
public ActionWaitForFrame(int actionLength, SWFInputStream sis, ConstantPool cpool) throws IOException {
public ActionWaitForFrame(int actionLength, SWFInputStream sis) throws IOException {
super(0x8A, actionLength);
frame = sis.readUI16("frame");
skipCount = sis.readUI8("skipCount");
@@ -22,7 +22,6 @@ 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.model.ConstantPool;
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;
@@ -60,7 +59,7 @@ public class ActionWaitForFrame2 extends Action implements ActionStore {
skipCount = store.size();
}
public ActionWaitForFrame2(int actionLength, SWFInputStream sis, ConstantPool cpool) throws IOException {
public ActionWaitForFrame2(int actionLength, SWFInputStream sis) throws IOException {
super(0x8D, actionLength);
skipCount = sis.readUI8("skipCount");
skipped = new ArrayList<>();
@@ -46,6 +46,7 @@ public class ConstantIndex implements Serializable {
}
}
}
return "constant" + index;
}
@@ -58,6 +59,7 @@ public class ConstantIndex implements Serializable {
}
}
}
return "constant" + index;
}
}