diff --git a/CHANGELOG.md b/CHANGELOG.md index a903a3c37..92469add4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased] ### Added - AS2 classes: maintain order of variables, and methods (place variables before methods) +- AS1/2: displaying script path in the error log when jump to invalid address ### Changed - AS1/2 direct editation - generated constantpool is sorted according to ActionPush position diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index af9a30818..1b3da466d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -2035,7 +2035,7 @@ public final class SWF implements SWFContainerItem, Timelined { ip = code.adr2pos(addr); addr += size; int nextip = code.adr2pos(addr); - getVariables(aLocalData.insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(aLocalData.insideDoInitAction, code.getActions().subList(ip, nextip), code.version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path + (cntName == null ? "" : "/" + cntName)); + getVariables(aLocalData.insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(path, aLocalData.insideDoInitAction, code.getActions().subList(ip, nextip), code.version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path + (cntName == null ? "" : "/" + cntName)); ip = nextip; } List> r = new ArrayList<>(); @@ -2136,7 +2136,7 @@ public final class SWF implements SWFContainerItem, Timelined { ActionList actions = src.getActions(); actionsMap.put(src, actions); boolean insideDoInitAction = src instanceof DoInitActionTag; - getVariables(insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(insideDoInitAction, actions, version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path); + getVariables(insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(path, insideDoInitAction, actions, version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path); return ret; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java index 07436c060..d2bde66db 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -65,8 +65,8 @@ public class ActionGraph extends Graph { private boolean insideDoInitAction; - public ActionGraph(boolean insideDoInitAction, List code, HashMap registerNames, HashMap variables, HashMap functions, int version) { - super(new ActionGraphSource(insideDoInitAction, code, version, registerNames, variables, functions), new ArrayList<>()); + public ActionGraph(String path, boolean insideDoInitAction, List code, HashMap registerNames, HashMap variables, HashMap functions, int version) { + super(new ActionGraphSource(path, insideDoInitAction, code, version, registerNames, variables, functions), new ArrayList<>()); this.insideDoInitAction = insideDoInitAction; } @@ -76,7 +76,7 @@ public class ActionGraph extends Graph { public static List translateViaGraph(boolean insideDoInitAction, HashMap registerNames, HashMap variables, HashMap functions, List code, int version, int staticOperation, String path) throws InterruptedException { - ActionGraph g = new ActionGraph(insideDoInitAction, code, registerNames, variables, functions, version); + ActionGraph g = new ActionGraph(path, insideDoInitAction, code, registerNames, variables, functions, version); ActionLocalData localData = new ActionLocalData(insideDoInitAction, registerNames); g.init(localData); return g.translate(localData, staticOperation, path); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java index 4b576a1c6..e1458a84b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java @@ -48,17 +48,20 @@ public class ActionGraphSource extends GraphSource { private final boolean insideDoInitAction; + private final String path; + public List getActions() { return actions; } - public ActionGraphSource(boolean insideDoInitAction, List actions, int version, HashMap registerNames, HashMap variables, HashMap functions) { + public ActionGraphSource(String path, boolean insideDoInitAction, List actions, int version, HashMap registerNames, HashMap variables, HashMap functions) { this.actions = actions; this.version = version; this.registerNames = registerNames; this.variables = variables; this.functions = functions; this.insideDoInitAction = insideDoInitAction; + this.path = path; } @Override @@ -139,7 +142,7 @@ public class ActionGraphSource extends GraphSource { } //ret = adr2posInside(adr); if (ret == -1) { - Logger.getLogger(ActionGraphSource.class.getName()).log(Level.SEVERE, "Address loc" + Helper.formatAddress(adr) + " not found"); + Logger.getLogger(ActionGraphSource.class.getName()).log(Level.SEVERE, "{0} - address loc{1} not found", new Object[]{path, Helper.formatAddress(adr)}); /*System.err.println("Addr loc"+Helper.formatAddress(adr)+" not found"); int pos=0; for(long l:posCache){ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoActionTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoActionTag.java index 4389b3e7b..a274a9209 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoActionTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoActionTag.java @@ -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.tags; import com.jpexs.decompiler.flash.DisassemblyListener; @@ -140,7 +141,7 @@ public class DoActionTag extends Tag implements ASMSource { actions = getActions(); } - return Action.actionsToSource(this, actions, toString()/*FIXME?*/, writer); + return Action.actionsToSource(this, actions, getScriptName(), writer); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index 2ffab0cf9..951cfc90a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -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.tags; import com.jpexs.decompiler.flash.DisassemblyListener; @@ -148,7 +149,7 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource { actions = getActions(); } - return Action.actionsToSource(this, actions, toString()/*FIXME?*/, writer); + return Action.actionsToSource(this, actions, getScriptName(), writer); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonAction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonAction.java index d03e2ed96..0404f998c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonAction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonAction.java @@ -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.tags.base; import com.jpexs.decompiler.flash.DisassemblyListener; @@ -70,7 +71,7 @@ public class ButtonAction implements ASMSource { actions = getActions(); } - return Action.actionsToSource(this, actions, toString()/*FIXME?*/, writer); + return Action.actionsToSource(this, actions, getScriptName(), writer); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java index dc9dbc44d..f5448ca69 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java @@ -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.types; import com.jpexs.decompiler.flash.DisassemblyListener; @@ -195,7 +196,7 @@ public class BUTTONCONDACTION implements ASMSource, Serializable { actions = getActions(); } - return Action.actionsToSource(this, actions, toString()/*FIXME?*/, writer); + return Action.actionsToSource(this, actions, getScriptName(), writer); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java index d81c8dfbc..b01fda5d2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java @@ -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.types; import com.jpexs.decompiler.flash.DisassemblyListener; @@ -197,7 +198,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable { actions = getActions(); } - return Action.actionsToSource(this, actions, toString()/*FIXME?*/, writer); + return Action.actionsToSource(this, actions, getScriptName(), writer); } /** diff --git a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index 80210f8ee..f9acb01be 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -941,7 +941,7 @@ public class ActionPanel extends JPanel implements SearchListener(), new HashMap<>(), new HashMap<>(), SWF.DEFAULT_VERSION), ""); + GraphDialog gf = new GraphDialog(mainPanel.getMainFrame().getWindow(), new ActionGraph(this.src.getScriptName(), insideDoInitAction, lastCode, new HashMap<>(), new HashMap<>(), new HashMap<>(), SWF.DEFAULT_VERSION), ""); gf.setVisible(true); } catch (InterruptedException ex) { logger.log(Level.SEVERE, null, ex);