Added Opening ABC file format (*.abc)

This commit is contained in:
Jindra Petřík
2022-11-20 12:02:49 +01:00
parent dd63487dd8
commit 344bdfa6ea
70 changed files with 1576 additions and 906 deletions

View File

@@ -31,7 +31,7 @@ import java.util.Set;
*
* @author JPEXS
*/
public class BinarySWFBundle implements SWFBundle {
public class BinarySWFBundle implements Bundle {
private final SWFSearch search;
@@ -55,7 +55,7 @@ public class BinarySWFBundle implements SWFBundle {
}
@Override
public SeekableInputStream getSWF(String key) {
public SeekableInputStream getOpenable(String key) {
if (!key.startsWith("[")) {
return null;
}
@@ -75,7 +75,7 @@ public class BinarySWFBundle implements SWFBundle {
public Map<String, SeekableInputStream> getAll() {
Map<String, SeekableInputStream> ret = new LinkedHashMap<>();
for (String key : getKeys()) {
ret.put(key, getSWF(key));
ret.put(key, getOpenable(key));
}
return ret;
}
@@ -91,7 +91,7 @@ public class BinarySWFBundle implements SWFBundle {
}
@Override
public boolean putSWF(String key, InputStream is) {
public boolean putOpenable(String key, InputStream is) {
throw new UnsupportedOperationException("Save not supported for this type of bundle");
}
}

View File

@@ -26,13 +26,13 @@ import java.util.Set;
*
* @author JPEXS
*/
public interface SWFBundle {
public interface Bundle {
public int length();
public Set<String> getKeys();
public SeekableInputStream getSWF(String key) throws IOException;
public SeekableInputStream getOpenable(String key) throws IOException;
public Map<String, SeekableInputStream> getAll() throws IOException;
@@ -40,5 +40,5 @@ public interface SWFBundle {
public boolean isReadOnly();
public boolean putSWF(String key, InputStream is) throws IOException;
public boolean putOpenable(String key, InputStream is) throws IOException;
}

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.abc.types.ConvertData;
import com.jpexs.decompiler.flash.abc.types.ScriptInfo;
@@ -26,6 +27,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.HighlightedText;
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.helpers.ImmediateFuture;
import java.util.ArrayList;
import java.util.List;
@@ -48,7 +50,7 @@ public class DecompilerPool {
private final ThreadPoolExecutor executor;
private Map<SWF, List<Future<HighlightedText>>> swfToFutures = new WeakHashMap<>();
private Map<Openable, List<Future<HighlightedText>>> openableToFutures = new WeakHashMap<>();
public DecompilerPool() {
int threadCount = Configuration.getParallelThreadCount();
@@ -105,7 +107,8 @@ public class DecompilerPool {
pack.toSource(writer, script == null ? null : script.traits.traits, new ConvertData(), ScriptExportMode.AS, parallel, false);
HighlightedText result = new HighlightedText(writer);
SWF swf = pack.getSwf();
Openable openable = pack.getOpenable();
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC)openable).getSwf();
if (swf != null) {
swf.as3Cache.put(pack, result);
}
@@ -155,10 +158,10 @@ public class DecompilerPool {
public HighlightedText decompile(ASMSource src, ActionList actions) throws InterruptedException {
Future<HighlightedText> future = submitTask(src, actions, null);
SWF swf = src.getSwf();
if (!swfToFutures.containsKey(swf)) {
swfToFutures.put(swf, new ArrayList<>());
if (!openableToFutures.containsKey(swf)) {
openableToFutures.put(swf, new ArrayList<>());
}
swfToFutures.get(swf).add(future);
openableToFutures.get(swf).add(future);
try {
return future.get();
} catch (InterruptedException ex) {
@@ -167,7 +170,7 @@ public class DecompilerPool {
} catch (ExecutionException ex) {
Logger.getLogger(DecompilerPool.class.getName()).log(Level.SEVERE, null, ex);
} finally {
List<Future<HighlightedText>> futures = swfToFutures.get(swf);
List<Future<HighlightedText>> futures = openableToFutures.get(swf);
if (futures != null) {
futures.remove(future);
}
@@ -179,11 +182,11 @@ public class DecompilerPool {
public HighlightedText decompile(ScriptPack pack) throws InterruptedException {
Future<HighlightedText> future = submitTask(pack, null);
SWF swf = pack.getSwf();
if (!swfToFutures.containsKey(swf)) {
swfToFutures.put(swf, new ArrayList<>());
Openable openable = pack.getOpenable();
if (!openableToFutures.containsKey(openable)) {
openableToFutures.put(openable, new ArrayList<>());
}
swfToFutures.get(swf).add(future);
openableToFutures.get(openable).add(future);
try {
return future.get();
} catch (InterruptedException ex) {
@@ -192,7 +195,7 @@ public class DecompilerPool {
} catch (ExecutionException ex) {
Logger.getLogger(DecompilerPool.class.getName()).log(Level.SEVERE, null, ex);
} finally {
List<Future<HighlightedText>> futures = swfToFutures.get(swf);
List<Future<HighlightedText>> futures = openableToFutures.get(openable);
if (futures != null) {
futures.remove(future);
}
@@ -208,7 +211,7 @@ public class DecompilerPool {
}
public void destroySwf(SWF swf){
List<Future<HighlightedText>> futures = swfToFutures.get(swf);
List<Future<HighlightedText>> futures = openableToFutures.get(swf);
if(futures!=null){
for(Future<HighlightedText> future:futures){
future.cancel(true);

View File

@@ -28,7 +28,7 @@ import java.io.InputStream;
*
* @author JPEXS
*/
public class SWFSourceInfo {
public class OpenableSourceInfo {
private final InputStream inputStream;
@@ -39,8 +39,10 @@ public class SWFSourceInfo {
private final boolean detectBundle;
private boolean empty = false;
private OpenableSourceKind kind;
public SWFSourceInfo(String fileTitle) {
public OpenableSourceInfo(String fileTitle) {
this(null, null, fileTitle, false);
empty = true;
}
@@ -49,16 +51,31 @@ public class SWFSourceInfo {
return empty;
}
public SWFSourceInfo(InputStream inputStream, String file, String fileTitle) {
public OpenableSourceInfo(InputStream inputStream, String file, String fileTitle) {
this(inputStream, file, fileTitle, true);
}
public SWFSourceInfo(InputStream inputStream, String file, String fileTitle, boolean detectBundle) {
public OpenableSourceInfo(InputStream inputStream, String file, String fileTitle, boolean detectBundle) {
this.inputStream = inputStream;
this.file = file;
this.fileTitle = fileTitle;
this.detectBundle = detectBundle;
detectKind();
}
public OpenableSourceKind getKind() {
return kind;
}
private void detectKind() {
if (isBundle()) {
kind = OpenableSourceKind.BUNDLE;
} else if (this.file != null && this.file.endsWith(".abc")) {
kind = OpenableSourceKind.ABC;
} else {
kind = OpenableSourceKind.SWF;
}
}
public InputStream getInputStream() {
return inputStream;
}
@@ -69,6 +86,7 @@ public class SWFSourceInfo {
public void setFile(String file) {
this.file = file;
detectKind();
}
public String getFileTitle() {
@@ -95,12 +113,12 @@ public class SWFSourceInfo {
return false;
}
String extension = Path.getExtension(fileObj);
return (detectBundle) && (extension == null || !(extension.equals(".swf") || extension.equals(".gfx")));
return (detectBundle) && (extension == null || !(extension.equals(".swf") || extension.equals(".gfx") || extension.equals(".abc")));
}
return false;
}
public SWFBundle getBundle(boolean noCheck, SearchMode searchMode) throws IOException {
public Bundle getBundle(boolean noCheck, SearchMode searchMode) throws IOException {
if (!isBundle()) {
return null;
}
@@ -111,7 +129,7 @@ public class SWFSourceInfo {
case ".swc":
return new SWC(new File(file));
case ".zip":
return new ZippedSWFBundle(new File(file));
return new ZippedBundle(new File(file));
case ".iggy":
return new IggySwfBundle(new File(file));
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2010-2022 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;
/**
*
* @author JPEXS
*/
public enum OpenableSourceKind {
ABC, SWF, BUNDLE
}

View File

@@ -31,7 +31,7 @@ import org.xml.sax.helpers.DefaultHandler;
*
* @author JPEXS
*/
public class SWC extends ZippedSWFBundle {
public class SWC extends ZippedBundle {
public SWC(InputStream is) throws IOException {
super(is);

View File

@@ -140,7 +140,8 @@ import com.jpexs.decompiler.flash.timeline.FrameScript;
import com.jpexs.decompiler.flash.timeline.TagScript;
import com.jpexs.decompiler.flash.timeline.Timeline;
import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.decompiler.flash.treeitems.SWFList;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.OpenableList;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.decompiler.flash.types.ColorTransform;
import com.jpexs.decompiler.flash.types.MATRIX;
@@ -212,7 +213,7 @@ import java.util.zip.InflaterInputStream;
*
* @author JPEXS
*/
public final class SWF implements SWFContainerItem, Timelined {
public final class SWF implements SWFContainerItem, Timelined, Openable {
/**
* Default version of SWF file format
@@ -290,7 +291,7 @@ public final class SWF implements SWFContainerItem, Timelined {
public boolean gfx = false;
@Internal
public SWFList swfList;
public OpenableList openableList;
@Internal
private String file;
@@ -456,8 +457,8 @@ public final class SWF implements SWFContainerItem, Timelined {
abcList = null;
}
if (swfList != null) {
swfList.swfs.clear();
if (openableList != null) {
openableList.items.clear();
}
clearScriptCache();
@@ -979,12 +980,13 @@ public final class SWF implements SWFContainerItem, Timelined {
* @param os OutputStream to save SWF in
* @throws IOException
*/
@Override
public void saveTo(OutputStream os) throws IOException {
checkCharset();
byte[] uncompressedData = saveToByteArray();
compress(new ByteArrayInputStream(uncompressedData), os, compression, lzmaProperties);
}
public void saveTo(OutputStream os, boolean gfx) throws IOException {
checkCharset();
byte[] uncompressedData = saveToByteArray(gfx);
@@ -1186,6 +1188,7 @@ public final class SWF implements SWFContainerItem, Timelined {
isModified = value;
}
@Override
public void clearModified() {
for (Tag tag : getTags()) {
if (tag.isModified()) {
@@ -1501,7 +1504,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
@Override
public SWF getSwf() {
public SWF getOpenable() {
return this;
}
@@ -1514,6 +1517,7 @@ public final class SWF implements SWFContainerItem, Timelined {
return result;
}
@Override
public String getFile() {
return file;
}
@@ -1523,6 +1527,7 @@ public final class SWF implements SWFContainerItem, Timelined {
*
* @return file title
*/
@Override
public String getFileTitle() {
if (fileTitle != null) {
return fileTitle;
@@ -1530,6 +1535,7 @@ public final class SWF implements SWFContainerItem, Timelined {
return file;
}
@Override
public String getTitleOrShortFileName() {
if (fileTitle != null) {
return fileTitle;
@@ -1537,6 +1543,7 @@ public final class SWF implements SWFContainerItem, Timelined {
return new File(file).getName();
}
@Override
public String getShortFileName() {
return new File(getTitleOrShortFileName()).getName();
}
@@ -1547,13 +1554,14 @@ public final class SWF implements SWFContainerItem, Timelined {
*
* @return
*/
@Override
public String getShortPathTitle() {
if (binaryData != null) {
return binaryData.getSwf().getShortPathTitle() + "/DefineBinaryData (" + binaryData.getCharacterId() + ")";
}
if (swfList != null) {
if (swfList.isBundle()) {
return swfList.name + "/" + getTitleOrShortFileName();
if (openableList != null) {
if (openableList.isBundle()) {
return openableList.name + "/" + getTitleOrShortFileName();
}
}
return getTitleOrShortFileName();
@@ -1565,18 +1573,20 @@ public final class SWF implements SWFContainerItem, Timelined {
*
* @return
*/
@Override
public String getFullPathTitle() {
if (binaryData != null) {
return binaryData.getSwf().getFullPathTitle() + "/DefineBinaryData (" + binaryData.getCharacterId() + ")";
}
if (swfList != null) {
if (swfList.isBundle()) {
return swfList.sourceInfo.getFileTitleOrName() + "/" + getFileTitle();
if (openableList != null) {
if (openableList.isBundle()) {
return openableList.sourceInfo.getFileTitleOrName() + "/" + getFileTitle();
}
}
return getFileTitle();
}
@Override
public void setFile(String file) {
this.file = file;
fileTitle = null;
@@ -1584,8 +1594,8 @@ public final class SWF implements SWFContainerItem, Timelined {
public Date getFileModificationDate() {
try {
if (swfList != null && swfList.sourceInfo != null) {
String fileName = swfList.sourceInfo.getFile();
if (openableList != null && openableList.sourceInfo != null) {
String fileName = openableList.sourceInfo.getFile();
if (fileName != null) {
long lastModified = new File(fileName).lastModified();
if (lastModified > 0) {
@@ -2014,7 +2024,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
}
TagScript tagScript = new TagScript(treeItem.getSwf(), resultTag, subNodes);
TagScript tagScript = new TagScript((SWF) treeItem.getOpenable(), resultTag, subNodes);
return tagScript;
}
@@ -2882,7 +2892,8 @@ public final class SWF implements SWFContainerItem, Timelined {
public static void uncache(ScriptPack pack) {
if (pack != null) {
SWF swf = pack.getSwf();
Openable openable = pack.getOpenable();
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC)openable).getSwf();
if (swf != null) {
swf.as3Cache.remove(pack);
}
@@ -2913,7 +2924,8 @@ public final class SWF implements SWFContainerItem, Timelined {
public static boolean isCached(ScriptPack pack) {
if (pack != null) {
SWF swf = pack.getSwf();
Openable openable = pack.getOpenable();
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC)openable).getSwf();
if (swf != null) {
return swf.as3Cache.isCached(pack);
}
@@ -2946,7 +2958,8 @@ public final class SWF implements SWFContainerItem, Timelined {
public static HighlightedText getFromCache(ScriptPack pack) {
if (pack != null) {
SWF swf = pack.getSwf();
Openable openable = pack.getOpenable();
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC)openable).getSwf();
if (swf != null) {
return swf.as3Cache.get(pack);
}
@@ -3006,7 +3019,8 @@ public final class SWF implements SWFContainerItem, Timelined {
}
public static HighlightedText getCached(ScriptPack pack) throws InterruptedException {
SWF swf = pack.getSwf();
Openable openable = pack.getOpenable();
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC)openable).getSwf();
HighlightedText res;
if (swf != null) {
res = swf.as3Cache.get(pack);
@@ -3036,7 +3050,8 @@ public final class SWF implements SWFContainerItem, Timelined {
}
public static Future<HighlightedText> getCachedFuture(ScriptPack pack, ScriptDecompiledListener<HighlightedText> listener) throws InterruptedException {
SWF swf = pack.getSwf();
Openable openable = pack.getOpenable();
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC)openable).getSwf();
HighlightedText res;
if (swf != null) {
res = swf.as3Cache.get(pack);
@@ -3418,7 +3433,7 @@ public final class SWF implements SWFContainerItem, Timelined {
return (DefineSpriteTag) treeItem;
}
return treeItem.getSwf();
return (SWF) treeItem.getOpenable(); //??
}
public void packCharacterIds() {
@@ -4148,4 +4163,14 @@ public final class SWF implements SWFContainerItem, Timelined {
public void setFrameCount(int frameCount) {
this.frameCount = frameCount;
}
@Override
public void setOpenableList(OpenableList openableList) {
this.openableList = openableList;
}
@Override
public OpenableList getOpenableList() {
return openableList;
}
}

View File

@@ -38,7 +38,7 @@ import java.util.zip.ZipOutputStream;
*
* @author JPEXS
*/
public class ZippedSWFBundle implements SWFBundle {
public class ZippedBundle implements Bundle {
protected Set<String> keySet = new HashSet<>();
@@ -48,15 +48,15 @@ public class ZippedSWFBundle implements SWFBundle {
protected File filename;
public ZippedSWFBundle(InputStream is) throws IOException {
public ZippedBundle(InputStream is) throws IOException {
this(is, null);
}
public ZippedSWFBundle(File filename) throws IOException {
public ZippedBundle(File filename) throws IOException {
this(null, filename);
}
protected ZippedSWFBundle(InputStream is, File filename) throws IOException {
protected ZippedBundle(InputStream is, File filename) throws IOException {
initBundle(is, filename);
}
@@ -90,7 +90,7 @@ public class ZippedSWFBundle implements SWFBundle {
}
@Override
public SeekableInputStream getSWF(String key) throws IOException {
public SeekableInputStream getOpenable(String key) throws IOException {
if (!keySet.contains(key)) {
return null;
}
@@ -118,7 +118,7 @@ public class ZippedSWFBundle implements SWFBundle {
public Map<String, SeekableInputStream> getAll() throws IOException {
Map<String, SeekableInputStream> ret = new HashMap<>();
for (String key : getKeys()) { // cache everything first
ret.put(key, getSWF(key));
ret.put(key, getOpenable(key));
}
return ret;
}
@@ -134,7 +134,7 @@ public class ZippedSWFBundle implements SWFBundle {
}
@Override
public boolean putSWF(String key, InputStream swfIs) throws IOException {
public boolean putOpenable(String key, InputStream swfIs) throws IOException {
if (this.isReadOnly()) {
return false;
}

View File

@@ -66,9 +66,12 @@ import com.jpexs.decompiler.flash.importers.As3ScriptReplaceException;
import com.jpexs.decompiler.flash.importers.As3ScriptReplacerInterface;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.OpenableList;
import com.jpexs.decompiler.flash.types.annotations.Internal;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.helpers.utf8.Utf8PrintWriter;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
@@ -85,7 +88,7 @@ import java.util.logging.Logger;
*
* @author JPEXS
*/
public class ABC {
public class ABC implements Openable {
public ABCVersion version = new ABCVersion(46, 16);
@@ -118,18 +121,38 @@ public class ABC {
/* Map from multiname index of namespace value to namespace name**/
private Map<String, DottedChain> namespaceMap;
private String file;
private String fileTitle;
private OpenableList openableList;
private boolean isOpenable = false;
public ABC(ABCContainerTag tag) {
this.parentTag = tag;
this.deobfuscation = null;
}
public SWF getSwf() {
@Override
public Openable getOpenable() {
if (isOpenable) {
return this;
}
return parentTag.getSwf();
}
public SWF getSwf() {
return parentTag.getSwf();
}
public List<ABCContainerTag> getAbcTags() {
return getSwf().getAbcList();
Openable openable = getOpenable();
if (openable instanceof SWF) {
return ((SWF) openable).getAbcList();
}
return new ArrayList<>();
}
public int addMethodBody(MethodBody body) {
@@ -481,7 +504,15 @@ public class ABC {
}
public ABC(ABCInputStream ais, SWF swf, ABCContainerTag tag) throws IOException {
this(ais, swf, tag, null, null);
}
public ABC(ABCInputStream ais, SWF swf, ABCContainerTag tag, String file, String fileTitle) throws IOException {
this.parentTag = tag;
this.file = file;
this.fileTitle = fileTitle;
if (file != null) {
isOpenable = true;
}
int minor_version = ais.readU16("minor_version");
int major_version = ais.readU16("major_version");
version = new ABCVersion(major_version, minor_version);
@@ -2116,4 +2147,96 @@ public class ABC {
deobfuscation = null;
abcMethodIndexing = null;
}
@Override
public String getFile() {
return file;
}
@Override
public String getFileTitle() {
if (fileTitle != null) {
return fileTitle;
}
return file;
}
@Override
public String getTitleOrShortFileName() {
if (fileTitle != null) {
return fileTitle;
}
return new File(file).getName();
}
@Override
public String getShortPathTitle() {
if (openableList != null) {
if (openableList.isBundle()) {
return openableList.name + "/" + getTitleOrShortFileName();
}
}
return getTitleOrShortFileName();
}
@Override
public String getShortFileName() {
return new File(getTitleOrShortFileName()).getName();
}
@Override
public String getFullPathTitle() {
if (openableList != null) {
if (openableList.isBundle()) {
return openableList.sourceInfo.getFileTitleOrName() + "/" + getFileTitle();
}
}
return getFileTitle();
}
@Override
public boolean isModified() {
return getSwf().isModified(); //??
}
@Override
public void setOpenableList(OpenableList openableList) {
this.openableList = openableList;
getSwf().setOpenableList(openableList); //dummySwf
}
@Override
public OpenableList getOpenableList() {
return openableList;
}
@Override
public String toString() {
return getTitleOrShortFileName();
}
@Override
public void saveTo(OutputStream os) throws IOException {
saveToStream(os);
}
@Override
public void setFile(String file) {
this.file = file;
fileTitle = null;
}
@Override
public void clearModified() {
getSwf().clearModified();
List<ABC> allAbcs = new ArrayList<>();
allAbcs.add(this);
List<ScriptPack> packs = getScriptPacks(null, allAbcs);
for(ScriptPack pack : packs) {
if (pack.isModified()) {
pack.clearModified();
}
}
}
}

View File

@@ -44,6 +44,7 @@ import com.jpexs.decompiler.flash.helpers.hilight.Highlighting;
import com.jpexs.decompiler.flash.search.MethodId;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.treeitems.AS3ClassTreeItem;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.ScopeStack;
import com.jpexs.helpers.CancellableWorker;
@@ -93,8 +94,8 @@ public class ScriptPack extends AS3ClassTreeItem {
public boolean scriptInitializerIsEmpty = false;
@Override
public SWF getSwf() {
return abc.getSwf();
public Openable getOpenable() {
return abc.getOpenable();
}
public ClassPath getClassPath() {
@@ -356,6 +357,13 @@ public class ScriptPack extends AS3ClassTreeItem {
}
return abc.script_info.get(scriptIndex).isModified();
}
public void clearModified() {
if (scriptIndex >= abc.script_info.size()) {
return;
}
abc.script_info.get(scriptIndex).setModified(false);
}
/**
* Injects debugfile, debugline instructions into the code

View File

@@ -2619,7 +2619,7 @@ public class ActionScript3Parser {
}
SWC swc = new SWC(new FileInputStream(Configuration.getPlayerSWC()));
SWF swf = new SWF(swc.getSWF("library.swf"), true);
SWF swf = new SWF(swc.getOpenable("library.swf"), true);
playerGlobalAbcIndex = new AbcIndexing(swf);
}
if (airGlobalAbcIndex == null) {
@@ -2627,7 +2627,7 @@ public class ActionScript3Parser {
return;
}
SWC swc = new SWC(new FileInputStream(Configuration.getAirSWC()));
SWF swf = new SWF(swc.getSWF("library.swf"), true);
SWF swf = new SWF(swc.getOpenable("library.swf"), true);
airGlobalAbcIndex = new AbcIndexing(swf);
}
}

View File

@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.TagStub;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import java.io.IOException;
import java.util.ArrayList;
@@ -147,13 +148,13 @@ public class DumpInfo implements TreeItem {
}
@Override
public SWF getSwf() {
public Openable getOpenable() {
Tag tag = tagToResolve != null ? tagToResolve : resolvedTag;
if (tag != null) {
return tag.getSwf();
return tag.getOpenable();
}
return DumpInfoSwfNode.getSwfNode(this).getSwf();
return DumpInfoSwfNode.getSwfNode(this).getOpenable();
}
@Override

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.dumpview;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.treeitems.Openable;
/**
*
@@ -24,16 +25,20 @@ import com.jpexs.decompiler.flash.SWF;
*/
public class DumpInfoSwfNode extends DumpInfo {
private final SWF swf;
private final Openable openable;
public DumpInfoSwfNode(SWF swf, String name, String type, Object value, long startByte, long lengthBytes) {
public DumpInfoSwfNode(Openable openable, String name, String type, Object value, long startByte, long lengthBytes) {
super(name, type, value, startByte, lengthBytes);
this.swf = swf;
this.openable = openable;
}
@Override
public Openable getOpenable() {
return openable;
}
public SWF getSwf() {
return swf;
return (SWF) openable;
}
public static DumpInfoSwfNode getSwfNode(DumpInfo dumpInfo) {

View File

@@ -247,7 +247,7 @@ public class PreviewExporter {
}
public SWFHeader exportSwf(OutputStream os, TreeItem treeItem, Color backgroundColor, int fontPageNum, boolean showControls) throws IOException, ActionParseException {
SWF swf = treeItem.getSwf();
SWF swf = (SWF) treeItem.getOpenable();
int frameCount = 1;
float frameRate = swf.frameRate;

View File

@@ -33,6 +33,7 @@ import com.jpexs.decompiler.flash.importers.As3ScriptReplaceExceptionItem;
import com.jpexs.decompiler.flash.importers.As3ScriptReplacerInterface;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.helpers.Helper;
import java.io.ByteArrayInputStream;
@@ -263,7 +264,9 @@ public class MxmlcAs3ScriptReplacer extends MxmlcRunner implements As3ScriptRepl
swcFile = new File(pkgDir, "out.swc");
//Make copy without the old script
SWF swfCopy = recompileSWF(pack.getSwf());
Openable openable = pack.getOpenable();
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC)openable).getSwf();
SWF swfCopy = recompileSWF(swf);
List<ABC> modAbcs = new ArrayList<>();

View File

@@ -17,7 +17,6 @@
package com.jpexs.decompiler.flash.iggy.conversion;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFBundle;
import com.jpexs.decompiler.flash.iggy.IggyFile;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.MemoryInputStream;
@@ -30,12 +29,13 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import com.jpexs.decompiler.flash.Bundle;
/**
*
* @author JPEXS
*/
public class IggySwfBundle implements SWFBundle {
public class IggySwfBundle implements Bundle {
private IggyFile iggyFile;
@@ -83,7 +83,7 @@ public class IggySwfBundle implements SWFBundle {
}
@Override
public SeekableInputStream getSWF(String key) throws IOException {
public SeekableInputStream getOpenable(String key) throws IOException {
SWF swf = IggyToSwfConvertor.getSwf(iggyFile);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
swf.saveTo(baos);
@@ -95,7 +95,7 @@ public class IggySwfBundle implements SWFBundle {
public Map<String, SeekableInputStream> getAll() throws IOException {
Map<String, SeekableInputStream> ret = new HashMap<>();
for (String key : getKeys()) {
ret.put(key, getSWF(key));
ret.put(key, getOpenable(key));
}
return ret;
}
@@ -111,7 +111,7 @@ public class IggySwfBundle implements SWFBundle {
}
@Override
public boolean putSWF(String key, InputStream is) throws IOException {
public boolean putOpenable(String key, InputStream is) throws IOException {
try {
SWF swf = new SWF(is, false, false);
SwfToIggyConvertor.updateIggy(iggyFile.getSwf(), swf);

View File

@@ -16,9 +16,12 @@
*/
package com.jpexs.decompiler.flash.importers;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.exporters.settings.ScriptExportSettings;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.helpers.Helper;
import java.io.File;
import java.io.IOException;
@@ -51,7 +54,9 @@ public class AS3ScriptImporter {
try {
File file = pack.getExportFile(scriptsFolder, new ScriptExportSettings(ScriptExportMode.AS, false, false));
if (file.exists()) {
pack.getSwf().informListeners("importing_as", file.getAbsolutePath());
Openable openable = pack.getOpenable();
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC)openable).getSwf();
swf.informListeners("importing_as", file.getAbsolutePath());
String fileName = file.getAbsolutePath();
String txt = Helper.readTextFile(fileName);

View File

@@ -22,12 +22,14 @@ import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.ClassPath;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.treeitems.Openable;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -56,7 +58,7 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
private static final int SERIAL_VERSION_MINOR = 0;
@SuppressWarnings("unchecked")
public ABCSearchResult(SWF swf, InputStream is) throws IOException, ScriptNotFoundException {
public ABCSearchResult(Openable openable, InputStream is) throws IOException, ScriptNotFoundException {
ObjectInputStream ois = new ObjectInputStream(is);
int versionMajor = ois.read();
ois.read(); //minor
@@ -78,7 +80,19 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
this.classIndex = ois.readInt();
this.traitId = ois.readInt();
boolean packFound = false;
for (ScriptPack pack : swf.getAS3Packs()) {
List<ScriptPack> packs;
if (openable instanceof SWF) {
packs = ((SWF)openable).getAS3Packs();
} else {
ABC abc = (ABC)openable;
List<ABC> allAbcs = new ArrayList<>();
allAbcs.add(abc);
packs = abc.getScriptPacks(null, allAbcs);
}
for (ScriptPack pack : packs) {
if (cp.equals(pack.getClassPath()) && traitIndices.equals(pack.traitIndices)) {
this.scriptPack = pack;
packFound = true;
@@ -176,7 +190,7 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
}
@Override
public SWF getSWF() {
return scriptPack.getSwf();
public Openable getOpenable() {
return scriptPack.getOpenable();
}
}

View File

@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.HighlightedText;
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.treeitems.Openable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -121,20 +122,27 @@ public class ActionScriptSearch {
return null;
}
public List<ABCSearchResult> searchAs3(final SWF swf, final String txt, boolean ignoreCase, boolean regexp, boolean pcode, ScriptSearchListener listener, List<ScriptPack> scope) {
public List<ABCSearchResult> searchAs3(final Openable openable, final String txt, boolean ignoreCase, boolean regexp, boolean pcode, ScriptSearchListener listener, List<ScriptPack> scope) {
// todo: pcode seach
if (txt != null && !txt.isEmpty()) {
List<String> ignoredClasses = new ArrayList<>();
List<String> ignoredNss = new ArrayList<>();
if (Configuration._ignoreAdditionalFlexClasses.get()) {
swf.getFlexMainClass(ignoredClasses, ignoredNss);
if (Configuration._ignoreAdditionalFlexClasses.get() && (openable instanceof SWF)) {
((SWF)openable).getFlexMainClass(ignoredClasses, ignoredNss);
}
final List<ABCSearchResult> found = Collections.synchronizedList(new ArrayList<>());
final List<ScriptPack> fscope;
if (scope == null) {
fscope = swf.getAS3Packs();
if (openable instanceof SWF) {
fscope = ((SWF)openable).getAS3Packs();
} else {
ABC abc = (ABC)openable;
List<ABC> allAbcs = new ArrayList<>();
allAbcs.add(abc);
fscope = abc.getScriptPacks(null, allAbcs);
}
} else {
fscope = scope;
}

View File

@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.search;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.treeitems.Openable;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
@@ -87,7 +88,7 @@ public class ActionSearchResult implements ScriptSearchResult {
}
@Override
public SWF getSWF() {
public Openable getOpenable() {
return src.getSwf();
}
}

View File

@@ -17,11 +17,12 @@
package com.jpexs.decompiler.flash.search;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.treeitems.Openable;
/**
*
* @author JPEXS
*/
public interface SearchResult {
public SWF getSWF();
public Openable getOpenable();
}

View File

@@ -39,6 +39,7 @@ import com.jpexs.decompiler.flash.tags.gfx.DefineSubImage;
import com.jpexs.decompiler.flash.tags.gfx.ExporterInfo;
import com.jpexs.decompiler.flash.tags.gfx.FontTextureInfo;
import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.types.RECT;
import com.jpexs.decompiler.flash.types.annotations.Internal;
import com.jpexs.helpers.ByteArrayRange;
@@ -156,6 +157,10 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
}
@Override
public Openable getOpenable() {
return swf;
}
public SWF getSwf() {
return swf;
}
@@ -648,6 +653,9 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
for (int i = 0; i < needed3.size(); i++) {
int characterId = needed3.get(i);
if (swf == null) {
return;
}
if (swf.getCharacters().containsKey(characterId)) {
Set<Integer> needed4 = new LinkedHashSet<>();
CharacterTag character = swf.getCharacter(characterId);
@@ -670,6 +678,9 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
}
for (Integer characterId : needed3) {
if (swf == null) {
return;
}
if (swf.getCharacters().containsKey(characterId)) {
needed.add(characterId);
}

View File

@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.tags.DefineButtonTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.helpers.ByteArrayRange;
import com.jpexs.helpers.Helper;
import java.util.ArrayList;
@@ -181,8 +182,8 @@ public class ButtonAction implements ASMSource {
}
@Override
public SWF getSwf() {
return buttonTag.getSwf();
public Openable getOpenable() {
return buttonTag.getOpenable();
}
@Override
@@ -199,6 +200,11 @@ public class ButtonAction implements ASMSource {
public Tag getTag() {
return buttonTag;
}
@Override
public SWF getSwf() {
return (SWF) getOpenable();
}
}

View File

@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.timeline;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import java.util.ArrayList;
import java.util.List;
@@ -59,7 +60,7 @@ public class AS2Package implements TreeItem {
@Override
public SWF getSwf() {
public Openable getOpenable() {
return swf;
}

View File

@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.ClassPath;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.treeitems.AS3ClassTreeItem;
import com.jpexs.decompiler.flash.treeitems.Openable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -32,7 +33,7 @@ import java.util.TreeMap;
*/
public class AS3Package extends AS3ClassTreeItem {
private final SWF swf;
private final Openable openable;
public String packageName;
@@ -48,10 +49,10 @@ public class AS3Package extends AS3ClassTreeItem {
private boolean defaultPackage;
public AS3Package(String packageName, SWF swf, boolean flat, boolean defaultPackage) {
public AS3Package(String packageName, Openable openable, boolean flat, boolean defaultPackage) {
super(packageName, "", null);
this.flat = flat;
this.swf = swf;
this.openable = openable;
this.packageName = packageName;
this.defaultPackage = defaultPackage;
}
@@ -63,8 +64,8 @@ public class AS3Package extends AS3ClassTreeItem {
@Override
public SWF getSwf() {
return swf;
public Openable getOpenable() {
return openable;
}
public List<AS3Package> getSubPackages() {

View File

@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import com.jpexs.decompiler.flash.tags.base.Exportable;
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.decompiler.flash.types.RGB;
import com.jpexs.decompiler.flash.types.RGBA;
@@ -87,7 +88,7 @@ public class Frame implements TreeItem, Exportable {
}
@Override
public SWF getSwf() {
public Openable getOpenable() {
return timeline.swf;
}

View File

@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.timeline;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.tags.base.Exportable;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
/**
@@ -40,7 +41,7 @@ public class FrameScript implements TreeItem, Exportable {
}
@Override
public SWF getSwf() {
public Openable getOpenable() {
return swf;
}

View File

@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.timeline;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.Exportable;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import java.util.List;
import java.util.Objects;
@@ -50,7 +51,7 @@ public class TagScript implements TreeItem, Exportable {
}
@Override
public SWF getSwf() {
public Openable getOpenable() {
return swf;
}

View File

@@ -45,7 +45,7 @@ public class FolderItem implements TreeItem {
}
@Override
public SWF getSwf() {
public Openable getOpenable() {
return swf;
}

View File

@@ -34,7 +34,7 @@ public class HeaderItem implements TreeItem {
}
@Override
public SWF getSwf() {
public Openable getOpenable() {
return swf;
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2010-2022 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.treeitems;
import java.io.IOException;
import java.io.OutputStream;
/**
*
* @author JPEXS
*/
public interface Openable extends TreeItem {
public String getFileTitle();
public String getShortPathTitle();
public String getShortFileName();
public String getFile();
public String getTitleOrShortFileName();
public String getFullPathTitle();
public void setOpenableList(OpenableList openableList);
public OpenableList getOpenableList();
public void saveTo(OutputStream os) throws IOException;
public void setFile(String file);
public void clearModified();
}

View File

@@ -17,35 +17,35 @@
package com.jpexs.decompiler.flash.treeitems;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFBundle;
import com.jpexs.decompiler.flash.SWFContainerItem;
import com.jpexs.decompiler.flash.SWFSourceInfo;
import com.jpexs.decompiler.flash.OpenableSourceInfo;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import com.jpexs.decompiler.flash.Bundle;
/**
*
* @author JPEXS
*/
public class SWFList implements List<SWF>, SWFContainerItem {
public class OpenableList implements List<Openable>, SWFContainerItem {
public String name;
public SWFBundle bundle;
public Bundle bundle;
public SWFSourceInfo sourceInfo;
public OpenableSourceInfo sourceInfo;
public List<SWF> swfs = new ArrayList<>();
public List<Openable> items = new ArrayList<>();
public boolean isBundle() {
return bundle != null;
}
@Override
public SWF getSwf() {
public Openable getOpenable() {
throw new UnsupportedOperationException("Not supported.");
}
@@ -54,131 +54,131 @@ public class SWFList implements List<SWF>, SWFContainerItem {
if (isBundle()) {
return name;
} else {
return swfs.get(0).getFileTitle();
return items.get(0).getFileTitle();
}
}
@Override
public Iterator<SWF> iterator() {
return swfs.iterator();
public Iterator<Openable> iterator() {
return items.iterator();
}
@Override
public int size() {
return swfs.size();
return items.size();
}
@Override
public boolean isEmpty() {
return swfs.isEmpty();
return items.isEmpty();
}
@Override
public boolean contains(Object o) {
return swfs.contains(o);
return items.contains(o);
}
@Override
public Object[] toArray() {
return swfs.toArray();
return items.toArray();
}
@Override
public <T> T[] toArray(T[] ts) {
return swfs.toArray(ts);
return items.toArray(ts);
}
@Override
public boolean add(SWF e) {
return swfs.add(e);
public boolean add(Openable e) {
return items.add(e);
}
@Override
public boolean remove(Object o) {
return swfs.remove(o);
return items.remove(o);
}
@Override
public boolean containsAll(Collection<?> clctn) {
return swfs.containsAll(clctn);
return items.containsAll(clctn);
}
@Override
public boolean addAll(Collection<? extends SWF> clctn) {
return swfs.addAll(clctn);
public boolean addAll(Collection<? extends Openable> clctn) {
return items.addAll(clctn);
}
@Override
public boolean removeAll(Collection<?> clctn) {
return swfs.removeAll(clctn);
return items.removeAll(clctn);
}
@Override
public boolean retainAll(Collection<?> clctn) {
return swfs.retainAll(clctn);
return items.retainAll(clctn);
}
@Override
public void clear() {
swfs.clear();
items.clear();
}
@Override
public boolean addAll(int i, Collection<? extends SWF> clctn) {
return swfs.addAll(i, clctn);
public boolean addAll(int i, Collection<? extends Openable> clctn) {
return items.addAll(i, clctn);
}
@Override
public SWF get(int i) {
if (i < 0 || i >= swfs.size()) {
public Openable get(int i) {
if (i < 0 || i >= items.size()) {
return null;
}
return swfs.get(i);
return items.get(i);
}
@Override
public SWF set(int i, SWF e) {
return swfs.set(i, e);
public Openable set(int i, Openable e) {
return items.set(i, e);
}
@Override
public void add(int i, SWF e) {
swfs.add(i, e);
public void add(int i, Openable e) {
items.add(i, e);
}
@Override
public SWF remove(int i) {
return swfs.remove(i);
public Openable remove(int i) {
return items.remove(i);
}
@Override
public int indexOf(Object o) {
return swfs.indexOf(0);
return items.indexOf(0);
}
@Override
public int lastIndexOf(Object o) {
return swfs.lastIndexOf(o);
return items.lastIndexOf(o);
}
@Override
public ListIterator<SWF> listIterator() {
return swfs.listIterator();
public ListIterator<Openable> listIterator() {
return items.listIterator();
}
@Override
public ListIterator<SWF> listIterator(int i) {
return swfs.listIterator(i);
public ListIterator<Openable> listIterator(int i) {
return items.listIterator(i);
}
@Override
public List<SWF> subList(int i, int i1) {
return swfs.subList(i, i1);
public List<Openable> subList(int i, int i1) {
return items.subList(i, i1);
}
@Override
public boolean isModified() {
for (SWF s : swfs) {
for (Openable s : items) {
if (s.isModified()) {
return true;
}

View File

@@ -24,7 +24,7 @@ import com.jpexs.decompiler.flash.SWF;
*/
public interface TreeItem {
public SWF getSwf();
public Openable getOpenable();
public boolean isModified();
}

View File

@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.HideInRawEdit;
import com.jpexs.decompiler.flash.types.annotations.Internal;
@@ -92,6 +93,12 @@ public class BUTTONCONDACTION implements ASMSource, Serializable, HasSwfAndTag {
actionBytes = sis.readByteRangeEx(condActionSize <= 0 ? sis.available() : condActionSize - 4, "actionBytes", DumpInfoSpecialType.ACTION_BYTES, sis.getPos());
}
@Override
public Openable getOpenable() {
return swf;
}
@Override
public SWF getSwf() {
return swf;

View File

@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.EnumValue;
@@ -153,6 +154,11 @@ public class BUTTONRECORD implements Serializable, TreeItem, HasSwfAndTag, HasCh
public SWF getSwf() {
return swf;
}
@Override
public Openable getOpenable() {
return swf;
}
public void setModified(boolean value) {
modified = value;

View File

@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.HideInRawEdit;
import com.jpexs.decompiler.flash.types.annotations.Internal;
@@ -172,10 +173,16 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag {
this.parentClipActions = parentClipActions;
}
@Override
public Openable getOpenable() {
return swf;
}
@Override
public SWF getSwf() {
return swf;
}
/**
* Events to which this handler applies