mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-27 10:47:16 +00:00
faster populateSoundStreamBlocks
This commit is contained in:
@@ -360,7 +360,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
}
|
||||
|
||||
private void parseCharacters(List<ContainerItem> list) {
|
||||
private void parseCharacters(List<? extends ContainerItem> 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<ContainerItem> objs = new ArrayList<>(tags.size());
|
||||
objs.addAll(tags);
|
||||
|
||||
ArrayList<ABCContainerTag> 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<ContainerItem> list, List<ABCContainerTag> actionScripts) {
|
||||
private static void getABCTags(List<? extends ContainerItem> list, List<ABCContainerTag> 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<ASMSource, ActionList> actionsMap = new HashMap<>();
|
||||
|
||||
private void getVariables(List<ContainerItem> objs, String path) throws InterruptedException {
|
||||
private void getVariables(List<? extends ContainerItem> objs, String path) throws InterruptedException {
|
||||
List<String> 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<ContainerItem> objs = new ArrayList<>();
|
||||
int ret = 0;
|
||||
objs.addAll(tags);
|
||||
getVariables(objs, "");
|
||||
getVariables(tags, "");
|
||||
informListeners("rename", "");
|
||||
int fc = 0;
|
||||
for (MyEntry<DirectValueActionItem, ConstantPool> it : allVariableNames) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ContainerItem> getSubItems() {
|
||||
List<ContainerItem> ret = new ArrayList<>();
|
||||
ret.addAll(actions);
|
||||
return ret;
|
||||
public List<BUTTONCONDACTION> getSubItems() {
|
||||
return actions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<ContainerItem> getSubItems() {
|
||||
List<ContainerItem> ret = new ArrayList<>();
|
||||
ret.addAll(subTags);
|
||||
return ret;
|
||||
public List<Tag> getSubItems() {
|
||||
return subTags;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<ContainerItem> getSubItems() {
|
||||
List<ContainerItem> ret = new ArrayList<>();
|
||||
public List<CLIPACTIONRECORD> getSubItems() {
|
||||
if (placeFlagHasClipActions) {
|
||||
ret.addAll(clipActions.clipActionRecords);
|
||||
return clipActions.clipActionRecords;
|
||||
}
|
||||
return ret;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<ContainerItem> getSubItems() {
|
||||
List<ContainerItem> ret = new ArrayList<>();
|
||||
public List<CLIPACTIONRECORD> getSubItems() {
|
||||
if (placeFlagHasClipActions) {
|
||||
ret.addAll(clipActions.clipActionRecords);
|
||||
return clipActions.clipActionRecords;
|
||||
}
|
||||
return ret;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<ContainerItem> getSubItems() {
|
||||
List<ContainerItem> ret = new ArrayList<>();
|
||||
public List<CLIPACTIONRECORD> getSubItems() {
|
||||
if (placeFlagHasClipActions) {
|
||||
ret.addAll(clipActions.clipActionRecords);
|
||||
return clipActions.clipActionRecords;
|
||||
}
|
||||
return ret;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<? extends ContainerItem> getSubItems();
|
||||
|
||||
/**
|
||||
* Returns number of sub-items
|
||||
|
||||
Reference in New Issue
Block a user