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 36dfc7334..bbf3f650c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -352,7 +352,7 @@ public final class SWF implements SWFContainerItem, Timelined { di.getChildInfos().clear(); } - + public Map getCharacters() { if (characters == null) { synchronized (this) { @@ -857,9 +857,11 @@ public final class SWF implements SWFContainerItem, Timelined { this.tags = tags; if (!checkOnly) { checkInvalidSprites(); + Map chars = new HashMap<>(); + parseCharacters(tags, chars); + characters = chars; assignExportNamesToSymbols(); assignClassesToSymbols(); - SWFDecompilerPlugin.fireSwfParsed(this); } else { boolean hasNonUnknownTag = false; @@ -950,8 +952,8 @@ public final class SWF implements SWFContainerItem, Timelined { } } for (Tag t : tags) { - if (t instanceof CharacterIdTag) { - CharacterIdTag ct = (CharacterIdTag) t; + if (t instanceof CharacterTag) { + CharacterTag ct = (CharacterTag) t; if (exportNames.containsKey(ct.getCharacterId())) { ct.setExportName(exportNames.get(ct.getCharacterId())); } @@ -1939,7 +1941,7 @@ public final class SWF implements SWFContainerItem, Timelined { cnt++; informListeners("rename", "class " + cnt + "/" + classCount); DoInitActionTag dia = (DoInitActionTag) t; - String exportName = dia.getExportName(); + String exportName = characters.containsKey(dia.spriteId)?characters.get(dia.spriteId).getExportName():"_unk_"; final String pkgPrefix = "__Packages."; String[] classNameParts = null; if ((exportName != null) && exportName.startsWith(pkgPrefix)) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java index a84035953..55d54dbcd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags; 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.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -32,7 +33,7 @@ import java.io.OutputStream; * * @author JPEXS */ -public class CSMTextSettingsTag extends Tag { +public class CSMTextSettingsTag extends Tag implements CharacterIdTag { @SWFType(BasicType.UI16) public int textID; @@ -114,4 +115,9 @@ public class CSMTextSettingsTag extends Tag { sharpness = sis.readFLOAT("sharpness"); //F32 = FLOAT reserved2 = sis.readUI8("reserved2"); //reserved } + + @Override + public int getCharacterId() { + return textID; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java index 8e91d3ca8..50d3811c3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags; 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.types.BasicType; import com.jpexs.decompiler.flash.types.CXFORM; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -32,7 +33,7 @@ import java.io.OutputStream; * * @author JPEXS */ -public class DefineButtonCxformTag extends Tag { +public class DefineButtonCxformTag extends Tag implements CharacterIdTag { @SWFType(BasicType.UI16) public int buttonId; @@ -87,4 +88,9 @@ public class DefineButtonCxformTag extends Tag { buttonId = sis.readUI16("buttonId"); buttonColorTransform = sis.readCXFORM("buttonColorTransform"); } + + @Override + public int getCharacterId() { + return buttonId; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java index 59a028905..733c8323d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java @@ -20,6 +20,7 @@ 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.CharacterTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.SOUNDINFO; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -33,7 +34,7 @@ import java.io.OutputStream; * * @author JPEXS */ -public class DefineButtonSoundTag extends CharacterIdTag { +public class DefineButtonSoundTag extends CharacterTag { @SWFType(BasicType.UI16) public int buttonId; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java index 431989b99..6157eb9b9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags; 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.types.BasicType; import com.jpexs.decompiler.flash.types.ZONERECORD; import com.jpexs.decompiler.flash.types.annotations.Reserved; @@ -31,7 +32,7 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.List; -public class DefineFontAlignZonesTag extends Tag { +public class DefineFontAlignZonesTag extends Tag implements CharacterIdTag { @SWFType(BasicType.UI16) public int fontID; @@ -97,4 +98,9 @@ public class DefineFontAlignZonesTag extends Tag { } return baos.toByteArray(); } + + @Override + public int getCharacterId() { + return fontID; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java index 03c2c4fa8..e7bc53774 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags; 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.types.BasicType; import com.jpexs.decompiler.flash.types.LANGCODE; import com.jpexs.decompiler.flash.types.annotations.Reserved; @@ -36,7 +37,7 @@ import java.util.List; * * @author JPEXS */ -public class DefineFontInfo2Tag extends Tag { +public class DefineFontInfo2Tag extends Tag implements CharacterIdTag { @SWFType(BasicType.UI16) public int fontID; @@ -145,4 +146,9 @@ public class DefineFontInfo2Tag extends Tag { codeTable.add(sis.readUI16("code")); } } + + @Override + public int getCharacterId() { + return fontID; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java index b6036f8e3..2dd08c224 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags; 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.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -35,7 +36,7 @@ import java.util.List; * * @author JPEXS */ -public class DefineFontInfoTag extends Tag { +public class DefineFontInfoTag extends Tag implements CharacterIdTag { @SWFType(BasicType.UI16) public int fontId; @@ -146,4 +147,9 @@ public class DefineFontInfoTag extends Tag { } } } + + @Override + public int getCharacterId() { + return fontId; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java index 9eae64a46..7c9dadf7a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags; 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.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.ByteArrayRange; @@ -26,7 +27,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -public class DefineFontNameTag extends Tag { +public class DefineFontNameTag extends Tag implements CharacterIdTag { @SWFType(BasicType.UI16) public int fontId; @@ -79,4 +80,9 @@ public class DefineFontNameTag extends Tag { } return baos.toByteArray(); } + + @Override + public int getCharacterId() { + return fontId; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java index 206ba9bdf..6c22cf3fb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags; 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.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -30,7 +31,7 @@ import java.io.OutputStream; /** * @author JPEXS */ -public class DefineScalingGridTag extends Tag { +public class DefineScalingGridTag extends Tag implements CharacterIdTag { @SWFType(BasicType.UI16) public int characterId; @@ -78,4 +79,9 @@ public class DefineScalingGridTag extends Tag { } return baos.toByteArray(); } + + @Override + public int getCharacterId() { + return characterId; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index 202378bb1..c97933e02 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -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.base.ASMSource; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; +import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.HideInRawEdit; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -39,7 +40,7 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -public class DoInitActionTag extends CharacterIdTag implements ASMSource { +public class DoInitActionTag extends Tag implements CharacterIdTag,ASMSource { /** * Identifier of Sprite @@ -193,7 +194,8 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { @Override public String getExportFileName() { - String expName = getExportName(); + CharacterTag sprite=swf.getCharacter(spriteId); + String expName = sprite!=null?sprite.getExportName():null; if ((expName == null) || expName.isEmpty()) { return super.getExportFileName(); } @@ -208,7 +210,8 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { @Override public String getName() { - String expName = getExportName(); + CharacterTag sprite=swf.getCharacter(spriteId); + String expName = sprite!=null?sprite.getExportName():null; if ((expName == null) || expName.isEmpty()) { return super.getName(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java index adcff4344..71cde6bdd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java @@ -33,7 +33,7 @@ import java.io.OutputStream; * * @author JPEXS */ -public class RemoveObjectTag extends CharacterIdTag implements RemoveTag { +public class RemoveObjectTag extends Tag implements CharacterIdTag,RemoveTag { /** * ID of character to place diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java index 71aaef8b0..dd8feb080 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java @@ -20,6 +20,7 @@ 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.CharacterTag; import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.Conditional; @@ -40,7 +41,7 @@ import java.util.List; * * @author JPEXS */ -public class SoundStreamHead2Tag extends CharacterIdTag implements SoundStreamHeadTypeTag { +public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHeadTypeTag { @Reserved @SWFType(value = BasicType.UB, count = 4) 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 541902a8f..b0eb10b78 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,6 +20,7 @@ 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.CharacterTag; import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.Conditional; @@ -40,7 +41,7 @@ import java.util.List; * * @author JPEXS */ -public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHeadTypeTag { +public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadTypeTag { @Reserved @SWFType(value = BasicType.UB, count = 4) @@ -261,4 +262,6 @@ public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHea final int[] rateMap = {5512, 11025, 22050, 44100}; return new SoundFormat(getSoundFormatId(), rateMap[getSoundRate()], getSoundType()); } + + } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java index e2af5e4b9..399975511 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java @@ -24,49 +24,10 @@ import com.jpexs.helpers.ByteArrayRange; * * @author JPEXS */ -public abstract class CharacterIdTag extends Tag { +public interface CharacterIdTag { - public CharacterIdTag(SWF swf, int id, String name, ByteArrayRange data) { - super(swf, id, name, data); - } + - public abstract int getCharacterId(); - - protected String exportName; - - public void setExportName(String exportName) { - if ("".equals(exportName)) { - exportName = null; - } - this.exportName = exportName; - } - - @Override - public String getName() { - String nameAppend = ""; - if (exportName != null) { - nameAppend = ": " + exportName; - } - if (getCharacterId() != -1) { - return super.getName() + " (" + getCharacterId() + nameAppend + ")"; - } - if (!nameAppend.isEmpty()) { - return super.getName() + " (" + nameAppend + ")"; - } - return super.getName(); - } - - @Override - public String getExportFileName() { - String result = super.getExportFileName() + "_" + getCharacterId(); - return result + (exportName != null ? "_" + exportName : ""); - } - - public String getCharacterExportFileName() { - return getCharacterId() + (exportName != null ? "_" + exportName : ""); - } - - public String getExportName() { - return exportName; - } + public int getCharacterId(); + } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java index ce8f7d2d6..81c8e4785 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java @@ -17,13 +17,14 @@ package com.jpexs.decompiler.flash.tags.base; import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.helpers.ByteArrayRange; /** * * @author JPEXS */ -public abstract class CharacterTag extends CharacterIdTag { +public abstract class CharacterTag extends Tag implements CharacterIdTag { protected String className; @@ -57,8 +58,20 @@ public abstract class CharacterTag extends CharacterIdTag { return result + (className != null ? "_" + className : ""); } - @Override public String getCharacterExportFileName() { return getCharacterId() + (exportName != null ? "_" + exportName : "") + (className != null ? "_" + className : ""); } + + protected String exportName; + + public void setExportName(String exportName) { + if ("".equals(exportName)) { + exportName = null; + } + this.exportName = exportName; + } + + public String getExportName() { + return exportName; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java index 732956722..e759df4b1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags.base; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFOutputStream; +import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.MATRIX; @@ -31,7 +32,7 @@ import java.util.List; * * @author JPEXS */ -public abstract class PlaceObjectTypeTag extends CharacterIdTag { +public abstract class PlaceObjectTypeTag extends Tag implements CharacterIdTag { public PlaceObjectTypeTag(SWF swf, int id, String name, ByteArrayRange data) { super(swf, id, name, data); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index ef40bf020..adafea1d4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -360,7 +360,8 @@ public class Timeline { for (ASMSource asm : asmSources) { if (asm instanceof DoInitActionTag) { DoInitActionTag initAction = (DoInitActionTag) asm; - String path = initAction.getExportName(); + CharacterTag cht=swf.getCharacter(initAction.spriteId); + String path = cht!=null?cht.getExportName():"_unk_"; if (path == null || path.isEmpty()) { path = initAction.getExportFileName(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index bb0a2a5c2..fe4e0c490 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -2733,7 +2733,10 @@ public class XFLConverter { DefineSpriteTag sprite = (DefineSpriteTag) characters.get(chid); if (sprite.subTags.isEmpty()) { String data = convertActionScript(dia); - String expPath = dia.getExportName(); + CharacterTag spr=dia.getSwf().getCharacter(dia.spriteId); + String expName = spr!=null?spr.getExportName():"_unk_"; + + String expPath = spr.getExportName(); final String prefix = "__Packages."; if (expPath.startsWith(prefix)) { expPath = expPath.substring(prefix.length()); diff --git a/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java b/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java index 5b1878cd9..6cda4935e 100644 --- a/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java +++ b/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java @@ -45,4 +45,9 @@ public enum TreeNodeType { BUNDLE_SWC, BUNDLE_BINARY, HEADER, + SET_BACKGROUNDCOLOR, + FILE_ATTRIBUTES, + METADATA, + PLACE_OBJECT, + REMOVE_OBJECT } diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/fileattributes16.png b/src/com/jpexs/decompiler/flash/gui/graphics/fileattributes16.png new file mode 100644 index 000000000..92953feca Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/fileattributes16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/metadata16.png b/src/com/jpexs/decompiler/flash/gui/graphics/metadata16.png new file mode 100644 index 000000000..f64dd0117 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/metadata16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/placeobject16.png b/src/com/jpexs/decompiler/flash/gui/graphics/placeobject16.png new file mode 100644 index 000000000..0ea124a74 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/placeobject16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/removeobject16.png b/src/com/jpexs/decompiler/flash/gui/graphics/removeobject16.png new file mode 100644 index 000000000..ace289edd Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/removeobject16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/setbackgroundcolor16.png b/src/com/jpexs/decompiler/flash/gui/graphics/setbackgroundcolor16.png new file mode 100644 index 000000000..d4eb0e446 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/setbackgroundcolor16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java index 262180647..76406e400 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java @@ -96,6 +96,8 @@ import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.flash.tags.base.ButtonTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; import com.jpexs.decompiler.flash.tags.base.MorphShapeTag; +import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; +import com.jpexs.decompiler.flash.tags.base.RemoveTag; import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.tags.base.SymbolClassTypeTag; import com.jpexs.decompiler.flash.tags.base.TextTag; @@ -336,6 +338,21 @@ public class TagTree extends JTree { } } + if(t instanceof SetBackgroundColorTag){ + return TreeNodeType.SET_BACKGROUNDCOLOR; + } + if(t instanceof FileAttributesTag){ + return TreeNodeType.FILE_ATTRIBUTES; + } + if(t instanceof MetadataTag){ + return TreeNodeType.METADATA; + } + if(t instanceof PlaceObjectTypeTag){ + return TreeNodeType.PLACE_OBJECT; + } + if(t instanceof RemoveTag){ + return TreeNodeType.REMOVE_OBJECT; + } if (t instanceof Tag) { return TreeNodeType.OTHER_TAG; } diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java index eeaa7109c..b91a377aa 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java @@ -28,6 +28,8 @@ 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.ASMSourceContainer; +import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; +import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.timeline.AS2Package; import com.jpexs.decompiler.flash.timeline.AS3Package; @@ -190,7 +192,7 @@ public class TagTreeModel implements TreeModel { List sounds = new ArrayList<>(); List binaryData = new ArrayList<>(); List others = new ArrayList<>(); - + Map> mappedTags = new HashMap<>(); for (Tag t : swf.tags) { TreeNodeType ttype = TagTree.getTreeNodeType(t); switch (ttype) { @@ -229,7 +231,20 @@ public class TagTreeModel implements TreeModel { break; default: if (t.getId() != ShowFrameTag.ID && !ShowFrameTag.isNestedTagType(t.getId())) { - others.add(t); + boolean parentFound = false; + if ((t instanceof CharacterIdTag) && !(t instanceof CharacterTag)) { + CharacterIdTag chit = (CharacterIdTag) t; + if (swf.getCharacter(chit.getCharacterId()) != null) { + parentFound = true; + if (!mappedTags.containsKey(chit.getCharacterId())) { + mappedTags.put(chit.getCharacterId(), new ArrayList<>()); + } + mappedTags.get(chit.getCharacterId()).add(t); + } + } + if (!parentFound) { + others.add(t); + } } break; } @@ -318,6 +333,7 @@ public class TagTreeModel implements TreeModel { TagTreeSwfInfo swfInfo = new TagTreeSwfInfo(); swfInfo.folders = nodeList; + swfInfo.mappedTags = mappedTags; swfInfo.tagScriptCache = currentTagScriptCache; swfInfos.put(swf, swfInfo); } @@ -461,6 +477,20 @@ public class TagTreeModel implements TreeModel { return swfInfo.folders; } + + private List getMappedCharacters(SWF swf,CharacterTag tag) { + TagTreeSwfInfo swfInfo = swfInfos.get(swf); + if (swfInfo == null) { + createTagList(swf); + swfInfo = swfInfos.get(swf); + } + + List mapped = swfInfo.mappedTags.get(tag.getCharacterId()); + if(mapped == null){ + mapped = new ArrayList<>(); + } + return mapped; + } public List getAllChildren(Object parent) { TreeItem parentNode = (TreeItem) parent; @@ -530,6 +560,8 @@ public class TagTreeModel implements TreeModel { } else { return new ArrayList<>(); } + } else if (parentNode instanceof CharacterTag){ + return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode); } return new ArrayList<>(); @@ -600,6 +632,8 @@ public class TagTreeModel implements TreeModel { return clt.getChild(clt.getRoot(), index); } else if (parentNode instanceof AS3ClassTreeItem) { return ((AS3Package) parentNode).getChild(index); + } else if (parentNode instanceof CharacterTag){ + return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode).get(index); } throw new Error("Unsupported parent type: " + parentNode.getClass().getName()); @@ -636,6 +670,8 @@ public class TagTreeModel implements TreeModel { return clt.getChildCount(clt.getRoot()); } else if (parentNode instanceof AS3Package) { return ((AS3Package) parentNode).getChildCount(); + } else if (parentNode instanceof CharacterTag){ + return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode).size(); } return 0; @@ -690,6 +726,8 @@ public class TagTreeModel implements TreeModel { return clt.getIndexOfChild(clt.getRoot(), childNode); } else if (parentNode instanceof AS3ClassTreeItem) { return ((AS3Package) parentNode).getIndexOfChild((AS3ClassTreeItem) childNode); + } else if (parentNode instanceof CharacterTag){ + return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode).indexOf(childNode); } throw new Error("Unsupported parent type: " + parentNode.getClass().getName()); diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeSwfInfo.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeSwfInfo.java index 5d95f5314..06eb8589f 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeSwfInfo.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeSwfInfo.java @@ -29,6 +29,7 @@ import java.util.Map; public class TagTreeSwfInfo { public List folders; + public Map> mappedTags; public Map tagScriptCache; }