This commit is contained in:
2015-02-19 21:21:15 +01:00
parent f7541748ac
commit c0e78c823b
88 changed files with 573 additions and 72 deletions
@@ -1182,10 +1182,10 @@ public class SWFInputStream implements AutoCloseable {
try {
switch (tag.getId()) {
case 0:
ret = new EndTag(swf, data);
ret = new EndTag(sis, data);
break;
case 1:
ret = new ShowFrameTag(swf, data);
ret = new ShowFrameTag(sis, data);
break;
case 2:
ret = new DefineShapeTag(sis, data, lazy);
@@ -101,6 +101,11 @@ public class CSMTextSettingsTag extends Tag {
*/
public CSMTextSettingsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "CSMTextSettings", 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 {
textID = sis.readUI16("textID");
useFlashType = (int) sis.readUB(2, "useFlashType");
gridFit = (int) sis.readUB(3, "gridFit");
@@ -1,18 +1,19 @@
/*
* 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.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
@@ -74,6 +75,11 @@ public class DebugIDTag extends Tag {
*/
public DebugIDTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DebugID", 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 {
debugId = sis.readBytesEx(16, "debugId");
}
}
@@ -83,6 +83,11 @@ public class DefineBinaryDataTag extends CharacterTag {
public DefineBinaryDataTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineBinaryData", 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 {
tag = sis.readUI16("tag");
reserved = sis.readUI32("reserved");
binaryData = sis.readByteRangeEx(sis.available(), "binaryData");
@@ -1,18 +1,19 @@
/*
* 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.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
@@ -88,6 +89,11 @@ public class DefineBitsJPEG2Tag extends ImageTag implements AloneTag {
public DefineBitsJPEG2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineBitsJPEG2", 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");
imageData = sis.readByteRangeEx(sis.available(), "imageData");
}
@@ -130,6 +130,11 @@ public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag {
public DefineBitsJPEG3Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineBitsJPEG3", 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");
long alphaDataOffset = sis.readUI32("alphaDataOffset");
imageData = sis.readByteRangeEx(alphaDataOffset, "imageData");
@@ -160,6 +160,11 @@ public class DefineBitsJPEG4Tag extends ImageTag implements AloneTag {
*/
public DefineBitsJPEG4Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineBitsJPEG4", 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");
long alphaDataOffset = sis.readUI32("alphaDataOffset");
deblockParam = sis.readUI16("deblockParam");
@@ -160,6 +160,11 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag {
public DefineBitsLossless2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineBitsLossless2", 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");
bitmapFormat = sis.readUI8("bitmapFormat");
bitmapWidth = sis.readUI16("bitmapWidth");
@@ -232,6 +232,11 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag {
public DefineBitsLosslessTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineBitsLossless", 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");
bitmapFormat = sis.readUI8("bitmapFormat");
bitmapWidth = sis.readUI16("bitmapWidth");
@@ -1,18 +1,19 @@
/*
* 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.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
@@ -64,6 +65,11 @@ public class DefineBitsTag extends ImageTag implements TagChangedListener {
public DefineBitsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineBits", 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");
jpegData = sis.readByteRangeEx(sis.available(), "jpegData");
}
@@ -118,6 +118,11 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
*/
public DefineButton2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineButton2", 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 {
buttonId = sis.readUI16("buttonId");
reserved = (int) sis.readUB(7, "reserved");
trackAsMenu = sis.readUB(1, "trackAsMenu") == 1;
@@ -79,6 +79,11 @@ public class DefineButtonCxformTag extends Tag {
*/
public DefineButtonCxformTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineButtonCxform", 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 {
buttonId = sis.readUI16("buttonId");
buttonColorTransform = sis.readCXFORM("buttonColorTransform");
}
@@ -117,6 +117,11 @@ public class DefineButtonSoundTag extends CharacterIdTag {
*/
public DefineButtonSoundTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineButtonSound", 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 {
buttonId = sis.readUI16("buttonId");
buttonSoundChar0 = sis.readUI16("buttonSoundChar0");
if (buttonSoundChar0 != 0) {
@@ -120,6 +120,11 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
*/
public DefineButtonTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineButton", 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 {
buttonId = sis.readUI16("buttonId");
characters = sis.readBUTTONRECORDList(false, "characters");
actionBytes = sis.readByteRangeEx(sis.available(), "actionBytes");
@@ -762,6 +762,11 @@ public class DefineEditTextTag extends TextTag {
*/
public DefineEditTextTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineEditText", 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");
bounds = sis.readRECT("bounds");
hasText = sis.readUB(1, "hasText") == 1;
@@ -227,6 +227,11 @@ public class DefineFont2Tag extends FontTag {
*/
public DefineFont2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFont2", 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 {
fontId = sis.readUI16("fontId");
fontFlagsHasLayout = sis.readUB(1, "fontFlagsHasLayout") == 1;
fontFlagsShiftJIS = sis.readUB(1, "fontFlagsShiftJIS") == 1;
@@ -140,6 +140,11 @@ public class DefineFont3Tag extends FontTag {
public DefineFont3Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFont3", 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 {
fontId = sis.readUI16("fontId");
fontFlagsHasLayout = sis.readUB(1, "fontFlagsHasLayout") == 1;
fontFlagsShiftJIS = sis.readUB(1, "fontFlagsShiftJIS") == 1;
@@ -68,6 +68,11 @@ public class DefineFont4Tag extends CharacterTag {
public DefineFont4Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFont4", 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 {
fontID = sis.readUI16("fontID");
reserved = (int) sis.readUB(5, "reserved");
fontFlagsHasFontData = sis.readUB(1, "fontFlagsHasFontData") == 1;
@@ -60,6 +60,11 @@ public class DefineFontAlignZonesTag extends Tag {
public DefineFontAlignZonesTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFontAlignZones", 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 {
fontID = sis.readUI16("fontID");
CSMTableHint = (int) sis.readUB(2, "CSMTableHint");
reserved = (int) sis.readUB(6, "reserved");
@@ -119,6 +119,11 @@ public class DefineFontInfo2Tag extends Tag {
*/
public DefineFontInfo2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFontInfo2", 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 {
fontID = sis.readUI16("fontID");
int fontNameLen = sis.readUI8("fontNameLen");
if (swf.version >= 6) {
@@ -118,6 +118,11 @@ public class DefineFontInfoTag extends Tag {
*/
public DefineFontInfoTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFontInfo", 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 {
fontId = sis.readUI16("fontId");
int fontNameLen = sis.readUI8("fontNameLen");
if (swf.version >= 6) {
@@ -50,6 +50,11 @@ public class DefineFontNameTag extends Tag {
public DefineFontNameTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFontName", 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 {
fontId = sis.readUI16("fontId");
fontName = sis.readString("fontName");
fontCopyright = sis.readString("fontCopyright");
@@ -160,6 +160,11 @@ public class DefineFontTag extends FontTag {
*/
public DefineFontTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFont", 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 {
fontId = sis.readUI16("fontId");
glyphShapeTable = new ArrayList<>();
@@ -191,6 +191,11 @@ public class DefineMorphShape2Tag extends MorphShapeTag {
*/
public DefineMorphShape2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineMorphShape2", 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");
startBounds = sis.readRECT("startBounds");
endBounds = sis.readRECT("endBounds");
@@ -162,6 +162,11 @@ public class DefineMorphShapeTag extends MorphShapeTag {
*/
public DefineMorphShapeTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineMorphShape", 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");
startBounds = sis.readRECT("startBounds");
endBounds = sis.readRECT("endBounds");
@@ -51,6 +51,11 @@ public class DefineScalingGridTag extends Tag {
public DefineScalingGridTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineScalingGrid", 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");
splitter = sis.readRECT("splitter");
}
@@ -101,6 +101,11 @@ public class DefineSceneAndFrameLabelDataTag extends Tag {
*/
public DefineSceneAndFrameLabelDataTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineSceneAndFrameLabelData", 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 {
int sceneCount = (int) sis.readEncodedU32("sceneCount");
sceneOffsets = new long[sceneCount];
sceneNames = new String[sceneCount];
@@ -38,7 +38,7 @@ public class DefineShape2Tag extends ShapeTag {
@SWFType(BasicType.UI16)
public int shapeId;
private final RECT shapeBounds;
private RECT shapeBounds;
public SHAPEWITHSTYLE shapes;
@@ -105,6 +105,11 @@ public class DefineShape2Tag extends ShapeTag {
public DefineShape2Tag(SWFInputStream sis, ByteArrayRange data, boolean lazy) throws IOException {
super(sis.getSwf(), ID, "DefineShape2", data);
readData(sis, data, 0, false, false, lazy);
}
@Override
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
shapeId = sis.readUI16("shapeId");
shapeBounds = sis.readRECT("shapeBounds");
if (!lazy) {
@@ -105,6 +105,11 @@ public class DefineShape3Tag extends ShapeTag {
public DefineShape3Tag(SWFInputStream sis, ByteArrayRange data, boolean lazy) throws IOException {
super(sis.getSwf(), ID, "DefineShape3", data);
readData(sis, data, 0, false, false, lazy);
}
@Override
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
shapeId = sis.readUI16("shapeId");
shapeBounds = sis.readRECT("shapeBounds");
if (!lazy) {
@@ -119,6 +119,11 @@ public class DefineShape4Tag extends ShapeTag {
public DefineShape4Tag(SWFInputStream sis, ByteArrayRange data, boolean lazy) throws IOException {
super(sis.getSwf(), ID, "DefineShape4", data);
readData(sis, data, 0, false, false, lazy);
}
@Override
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
shapeId = sis.readUI16("shapeId");
shapeBounds = sis.readRECT("shapeBounds");
edgeBounds = sis.readRECT("edgeBounds");
@@ -99,6 +99,11 @@ public class DefineShapeTag extends ShapeTag {
public DefineShapeTag(SWFInputStream sis, ByteArrayRange data, boolean lazy) throws IOException {
super(sis.getSwf(), ID, "DefineShape", data);
readData(sis, data, 0, false, false, lazy);
}
@Override
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
shapeId = sis.readUI16("shapeId");
shapeBounds = sis.readRECT("shapeBounds");
if (!lazy) {
@@ -118,6 +118,11 @@ public class DefineSoundTag extends CharacterTag implements SoundTag {
*/
public DefineSoundTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineSound", 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 {
soundId = sis.readUI16("soundId");
soundFormat = (int) sis.readUB(4, "soundFormat");
soundRate = (int) sis.readUB(2, "soundRate");
@@ -218,6 +218,11 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
*/
public DefineSpriteTag(SWFInputStream sis, int level, ByteArrayRange data, boolean parallel, boolean skipUnusualTags) throws IOException, InterruptedException {
super(sis.getSwf(), ID, "DefineSprite", data);
readData(sis, data, level, parallel, skipUnusualTags, false);
}
@Override
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException, InterruptedException {
spriteId = sis.readUI16("spriteId");
frameCount = sis.readUI16("frameCount");
List<Tag> subTags = sis.readTagList(this, level + 1, parallel, skipUnusualTags, true);
@@ -64,9 +64,9 @@ public class DefineText2Tag extends TextTag {
@SWFType(BasicType.UI16)
public int characterID;
private final int glyphBits;
private int glyphBits;
private final int advanceBits;
private int advanceBits;
public RECT textBounds;
@@ -527,6 +527,11 @@ public class DefineText2Tag extends TextTag {
*/
public DefineText2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineText2", 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");
textBounds = sis.readRECT("textBounds");
textMatrix = sis.readMatrix("textMatrix");
@@ -65,9 +65,9 @@ public class DefineTextTag extends TextTag {
@SWFType(BasicType.UI16)
public int characterID;
private final int glyphBits;
private int glyphBits;
private final int advanceBits;
private int advanceBits;
public RECT textBounds;
@@ -540,6 +540,11 @@ public class DefineTextTag extends TextTag {
*/
public DefineTextTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineText", 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");
textBounds = sis.readRECT("textBounds");
textMatrix = sis.readMatrix("textMatrix");
@@ -121,6 +121,11 @@ public class DefineVideoStreamTag extends CharacterTag implements BoundedTag {
*/
public DefineVideoStreamTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineVideoStream", 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");
numFrames = sis.readUI16("numFrames");
width = sis.readUI16("width");
@@ -43,7 +43,7 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag {
*/
@HideInRawEdit
@SWFField
private final ABC abc;
private ABC abc;
/**
* A 32-bit flags value, which may contain the following bits set:
@@ -91,6 +91,11 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag {
*/
public DoABCDefineTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DoABCDefine", 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 {
flags = sis.readUI32("flags");
name = sis.readString("name");
@@ -41,7 +41,7 @@ public class DoABCTag extends Tag implements ABCContainerTag {
*/
@HideInRawEdit
@SWFField
private final ABC abc;
private ABC abc;
public static final int ID = 72;
@@ -74,7 +74,11 @@ public class DoABCTag extends Tag implements ABCContainerTag {
*/
public DoABCTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DoABC", 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 {
ABCInputStream ais = new ABCInputStream(sis.getBaseStream());
// put it to the dumpview:
sis.readByteRangeEx(sis.available(), "abcBytes");
@@ -67,6 +67,11 @@ public class DoActionTag extends Tag implements ASMSource {
*/
public DoActionTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DoAction", 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 {
actionBytes = sis.readByteRangeEx(sis.available(), "actionBytes");
}
@@ -74,6 +74,11 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
*/
public DoInitActionTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DoInitAction", 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 {
spriteId = sis.readUI16("spriteId");
actionBytes = sis.readByteRangeEx(sis.available(), "actionBytes");
}
@@ -84,6 +84,11 @@ public class EnableDebugger2Tag extends Tag {
*/
public EnableDebugger2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "EnableDebugger2", 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 {
reserved = sis.readUI16("reserved");
passwordHash = sis.readString("passwordHash");
}
@@ -77,6 +77,11 @@ public class EnableDebuggerTag extends Tag {
*/
public EnableDebuggerTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "EnableDebugger", 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 {
passwordHash = sis.readString("passwordHash");
}
}
@@ -1,18 +1,19 @@
/*
* 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. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
@@ -84,6 +85,11 @@ public class EnableTelemetryTag extends Tag {
*/
public EnableTelemetryTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "", 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 {
reserved = (int) sis.readUB(16, "reserved");
if (sis.available() > 0) {
passwordHash = sis.readBytesEx(32, "passwordHash");
@@ -1,21 +1,23 @@
/*
* 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. */
* 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;
@@ -50,12 +52,16 @@ public class EndTag extends Tag {
/**
* Constructor
*
* @param swf
* @param sis
* @param data
* @throws IOException
*/
public EndTag(SWF swf, ByteArrayRange data) throws IOException {
super(swf, ID, "End", data);
public EndTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "End", 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 {
}
}
@@ -68,6 +68,11 @@ public class ExportAssetsTag extends Tag {
*/
public ExportAssetsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "ExportAssets", 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 {
int count = sis.readUI16("count");
tags = new ArrayList<>();
names = new ArrayList<>();
@@ -64,6 +64,11 @@ public class FileAttributesTag extends Tag {
public FileAttributesTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "FileAttributes", 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 {
reserved1 = sis.readUB(1, "reserved1") == 1; // reserved
// UB[1] == 0 (reserved)
useDirectBlit = sis.readUB(1, "useDirectBlit") != 0;
@@ -52,6 +52,11 @@ public class FrameLabelTag extends Tag {
public FrameLabelTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "FrameLabel", 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 {
name = sis.readString("name");
if (sis.available() > 0) {
if (sis.readUI8("namedAnchor") == 1) {
@@ -82,6 +82,11 @@ public class ImportAssets2Tag extends Tag implements ImportTag {
*/
public ImportAssets2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "ImportAssets2", 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 {
tags = new ArrayList<>();
names = new ArrayList<>();
url = sis.readString("url");
@@ -73,6 +73,11 @@ public class ImportAssetsTag extends Tag implements ImportTag {
*/
public ImportAssetsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "ImportAssets", 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 {
tags = new ArrayList<>();
names = new ArrayList<>();
url = sis.readString("url");
@@ -44,6 +44,11 @@ public class JPEGTablesTag extends Tag {
public JPEGTablesTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "JPEGTables", 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 {
jpegData = sis.readBytesEx(sis.available(), "jpegData");
}
@@ -44,6 +44,11 @@ public class MetadataTag extends Tag {
public MetadataTag(SWFInputStream sis, ByteArrayRange data) {
super(sis.getSwf(), ID, "Metadata", 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) {
try {
xmlMetadata = sis.readString("xmlMetadata");
} catch (IOException ex) {
@@ -245,6 +245,11 @@ public class PlaceObject2Tag extends PlaceObjectTypeTag implements ASMSourceCont
*/
public PlaceObject2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "PlaceObject2", 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 {
placeFlagHasClipActions = sis.readUB(1, "placeFlagHasClipActions") == 1;
placeFlagHasClipDepth = sis.readUB(1, "placeFlagHasClipDepth") == 1;
placeFlagHasName = sis.readUB(1, "placeFlagHasName") == 1;
@@ -346,6 +346,11 @@ public class PlaceObject3Tag extends PlaceObjectTypeTag implements ASMSourceCont
*/
public PlaceObject3Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "PlaceObject3", 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 {
placeFlagHasClipActions = sis.readUB(1, "placeFlagHasClipActions") == 1;
placeFlagHasClipDepth = sis.readUB(1, "placeFlagHasClipDepth") == 1;
placeFlagHasName = sis.readUB(1, "placeFlagHasName") == 1;
@@ -348,6 +348,11 @@ public class PlaceObject4Tag extends PlaceObjectTypeTag implements ASMSourceCont
*/
public PlaceObject4Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "PlaceObject4", 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 {
placeFlagHasClipActions = sis.readUB(1, "placeFlagHasClipActions") == 1;
placeFlagHasClipDepth = sis.readUB(1, "placeFlagHasClipDepth") == 1;
placeFlagHasName = sis.readUB(1, "placeFlagHasName") == 1;
@@ -120,6 +120,11 @@ public class PlaceObjectTag extends PlaceObjectTypeTag {
*/
public PlaceObjectTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "PlaceObject", 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");
depth = sis.readUI16("depth");
matrix = sis.readMatrix("matrix");
@@ -65,6 +65,11 @@ public class ProductInfoTag extends Tag {
public ProductInfoTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "ProductInfo", 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 {
/*
* 0: Unknown
* 1: Macromedia Flex for J2EE
@@ -77,6 +77,11 @@ public class ProtectTag extends Tag {
*/
public ProtectTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "Protect", 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 {
if (sis.available() > 0) {
passwordHash = sis.readString("passwordHash");
} else {
@@ -45,6 +45,11 @@ public class RemoveObject2Tag extends Tag implements RemoveTag {
public RemoveObject2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "RemoveObject2", 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 {
depth = sis.readUI16("depth");
}
@@ -87,6 +87,11 @@ public class RemoveObjectTag extends CharacterIdTag implements RemoveTag {
*/
public RemoveObjectTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "RemoveObject", 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");
depth = sis.readUI16("depth");
}
@@ -1,18 +1,19 @@
/*
* 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. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
@@ -46,6 +47,11 @@ public class ScriptLimitsTag extends Tag {
public ScriptLimitsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "ScriptLimits", 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 {
maxRecursionDepth = sis.readUI16("maxRecursionDepth");
scriptTimeoutSeconds = sis.readUI16("scriptTimeoutSeconds");
}
@@ -40,16 +40,21 @@ public class SetBackgroundColorTag extends Tag {
backgroundColor = new RGB();
}
public SetBackgroundColorTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "SetBackgroundColor", data);
backgroundColor = sis.readRGB("backgroundColor");
}
public SetBackgroundColorTag(SWF swf, RGB backgroundColor) {
super(swf, ID, "SetBackgroundColor", null);
this.backgroundColor = backgroundColor;
}
public SetBackgroundColorTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "SetBackgroundColor", 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 {
backgroundColor = sis.readRGB("backgroundColor");
}
@Override
public byte[] getData() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -84,6 +84,11 @@ public class SetTabIndexTag extends Tag {
*/
public SetTabIndexTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "SetTabIndex", 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 {
depth = sis.readUI16("depth");
tabIndex = sis.readUI16("tabIndex");
}
@@ -1,21 +1,23 @@
/*
* 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. */
* 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.util.ArrayList;
import java.util.List;
@@ -59,11 +61,16 @@ public class ShowFrameTag extends Tag {
/**
* Constructor
*
* @param swf
* @param sis
* @param data
*/
public ShowFrameTag(SWF swf, ByteArrayRange data) {
super(swf, ID, "ShowFrame", data);
public ShowFrameTag(SWFInputStream sis, ByteArrayRange data) {
super(sis.getSwf(), ID, "ShowFrame", 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) {
}
/**
@@ -1,16 +1,16 @@
/*
* 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.
*/
@@ -56,6 +56,11 @@ public class SoundStreamBlockTag extends Tag {
*/
public SoundStreamBlockTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "SoundStreamBlock", 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 {
//all data is streamSoundData
streamSoundData = sis.readByteRangeEx(sis.available(), "streamSoundData");
}
@@ -157,6 +157,11 @@ public class SoundStreamHead2Tag extends CharacterIdTag implements SoundStreamHe
*/
public SoundStreamHead2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "SoundStreamHead2", 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 {
reserved = (int) sis.readUB(4, "reserved");
playBackSoundRate = (int) sis.readUB(2, "playBackSoundRate");
playBackSoundSize = sis.readUB(1, "playBackSoundSize") == 1;
@@ -156,6 +156,11 @@ public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHea
*/
public SoundStreamHeadTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "SoundStreamHead", 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 {
reserved = (int) sis.readUB(4, "reserved");
playBackSoundRate = (int) sis.readUB(2, "playBackSoundRate");
playBackSoundSize = sis.readUB(1, "playBackSoundSize") == 1;
@@ -77,6 +77,11 @@ public class StartSound2Tag extends Tag {
*/
public StartSound2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "StartSound2", 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 {
soundClassName = sis.readString("soundClassName");
soundInfo = sis.readSOUNDINFO("soundInfo");
}
@@ -79,6 +79,11 @@ public class StartSoundTag extends Tag {
*/
public StartSoundTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "StartSound", 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 {
soundId = sis.readUI16("soundId");
soundInfo = sis.readSOUNDINFO("soundInfo");
}
@@ -51,6 +51,11 @@ public class SymbolClassTag extends Tag {
public SymbolClassTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "SymbolClass", 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 {
int numSymbols = sis.readUI16("numSymbols");
tags = new int[numSymbols];
names = new String[numSymbols];
@@ -140,6 +140,8 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
}
}
public abstract void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException, InterruptedException;
private static final Object lockObject = new Object();
private volatile static List<Integer> knownTagIds;
@@ -457,6 +459,13 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
return SWFInputStream.resolveTag(copy, 0, false, true, false);
}
public void undo() throws InterruptedException, IOException {
byte[] data = getOriginalData();
SWFInputStream tagDataStream = new SWFInputStream(swf, data, getDataPos(), data.length);
readData(tagDataStream, getOriginalRange(), 0, false, true, false);
setModified(false);
}
/**
* Returns string representation of the object
*
@@ -1,23 +1,25 @@
/*
* 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. */
* 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;
/**
*
@@ -42,6 +44,10 @@ public class TagStub extends Tag {
dataStream = sis;
}
@Override
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
}
/**
* Gets data bytes
*
@@ -17,7 +17,9 @@
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;
/**
*
@@ -29,6 +31,10 @@ public class UnknownTag extends Tag {
super(swf, id, "Unknown", data);
}
@Override
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
}
/**
* Gets data bytes
*
@@ -82,6 +82,11 @@ public class VideoFrameTag extends Tag {
*/
public VideoFrameTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "VideoFrame", 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 {
streamID = sis.readUI16("streamID");
frameNum = sis.readUI16("frameNum");
videoData = sis.readByteRangeEx(sis.available(), "videoData"); //TODO: Parse video packets
@@ -1,18 +1,19 @@
/*
* 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. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags.base;
import com.jpexs.decompiler.flash.SWF;
@@ -108,7 +108,11 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag {
*/
public DefineCompactedFont(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineCompactedFont", 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 {
fontId = sis.readUI16("fontId");
fonts = new ArrayList<>();
@@ -79,6 +79,11 @@ public class DefineExternalGradient extends Tag {
*/
public DefineExternalGradient(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineExternalGradient", 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 {
gradientId = sis.readUI16("gradientId");
bitmapsFormat = sis.readUI16("bitmapsFormat");
gradientSize = sis.readUI16("gradientSize");
@@ -82,6 +82,11 @@ public class DefineExternalImage extends Tag {
*/
public DefineExternalImage(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineExternalImage", 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");
bitmapFormat = sis.readUI16("bitmapFormat");
targetWidth = sis.readUI16("targetWidth");
@@ -92,6 +92,11 @@ public class DefineExternalImage2 extends Tag {
*/
public DefineExternalImage2(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineExternalImage2", 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.readUI32("characterId");
bitmapFormat = sis.readUI16("bitmapFormat");
targetWidth = sis.readUI16("targetWidth");
@@ -92,6 +92,11 @@ public class DefineExternalSound extends Tag {
*/
public DefineExternalSound(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineExternalSound", 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");
soundFormat = sis.readUI16("soundFormat");
bits = sis.readUI16("bits");
@@ -90,6 +90,11 @@ public class DefineExternalStreamSound extends Tag {
*/
public DefineExternalStreamSound(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineExternalStreamSound", 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 {
soundFormat = sis.readUI16("soundFormat");
bits = sis.readUI16("bits");
channels = sis.readUI16("channels");
@@ -65,6 +65,11 @@ public class DefineGradientMap extends Tag {
*/
public DefineGradientMap(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineGradientMap", 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 {
int numGradients = sis.readUI16("numGradients");
indices = new int[numGradients];
for (int i = 0; i < numGradients; i++) {
@@ -77,6 +77,11 @@ public class DefineSubImage extends Tag {
*/
public DefineSubImage(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineSubImage", 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");
imageCharacterId = sis.readUI16("imageCharacterId");
x1 = sis.readUI16("x1");
@@ -101,6 +101,11 @@ public class ExporterInfo extends Tag {
*/
public ExporterInfo(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "ExporterInfo", 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.version = sis.readUI16("version");
if (this.version >= 0x10a) {
flags = sis.readUI32("flags");
@@ -105,6 +105,11 @@ public class FontTextureInfo extends Tag {
*/
public FontTextureInfo(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "FontTextureInfo", 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 {
textureID = sis.readUI32("textureID");
textureFormat = sis.readUI16("textureFormat");
int fileNameLen = sis.readUI8("fileNameLen");