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 c34b4c9c9..b2435d62f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -360,7 +360,7 @@ public final class SWF implements SWFContainerItem, Timelined { } } - private void parseCharacters(List list) { + private void parseCharacters(List list) { for (ContainerItem t : list) { if (t instanceof CharacterTag) { characters.put(((CharacterTag) t).getCharacterId(), (CharacterTag) t); @@ -683,16 +683,14 @@ public final class SWF implements SWFContainerItem, Timelined { } private void findABCTags() { - List objs = new ArrayList<>(tags.size()); - objs.addAll(tags); ArrayList newAbcList = new ArrayList<>(); - getABCTags(objs, newAbcList); + getABCTags(tags, newAbcList); isAS3 = (fileAttributes != null && fileAttributes.actionScript3) || (fileAttributes == null && !newAbcList.isEmpty()); abcList = newAbcList; } - private static void getABCTags(List list, List actionScripts) { + private static void getABCTags(List list, List actionScripts) { for (ContainerItem t : list) { if (t instanceof Container) { getABCTags(((Container) t).getSubItems(), actionScripts); @@ -1782,7 +1780,7 @@ public final class SWF implements SWFContainerItem, Timelined { } private HashMap actionsMap = new HashMap<>(); - private void getVariables(List objs, String path) throws InterruptedException { + private void getVariables(List objs, String path) throws InterruptedException { List processed = new ArrayList<>(); for (ContainerItem o : objs) { if (o instanceof ASMSource) { @@ -1864,10 +1862,8 @@ public final class SWF implements SWFContainerItem, Timelined { allVariableNames = new ArrayList<>(); allStrings = new HashMap<>(); - List objs = new ArrayList<>(); int ret = 0; - objs.addAll(tags); - getVariables(objs, ""); + getVariables(tags, ""); informListeners("rename", ""); int fc = 0; for (MyEntry it : allVariableNames) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index 0a310f206..fe2fceada 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -15,7 +15,6 @@ * License along with this library. */ package com.jpexs.decompiler.flash.abc.types; -import com.jpexs.decompiler.flash.AppResources; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABCInputStream; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index a74da76cf..606ef1666 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -25,7 +25,6 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.ButtonTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; -import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.timeline.DepthState; import com.jpexs.decompiler.flash.timeline.Frame; import com.jpexs.decompiler.flash.timeline.Timeline; @@ -168,10 +167,8 @@ public class DefineButton2Tag extends ButtonTag implements Container { * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); - ret.addAll(actions); - return ret; + public List getSubItems() { + return actions; } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index 55789e057..76e4fd647 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -27,7 +27,6 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; -import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.timeline.DepthState; @@ -257,10 +256,8 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); - ret.addAll(subTags); - return ret; + public List getSubItems() { + return subTags; } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java index 58f6af895..5658a4849 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java @@ -23,9 +23,9 @@ import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.Container; -import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; import com.jpexs.decompiler.flash.types.ColorTransform; @@ -269,12 +269,11 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); + public List getSubItems() { if (placeFlagHasClipActions) { - ret.addAll(clipActions.clipActionRecords); + return clipActions.clipActionRecords; } - return ret; + return new ArrayList<>(); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java index 0efeb52f8..fe3f2d49c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java @@ -24,9 +24,9 @@ import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.Container; -import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; import com.jpexs.decompiler.flash.types.ColorTransform; @@ -388,12 +388,11 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); + public List getSubItems() { if (placeFlagHasClipActions) { - ret.addAll(clipActions.clipActionRecords); + return clipActions.clipActionRecords; } - return ret; + return new ArrayList<>(); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java index 752cdbc85..02e109734 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java @@ -24,9 +24,9 @@ import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.Container; -import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; import com.jpexs.decompiler.flash.types.ColorTransform; @@ -391,12 +391,11 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO * @return List of sub-items */ @Override - public List getSubItems() { - List ret = new ArrayList<>(); + public List getSubItems() { if (placeFlagHasClipActions) { - ret.addAll(clipActions.clipActionRecords); + return clipActions.clipActionRecords; } - return ret; + return new ArrayList<>(); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java index 55d98916b..8668721fd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; -import com.jpexs.decompiler.flash.tags.base.Container; import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.types.BasicType; @@ -189,8 +188,9 @@ public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHea head.setVirtualCharacterId(containerId); continue; } - if (t instanceof Container) { - populateSoundStreamBlocks(((CharacterIdTag) t).getCharacterId(), ((Container) t).getSubItems(), head, output); + if (t instanceof DefineSpriteTag) { + DefineSpriteTag sprite = (DefineSpriteTag) t; + populateSoundStreamBlocks(sprite.getCharacterId(), sprite.getSubItems(), head, output); } if (!found) { continue; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/Container.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/Container.java index 8f1cfa8d0..40a592bc4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/Container.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/Container.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.treeitems.TreeItem; @@ -30,7 +31,7 @@ public interface Container extends TreeItem { * * @return List of sub-items */ - public List getSubItems(); + public List getSubItems(); /** * Returns number of sub-items diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java index 8aa91cc22..45a171761 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java @@ -167,9 +167,10 @@ public class TagTreeModel implements TreeModel { frames.add(timeline.getFrames().get(i)); } - for (int i = 0; i < sounds.size(); i++) { - if (sounds.get(i) instanceof SoundStreamHeadTypeTag) { - List blocks = ((SoundStreamHeadTypeTag) sounds.get(i)).getBlocks(); + for (int i = sounds.size() - 1; i >=0 ; i--) { + TreeItem sound = sounds.get(i); + if (sound instanceof SoundStreamHeadTypeTag) { + List blocks = ((SoundStreamHeadTypeTag) sound).getBlocks(); if (blocks.isEmpty()) { sounds.remove(i); i--;