From b3880ab5de66e882935c0475268414ce2d64154d Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Sun, 18 Jan 2015 17:44:57 +0100 Subject: [PATCH] swf reference removed from ABC class --- .../src/com/jpexs/decompiler/flash/abc/ABC.java | 10 +++++----- .../jpexs/decompiler/flash/abc/ScriptPack.java | 5 +++-- .../decompiler/flash/tags/ABCContainerTag.java | 3 +++ .../decompiler/flash/tags/DoABCDefineTag.java | 17 +++++++---------- .../jpexs/decompiler/flash/tags/DoABCTag.java | 7 ------- src/com/jpexs/decompiler/flash/gui/Main.java | 2 ++ 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java index c681e1456..186849a41 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -90,8 +90,6 @@ public class ABC { private static final Logger logger = Logger.getLogger(ABC.class.getName()); private AVM2Deobfuscation deobfuscation; @Internal - public SWF swf; - @Internal public ABCContainerTag parentTag; /* Map from multiname index of namespace value to namespace name**/ @@ -99,7 +97,6 @@ public class ABC { public ABC(SWF swf) { this.deobfuscation = null; - this.swf = swf; constants.constant_double.add(null); constants.constant_int.add(null); constants.constant_uint.add(null); @@ -109,6 +106,10 @@ public class ABC { constants.constant_namespace_set.add(null); } + public SWF getSwf() { + return parentTag.getSwf(); + } + public int addMethodBody(MethodBody body) { bodies.add(body); bodyIdxFromMethodIdx = null; @@ -339,7 +340,6 @@ public class ABC { } public ABC(ABCInputStream ais, SWF swf, ABCContainerTag tag) throws IOException { - this.swf = swf; this.parentTag = tag; minor_version = ais.readU16("minor_version"); major_version = ais.readU16("major_version"); @@ -1207,7 +1207,7 @@ public class ABC { String scriptName = pack.getPathScriptName() + ".as"; int oldIndex = pack.scriptIndex; int newIndex = script_info.size(); - String documentClass = swf.getDocumentClass(); + String documentClass = getSwf().getDocumentClass(); boolean isDocumentClass = documentClass != null && documentClass.equals(pack.getClassPath().toString()); ScriptInfo si = script_info.get(oldIndex); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 468758402..78325ef1e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.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.abc; import com.jpexs.decompiler.flash.SWF; @@ -54,7 +55,7 @@ public class ScriptPack extends AS3ClassTreeItem { @Override public SWF getSwf() { - return abc.swf; + return abc.getSwf(); } public ClassPath getClassPath() { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/ABCContainerTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/ABCContainerTag.java index 1a5e27961..9d11fc6d6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/ABCContainerTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/ABCContainerTag.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.tags; +import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.abc.ABC; /** @@ -25,4 +26,6 @@ import com.jpexs.decompiler.flash.abc.ABC; public interface ABCContainerTag extends Comparable { public ABC getABC(); + + public SWF getSwf(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java index a1a5e91c9..65866817a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java @@ -38,16 +38,13 @@ import java.io.OutputStream; */ public class DoABCDefineTag extends Tag implements ABCContainerTag { - @Override - public ABC getABC() { - return abc; - } /** * ActionScript 3 bytecodes */ @HideInRawEdit @SWFField private final ABC abc; + /** * A 32-bit flags value, which may contain the following bits set: * kDoAbcLazyInitializeFlag = 1: Indicates that the ABC block should not be @@ -56,12 +53,18 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag { */ @SWFType(BasicType.UI32) public long flags; + /** * The name assigned to the bytecode. */ public String name; public static final int ID = 82; + @Override + public ABC getABC() { + return abc; + } + @Override public String getName() { return "DoABCDefine (" + name + ")"; @@ -96,12 +99,6 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag { abc = new ABC(ais, swf, this); } - @Override - public void setSwf(SWF swf) { - super.setSwf(swf); - abc.swf = swf; - } - /** * Gets data bytes * diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCTag.java index c341f6fd7..b07e637a8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoABCTag.java @@ -106,11 +106,4 @@ public class DoABCTag extends Tag implements ABCContainerTag { public int compareTo(ABCContainerTag o) { return 0; } - - @Override - public void setSwf(SWF swf) { - super.setSwf(swf); - abc.swf = swf; - } - } diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 768e13f15..ad1c6f9d8 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -32,6 +32,7 @@ import com.jpexs.decompiler.flash.abc.types.Namespace; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.console.CommandLineArgumentParser; import com.jpexs.decompiler.flash.console.ContextMenuTools; +import com.jpexs.decompiler.flash.exporters.swf.SwfFile; import com.jpexs.decompiler.flash.gui.debugger.Debugger; import com.jpexs.decompiler.flash.gui.proxy.ProxyFrame; import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin; @@ -317,6 +318,7 @@ public class Main { startWork(AppStrings.translate("work.reading.swf"), p); } }, Configuration.parallelSpeedUp.get()); + swf = new SwfFile().getSwf(); swf.file = sourceInfo.getFile(); swf.fileTitle = sourceInfo.getFileTitle(); result.add(swf);