Tag annotations

This commit is contained in:
Jindra Petk
2014-02-05 21:31:11 +01:00
parent 67c9383ed6
commit ed19d87486
64 changed files with 601 additions and 76 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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;
/**

View File

@@ -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;
/**

View File

@@ -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;
/**

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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
*/

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<Action> actions;
@Internal
public byte[] actionBytes;
public static final int ID = 7;

View File

@@ -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

View File

@@ -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<SHAPE> glyphShapeTable;
@SWFType(value=BasicType.UI16,alternateValue = BasicType.UI32,alternateCondition = "fontFlagsWideCodes")
public List<Integer> 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<Integer> fontAdvanceTable;
@Conditional("fontFlagsHasLayout")
public List<RECT> fontBoundsTable;
public KERNINGRECORD[] fontKerningTable;
public static final int ID = 48;

View File

@@ -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<SHAPE> glyphShapeTable;
@SWFType(value=BasicType.UI16,alternateValue = BasicType.UI32,alternateCondition = "fontFlagsWideCodes")
public List<Integer> 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<Integer> fontAdvanceTable;
public List<RECT> fontBoundsTable;
public KERNINGRECORD[] fontKerningTable;

View File

@@ -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;

View File

@@ -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<ZONERECORD> zoneTable;
public static final int ID = 73;

View File

@@ -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<Integer> codeTable;
public static final int ID = 62;

View File

@@ -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<Integer> codeTable;
public static final int ID = 13;

View File

@@ -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;

View File

@@ -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<SHAPE> glyphShapeTable;
@Internal
private DefineFontInfoTag fontInfoTag = null;
@Internal
private DefineFontInfo2Tag fontInfo2Tag = null;
public static final int ID = 10;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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());
}

View File

@@ -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<Tag> subTags;
private int level;
public static final int ID = 39;
@Override

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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.

View File

@@ -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;

View File

@@ -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<Action> actions = new ArrayList<Action>();
@Internal
public byte[] actionBytes;
public static final int ID = 12;

View File

@@ -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<Action> actions = new ArrayList<Action>();
@Internal
public byte[] actionBytes;
public static final int ID = 59;

View File

@@ -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

View File

@@ -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;
/**

View File

@@ -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<Integer> tags;
public List<String> names;
public static final int ID = 56;

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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<FILTER> 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;

View File

@@ -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<FILTER> 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;

View File

@@ -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;

View File

@@ -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();
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();

View File

@@ -25,6 +25,7 @@ public enum BasicType {
UI8,
UI16,
UI32,
EncodedU32,
SI8,
SI16,
SI32,

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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 {
}

View File

@@ -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

View File

@@ -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 + "\"";