diff --git a/src/com/jpexs/decompiler/flash/action/Action.java b/src/com/jpexs/decompiler/flash/action/Action.java index ffb46cd9d..cbd6a8ba7 100644 --- a/src/com/jpexs/decompiler/flash/action/Action.java +++ b/src/com/jpexs/decompiler/flash/action/Action.java @@ -19,8 +19,6 @@ package com.jpexs.decompiler.flash.action; import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.BaseLocalData; import com.jpexs.decompiler.flash.DisassemblyListener; -import com.jpexs.decompiler.flash.SWF; -import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.action.model.ActionItem; import com.jpexs.decompiler.flash.action.model.ConstantPool; @@ -42,7 +40,6 @@ import com.jpexs.decompiler.flash.action.model.clauses.ClassActionItem; import com.jpexs.decompiler.flash.action.model.clauses.InterfaceActionItem; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol; -import com.jpexs.decompiler.flash.action.parser.pcode.ASMParser; import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.script.VariableActionItem; import com.jpexs.decompiler.flash.action.special.ActionEnd; @@ -59,7 +56,6 @@ import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; -import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.flash.helpers.collections.MyEntry; import com.jpexs.decompiler.flash.tags.base.ASMSource; @@ -402,11 +398,10 @@ public class Action implements GraphSourceItem { * @param version SWF version * @param exportMode PCode or hex? * @param writer - * @param path * @return HilightedTextWriter */ - public static GraphTextWriter actionsToString(List listeners, long address, List list, int version, ScriptExportMode exportMode, GraphTextWriter writer, String path) { - return actionsToString(listeners, address, list, new ArrayList(), version, exportMode, writer, path); + public static GraphTextWriter actionsToString(List listeners, long address, List list, int version, ScriptExportMode exportMode, GraphTextWriter writer) { + return actionsToString(listeners, address, list, new ArrayList(), version, exportMode, writer); } /** @@ -419,10 +414,9 @@ public class Action implements GraphSourceItem { * @param constantPool Constant pool * @param version SWF version * @param hex Add hexadecimal? - * @param path * @return HilightedTextWriter */ - private static GraphTextWriter actionsToString(List listeners, long address, List list, List constantPool, int version, ScriptExportMode exportMode, GraphTextWriter writer, String path) { + private static GraphTextWriter actionsToString(List listeners, long address, List list, List constantPool, int version, ScriptExportMode exportMode, GraphTextWriter writer) { long offset; List importantOffsets = getActionsAllRefs(list); /*List cps = SWFInputStream.getConstantPool(new ArrayList(), new ActionGraphSource(list, version, new HashMap(), new HashMap(), new HashMap()), 0, version, path); @@ -544,8 +538,9 @@ public class Action implements GraphSourceItem { } if (fixBranch > -1) { - writer.appendNoHilight("FFDec_DeobfuscatePop").newLine(); - if (fixBranch == 0) { //jump + writer.appendNoHilight("FFDec_DeobfuscatePop"); + if (fixBranch == 0) { //jump + writer.newLine(); writer.appendNoHilight("Jump loc"); writer.appendNoHilight(Helper.formatAddress(a.getAddress() + a.getTotalActionLength() + ((ActionIf) a).getJumpOffset())); } else { @@ -598,7 +593,6 @@ public class Action implements GraphSourceItem { * @param container * @param knownAddreses List of important offsets to mark as labels * @param constantPool Constant pool - * @param version SWF version * @param exportMode PCode or hex? * @return String of P-code source */ diff --git a/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 2713d8895..6949f587e 100644 --- a/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -142,7 +142,7 @@ public class ActionListReader { if (actionMap.isEmpty()) { return actions; } - + Map> containerLastActions = new HashMap<>(); List addresses = new ArrayList<>(actionMap.keySet()); getContainerLastActions(actionMap, addresses, containerLastActions); @@ -259,11 +259,9 @@ public class ActionListReader { Action lastAction = actions.get(actions.size() - 1); int endIp = (int) lastAction.getAddress(); - List retdups = new ArrayList<>(endIp); + List retMap = new ArrayList<>(endIp); for (int i = 0; i < endIp; i++) { - Action a = new ActionNop(); - a.setAddress(i); - retdups.add(a); + retMap.add(null); } List actionMap = new ArrayList<>(endIp); for (int i = 0; i <= endIp; i++) { @@ -292,15 +290,15 @@ public class ActionListReader { new ActionLocalData(), new Stack(), new ConstantPool(), - actionMap, ip, retdups, ip, endIp, path, + actionMap, ip, retMap, ip, endIp, path, new HashMap(), false, new HashMap>(), version, 0, maxRecursionLevel); ActionList ret = new ActionList(); Action last = null; - for (Action a : retdups) { - if (a != last) { + for (Action a : retMap) { + if (a != last && a != null) { ret.add(a); } last = a; @@ -849,18 +847,7 @@ public class ActionListReader { } } } - int nopos = -1; for (int i = 0; i < actionLen; i++) { - if (a instanceof ActionNop) { - int prevPos = (int) a.getAddress(); - a = new ActionNop(); - a.setAddress(prevPos); - nopos++; - if (nopos > 0) { - a.setAddress(a.getAddress() + 1); - } - - } ret.set(ip + i, a); } diff --git a/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java b/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java index b7fa0dcbc..4e0752779 100644 --- a/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java +++ b/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java @@ -66,7 +66,7 @@ public class ActionWaitForFrame extends Action implements ActionStore { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SWFOutputStream sos = new SWFOutputStream(baos, version); try { - sos.writeUI16(frame); + sos.writeUI16(frame); sos.writeUI8(skipCount); sos.close(); } catch (IOException e) { diff --git a/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java b/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java index b5e3bd2d9..2af322d75 100644 --- a/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java +++ b/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.action.swf4; 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.ActionGraphSource; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; diff --git a/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java b/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java index a4aaa88fa..b0e2c6453 100644 --- a/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java +++ b/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java @@ -146,7 +146,7 @@ public class DefineButtonTag extends ButtonTag implements ASMSource { if (actions == null) { actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer, toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer); } /** diff --git a/src/com/jpexs/decompiler/flash/tags/DoActionTag.java b/src/com/jpexs/decompiler/flash/tags/DoActionTag.java index a2c92adb4..12dc4ec71 100644 --- a/src/com/jpexs/decompiler/flash/tags/DoActionTag.java +++ b/src/com/jpexs/decompiler/flash/tags/DoActionTag.java @@ -96,7 +96,7 @@ public class DoActionTag extends Tag implements ASMSource { if (actions == null) { actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer, toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer); } /** diff --git a/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index 090e6baac..e0b81a2c4 100644 --- a/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -110,7 +110,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { if (actions == null) { actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer, toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer); } @Override diff --git a/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java b/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java index d08dcbe0a..27bc560de 100644 --- a/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java +++ b/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java @@ -165,7 +165,7 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, S if (actions == null) { actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer, toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer); } /** diff --git a/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java b/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java index 2c29b1168..19e6c9bd8 100644 --- a/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java +++ b/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java @@ -181,7 +181,7 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S if (actions == null) { actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer, toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, swf.version, exportMode, writer); } /**