mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-08 02:25:20 +00:00
#742 Can't edit frames fixed, Container/ContainerItems refactored, build fixed on linux (Pull request #12)
This commit is contained in:
@@ -104,12 +104,11 @@ import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.TagStub;
|
||||
import com.jpexs.decompiler.flash.tags.VideoFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
|
||||
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.FontTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
@@ -283,7 +282,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
|
||||
public void updateCharacters() {
|
||||
characters.clear();
|
||||
parseCharacters(new ArrayList<ContainerItem>(tags));
|
||||
parseCharacters(tags);
|
||||
}
|
||||
|
||||
public int getNextCharacterId() {
|
||||
@@ -363,13 +362,13 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
}
|
||||
|
||||
private void parseCharacters(List<? extends ContainerItem> list) {
|
||||
for (ContainerItem t : list) {
|
||||
private void parseCharacters(List<Tag> list) {
|
||||
for (Tag t : list) {
|
||||
if (t instanceof CharacterTag) {
|
||||
characters.put(((CharacterTag) t).getCharacterId(), (CharacterTag) t);
|
||||
}
|
||||
if (t instanceof Container) {
|
||||
parseCharacters(((Container) t).getSubItems());
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
parseCharacters(((DefineSpriteTag) t).getSubTags());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -693,10 +692,10 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
abcList = newAbcList;
|
||||
}
|
||||
|
||||
private static void getABCTags(List<? extends ContainerItem> list, List<ABCContainerTag> actionScripts) {
|
||||
for (ContainerItem t : list) {
|
||||
if (t instanceof Container) {
|
||||
getABCTags(((Container) t).getSubItems(), actionScripts);
|
||||
private static void getABCTags(List<Tag> list, List<ABCContainerTag> actionScripts) {
|
||||
for (Tag t : list) {
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
getABCTags(((DefineSpriteTag) t).getSubTags(), actionScripts);
|
||||
}
|
||||
if (t instanceof ABCContainerTag) {
|
||||
actionScripts.add((ABCContainerTag) t);
|
||||
@@ -1084,23 +1083,32 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
return asms;
|
||||
}
|
||||
|
||||
private static void getASMs(String path, List<? extends ContainerItem> items, Map<String, ASMSource> asms) {
|
||||
for (ContainerItem item : items) {
|
||||
String subPath = path + "/" + item.toString();
|
||||
if (item instanceof ASMSource) {
|
||||
String npath = subPath;
|
||||
int ppos = 1;
|
||||
while (asms.containsKey(npath)) {
|
||||
ppos++;
|
||||
npath = subPath + "[" + ppos + "]";
|
||||
}
|
||||
asms.put(npath, (ASMSource) item);
|
||||
private static void getASMs(String path, List<Tag> items, Map<String, ASMSource> asms) {
|
||||
for (Tag t : items) {
|
||||
String subPath = path + "/" + t.toString();
|
||||
if (t instanceof ASMSource) {
|
||||
addASM(asms, (ASMSource) t, subPath);
|
||||
}
|
||||
if (item instanceof Container) {
|
||||
getASMs(subPath, ((Container) item).getSubItems(), asms);
|
||||
if (t instanceof ASMSourceContainer) {
|
||||
for (ASMSource asm : ((ASMSourceContainer) t).getSubItems()) {
|
||||
addASM(asms, asm, subPath + "/" + asm.toString());
|
||||
}
|
||||
}
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
getASMs(subPath, ((DefineSpriteTag) t).getSubTags(), asms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addASM(Map<String, ASMSource> asms, ASMSource asm, String path) {
|
||||
String npath = path;
|
||||
int ppos = 1;
|
||||
while (asms.containsKey(npath)) {
|
||||
ppos++;
|
||||
npath = path + "[" + ppos + "]";
|
||||
}
|
||||
asms.put(npath, asm);
|
||||
}
|
||||
|
||||
private final HashSet<EventListener> listeners = new HashSet<>();
|
||||
|
||||
@@ -1142,13 +1150,13 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void populateVideoFrames(int streamId, List<? extends ContainerItem> tags, HashMap<Integer, VideoFrameTag> output) {
|
||||
for (ContainerItem t : tags) {
|
||||
public static void populateVideoFrames(int streamId, List<Tag> tags, HashMap<Integer, VideoFrameTag> output) {
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof VideoFrameTag) {
|
||||
output.put(((VideoFrameTag) t).frameNum, (VideoFrameTag) t);
|
||||
}
|
||||
if (t instanceof Container) {
|
||||
populateVideoFrames(streamId, ((Container) t).getSubItems(), output);
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
populateVideoFrames(streamId, ((DefineSpriteTag) t).getSubTags(), output);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1784,27 +1792,37 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
private HashMap<ASMSource, ActionList> actionsMap = new HashMap<>();
|
||||
|
||||
private void getVariables(List<? extends ContainerItem> objs, String path) throws InterruptedException {
|
||||
private void getVariables(List<Tag> tags, String path) throws InterruptedException {
|
||||
List<String> processed = new ArrayList<>();
|
||||
for (ContainerItem o : objs) {
|
||||
if (o instanceof ASMSource) {
|
||||
String infPath = path + "/" + o.toString();
|
||||
int pos = 1;
|
||||
String infPath2 = infPath;
|
||||
while (processed.contains(infPath2)) {
|
||||
pos++;
|
||||
infPath2 = infPath + "[" + pos + "]";
|
||||
}
|
||||
processed.add(infPath2);
|
||||
informListeners("getVariables", infPath2);
|
||||
getVariables(allVariableNames, allFunctions, allStrings, usageTypes, (ASMSource) o, path);
|
||||
for (Tag t : tags) {
|
||||
String subPath = path + "/" + t.toString();
|
||||
if (t instanceof ASMSource) {
|
||||
addVariable((ASMSource) t, subPath, processed);
|
||||
}
|
||||
if (o instanceof Container) {
|
||||
getVariables(((Container) o).getSubItems(), path + "/" + o.toString());
|
||||
if (t instanceof ASMSourceContainer) {
|
||||
List<String> processed2 = new ArrayList<>();
|
||||
for (ASMSource asm : ((ASMSourceContainer) t).getSubItems()) {
|
||||
addVariable(asm, subPath + "/" + asm.toString(), processed2);
|
||||
}
|
||||
}
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
getVariables(((DefineSpriteTag) t).getSubTags(), path + "/" + t.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addVariable(ASMSource asm, String path, List<String> processed) throws InterruptedException {
|
||||
int pos = 1;
|
||||
String infPath2 = path;
|
||||
while (processed.contains(infPath2)) {
|
||||
pos++;
|
||||
infPath2 = path + "[" + pos + "]";
|
||||
}
|
||||
processed.add(infPath2);
|
||||
informListeners("getVariables", infPath2);
|
||||
getVariables(allVariableNames, allFunctions, allStrings, usageTypes, asm, path);
|
||||
}
|
||||
|
||||
public int deobfuscateAS3Identifiers(RenameType renameType) {
|
||||
for (Tag tag : tags) {
|
||||
if (tag instanceof ABCContainerTag) {
|
||||
|
||||
@@ -21,10 +21,10 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
|
||||
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.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.timeline.Frame;
|
||||
import com.jpexs.decompiler.flash.timeline.Timeline;
|
||||
@@ -52,7 +52,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineButton2Tag extends ButtonTag implements Container {
|
||||
public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
|
||||
/**
|
||||
* ID for this character
|
||||
@@ -171,16 +171,6 @@ public class DefineButton2Tag extends ButtonTag implements Container {
|
||||
return actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of sub-items
|
||||
*
|
||||
* @return Number of sub-items
|
||||
*/
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return actions.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
for (BUTTONRECORD r : characters) {
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter;
|
||||
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.DrawableTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
|
||||
import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
@@ -56,7 +55,7 @@ import java.util.Set;
|
||||
/**
|
||||
* Defines a sprite character
|
||||
*/
|
||||
public class DefineSpriteTag extends CharacterTag implements Container, DrawableTag, Timelined {
|
||||
public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timelined {
|
||||
|
||||
/**
|
||||
* Character ID of sprite
|
||||
@@ -249,26 +248,6 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all sub-items
|
||||
*
|
||||
* @return List of sub-items
|
||||
*/
|
||||
@Override
|
||||
public List<Tag> getSubItems() {
|
||||
return subTags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of sub-items
|
||||
*
|
||||
* @return Number of sub-items
|
||||
*/
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return subTags.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSubTags() {
|
||||
return true;
|
||||
|
||||
@@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.Container;
|
||||
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD;
|
||||
@@ -49,7 +49,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceObjectTypeTag {
|
||||
public class PlaceObject2Tag extends CharacterIdTag implements ASMSourceContainer, PlaceObjectTypeTag {
|
||||
|
||||
/**
|
||||
* @since SWF 5 Has clip actions (sprite characters only)
|
||||
@@ -276,19 +276,6 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of sub-items
|
||||
*
|
||||
* @return Number of sub-items
|
||||
*/
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (!placeFlagHasClipActions) {
|
||||
return 0;
|
||||
}
|
||||
return clipActions.clipActionRecords.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
if (placeFlagHasCharacter) {
|
||||
|
||||
@@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.Container;
|
||||
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD;
|
||||
@@ -51,7 +51,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceObjectTypeTag {
|
||||
public class PlaceObject3Tag extends CharacterIdTag implements ASMSourceContainer, PlaceObjectTypeTag {
|
||||
|
||||
/**
|
||||
* @since SWF 5 has clip actions (sprite characters only)
|
||||
@@ -395,19 +395,6 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of sub-items
|
||||
*
|
||||
* @return Number of sub-items
|
||||
*/
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (!placeFlagHasClipActions) {
|
||||
return 0;
|
||||
}
|
||||
return clipActions.clipActionRecords.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
if (placeFlagHasCharacter) {
|
||||
|
||||
@@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.Container;
|
||||
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD;
|
||||
@@ -51,7 +51,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceObjectTypeTag {
|
||||
public class PlaceObject4Tag extends CharacterIdTag implements ASMSourceContainer, PlaceObjectTypeTag {
|
||||
|
||||
/**
|
||||
* @since SWF 5 has clip actions (sprite characters only)
|
||||
@@ -398,19 +398,6 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of sub-items
|
||||
*
|
||||
* @return Number of sub-items
|
||||
*/
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (!placeFlagHasClipActions) {
|
||||
return 0;
|
||||
}
|
||||
return clipActions.clipActionRecords.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
if (placeFlagHasCharacter) {
|
||||
|
||||
@@ -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.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
@@ -180,9 +179,9 @@ public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHea
|
||||
return streamSoundType;
|
||||
}
|
||||
|
||||
public static void populateSoundStreamBlocks(int containerId, List<? extends ContainerItem> tags, SoundStreamHeadTypeTag head, List<SoundStreamBlockTag> output) {
|
||||
public static void populateSoundStreamBlocks(int containerId, List<Tag> tags, SoundStreamHeadTypeTag head, List<SoundStreamBlockTag> output) {
|
||||
boolean found = false;
|
||||
for (ContainerItem t : tags) {
|
||||
for (Tag t : tags) {
|
||||
if (t == head) {
|
||||
found = true;
|
||||
head.setVirtualCharacterId(containerId);
|
||||
@@ -190,7 +189,7 @@ public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHea
|
||||
}
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
DefineSpriteTag sprite = (DefineSpriteTag) t;
|
||||
populateSoundStreamBlocks(sprite.getCharacterId(), sprite.getSubItems(), head, output);
|
||||
populateSoundStreamBlocks(sprite.getCharacterId(), sprite.getSubTags(), head, output);
|
||||
}
|
||||
if (!found) {
|
||||
continue;
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.base.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.tags.base.Exportable;
|
||||
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
|
||||
import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
|
||||
@@ -45,7 +44,7 @@ import java.util.Set;
|
||||
/**
|
||||
* Represents Tag inside SWF file
|
||||
*/
|
||||
public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem, Serializable {
|
||||
public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
|
||||
/**
|
||||
* Identifier of tag type
|
||||
|
||||
@@ -24,19 +24,12 @@ import java.util.List;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface Container extends TreeItem {
|
||||
public interface ASMSourceContainer extends TreeItem {
|
||||
|
||||
/**
|
||||
* Returns all sub-items
|
||||
*
|
||||
* @return List of sub-items
|
||||
*/
|
||||
public List<? extends ContainerItem> getSubItems();
|
||||
|
||||
/**
|
||||
* Returns number of sub-items
|
||||
*
|
||||
* @return Number of sub-items
|
||||
*/
|
||||
public int getItemCount();
|
||||
public List<? extends ASMSource> getSubItems();
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 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.tags.base;
|
||||
|
||||
import com.jpexs.decompiler.flash.treeitems.TreeItem;
|
||||
|
||||
/**
|
||||
* Object which contains other objects
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface ContainerItem extends TreeItem {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class AS3Package extends AS3ClassTreeItem {
|
||||
int res = 0;
|
||||
if (child instanceof AS3Package) {
|
||||
for (AS3Package pkg : subPackages.values()) {
|
||||
if (pkg.equals(child)) {
|
||||
if (pkg.packageName.equals(((AS3Package) child).packageName)) {
|
||||
break;
|
||||
}
|
||||
res++;
|
||||
|
||||
@@ -26,7 +26,6 @@ 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.tags.base.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.tags.base.Exportable;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
@@ -45,7 +44,7 @@ import java.util.logging.Logger;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, Serializable {
|
||||
public class BUTTONCONDACTION implements ASMSource, Exportable, Serializable {
|
||||
|
||||
private final SWF swf;
|
||||
private final Tag tag;
|
||||
|
||||
@@ -26,7 +26,6 @@ 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.tags.base.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.tags.base.Exportable;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
@@ -44,7 +43,7 @@ import java.util.logging.Logger;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, Serializable {
|
||||
public class CLIPACTIONRECORD implements ASMSource, Exportable, Serializable {
|
||||
|
||||
public static String keyToString(int key) {
|
||||
if ((key < CLIPACTIONRECORD.KEYNAMES.length) && (key > 0) && (CLIPACTIONRECORD.KEYNAMES[key] != null)) {
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFArray;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.parser.AnnotationParseException;
|
||||
import com.jpexs.decompiler.flash.types.annotations.parser.ConditionEvaluator;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
@@ -663,10 +664,10 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
SWF swf = tag.getSwf();
|
||||
try {
|
||||
byte[] data = tag.getData();
|
||||
SWFInputStream tagDataStream = new SWFInputStream(swf, data, 0, data.length);
|
||||
SWFInputStream tagDataStream = new SWFInputStream(swf, data, tag.getDataPos(), data.length);
|
||||
TagStub copy = new TagStub(swf, tag.getId(), "Unresolved", tag.getOriginalRange(), tagDataStream);
|
||||
copy.forceWriteAsLong = tag.forceWriteAsLong;
|
||||
this.editedTag = SWFInputStream.resolveTag(copy, 0, false, true, false);
|
||||
editedTag = SWFInputStream.resolveTag(copy, 0, false, true, false);
|
||||
} catch (InterruptedException ex) {
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(GenericTagTreePanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
@@ -83,7 +83,6 @@ import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
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.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.tags.base.DrawableTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
@@ -897,37 +896,38 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
if (selectedNodeSwf != swf) {
|
||||
continue;
|
||||
}
|
||||
if (d instanceof ContainerItem) {
|
||||
ContainerItem n = (ContainerItem) d;
|
||||
TreeNodeType nodeType = TagTree.getTreeNodeType(n);
|
||||
|
||||
if (d instanceof Tag || d instanceof ASMSource) {
|
||||
TreeNodeType nodeType = TagTree.getTreeNodeType(d);
|
||||
if (nodeType == TreeNodeType.IMAGE) {
|
||||
images.add((Tag) n);
|
||||
images.add((Tag) d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.SHAPE) {
|
||||
shapes.add((Tag) n);
|
||||
shapes.add((Tag) d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.MORPH_SHAPE) {
|
||||
morphshapes.add((Tag) n);
|
||||
morphshapes.add((Tag) d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.AS) {
|
||||
as12scripts.add(n);
|
||||
as12scripts.add(d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.MOVIE) {
|
||||
movies.add((Tag) n);
|
||||
movies.add((Tag) d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.SOUND) {
|
||||
sounds.add((Tag) n);
|
||||
sounds.add((Tag) d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.BINARY_DATA) {
|
||||
binaryData.add((Tag) n);
|
||||
binaryData.add((Tag) d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.TEXT) {
|
||||
texts.add((Tag) n);
|
||||
texts.add((Tag) d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.FONT) {
|
||||
fonts.add((Tag) n);
|
||||
fonts.add((Tag) d);
|
||||
}
|
||||
}
|
||||
|
||||
if (d instanceof Frame) {
|
||||
Frame fn = (Frame) d;
|
||||
Timelined parent = fn.timeline.timelined;
|
||||
|
||||
@@ -48,7 +48,6 @@ import com.jpexs.decompiler.flash.tags.VideoFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.AloneTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag;
|
||||
@@ -562,8 +561,8 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
List<Tag> subs = fn.timeline.tags;
|
||||
List<Integer> doneCharacters = new ArrayList<>();
|
||||
int frameCnt = 0;
|
||||
for (ContainerItem item : subs) {
|
||||
if (item instanceof ShowFrameTag) {
|
||||
for (Tag t : subs) {
|
||||
if (t instanceof ShowFrameTag) {
|
||||
frameCnt++;
|
||||
continue;
|
||||
}
|
||||
@@ -571,12 +570,11 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
break;
|
||||
}
|
||||
|
||||
if (item instanceof DoActionTag || item instanceof DoInitActionTag) {
|
||||
if (t instanceof DoActionTag || t instanceof DoInitActionTag) {
|
||||
// todo: Maybe DoABC tags should be removed, too
|
||||
continue;
|
||||
}
|
||||
|
||||
Tag t = (Tag) item;
|
||||
Set<Integer> needed = new HashSet<>();
|
||||
t.getNeededCharactersDeep(needed);
|
||||
for (int n : needed) {
|
||||
|
||||
@@ -94,7 +94,6 @@ import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.VideoFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
|
||||
@@ -472,37 +471,38 @@ public class TagTree extends JTree {
|
||||
if (d.getSwf() != swf) {
|
||||
continue;
|
||||
}
|
||||
if (d instanceof ContainerItem) {
|
||||
ContainerItem n = (ContainerItem) d;
|
||||
TreeNodeType nodeType = TagTree.getTreeNodeType(n);
|
||||
|
||||
if (d instanceof Tag || d instanceof ASMSource) {
|
||||
TreeNodeType nodeType = TagTree.getTreeNodeType(d);
|
||||
if (nodeType == TreeNodeType.IMAGE) {
|
||||
ret.add(n);
|
||||
ret.add(d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.SHAPE) {
|
||||
ret.add(n);
|
||||
ret.add(d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.MORPH_SHAPE) {
|
||||
ret.add(n);
|
||||
ret.add(d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.AS) {
|
||||
ret.add(n);
|
||||
ret.add(d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.MOVIE) {
|
||||
ret.add(n);
|
||||
ret.add(d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.SOUND) {
|
||||
ret.add(n);
|
||||
ret.add(d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.BINARY_DATA) {
|
||||
ret.add(n);
|
||||
ret.add(d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.TEXT) {
|
||||
ret.add(n);
|
||||
ret.add(d);
|
||||
}
|
||||
if (nodeType == TreeNodeType.FONT) {
|
||||
ret.add(n);
|
||||
ret.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
if (d instanceof Frame) {
|
||||
ret.add(d);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,7 @@ import com.jpexs.decompiler.flash.tags.ShowFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.SoundStreamBlockTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.tags.base.Container;
|
||||
import com.jpexs.decompiler.flash.tags.base.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSourceContainer;
|
||||
import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag;
|
||||
import com.jpexs.decompiler.flash.timeline.AS2Package;
|
||||
import com.jpexs.decompiler.flash.timeline.AS3Package;
|
||||
@@ -252,11 +251,9 @@ public class TagTreeModel implements TreeModel {
|
||||
}
|
||||
|
||||
if (!hasInnerFrames) {
|
||||
if (tag instanceof Container) {
|
||||
for (ContainerItem item : ((Container) tag).getSubItems()) {
|
||||
if (item instanceof ASMSource) {
|
||||
tagSubNodes.add(item);
|
||||
}
|
||||
if (tag instanceof ASMSourceContainer) {
|
||||
for (ASMSource asm : ((ASMSourceContainer) tag).getSubItems()) {
|
||||
tagSubNodes.add(asm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user