diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java index c2a2a143a..55f25e910 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.special.ActionEnd; -import com.jpexs.decompiler.flash.action.special.ActionNop; +import com.jpexs.decompiler.flash.action.special.ActionUnknown; import com.jpexs.decompiler.flash.action.swf3.ActionGetURL; import com.jpexs.decompiler.flash.action.swf3.ActionGoToLabel; import com.jpexs.decompiler.flash.action.swf3.ActionGotoFrame; @@ -1896,9 +1896,7 @@ public class SWFInputStream implements AutoCloseable { //skip(actionLength); }*/ //throw new UnknownActionException(actionCode); - Action r = new ActionNop(); - r.actionCode = actionCode; - r.actionLength = actionLength; + Action r = new ActionUnknown(actionCode, actionLength); if (Configuration.useDetailedLogging.get()) { logger.log(Level.SEVERE, "Unknown action code: {0}", actionCode); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java index df08e724c..fe169ffc0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java @@ -117,12 +117,12 @@ public abstract class Action implements GraphSourceItem { /** * Action type identifier */ - public int actionCode; + private int actionCode; /** * Length of action data */ - public int actionLength; + protected int actionLength; private long address; @@ -187,6 +187,15 @@ public abstract class Action implements GraphSourceItem { return address; } + /** + * Return code of this action + * + * @return code of this action + */ + public int getActionCode() { + return actionCode; + } + /** * Gets all addresses which are referenced from this action and/or * subactions @@ -1068,7 +1077,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; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 4047d480d..20f9d8d39 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.action.special.ActionDeobfuscateJump; import com.jpexs.decompiler.flash.action.special.ActionEnd; import com.jpexs.decompiler.flash.action.special.ActionNop; import com.jpexs.decompiler.flash.action.special.ActionStore; +import com.jpexs.decompiler.flash.action.special.ActionUnknown; import com.jpexs.decompiler.flash.action.swf4.ActionIf; import com.jpexs.decompiler.flash.action.swf4.ActionJump; import com.jpexs.decompiler.flash.action.swf4.ActionPush; @@ -700,7 +701,7 @@ public class ActionListReader { int actionLengthWithHeader = a.getTotalActionLength(); // unknown action, replace with jump - if (a instanceof ActionNop) { + if (a instanceof ActionUnknown && a.getActionCode() >= 0x80) { ActionJump aJump = new ActionDeobfuscateJump(0); int jumpLength = aJump.getTotalActionLength(); aJump.setAddress(a.getAddress()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionNop.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionNop.java index 482132a91..782892885 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionNop.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionNop.java @@ -34,6 +34,10 @@ public class ActionNop extends Action { super(-1, 0); } + protected ActionNop(int actionCode) { + super(actionCode, 0); + } + @Override public String toString() { return "Nop"; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionUnknown.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionUnknown.java new file mode 100644 index 000000000..0273d1aee --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionUnknown.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010-2016 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.action.special; + +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; +import com.jpexs.helpers.Helper; +import java.util.HashMap; +import java.util.List; + +/** + * + * @author JPEXS + */ +public class ActionUnknown extends ActionNop { + + public ActionUnknown(int actionCode, int actionLength) { + super(actionCode); + this.actionLength = actionLength; + } + + @Override + public String toString() { + return "Unknown_" + Helper.byteToHex((byte) getActionCode()); + } + + @Override + public boolean execute(LocalDataArea lda) { + return true; + } + + @Override + public void translate(GraphSourceItem lineStartItem, TranslateStack stack, List output, HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { + } +}