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 6e537f6bb..40ffbaa72 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -371,6 +371,12 @@ public final class SWF implements SWFContainerItem, Timelined { return getCharacters().get(characterId); } + public String getExportName(int characterId) { + CharacterTag characterTag = getCharacters().get(characterId); + String exportName = characterTag != null ? characterTag.getExportName() : null; + return exportName; + } + public FontTag getFont(int fontId) { CharacterTag characterTag = getCharacters().get(fontId); if (characterTag instanceof FontTag) { @@ -512,7 +518,14 @@ public final class SWF implements SWFContainerItem, Timelined { private void parseCharacters(List list, Map characters) { for (Tag t : list) { if (t instanceof CharacterTag) { - characters.put(((CharacterTag) t).getCharacterId(), (CharacterTag) t); + int characterId = ((CharacterTag) t).getCharacterId(); + if (characters.containsKey(characterId)) { + logger.log(Level.SEVERE, "SWF already contains characterId={0}", characterId); + } + + if (characterId != 0) { + characters.put(characterId, (CharacterTag) t); + } } if (t instanceof DefineSpriteTag) { parseCharacters(((DefineSpriteTag) t).getSubTags(), characters); @@ -1940,10 +1953,11 @@ public final class SWF implements SWFContainerItem, Timelined { cnt++; informListeners("rename", "class " + cnt + "/" + classCount); DoInitActionTag dia = (DoInitActionTag) t; - String exportName = characters.containsKey(dia.spriteId) ? characters.get(dia.spriteId).getExportName() : "_unk_"; + String exportName = getExportName(dia.spriteId); + exportName = exportName != null ? exportName : "_unk_"; final String pkgPrefix = "__Packages."; String[] classNameParts = null; - if ((exportName != null) && exportName.startsWith(pkgPrefix)) { + if (exportName.startsWith(pkgPrefix)) { String className = exportName.substring(pkgPrefix.length()); if (className.contains(".")) { classNameParts = className.split("\\."); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java index 550c7ec24..5b8e064c5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java @@ -83,17 +83,14 @@ import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.Namespace; import com.jpexs.decompiler.flash.action.swf4.ActionIf; import com.jpexs.decompiler.flash.configuration.Configuration; -import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.tags.ABCContainerTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.graph.CompilationException; -import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.AndItem; import com.jpexs.decompiler.graph.model.BinaryOp; -import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.BlockItem; import com.jpexs.decompiler.graph.model.BreakItem; import com.jpexs.decompiler.graph.model.CommaExpressionItem; @@ -101,7 +98,6 @@ import com.jpexs.decompiler.graph.model.ContinueItem; import com.jpexs.decompiler.graph.model.DoWhileItem; import com.jpexs.decompiler.graph.model.ForItem; import com.jpexs.decompiler.graph.model.IfItem; -import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.NotItem; import com.jpexs.decompiler.graph.model.OrItem; import com.jpexs.decompiler.graph.model.ParenthesisItem; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java index e831f7df8..84c2ab57d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java @@ -35,7 +35,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceAIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceSIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.ConvertBIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.types.ConvertDIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.ConvertIIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.ConvertUIns; import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java index 2db4a120a..8c7d52910 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java @@ -128,7 +128,6 @@ import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.model.AndItem; -import com.jpexs.decompiler.graph.model.BinaryOp; import com.jpexs.decompiler.graph.model.BlockItem; import com.jpexs.decompiler.graph.model.BreakItem; import com.jpexs.decompiler.graph.model.CommaExpressionItem; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java index 9777a16bf..2cf7e2e0e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java @@ -51,6 +51,10 @@ public class BinaryDataExporter { count++; } } + + if (count == 0) { + return ret; + } int currentIndex = 1; for (final Tag t : tags) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java index ce474b167..1ea7048de 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java @@ -71,6 +71,10 @@ public class FontExporter { } } + if (count == 0) { + return ret; + } + int currentIndex = 1; for (Tag t : tags) { if (t instanceof FontTag) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ImageExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ImageExporter.java index ec2263143..cac82662f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ImageExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ImageExporter.java @@ -56,6 +56,10 @@ public class ImageExporter { } } + if (count == 0) { + return ret; + } + int currentIndex = 1; for (Tag t : tags) { if (t instanceof ImageTag) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java index a5747ddb4..9fb3a80c0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java @@ -66,6 +66,10 @@ public class MorphShapeExporter { } } + if (count == 0) { + return ret; + } + int currentIndex = 1; for (final Tag t : tags) { if (t instanceof MorphShapeTag) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java index 1c04db5b9..2d183eb32 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java @@ -64,6 +64,10 @@ public class MovieExporter { } } + if (count == 0) { + return ret; + } + int currentIndex = 1; for (Tag t : tags) { if (t instanceof DefineVideoStreamTag) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java index d8527b9c0..ba9d5ee30 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java @@ -71,6 +71,10 @@ public class ShapeExporter { } } + if (count == 0) { + return ret; + } + int currentIndex = 1; for (final Tag t : tags) { if (t instanceof ShapeTag) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java index e12ac8ccd..c631ca6d6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java @@ -67,6 +67,10 @@ public class SoundExporter { } } + if (count == 0) { + return ret; + } + int currentIndex = 1; for (Tag t : tags) { if (t instanceof SoundTag) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java index f3eba4000..a69faa124 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java @@ -65,6 +65,10 @@ public class TextExporter { } } + if (count == 0) { + return ret; + } + int currentIndex = 1; if (settings.mode == TextExportMode.SVG) { for (Tag t : tags) { 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 143be0e91..ef6bd199b 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 @@ -267,6 +267,7 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer { if (timeline != null) { return timeline; } + timeline = new Timeline(swf, this, new ArrayList(), buttonId, getRect()); int maxDepth = 0; @@ -300,18 +301,25 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer { } } + timeline.addFrame(frameUp); + if (frameOver.layers.isEmpty()) { frameOver = frameUp; } + timeline.addFrame(frameOver); + if (frameDown.layers.isEmpty()) { frameDown = frameOver; } + timeline.addFrame(frameDown); + if (frameHit.layers.isEmpty()) { frameHit = frameUp; } + timeline.addFrame(frameHit); return timeline; } 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 733c8323d..0fa8f12a5 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,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.CharacterTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.SOUNDINFO; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -34,7 +33,7 @@ import java.io.OutputStream; * * @author JPEXS */ -public class DefineButtonSoundTag extends CharacterTag { +public class DefineButtonSoundTag extends Tag implements CharacterIdTag { @SWFType(BasicType.UI16) public int buttonId; 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 c97933e02..5f9ecc675 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 @@ -194,8 +194,7 @@ public class DoInitActionTag extends Tag implements CharacterIdTag,ASMSource { @Override public String getExportFileName() { - CharacterTag sprite=swf.getCharacter(spriteId); - String expName = sprite!=null?sprite.getExportName():null; + String expName = swf.getExportName(spriteId); if ((expName == null) || expName.isEmpty()) { return super.getExportFileName(); } @@ -210,8 +209,7 @@ public class DoInitActionTag extends Tag implements CharacterIdTag,ASMSource { @Override public String getName() { - CharacterTag sprite=swf.getCharacter(spriteId); - String expName = sprite!=null?sprite.getExportName():null; + String expName = swf.getExportName(spriteId); if ((expName == null) || expName.isEmpty()) { return super.getName(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java index 10fd07bc2..e5ac0c8af 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java @@ -27,7 +27,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -public class RemoveObject2Tag extends Tag implements RemoveTag { +public class RemoveObject2Tag extends RemoveTag { @SWFType(BasicType.UI16) public int depth; 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 71cde6bdd..230cad0f3 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 Tag implements CharacterIdTag,RemoveTag { +public class RemoveObjectTag extends RemoveTag implements CharacterIdTag { /** * 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 dd8feb080..a7c10b998 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 @@ -19,8 +19,6 @@ 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.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; @@ -41,7 +39,7 @@ import java.util.List; * * @author JPEXS */ -public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHeadTypeTag { +public class SoundStreamHead2Tag extends Tag implements SoundStreamHeadTypeTag { @Reserved @SWFType(value = BasicType.UB, count = 4) @@ -239,4 +237,10 @@ public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHead final int[] rateMap = {5512, 11025, 22050, 44100}; return new SoundFormat(getSoundFormatId(), rateMap[getSoundRate()], getSoundType()); } + + @Override + public String getCharacterExportFileName() { + String exportName = swf.getExportName(getCharacterId()); + return getCharacterId() + (exportName != null ? "_" + exportName : ""); + } } 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 b0eb10b78..d45c7fce3 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 @@ -19,8 +19,6 @@ 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.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; @@ -41,7 +39,7 @@ import java.util.List; * * @author JPEXS */ -public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadTypeTag { +public class SoundStreamHeadTag extends Tag implements SoundStreamHeadTypeTag { @Reserved @SWFType(value = BasicType.UB, count = 4) @@ -263,5 +261,9 @@ public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadT return new SoundFormat(getSoundFormatId(), rateMap[getSoundRate()], getSoundType()); } - + @Override + public String getCharacterExportFileName() { + String exportName = swf.getExportName(getCharacterId()); + return getCharacterId() + (exportName != null ? "_" + 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 e759df4b1..9d76d4564 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 @@ -74,11 +74,32 @@ public abstract class PlaceObjectTypeTag extends Tag implements CharacterIdTag { @Override public String getName() { - return super.getName() + " Depth: " + getDepth(); + String result = super.getName(); + String exportName = swf.getExportName(getCharacterId()); + String nameAppend = ""; + if (exportName != null) { + nameAppend = ": " + exportName; + } + + if (getCharacterId() != -1) { + result += " (" + getCharacterId() + nameAppend + ")"; + } + if (!nameAppend.isEmpty()) { + result += " (" + nameAppend + ")"; + } + + return result + " Depth: " + getDepth(); } @Override public String getExportFileName() { - return super.getExportFileName() + "_" + getDepth(); + String result = super.getExportFileName() + "_" + getCharacterId() + "_" + getDepth(); + String exportName = swf.getExportName(getCharacterId()); + if (exportName != null) { + result += "_" + exportName; + } + + result += "_" + getDepth(); + return result; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/RemoveTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/RemoveTag.java index 2663dde90..bd7263926 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/RemoveTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/RemoveTag.java @@ -12,14 +12,67 @@ * 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.SWF; +import com.jpexs.decompiler.flash.tags.Tag; +import com.jpexs.helpers.ByteArrayRange; + /** * * @author JPEXS */ -public interface RemoveTag { +public abstract class RemoveTag extends Tag { - public int getDepth(); + public RemoveTag(SWF swf, int id, String name, ByteArrayRange data) { + super(swf, id, name, data); + } + + public abstract int getDepth(); + + @Override + public String getName() { + String result = super.getName(); + String exportName = swf.getExportName(getCharacterId()); + String nameAppend = ""; + if (exportName != null) { + nameAppend = ": " + exportName; + } + + if (getCharacterId() != -1) { + result += " (" + getCharacterId() + nameAppend + ")"; + } + + if (!nameAppend.isEmpty()) { + result += " (" + nameAppend + ")"; + } + + return result + " Depth: " + getDepth(); + } + + @Override + public String getExportFileName() { + String result = super.getExportFileName(); + if (getCharacterId() != -1) { + result += "_" + getCharacterId(); + } + + String exportName = swf.getExportName(getCharacterId()); + if (exportName != null) { + result += "_" + exportName; + } + + result += "_" + getDepth(); + return result; + } + + private int getCharacterId() { + if (this instanceof CharacterIdTag) { + return ((CharacterIdTag) this).getCharacterId(); + } + + return -1; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java index caf50ac14..8e6095b4d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.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.tags.SoundStreamBlockTag; @@ -22,7 +23,7 @@ import java.util.List; * * @author JPEXS */ -public interface SoundStreamHeadTypeTag extends SoundTag { +public interface SoundStreamHeadTypeTag extends CharacterIdTag, SoundTag { @Override public boolean getSoundSize(); 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 adafea1d4..63d569bdc 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,9 +360,9 @@ public class Timeline { for (ASMSource asm : asmSources) { if (asm instanceof DoInitActionTag) { DoInitActionTag initAction = (DoInitActionTag) asm; - CharacterTag cht=swf.getCharacter(initAction.spriteId); - String path = cht!=null?cht.getExportName():"_unk_"; - if (path == null || path.isEmpty()) { + String path = swf.getExportName(initAction.spriteId); + path = path != null ? path : "_unk_"; + if (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 8ca08bf49..e154be654 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 @@ -2728,10 +2728,9 @@ public class XFLConverter { DefineSpriteTag sprite = (DefineSpriteTag) characters.get(chid); if (sprite.subTags.isEmpty()) { String data = convertActionScript(dia); - CharacterTag spr = dia.getSwf().getCharacter(dia.spriteId); - String expName = spr != null ? spr.getExportName() : "_unk_"; - - String expPath = spr.getExportName(); + String expName = dia.getSwf().getExportName(dia.spriteId); + expName = expName != null ? expName : "_unk_"; + String expPath = expName; final String prefix = "__Packages."; if (expPath.startsWith(prefix)) { expPath = expPath.substring(prefix.length()); diff --git a/src/com/jpexs/decompiler/flash/gui/pipes/PipeOutputStream.java b/src/com/jpexs/decompiler/flash/gui/pipes/PipeOutputStream.java index dc50380c6..47be3cf83 100644 --- a/src/com/jpexs/decompiler/flash/gui/pipes/PipeOutputStream.java +++ b/src/com/jpexs/decompiler/flash/gui/pipes/PipeOutputStream.java @@ -22,7 +22,6 @@ import com.sun.jna.platform.win32.WinNT.HANDLE; import com.sun.jna.ptr.IntByReference; import java.io.IOException; import java.io.OutputStream; -import java.util.logging.Level; /** * diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java index b91a377aa..ee4a70ef5 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java @@ -478,7 +478,7 @@ public class TagTreeModel implements TreeModel { return swfInfo.folders; } - private List getMappedCharacters(SWF swf,CharacterTag tag) { + private List getMappedCharacters(SWF swf, CharacterTag tag) { TagTreeSwfInfo swfInfo = swfInfos.get(swf); if (swfInfo == null) { createTagList(swf); @@ -489,6 +489,7 @@ public class TagTreeModel implements TreeModel { if(mapped == null){ mapped = new ArrayList<>(); } + return mapped; } @@ -671,7 +672,8 @@ public class TagTreeModel implements TreeModel { } else if (parentNode instanceof AS3Package) { return ((AS3Package) parentNode).getChildCount(); } else if (parentNode instanceof CharacterTag){ - return getMappedCharacters(((CharacterTag)parentNode).getSwf(),(CharacterTag)parentNode).size(); + SWF swf = ((CharacterTag) parentNode).getSwf(); + return swf == null ? 0 : getMappedCharacters(swf,(CharacterTag)parentNode).size(); } return 0; diff --git a/src/com/sun/jna/platform/win32/Advapi32.java b/src/com/sun/jna/platform/win32/Advapi32.java index ee65ebbdb..9d6681537 100644 --- a/src/com/sun/jna/platform/win32/Advapi32.java +++ b/src/com/sun/jna/platform/win32/Advapi32.java @@ -394,7 +394,7 @@ public interface Advapi32 extends StdCallLibrary { public int RegSetValueEx(HKEY hKey, String lpValueName, int Reserved, int dwType, byte[] lpData, int cbData); - /* * + /** * * @param hKey * @param lpSubKey @@ -413,7 +413,7 @@ public interface Advapi32 extends StdCallLibrary { int dwOptions, int samDesired, SECURITY_ATTRIBUTES lpSecurityAttributes, HKEYByReference phkResult, IntByReference lpdwDisposition); - /* + /** * * @param hKey * @param name diff --git a/src/com/sun/jna/platform/win32/Gdi32.java b/src/com/sun/jna/platform/win32/Gdi32.java index 85316ee6d..88756dfc2 100644 --- a/src/com/sun/jna/platform/win32/Gdi32.java +++ b/src/com/sun/jna/platform/win32/Gdi32.java @@ -303,7 +303,7 @@ public interface Gdi32 extends StdCallLibrary { */ int GetDeviceCaps(HDC hdc, int nIndex); - /* * + /** * The GetDIBits function retrieves the bits fo the specified compatible * bitmap and copies them into a buffer as a DIB using the specified format. * diff --git a/src/com/sun/jna/platform/win32/Shell32.java b/src/com/sun/jna/platform/win32/Shell32.java index 2688caea4..227449f7b 100644 --- a/src/com/sun/jna/platform/win32/Shell32.java +++ b/src/com/sun/jna/platform/win32/Shell32.java @@ -27,7 +27,7 @@ public interface Shell32 extends StdCallLibrary { Shell32 INSTANCE = (Shell32) Native.loadLibrary("shell32", Shell32.class, W32APIOptions.UNICODE_OPTIONS); - /* * + /** * @param lpExecInfo * @return true if successful. Otherwise false. */ diff --git a/src/com/sun/jna/platform/win32/User32.java b/src/com/sun/jna/platform/win32/User32.java index 71fc877bf..0efe231d4 100644 --- a/src/com/sun/jna/platform/win32/User32.java +++ b/src/com/sun/jna/platform/win32/User32.java @@ -952,7 +952,7 @@ public interface User32 extends StdCallLibrary, WinUser { */ DWORD SendInput(DWORD nInputs, WinUser.INPUT[] pInputs, int cbSize); - /* * + /** * Waits until the specified process has finished processing its initial * input and is waiting for user input with no input pending, or until the * time-out interval has elapsed. @@ -1099,7 +1099,7 @@ public interface User32 extends StdCallLibrary, WinUser { */ boolean CloseWindow(HWND hWnd); - /* * + /** * Defines a system-wide hot key. * * @param hWnd A handle to the window that will receive @@ -1199,7 +1199,7 @@ public interface User32 extends StdCallLibrary, WinUser { */ public boolean UnregisterClass(WString lpClassName, HINSTANCE hInstance); - /* * + /** * Creates an overlapped, pop-up, or child window with an extended window * style; otherwise, this function is identical to the CreateWindow * function. For more information about creating a window and for full diff --git a/src/com/sun/jna/platform/win32/W32Errors.java b/src/com/sun/jna/platform/win32/W32Errors.java index 02631f460..be77b5d6b 100644 --- a/src/com/sun/jna/platform/win32/W32Errors.java +++ b/src/com/sun/jna/platform/win32/W32Errors.java @@ -166,7 +166,7 @@ public abstract class W32Errors implements WinError { | 0x80000000); } - /* * + /** * FACILITY_USERMODE_FILTER_MANAGER * * Translation macro for converting: NTSTATUS --> HRESULT. diff --git a/src/com/sun/jna/platform/win32/WinNT.java b/src/com/sun/jna/platform/win32/WinNT.java index f48212407..0b1079914 100644 --- a/src/com/sun/jna/platform/win32/WinNT.java +++ b/src/com/sun/jna/platform/win32/WinNT.java @@ -346,7 +346,7 @@ public interface WinNT extends WinError, WinDef, WinBase, BaseTSD { Privileges = new LUID_AND_ATTRIBUTES[nbOfPrivileges]; } - /* * + /** * Initialize a TOKEN_PRIVILEGES instance from initialized memory. * * @param p @@ -671,7 +671,7 @@ public interface WinNT extends WinError, WinDef, WinBase, BaseTSD { allocateMemory(size); } - /* * + /** * WARNING: this filename may be either the short or long form of the * filename. * @@ -1030,7 +1030,7 @@ public interface WinNT extends WinError, WinDef, WinBase, BaseTSD { immutable = true; } - /* * + /** * Override to the appropriate object for INVALID_HANDLE_VALUE. * * @param nativeValue diff --git a/src/com/sun/jna/platform/win32/WinUser.java b/src/com/sun/jna/platform/win32/WinUser.java index e6be6aa1d..5344d9c45 100644 --- a/src/com/sun/jna/platform/win32/WinUser.java +++ b/src/com/sun/jna/platform/win32/WinUser.java @@ -265,7 +265,7 @@ public interface WinUser extends StdCallLibrary, WinDef { public interface WNDENUMPROC extends StdCallCallback { - /* * + /** * Return whether to continue enumeration. * * @param hWnd