From ca52f637690b7cf3b0cc54e183bd36be6ca67562 Mon Sep 17 00:00:00 2001 From: Honfika Date: Sat, 5 Apr 2014 16:10:43 +0200 Subject: [PATCH] preserver original tag header and endtag, organize imports, missing javadoc params --- trunk/src/com/jpexs/decompiler/flash/SWF.java | 15 +- .../decompiler/flash/SWFInputStream.java | 179 +++++++++--------- .../decompiler/flash/SWFOutputStream.java | 35 +--- .../abc/avm2/model/operations/GeAVM2Item.java | 1 - .../abc/avm2/model/operations/GtAVM2Item.java | 1 - .../abc/avm2/model/operations/LeAVM2Item.java | 1 - .../abc/avm2/model/operations/LtAVM2Item.java | 1 - .../model/operations/StrictEqAVM2Item.java | 1 - .../model/operations/StrictNeqAVM2Item.java | 1 - .../parser/script/AVM2SourceGenerator.java | 8 +- .../avm2/parser/script/ActionScriptLexer.java | 9 +- .../parser/script/ActionScriptParser.java | 27 ++- .../abc/avm2/parser/script/CallAVM2Item.java | 4 +- .../abc/avm2/parser/script/NameAVM2Item.java | 3 - .../avm2/parser/script/PropertyAVM2Item.java | 4 +- .../abc/avm2/parser/script/Reference.java | 1 + .../parser/script/ActionScriptLexer.java | 2 +- .../decompiler/flash/ecma/EcmaScript.java | 6 +- .../flash/exporters/ShapeExporterBase.java | 8 +- .../flash/gui/FontPreviewDialog.java | 2 +- .../decompiler/flash/gui/GenericTagPanel.java | 10 +- .../flash/gui/GenericTagTreePanel.java | 12 +- .../com/jpexs/decompiler/flash/gui/Main.java | 2 +- .../flash/gui/MainFrameRibbonMenu.java | 2 +- .../jpexs/decompiler/flash/gui/MainPanel.java | 2 +- .../decompiler/flash/gui/PreviewPanel.java | 70 +++---- .../flash/tags/CSMTextSettingsTag.java | 5 +- .../decompiler/flash/tags/DebugIDTag.java | 5 +- .../flash/tags/DefineBinaryDataTag.java | 4 +- .../flash/tags/DefineBitsJPEG2Tag.java | 8 +- .../flash/tags/DefineBitsJPEG3Tag.java | 4 +- .../flash/tags/DefineBitsJPEG4Tag.java | 5 +- .../flash/tags/DefineBitsLossless2Tag.java | 4 +- .../flash/tags/DefineBitsLosslessTag.java | 4 +- .../decompiler/flash/tags/DefineBitsTag.java | 4 +- .../flash/tags/DefineButton2Tag.java | 5 +- .../flash/tags/DefineButtonCxformTag.java | 5 +- .../flash/tags/DefineButtonSoundTag.java | 5 +- .../flash/tags/DefineButtonTag.java | 5 +- .../flash/tags/DefineEditTextTag.java | 5 +- .../decompiler/flash/tags/DefineFont2Tag.java | 7 +- .../decompiler/flash/tags/DefineFont3Tag.java | 4 +- .../decompiler/flash/tags/DefineFont4Tag.java | 4 +- .../flash/tags/DefineFontAlignZonesTag.java | 4 +- .../flash/tags/DefineFontInfo2Tag.java | 5 +- .../flash/tags/DefineFontInfoTag.java | 5 +- .../flash/tags/DefineFontNameTag.java | 4 +- .../decompiler/flash/tags/DefineFontTag.java | 5 +- .../flash/tags/DefineMorphShape2Tag.java | 5 +- .../flash/tags/DefineMorphShapeTag.java | 5 +- .../flash/tags/DefineScalingGridTag.java | 4 +- .../tags/DefineSceneAndFrameLabelDataTag.java | 5 +- .../flash/tags/DefineShape2Tag.java | 4 +- .../flash/tags/DefineShape3Tag.java | 4 +- .../flash/tags/DefineShape4Tag.java | 4 +- .../decompiler/flash/tags/DefineShapeTag.java | 4 +- .../decompiler/flash/tags/DefineSoundTag.java | 5 +- .../flash/tags/DefineSpriteTag.java | 17 +- .../decompiler/flash/tags/DefineText2Tag.java | 5 +- .../decompiler/flash/tags/DefineTextTag.java | 7 +- .../flash/tags/DefineVideoStreamTag.java | 5 +- .../decompiler/flash/tags/DoABCDefineTag.java | 5 +- .../jpexs/decompiler/flash/tags/DoABCTag.java | 5 +- .../decompiler/flash/tags/DoActionTag.java | 8 +- .../flash/tags/DoInitActionTag.java | 7 +- .../flash/tags/EnableDebugger2Tag.java | 5 +- .../flash/tags/EnableDebuggerTag.java | 5 +- .../flash/tags/EnableTelemetryTag.java | 5 +- .../jpexs/decompiler/flash/tags/EndTag.java | 7 +- .../flash/tags/ExportAssetsTag.java | 7 +- .../flash/tags/FileAttributesTag.java | 6 +- .../decompiler/flash/tags/FrameLabelTag.java | 4 +- .../flash/tags/ImportAssets2Tag.java | 5 +- .../flash/tags/ImportAssetsTag.java | 5 +- .../decompiler/flash/tags/JPEGTablesTag.java | 5 +- .../decompiler/flash/tags/MetadataTag.java | 4 +- .../flash/tags/PlaceObject2Tag.java | 7 +- .../flash/tags/PlaceObject3Tag.java | 5 +- .../flash/tags/PlaceObject4Tag.java | 5 +- .../decompiler/flash/tags/PlaceObjectTag.java | 7 +- .../decompiler/flash/tags/ProductInfoTag.java | 4 +- .../decompiler/flash/tags/ProtectTag.java | 5 +- .../flash/tags/RemoveObject2Tag.java | 4 +- .../flash/tags/RemoveObjectTag.java | 5 +- .../flash/tags/ScriptLimitsTag.java | 4 +- .../flash/tags/SetBackgroundColorTag.java | 6 +- .../decompiler/flash/tags/SetTabIndexTag.java | 5 +- .../decompiler/flash/tags/ShowFrameTag.java | 8 +- .../flash/tags/SoundStreamBlockTag.java | 6 +- .../flash/tags/SoundStreamHead2Tag.java | 5 +- .../flash/tags/SoundStreamHeadTag.java | 5 +- .../decompiler/flash/tags/StartSound2Tag.java | 5 +- .../decompiler/flash/tags/StartSoundTag.java | 5 +- .../decompiler/flash/tags/SymbolClassTag.java | 4 +- .../com/jpexs/decompiler/flash/tags/Tag.java | 79 +++++++- .../jpexs/decompiler/flash/tags/TagStub.java | 5 +- .../decompiler/flash/tags/UnknownTag.java | 4 +- .../decompiler/flash/tags/VideoFrameTag.java | 5 +- .../decompiler/flash/tags/base/ButtonTag.java | 4 +- .../flash/tags/base/CharacterIdTag.java | 6 +- .../flash/tags/base/CharacterTag.java | 4 +- .../decompiler/flash/tags/base/FontTag.java | 4 +- .../decompiler/flash/tags/base/ImageTag.java | 4 +- .../decompiler/flash/tags/base/ShapeTag.java | 4 +- .../decompiler/flash/tags/base/TextTag.java | 4 +- .../flash/tags/gfx/DefineCompactedFont.java | 5 +- .../tags/gfx/DefineExternalGradient.java | 5 +- .../flash/tags/gfx/DefineExternalImage.java | 5 +- .../flash/tags/gfx/DefineExternalImage2.java | 5 +- .../flash/tags/gfx/DefineExternalSound.java | 5 +- .../tags/gfx/DefineExternalStreamSound.java | 5 +- .../flash/tags/gfx/DefineGradientMap.java | 5 +- .../flash/tags/gfx/DefineSubImage.java | 5 +- .../flash/tags/gfx/ExporterInfoTag.java | 5 +- .../flash/tags/gfx/FontTextureInfo.java | 5 +- .../decompiler/flash/tags/text/TextLexer.java | 2 +- .../parser/ConditionEvaluator.java | 2 +- .../com/jpexs/decompiler/graph/TypeItem.java | 4 +- 118 files changed, 523 insertions(+), 423 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index d40f1a402..042d030b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -79,6 +79,7 @@ import com.jpexs.decompiler.flash.tags.DefineSoundTag; import com.jpexs.decompiler.flash.tags.DefineSpriteTag; import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag; import com.jpexs.decompiler.flash.tags.DoInitActionTag; +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.JPEGTablesTag; @@ -204,6 +205,7 @@ public final class SWF implements TreeItem, Timelined { * Tags inside of file */ public List tags = new ArrayList<>(); + public boolean hasEndTag; /** * ExportRectangle for the display */ @@ -282,7 +284,7 @@ public final class SWF implements TreeItem, Timelined { Tag t = tags.get(i); if (t instanceof DefineSpriteTag) { if (!isSpriteValid((DefineSpriteTag) t, new ArrayList())) { - tags.set(i, new Tag(this, t.getId(), "InvalidSprite", t.getData(), t.getPos())); + tags.set(i, new Tag(this, t.getId(), "InvalidSprite", t.getOriginalHeaderData(), t.getOriginalData(), t.getPos())); } } } @@ -349,7 +351,9 @@ public final class SWF implements TreeItem, Timelined { sos.writeUI16(frameCount); sos.writeTags(tags); - sos.writeUI16(0); + if (hasEndTag) { + sos.writeUI16(0); + } sos.close(); if (compressed && lzma) { os.write('Z'); @@ -578,7 +582,12 @@ public final class SWF implements TreeItem, Timelined { sis.readUI8(); //tmpFirstByetOfFrameRate frameRate = sis.readUI8(); frameCount = sis.readUI16(); - tags = sis.readTagList(this, this, 0, parallelRead, true, !checkOnly, gfx); + List tags = sis.readTagList(this, this, 0, parallelRead, true, !checkOnly, gfx); + if (tags.get(tags.size() - 1).getId() == EndTag.ID) { + hasEndTag = true; + tags.remove(tags.size() - 1); + } + this.tags = tags; if (!checkOnly) { checkInvalidSprites(); updateInnerTagsForShowFrameTags(); diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index d158243ae..52a6861bf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -908,6 +908,7 @@ public class SWFInputStream extends InputStream { case SoundStreamHead2Tag.ID: case SoundStreamBlockTag.ID: case VideoFrameTag.ID: + case EndTag.ID: doParse = true; break; default: @@ -930,6 +931,10 @@ public class SWFInputStream extends InputStream { futureResults.add(future); } } + + if (tag.getId() == EndTag.ID) { + break; + } } if (parallel) { @@ -952,131 +957,132 @@ public class SWFInputStream extends InputStream { Tag ret; byte[] data = tag.getData(); + byte[] headerData = tag.getOriginalHeaderData(); long pos = tag.getPos(); try { switch (tag.getId()) { case 0: - ret = new EndTag(swf, data, pos); + ret = new EndTag(swf, headerData, data, pos); break; case 1: - ret = new ShowFrameTag(swf, pos); + ret = new ShowFrameTag(swf, headerData, data, pos); break; case 2: - ret = new DefineShapeTag(swf, data, pos); + ret = new DefineShapeTag(swf, headerData, data, pos); break; //case 3: FreeCharacter case 4: - ret = new PlaceObjectTag(swf, data, pos); + ret = new PlaceObjectTag(swf, headerData, data, pos); break; case 5: - ret = new RemoveObjectTag(swf, data, pos); + ret = new RemoveObjectTag(swf, headerData, data, pos); break; case 6: - ret = new DefineBitsTag(swf, data, pos); + ret = new DefineBitsTag(swf, headerData, data, pos); break; case 7: - ret = new DefineButtonTag(swf, data, pos); + ret = new DefineButtonTag(swf, headerData, data, pos); break; case 8: - ret = new JPEGTablesTag(swf, data, pos); + ret = new JPEGTablesTag(swf, headerData, data, pos); break; case 9: - ret = new SetBackgroundColorTag(swf, data, pos); + ret = new SetBackgroundColorTag(swf, headerData, data, pos); break; case 10: - ret = new DefineFontTag(swf, data, pos); + ret = new DefineFontTag(swf, headerData, data, pos); break; case 11: - ret = new DefineTextTag(swf, data, pos); + ret = new DefineTextTag(swf, headerData, data, pos); break; case 12: - ret = new DoActionTag(swf, data, pos); + ret = new DoActionTag(swf, headerData, data, pos); break; case 13: - ret = new DefineFontInfoTag(swf, data, pos); + ret = new DefineFontInfoTag(swf, headerData, data, pos); break; case 14: - ret = new DefineSoundTag(swf, data, pos); + ret = new DefineSoundTag(swf, headerData, data, pos); break; case 15: - ret = new StartSoundTag(swf, data, pos); + ret = new StartSoundTag(swf, headerData, data, pos); break; //case 16: case 17: - ret = new DefineButtonSoundTag(swf, data, pos); + ret = new DefineButtonSoundTag(swf, headerData, data, pos); break; case 18: - ret = new SoundStreamHeadTag(swf, data, pos); + ret = new SoundStreamHeadTag(swf, headerData, data, pos); break; case 19: - ret = new SoundStreamBlockTag(swf, data, pos); + ret = new SoundStreamBlockTag(swf, headerData, data, pos); break; case 21: - ret = new DefineBitsJPEG2Tag(swf, data, pos); + ret = new DefineBitsJPEG2Tag(swf, headerData, data, pos); break; case 20: - ret = new DefineBitsLosslessTag(swf, data, pos); + ret = new DefineBitsLosslessTag(swf, headerData, data, pos); break; case 22: - ret = new DefineShape2Tag(swf, data, pos); + ret = new DefineShape2Tag(swf, headerData, data, pos); break; case 23: - ret = new DefineButtonCxformTag(swf, data, pos); + ret = new DefineButtonCxformTag(swf, headerData, data, pos); break; case 24: - ret = new ProtectTag(swf, data, pos); + ret = new ProtectTag(swf, headerData, data, pos); break; //case 25: PathsArePostscript case 26: - ret = new PlaceObject2Tag(swf, data, pos); + ret = new PlaceObject2Tag(swf, headerData, data, pos); break; //case 27: case 28: - ret = new RemoveObject2Tag(swf, data, pos); + ret = new RemoveObject2Tag(swf, headerData, data, pos); break; //case 29: SyncFrame //case 30: //case 31: FreeAll case 32: - ret = new DefineShape3Tag(swf, data, pos); + ret = new DefineShape3Tag(swf, headerData, data, pos); break; case 33: - ret = new DefineText2Tag(swf, data, pos); + ret = new DefineText2Tag(swf, headerData, data, pos); break; case 34: - ret = new DefineButton2Tag(swf, data, pos); + ret = new DefineButton2Tag(swf, headerData, data, pos); break; case 35: - ret = new DefineBitsJPEG3Tag(swf, data, pos); + ret = new DefineBitsJPEG3Tag(swf, headerData, data, pos); break; case 36: - ret = new DefineBitsLossless2Tag(swf, data, pos); + ret = new DefineBitsLossless2Tag(swf, headerData, data, pos); break; case 37: - ret = new DefineEditTextTag(swf, data, pos); + ret = new DefineEditTextTag(swf, headerData, data, pos); break; //case 38: DefineVideo case 39: - ret = new DefineSpriteTag(swf, data, level, pos, parallel, skipUnusualTags); + ret = new DefineSpriteTag(swf, headerData, data, level, pos, parallel, skipUnusualTags); break; //case 40: NameCharacter case 41: - ret = new ProductInfoTag(swf, data, pos); + ret = new ProductInfoTag(swf, headerData, data, pos); break; //case 42: DefineTextFormat case 43: - ret = new FrameLabelTag(swf, data, pos); + ret = new FrameLabelTag(swf, headerData, data, pos); break; //case 44: case 45: - ret = new SoundStreamHead2Tag(swf, data, pos); + ret = new SoundStreamHead2Tag(swf, headerData, data, pos); break; case 46: - ret = new DefineMorphShapeTag(swf, data, pos); + ret = new DefineMorphShapeTag(swf, headerData, data, pos); break; //case 47: GenerateFrame case 48: - ret = new DefineFont2Tag(swf, data, pos); + ret = new DefineFont2Tag(swf, headerData, data, pos); break; //case 49: GeneratorCommand //case 50: DefineCommandObject @@ -1084,148 +1090,148 @@ public class SWFInputStream extends InputStream { //case 52: ExternalFont //case 53-55 case 56: - ret = new ExportAssetsTag(swf, data, pos); + ret = new ExportAssetsTag(swf, headerData, data, pos); break; case 57: - ret = new ImportAssetsTag(swf, data, pos); + ret = new ImportAssetsTag(swf, headerData, data, pos); break; case 58: - ret = new EnableDebuggerTag(swf, data, pos); + ret = new EnableDebuggerTag(swf, headerData, data, pos); break; case 59: - ret = new DoInitActionTag(swf, data, pos); + ret = new DoInitActionTag(swf, headerData, data, pos); break; case 60: - ret = new DefineVideoStreamTag(swf, data, pos); + ret = new DefineVideoStreamTag(swf, headerData, data, pos); break; case 61: - ret = new VideoFrameTag(swf, data, pos); + ret = new VideoFrameTag(swf, headerData, data, pos); break; case 62: - ret = new DefineFontInfo2Tag(swf, data, pos); + ret = new DefineFontInfo2Tag(swf, headerData, data, pos); break; case 63: - ret = new DebugIDTag(swf, data, pos); + ret = new DebugIDTag(swf, headerData, data, pos); break; case 64: - ret = new EnableDebugger2Tag(swf, data, pos); + ret = new EnableDebugger2Tag(swf, headerData, data, pos); break; case 65: - ret = new ScriptLimitsTag(swf, data, pos); + ret = new ScriptLimitsTag(swf, headerData, data, pos); break; case 66: - ret = new SetTabIndexTag(swf, data, pos); + ret = new SetTabIndexTag(swf, headerData, data, pos); break; //case 67-68: case 69: - ret = new FileAttributesTag(swf, data, pos); + ret = new FileAttributesTag(swf, headerData, data, pos); break; case 70: - ret = new PlaceObject3Tag(swf, data, pos); + ret = new PlaceObject3Tag(swf, headerData, data, pos); break; case 71: - ret = new ImportAssets2Tag(swf, data, pos); + ret = new ImportAssets2Tag(swf, headerData, data, pos); break; case 72: - ret = new DoABCTag(swf, data, pos); + ret = new DoABCTag(swf, headerData, data, pos); break; case 73: - ret = new DefineFontAlignZonesTag(swf, data, pos); + ret = new DefineFontAlignZonesTag(swf, headerData, data, pos); break; case 74: - ret = new CSMTextSettingsTag(swf, data, pos); + ret = new CSMTextSettingsTag(swf, headerData, data, pos); break; case 75: - ret = new DefineFont3Tag(swf, data, pos); + ret = new DefineFont3Tag(swf, headerData, data, pos); break; case 76: - ret = new SymbolClassTag(swf, data, pos); + ret = new SymbolClassTag(swf, headerData, data, pos); break; case 77: - ret = new MetadataTag(swf, data, pos); + ret = new MetadataTag(swf, headerData, data, pos); break; case 78: - ret = new DefineScalingGridTag(swf, data, pos); + ret = new DefineScalingGridTag(swf, headerData, data, pos); break; //case 79-81: case 82: - ret = new DoABCDefineTag(swf, data, pos); + ret = new DoABCDefineTag(swf, headerData, data, pos); break; case 83: - ret = new DefineShape4Tag(swf, data, pos); + ret = new DefineShape4Tag(swf, headerData, data, pos); break; case 84: - ret = new DefineMorphShape2Tag(swf, data, pos); + ret = new DefineMorphShape2Tag(swf, headerData, data, pos); break; //case 85: case 86: - ret = new DefineSceneAndFrameLabelDataTag(swf, data, pos); + ret = new DefineSceneAndFrameLabelDataTag(swf, headerData, data, pos); break; case 87: - ret = new DefineBinaryDataTag(swf, data, pos); + ret = new DefineBinaryDataTag(swf, headerData, data, pos); break; case 88: - ret = new DefineFontNameTag(swf, data, pos); + ret = new DefineFontNameTag(swf, headerData, data, pos); break; case 89: - ret = new StartSound2Tag(swf, data, pos); + ret = new StartSound2Tag(swf, headerData, data, pos); break; case 90: - ret = new DefineBitsJPEG4Tag(swf, data, pos); + ret = new DefineBitsJPEG4Tag(swf, headerData, data, pos); break; case 91: - ret = new DefineFont4Tag(swf, data, pos); + ret = new DefineFont4Tag(swf, headerData, data, pos); break; //case 92: certificate case 93: - ret = new EnableTelemetryTag(swf, data, pos); + ret = new EnableTelemetryTag(swf, headerData, data, pos); break; case 94: - ret = new PlaceObject4Tag(swf, data, pos); + ret = new PlaceObject4Tag(swf, headerData, data, pos); break; default: if (gfx) { //GFX tags only in GFX files. There may be incorrect GFX tags in non GFX files switch (tag.getId()) { case 1000: - ret = new ExporterInfoTag(swf, data, pos); + ret = new ExporterInfoTag(swf, headerData, data, pos); break; case 1001: - ret = new DefineExternalImage(swf, data, pos); + ret = new DefineExternalImage(swf, headerData, data, pos); break; case 1002: - ret = new FontTextureInfo(swf, data, pos); + ret = new FontTextureInfo(swf, headerData, data, pos); break; case 1003: - ret = new DefineExternalGradient(swf, data, pos); + ret = new DefineExternalGradient(swf, headerData, data, pos); break; case 1004: - ret = new DefineGradientMap(swf, data, pos); + ret = new DefineGradientMap(swf, headerData, data, pos); break; case 1005: - ret = new DefineCompactedFont(swf, data, pos); + ret = new DefineCompactedFont(swf, headerData, data, pos); break; case 1006: - ret = new DefineExternalSound(swf, data, pos); + ret = new DefineExternalSound(swf, headerData, data, pos); break; case 1007: - ret = new DefineExternalStreamSound(swf, data, pos); + ret = new DefineExternalStreamSound(swf, headerData, data, pos); break; case 1008: - ret = new DefineSubImage(swf, data, pos); + ret = new DefineSubImage(swf, headerData, data, pos); break; case 1009: - ret = new DefineExternalImage2(swf, data, pos); + ret = new DefineExternalImage2(swf, headerData, data, pos); break; default: - ret = new UnknownTag(swf, tag.getId(), data, pos); + ret = new UnknownTag(swf, tag.getId(), headerData, data, pos); } } else { - ret = new UnknownTag(swf, tag.getId(), data, pos); + ret = new UnknownTag(swf, tag.getId(), headerData, data, pos); } } } catch (IOException ex) { Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE, "Error during tag reading", ex); - ret = new Tag(swf, tag.getId(), "ErrorTag", data, pos); + ret = new Tag(swf, tag.getId(), "ErrorTag", headerData, data, pos); } ret.previousTag = tag.previousTag; ret.forceWriteAsLong = tag.forceWriteAsLong; @@ -1251,9 +1257,6 @@ public class SWFInputStream extends InputStream { public Tag readTag(SWF swf, int level, long pos, boolean resolve, boolean parallel, boolean skipUnusualTags, boolean gfx) throws IOException, InterruptedException { int tagIDTagLength = readUI16(); int tagID = (tagIDTagLength) >> 6; - if (tagID == 0) { - return null; - } logger.log(Level.INFO, "Reading tag. ID={0}, position: {1}", new Object[]{tagID, pos}); @@ -1264,7 +1267,7 @@ public class SWFInputStream extends InputStream { readLong = true; } byte[] data = readBytes((int) tagLength); - Tag ret = new Tag(swf, tagID, "Unresolved", data, pos); + Tag ret = new Tag(swf, tagID, "Unresolved", Tag.getTagHeader(tagIDTagLength, tagLength, readLong, swf.version), data, pos); ret.forceWriteAsLong = readLong; if (resolve) { @@ -1675,6 +1678,7 @@ public class SWFInputStream extends InputStream { * Reads one CLIPACTIONRECORD value from the stream * * @param swf + * @param tag * @return CLIPACTIONRECORD value * @throws IOException */ @@ -1691,6 +1695,7 @@ public class SWFInputStream extends InputStream { * Reads one CLIPACTIONS value from the stream * * @param swf + * @param tag * @return CLIPACTIONS value * @throws IOException */ @@ -2032,6 +2037,7 @@ public class SWFInputStream extends InputStream { * Reads list of BUTTONCONDACTION values from the stream * * @param swf + * @param tag * @return List of BUTTONCONDACTION values * @throws IOException */ @@ -2049,6 +2055,7 @@ public class SWFInputStream extends InputStream { * Reads one BUTTONCONDACTION value from the stream * * @param swf + * @param tag * @return BUTTONCONDACTION value * @throws IOException */ diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java index 5cdde2c22..df9407588 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java @@ -418,7 +418,7 @@ public class SWFOutputStream extends OutputStream { public void writeTags(List tags) throws IOException { for (Tag tag : tags) { //try { - writeTag(tag); + tag.writeTag(this); /*} catch (NotSameException nse) { throw new RuntimeException("error in tag "+tag+" at pos "+Helper.formatHex((int)tag.getPos(), 8), nse); }*/ @@ -426,39 +426,6 @@ public class SWFOutputStream extends OutputStream { } } - public static byte[] getTagHeader(Tag tag, byte[] data, int version) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try { - - SWFOutputStream sos = new SWFOutputStream(baos, version); - int tagLength = data.length; - int tagID = tag.getId(); - int tagIDLength = (tagID << 6); - if ((tagLength <= 62) && (!tag.forceWriteAsLong)) { - tagIDLength += tagLength; - sos.writeUI16(tagIDLength); - } else { - tagIDLength += 0x3f; - sos.writeUI16(tagIDLength); - sos.writeSI32(tagLength); - } - } catch (IOException iex) { - } - return baos.toByteArray(); - } - - /** - * Writes Tag value to the stream - * - * @param tag Tag value - * @throws IOException - */ - public void writeTag(Tag tag) throws IOException { - byte[] data = tag.getDataOrOriginalData(); - write(getTagHeader(tag, data, version)); - write(data); - } - /** * Calculates number of bits needed for representing unsigned value * diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java index cd2d77002..24bc6b317 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.GreaterEqualsIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfEqIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfGeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNGeIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java index ea6ea1901..25b0bd6be 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.GreaterThanIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfEqIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfGtIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNGtIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java index 7fd8f693a..c90ce7ba0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.LessEqualsIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfEqIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfLeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNLeIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java index 8ebbbe11e..cfefe83c3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.LessThanIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfEqIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfLtIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNLtIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java index cc884b423..8b17b589d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.StrictEqualsIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictEqIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictNeIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java index 783a7a6ae..846cc9e2d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java @@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.NotIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.StrictEqualsIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictEqIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictNeIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index 637858059..8c9e31c03 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -22,11 +22,9 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.NotIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.EqualsIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.StrictEqualsIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.ConstructSuperIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewClassIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfEqIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfFalseIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfTrueIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns; @@ -611,7 +609,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } public void generateClass(int namespace, int initScope, PackageAVM2Item pkg, ClassInfo classInfo, InstanceInfo instanceInfo, SourceGeneratorLocalData localData, boolean isInterface, String name, String superName, GraphTargetItem extendsVal, List implementsStr, GraphTargetItem constructor, List traitItems) throws ParseException { - localData.currentClass = pkg.packageName.equals("") ? name : pkg.packageName + "." + name; + localData.currentClass = pkg.packageName.isEmpty() ? name : pkg.packageName + "." + name; List ret = new ArrayList<>(); if (extendsVal == null && !isInterface) { extendsVal = new TypeItem("Object"); @@ -720,8 +718,8 @@ public class AVM2SourceGenerator implements SourceGenerator { String name = type.toString(); TypeItem nameItem = (TypeItem) type; if (name.contains(".")) { - pkg = name.substring(0, name.lastIndexOf(".")); - name = name.substring(name.lastIndexOf(".") + 1); + pkg = name.substring(0, name.lastIndexOf('.')); + name = name.substring(name.lastIndexOf('.') + 1); } /*int nsKind = Namespace.KIND_PACKAGE; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptLexer.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptLexer.java index 783e1fc96..b008c38ed 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptLexer.java @@ -853,7 +853,7 @@ public final class ActionScriptLexer { return yychar; } - private Stack pushedBack = new Stack(); + private Stack pushedBack = new Stack<>(); public int yyline() { return yyline + 1; @@ -995,6 +995,7 @@ public final class ActionScriptLexer { /** * Closes the input stream. + * @throws java.io.IOException */ public final void yyclose() throws java.io.IOException { zzAtEOF = true; /* indicate end of file */ @@ -1035,6 +1036,7 @@ public final class ActionScriptLexer { /** * Returns the current lexical state. + * @return */ public final int yystate() { return zzLexicalState; @@ -1051,6 +1053,7 @@ public final class ActionScriptLexer { /** * Returns the text matched by the current regular expression. + * @return */ public final String yytext() { return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead); @@ -1072,6 +1075,7 @@ public final class ActionScriptLexer { /** * Returns the length of the matched text region. + * @return */ public final int yylength() { return zzMarkedPos - zzStartRead; @@ -1123,6 +1127,7 @@ public final class ActionScriptLexer { * * @return the next token * @exception java.io.IOException if any I/O-Error occurs + * @throws com.jpexs.decompiler.flash.abc.avm2.parser.ParseException */ public ParsedSymbol yylex() throws java.io.IOException, ParseException { int zzInput; @@ -1587,7 +1592,7 @@ public final class ActionScriptLexer { String s = yytext(); s = s.substring(1, s.length() - 1); if (s.contains(" ")) { - s = s.substring(0, s.indexOf(" ")); + s = s.substring(0, s.indexOf(' ')); } xmlTagName = s; string.append(yytext()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java index a0afd6517..cb039c7d8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java @@ -75,7 +75,6 @@ import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.Namespace; import com.jpexs.decompiler.flash.action.swf4.ActionIf; import com.jpexs.decompiler.flash.configuration.Configuration; -import com.jpexs.decompiler.flash.gui.Main; import com.jpexs.decompiler.flash.tags.ABCContainerTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -284,8 +283,8 @@ public class ActionScriptParser { String iname = importedClasses.get(i); String ipkg = ""; if (iname.contains(".")) { - ipkg = iname.substring(0, iname.lastIndexOf(".")); - iname = iname.substring(iname.lastIndexOf(".") + 1); + ipkg = iname.substring(0, iname.lastIndexOf('.')); + iname = iname.substring(iname.lastIndexOf('.') + 1); } if (iname.equals(parts.get(0))) { k = 0; @@ -305,7 +304,7 @@ public class ActionScriptParser { } name = parts.get(k); - String fname = pkg.equals("") ? name : pkg + "." + name; + String fname = pkg.isEmpty() ? name : pkg + "." + name; for (ABC a : allAbcs) { int c = a.findClassByName(fname); @@ -321,7 +320,7 @@ public class ActionScriptParser { String nsname = ns.getName(abc.constants); if (nsKind == Namespace.KIND_PACKAGE) { for (ABC a : allAbcs) { - int c = a.findClassByName(nsname.equals("") ? fname : nsname + "." + fname); + int c = a.findClassByName(nsname.isEmpty() ? fname : nsname + "." + fname); if (c != -1) { pkg = nsname; break loopk; @@ -693,7 +692,7 @@ public class ActionScriptParser { nval = s.value.toString(); s = lex(); } else { - nval = (packageName.equals("") ? classNameStr : packageName + ":" + classNameStr) + "/" + nname; + nval = (packageName.isEmpty() ? classNameStr : packageName + ":" + classNameStr) + "/" + nname; } if (s.type != SymbolType.SEMICOLON) { lexer.pushback(s); @@ -768,15 +767,15 @@ public class ActionScriptParser { int publicNs = namespace; int protectedStaticNs = 0; - openedNamespaces.add(protectedNs = abc.constants.addNamespace(new Namespace(Namespace.KIND_PROTECTED, abc.constants.getStringId(packageName.equals("") ? classNameStr : packageName + ":" + classNameStr, true)))); - openedNamespaces.add(protectedStaticNs = abc.constants.addNamespace(new Namespace(Namespace.KIND_STATIC_PROTECTED, abc.constants.getStringId(packageName.equals("") ? classNameStr : packageName + ":" + classNameStr, true)))); + openedNamespaces.add(protectedNs = abc.constants.addNamespace(new Namespace(Namespace.KIND_PROTECTED, abc.constants.getStringId(packageName.isEmpty() ? classNameStr : packageName + ":" + classNameStr, true)))); + openedNamespaces.add(protectedStaticNs = abc.constants.addNamespace(new Namespace(Namespace.KIND_STATIC_PROTECTED, abc.constants.getStringId(packageName.isEmpty() ? classNameStr : packageName + ":" + classNameStr, true)))); List indices = new ArrayList<>(); List names = new ArrayList<>(); List namespaces = new ArrayList<>(); AVM2SourceGenerator.parentNamesAddNames(abc, otherABCs, ((TypeItem) extendsStr).resolveClass(abc), indices, names, namespaces); for (int i = 0; i < names.size(); i++) { - if (namespaces.get(i).equals("")) { + if (namespaces.get(i).isEmpty()) { continue; } openedNamespaces.add(abc.constants.getNamespaceId(new Namespace(Namespace.KIND_STATIC_PROTECTED, abc.constants.getStringId(namespaces.get(i) + ":" + names.get(i), true)), 0, true)); @@ -1589,10 +1588,10 @@ public class ActionScriptParser { lexer.pushback(s); GraphTargetItem num = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); if (num instanceof IntegerValueAVM2Item) { - ((IntegerValueAVM2Item) num).value = -(Long) ((IntegerValueAVM2Item) num).value; + ((IntegerValueAVM2Item) num).value = -((IntegerValueAVM2Item) num).value; ret = num; } else if (num instanceof FloatValueAVM2Item) { - Double d = (Double) ((FloatValueAVM2Item) num).value; + Double d = ((FloatValueAVM2Item) num).value; if (d.isInfinite()) { ((FloatValueAVM2Item) num).value = Double.NEGATIVE_INFINITY; } else { @@ -1782,10 +1781,10 @@ public class ActionScriptParser { int privateNs = 0; int publicNs = 0; if (fileName.contains("/")) { - fileName = fileName.substring(fileName.lastIndexOf("/") + 1); + fileName = fileName.substring(fileName.lastIndexOf('/') + 1); } if (fileName.contains("\\")) { - fileName = fileName.substring(fileName.lastIndexOf("\\") + 1); + fileName = fileName.substring(fileName.lastIndexOf('\\') + 1); } String className = fileName; if (className.endsWith(".as")) { @@ -1797,7 +1796,7 @@ public class ActionScriptParser { openedNamespaces.add(publicNs = abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId("", true)), 0, true)); openedNamespaces.add(abc.constants.addNamespace(new Namespace(Namespace.KIND_PRIVATE, 0))); //abc.constants.getStringId(fileName + "$", true) - if (!name.equals("")) { + if (!name.isEmpty()) { openedNamespaces.add(publicNs = abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(name, true)), 0, true)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java index 955922d71..47951c822 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java @@ -68,8 +68,8 @@ public class CallAVM2Item extends AVM2Item { String pkgName = ""; cname = localData.currentClass; if (cname.contains(".")) { - pkgName = cname.substring(0, cname.lastIndexOf(".")); - cname = cname.substring(cname.lastIndexOf(".") + 1); + pkgName = cname.substring(0, cname.lastIndexOf('.')); + cname = cname.substring(cname.lastIndexOf('.') + 1); } GraphTargetItem obj = null; Reference outName = new Reference<>(""); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java index ff00475e1..fddbb80fe 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java @@ -30,9 +30,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.other.GetPropertyIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.other.SetPropertyIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.DupIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushByteIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushNanIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushNullIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceAIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceSIns; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java index 4865b4f72..b5037dde5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java @@ -437,8 +437,8 @@ public class PropertyAVM2Item extends AssignableAVM2Item { String pkgName = ""; cname = localData.currentClass; if (cname.contains(".")) { - pkgName = cname.substring(0, cname.lastIndexOf(".")); - cname = cname.substring(cname.lastIndexOf(".") + 1); + pkgName = cname.substring(0, cname.lastIndexOf('.')); + cname = cname.substring(cname.lastIndexOf('.') + 1); } Reference outName = new Reference<>(""); Reference outNs = new Reference<>(""); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/Reference.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/Reference.java index dfa79dc5e..d1f134dcc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/Reference.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/Reference.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.parser.script; /** * * @author JPEXS + * @param */ public class Reference { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java index e576580c1..08333a10e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java @@ -1934,7 +1934,7 @@ public final class ActionScriptLexer { String s = yytext(); s = s.substring(1, s.length() - 1); if (s.contains(" ")) { - s = s.substring(0, s.indexOf(" ")); + s = s.substring(0, s.indexOf(' ')); } xmlTagName = s; string.append(yytext()); diff --git a/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java b/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java index 327f4a60d..918bce0da 100644 --- a/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java +++ b/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java @@ -100,13 +100,13 @@ public class EcmaScript { if (ny.isNaN()) { return new Undefined(); } - if (((Double) nx).compareTo((Double) ny) == 0) { + if ((nx).compareTo(ny) == 0) { return false; } - if ((Double.compare((Double) nx, -0.0) == 0) && (Double.compare((Double) ny, 0.0) == 0)) { + if ((Double.compare(nx, -0.0) == 0) && (Double.compare(ny, 0.0) == 0)) { return false; } - if ((Double.compare((Double) nx, 0.0) == 0) && (Double.compare((Double) ny, -0.0) == 0)) { + if ((Double.compare(nx, 0.0) == 0) && (Double.compare(ny, -0.0) == 0)) { return false; } if (nx.isInfinite() && nx > 0) { diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/ShapeExporterBase.java b/trunk/src/com/jpexs/decompiler/flash/exporters/ShapeExporterBase.java index 9d8e54cbf..21706f7ee 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/ShapeExporterBase.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/ShapeExporterBase.java @@ -506,15 +506,11 @@ public abstract class ShapeExporterBase implements IShapeExporter { } protected void appendFillStyles(List v1, FILLSTYLE[] v2) { - for (int i = 0; i < v2.length; i++) { - v1.add(v2[i]); - } + v1.addAll(Arrays.asList(v2)); } protected void appendLineStyles(List v1, LINESTYLE[] v2) { - for (int i = 0; i < v2.length; i++) { - v1.add(v2[i]); - } + v1.addAll(Arrays.asList(v2)); } protected void appendEdges(List v1, List v2) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/FontPreviewDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/FontPreviewDialog.java index a190b7123..073c0961b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/FontPreviewDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/FontPreviewDialog.java @@ -91,7 +91,7 @@ public class FontPreviewDialog extends AppDialog { } catch (IOException ex) { Logger.getLogger(FontPreviewDialog.class.getName()).log(Level.SEVERE, "Cannot read font preview dialog sample texts", ex); } - return new DefaultComboBoxModel<>(sampleTexts.toArray(new String[0])); + return new DefaultComboBoxModel<>(sampleTexts.toArray(new String[sampleTexts.size()])); } /** diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java index 62ea6ee94..72f287493 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java @@ -266,7 +266,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener { final JScrollBar sb = genericTagPropertiesEditPanelScrollPanel.getVerticalScrollBar(); final int val = sb.getValue(); //save scroll top SWFType swfType = field.getAnnotation(SWFType.class); - if (swfType != null && !swfType.countField().equals("")) { //Fields with same countField must be removed from too + if (swfType != null && !swfType.countField().isEmpty()) { //Fields with same countField must be removed from too Field fields[] = obj.getClass().getDeclaredFields(); for (int f = 0; f < fields.length; f++) { SWFType fieldSwfType = fields[f].getAnnotation(SWFType.class); @@ -318,7 +318,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener { final JScrollBar sb = genericTagPropertiesEditPanelScrollPanel.getVerticalScrollBar(); final int val = sb.getValue(); //save scroll top SWFType swfType = field.getAnnotation(SWFType.class); - if (swfType != null && !swfType.countField().equals("")) { //Fields with same countField must be enlarged too + if (swfType != null && !swfType.countField().isEmpty()) { //Fields with same countField must be enlarged too Field fields[] = obj.getClass().getDeclaredFields(); for (int f = 0; f < fields.length; f++) { SWFType fieldSwfType = fields[f].getAnnotation(SWFType.class); @@ -450,7 +450,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener { result += " + " + swfType.countAdd(); } result += "]"; - } else if (!swfType.countField().equals("")) { + } else if (!swfType.countField().isEmpty()) { result += "[" + swfType.countField(); if (swfType.countAdd() > 0) { result += " + " + swfType.countAdd(); @@ -510,7 +510,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener { Field f = path.get(i); int index = indices.get(i); String par = p; - if (!p.equals("")) { + if (!p.isEmpty()) { p += "."; } p += f.getName(); @@ -526,7 +526,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener { Map fields = new HashMap<>(); for (String fld : fieldNames) { String ckey = ""; - if (!par.equals("")) { + if (!par.isEmpty()) { ckey = par + "."; } ckey += fld; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java index f289be722..f7d0e6ee8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java @@ -239,7 +239,7 @@ public class GenericTagTreePanel extends GenericTagPanel { if (swfArray != null) { itemStr = swfArray.value(); } - if (itemStr.equals("")) { + if (itemStr.isEmpty()) { itemStr = AppStrings.translate("generictag.array.item"); } if (ReflectionTools.needsIndex(fnode.field)) { @@ -519,7 +519,7 @@ public class GenericTagTreePanel extends GenericTagPanel { Conditional cond = fnode.field.getAnnotation(Conditional.class); if (cond != null) { ConditionEvaluator ev = new ConditionEvaluator(cond); - String parentPath = currentPath.indexOf(".") == -1 ? "" : currentPath.substring(0, currentPath.lastIndexOf(".")); + String parentPath = currentPath.indexOf('.') == -1 ? "" : currentPath.substring(0, currentPath.lastIndexOf('.')); try { for (String cname : ev.getFields()) { String fullParh = parentPath + "." + cname; @@ -705,7 +705,7 @@ public class GenericTagTreePanel extends GenericTagPanel { } if (swfArray.count() > 0) { result += "[" + swfArray.count() + "]"; - } else if (!swfArray.countField().equals("")) { + } else if (!swfArray.countField().isEmpty()) { result += "[" + swfArray.countField() + "]"; } return result; @@ -726,7 +726,7 @@ public class GenericTagTreePanel extends GenericTagPanel { result += " + " + swfType.countAdd(); } result += "]"; - } else if (!swfType.countField().equals("")) { + } else if (!swfType.countField().isEmpty()) { result += "[" + swfType.countField(); if (swfType.countAdd() > 0) { result += " + " + swfType.countAdd(); @@ -822,7 +822,7 @@ public class GenericTagTreePanel extends GenericTagPanel { private void addItem(Object obj, Field field, int index) { SWFArray swfArray = field.getAnnotation(SWFArray.class); - if (swfArray != null && !swfArray.countField().equals("")) { //Fields with same countField must be enlarged too + if (swfArray != null && !swfArray.countField().isEmpty()) { //Fields with same countField must be enlarged too Field fields[] = obj.getClass().getDeclaredFields(); List sameFlds = new ArrayList<>(); for (int f = 0; f < fields.length; f++) { @@ -868,7 +868,7 @@ public class GenericTagTreePanel extends GenericTagPanel { private void removeItem(Object obj, Field field, int index) { SWFArray swfArray = field.getAnnotation(SWFArray.class); - if (swfArray != null && !swfArray.countField().equals("")) { //Fields with same countField must be removed from too + if (swfArray != null && !swfArray.countField().isEmpty()) { //Fields with same countField must be removed from too Field fields[] = obj.getClass().getDeclaredFields(); for (int f = 0; f < fields.length; f++) { SWFArray fieldSwfArray = fields[f].getAnnotation(SWFArray.class); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index b9a8ac6f6..4e609fca4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -1050,7 +1050,7 @@ public class Main { String acceptVersions = ""; for (String a : accepted) { - if (!acceptVersions.equals("")) { + if (!acceptVersions.isEmpty()) { acceptVersions += ","; } acceptVersions += a; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index e385e5980..4ddd03365 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -531,7 +531,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { private void clearModified(SWF swf) { for (Tag tag : swf.tags) { if (tag.isModified()) { - tag.setOriginalData(tag.getData()); + tag.createOriginalData(); tag.setModified(false); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 169308095..bcec7f11c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -2030,7 +2030,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec try { SWF swf = it.getSwf(); if (it instanceof DefineBitsTag) { - DefineBitsJPEG2Tag jpeg2Tag = new DefineBitsJPEG2Tag(swf, it.getOriginalData(), it.getPos(), it.getCharacterId(), data); + DefineBitsJPEG2Tag jpeg2Tag = new DefineBitsJPEG2Tag(swf, it.getOriginalHeaderData(), it.getOriginalData(), it.getPos(), it.getCharacterId(), data); jpeg2Tag.setModified(true); swf.tags.set(swf.tags.indexOf(it), jpeg2Tag); swf.updateCharacters(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 4e3bbe0c4..f6d0cf086 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -526,7 +526,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { /*FileAttributesTag fa = new FileAttributesTag(); sos2.writeTag(fa); */ - sos2.writeTag(new SetBackgroundColorTag(null, new RGB(backgroundColor))); + new SetBackgroundColorTag(null, new RGB(backgroundColor)).writeTag(sos2); if (tagObj instanceof FrameNodeItem) { FrameNodeItem fn = (FrameNodeItem) tagObj; @@ -559,7 +559,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { Set needed = t.getDeepNeededCharacters(swf.characters); for (int n : needed) { if (!doneCharacters.contains(n)) { - sos2.writeTag(classicTag(swf.characters.get(n))); + classicTag(swf.characters.get(n)).writeTag(sos2); doneCharacters.add(n); } } @@ -569,7 +569,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { doneCharacters.add(((CharacterTag) t).getCharacterId()); } } - sos2.writeTag(classicTag(t)); + classicTag(t).writeTag(sos2); if (parent != null) { if (t instanceof PlaceObjectTypeTag) { @@ -589,28 +589,28 @@ public class PreviewPanel extends JSplitPane implements ActionListener { mat.translateX += width / 2; mat.translateY += height / 2; } - sos2.writeTag(new PlaceObject2Tag(null, false, false, false, false, false, true, false, true, depth, chid, mat, null, 0, null, 0, null)); + new PlaceObject2Tag(null, false, false, false, false, false, true, false, true, depth, chid, mat, null, 0, null, 0, null).writeTag(sos2); } } } - sos2.writeTag(new ShowFrameTag(null)); + new ShowFrameTag(null).writeTag(sos2); } else { if (tagObj instanceof DefineBitsTag) { JPEGTablesTag jtt = swf.jtt; if (jtt != null) { - sos2.writeTag(jtt); + jtt.writeTag(sos2); } } else if (tagObj instanceof AloneTag) { } else { Set needed = ((Tag) tagObj).getDeepNeededCharacters(swf.characters); for (int n : needed) { - sos2.writeTag(classicTag(swf.characters.get(n))); + classicTag(swf.characters.get(n)).writeTag(sos2); } } - sos2.writeTag(classicTag((Tag) tagObj)); + classicTag((Tag) tagObj).writeTag(sos2); int chtId = 0; if (tagObj instanceof CharacterTag) { @@ -663,34 +663,34 @@ public class PreviewPanel extends JSplitPane implements ActionListener { rec.add(tr); mat.translateX = x * width / cols; mat.translateY = y * height / rows; - sos2.writeTag(new DefineTextTag(null, 999 + f, new RECT(0, width, 0, height), new MATRIX(), rec)); - sos2.writeTag(new PlaceObject2Tag(null, false, false, false, true, false, true, true, false, 1 + f, 999 + f, mat, null, 0, null, 0, null)); + new DefineTextTag(null, 999 + f, new RECT(0, width, 0, height), new MATRIX(), rec).writeTag(sos2); + new PlaceObject2Tag(null, false, false, false, true, false, true, true, false, 1 + f, 999 + f, mat, null, 0, null, 0, null).writeTag(sos2); x++; } - sos2.writeTag(new ShowFrameTag(null)); + new ShowFrameTag(null).writeTag(sos2); } else if ((tagObj instanceof DefineMorphShapeTag) || (tagObj instanceof DefineMorphShape2Tag)) { - sos2.writeTag(new PlaceObject2Tag(null, false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null)); - sos2.writeTag(new ShowFrameTag(null)); + new PlaceObject2Tag(null, false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null).writeTag(sos2); + new ShowFrameTag(null).writeTag(sos2); int numFrames = 100; for (int ratio = 0; ratio < 65536; ratio += 65536 / numFrames) { - sos2.writeTag(new PlaceObject2Tag(null, false, false, false, true, false, true, false, true, 1, chtId, mat, null, ratio, null, 0, null)); - sos2.writeTag(new ShowFrameTag(null)); + new PlaceObject2Tag(null, false, false, false, true, false, true, false, true, 1, chtId, mat, null, ratio, null, 0, null).writeTag(sos2); + new ShowFrameTag(null).writeTag(sos2); } } else if (tagObj instanceof SoundStreamHeadTypeTag) { for (SoundStreamBlockTag blk : soundFrames) { - sos2.writeTag(blk); - sos2.writeTag(new ShowFrameTag(null)); + blk.writeTag(sos2); + new ShowFrameTag(null).writeTag(sos2); } } else if (tagObj instanceof DefineSoundTag) { ExportAssetsTag ea = new ExportAssetsTag(); DefineSoundTag ds = (DefineSoundTag) tagObj; ea.tags.add(ds.soundId); ea.names.add("my_define_sound"); - sos2.writeTag(ea); + ea.writeTag(sos2); List actions; DoActionTag doa; - doa = new DoActionTag(swf, new byte[]{}, 0); + doa = new DoActionTag(swf, new byte[0], new byte[0], 0); actions = ASMParser.parse(0, 0, false, "ConstantPool \"_root\" \"my_sound\" \"Sound\" \"my_define_sound\" \"attachSound\"\n" + "Push \"_root\"\n" @@ -707,8 +707,8 @@ public class PreviewPanel extends JSplitPane implements ActionListener { + "Pop\n" + "Stop", swf.version, false); doa.setActions(actions); - sos2.writeTag(doa); - sos2.writeTag(new ShowFrameTag(null)); + doa.writeTag(sos2); + new ShowFrameTag(null).writeTag(sos2); actions = ASMParser.parse(0, 0, false, "ConstantPool \"_root\" \"my_sound\" \"Sound\" \"my_define_sound\" \"attachSound\" \"start\"\n" @@ -734,8 +734,8 @@ public class PreviewPanel extends JSplitPane implements ActionListener { + "Pop\n" + "Stop", swf.version, false); doa.setActions(actions); - sos2.writeTag(doa); - sos2.writeTag(new ShowFrameTag(null)); + doa.writeTag(sos2); + new ShowFrameTag(null).writeTag(sos2); actions = ASMParser.parse(0, 0, false, "ConstantPool \"_root\" \"my_sound\" \"Sound\" \"my_define_sound\" \"attachSound\" \"onSoundComplete\" \"start\" \"execParam\"\n" @@ -778,23 +778,23 @@ public class PreviewPanel extends JSplitPane implements ActionListener { + "Pop\n" + "Stop", swf.version, false); doa.setActions(actions); - sos2.writeTag(doa); - sos2.writeTag(new ShowFrameTag(null)); + doa.writeTag(sos2); + new ShowFrameTag(null).writeTag(sos2); actions = ASMParser.parse(0, 0, false, "StopSounds\n" + "Stop", swf.version, false); doa.setActions(actions); - sos2.writeTag(doa); - sos2.writeTag(new ShowFrameTag(null)); + doa.writeTag(sos2); + new ShowFrameTag(null).writeTag(sos2); - sos2.writeTag(new ShowFrameTag(null)); + new ShowFrameTag(null).writeTag(sos2); if (flashPanel != null) { flashPanel.specialPlayback = true; } } else if (tagObj instanceof DefineVideoStreamTag) { - sos2.writeTag(new PlaceObject2Tag(null, false, false, false, false, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null)); + new PlaceObject2Tag(null, false, false, false, false, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null).writeTag(sos2); List frs = new ArrayList<>(videoFrames.values()); Collections.sort(frs, new Comparator() { @Override @@ -807,20 +807,20 @@ public class PreviewPanel extends JSplitPane implements ActionListener { for (VideoFrameTag f : frs) { if (!first) { ratio++; - sos2.writeTag(new PlaceObject2Tag(null, false, false, false, true, false, false, false, true, 1, 0, null, null, ratio, null, 0, null)); + new PlaceObject2Tag(null, false, false, false, true, false, false, false, true, 1, 0, null, null, ratio, null, 0, null).writeTag(sos2); } - sos2.writeTag(f); - sos2.writeTag(new ShowFrameTag(null)); + f.writeTag(sos2); + new ShowFrameTag(null).writeTag(sos2); first = false; } } else { - sos2.writeTag(new PlaceObject2Tag(null, false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null)); - sos2.writeTag(new ShowFrameTag(null)); + new PlaceObject2Tag(null, false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null).writeTag(sos2); + new ShowFrameTag(null).writeTag(sos2); } }//not showframe - sos2.writeTag(new EndTag(null)); + new EndTag(null).writeTag(sos2); data = baos.toByteArray(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java index d847e88a1..81b9d402a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java @@ -86,12 +86,13 @@ public class CSMTextSettingsTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public CSMTextSettingsTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "CSMTextSettings", data, pos); + public CSMTextSettingsTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "CSMTextSettings", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); textID = sis.readUI16(); useFlashType = (int) sis.readUB(2); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java index 76bc1faea..7297e22c6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java @@ -59,12 +59,13 @@ public class DebugIDTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DebugIDTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DebugID", data, pos); + public DebugIDTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DebugID", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); debugId = sis.readBytesEx(16); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java index 2186268a1..1cc7e87b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java @@ -60,8 +60,8 @@ public class DefineBinaryDataTag extends CharacterTag { return baos.toByteArray(); } - public DefineBinaryDataTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineBinaryData", data, pos); + public DefineBinaryDataTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineBinaryData", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); tag = sis.readUI16(); reserved = sis.readUI32(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java index a298ea932..d307caf91 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java @@ -68,15 +68,15 @@ public class DefineBitsJPEG2Tag extends ImageTag implements AloneTag { return null; } - public DefineBitsJPEG2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineBitsJPEG2", data, pos); + public DefineBitsJPEG2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineBitsJPEG2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); imageData = sis.readBytesEx(sis.available()); } - public DefineBitsJPEG2Tag(SWF swf, byte[] data, long pos, int characterID, byte[] imageData) throws IOException { - super(swf, ID, "DefineBitsJPEG2", data, pos); + public DefineBitsJPEG2Tag(SWF swf, byte[] headerData, byte[] data, long pos, int characterID, byte[] imageData) throws IOException { + super(swf, ID, "DefineBitsJPEG2", headerData, data, pos); this.characterID = characterID; this.imageData = imageData; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java index 48a10e2af..980dce3fa 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java @@ -107,8 +107,8 @@ public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag { return null; } - public DefineBitsJPEG3Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineBitsJPEG3", data, pos); + public DefineBitsJPEG3Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineBitsJPEG3", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); long alphaDataOffset = sis.readUI32(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java index 038fe5a04..d314058cc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java @@ -134,12 +134,13 @@ public class DefineBitsJPEG4Tag extends ImageTag implements AloneTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineBitsJPEG4Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineBitsJPEG4", data, pos); + public DefineBitsJPEG4Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineBitsJPEG4", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); long alphaDataOffset = sis.readUI32(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java index 4fc642b4e..25bac5eae 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java @@ -107,8 +107,8 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag { setModified(true); } - public DefineBitsLossless2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineBitsLossless2", data, pos); + public DefineBitsLossless2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineBitsLossless2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); bitmapFormat = sis.readUI8(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java index 2153c011d..c376fe950 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java @@ -181,8 +181,8 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag { decompressed = true; } - public DefineBitsLosslessTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineBitsLossless", data, pos); + public DefineBitsLosslessTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineBitsLossless", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); bitmapFormat = sis.readUI8(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java index 12cb7bddd..83dfdc067 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java @@ -54,8 +54,8 @@ public class DefineBitsTag extends ImageTag { return true; } - public DefineBitsTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineBits", data, pos); + public DefineBitsTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineBits", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); jpegData = sis.readBytesEx(sis.available()); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index 4a7fb8d04..19b376570 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -100,12 +100,13 @@ public class DefineButton2Tag extends ButtonTag implements Container { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineButton2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineButton2", data, pos); + public DefineButton2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineButton2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); buttonId = sis.readUI16(); reserved = (int) sis.readUB(7); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java index a3da65d39..4e84d802d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java @@ -61,12 +61,13 @@ public class DefineButtonCxformTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineButtonCxformTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineButtonCxform", data, pos); + public DefineButtonCxformTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineButtonCxform", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); buttonId = sis.readUI16(); buttonColorTransform = sis.readCXFORM(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java index 6679a41c1..e4e576b09 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java @@ -101,12 +101,13 @@ public class DefineButtonSoundTag extends CharacterIdTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineButtonSoundTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineButtonSound", data, pos); + public DefineButtonSoundTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineButtonSound", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); buttonId = sis.readUI16(); buttonSoundChar0 = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java index c80920d98..024b11102 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java @@ -99,12 +99,13 @@ public class DefineButtonTag extends ButtonTag implements ASMSource { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineButtonTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineButton", data, pos); + public DefineButtonTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineButton", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); buttonId = sis.readUI16(); characters = sis.readBUTTONRECORDList(false); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 2efdbfc19..15eb671e4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -695,12 +695,13 @@ public class DefineEditTextTag extends TextTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineEditTextTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineEditText", data, pos); + public DefineEditTextTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineEditText", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); bounds = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java index ee4ecc464..fb5d4f145 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java @@ -186,19 +186,20 @@ public class DefineFont2Tag extends FontTag { } public DefineFont2Tag(SWF swf) throws IOException { - super(swf, ID, "DefineFont2", null, 0); + super(swf, ID, "DefineFont2", null, null, 0); } /** * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineFont2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineFont2", data, pos); + public DefineFont2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineFont2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); fontId = sis.readUI16(); fontFlagsHasLayout = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java index db8d80503..eb0801ee1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java @@ -110,8 +110,8 @@ public class DefineFont3Tag extends FontTag { return codeTable.indexOf((Integer) (int) c); } - public DefineFont3Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineFont3", data, pos); + public DefineFont3Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineFont3", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); fontId = sis.readUI16(); fontFlagsHasLayout = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java index c4b1ada30..290e1fd9a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java @@ -48,8 +48,8 @@ public class DefineFont4Tag extends CharacterTag { return fontID; } - public DefineFont4Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineFont4", data, pos); + public DefineFont4Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineFont4", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); fontID = sis.readUI16(); reserved = (int) sis.readUB(5); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java index 902a11502..7f761911b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java @@ -44,8 +44,8 @@ public class DefineFontAlignZonesTag extends Tag { public List zoneTable; public static final int ID = 73; - public DefineFontAlignZonesTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineFontAlignZones", data, pos); + public DefineFontAlignZonesTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineFontAlignZones", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); fontID = sis.readUI16(); CSMTableHint = (int) sis.readUB(2); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java index 0acc2b630..d0f3c62af 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java @@ -90,12 +90,13 @@ public class DefineFontInfo2Tag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineFontInfo2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineFontInfo2", data, pos); + public DefineFontInfo2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineFontInfo2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); fontID = sis.readUI16(); int fontNameLen = sis.readUI8(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java index a90c1b95d..b27486644 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java @@ -91,12 +91,13 @@ public class DefineFontInfoTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineFontInfoTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineFontInfo", data, pos); + public DefineFontInfoTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineFontInfo", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); fontId = sis.readUI16(); int fontNameLen = sis.readUI8(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java index 4a6167f71..15dad8530 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontNameTag.java @@ -31,8 +31,8 @@ public class DefineFontNameTag extends Tag { public String fontCopyright; public static final int ID = 88; - public DefineFontNameTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineFontName", data, pos); + public DefineFontNameTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineFontName", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); fontId = sis.readUI16(); fontName = sis.readString(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java index 0cbb8e9ac..4cb72dbe7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java @@ -138,12 +138,13 @@ public class DefineFontTag extends FontTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineFontTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineFont", data, pos); + public DefineFontTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineFont", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); fontId = sis.readUI16(); int firstOffset = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java index 0f7f9b8aa..55d3b7d12 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java @@ -138,12 +138,13 @@ public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag, * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineMorphShape2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineMorphShape2", data, pos); + public DefineMorphShape2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineMorphShape2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterId = sis.readUI16(); startBounds = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java index 529c2cef4..139fe2229 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java @@ -116,12 +116,13 @@ public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag, * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineMorphShapeTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineMorphShape", data, pos); + public DefineMorphShapeTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineMorphShape", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterId = sis.readUI16(); startBounds = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java index 42540b2f9..e475753bc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java @@ -37,8 +37,8 @@ public class DefineScalingGridTag extends Tag { public RECT splitter; public static final int ID = 78; - public DefineScalingGridTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineScalingGrid", data, pos); + public DefineScalingGridTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineScalingGrid", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterId = sis.readUI16(); splitter = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java index 007f59d6b..a0e35f8d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java @@ -80,12 +80,13 @@ public class DefineSceneAndFrameLabelDataTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineSceneAndFrameLabelDataTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineSceneAndFrameLabelData", data, pos); + public DefineSceneAndFrameLabelDataTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineSceneAndFrameLabelData", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); int sceneCount = (int) sis.readEncodedU32(); sceneOffsets = new long[sceneCount]; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java index 349d09aaa..18c8bd946 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java @@ -75,8 +75,8 @@ public class DefineShape2Tag extends ShapeTag { return shapeBounds; } - public DefineShape2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineShape2", data, pos); + public DefineShape2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineShape2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); shapeId = sis.readUI16(); shapeBounds = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java index 731ac9c0e..59f9449ee 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java @@ -79,8 +79,8 @@ public class DefineShape3Tag extends ShapeTag { return shapeId; } - public DefineShape3Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineShape3", data, pos); + public DefineShape3Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineShape3", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); shapeId = sis.readUI16(); shapeBounds = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java index d34539353..45d9168f9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java @@ -83,8 +83,8 @@ public class DefineShape4Tag extends ShapeTag { return shapeBounds; } - public DefineShape4Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineShape4", data, pos); + public DefineShape4Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineShape4", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); shapeId = sis.readUI16(); shapeBounds = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java index 30ef1168d..478a3a2b1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java @@ -60,8 +60,8 @@ public class DefineShapeTag extends ShapeTag { return shapeBounds; } - public DefineShapeTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineShape", data, pos); + public DefineShapeTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineShape", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); shapeId = sis.readUI16(); shapeBounds = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java index 5e9fd5011..25bf78361 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java @@ -97,12 +97,13 @@ public class DefineSoundTag extends CharacterTag implements SoundTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineSoundTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineSound", data, pos); + public DefineSoundTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineSound", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); soundId = sis.readUI16(); soundFormat = (int) sis.readUB(4); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index 4d485507d..d5e3b817f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -70,6 +70,7 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable * A series of tags */ public List subTags; + public boolean hasEndTag; public static final int ID = 39; @@ -190,6 +191,7 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param level * @param pos @@ -198,12 +200,17 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable * @throws IOException * @throws java.lang.InterruptedException */ - public DefineSpriteTag(SWF swf, byte[] data, int level, long pos, boolean parallel, boolean skipUnusualTags) throws IOException, InterruptedException { - super(swf, ID, "DefineSprite", data, pos); + public DefineSpriteTag(SWF swf, byte[] headerData, byte[] data, int level, long pos, boolean parallel, boolean skipUnusualTags) throws IOException, InterruptedException { + super(swf, ID, "DefineSprite", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version, pos); spriteId = sis.readUI16(); frameCount = sis.readUI16(); - subTags = sis.readTagList(swf, this, level + 1, parallel, skipUnusualTags, true, swf.gfx); + List subTags = sis.readTagList(swf, this, level + 1, parallel, skipUnusualTags, true, swf.gfx); + if (subTags.get(subTags.size() - 1).getId() == EndTag.ID) { + hasEndTag = true; + subTags.remove(subTags.size() - 1); + } + this.subTags = subTags; } static int c = 0; @@ -226,7 +233,9 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable try { sos.writeUI16(spriteId); sos.writeUI16(frameCount); - sos.writeTags(subTags); + if (hasEndTag) { + sos.writeTags(subTags); + } sos.writeUI16(0); sos.close(); } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 312e95607..0a5b51e82 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -456,12 +456,13 @@ public class DefineText2Tag extends TextTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineText2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineText2", data, pos); + public DefineText2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineText2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); textBounds = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index a5d29cb11..cb485c62e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -421,7 +421,7 @@ public class DefineTextTag extends TextTag { } public DefineTextTag(SWF swf, int characterID, RECT textBounds, MATRIX textMatrix, List textRecords) { - super(swf, ID, "DefineText", null, 0); + super(swf, ID, "DefineText", null, null, 0); this.characterID = characterID; this.textBounds = textBounds; this.textMatrix = textMatrix; @@ -467,12 +467,13 @@ public class DefineTextTag extends TextTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineTextTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineText", data, pos); + public DefineTextTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineText", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); textBounds = sis.readRECT(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java index 837d6995a..263c24bb3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java @@ -100,12 +100,13 @@ public class DefineVideoStreamTag extends CharacterTag implements BoundedTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineVideoStreamTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineVideoStream", data, pos); + public DefineVideoStreamTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineVideoStream", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterID = sis.readUI16(); numFrames = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java index fd91c4478..96be571c3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java @@ -68,12 +68,13 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DoABCDefineTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DoABCDefine", data, pos); + public DoABCDefineTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DoABCDefine", headerData, data, pos); InputStream is = new ByteArrayInputStream(data); SWFInputStream sis = new SWFInputStream(is, swf.version); flags = sis.readUI32(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java index e2bf98a73..23cb51815 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java @@ -54,12 +54,13 @@ public class DoABCTag extends Tag implements ABCContainerTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DoABCTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DoABC", data, pos); + public DoABCTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DoABC", headerData, data, pos); InputStream is = new ByteArrayInputStream(data); abc = new ABC(is, swf, this); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java index e803fca3f..8ef4a2fcb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.tags; import com.jpexs.decompiler.flash.DisassemblyListener; import com.jpexs.decompiler.flash.SWF; -import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.ActionListReader; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; @@ -51,11 +50,12 @@ public class DoActionTag extends Tag implements ASMSource { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos */ - public DoActionTag(SWF swf, byte[] data, long pos) { - super(swf, ID, "DoAction", data, pos); + public DoActionTag(SWF swf, byte[] headerData, byte[] data, long pos) { + super(swf, ID, "DoAction", headerData, data, pos); actionBytes = data; } @@ -114,7 +114,7 @@ public class DoActionTag extends Tag implements ASMSource { byte[] prevData = previousTag.getData(); baos.write(prevData); prevLength = prevData.length; - byte[] header = SWFOutputStream.getTagHeader(this, data, getVersion()); + byte[] header = getHeader(data); baos.write(header); prevLength += header.length; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index ce76d289e..0fd786687 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -58,12 +58,13 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DoInitActionTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DoInitAction", data, pos); + public DoInitActionTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DoInitAction", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); spriteId = sis.readUI16(); //actions = sis.readActionList(); @@ -127,7 +128,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { baos.write(0); baos.write(0); prevLength += 2; - byte[] header = SWFOutputStream.getTagHeader(this, data, getVersion()); + byte[] header = getHeader(data); baos.write(header); prevLength += header.length; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java index 790bb213d..a82e35852 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java @@ -66,12 +66,13 @@ public class EnableDebugger2Tag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public EnableDebugger2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "EnableDebugger2", data, pos); + public EnableDebugger2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "EnableDebugger2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); reserved = sis.readUI16(); passwordHash = sis.readString(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java index be90be126..f17182cc5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java @@ -60,12 +60,13 @@ public class EnableDebuggerTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public EnableDebuggerTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "EnableDebugger", data, pos); + public EnableDebuggerTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "EnableDebugger", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); passwordHash = sis.readString(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java index fe3613c00..66b8cf6eb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java @@ -69,12 +69,13 @@ public class EnableTelemetryTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public EnableTelemetryTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "", data, pos); + public EnableTelemetryTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); reserved = (int) sis.readUB(16); if (sis.available() > 0) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EndTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EndTag.java index 427a9127d..0d8b53292 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EndTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EndTag.java @@ -41,16 +41,17 @@ public class EndTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public EndTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "End", data, pos); + public EndTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "End", headerData, data, pos); } public EndTag(SWF swf) { - super(swf, ID, "End", new byte[0], 0); + super(swf, ID, "End", new byte[0], new byte[0], 0); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java index c44dd790f..beb56002e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java @@ -48,7 +48,7 @@ public class ExportAssetsTag extends Tag { public static final int ID = 56; public ExportAssetsTag() { - super(null, ID, "ExportAssets", new byte[]{}, 0); + super(null, ID, "ExportAssets", new byte[0], new byte[0], 0); tags = new ArrayList<>(); names = new ArrayList<>(); } @@ -57,12 +57,13 @@ public class ExportAssetsTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public ExportAssetsTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "ExportAssets", data, pos); + public ExportAssetsTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "ExportAssets", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); int count = sis.readUI16(); tags = new ArrayList<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java index 40377c648..8543c3155 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java @@ -46,11 +46,11 @@ public class FileAttributesTag extends Tag { public static final int ID = 69; public FileAttributesTag() { - super(null, ID, "FileAttributes", new byte[]{}, 0); + super(null, ID, "FileAttributes", new byte[0], new byte[0], 0); } - public FileAttributesTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "FileAttributes", data, pos); + public FileAttributesTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "FileAttributes", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); reserved1 = sis.readUB(1) == 1; // reserved // UB[1] == 0 (reserved) diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java index 0486f8c50..df1770463 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java @@ -38,8 +38,8 @@ public class FrameLabelTag extends Tag { return namedAnchor; } - public FrameLabelTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "FrameLabel", data, pos); + public FrameLabelTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "FrameLabel", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); name = sis.readString(); if (sis.available() > 0) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java index 56a1c650a..6702d4134 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java @@ -61,12 +61,13 @@ public class ImportAssets2Tag extends Tag implements ImportTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public ImportAssets2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "ImportAssets2", data, pos); + public ImportAssets2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "ImportAssets2", headerData, data, pos); tags = new ArrayList<>(); names = new ArrayList<>(); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssetsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssetsTag.java index e61f89649..4e8d9d10b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssetsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssetsTag.java @@ -54,12 +54,13 @@ public class ImportAssetsTag extends Tag implements ImportTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public ImportAssetsTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "ImportAssets", data, pos); + public ImportAssetsTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "ImportAssets", headerData, data, pos); tags = new ArrayList<>(); names = new ArrayList<>(); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/JPEGTablesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/JPEGTablesTag.java index 2616815ba..818792aa3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/JPEGTablesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/JPEGTablesTag.java @@ -23,7 +23,6 @@ public class JPEGTablesTag extends Tag { public static final int ID = 8; - public JPEGTablesTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "JPEGTables", data, pos); //data is JPEG data - } + public JPEGTablesTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "JPEGTables", headerData, data, pos); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/MetadataTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/MetadataTag.java index bfb9cd9be..40e0ed578 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/MetadataTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/MetadataTag.java @@ -31,8 +31,8 @@ public class MetadataTag extends Tag { public String xmlMetadata; public static final int ID = 77; - public MetadataTag(SWF swf, byte[] data, long pos) { - super(swf, ID, "Metadata", data, pos); + public MetadataTag(SWF swf, byte[] headerData, byte[] data, long pos) { + super(swf, ID, "Metadata", headerData, data, pos); try { SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); xmlMetadata = sis.readString(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java index 13a05c1e7..b827aa675 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java @@ -195,7 +195,7 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO } public PlaceObject2Tag(SWF swf, boolean placeFlagHasClipActions, boolean placeFlagHasClipDepth, boolean placeFlagHasName, boolean placeFlagHasRatio, boolean placeFlagHasColorTransform, boolean placeFlagHasMatrix, boolean placeFlagHasCharacter, boolean placeFlagMove, int depth, int characterId, MATRIX matrix, CXFORMWITHALPHA colorTransform, int ratio, String name, int clipDepth, CLIPACTIONS clipActions) { - super(swf, ID, "PlaceObject2", null, 0); + super(swf, ID, "PlaceObject2", null, null, 0); this.placeFlagHasClipActions = placeFlagHasClipActions; this.placeFlagHasClipDepth = placeFlagHasClipDepth; this.placeFlagHasName = placeFlagHasName; @@ -218,12 +218,13 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public PlaceObject2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "PlaceObject2", data, pos); + public PlaceObject2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "PlaceObject2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); placeFlagHasClipActions = sis.readUB(1) == 1; placeFlagHasClipDepth = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java index 79726d436..153fb9d01 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java @@ -302,12 +302,13 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public PlaceObject3Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "PlaceObject3", data, pos); + public PlaceObject3Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "PlaceObject3", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); placeFlagHasClipActions = sis.readUB(1) == 1; placeFlagHasClipDepth = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java index c454139e8..d7f5cb505 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java @@ -304,12 +304,13 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public PlaceObject4Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "PlaceObject4", data, pos); + public PlaceObject4Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "PlaceObject4", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); placeFlagHasClipActions = sis.readUB(1) == 1; placeFlagHasClipDepth = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java index e3b0bce53..818b0a207 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java @@ -102,12 +102,13 @@ public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public PlaceObjectTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "PlaceObject", data, pos); + public PlaceObjectTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "PlaceObject", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterId = sis.readUI16(); depth = sis.readUI16(); @@ -118,7 +119,7 @@ public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag } public PlaceObjectTag(SWF swf, int characterId, int depth, MATRIX matrix, CXFORM colorTransform) { - super(swf, ID, "PlaceObject", null, 0); + super(swf, ID, "PlaceObject", null, null, 0); this.characterId = characterId; this.depth = depth; this.matrix = matrix; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java index c2262581b..73dd29fba 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java @@ -46,8 +46,8 @@ public class ProductInfoTag extends Tag { public long compilationDateHigh; public static final int ID = 41; - public ProductInfoTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "ProductInfo", data, pos); + public ProductInfoTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "ProductInfo", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); /* * 0: Unknown diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java index 057df7c6e..33c1ba75c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java @@ -60,12 +60,13 @@ public class ProtectTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public ProtectTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "Protect", data, pos); + public ProtectTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "Protect", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); if (sis.available() > 0) { passwordHash = sis.readString(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java index 20bf34e8a..c5e7c37db 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObject2Tag.java @@ -30,8 +30,8 @@ public class RemoveObject2Tag extends Tag implements RemoveTag { public int depth; public static final int ID = 28; - public RemoveObject2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "RemoveObject2", data, pos); + public RemoveObject2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "RemoveObject2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); depth = sis.readUI16(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java index dd3075445..024607793 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java @@ -69,12 +69,13 @@ public class RemoveObjectTag extends CharacterIdTag implements RemoveTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public RemoveObjectTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "RemoveObject", data, pos); + public RemoveObjectTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "RemoveObject", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterId = sis.readUI16(); depth = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java index 50191d1fc..5e9d69c12 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java @@ -36,8 +36,8 @@ public class ScriptLimitsTag extends Tag { public static final int ID = 65; - public ScriptLimitsTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "ScriptLimits", data, pos); + public ScriptLimitsTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "ScriptLimits", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); maxRecursionDepth = sis.readUI16(); scriptTimeoutSeconds = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SetBackgroundColorTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SetBackgroundColorTag.java index 39d478853..94ac69154 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SetBackgroundColorTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SetBackgroundColorTag.java @@ -29,14 +29,14 @@ public class SetBackgroundColorTag extends Tag { public RGB backgroundColor; public static final int ID = 9; - public SetBackgroundColorTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "SetBackgroundColor", data, pos); + public SetBackgroundColorTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "SetBackgroundColor", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); backgroundColor = sis.readRGB(); } public SetBackgroundColorTag(SWF swf, RGB backgroundColor) { - super(swf, ID, "SetBackgroundColor", null, 0); + super(swf, ID, "SetBackgroundColor", null, null, 0); this.backgroundColor = backgroundColor; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java index b8c79d09e..8dbfec66c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java @@ -67,12 +67,13 @@ public class SetTabIndexTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public SetTabIndexTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "SetTabIndex", data, pos); + public SetTabIndexTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "SetTabIndex", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); depth = sis.readUI16(); tabIndex = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ShowFrameTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ShowFrameTag.java index e803888a1..aa0667c3b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ShowFrameTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ShowFrameTag.java @@ -52,14 +52,16 @@ public class ShowFrameTag extends Tag { * Constructor * * @param swf + * @param headerData * @param pos + * @param data */ - public ShowFrameTag(SWF swf, long pos) { - super(swf, ID, "ShowFrame", new byte[0], pos); + public ShowFrameTag(SWF swf, byte[] headerData, byte[] data, long pos) { + super(swf, ID, "ShowFrame", headerData, data, pos); } public ShowFrameTag(SWF swf) { - super(swf, ID, "ShowFrame", null, 0); + super(swf, ID, "ShowFrame", null, null, 0); } public static boolean isNestedTagType(int tagTypeId) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamBlockTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamBlockTag.java index af3a201a2..0acb8d801 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamBlockTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamBlockTag.java @@ -32,11 +32,11 @@ public class SoundStreamBlockTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public SoundStreamBlockTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "SoundStreamBlock", data, pos); //all data is streamSoundData - } + public SoundStreamBlockTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "SoundStreamBlock", headerData, data, pos); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java index c379e5c64..716114598 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java @@ -139,12 +139,13 @@ public class SoundStreamHead2Tag extends CharacterIdTag implements SoundStreamHe * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public SoundStreamHead2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "SoundStreamHead2", data, pos); + public SoundStreamHead2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "SoundStreamHead2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); reserved = (int) sis.readUB(4); playBackSoundRate = (int) sis.readUB(2); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java index 683858d20..8bbbed8e4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java @@ -132,12 +132,13 @@ public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHea * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public SoundStreamHeadTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "SoundStreamHead", data, pos); + public SoundStreamHeadTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "SoundStreamHead", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); reserved = (int) sis.readUB(4); playBackSoundRate = (int) sis.readUB(2); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/StartSound2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/StartSound2Tag.java index e36da5c08..8fd97fede 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/StartSound2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/StartSound2Tag.java @@ -57,12 +57,13 @@ public class StartSound2Tag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public StartSound2Tag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "StartSound2", data, pos); + public StartSound2Tag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "StartSound2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); soundClassName = sis.readString(); soundInfo = sis.readSOUNDINFO(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java index 9affca4ae..d9cda4473 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java @@ -61,12 +61,13 @@ public class StartSoundTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public StartSoundTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "StartSound", data, pos); + public StartSoundTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "StartSound", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); soundId = sis.readUI16(); soundInfo = sis.readSOUNDINFO(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java index 4fd775c3d..f9172d09c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java @@ -36,8 +36,8 @@ public class SymbolClassTag extends Tag { public String[] names; public static final int ID = 76; - public SymbolClassTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "SymbolClass", data, pos); + public SymbolClassTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "SymbolClass", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); int numSymbols = sis.readUI16(); tags = new int[numSymbols]; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java index 8ca941d09..4115ef60a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.tags; import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.Exportable; @@ -33,6 +34,8 @@ import com.jpexs.decompiler.flash.tags.gfx.ExporterInfoTag; import com.jpexs.decompiler.flash.tags.gfx.FontTextureInfo; import com.jpexs.decompiler.flash.timeline.Timelined; import com.jpexs.decompiler.flash.types.annotations.Internal; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.Serializable; import java.util.Arrays; import java.util.HashSet; @@ -49,6 +52,10 @@ public class Tag implements NeedsCharacters, Exportable, ContainerItem, Serializ * Identifier of tag type */ protected int id; + /** + * Original header data in the tag + */ + protected byte[] headerData; /** * Data in the tag */ @@ -116,12 +123,14 @@ public class Tag implements NeedsCharacters, Exportable, ContainerItem, Serializ * @param swf * @param id Tag type identifier * @param name Tag name + * @param headerData * @param data Bytes of data * @param pos */ - public Tag(SWF swf, int id, String name, byte[] data, long pos) { + public Tag(SWF swf, int id, String name, byte[] headerData, byte[] data, long pos) { this.id = id; this.tagName = name; + this.headerData = headerData; this.data = data; this.pos = pos; this.swf = swf; @@ -293,6 +302,15 @@ public class Tag implements NeedsCharacters, Exportable, ContainerItem, Serializ return swf.version; } + /** + * Gets original read header data + * + * @return Bytes of data + */ + public byte[] getOriginalHeaderData() { + return headerData; + } + /** * Gets original read data * @@ -302,15 +320,62 @@ public class Tag implements NeedsCharacters, Exportable, ContainerItem, Serializ return data; } - public void setOriginalData(byte[] data) { - this.data = data; + public void createOriginalData() { + data = getData(); + headerData = getHeader(data); } - public byte[] getDataOrOriginalData() { - if (isModified()) { - return getData(); + protected byte[] getHeader(byte[] data) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + + SWFOutputStream sos = new SWFOutputStream(baos, swf.version); + int tagLength = data.length; + int tagID = getId(); + int tagIDLength = (tagID << 6); + if ((tagLength <= 62) && (!forceWriteAsLong)) { + tagIDLength += tagLength; + sos.writeUI16(tagIDLength); + } else { + tagIDLength += 0x3f; + sos.writeUI16(tagIDLength); + sos.writeSI32(tagLength); + } + } catch (IOException iex) { } - return data; + return baos.toByteArray(); + } + + public static byte[] getTagHeader(int tagIDTagLength, long tagLength, boolean writeLong, int version) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + + SWFOutputStream sos = new SWFOutputStream(baos, version); + sos.writeUI16(tagIDTagLength); + if (writeLong) { + sos.writeSI32(tagLength); + } + } catch (IOException iex) { + } + return baos.toByteArray(); + } + + /** + * Writes Tag value to the stream + * + * @param sos SWF output stream + * @throws IOException + */ + public void writeTag(SWFOutputStream sos) throws IOException { + if (isModified()) { + byte[] newData = getData(); + sos.write(getHeader(newData)); + sos.write(newData); + return; + } + + sos.write(headerData); + sos.write(data); } /** diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/TagStub.java b/trunk/src/com/jpexs/decompiler/flash/tags/TagStub.java index 37fc32773..9c96a96a8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/TagStub.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/TagStub.java @@ -54,12 +54,13 @@ public class TagStub extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public TagStub(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "" /*TODO:Insert name here*/, data, pos); + public TagStub(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "" /*TODO:Insert name here*/, headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/UnknownTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/UnknownTag.java index 72327930f..b93ac2784 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/UnknownTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/UnknownTag.java @@ -24,7 +24,7 @@ import com.jpexs.decompiler.flash.SWF; */ public class UnknownTag extends Tag { - public UnknownTag(SWF swf, int id, byte[] data, long pos) { - super(swf, id, "Unknown", data, pos); + public UnknownTag(SWF swf, int id, byte[] headerData, byte[] data, long pos) { + super(swf, id, "Unknown", headerData, data, pos); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java index e5fc55c3d..07495844b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java @@ -63,12 +63,13 @@ public class VideoFrameTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public VideoFrameTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "VideoFrame", data, pos); + public VideoFrameTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "VideoFrame", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); streamID = sis.readUI16(); frameNum = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java index 9577b8cd6..e4ad5ba11 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java @@ -39,8 +39,8 @@ public abstract class ButtonTag extends CharacterTag implements DrawableTag, Tim public static int FRAME_DOWN = 2; public static int FRAME_HITTEST = 3; - public ButtonTag(SWF swf, int id, String name, byte[] data, long pos) { - super(swf, id, name, data, pos); + public ButtonTag(SWF swf, int id, String name, byte[] headerData, byte[] data, long pos) { + super(swf, id, name, headerData, data, pos); } public abstract List getRecords(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java index 00b84c135..0d4ef9f85 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java @@ -29,8 +29,8 @@ import java.util.List; */ public abstract class CharacterIdTag extends Tag { - public CharacterIdTag(SWF swf, int id, String name, byte[] data, long pos) { - super(swf, id, name, data, pos); + public CharacterIdTag(SWF swf, int id, String name, byte[] headerData, byte[] data, long pos) { + super(swf, id, name, headerData, data, pos); } public abstract int getCharacterId(); @@ -66,7 +66,7 @@ public abstract class CharacterIdTag extends Tag { if (getCharacterId() != -1) { return super.getName() + " (" + getCharacterId() + nameAppend + ")"; } - if (!nameAppend.equals("")) { + if (!nameAppend.isEmpty()) { return super.getName() + " (" + nameAppend + ")"; } return super.getName(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java index 6fec5ec82..2a47c76da 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java @@ -24,7 +24,7 @@ import com.jpexs.decompiler.flash.SWF; */ public abstract class CharacterTag extends CharacterIdTag { - public CharacterTag(SWF swf, int id, String name, byte[] data, long pos) { - super(swf, id, name, data, pos); + public CharacterTag(SWF swf, int id, String name, byte[] headerData, byte[] data, long pos) { + super(swf, id, name, headerData, data, pos); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java index 4e59ebd0b..7c9bf95cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -54,8 +54,8 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable protected final int previewSize = 500; - public FontTag(SWF swf, int id, String name, byte[] data, long pos) { - super(swf, id, name, data, pos); + public FontTag(SWF swf, int id, String name, byte[] headerData, byte[] data, long pos) { + super(swf, id, name, headerData, data, pos); } public abstract int getFontId(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ImageTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ImageTag.java index 4e4d5e085..5b6e160b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ImageTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ImageTag.java @@ -28,8 +28,8 @@ import java.io.InputStream; */ public abstract class ImageTag extends CharacterTag { - public ImageTag(SWF swf, int id, String name, byte[] data, long pos) { - super(swf, id, name, data, pos); + public ImageTag(SWF swf, int id, String name, byte[] headerData, byte[] data, long pos) { + super(swf, id, name, headerData, data, pos); } public abstract InputStream getImageData(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java index 1a319ed90..ca29f241c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java @@ -31,8 +31,8 @@ import java.awt.Shape; */ public abstract class ShapeTag extends CharacterTag implements BoundedTag, DrawableTag { - public ShapeTag(SWF swf, int id, String name, byte[] data, long pos) { - super(swf, id, name, data, pos); + public ShapeTag(SWF swf, int id, String name, byte[] headerData, byte[] data, long pos) { + super(swf, id, name, headerData, data, pos); } public abstract SHAPEWITHSTYLE getShapes(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index 16c608e0c..4801b5f1e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -59,8 +59,8 @@ import java.util.Map; */ public abstract class TextTag extends CharacterTag implements BoundedTag, DrawableTag { - public TextTag(SWF swf, int id, String name, byte[] data, long pos) { - super(swf, id, name, data, pos); + public TextTag(SWF swf, int id, String name, byte[] headerData, byte[] data, long pos) { + super(swf, id, name, headerData, data, pos); } public abstract MATRIX getTextMatrix(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java index d1fb6c884..19f2feb12 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java @@ -86,12 +86,13 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineCompactedFont(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineCompactedFont", data, pos); + public DefineCompactedFont(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineCompactedFont", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); fontId = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalGradient.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalGradient.java index 6bd675e5c..0ffee0cf5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalGradient.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalGradient.java @@ -67,12 +67,13 @@ public class DefineExternalGradient extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineExternalGradient(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineExternalGradient", data, pos); + public DefineExternalGradient(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineExternalGradient", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); gradientId = sis.readUI16(); bitmapsFormat = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage.java index 8ce4bb090..0fad5ed4f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage.java @@ -69,12 +69,13 @@ public class DefineExternalImage extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineExternalImage(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineExternalImage", data, pos); + public DefineExternalImage(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineExternalImage", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterId = sis.readUI16(); bitmapFormat = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage2.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage2.java index 532e81159..ac8394903 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage2.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage2.java @@ -77,12 +77,13 @@ public class DefineExternalImage2 extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineExternalImage2(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineExternalImage2", data, pos); + public DefineExternalImage2(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineExternalImage2", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterId = sis.readUI32(); bitmapFormat = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java index a6f1e06f4..dbc62d346 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java @@ -77,12 +77,13 @@ public class DefineExternalSound extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineExternalSound(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineExternalSound", data, pos); + public DefineExternalSound(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineExternalSound", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterId = sis.readUI16(); soundFormat = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java index e976b4b73..029172be3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java @@ -75,12 +75,13 @@ public class DefineExternalStreamSound extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineExternalStreamSound(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineExternalStreamSound", data, pos); + public DefineExternalStreamSound(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineExternalStreamSound", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); soundFormat = sis.readUI16(); bits = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineGradientMap.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineGradientMap.java index 5a9fe1f15..720504801 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineGradientMap.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineGradientMap.java @@ -59,12 +59,13 @@ public class DefineGradientMap extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineGradientMap(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineGradientMap", data, pos); + public DefineGradientMap(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineGradientMap", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); int numGradients = sis.readUI16(); indices = new int[numGradients]; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineSubImage.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineSubImage.java index ad3214943..4c23b0254 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineSubImage.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineSubImage.java @@ -66,12 +66,13 @@ public class DefineSubImage extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public DefineSubImage(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "DefineSubImage", data, pos); + public DefineSubImage(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "DefineSubImage", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); characterId = sis.readUI16(); imageCharacterId = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/ExporterInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/ExporterInfoTag.java index ab92734bc..516ba3b88 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/ExporterInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/ExporterInfoTag.java @@ -85,12 +85,13 @@ public class ExporterInfoTag extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public ExporterInfoTag(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "ExporterInfo", data, pos); + public ExporterInfoTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "ExporterInfo", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); this.version = sis.readUI16(); if (this.version >= 0x10a) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java index 539e997d2..31499cde7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java @@ -87,12 +87,13 @@ public class FontTextureInfo extends Tag { * Constructor * * @param swf + * @param headerData * @param data Data bytes * @param pos * @throws IOException */ - public FontTextureInfo(SWF swf, byte[] data, long pos) throws IOException { - super(swf, ID, "FontTextureInfo", data, pos); + public FontTextureInfo(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { + super(swf, ID, "FontTextureInfo", headerData, data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), swf.version); textureID = sis.readUI32(); textureFormat = sis.readUI16(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java b/trunk/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java index d1a49e133..86e0070c8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java @@ -657,7 +657,7 @@ public final class TextLexer { if (string != null) { String ret = string.toString(); string = null; - return new ParsedSymbol(SymbolType.TEXT, ret.toString()); + return new ParsedSymbol(SymbolType.TEXT, ret); } } case 21: diff --git a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionEvaluator.java b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionEvaluator.java index df89c4704..b5473cb23 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionEvaluator.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/annotations/parser/ConditionEvaluator.java @@ -103,7 +103,7 @@ public class ConditionEvaluator { } catch (IOException | EmptyStackException ex) { throw new ParseException("Invalid condition:" + prepareCond(), lex.yyline()); } - if (prepareCond().equals("")) { + if (prepareCond().isEmpty()) { return true; } if (stack.size() != 1) { diff --git a/trunk/src/com/jpexs/decompiler/graph/TypeItem.java b/trunk/src/com/jpexs/decompiler/graph/TypeItem.java index 7634dd637..da13f5ef5 100644 --- a/trunk/src/com/jpexs/decompiler/graph/TypeItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/TypeItem.java @@ -97,8 +97,8 @@ public class TypeItem extends GraphTargetItem{ String name = fullTypeName; String pkg = ""; if(name.contains(".")){ - pkg = name.substring(0,name.lastIndexOf(".")); - name = name.substring(name.lastIndexOf(".")+1); + pkg = name.substring(0,name.lastIndexOf('.')); + name = name.substring(name.lastIndexOf('.')+1); } for(InstanceInfo ii:abc.instance_info){ Multiname mname=abc.constants.constant_multiname.get(ii.name_index);