diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java index d68c6c1af..02516b570 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -166,10 +166,14 @@ import com.jpexs.decompiler.flash.tags.EndTag; import com.jpexs.decompiler.flash.tags.ExportAssetsTag; import com.jpexs.decompiler.flash.tags.FileAttributesTag; import com.jpexs.decompiler.flash.tags.FrameLabelTag; +import com.jpexs.decompiler.flash.tags.FreeAllTag; +import com.jpexs.decompiler.flash.tags.FreeCharacterTag; import com.jpexs.decompiler.flash.tags.ImportAssets2Tag; import com.jpexs.decompiler.flash.tags.ImportAssetsTag; import com.jpexs.decompiler.flash.tags.JPEGTablesTag; import com.jpexs.decompiler.flash.tags.MetadataTag; +import com.jpexs.decompiler.flash.tags.NameCharacterTag; +import com.jpexs.decompiler.flash.tags.PathsArePostScriptTag; import com.jpexs.decompiler.flash.tags.PlaceObject2Tag; import com.jpexs.decompiler.flash.tags.PlaceObject3Tag; import com.jpexs.decompiler.flash.tags.PlaceObject4Tag; @@ -188,6 +192,7 @@ import com.jpexs.decompiler.flash.tags.SoundStreamHeadTag; import com.jpexs.decompiler.flash.tags.StartSound2Tag; import com.jpexs.decompiler.flash.tags.StartSoundTag; import com.jpexs.decompiler.flash.tags.SymbolClassTag; +import com.jpexs.decompiler.flash.tags.SyncFrameTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.TagStub; import com.jpexs.decompiler.flash.tags.UnknownTag; @@ -1206,7 +1211,9 @@ public class SWFInputStream implements AutoCloseable { case 2: ret = new DefineShapeTag(sis, data, lazy); break; - //case 3: FreeCharacter + case 3: + ret = new FreeCharacterTag(sis, data); + break; case 4: ret = new PlaceObjectTag(sis, data); break; @@ -1268,7 +1275,9 @@ public class SWFInputStream implements AutoCloseable { case 24: ret = new ProtectTag(sis, data); break; - //case 25: PathsArePostScript + case 25: + ret = new PathsArePostScriptTag(sis, data); + break; case 26: ret = new PlaceObject2Tag(sis, data); break; @@ -1276,9 +1285,13 @@ public class SWFInputStream implements AutoCloseable { case 28: ret = new RemoveObject2Tag(sis, data); break; - //case 29: SyncFrame + case 29: + ret = new SyncFrameTag(sis, data); + break; //case 30: - //case 31: FreeAll + case 31: + ret = new FreeAllTag(sis, data); + break; case 32: ret = new DefineShape3Tag(sis, data, lazy); break; @@ -1297,12 +1310,14 @@ public class SWFInputStream implements AutoCloseable { case 37: ret = new DefineEditTextTag(sis, data); break; - //case 38: DefineMouseTarget (DefineVideo?) + //case 38: DefineMouseTarget case 39: ret = new DefineSpriteTag(sis, level, data, parallel, skipUnusualTags); break; - //case 40: NameCharacter - case 41: + case 40: + ret = new NameCharacterTag(sis, data); + break; + case 41: //or NameObject ret = new ProductInfoTag(sis, data); break; //case 42: DefineTextFormat diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FreeAllTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FreeAllTag.java new file mode 100644 index 000000000..bb7550ca8 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FreeAllTag.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010-2015 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.tags; + +import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.SWFInputStream; +import com.jpexs.helpers.ByteArrayRange; +import java.io.IOException; + +/** + * + * + * @author JPEXS + */ +public class FreeAllTag extends Tag { + + public static final int ID = 31; + + public static final String NAME = "FreeAll"; + + /** + * Constructor + * + * @param swf + */ + public FreeAllTag(SWF swf) { + super(swf, ID, NAME, null); + } + + public FreeAllTag(SWFInputStream sis, ByteArrayRange data) throws IOException { + super(sis.getSwf(), ID, NAME, data); + readData(sis, data, 0, false, false, false); + } + + @Override + public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException { + + } + + /** + * Gets data bytes + * + * @return Bytes of data + */ + @Override + public byte[] getData() { + return new byte[0]; + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FreeCharacterTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FreeCharacterTag.java new file mode 100644 index 000000000..272dc135f --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FreeCharacterTag.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2010-2015 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.tags; + +import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.SWFInputStream; +import com.jpexs.decompiler.flash.SWFOutputStream; +import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; +import com.jpexs.helpers.ByteArrayRange; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * + * + * @author JPEXS + */ +public class FreeCharacterTag extends Tag implements CharacterIdTag { + + public static final int ID = 3; + + public static final String NAME = "FreeCharacter"; + + /** + * ID of character to free + */ + @SWFType(BasicType.UI16) + public int characterId; + + /** + * Constructor + * + * @param swf + */ + public FreeCharacterTag(SWF swf) { + super(swf, ID, NAME, null); + } + + public FreeCharacterTag(SWFInputStream sis, ByteArrayRange data) throws IOException { + super(sis.getSwf(), ID, NAME, data); + readData(sis, data, 0, false, false, false); + } + + @Override + public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException { + this.characterId = sis.readUI16("characterId"); + } + + /** + * Gets data bytes + * + * @return Bytes of data + */ + @Override + public byte[] getData() { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + OutputStream os = baos; + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); + try { + sos.writeUI16(characterId); + } catch (IOException e) { + throw new Error("This should never happen.", e); + } + return baos.toByteArray(); + } + + @Override + public int getCharacterId() { + return characterId; + } + + @Override + public void setCharacterId(int characterId) { + this.characterId = characterId; + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/NameCharacterTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/NameCharacterTag.java new file mode 100644 index 000000000..0f14e5f53 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/NameCharacterTag.java @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2010-2015 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.tags; + +import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.SWFInputStream; +import com.jpexs.decompiler.flash.SWFOutputStream; +import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; +import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.SWFType; +import com.jpexs.helpers.ByteArrayRange; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * + * + * @author JPEXS + */ +public class NameCharacterTag extends Tag implements CharacterIdTag { + + public static final int ID = 40; + + public static final String NAME = "NameCharacter"; + + /** + * ID of character to name + */ + @SWFType(BasicType.UI16) + public int characterId; + + /** + * Name of the character + */ + public String name; + + /** + * Constructor + * + * @param swf + */ + public NameCharacterTag(SWF swf) { + super(swf, ID, NAME, null); + this.characterId = swf.getNextCharacterId(); + this.name = "unknown"; + } + + public NameCharacterTag(SWFInputStream sis, ByteArrayRange data) throws IOException { + super(sis.getSwf(), ID, NAME, data); + readData(sis, data, 0, false, false, false); + } + + @Override + public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException { + characterId = sis.readUI16("characterId"); + name = sis.readString("name"); + } + + /** + * Gets data bytes + * + * @return Bytes of data + */ + @Override + public byte[] getData() { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + OutputStream os = baos; + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); + try { + sos.writeUI16(characterId); + sos.writeString(name); + } catch (IOException e) { + throw new Error("This should never happen.", e); + } + return baos.toByteArray(); + } + + @Override + public int getCharacterId() { + return characterId; + } + + @Override + public void setCharacterId(int characterId) { + this.characterId = characterId; + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PathsArePostScriptTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PathsArePostScriptTag.java new file mode 100644 index 000000000..0ab76f2af --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/PathsArePostScriptTag.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010-2015 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.tags; + +import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.SWFInputStream; +import com.jpexs.helpers.ByteArrayRange; +import java.io.IOException; + +/** + * + * + * @author JPEXS + */ +public class PathsArePostScriptTag extends Tag { + + public static final int ID = 25; + + public static final String NAME = "PathsArePostScript"; + + /** + * Constructor + * + * @param swf + */ + public PathsArePostScriptTag(SWF swf) { + super(swf, ID, NAME, null); + } + + public PathsArePostScriptTag(SWFInputStream sis, ByteArrayRange data) throws IOException { + super(sis.getSwf(), ID, NAME, data); + readData(sis, data, 0, false, false, false); + } + + @Override + public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException { + + } + + /** + * Gets data bytes + * + * @return Bytes of data + */ + @Override + public byte[] getData() { + return new byte[0]; + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SyncFrameTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SyncFrameTag.java new file mode 100644 index 000000000..cf91c263c --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SyncFrameTag.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010-2015 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.tags; + +import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.SWFInputStream; +import com.jpexs.helpers.ByteArrayRange; +import java.io.IOException; + +/** + * + * + * @author JPEXS + */ +public class SyncFrameTag extends Tag { + + public static final int ID = 29; + + public static final String NAME = "SyncFrame"; + + /** + * Constructor + * + * @param swf + */ + public SyncFrameTag(SWF swf) { + super(swf, ID, NAME, null); + } + + public SyncFrameTag(SWFInputStream sis, ByteArrayRange data) throws IOException { + super(sis.getSwf(), ID, NAME, data); + readData(sis, data, 0, false, false, false); + } + + @Override + public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException { + + } + + /** + * Gets data bytes + * + * @return Bytes of data + */ + @Override + public byte[] getData() { + return new byte[0]; + } +}