diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 59b91687f..9773ae0ce 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -1141,18 +1141,18 @@ public final class SWF implements TreeItem { } } - private static void createWavFromAdpcm(OutputStream fos, int soundRate, int soundSize, int soundType, byte[] data) throws IOException { - byte[] pcmData = AdpcmDecoder.decode(data, soundType == 1 ? true : false); + private static void createWavFromAdpcm(OutputStream fos, int soundRate, boolean soundSize, boolean soundType, byte[] data) throws IOException { + byte[] pcmData = AdpcmDecoder.decode(data, soundType); ByteArrayOutputStream subChunk1Data = new ByteArrayOutputStream(); int audioFormat = 1; //PCM writeLE(subChunk1Data, audioFormat, 2); - int numChannels = soundType == 1 ? 2 : 1; + int numChannels = soundType ? 2 : 1; writeLE(subChunk1Data, numChannels, 2); int[] rateMap = {5512, 11025, 22050, 44100}; int sampleRate = rateMap[soundRate]; writeLE(subChunk1Data, sampleRate, 4); - int bitsPerSample = soundSize == 1 ? 16 : 8; + int bitsPerSample = soundSize ? 16 : 8; int byteRate = sampleRate * numChannels * bitsPerSample / 8; writeLE(subChunk1Data, byteRate, 4); int blockAlign = numChannels * bitsPerSample / 8; diff --git a/trunk/src/com/jpexs/decompiler/flash/flv/AUDIODATA.java b/trunk/src/com/jpexs/decompiler/flash/flv/AUDIODATA.java index b000afa97..bff358fa8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/flv/AUDIODATA.java +++ b/trunk/src/com/jpexs/decompiler/flash/flv/AUDIODATA.java @@ -43,11 +43,11 @@ public class AUDIODATA extends DATA { public static final int SOUNDTYPE_STEREO = 1; public int soundFormat; public int soundRate; - public int soundSize; - public int soundType; + public boolean soundSize; + public boolean soundType; public byte[] soundData; - public AUDIODATA(int soundFormat, int soundRate, int soundSize, int soundType, byte[] soundData) { + public AUDIODATA(int soundFormat, int soundRate, boolean soundSize, boolean soundType, byte[] soundData) { this.soundFormat = soundFormat; this.soundRate = soundRate; this.soundSize = soundSize; @@ -62,8 +62,8 @@ public class AUDIODATA extends DATA { FLVOutputStream flv = new FLVOutputStream(baos); flv.writeUB(4, soundFormat); flv.writeUB(2, soundRate); - flv.writeUB(1, soundSize); - flv.writeUB(1, soundType); + flv.writeUB(1, soundSize?1:0); + flv.writeUB(1, soundType?1:0); flv.write(soundData); } catch (IOException ex) { //ignore diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java index 38aac0b47..3c3e25750 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -31,11 +33,21 @@ import java.io.OutputStream; */ public class CSMTextSettingsTag extends Tag { + @SWFType(BasicType.UI16) public int textID; + + @SWFType(value=BasicType.UB,count=2) public int useFlashType; + + @SWFType(value=BasicType.UB,count=3) public int gridFit; + + @SWFType(value=BasicType.FLOAT) //F32 = FLOAT public float thickness; + + @SWFType(value=BasicType.FLOAT) //F32 = FLOAT public float sharpness; + public static final int ID = 74; /** diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java index edb7c7f30..2e2bad942 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -31,7 +33,9 @@ import java.io.OutputStream; */ public class DebugIDTag extends Tag { + @SWFType(value=BasicType.UI8,count=16) public byte[] debugId; + public static final int ID = 63; /** diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java index 6c06c3380..cad58e3c5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java @@ -20,6 +20,9 @@ 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.CharacterTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Reserved; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -27,9 +30,15 @@ import java.io.OutputStream; public class DefineBinaryDataTag extends CharacterTag { + @SWFType(BasicType.UI16) public int tag; + public byte[] binaryData; + + @Reserved + @SWFType(BasicType.UI32) public long reserved; + public static final int ID = 87; /** diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java index 391db895c..98ad7fb95 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java @@ -21,6 +21,8 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.AloneTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -32,8 +34,12 @@ import javax.imageio.ImageIO; public class DefineBitsJPEG2Tag extends ImageTag implements AloneTag { + @SWFType(BasicType.UI16) public int characterID; + + @SWFType(BasicType.UI8) public byte[] imageData; + public static final int ID = 21; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java index ce2110b66..8f8eec44d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java @@ -21,6 +21,8 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.AloneTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -32,9 +34,15 @@ import javax.imageio.ImageIO; public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag { + @SWFType(BasicType.UI16) public int characterID; + + @SWFType(BasicType.UI8) public byte[] imageData; + + @SWFType(BasicType.UI8) public byte[] bitmapAlphaData; + public static final int ID = 35; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java index a1e0e8706..a57e1bff0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java @@ -21,6 +21,8 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.AloneTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -38,10 +40,18 @@ import javax.imageio.ImageIO; */ public class DefineBitsJPEG4Tag extends ImageTag implements AloneTag { + @SWFType(BasicType.UI16) public int characterID; + + @SWFType(BasicType.UI16) public int deblockParam; + + @SWFType(BasicType.UI8) public byte[] imageData; + + @SWFType(BasicType.UI8) public byte[] bitmapAlphaData; + public static final int ID = 90; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java index 4deb01b89..3c7b7cb52 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java @@ -24,6 +24,9 @@ import com.jpexs.decompiler.flash.tags.base.ImageTag; import com.jpexs.decompiler.flash.types.ALPHABITMAPDATA; import com.jpexs.decompiler.flash.types.ALPHACOLORMAPDATA; import com.jpexs.decompiler.flash.types.ARGB; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.awt.Color; import java.io.ByteArrayInputStream; @@ -37,14 +40,27 @@ import javax.imageio.ImageIO; public class DefineBitsLossless2Tag extends ImageTag implements AloneTag { + @SWFType(BasicType.UI16) public int characterID; + + @SWFType(BasicType.UI8) public int bitmapFormat; + + @SWFType(BasicType.UI16) public int bitmapWidth; + + @SWFType(BasicType.UI16) public int bitmapHeight; + + @SWFType(BasicType.UI8) + @Conditional(value="bitmapFormat",options={FORMAT_8BIT_COLORMAPPED}) public int bitmapColorTableSize; + public byte[] zlibBitmapData; //TODO: Parse ALPHACOLORMAPDATA,ALPHABITMAPDATA + public static final int FORMAT_8BIT_COLORMAPPED = 3; public static final int FORMAT_32BIT_ARGB = 5; + public static final int ID = 36; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java index b17ac6bf3..0f395ea7a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java @@ -19,12 +19,17 @@ 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 static com.jpexs.decompiler.flash.tags.DefineBitsLossless2Tag.FORMAT_8BIT_COLORMAPPED; import com.jpexs.decompiler.flash.tags.base.AloneTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; import com.jpexs.decompiler.flash.types.BITMAPDATA; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.COLORMAPDATA; import com.jpexs.decompiler.flash.types.PIX24; import com.jpexs.decompiler.flash.types.RGB; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.awt.Color; import java.io.ByteArrayInputStream; @@ -38,18 +43,35 @@ import javax.imageio.ImageIO; public class DefineBitsLosslessTag extends ImageTag implements AloneTag { + @SWFType(BasicType.UI16) public int characterID; + + @SWFType(BasicType.UI8) public int bitmapFormat; + + + @SWFType(BasicType.UI16) public int bitmapWidth; + + @SWFType(BasicType.UI16) public int bitmapHeight; + + @SWFType(BasicType.UI8) + @Conditional(value="bitmapFormat",options={FORMAT_8BIT_COLORMAPPED}) public int bitmapColorTableSize; + public byte[] zlibBitmapData; //TODO: Parse COLORMAPDATA,BITMAPDATA public static final int FORMAT_8BIT_COLORMAPPED = 3; public static final int FORMAT_15BIT_RGB = 4; public static final int FORMAT_24BIT_RGB = 5; + + @Internal private COLORMAPDATA colorMapData; + @Internal private BITMAPDATA bitmapData; + @Internal private boolean decompressed = false; + public static final int ID = 20; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java index dfedb1b8b..18c24f6d6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java @@ -20,6 +20,9 @@ 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.ImageTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -31,8 +34,13 @@ import javax.imageio.ImageIO; public class DefineBitsTag extends ImageTag { + @SWFType(BasicType.UI16) public int characterID; + + @SWFType(BasicType.UI8) public byte[] jpegData; + + @Internal private JPEGTablesTag jtt = null; public static final int ID = 6; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index 7e0633c71..c819912c5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -31,8 +31,10 @@ import com.jpexs.decompiler.flash.tags.base.Container; import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.types.BUTTONCONDACTION; import com.jpexs.decompiler.flash.types.BUTTONRECORD; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RECT; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.Cache; import com.jpexs.helpers.SerializableImage; import java.awt.Color; @@ -60,7 +62,9 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded /** * ID for this character */ + @SWFType(BasicType.UI16) public int buttonId; + /** * Track as menu button */ diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java index bb4a7e2c3..005816863 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java @@ -19,7 +19,9 @@ 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.types.BasicType; import com.jpexs.decompiler.flash.types.CXFORM; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -32,6 +34,7 @@ import java.io.OutputStream; */ public class DefineButtonCxformTag extends Tag { + @SWFType(BasicType.UI16) public int buttonId; public CXFORM buttonColorTransform; public static final int ID = 23; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java index 5ea8522da..c85b7f38b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java @@ -20,7 +20,9 @@ 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.CharacterTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.SOUNDINFO; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -33,14 +35,27 @@ import java.io.OutputStream; */ public class DefineButtonSoundTag extends CharacterTag { + @SWFType(BasicType.UI16) public int buttonId; + + @SWFType(BasicType.UI16) public int buttonSoundChar0; + public SOUNDINFO buttonSoundInfo0; + + @SWFType(BasicType.UI16) public int buttonSoundChar1; + public SOUNDINFO buttonSoundInfo1; + + @SWFType(BasicType.UI16) public int buttonSoundChar2; + public SOUNDINFO buttonSoundInfo2; + + @SWFType(BasicType.UI16) public int buttonSoundChar3; + public SOUNDINFO buttonSoundInfo3; public static final int ID = 17; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java index 9e66a146b..f5c5f31d4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java @@ -33,8 +33,11 @@ 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.types.BUTTONRECORD; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RECT; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.graph.ExportMode; import com.jpexs.helpers.Cache; import com.jpexs.helpers.Helper; @@ -64,6 +67,7 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT /** * ID for this character */ + @SWFType(BasicType.UI16) public int buttonId; /** * Characters that make up the button @@ -73,6 +77,7 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT * Actions to perform */ //public List actions; + @Internal public byte[] actionBytes; public static final int ID = 7; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 2c6bc052b..317136771 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -25,9 +25,12 @@ import com.jpexs.decompiler.flash.tags.base.TextTag; import com.jpexs.decompiler.flash.tags.text.ParseException; import com.jpexs.decompiler.flash.tags.text.ParsedSymbol; import com.jpexs.decompiler.flash.tags.text.TextLexer; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.RGBA; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.awt.geom.GeneralPath; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -52,7 +55,9 @@ import java.util.regex.Pattern; */ public class DefineEditTextTag extends TextTag { + @SWFType(BasicType.UI16) public int characterID; + public RECT bounds; public boolean hasText; public boolean wordWrap; @@ -70,18 +75,50 @@ public class DefineEditTextTag extends TextTag { public boolean wasStatic; public boolean html; public boolean useOutlines; + + @SWFType(BasicType.UI16) + @Conditional("hasFont") public int fontId; + + @Conditional("hasFontClass") public String fontClass; + + @SWFType(BasicType.UI16) + @Conditional("hasFont") public int fontHeight; + + @Conditional("hasTextColor") public RGBA textColor; + + @SWFType(BasicType.UI16) + @Conditional("hasMaxLength") public int maxLength; + + @SWFType(BasicType.UI8) + @Conditional("hasLayout") public int align; + + @SWFType(BasicType.UI16) + @Conditional("hasLayout") public int leftMargin; + + @SWFType(BasicType.UI16) + @Conditional("hasLayout") public int rightMargin; + + @SWFType(BasicType.UI16) + @Conditional("hasLayout") public int indent; + + @SWFType(BasicType.SI16) + @Conditional("hasLayout") public int leading; + public String variableName; + + @Conditional("hasText") public String initialText; + public static final int ID = 37; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java index 0b039f223..de47a18f9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java @@ -20,10 +20,15 @@ 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.FontTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.KERNINGRECORD; import com.jpexs.decompiler.flash.types.LANGCODE; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPE; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.ConditionalType; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD; import com.jpexs.helpers.utf8.Utf8Helper; import java.awt.Font; @@ -41,7 +46,9 @@ import javax.swing.JPanel; */ public class DefineFont2Tag extends FontTag { + @SWFType(BasicType.UI16) public int fontId; + public boolean fontFlagsHasLayout; public boolean fontFlagsShiftJIS; public boolean fontFlagsSmallText; @@ -52,14 +59,32 @@ public class DefineFont2Tag extends FontTag { public boolean fontFlagsBold; public LANGCODE languageCode; public String fontName; + @Internal public int numGlyphs; public List glyphShapeTable; + + @SWFType(value=BasicType.UI16,alternateValue = BasicType.UI32,alternateCondition = "fontFlagsWideCodes") public List codeTable; + + @SWFType(BasicType.UI16) + @Conditional("fontFlagsHasLayout") public int fontAscent; + + @SWFType(BasicType.UI16) + @Conditional("fontFlagsHasLayout") public int fontDescent; + + @SWFType(BasicType.SI16) + @Conditional("fontFlagsHasLayout") public int fontLeading; + + @SWFType(BasicType.SI16) + @Conditional("fontFlagsHasLayout") public List fontAdvanceTable; + + @Conditional("fontFlagsHasLayout") public List fontBoundsTable; + public KERNINGRECORD[] fontKerningTable; public static final int ID = 48; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java index 96abf16cd..85aa0143d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java @@ -22,10 +22,14 @@ 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.FontTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.KERNINGRECORD; import com.jpexs.decompiler.flash.types.LANGCODE; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPE; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD; import com.jpexs.helpers.utf8.Utf8Helper; import java.awt.Font; @@ -39,7 +43,9 @@ import javax.swing.JPanel; public class DefineFont3Tag extends FontTag { + @SWFType(BasicType.UI16) public int fontId; + public boolean fontFlagsHasLayout; public boolean fontFlagsShiftJIS; public boolean fontFlagsSmallText; @@ -50,13 +56,26 @@ public class DefineFont3Tag extends FontTag { public boolean fontFlagsBold; public LANGCODE languageCode; public String fontName; + @Internal public int numGlyphs; - //public long[] offsetTable]; + public List glyphShapeTable; + + @SWFType(value=BasicType.UI16,alternateValue = BasicType.UI32,alternateCondition = "fontFlagsWideCodes") public List codeTable; + + @SWFType(BasicType.UI16) + @Conditional("fontFlagsHasLayout") public int fontAscent; + + @SWFType(BasicType.UI16) + @Conditional("fontFlagsHasLayout") public int fontDescent; + + @SWFType(BasicType.SI16) + @Conditional("fontFlagsHasLayout") public int fontLeading; + public List fontAdvanceTable; public List fontBoundsTable; public KERNINGRECORD[] fontKerningTable; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java index 36168fd79..a9ff1a37c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java @@ -20,6 +20,8 @@ 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.CharacterTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -27,7 +29,9 @@ import java.io.OutputStream; public class DefineFont4Tag extends CharacterTag { + @SWFType(BasicType.UI16) public int fontID; + public boolean fontFlagsHasFontData; public boolean fontFlagsItalic; public boolean fontFlagsBold; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java index 695d5d817..c79b2ab33 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java @@ -19,7 +19,9 @@ 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.types.BasicType; import com.jpexs.decompiler.flash.types.ZONERECORD; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -29,7 +31,9 @@ import java.util.List; public class DefineFontAlignZonesTag extends Tag { + @SWFType(BasicType.UI16) public int fontID; + @SWFType(value=BasicType.UB,count=2) public int CSMTableHint; public List zoneTable; public static final int ID = 73; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java index 14f9db466..35a4346c6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java @@ -19,7 +19,9 @@ 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.types.BasicType; import com.jpexs.decompiler.flash.types.LANGCODE; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.utf8.Utf8Helper; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -35,6 +37,7 @@ import java.util.List; */ public class DefineFontInfo2Tag extends Tag { + @SWFType(BasicType.UI16) public int fontID; public String fontName; public boolean fontFlagsSmallText; @@ -42,8 +45,9 @@ public class DefineFontInfo2Tag extends Tag { public boolean fontFlagsANSI; public boolean fontFlagsItalic; public boolean fontFlagsBold; - public boolean fontFlagsWideCodes; + public boolean fontFlagsWideCodes; //always 1 public LANGCODE languageCode; + @SWFType(BasicType.UI16) public List codeTable; public static final int ID = 62; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java index 05f3a9289..4f3292d41 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.utf8.Utf8Helper; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -34,6 +36,7 @@ import java.util.List; */ public class DefineFontInfoTag extends Tag { + @SWFType(BasicType.UI16) public int fontId; public String fontName; public boolean fontFlagsSmallText; @@ -42,6 +45,7 @@ public class DefineFontInfoTag extends Tag { public boolean fontFlagsItalic; public boolean fontFlagsBold; public boolean fontFlagsWideCodes; + @SWFType(value=BasicType.UI8,alternateValue = BasicType.UI16, alternateCondition = "fontFlagsWideCodes") public List codeTable; public static final int ID = 13; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java index df675a3a5..2bb842324 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java @@ -18,11 +18,14 @@ package com.jpexs.decompiler.flash.tags; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.IOException; public class DefineFontNameTag extends Tag { + @SWFType(BasicType.UI16) public int fontId; public String fontName; public String fontCopyright; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java index bd627b8e6..21da55846 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java @@ -20,7 +20,10 @@ 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.FontTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.SHAPE; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -36,9 +39,12 @@ import java.util.List; */ public class DefineFontTag extends FontTag { + @SWFType(BasicType.UI16) public int fontId; public List glyphShapeTable; + @Internal private DefineFontInfoTag fontInfoTag = null; + @Internal private DefineFontInfo2Tag fontInfo2Tag = null; public static final int ID = 10; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java index 240e4324a..7588c28ab 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.MorphShapeTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.FILLSTYLEARRAY; import com.jpexs.decompiler.flash.types.LINESTYLEARRAY; import com.jpexs.decompiler.flash.types.MORPHFILLSTYLEARRAY; @@ -33,6 +34,7 @@ import com.jpexs.decompiler.flash.types.MORPHLINESTYLEARRAY; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPE; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord; import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord; import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD; @@ -57,6 +59,7 @@ import java.util.Stack; */ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, MorphShapeTag, DrawableTag { + @SWFType(BasicType.UI16) public int characterId; public RECT startBounds; public RECT endBounds; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java index db50a28ae..47a12a5a7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.MorphShapeTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.FILLSTYLEARRAY; import com.jpexs.decompiler.flash.types.LINESTYLEARRAY; import com.jpexs.decompiler.flash.types.MORPHFILLSTYLEARRAY; @@ -33,6 +34,7 @@ import com.jpexs.decompiler.flash.types.MORPHLINESTYLEARRAY; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPE; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord; import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord; import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD; @@ -57,6 +59,7 @@ import java.util.Stack; */ public class DefineMorphShapeTag extends CharacterTag implements BoundedTag, MorphShapeTag, DrawableTag { + @SWFType(BasicType.UI16) public int characterId; public RECT startBounds; public RECT endBounds; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java index 09f6d9953..7afb44a2e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java @@ -19,7 +19,9 @@ 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.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -30,8 +32,9 @@ import java.io.OutputStream; */ public class DefineScalingGridTag extends Tag { - private final int characterId; - private final RECT splitter; + @SWFType(BasicType.UI16) + public int characterId; + public RECT splitter; public static final int ID = 78; public DefineScalingGridTag(SWF swf, byte[] data, int version, long pos) throws IOException { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java index 472452cc8..6f3d52d85 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -31,9 +33,14 @@ import java.io.OutputStream; */ public class DefineSceneAndFrameLabelDataTag extends Tag { + @SWFType(BasicType.EncodedU32) public long[] sceneOffsets; + public String[] sceneNames; + + @SWFType(BasicType.EncodedU32) public long[] frameNums; + public String[] frameNames; public static final int ID = 86; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java index 2c50fbc63..7018c9f2e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java @@ -25,8 +25,10 @@ import com.jpexs.decompiler.flash.exporters.SVGShapeExporter; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.ShapeTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -37,6 +39,7 @@ import java.util.Stack; public class DefineShape2Tag extends CharacterTag implements BoundedTag, ShapeTag { + @SWFType(BasicType.UI16) public int shapeId; private final RECT shapeBounds; public SHAPEWITHSTYLE shapes; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java index 13e09e690..26f780ed2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java @@ -25,8 +25,10 @@ import com.jpexs.decompiler.flash.exporters.SVGShapeExporter; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.ShapeTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -37,8 +39,9 @@ import java.util.Stack; public class DefineShape3Tag extends CharacterTag implements BoundedTag, ShapeTag { + @SWFType(BasicType.UI16) public int shapeId; - private final RECT shapeBounds; + public RECT shapeBounds; public SHAPEWITHSTYLE shapes; public static final int ID = 32; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java index ae98a18bc..c8a7100bc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java @@ -25,8 +25,10 @@ import com.jpexs.decompiler.flash.exporters.SVGShapeExporter; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.ShapeTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -37,9 +39,10 @@ import java.util.Stack; public class DefineShape4Tag extends CharacterTag implements BoundedTag, ShapeTag { + @SWFType(BasicType.UI16) public int shapeId; - private final RECT shapeBounds; - private final RECT edgeBounds; + public RECT shapeBounds; + public RECT edgeBounds; public boolean usesFillWindingRule; public boolean usesNonScalingStrokes; public boolean usesScalingStrokes; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java index 3b515b6c1..7bb3e247e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java @@ -26,8 +26,10 @@ import com.jpexs.decompiler.flash.exporters.SVGShapeExporter; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.ShapeTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -39,8 +41,9 @@ import java.util.Stack; public class DefineShapeTag extends CharacterTag implements BoundedTag, ShapeTag { + @SWFType(BasicType.UI16) public int shapeId; - private final RECT shapeBounds; + public RECT shapeBounds; public SHAPEWITHSTYLE shapes; public static final int ID = 2; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java index 5e2a2d8af..d1a91ed58 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java @@ -20,6 +20,8 @@ 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.CharacterTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -32,7 +34,10 @@ import java.io.OutputStream; */ public class DefineSoundTag extends CharacterTag { + @SWFType(BasicType.UI16) public int soundId; + + @SWFType(value=BasicType.UB,count=4) public int soundFormat; public static final int FORMAT_UNCOMPRESSED_NATIVE_ENDIAN = 0; public static final int FORMAT_ADPCM = 1; @@ -42,10 +47,16 @@ public class DefineSoundTag extends CharacterTag { public static final int FORMAT_NELLYMOSER8KHZ = 5; public static final int FORMAT_NELLYMOSER = 6; public static final int FORMAT_SPEEX = 11; + + @SWFType(value=BasicType.UB,count=2) public int soundRate; - public int soundSize; - public int soundType; + + public boolean soundSize; + public boolean soundType; + + @SWFType(BasicType.UI32) public long soundSampleCount; + public byte[] soundData; public static final int ID = 14; @@ -69,8 +80,8 @@ public class DefineSoundTag extends CharacterTag { sos.writeUI16(soundId); sos.writeUB(4, soundFormat); sos.writeUB(2, soundRate); - sos.writeUB(1, soundSize); - sos.writeUB(1, soundType); + sos.writeUB(1, soundSize?1:0); + sos.writeUB(1, soundType?1:0); sos.writeUI32(soundSampleCount); sos.write(soundData); } catch (IOException e) { @@ -91,8 +102,8 @@ public class DefineSoundTag extends CharacterTag { soundId = sis.readUI16(); soundFormat = (int) sis.readUB(4); soundRate = (int) sis.readUB(2); - soundSize = (int) sis.readUB(1); - soundType = (int) sis.readUB(1); + soundSize = sis.readUB(1)==1; + soundType = sis.readUB(1)==1; soundSampleCount = sis.readUI32(); soundData = sis.readBytesEx(sis.available()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index 1aa688254..63f5505e5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -29,8 +29,11 @@ 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.types.BasicType; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RECT; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.Cache; import com.jpexs.helpers.SerializableImage; import java.awt.geom.AffineTransform; @@ -53,16 +56,18 @@ public class DefineSpriteTag extends CharacterTag implements Container, BoundedT /** * Character ID of sprite */ + @SWFType(BasicType.UI16) public int spriteId; /** * Number of frames in sprite */ + @SWFType(BasicType.UI16) public int frameCount; /** * A series of tags */ public List subTags; - private int level; + public static final int ID = 39; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 1ff470355..70b55908b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -29,11 +29,13 @@ import com.jpexs.decompiler.flash.tags.base.TextTag; import com.jpexs.decompiler.flash.tags.text.ParseException; import com.jpexs.decompiler.flash.tags.text.ParsedSymbol; import com.jpexs.decompiler.flash.tags.text.TextLexer; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.GLYPHENTRY; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.RGBA; import com.jpexs.decompiler.flash.types.TEXTRECORD; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.Helper; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; @@ -57,6 +59,7 @@ import java.util.regex.Pattern; */ public class DefineText2Tag extends TextTag implements DrawableTag { + @SWFType(BasicType.UI16) public int characterID; public RECT textBounds; public MATRIX textMatrix; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index 92ac7a76a..f40944200 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -30,11 +30,13 @@ import com.jpexs.decompiler.flash.tags.base.TextTag; import com.jpexs.decompiler.flash.tags.text.ParseException; import com.jpexs.decompiler.flash.tags.text.ParsedSymbol; import com.jpexs.decompiler.flash.tags.text.TextLexer; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.GLYPHENTRY; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.RGB; import com.jpexs.decompiler.flash.types.TEXTRECORD; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.Helper; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; @@ -58,6 +60,7 @@ import java.util.regex.Pattern; */ public class DefineTextTag extends TextTag implements DrawableTag { + @SWFType(BasicType.UI16) public int characterID; public RECT textBounds; public MATRIX textMatrix; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java index 917ec950c..a8327b03f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java @@ -21,7 +21,9 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -36,13 +38,26 @@ import java.util.Stack; */ public class DefineVideoStreamTag extends CharacterTag implements BoundedTag { + @SWFType(BasicType.UI16) public int characterID; + + @SWFType(BasicType.UI16) public int numFrames; + + @SWFType(BasicType.UI16) public int width; + + @SWFType(BasicType.UI16) public int height; + + @SWFType(value=BasicType.UB,count=3) public int videoFlagsDeblocking; + public boolean videoFlagsSmoothing; + + @SWFType(BasicType.UI8) public int codecID; + public static final int CODEC_SORENSON_H263 = 2; public static final int CODEC_SCREEN_VIDEO = 3; public static final int CODEC_VP6 = 4; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java index df49e7c73..83d1ca0a9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java @@ -22,6 +22,9 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -40,6 +43,7 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag { /** * ActionScript 3 bytecodes */ + @Internal private final ABC abc; /** * A 32-bit flags value, which may contain the following bits set: @@ -47,6 +51,7 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag { * executed immediately, but only parsed. A later finddef may cause its * scripts to execute. */ + @SWFType(BasicType.UI32) public long flags; /** * The name assigned to the bytecode. diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java index 6b90b186b..95a74b010 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.types.annotations.Internal; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -35,6 +36,7 @@ public class DoABCTag extends Tag implements ABCContainerTag { /** * ActionScript 3 bytecodes */ + @Internal private final ABC abc; public static final int ID = 72; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java index 508ff5f92..8ff2e3bd0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.ActionListReader; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.tags.base.ASMSource; +import com.jpexs.decompiler.flash.types.annotations.Internal; import com.jpexs.decompiler.graph.ExportMode; import com.jpexs.helpers.Helper; import com.jpexs.helpers.MemoryInputStream; @@ -42,6 +43,7 @@ public class DoActionTag extends Tag implements ASMSource { * List of actions to perform */ //public List actions = new ArrayList(); + @Internal public byte[] actionBytes; public static final int ID = 12; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index ba6dcfac6..da794d581 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -25,6 +25,9 @@ import com.jpexs.decompiler.flash.action.ActionListReader; 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.graph.ExportMode; import com.jpexs.helpers.Helper; import com.jpexs.helpers.MemoryInputStream; @@ -41,11 +44,13 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { /** * Identifier of Sprite */ + @SWFType(BasicType.UI16) public int spriteId = 0; /** * List of actions to perform */ //public List actions = new ArrayList(); + @Internal public byte[] actionBytes; public static final int ID = 59; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java index 1a30fb9e6..dabaf224e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java @@ -19,6 +19,9 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Reserved; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -31,6 +34,8 @@ import java.io.OutputStream; */ public class EnableDebugger2Tag extends Tag { + @Reserved + @SWFType(BasicType.UI16) public int reserved; /** * MD5 hash of password diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java index 79817cf5e..0a4a7698a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java @@ -19,6 +19,10 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Optional; +import com.jpexs.decompiler.flash.types.annotations.Reserved; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -32,7 +36,13 @@ import java.io.OutputStream; public class EnableTelemetryTag extends Tag { public static final int ID = 93; + + @SWFType(value=BasicType.UB,count=16) + @Reserved public int reserved; + + @Optional + @SWFType(value=BasicType.UI8,count=32) public byte[] passwordHash; /** diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java index cea3d440f..632935f8e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -36,6 +38,7 @@ public class ExportAssetsTag extends Tag { /** * HashMap with assets */ + @SWFType(BasicType.UI16) public List tags; public List names; public static final int ID = 56; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java index 7c88da85e..98e094af3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -32,8 +34,10 @@ public class FileAttributesTag extends Tag { public boolean actionScript3; public boolean useNetwork; public boolean noCrossDomainCache; - private int reserved1; - private int reserved2; + private boolean reserved1; + private boolean reserved2; + + @SWFType(value=BasicType.UB,count=24) private int reserved3; public static final int ID = 69; @@ -44,14 +48,14 @@ public class FileAttributesTag extends Tag { public FileAttributesTag(SWF swf, byte[] data, int version, long pos) throws IOException { super(swf, ID, "FileAttributes", data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); - reserved1 = (int) sis.readUB(1); // reserved + reserved1 = sis.readUB(1)==1; // reserved // UB[1] == 0 (reserved) useDirectBlit = sis.readUB(1) != 0; useGPU = sis.readUB(1) != 0; hasMetadata = sis.readUB(1) != 0; actionScript3 = sis.readUB(1) != 0; noCrossDomainCache = sis.readUB(1) != 0; - reserved2 = (int) sis.readUB(1); // reserved + reserved2 = sis.readUB(1)==1; // reserved useNetwork = sis.readUB(1) != 0; // UB[24] == 0 (reserved) reserved3 = (int) sis.readUB(24); //reserved @@ -69,13 +73,13 @@ public class FileAttributesTag extends Tag { OutputStream os = baos; SWFOutputStream sos = new SWFOutputStream(os, version); try { - sos.writeUB(1, reserved1); //reserved + sos.writeUB(1, reserved1?1:0); //reserved sos.writeUB(1, useDirectBlit ? 1 : 0); sos.writeUB(1, useGPU ? 1 : 0); sos.writeUB(1, hasMetadata ? 1 : 0); sos.writeUB(1, actionScript3 ? 1 : 0); sos.writeUB(1, noCrossDomainCache ? 1 : 0); - sos.writeUB(1, reserved2); //reserved + sos.writeUB(1, reserved2?1:0); //reserved sos.writeUB(1, useNetwork ? 1 : 0); sos.writeUB(24, reserved3); //reserved } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java index 72a240bfa..935513e0a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java @@ -25,11 +25,14 @@ 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.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORM; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RGBA; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.filters.FILTER; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -82,34 +85,44 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO /** * Depth of character */ + @SWFType(BasicType.UI16) public int depth; /** * If PlaceFlagHasCharacter, ID of character to place */ + @SWFType(BasicType.UI16) + @Conditional("placeFlagHasCharacter") public int characterId; /** * If PlaceFlagHasMatrix, Transform matrix data */ + @Conditional("placeFlagHasMatrix") public MATRIX matrix; /** * If PlaceFlagHasColorTransform, Color transform data */ + @Conditional("placeFlagHasColorTransform") public CXFORMWITHALPHA colorTransform; /** * If PlaceFlagHasRatio, ratio */ + @SWFType(BasicType.UI16) + @Conditional("placeFlagHasRatio") public int ratio; /** * If PlaceFlagHasName, Name of character */ + @Conditional("placeFlagHasName") public String name; /** * If PlaceFlagHasClipDepth, Clip depth */ + @Conditional("placeFlagHasClipDepth") public int clipDepth; /** * @since SWF 5 If PlaceFlagHasClipActions, Clip Actions Data */ + @Conditional("placeFlagHasClipActions") public CLIPACTIONS clipActions; public static final int ID = 26; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java index ad2826ac9..31b8a6ef4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java @@ -26,11 +26,16 @@ 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.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORM; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RGBA; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.Reserved; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.filters.FILTER; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -113,64 +118,85 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO /** * Depth of character */ + @SWFType(BasicType.UI16) public int depth; /** * If PlaceFlagHasClassName or (PlaceFlagHasImage and * PlaceFlagHasCharacter), Name of the class to place */ + @Conditional("placeFlagHasClassName|(placeFlagHasImage,placeFlagHasCharacter)") public String className; /** * If PlaceFlagHasCharacter, ID of character to place */ + @SWFType(BasicType.UI16) + @Conditional("placeFlagHasCharacter") public int characterId; /** * If PlaceFlagHasMatrix, Transform matrix data */ + @Conditional("placeFlagHasMatrix") public MATRIX matrix; /** * If PlaceFlagHasColorTransform, Color transform data */ + @Conditional("placeFlagHasColorTransform") public CXFORMWITHALPHA colorTransform; /** * If PlaceFlagHasRatio, Ratio */ + @SWFType(BasicType.UI16) + @Conditional("placeFlagHasRatio") public int ratio; /** * If PlaceFlagHasName, Name of character */ + @Conditional("placeFlagHasName") public String name; /** * If PlaceFlagHasClipDepth, Clip depth */ + @SWFType(BasicType.UI16) + @Conditional("placeFlagHasClipDepth") public int clipDepth; /** * If PlaceFlagHasFilterList, List of filters on this object */ + @Conditional("placeFlagHasFilterList") public List surfaceFilterList; /** * If PlaceFlagHasBlendMode, Blend mode */ + @SWFType(BasicType.UI8) + @Conditional("placeFlagHasBlendMode") public int blendMode; /** * If PlaceFlagHasCacheAsBitmap, 0 = Bitmap cache disabled, 1-255 = Bitmap * cache enabled */ + @SWFType(BasicType.UI8) + @Conditional("placeFlagHasCacheAsBitmap") public int bitmapCache; /** * @since SWF 5 If PlaceFlagHasClipActions, Clip Actions Data */ + @Conditional(value="placeFlagHasClipActions",minSwfVersion = 5) public CLIPACTIONS clipActions; /** * If PlaceFlagHasVisible, 0 = Place invisible, 1 = Place visible */ + @Conditional("placeFlagHasVisible") public int visible; /** * If PlaceFlagHasVisible, Background color */ + @Conditional("placeFlagOpaqueBackground") public RGBA backgroundColor; // FIXME bug found in ecoDrive.swf, + @Internal private boolean bitmapCacheBug; - private final int reserved; + @Reserved + public boolean reserved; public static final int ID = 70; @Override @@ -216,7 +242,7 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO sos.writeUB(1, placeFlagHasMatrix ? 1 : 0); sos.writeUB(1, placeFlagHasCharacter ? 1 : 0); sos.writeUB(1, placeFlagMove ? 1 : 0); - sos.writeUB(1, reserved); + sos.writeUB(1, reserved ?1:0); sos.writeUB(1, placeFlagOpaqueBackground ? 1 : 0); //SWF11 sos.writeUB(1, placeFlagHasVisible ? 1 : 0); //SWF11 sos.writeUB(1, placeFlagHasImage ? 1 : 0); @@ -292,7 +318,7 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO placeFlagHasMatrix = sis.readUB(1) == 1; placeFlagHasCharacter = sis.readUB(1) == 1; placeFlagMove = sis.readUB(1) == 1; - reserved = (int) sis.readUB(1); + reserved = sis.readUB(1) == 1; placeFlagOpaqueBackground = sis.readUB(1) == 1; //SWF11 placeFlagHasVisible = sis.readUB(1) == 1; //SWF11 placeFlagHasImage = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java index 6d09ffb2f..a8fbd7a21 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java @@ -26,11 +26,16 @@ 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.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORM; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RGBA; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.Reserved; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.filters.FILTER; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -113,64 +118,86 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO /** * Depth of character */ + @SWFType(BasicType.UI16) public int depth; /** * If PlaceFlagHasClassName or (PlaceFlagHasImage and * PlaceFlagHasCharacter), Name of the class to place */ + @Conditional("placeFlagHasClassName|(placeFlagHasImage,placeFlagHasCharacter)") public String className; /** * If PlaceFlagHasCharacter, ID of character to place */ + @SWFType(BasicType.UI16) + @Conditional("placeFlagHasCharacter") public int characterId; /** * If PlaceFlagHasMatrix, Transform matrix data */ + @Conditional("placeFlagHasMatrix") public MATRIX matrix; /** * If PlaceFlagHasColorTransform, Color transform data */ + @Conditional("placeFlagHasColorTransform") public CXFORMWITHALPHA colorTransform; /** * If PlaceFlagHasRatio, Ratio */ + @SWFType(BasicType.UI16) + @Conditional("placeFlagHasRatio") public int ratio; /** * If PlaceFlagHasName, Name of character */ + @Conditional("placeFlagHasName") public String name; /** * If PlaceFlagHasClipDepth, Clip depth */ + @SWFType(BasicType.UI16) + @Conditional("placeFlagHasClipDepth") public int clipDepth; /** * If PlaceFlagHasFilterList, List of filters on this object */ + @Conditional("placeFlagHasFilterList") public List surfaceFilterList; /** * If PlaceFlagHasBlendMode, Blend mode */ + @SWFType(BasicType.UI8) + @Conditional("placeFlagHasBlendMode") public int blendMode; /** * If PlaceFlagHasCacheAsBitmap, 0 = Bitmap cache disabled, 1-255 = Bitmap * cache enabled */ + @SWFType(BasicType.UI8) + @Conditional("placeFlagHasCacheAsBitmap") public int bitmapCache; /** * @since SWF 5 If PlaceFlagHasClipActions, Clip Actions Data */ + @Conditional(value = "placeFlagHasClipActions", minSwfVersion = 5) public CLIPACTIONS clipActions; /** * If PlaceFlagHasVisible, 0 = Place invisible, 1 = Place visible */ + @Conditional("placeFlagHasVisible") public int visible; /** * If PlaceFlagHasVisible, Background color */ + @Conditional("placeFlagOpaqueBackground") public RGBA backgroundColor; // FIXME bug found in ecoDrive.swf, + @Internal private boolean bitmapCacheBug; - private final int reserved; + @Reserved + public boolean reserved; + public static final int ID = 94; public byte[] amfData; //TODO: Parse AMF data? @@ -217,7 +244,7 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO sos.writeUB(1, placeFlagHasMatrix ? 1 : 0); sos.writeUB(1, placeFlagHasCharacter ? 1 : 0); sos.writeUB(1, placeFlagMove ? 1 : 0); - sos.writeUB(1, reserved); + sos.writeUB(1, reserved ? 1 : 0); sos.writeUB(1, placeFlagOpaqueBackground ? 1 : 0); //SWF11 sos.writeUB(1, placeFlagHasVisible ? 1 : 0); //SWF11 sos.writeUB(1, placeFlagHasImage ? 1 : 0); @@ -293,7 +320,7 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO placeFlagHasMatrix = sis.readUB(1) == 1; placeFlagHasCharacter = sis.readUB(1) == 1; placeFlagMove = sis.readUB(1) == 1; - reserved = (int) sis.readUB(1); + reserved = sis.readUB(1) == 1; placeFlagOpaqueBackground = sis.readUB(1) == 1; //SWF11 placeFlagHasVisible = sis.readUB(1) == 1; //SWF11 placeFlagHasImage = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java index b6ad0b73f..abbb055b2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java @@ -21,11 +21,14 @@ 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.PlaceObjectTypeTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORM; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RGBA; +import com.jpexs.decompiler.flash.types.annotations.Optional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.filters.FILTER; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -45,10 +48,12 @@ public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag /** * ID of character to place */ + @SWFType(BasicType.UI16) public int characterId; /** * Depth of character */ + @SWFType(BasicType.UI16) public int depth; /** * Transform matrix data @@ -57,6 +62,7 @@ public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag /** * Color transform data */ + @Optional public CXFORM colorTransform; public static final int ID = 4; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java index 79c49cc94..44adf8ff1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java @@ -18,18 +18,32 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.OutputStream; public class ProductInfoTag extends Tag { + @SWFType(BasicType.UI32) public long productID; + @SWFType(BasicType.UI32) public long edition; + @SWFType(BasicType.UI8) public int majorVersion; + @SWFType(BasicType.UI8) public int minorVersion; + @SWFType(BasicType.UI32) public long buildLow; + @SWFType(BasicType.UI32) public long buildHigh; - public long compilationDate; + @SWFType(BasicType.UI32) + public long compilationDateLow; + @SWFType(BasicType.UI32) + public long compilationDateHigh; public static final int ID = 41; public ProductInfoTag(SWF swf, byte[] data, int version, long pos) throws IOException { @@ -57,7 +71,28 @@ public class ProductInfoTag extends Tag { minorVersion = sis.readUI8(); buildLow = sis.readUI32(); buildHigh = sis.readUI32(); - compilationDate = sis.readUI32() & 0xffffffffL; - compilationDate |= sis.readUI32() << 32; + compilationDateLow = sis.readUI32(); + compilationDateHigh = sis.readUI32(); } + + @Override + public byte[] getData(int version) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + OutputStream os = baos; + SWFOutputStream sos = new SWFOutputStream(os, version); + try { + sos.writeUI32(productID); + sos.writeUI32(edition); + sos.writeUI8(majorVersion); + sos.writeUI8(minorVersion); + sos.writeUI32(buildLow); + sos.writeUI32(buildHigh); + sos.writeUI32(compilationDateLow); + sos.writeUI32(compilationDateHigh); + } catch (IOException e) { + } + return baos.toByteArray(); + } + + } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java index 5383dcc40..2af3c42b5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java @@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.tags; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.tags.base.RemoveTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.IOException; public class RemoveObject2Tag extends Tag implements RemoveTag { + @SWFType(BasicType.UI16) public int depth; public static final int ID = 28; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java index 50a56f847..fc07f8c17 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java @@ -21,6 +21,8 @@ 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.RemoveTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -36,10 +38,12 @@ public class RemoveObjectTag extends CharacterIdTag implements RemoveTag { /** * ID of character to place */ + @SWFType(BasicType.UI16) public int characterId; /** * Depth of character */ + @SWFType(BasicType.UI16) public int depth; public static final int ID = 5; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java index 150e6b645..df4287b5a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -26,8 +28,12 @@ import java.io.OutputStream; public class ScriptLimitsTag extends Tag { + @SWFType(BasicType.UI16) public int maxRecursionDepth; + + @SWFType(BasicType.UI16) public int scriptTimeoutSeconds; + public static final int ID = 65; public ScriptLimitsTag(SWF swf, byte[] data, int version, long pos) throws IOException { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java index 8e7d5c90e..e30c2bb50 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -34,10 +36,12 @@ public class SetTabIndexTag extends Tag { /** * Depth of character */ + @SWFType(BasicType.UI16) public int depth; /** * Tab order value */ + @SWFType(BasicType.UI16) public int tabIndex; public static final int ID = 66; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java index 439fcfeb3..d1ae063b2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java @@ -21,6 +21,10 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; 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; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -33,15 +37,29 @@ import java.io.OutputStream; */ public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHeadTypeTag { + @SWFType(value=BasicType.UB,count=2) public int playBackSoundRate; - public int playBackSoundSize; - public int playBackSoundType; + + public boolean playBackSoundSize; + public boolean playBackSoundType; + + @SWFType(value=BasicType.UB,count=4) public int streamSoundCompression; + + @SWFType(value=BasicType.UB,count=2) public int streamSoundRate; - public int streamSoundSize; - public int streamSoundType; + + public boolean streamSoundSize; + public boolean streamSoundType; + + @SWFType(BasicType.UI16) public int streamSoundSampleCount; + + @SWFType(BasicType.SI16) + @Conditional(value="streamSoundCompression",options={2}) public int latencySeek; + + @Internal private int virtualCharacterId = 0; public static final int ID = 45; @@ -85,12 +103,12 @@ public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHead try { sos.writeUB(4, 0);//reserved sos.writeUB(2, playBackSoundRate); - sos.writeUB(1, playBackSoundSize); - sos.writeUB(1, playBackSoundType); + sos.writeUB(1, playBackSoundSize?1:0); + sos.writeUB(1, playBackSoundType?1:0); sos.writeUB(4, streamSoundCompression); sos.writeUB(2, streamSoundRate); - sos.writeUB(1, streamSoundSize); - sos.writeUB(1, streamSoundType); + sos.writeUB(1, streamSoundSize?1:0); + sos.writeUB(1, streamSoundType?1:0); sos.writeUI16(streamSoundSampleCount); if (streamSoundCompression == 2) { sos.writeSI16(latencySeek); @@ -113,12 +131,12 @@ public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHead SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); sis.readUB(4);//reserved playBackSoundRate = (int) sis.readUB(2); - playBackSoundSize = (int) sis.readUB(1); - playBackSoundType = (int) sis.readUB(1); + playBackSoundSize = sis.readUB(1) == 1; + playBackSoundType = sis.readUB(1) == 1; streamSoundCompression = (int) sis.readUB(4); streamSoundRate = (int) sis.readUB(2); - streamSoundSize = (int) sis.readUB(1); - streamSoundType = (int) sis.readUB(1); + streamSoundSize = sis.readUB(1) == 1; + streamSoundType = sis.readUB(1) == 1; streamSoundSampleCount = sis.readUI16(); if (streamSoundCompression == 2) { latencySeek = sis.readSI16(); @@ -136,12 +154,12 @@ public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHead } @Override - public int getSoundSize() { + public boolean getSoundSize() { return streamSoundSize; } @Override - public int getSoundType() { + public boolean getSoundType() { return streamSoundType; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java index 9cae7f8b3..d447065b8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java @@ -21,6 +21,10 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; 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; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -33,15 +37,21 @@ import java.io.OutputStream; */ public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadTypeTag { + @SWFType(value=BasicType.UB,count=2) public int playBackSoundRate; - public int playBackSoundSize; - public int playBackSoundType; + public boolean playBackSoundSize; + public boolean playBackSoundType; + @SWFType(value=BasicType.UB,count=4) public int streamSoundCompression; + @SWFType(value=BasicType.UB,count=2) public int streamSoundRate; - public int streamSoundSize; - public int streamSoundType; + public boolean streamSoundSize; + public boolean streamSoundType; + @SWFType(value=BasicType.UI16) public int streamSoundSampleCount; + @Conditional(value="streamSoundCompression",options={2}) public int latencySeek; + @Internal private int virtualCharacterId = 0; public static final int ID = 18; @@ -85,12 +95,12 @@ public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadT try { sos.writeUB(4, 0);//reserved sos.writeUB(2, playBackSoundRate); - sos.writeUB(1, playBackSoundSize); - sos.writeUB(1, playBackSoundType); + sos.writeUB(1, playBackSoundSize?1:0); + sos.writeUB(1, playBackSoundType?1:0); sos.writeUB(4, streamSoundCompression); sos.writeUB(2, streamSoundRate); - sos.writeUB(1, streamSoundSize); - sos.writeUB(1, streamSoundType); + sos.writeUB(1, streamSoundSize?1:0); + sos.writeUB(1, streamSoundType?1:0); sos.writeUI16(streamSoundSampleCount); if (streamSoundCompression == 2) { sos.writeSI16(latencySeek); @@ -112,12 +122,12 @@ public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadT SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); sis.readUB(4);//reserved playBackSoundRate = (int) sis.readUB(2); - playBackSoundSize = (int) sis.readUB(1); - playBackSoundType = (int) sis.readUB(1); + playBackSoundSize = sis.readUB(1) == 1; + playBackSoundType = sis.readUB(1) == 1; streamSoundCompression = (int) sis.readUB(4); streamSoundRate = (int) sis.readUB(2); - streamSoundSize = (int) sis.readUB(1); - streamSoundType = (int) sis.readUB(1); + streamSoundSize = sis.readUB(1) == 1; + streamSoundType = sis.readUB(1) == 1; streamSoundSampleCount = sis.readUI16(); if (streamSoundCompression == 2) { latencySeek = sis.readSI16(); @@ -135,12 +145,12 @@ public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadT } @Override - public int getSoundSize() { + public boolean getSoundSize() { return streamSoundSize; } @Override - public int getSoundType() { + public boolean getSoundType() { return streamSoundType; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java index 1a0154a1e..39f1e381b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java @@ -19,7 +19,9 @@ 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.types.BasicType; import com.jpexs.decompiler.flash.types.SOUNDINFO; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -32,6 +34,7 @@ import java.io.OutputStream; */ public class StartSoundTag extends Tag { + @SWFType(BasicType.UI16) public int soundId; public SOUNDINFO soundInfo; public static final int ID = 15; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java index 324815831..36c2ccaa4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -26,6 +28,7 @@ import java.io.OutputStream; public class SymbolClassTag extends Tag { + @SWFType(BasicType.UI16) public int[] tagIDs; public String[] classNames; public static final int ID = 76; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java index da7d5dd79..6e7c65359 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java @@ -19,6 +19,8 @@ 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.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -31,7 +33,9 @@ import java.io.OutputStream; */ public class VideoFrameTag extends Tag { + @SWFType(BasicType.UI16) public int streamID; + @SWFType(BasicType.UI16) public int frameNum; public byte[] videoData; public static final int ID = 61; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java index f9f670552..12a8b66d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java @@ -26,9 +26,9 @@ public interface SoundStreamHeadTypeTag { public int getSoundRate(); - public int getSoundSize(); + public boolean getSoundSize(); - public int getSoundType(); + public boolean getSoundType(); public long getSoundSampleCount(); diff --git a/trunk/src/com/jpexs/decompiler/flash/types/BasicType.java b/trunk/src/com/jpexs/decompiler/flash/types/BasicType.java index c184e8594..acfef4567 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/BasicType.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/BasicType.java @@ -25,6 +25,7 @@ public enum BasicType { UI8, UI16, UI32, + EncodedU32, SI8, SI16, SI32, diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/Optional.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Optional.java new file mode 100644 index 000000000..233d2c7f7 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Optional.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.jpexs.decompiler.flash.types.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * The field is optional anc can be unset + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Optional { + +} diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/SWFType.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/SWFType.java index 4fec9ce2d..e6147dec4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/annotations/SWFType.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/SWFType.java @@ -37,7 +37,7 @@ public @interface SWFType { /// Condition for alternate type String alternateCondition() default ""; /// Count - used primarily for bit fields UB,SB,FB to specify number of bits - int count() default 1; + int count() default -1; /// Field name on which Count depends String countField() default ""; //Count to add to countField diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 846871ff7..557675d59 100644 --- a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -1301,8 +1301,8 @@ public class XFLConverter { } else if ((symbol instanceof SoundStreamHeadTypeTag) || (symbol instanceof DefineSoundTag)) { int soundFormat = 0; int soundRate = 0; - int soundType = 0; - int soundSize = 0; + boolean soundType = false; + boolean soundSize = false; long soundSampleCount = 0; byte[] soundData = new byte[0]; int[] rateMap = {5, 11, 22, 44}; @@ -1339,7 +1339,7 @@ public class XFLConverter { if ((soundFormat == DefineSoundTag.FORMAT_ADPCM) || (soundFormat == DefineSoundTag.FORMAT_UNCOMPRESSED_LITTLE_ENDIAN) || (soundFormat == DefineSoundTag.FORMAT_UNCOMPRESSED_NATIVE_ENDIAN)) { - if (soundType == 1) { //stereo + if (soundType) { //stereo format += 1; } switch (soundRate) { @@ -1372,7 +1372,7 @@ public class XFLConverter { } if (soundFormat == DefineSoundTag.FORMAT_MP3) { exportFormat = "mp3"; - if (soundType == 0) { //mono + if (!soundType) { //mono format += 1; } format += 4; //quality best @@ -1438,8 +1438,8 @@ public class XFLConverter { mediaLinkStr += " href=\"" + symbolFile + "\""; mediaLinkStr += " format=\""; mediaLinkStr += rateMap[soundRate] + "kHz"; - mediaLinkStr += " " + (soundSize == 1 ? "16bit" : "8bit"); - mediaLinkStr += " " + (soundType == 1 ? "Stereo" : "Mono"); + mediaLinkStr += " " + (soundSize ? "16bit" : "8bit"); + mediaLinkStr += " " + (soundType ? "Stereo" : "Mono"); mediaLinkStr += "\""; mediaLinkStr += " exportFormat=\"" + format + "\" exportBits=\"" + bits + "\" sampleCount=\"" + soundSampleCount + "\"";