diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java index 258a6f6dd..a13c16192 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java @@ -379,7 +379,7 @@ public class SWFOutputStream extends OutputStream { int tagLength = data.length; int tagID = tag.getId(); int tagIDLength = (tagID << 6); - if ((tagLength < 0x3f) && (!tag.forceWriteAsLong)) { + if ((tagLength <= 62) && (!tag.forceWriteAsLong)) { tagIDLength += tagLength; sos.writeUI16(tagIDLength); } else { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/GFxDefineCompactedFont.java b/trunk/src/com/jpexs/decompiler/flash/tags/GFxDefineCompactedFont.java index 8dfa21db9..5d34a5b34 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/GFxDefineCompactedFont.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/GFxDefineCompactedFont.java @@ -105,7 +105,7 @@ public class GFxDefineCompactedFont extends FontTag implements DrawableTag { * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData(int version) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; SWFOutputStream sos = new SWFOutputStream(os, version); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/GFxDefineExternalImage2.java b/trunk/src/com/jpexs/decompiler/flash/tags/GFxDefineExternalImage2.java index d7f02ed96..f289bde6d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/GFxDefineExternalImage2.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/GFxDefineExternalImage2.java @@ -37,6 +37,7 @@ public class GFxDefineExternalImage2 extends Tag { public int targetWidth; public int targetHeight; public String fileName; + public byte[] extraData; //? public static final int BITMAP_FORMAT_DEFAULT = 0; public static final int BITMAP_FORMAT_TGA = 1; public static final int BITMAP_FORMAT_DDS = 2; @@ -60,6 +61,9 @@ public class GFxDefineExternalImage2 extends Tag { byte fileNameBytes[] = fileName.getBytes(); sos.writeUI8(fileNameBytes.length); sos.write(fileNameBytes); + if (extraData != null) { + sos.write(extraData); + } } catch (IOException e) { } return baos.toByteArray(); @@ -83,5 +87,8 @@ public class GFxDefineExternalImage2 extends Tag { targetHeight = sis.readUI16(); int fileNameLen = sis.readUI8(); fileName = new String(sis.readBytes(fileNameLen)); + if (sis.available() > 0) { + extraData = sis.readBytes(sis.available()); + } } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/GFxExporterInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/GFxExporterInfoTag.java index 6b05c9fe7..5bdaf413c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/GFxExporterInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/GFxExporterInfoTag.java @@ -23,6 +23,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; /** * @@ -39,6 +41,7 @@ public class GFxExporterInfoTag extends Tag { public int bitmapFormat; public byte[] prefix; public String swfName; + public List codeOffsets; public static final int BITMAP_FORMAT_TGA = 1; public static final int BITMAP_FORMAT_DDS = 2; public static final int FLAG_CONTAINS_GLYPH_TEXTURES = 1; @@ -57,8 +60,8 @@ public class GFxExporterInfoTag extends Tag { OutputStream os = baos; SWFOutputStream sos = new SWFOutputStream(os, version); try { - sos.writeUI16(version); - if (version >= 0x10a) { + sos.writeUI16(this.version); + if (this.version >= 0x10a) { sos.writeUI32(flags); } sos.writeUI16(bitmapFormat); @@ -67,6 +70,12 @@ public class GFxExporterInfoTag extends Tag { byte swfNameBytes[] = swfName.getBytes(); sos.writeUI8(swfNameBytes.length); sos.write(swfNameBytes); + if (codeOffsets != null) { + sos.writeUI16(codeOffsets.size()); + for (long l : codeOffsets) { + sos.writeUI32(l); + } + } } catch (IOException e) { } return baos.toByteArray(); @@ -84,8 +93,8 @@ public class GFxExporterInfoTag extends Tag { public GFxExporterInfoTag(SWF swf, byte[] data, int version, long pos) throws IOException { super(swf, ID, "ExporterInfo", data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); - version = sis.readUI16(); - if (version >= 0x10a) { + this.version = sis.readUI16(); + if (this.version >= 0x10a) { flags = sis.readUI32(); } bitmapFormat = sis.readUI16(); @@ -93,5 +102,13 @@ public class GFxExporterInfoTag extends Tag { prefix = sis.readBytes(prefixLen); int swfNameLen = sis.readUI8(); swfName = new String(sis.readBytes(swfNameLen)); + if (sis.available() > 0) // (version >= 0x401) //? + { + codeOffsets = new ArrayList<>(); + int numCodeOffsets = sis.readUI16(); + for (int i = 0; i < numCodeOffsets; i++) { + codeOffsets.add(sis.readUI32()); + } + } } }