diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index 9cf56318d..614546659 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -1548,19 +1548,19 @@ public class SWFInputStream extends InputStream { int NScaleBits = (int) readUB(5); ret.scaleX = (int) readSB(NScaleBits); ret.scaleY = (int) readSB(NScaleBits); - ret.bitsScale = NScaleBits; + ret.nScaleBits = NScaleBits; } ret.hasRotate = readUB(1) == 1; if (ret.hasRotate) { int NRotateBits = (int) readUB(5); ret.rotateSkew0 = (int) readSB(NRotateBits); ret.rotateSkew1 = (int) readSB(NRotateBits); - ret.bitsRotate = NRotateBits; + ret.nRotateBits = NRotateBits; } int NTranslateBits = (int) readUB(5); ret.translateX = (int) readSB(NTranslateBits); ret.translateY = (int) readSB(NTranslateBits); - ret.bitsTranslate = NTranslateBits; + ret.nTranslateBits = NTranslateBits; alignByte(); return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/ARGB.java b/trunk/src/com/jpexs/decompiler/flash/types/ARGB.java index bc2514eb5..ec0970e74 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/ARGB.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/ARGB.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.awt.Color; /** @@ -28,18 +29,22 @@ public class ARGB { /** * Alpha value defining opacity */ + @SWFType(BasicType.UI8) public int alpha; /** * Red color value */ + @SWFType(BasicType.UI8) public int red; /** * Green color value */ + @SWFType(BasicType.UI8) public int green; /** * Blue color value */ + @SWFType(BasicType.UI8) public int blue; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java index d646e42a1..91934f2b7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java @@ -25,6 +25,9 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.Exportable; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.graph.ExportMode; import com.jpexs.helpers.Helper; import com.jpexs.helpers.MemoryInputStream; @@ -80,6 +83,7 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem { /** * Is this BUTTONCONDACTION last in the list? */ + @Internal public boolean isLast; /** * Idle to OverDown @@ -116,6 +120,8 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem { /** * @since SWF 4 key code */ + @SWFType(value=BasicType.UB,count=7) + @Conditional(minSwfVersion=4) public int condKeyPress; /** * OverDown to Idle @@ -128,6 +134,7 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem { /** * Actions to perform in byte array */ + @Internal public byte[] actionBytes; /** diff --git a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java index 75988e220..62bcb1fcf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java @@ -16,6 +16,9 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.tags.DefineButton2Tag; +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.util.List; @@ -53,10 +56,12 @@ public class BUTTONRECORD { /** * ID of character to place */ + @SWFType(BasicType.UI16) public int characterId; /** * Depth at which to place character */ + @SWFType(BasicType.UI16) public int placeDepth; /** * Transformation matrix for character placement @@ -74,6 +79,8 @@ public class BUTTONRECORD { /** * If within DefineButton2Tag and buttonHasBlendMode: Blend mode */ + @SWFType(BasicType.UI8) + @Conditional(value={"buttonHasBlendMode"},tags={DefineButton2Tag.ID}) public int blendMode; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/BasicType.java b/trunk/src/com/jpexs/decompiler/flash/types/BasicType.java new file mode 100644 index 000000000..c184e8594 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/types/BasicType.java @@ -0,0 +1,39 @@ +/* + * 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; + +/** + * + * @author JPEXS + */ +public enum BasicType { + UI8, + UI16, + UI32, + SI8, + SI16, + SI32, + UB, + SB, + FB, + FLOAT, + FLOAT16, + FIXED, + FIXED8, + NONE +} diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java index 7d3064391..59a26c42b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java @@ -25,6 +25,8 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.Exportable; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Internal; import com.jpexs.decompiler.graph.ExportMode; import com.jpexs.helpers.Helper; import com.jpexs.helpers.MemoryInputStream; @@ -85,8 +87,11 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem { "" }; + @Internal private final SWF swf; + @Internal private long pos; + @Internal private long hdrPos; public CLIPACTIONRECORD(SWF swf, InputStream is, int version, long pos) throws IOException { @@ -123,11 +128,13 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem { /** * If EventFlags contain ClipEventKeyPress: Key code to trap */ + @Conditional("eventFlags.clipEventKeyPress") public int keyCode; /** * Actions to perform */ //public List actions; + @Internal public byte[] actionBytes; /** diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java b/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java index c2bf54683..78550ce6a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Conditional; import com.jpexs.helpers.Helper; import java.util.ArrayList; import java.util.List; @@ -62,30 +63,37 @@ public class CLIPEVENTFLAGS { /** * @since SWF 6 Mouse drag over event */ + @Conditional(minSwfVersion=6) public boolean clipEventDragOver; /** * @since SWF 6 Mouse rollout event */ + @Conditional(minSwfVersion=6) public boolean clipEventRollOut; /** * @since SWF 6 Mouse rollover event */ + @Conditional(minSwfVersion=6) public boolean clipEventRollOver; /** * @since SWF 6 Mouse release outside event */ + @Conditional(minSwfVersion=6) public boolean clipEventReleaseOutside; /** * @since SWF 6 Mouse release inside event */ + @Conditional(minSwfVersion=6) public boolean clipEventRelease; /** * @since SWF 6 Mouse press event */ + @Conditional(minSwfVersion=6) public boolean clipEventPress; /** * @since SWF 6 Initialize event */ + @Conditional(minSwfVersion=6) public boolean clipEventInitialize; /** * Data received event @@ -94,14 +102,17 @@ public class CLIPEVENTFLAGS { /** * @since SWF 7 Construct event */ + @Conditional(minSwfVersion=7) public boolean clipEventConstruct = false; /** * @since SWF 6 Key press event */ + @Conditional(minSwfVersion=6) public boolean clipEventKeyPress = false; /** * @since SWF 6 Mouse drag out event */ + @Conditional(minSwfVersion=6) public boolean clipEventDragOut = false; public String getHeader(int key, boolean asFileName) { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CXFORM.java b/trunk/src/com/jpexs/decompiler/flash/types/CXFORM.java index ef8dc522f..24b63e610 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CXFORM.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CXFORM.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.filters.Filtering; import com.jpexs.helpers.SerializableImage; @@ -35,30 +36,37 @@ public class CXFORM { * Has color multiply values */ public boolean hasMultTerms; + @SWFType(value=BasicType.UB,count=4) public int nbits; /** * Red multiply value */ + @SWFType(value=BasicType.SB,countField="nbits") public int redMultTerm; /** * Green multiply value */ + @SWFType(value=BasicType.SB,countField="nbits") public int greenMultTerm; /** * Blue multiply value */ + @SWFType(value=BasicType.SB,countField="nbits") public int blueMultTerm; /** * Red addition value */ + @SWFType(value=BasicType.SB,countField="nbits") public int redAddTerm; /** * Green addition value */ + @SWFType(value=BasicType.SB,countField="nbits") public int greenAddTerm; /** * Blue addition value */ + @SWFType(value=BasicType.SB,countField="nbits") public int blueAddTerm; public SerializableImage apply(SerializableImage src) { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CXFORMWITHALPHA.java b/trunk/src/com/jpexs/decompiler/flash/types/CXFORMWITHALPHA.java index 614fa6b2c..7e3594ed4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CXFORMWITHALPHA.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CXFORMWITHALPHA.java @@ -16,6 +16,8 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.filters.Filtering; import com.jpexs.helpers.SerializableImage; @@ -38,35 +40,53 @@ public class CXFORMWITHALPHA { /** * Red multiply value */ + @Conditional("hasMultTerms") + @SWFType(value=BasicType.SB,countField="nbits") public int redMultTerm; /** * Green multiply value */ + @Conditional("hasMultTerms") + @SWFType(value=BasicType.SB,countField="nbits") public int greenMultTerm; /** * Blue multiply value */ + @Conditional("hasMultTerms") + @SWFType(value=BasicType.SB,countField="nbits") public int blueMultTerm; /** * Alpha multiply value */ + @Conditional("hasMultTerms") + @SWFType(value=BasicType.SB,countField="nbits") public int alphaMultTerm; /** * Red addition value */ + @Conditional("hasAddTerms") + @SWFType(value=BasicType.SB,countField="nbits") public int redAddTerm; /** * Green addition value */ + @Conditional("hasAddTerms") + @SWFType(value=BasicType.SB,countField="nbits") public int greenAddTerm; /** * Blue addition value */ + @Conditional("hasAddTerms") + @SWFType(value=BasicType.SB,countField="nbits") public int blueAddTerm; /** * Alpha addition value */ + @Conditional("hasAddTerms") + @SWFType(value=BasicType.SB,countField="nbits") public int alphaAddTerm; + + @SWFType(value=BasicType.UB, count=4) public int nbits; public SerializableImage apply(SerializableImage src) { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/FILLSTYLE.java b/trunk/src/com/jpexs/decompiler/flash/types/FILLSTYLE.java index 42712ecd4..715be3478 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/FILLSTYLE.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/FILLSTYLE.java @@ -16,7 +16,12 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.tags.DefineShape3Tag; import com.jpexs.decompiler.flash.tags.base.NeedsCharacters; +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 java.util.HashSet; import java.util.Set; @@ -26,6 +31,7 @@ import java.util.Set; */ public class FILLSTYLE implements NeedsCharacters { + @SWFType(BasicType.UI8) public int fillStyleType; public static final int SOLID = 0x0; public static final int LINEAR_GRADIENT = 0x10; @@ -35,11 +41,22 @@ public class FILLSTYLE implements NeedsCharacters { public static final int CLIPPED_BITMAP = 0x41; public static final int NON_SMOOTHED_REPEATING_BITMAP = 0x42; public static final int NON_SMOOTHED_CLIPPED_BITMAP = 0x43; + @Internal public boolean inShape3; + @ConditionalType(type = RGBA.class,tags = DefineShape3Tag.ID) public RGB color; + + @Conditional(value="fillStyleType",options={LINEAR_GRADIENT,RADIAL_GRADIENT,FOCAL_RADIAL_GRADIENT}) public MATRIX gradientMatrix; + + @Conditional(value="fillStyleType",options={LINEAR_GRADIENT,RADIAL_GRADIENT,FOCAL_RADIAL_GRADIENT}) + @ConditionalType(value="fillStyleType",type=FOCALGRADIENT.class, options={FOCAL_RADIAL_GRADIENT}) public GRADIENT gradient; + + @Conditional(value="fillStyleType",options={REPEATING_BITMAP,CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP}) public int bitmapId; + + @Conditional(value="fillStyleType",options={REPEATING_BITMAP,CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP}) public MATRIX bitmapMatrix; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/FOCALGRADIENT.java b/trunk/src/com/jpexs/decompiler/flash/types/FOCALGRADIENT.java index 8e1fb7aa2..a59d92427 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/FOCALGRADIENT.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/FOCALGRADIENT.java @@ -16,11 +16,14 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class FOCALGRADIENT extends GRADIENT { + @SWFType(BasicType.FIXED8) public float focalPoint; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/GLYPHENTRY.java b/trunk/src/com/jpexs/decompiler/flash/types/GLYPHENTRY.java index 0d4fbac8f..cf0cd0e29 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/GLYPHENTRY.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/GLYPHENTRY.java @@ -16,13 +16,17 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class GLYPHENTRY { + @SWFType(value=BasicType.UB,countField="+glyphBits") public int glyphIndex; + @SWFType(value=BasicType.SB,countField="advanceBits") public int glyphAdvance; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/GRADIENT.java b/trunk/src/com/jpexs/decompiler/flash/types/GRADIENT.java index 0bac8a517..1b6cc82d9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/GRADIENT.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/GRADIENT.java @@ -16,6 +16,8 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS @@ -25,6 +27,7 @@ public class GRADIENT { /** * Spread mode */ + @SWFType(value=BasicType.UB,count=2) public int spreadMode; public static final int SPREAD_PAD_MODE = 0; public static final int SPREAD_REFLECT_MODE = 1; @@ -33,6 +36,7 @@ public class GRADIENT { /** * Interpolation mode */ + @SWFType(value=BasicType.UB,count=2) public int interpolationMode; public static final int INTERPOLATION_RGB_MODE = 0; public static final int INTERPOLATION_LINEAR_RGB_MODE = 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/GRADRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/GRADRECORD.java index ce4ecde35..2ef2a6027 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/GRADRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/GRADRECORD.java @@ -16,13 +16,19 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class GRADRECORD { + @SWFType(BasicType.UI8) public int ratio; + + @Internal public boolean inShape3; public RGB color; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/KERNINGRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/KERNINGRECORD.java index cc6a701ae..b72c2ab64 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/KERNINGRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/KERNINGRECORD.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.awt.Font; import java.awt.font.GlyphVector; import java.awt.font.TextAttribute; @@ -31,8 +32,13 @@ import javax.swing.JPanel; */ public class KERNINGRECORD { + @SWFType(value=BasicType.UI8,alternateValue = BasicType.UI16, alternateCondition = "fontFlagsWideCodes") public int fontKerningCode1; + + @SWFType(value=BasicType.UI8,alternateValue = BasicType.UI16, alternateCondition = "fontFlagsWideCodes") public int fontKerningCode2; + + @SWFType(BasicType.SI16) public int fontKerningAdjustment; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/LANGCODE.java b/trunk/src/com/jpexs/decompiler/flash/types/LANGCODE.java index dd187f92f..202cf6a57 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/LANGCODE.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/LANGCODE.java @@ -16,12 +16,15 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class LANGCODE { + @SWFType(BasicType.UI8) public int languageCode; public LANGCODE() { @@ -30,4 +33,11 @@ public class LANGCODE { public LANGCODE(int languageCode) { this.languageCode = languageCode; } + + @Override + public String toString() { + return "[LANGCODE:"+languageCode+"]"; + } + + } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE.java b/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE.java index ab5125885..0620e0ac1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE.java @@ -16,12 +16,20 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.tags.DefineShape3Tag; +import com.jpexs.decompiler.flash.tags.DefineShape4Tag; +import com.jpexs.decompiler.flash.types.annotations.ConditionalType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class LINESTYLE { + @SWFType(BasicType.UI16) public int width; + + @ConditionalType(tags = {DefineShape3Tag.ID,DefineShape4Tag.ID}, type=RGBA.class) public RGB color; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE2.java b/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE2.java index dd86d256f..bc483e489 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE2.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE2.java @@ -16,13 +16,18 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class LINESTYLE2 extends LINESTYLE { + @SWFType(value=BasicType.UB,count = 2) public int startCapStyle; + @SWFType(value=BasicType.UB,count = 2) public int joinStyle; public static final int ROUND_JOIN = 0; public static final int BEVEL_JOIN = 1; @@ -32,10 +37,14 @@ public class LINESTYLE2 extends LINESTYLE { public boolean noVScaleFlag; public boolean pixelHintingFlag; public boolean noClose; + @SWFType(value=BasicType.UB,count = 2) public int endCapStyle; public static final int ROUND_CAP = 0; public static final int NO_CAP = 1; public static final int SQUARE_CAP = 2; + + @SWFType(BasicType.UI16) + @Conditional(value="joinStyle",options = MITER_JOIN) public int miterLimitFactor; public FILLSTYLE fillType; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MATRIX.java b/trunk/src/com/jpexs/decompiler/flash/types/MATRIX.java index a1d16bfd0..ffddf65d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MATRIX.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MATRIX.java @@ -16,6 +16,8 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.awt.Point; import java.io.Serializable; @@ -34,10 +36,14 @@ public class MATRIX implements Serializable { /** * X scale value */ + @Conditional("hasScale") + @SWFType(value=BasicType.FB,countField = "nScaleBits") public int scaleX; /** * Y scale value */ + @Conditional("hasScale") + @SWFType(value=BasicType.FB,countField = "nScaleBits") public int scaleY; /** * Has rotate and skew values @@ -46,23 +52,35 @@ public class MATRIX implements Serializable { /** * First rotate and skew value */ + @Conditional("hasRotate") + @SWFType(value=BasicType.FB,countField = "nRotateBits") public int rotateSkew0; /** * Second rotate and skew value */ + @Conditional("hasRotate") + @SWFType(value=BasicType.FB,countField = "nRotateBits") public int rotateSkew1; /** * X translate value in twips */ + @SWFType(value=BasicType.SB,countField = "nTranslateBits") public int translateX; /** * Y translate value in twips */ + @SWFType(value=BasicType.SB,countField = "nTranslateBits") public int translateY; - public int bitsTranslate; - public int bitsRotate; - public int bitsScale; - + + @SWFType(value=BasicType.UB,count = 5) + public int nTranslateBits; + + @SWFType(value=BasicType.UB,count = 5) + public int nRotateBits; + + @SWFType(value=BasicType.UB,count = 5) + public int nScaleBits; + public MATRIX() { } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLE.java b/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLE.java index 11fd6b229..410fef7e4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLE.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MORPHFILLSTYLE.java @@ -17,6 +17,8 @@ package com.jpexs.decompiler.flash.types; import com.jpexs.decompiler.flash.tags.base.NeedsCharacters; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.util.HashSet; import java.util.Set; @@ -26,7 +28,9 @@ import java.util.Set; */ public class MORPHFILLSTYLE implements NeedsCharacters { + @SWFType(BasicType.UI8) public int fillStyleType; + public static final int SOLID = 0x0; public static final int LINEAR_GRADIENT = 0x10; public static final int RADIAL_GRADIENT = 0x12; @@ -34,13 +38,29 @@ public class MORPHFILLSTYLE implements NeedsCharacters { public static final int CLIPPED_BITMAP = 0x41; public static final int NON_SMOOTHED_REPEATING_BITMAP = 0x42; public static final int NON_SMOOTHED_CLIPPED_BITMAP = 0x43; + + @Conditional(value="fillStyleType",options = {SOLID}) public RGBA startColor; + + @Conditional(value="fillStyleType",options = {SOLID}) public RGBA endColor; + + @Conditional(value="fillStyleType",options = {LINEAR_GRADIENT,RADIAL_GRADIENT}) public MATRIX startGradientMatrix; + + @Conditional(value="fillStyleType",options = {LINEAR_GRADIENT,RADIAL_GRADIENT}) public MATRIX endGradientMatrix; + + @Conditional(value="fillStyleType",options = {LINEAR_GRADIENT,RADIAL_GRADIENT}) public MORPHGRADIENT gradient; + + @Conditional(value="fillStyleType",options = {CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP}) public int bitmapId; + + @Conditional(value="fillStyleType",options = {CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP}) public MATRIX startBitmapMatrix; + + @Conditional(value="fillStyleType",options = {CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP}) public MATRIX endBitmapMatrix; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java b/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java index 1c82ba477..7a7a30d4f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java @@ -16,6 +16,9 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS @@ -25,12 +28,17 @@ public class MORPHGRADIENT { /** * Spread mode. See GRADIENT.SPREAD_* constants */ + @SWFType(value=BasicType.UB,count=2) public int spreadMode; /** * Interpolation mode. See GRADIENT.INTERPOLATION_* constants */ + @SWFType(value=BasicType.UB,count=2) public int interPolationMode; + @Internal public int numGradients; + + public MORPHGRADRECORD[] gradientRecords; public static RGBA morphColor(RGBA c1, RGBA c2, int ratio) { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADRECORD.java index ed492d9b8..664f0e039 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MORPHGRADRECORD.java @@ -16,15 +16,22 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class MORPHGRADRECORD { + @SWFType(BasicType.UI8) public int startRatio; + public RGBA startColor; + + @SWFType(BasicType.UI8) public int endRatio; + public RGBA endColor; public GRADRECORD getStartRecord() { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE.java b/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE.java index 0a26f88f6..15b6a2d55 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE.java @@ -16,13 +16,17 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class MORPHLINESTYLE { + @SWFType(BasicType.UI16) public int startWidth; + @SWFType(BasicType.UI16) public int endWidth; public RGBA startColor; public RGBA endColor; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE2.java b/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE2.java index b85faae4a..f656ed2a6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE2.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE2.java @@ -16,15 +16,22 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class MORPHLINESTYLE2 { + @SWFType(BasicType.UI16) public int startWidth; + @SWFType(BasicType.UI16) public int endWidth; + @SWFType(value=BasicType.UB,count = 2) public int startCapStyle; + @SWFType(value=BasicType.UB,count = 2) public int joinStyle; public static final int ROUND_JOIN = 0; public static final int BEVEL_JOIN = 1; @@ -34,13 +41,25 @@ public class MORPHLINESTYLE2 { public boolean noVScaleFlag; public boolean pixelHintingFlag; public boolean noClose; + + @SWFType(value=BasicType.UB,count = 2) public int endCapStyle; + public static final int ROUND_CAP = 0; public static final int NO_CAP = 1; public static final int SQUARE_CAP = 2; + + @SWFType(value=BasicType.UI16) + @Conditional(value="joinStyle",options = {MITER_JOIN}) public int miterLimitFactor; + + @Conditional(value="hasFillFlag",revert = true) public RGBA startColor; + + @Conditional(value="hasFillFlag",revert = true) public RGBA endColor; + + @Conditional(value="hasFillFlag") public MORPHFILLSTYLE fillType; public LINESTYLE2 getLineStyle2At(int ratio) { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/PIX15.java b/trunk/src/com/jpexs/decompiler/flash/types/PIX15.java index 41f0b0e11..076921727 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/PIX15.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/PIX15.java @@ -16,6 +16,8 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * Represents 15-bit red, green and blue value * @@ -26,13 +28,16 @@ public class PIX15 { /** * Red color value */ + @SWFType(value=BasicType.UB, count = 5) public int red; /** * Green color value */ + @SWFType(value=BasicType.UB, count = 5) public int green; /** * Blue color value */ + @SWFType(value=BasicType.UB, count = 5) public int blue; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/PIX24.java b/trunk/src/com/jpexs/decompiler/flash/types/PIX24.java index ee71ef97c..a646e09db 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/PIX24.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/PIX24.java @@ -16,6 +16,9 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Reserved; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * Represents 15-bit red, green and blue value * @@ -23,18 +26,23 @@ package com.jpexs.decompiler.flash.types; */ public class PIX24 { + @SWFType(BasicType.UI8) + @Reserved public int reserved; /** * Red color value */ + @SWFType(BasicType.UI8) public int red; /** * Green color value */ + @SWFType(BasicType.UI8) public int green; /** * Blue color value */ + @SWFType(BasicType.UI8) public int blue; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/RECT.java b/trunk/src/com/jpexs/decompiler/flash/types/RECT.java index b184d162b..92ec6bc79 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/RECT.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/RECT.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.awt.Point; import java.io.Serializable; @@ -29,19 +30,28 @@ public class RECT implements Serializable { /** * X minimum position for rectangle in twips */ + @SWFType(value=BasicType.SB, countField = "nbits") public int Xmin; + /** * X maximum position for rectangle in twips */ + @SWFType(value=BasicType.SB, countField = "nbits") public int Xmax; + /** * Y minimum position for rectangle in twips */ + @SWFType(value=BasicType.SB, countField = "nbits") public int Ymin; + /** * Y maximum position for rectangle in twips */ + @SWFType(value=BasicType.SB, countField = "nbits") public int Ymax; + + @SWFType(value=BasicType.UB, count = 5) public int nbits; public RECT(int Xmin, int Xmax, int Ymin, int Ymax) { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/RGB.java b/trunk/src/com/jpexs/decompiler/flash/types/RGB.java index e37046573..f08d2913f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/RGB.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/RGB.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.awt.Color; /** @@ -28,14 +29,17 @@ public class RGB { /** * Red color value */ + @SWFType(BasicType.UI8) public int red; /** * Green color value */ + @SWFType(BasicType.UI8) public int green; /** * Blue color value */ + @SWFType(BasicType.UI8) public int blue; public RGB(int red, int green, int blue) { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/RGBA.java b/trunk/src/com/jpexs/decompiler/flash/types/RGBA.java index d1ad11883..de7b32a0b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/RGBA.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/RGBA.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.awt.Color; /** @@ -28,6 +29,7 @@ public class RGBA extends RGB { /** * Alpha value defining opacity */ + @SWFType(BasicType.UI8) public int alpha; public float getAlphaFloat() { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/SHAPE.java b/trunk/src/com/jpexs/decompiler/flash/types/SHAPE.java index 69c3d3032..4c4752d52 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/SHAPE.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/SHAPE.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.types; import com.jpexs.decompiler.flash.tags.base.NeedsCharacters; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD; import java.util.HashSet; import java.util.List; @@ -28,7 +29,9 @@ import java.util.Set; */ public class SHAPE implements NeedsCharacters { + @SWFType(value=BasicType.UB, count=4) public int numFillBits; + @SWFType(value=BasicType.UB, count=4) public int numLineBits; public List shapeRecords; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/SOUNDENVELOPE.java b/trunk/src/com/jpexs/decompiler/flash/types/SOUNDENVELOPE.java index be0be767d..0dd7332f1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/SOUNDENVELOPE.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/SOUNDENVELOPE.java @@ -16,13 +16,18 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS */ public class SOUNDENVELOPE { + @SWFType(BasicType.UI32) public long pos44; + @SWFType(BasicType.UI16) public int leftLevel; + @SWFType(BasicType.UI16) public int rightLevel; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java b/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java index c7f383d6d..2e55d3417 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java @@ -16,6 +16,9 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * * @author JPEXS @@ -28,8 +31,19 @@ public class SOUNDINFO { public boolean hasLoops; public boolean hasOutPoint; public boolean hasInPoint; + + @Conditional("hasInPoint") + @SWFType(BasicType.UI32) public long inPoint; + + @Conditional("hasOutPoint") + @SWFType(BasicType.UI32) public long outPoint; + + @Conditional("hasLoops") + @SWFType(BasicType.UI16) public int loopCount; + + @Conditional("hasEnvelope") public SOUNDENVELOPE[] envelopeRecords = new SOUNDENVELOPE[0]; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/TEXTRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/TEXTRECORD.java index 5cd025270..70f1c1815 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/TEXTRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/TEXTRECORD.java @@ -16,8 +16,12 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.tags.DefineText2Tag; +import com.jpexs.decompiler.flash.tags.DefineTextTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.FontTag; +import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.util.List; /** @@ -30,12 +34,29 @@ public class TEXTRECORD { public boolean styleFlagsHasColor; public boolean styleFlagsHasYOffset; public boolean styleFlagsHasXOffset; + + @Conditional("styleFlagsHasFont") + @SWFType(BasicType.UI16) public int fontId; + + @Conditional(value="styleFlagsHasColor", tags = {DefineTextTag.ID}) public RGB textColor; + + @Conditional(value="styleFlagsHasColor", tags = {DefineText2Tag.ID}) public RGBA textColorA; + + @Conditional("styleFlagsHasXOffset") + @SWFType(BasicType.SI16) public int xOffset; + + @Conditional("styleFlagsHasYOffset") + @SWFType(BasicType.SI16) public int yOffset; + + @Conditional("styleFlagsHasFont") + @SWFType(BasicType.UI16) public int textHeight; + public GLYPHENTRY[] glyphEntries; public String getText(List tags, FontTag font) { diff --git a/trunk/src/com/jpexs/decompiler/flash/types/ZONEDATA.java b/trunk/src/com/jpexs/decompiler/flash/types/ZONEDATA.java index a150095a0..c8c62ff52 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/ZONEDATA.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/ZONEDATA.java @@ -16,6 +16,8 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.SWFType; + /** * Represents 32-bit alpha, red, green and blue value * @@ -23,7 +25,9 @@ package com.jpexs.decompiler.flash.types; */ public class ZONEDATA { + @SWFType(BasicType.FLOAT16) public int alignmentCoordinate; + @SWFType(BasicType.FLOAT16) public int range; @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/Conditional.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Conditional.java new file mode 100644 index 000000000..1f4dd632f --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Conditional.java @@ -0,0 +1,44 @@ +/* + * 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; + +/** + * Mark for field that it is available only whern certain field (value) is set + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Conditional { + ///Name of field on which this depends + String[] value() default {}; + ///Tag IDs which this field must be in + int[] tags() default {}; + ///Minimum SWF version for this field + int minSwfVersion() default 1; + ///Maximum SWF version for this field + int maxSwfVersion() default Integer.MAX_VALUE; + ///List of values for condition (if true/false is not enough) + int[] options() default {}; + ///Revert condition (if false...) + boolean revert() default false; +} diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/ConditionalType.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/ConditionalType.java new file mode 100644 index 000000000..09c029450 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/ConditionalType.java @@ -0,0 +1,46 @@ +/* + * 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; + +/** + * Mark for field that its type is different whern certain field (value) is set + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ConditionalType { + ///Name of field on which this depends + String[] value() default {}; + ///Tag IDs which this field must be in + int[] tags() default {}; + ///Minimum SWF version for this field + int minSwfVersion() default 1; + ///Maximum SWF version for this field + int maxSwfVersion() default Integer.MAX_VALUE; + ///List of values for condition (if true/false is not enough) + int[] options() default {}; + ///Revert condition (if false...) + boolean revert() default false; + ///Field type when condition is met + Class type(); +} diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/Internal.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Internal.java new file mode 100644 index 000000000..577f87804 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Internal.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; + +/** + * Field is internal + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Internal { + +} diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/Reserved.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Reserved.java new file mode 100644 index 000000000..a5f4e2842 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/Reserved.java @@ -0,0 +1,32 @@ +/* + * 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; + +/** + * Field is reserved + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Reserved { +} diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/SWFType.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/SWFType.java new file mode 100644 index 000000000..091578862 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/SWFType.java @@ -0,0 +1,43 @@ +/* + * 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 com.jpexs.decompiler.flash.types.BasicType; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Maps basic java types (int,float,double) to SWF types (UI8,UI16...FLOAT) + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface SWFType { + /// Type of value + BasicType value(); + /// Alternate type when condition is met + BasicType alternateValue() default BasicType.NONE; + /// 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; + /// Field name on which Count depends + String countField() default ""; +}