Merge origin/master

Conflicts:
	src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java
This commit is contained in:
Jindra Petřík
2014-11-07 22:18:53 +01:00
61 changed files with 954 additions and 120 deletions
@@ -285,7 +285,36 @@ public final class SWF implements SWFContainerItem, Timelined {
return max + 1; return max + 1;
} }
public void fixCharactersOrder(boolean checkAll) {
Set<Integer> addedCharacterIds = new HashSet<>();
Set<CharacterTag> movedTags = new HashSet<>();
for (int i = 0; i < tags.size(); i++) {
Tag tag = tags.get(i);
if (checkAll || tag.isModified()) {
Set<Integer> needed = new HashSet<>();
tag.getNeededCharacters(needed);
for (Integer id : needed) {
if (!addedCharacterIds.contains(id)) {
CharacterTag neededCharacter = characters.get(id);
if (movedTags.contains(neededCharacter)) {
logger.log(Level.SEVERE, "Fixing characters order failed, recursion detected.");
return;
}
// move the needed character to the current position
tags.remove(neededCharacter);
tags.add(i, neededCharacter);
movedTags.add(neededCharacter);
}
}
}
if (tag instanceof CharacterTag) {
addedCharacterIds.add(((CharacterTag) tag).getCharacterId());
}
}
}
public void resetTimelines(Timelined timelined) { public void resetTimelines(Timelined timelined) {
timelined.getTimeline().reset(); timelined.getTimeline().reset();
for (Tag t : timelined.getTimeline().tags) { for (Tag t : timelined.getTimeline().tags) {
@@ -402,6 +431,8 @@ public final class SWF implements SWFContainerItem, Timelined {
*/ */
public void saveTo(OutputStream os, SWFCompression compression) throws IOException { public void saveTo(OutputStream os, SWFCompression compression) throws IOException {
try { try {
fixCharactersOrder(false);
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version); SWFOutputStream sos = new SWFOutputStream(baos, version);
sos.writeRECT(displayRect); sos.writeRECT(displayRect);
@@ -201,7 +201,7 @@ import com.jpexs.decompiler.flash.tags.gfx.DefineExternalSound;
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound; import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound;
import com.jpexs.decompiler.flash.tags.gfx.DefineGradientMap; import com.jpexs.decompiler.flash.tags.gfx.DefineGradientMap;
import com.jpexs.decompiler.flash.tags.gfx.DefineSubImage; import com.jpexs.decompiler.flash.tags.gfx.DefineSubImage;
import com.jpexs.decompiler.flash.tags.gfx.ExporterInfoTag; import com.jpexs.decompiler.flash.tags.gfx.ExporterInfo;
import com.jpexs.decompiler.flash.tags.gfx.FontTextureInfo; import com.jpexs.decompiler.flash.tags.gfx.FontTextureInfo;
import com.jpexs.decompiler.flash.timeline.Timelined; import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.decompiler.flash.types.ALPHABITMAPDATA; import com.jpexs.decompiler.flash.types.ALPHABITMAPDATA;
@@ -768,10 +768,12 @@ public class SWFInputStream implements AutoCloseable {
endDumpLevel(); endDumpLevel();
InflaterInputStream dis = new InflaterInputStream(new ByteArrayInputStream(data)); InflaterInputStream dis = new InflaterInputStream(new ByteArrayInputStream(data));
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (count > 0) {
byte[] buf = new byte[4096]; byte[] buf = new byte[4096];
int c = 0; int c = 0;
while ((c = dis.read(buf)) > 0) { while ((c = dis.read(buf)) > 0) {
baos.write(buf, 0, c); baos.write(buf, 0, c);
}
} }
return baos.toByteArray(); return baos.toByteArray();
} }
@@ -1365,7 +1367,7 @@ public class SWFInputStream implements AutoCloseable {
if (swf.gfx) { //GFX tags only in GFX files. There may be incorrect GFX tags in non GFX files if (swf.gfx) { //GFX tags only in GFX files. There may be incorrect GFX tags in non GFX files
switch (tag.getId()) { switch (tag.getId()) {
case 1000: case 1000:
ret = new ExporterInfoTag(sis, data); ret = new ExporterInfo(sis, data);
break; break;
case 1001: case 1001:
ret = new DefineExternalImage(sis, data); ret = new DefineExternalImage(sis, data);
@@ -28,6 +28,7 @@ import java.util.logging.Logger;
public class AVM2ConstantPool { public class AVM2ConstantPool {
private static final Logger logger = Logger.getLogger(AVM2ConstantPool.class.getName());
public List<Long> constant_int = new ArrayList<>(); public List<Long> constant_int = new ArrayList<>();
public List<Long> constant_uint = new ArrayList<>(); public List<Long> constant_uint = new ArrayList<>();
public List<Double> constant_double = new ArrayList<>(); public List<Double> constant_double = new ArrayList<>();
@@ -122,7 +123,7 @@ public class AVM2ConstantPool {
try { try {
return constant_int.get(index); return constant_int.get(index);
} catch (IndexOutOfBoundsException ex) { } catch (IndexOutOfBoundsException ex) {
Logger.getLogger(AVM2ConstantPool.class.getName()).log(Level.SEVERE, "Multiname not found. Index: " + index, ex); logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex);
} }
return 0; return 0;
} }
@@ -131,7 +132,7 @@ public class AVM2ConstantPool {
try { try {
return constant_namespace.get(index); return constant_namespace.get(index);
} catch (IndexOutOfBoundsException ex) { } catch (IndexOutOfBoundsException ex) {
Logger.getLogger(AVM2ConstantPool.class.getName()).log(Level.SEVERE, "Multiname not found. Index: " + index, ex); logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex);
} }
return null; return null;
} }
@@ -140,7 +141,7 @@ public class AVM2ConstantPool {
try { try {
return constant_namespace_set.get(index); return constant_namespace_set.get(index);
} catch (IndexOutOfBoundsException ex) { } catch (IndexOutOfBoundsException ex) {
Logger.getLogger(AVM2ConstantPool.class.getName()).log(Level.SEVERE, "Multiname not found. Index: " + index, ex); logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex);
} }
return null; return null;
} }
@@ -149,7 +150,7 @@ public class AVM2ConstantPool {
try { try {
return constant_multiname.get(index); return constant_multiname.get(index);
} catch (IndexOutOfBoundsException ex) { } catch (IndexOutOfBoundsException ex) {
Logger.getLogger(AVM2ConstantPool.class.getName()).log(Level.SEVERE, "Multiname not found. Index: " + index, ex); logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex);
} }
return null; return null;
} }
@@ -158,7 +159,7 @@ public class AVM2ConstantPool {
try { try {
return constant_uint.get(index); return constant_uint.get(index);
} catch (IndexOutOfBoundsException ex) { } catch (IndexOutOfBoundsException ex) {
Logger.getLogger(AVM2ConstantPool.class.getName()).log(Level.SEVERE, "Multiname not found. Index: " + index, ex); logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex);
} }
return 0; return 0;
} }
@@ -167,7 +168,7 @@ public class AVM2ConstantPool {
try { try {
return constant_double.get(index); return constant_double.get(index);
} catch (IndexOutOfBoundsException ex) { } catch (IndexOutOfBoundsException ex) {
Logger.getLogger(AVM2ConstantPool.class.getName()).log(Level.SEVERE, "Multiname not found. Index: " + index, ex); logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex);
} }
return 0; return 0;
} }
@@ -176,7 +177,7 @@ public class AVM2ConstantPool {
try { try {
return constant_decimal.get(index); return constant_decimal.get(index);
} catch (IndexOutOfBoundsException ex) { } catch (IndexOutOfBoundsException ex) {
Logger.getLogger(AVM2ConstantPool.class.getName()).log(Level.SEVERE, "Multiname not found. Index: " + index, ex); logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex);
} }
return null; return null;
} }
@@ -185,7 +186,7 @@ public class AVM2ConstantPool {
try { try {
return constant_string.get(index); return constant_string.get(index);
} catch (IndexOutOfBoundsException ex) { } catch (IndexOutOfBoundsException ex) {
Logger.getLogger(AVM2ConstantPool.class.getName()).log(Level.SEVERE, "Multiname not found. Index: " + index, ex); logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex);
} }
return null; return null;
} }
@@ -713,7 +713,7 @@ public class Action implements GraphSourceItem {
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
throw ex; throw ex;
} catch (Exception | OutOfMemoryError | StackOverflowError ex) { } catch (Exception | OutOfMemoryError | StackOverflowError ex) {
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error in: " + path, ex); logger.log(Level.SEVERE, "Decompilation error in: " + path, ex);
convertException = ex; convertException = ex;
Throwable cause = ex.getCause(); Throwable cause = ex.getCause();
if (ex instanceof ExecutionException && cause instanceof Exception) { if (ex instanceof ExecutionException && cause instanceof Exception) {
@@ -728,10 +728,10 @@ public class Action implements GraphSourceItem {
if (convertException == null) { if (convertException == null) {
Graph.graphToString(tree, writer, new LocalData()); Graph.graphToString(tree, writer, new LocalData());
} else if (convertException instanceof TimeoutException) { } else if (convertException instanceof TimeoutException) {
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error in: " + path, convertException); logger.log(Level.SEVERE, "Decompilation error in: " + path, convertException);
Helper.appendTimeoutComment(writer, timeout); Helper.appendTimeoutComment(writer, timeout);
} else { } else {
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error in: " + path, convertException); logger.log(Level.SEVERE, "Decompilation error in: " + path, convertException);
Helper.appendErrorComment(writer, convertException); Helper.appendErrorComment(writer, convertException);
} }
if (asm != null) { if (asm != null) {
@@ -871,7 +871,7 @@ public class Action implements GraphSourceItem {
try { try {
out = ActionGraph.translateViaGraph(cnt.getRegNames(), variables2, functions, actions.subList(adr2ip(actions, endAddr), adr2ip(actions, endAddr + size)), version, staticOperation, path + (cntName == null ? "" : "/" + cntName)); out = ActionGraph.translateViaGraph(cnt.getRegNames(), variables2, functions, actions.subList(adr2ip(actions, endAddr), adr2ip(actions, endAddr + size)), version, staticOperation, path + (cntName == null ? "" : "/" + cntName));
} catch (OutOfMemoryError | TranslateException | StackOverflowError ex2) { } catch (OutOfMemoryError | TranslateException | StackOverflowError ex2) {
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error in: " + path, ex2); logger.log(Level.SEVERE, "Decompilation error in: " + path, ex2);
if (ex2 instanceof OutOfMemoryError) { if (ex2 instanceof OutOfMemoryError) {
Helper.freeMem(); Helper.freeMem();
} }
@@ -1004,7 +1004,7 @@ public class Action implements GraphSourceItem {
try { try {
action.translate(localData, stack, output, staticOperation, path); action.translate(localData, stack, output, staticOperation, path);
} catch (EmptyStackException ese) { } catch (EmptyStackException ese) {
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error in: " + path, ese); logger.log(Level.SEVERE, "Decompilation error in: " + path, ese);
output.add(new UnsupportedActionItem(action, "Empty stack")); output.add(new UnsupportedActionItem(action, "Empty stack"));
} }
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -81,6 +83,14 @@ public class CSMTextSettingsTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public CSMTextSettingsTag(SWF swf) {
super(swf, ID, "CSMTextSettings", null);
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -54,6 +56,15 @@ public class DebugIDTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public DebugIDTag(SWF swf) {
super(swf, ID, "DebugID", null);
debugId = new byte[16];
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -56,6 +58,15 @@ public class DefineButtonCxformTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public DefineButtonCxformTag(SWF swf) {
super(swf, ID, "DefineButtonCxform", null);
buttonColorTransform = new CXFORM();
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
@@ -96,6 +98,14 @@ public class DefineButtonSoundTag extends CharacterIdTag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public DefineButtonSoundTag(SWF swf) {
super(swf, ID, "DefineButtonSound", null);
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -42,6 +44,15 @@ public class DefineFontAlignZonesTag extends Tag {
public List<ZONERECORD> zoneTable; public List<ZONERECORD> zoneTable;
public static final int ID = 73; public static final int ID = 73;
/**
* Constructor
* @param swf
*/
public DefineFontAlignZonesTag(SWF swf) {
super(swf, ID, "DefineFontAlignZones", null);
zoneTable = new ArrayList<>();
}
public DefineFontAlignZonesTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public DefineFontAlignZonesTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFontAlignZones", data); super(sis.getSwf(), ID, "DefineFontAlignZones", data);
fontID = sis.readUI16("fontID"); fontID = sis.readUI16("fontID");
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -26,6 +28,7 @@ import com.jpexs.helpers.utf8.Utf8Helper;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.AbstractList;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -85,6 +88,17 @@ public class DefineFontInfo2Tag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public DefineFontInfo2Tag(SWF swf) {
super(swf, ID, "DefineFontInfo2", null);
fontName = "New Font Info Name";
languageCode = new LANGCODE();
codeTable = new ArrayList<>();
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -86,6 +88,16 @@ public class DefineFontInfoTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public DefineFontInfoTag(SWF swf) {
super(swf, ID, "DefineFontInfo", null);
fontName = "New Font Info Name";
codeTable = new ArrayList<>();
}
/** /**
* Constructor * Constructor
* *
@@ -110,12 +122,12 @@ public class DefineFontInfoTag extends Tag {
fontFlagsBold = sis.readUB(1, "fontFlagsBold") == 1; fontFlagsBold = sis.readUB(1, "fontFlagsBold") == 1;
fontFlagsWideCodes = sis.readUB(1, "fontFlagsWideCodes") == 1; fontFlagsWideCodes = sis.readUB(1, "fontFlagsWideCodes") == 1;
codeTable = new ArrayList<>(); codeTable = new ArrayList<>();
do { while (sis.available() > 0) {
if (fontFlagsWideCodes) { if (fontFlagsWideCodes) {
codeTable.add(sis.readUI16("code")); codeTable.add(sis.readUI16("code"));
} else { } else {
codeTable.add(sis.readUI8("code")); codeTable.add(sis.readUI8("code"));
} }
} while (sis.available() > 0); }
} }
} }
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -32,6 +34,16 @@ public class DefineFontNameTag extends Tag {
public String fontCopyright; public String fontCopyright;
public static final int ID = 88; public static final int ID = 88;
/**
* Constructor
* @param swf
*/
public DefineFontNameTag(SWF swf) {
super(swf, ID, "DefineFontName", null);
fontName = "New Font Name";
fontCopyright = "Copyright text";
}
public DefineFontNameTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public DefineFontNameTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineFontName", data); super(sis.getSwf(), ID, "DefineFontName", data);
fontId = sis.readUI16("fontId"); fontId = sis.readUI16("fontId");
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -35,6 +37,15 @@ public class DefineScalingGridTag extends Tag {
public RECT splitter; public RECT splitter;
public static final int ID = 78; public static final int ID = 78;
/**
* Constructor
* @param swf
*/
public DefineScalingGridTag(SWF swf) {
super(swf, ID, "DefineScalingGrid", null);
splitter = new RECT();
}
public DefineScalingGridTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public DefineScalingGridTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "DefineScalingGrid", data); super(sis.getSwf(), ID, "DefineScalingGrid", data);
characterId = sis.readUI16("characterId"); characterId = sis.readUI16("characterId");
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -75,6 +77,18 @@ public class DefineSceneAndFrameLabelDataTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public DefineSceneAndFrameLabelDataTag(SWF swf) {
super(swf, ID, "DefineSceneAndFrameLabelData", null);
sceneOffsets = new long[0];
sceneNames = new String[0];
frameNums= new long[0];
frameNames = new String[0];
}
/** /**
* Constructor * Constructor
* *
@@ -65,6 +65,16 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag {
return "DoABCDefine (" + name + ")"; return "DoABCDefine (" + name + ")";
} }
/**
* Constructor
* @param swf
*/
public DoABCDefineTag(SWF swf) {
super(swf, ID, "DoABCDefine", null);
name = "New DoABC";
abc = new ABC(swf);
}
/** /**
* Constructor * Constructor
* *
@@ -52,6 +52,15 @@ public class DoABCTag extends Tag implements ABCContainerTag {
return "DoABC"; return "DoABC";
} }
/**
* Constructor
* @param swf
*/
public DoABCTag(SWF swf) {
super(swf, ID, "DoABC", null);
abc = new ABC(swf);
}
/** /**
* Constructor * Constructor
* *
@@ -48,6 +48,14 @@ public class DoActionTag extends Tag implements ASMSource {
public ByteArrayRange actionBytes; public ByteArrayRange actionBytes;
public static final int ID = 12; public static final int ID = 12;
/**
* Constructor
* @param swf
*/
public DoActionTag(SWF swf) {
super(swf, ID, "DoAction", null);
}
/** /**
* Constructor * Constructor
* *
@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.DisassemblyListener; import com.jpexs.decompiler.flash.DisassemblyListener;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.Action;
@@ -53,6 +54,14 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
public ByteArrayRange actionBytes; public ByteArrayRange actionBytes;
public static final int ID = 59; public static final int ID = 59;
/**
* Constructor
* @param swf
*/
public DoInitActionTag(SWF swf) {
super(swf, ID, "DoInitAction", null);
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -61,6 +63,15 @@ public class EnableDebugger2Tag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public EnableDebugger2Tag(SWF swf) {
super(swf, ID, "EnableDebugger2", null);
passwordHash = "PasswordHash";
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.helpers.ByteArrayRange; import com.jpexs.helpers.ByteArrayRange;
@@ -55,6 +57,15 @@ public class EnableDebuggerTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public EnableDebuggerTag(SWF swf) {
super(swf, ID, "EnableDebugger", null);
passwordHash = "PasswordHash";
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -64,6 +66,15 @@ public class EnableTelemetryTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public EnableTelemetryTag(SWF swf) {
super(swf, ID, "EnableTelemetry", null);
passwordHash = new byte[32];
}
/** /**
* Constructor * Constructor
* *
@@ -12,7 +12,8 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWF;
@@ -38,6 +39,14 @@ public class EndTag extends Tag {
public static final int ID = 0; public static final int ID = 0;
/**
* Constructor
* @param swf
*/
public EndTag(SWF swf) {
super(swf, ID, "End", null);
}
/** /**
* Constructor * Constructor
* *
@@ -49,8 +58,4 @@ public class EndTag extends Tag {
super(swf, ID, "End", data); super(swf, ID, "End", data);
} }
public EndTag(SWF swf) {
super(swf, ID, "End", null);
}
} }
@@ -12,7 +12,8 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWF;
@@ -46,6 +47,10 @@ public class ExportAssetsTag extends Tag {
public List<String> names; public List<String> names;
public static final int ID = 56; public static final int ID = 56;
/**
* Constructor
* @param swf
*/
public ExportAssetsTag(SWF swf) { public ExportAssetsTag(SWF swf) {
super(swf, ID, "ExportAssets", null); super(swf, ID, "ExportAssets", null);
tags = new ArrayList<>(); tags = new ArrayList<>();
@@ -12,7 +12,8 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWF;
@@ -44,6 +45,10 @@ public class FileAttributesTag extends Tag {
public int reserved3; public int reserved3;
public static final int ID = 69; public static final int ID = 69;
/**
* Constructor
* @param swf
*/
public FileAttributesTag(SWF swf) { public FileAttributesTag(SWF swf) {
super(swf, ID, "FileAttributes", null); super(swf, ID, "FileAttributes", null);
} }
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.helpers.ByteArrayRange; import com.jpexs.helpers.ByteArrayRange;
@@ -36,6 +38,15 @@ public class FrameLabelTag extends Tag {
return namedAnchor; return namedAnchor;
} }
/**
* Constructor
* @param swf
*/
public FrameLabelTag(SWF swf) {
super(swf, ID, "FrameLabel", null);
name = "New frame label";
}
public FrameLabelTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public FrameLabelTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "FrameLabel", data); super(sis.getSwf(), ID, "FrameLabel", data);
name = sis.readString("name"); name = sis.readString("name");
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.tags.base.ImportTag; import com.jpexs.decompiler.flash.tags.base.ImportTag;
@@ -55,6 +57,16 @@ public class ImportAssets2Tag extends Tag implements ImportTag {
public List<String> names; public List<String> names;
public static final int ID = 71; public static final int ID = 71;
/**
* Constructor
* @param swf
*/
public ImportAssets2Tag(SWF swf) {
super(swf, ID, "ImportAssets2", null);
url = "";
tags = new ArrayList<>();
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.tags.base.ImportTag; import com.jpexs.decompiler.flash.tags.base.ImportTag;
@@ -48,6 +50,16 @@ public class ImportAssetsTag extends Tag implements ImportTag {
public List<String> names; public List<String> names;
public static final int ID = 57; public static final int ID = 57;
/**
* Constructor
* @param swf
*/
public ImportAssetsTag(SWF swf) {
super(swf, ID, "ImportAssets", null);
url = "";
tags = new ArrayList<>();
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.annotations.Internal; import com.jpexs.decompiler.flash.types.annotations.Internal;
@@ -29,6 +31,15 @@ public class JPEGTablesTag extends Tag {
@Internal @Internal
public byte[] jpegData; public byte[] jpegData;
/**
* Constructor
* @param swf
*/
public JPEGTablesTag(SWF swf) {
super(swf, ID, "JPEGTables", null);
jpegData = new byte[0];
}
public JPEGTablesTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public JPEGTablesTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "JPEGTables", data); super(sis.getSwf(), ID, "JPEGTables", data);
jpegData = sis.readBytesEx(sis.available(), "jpegData"); jpegData = sis.readBytesEx(sis.available(), "jpegData");
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.annotations.Multiline; import com.jpexs.decompiler.flash.types.annotations.Multiline;
@@ -29,6 +31,15 @@ public class MetadataTag extends Tag {
public String xmlMetadata; public String xmlMetadata;
public static final int ID = 77; public static final int ID = 77;
/**
* Constructor
* @param swf
*/
public MetadataTag(SWF swf) {
super(swf, ID, "Metadata", null);
xmlMetadata = "";
}
public MetadataTag(SWFInputStream sis, ByteArrayRange data) { public MetadataTag(SWFInputStream sis, ByteArrayRange data) {
super(sis.getSwf(), ID, "Metadata", data); super(sis.getSwf(), ID, "Metadata", data);
try { try {
@@ -12,7 +12,8 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWF;
@@ -191,6 +192,14 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public PlaceObject2Tag(SWF swf) {
super(swf, ID, "PlaceObject2", null);
}
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) { 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); super(swf, ID, "PlaceObject2", null);
this.placeFlagHasClipActions = placeFlagHasClipActions; this.placeFlagHasClipActions = placeFlagHasClipActions;
@@ -12,10 +12,12 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.EndOfStreamException; import com.jpexs.decompiler.flash.EndOfStreamException;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream;
@@ -295,6 +297,14 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public PlaceObject3Tag(SWF swf) {
super(swf, ID, "PlaceObject3", null);
}
/** /**
* Constructor * Constructor
* *
@@ -12,10 +12,12 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.EndOfStreamException; import com.jpexs.decompiler.flash.EndOfStreamException;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream;
@@ -297,6 +299,14 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public PlaceObject4Tag(SWF swf) {
super(swf, ID, "PlaceObject4", null);
}
/** /**
* Constructor * Constructor
* *
@@ -12,7 +12,8 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWF;
@@ -97,6 +98,15 @@ public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public PlaceObjectTag(SWF swf) {
super(swf, ID, "PlaceObject", null);
matrix = new MATRIX();
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -44,6 +46,14 @@ public class ProductInfoTag extends Tag {
public long compilationDateHigh; public long compilationDateHigh;
public static final int ID = 41; public static final int ID = 41;
/**
* Constructor
* @param swf
*/
public ProductInfoTag(SWF swf) {
super(swf, ID, "ProductInfo", null);
}
public ProductInfoTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public ProductInfoTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "ProductInfo", data); super(sis.getSwf(), ID, "ProductInfo", data);
/* /*
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.helpers.ByteArrayRange; import com.jpexs.helpers.ByteArrayRange;
@@ -55,6 +57,15 @@ public class ProtectTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public ProtectTag(SWF swf) {
super(swf, ID, "Protect", null);
passwordHash = "";
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.tags.base.RemoveTag; import com.jpexs.decompiler.flash.tags.base.RemoveTag;
@@ -31,6 +33,14 @@ public class RemoveObject2Tag extends Tag implements RemoveTag {
public int depth; public int depth;
public static final int ID = 28; public static final int ID = 28;
/**
* Constructor
* @param swf
*/
public RemoveObject2Tag(SWF swf) {
super(swf, ID, "RemoveObject2", null);
}
public RemoveObject2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException { public RemoveObject2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "RemoveObject2", data); super(sis.getSwf(), ID, "RemoveObject2", data);
depth = sis.readUI16("depth"); depth = sis.readUI16("depth");
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
@@ -64,6 +66,15 @@ public class RemoveObjectTag extends CharacterIdTag implements RemoveTag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public RemoveObjectTag(SWF swf) {
super(swf, ID, "RemoveObject", null);
characterId = swf.getNextCharacterId();
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -34,6 +36,14 @@ public class ScriptLimitsTag extends Tag {
public static final int ID = 65; public static final int ID = 65;
/**
* Constructor
* @param swf
*/
public ScriptLimitsTag(SWF swf) {
super(swf, ID, "ScriptLimits", null);
}
public ScriptLimitsTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public ScriptLimitsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "ScriptLimits", data); super(sis.getSwf(), ID, "ScriptLimits", data);
maxRecursionDepth = sis.readUI16("maxRecursionDepth"); maxRecursionDepth = sis.readUI16("maxRecursionDepth");
@@ -12,7 +12,8 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWF;
@@ -28,6 +29,15 @@ public class SetBackgroundColorTag extends Tag {
public RGB backgroundColor; public RGB backgroundColor;
public static final int ID = 9; public static final int ID = 9;
/**
* Constructor
* @param swf
*/
public SetBackgroundColorTag(SWF swf) {
super(swf, ID, "SetBackgroundColor", null);
backgroundColor = new RGB();
}
public SetBackgroundColorTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public SetBackgroundColorTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "SetBackgroundColor", data); super(sis.getSwf(), ID, "SetBackgroundColor", data);
backgroundColor = sis.readRGB("backgroundColor"); backgroundColor = sis.readRGB("backgroundColor");
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -62,6 +64,14 @@ public class SetTabIndexTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public SetTabIndexTag(SWF swf) {
super(swf, ID, "SetTabIndex", null);
}
/** /**
* Constructor * Constructor
* *
@@ -12,7 +12,8 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWF;
@@ -47,6 +48,14 @@ public class ShowFrameTag extends Tag {
} }
}; };
/**
* Constructor
* @param swf
*/
public ShowFrameTag(SWF swf) {
super(swf, ID, "ShowFrame", null);
}
/** /**
* Constructor * Constructor
* *
@@ -57,10 +66,6 @@ public class ShowFrameTag extends Tag {
super(swf, ID, "ShowFrame", data); super(swf, ID, "ShowFrame", data);
} }
public ShowFrameTag(SWF swf) {
super(swf, ID, "ShowFrame", null);
}
/** /**
* Gets data bytes * Gets data bytes
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.annotations.Internal; import com.jpexs.decompiler.flash.types.annotations.Internal;
@@ -35,6 +37,15 @@ public class SoundStreamBlockTag extends Tag {
@Internal @Internal
public byte[] streamSoundData; public byte[] streamSoundData;
/**
* Constructor
* @param swf
*/
public SoundStreamBlockTag(SWF swf) {
super(swf, ID, "SoundStreamBlock", null);
streamSoundData = new byte[0];
}
/** /**
* Constructor * Constructor
* *
@@ -181,12 +181,12 @@ public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHea
return streamSoundType; return streamSoundType;
} }
public static void populateSoundStreamBlocks(int containerId, List<? extends ContainerItem> tags, Tag head, List<SoundStreamBlockTag> output) { public static void populateSoundStreamBlocks(int containerId, List<? extends ContainerItem> tags, SoundStreamHeadTypeTag head, List<SoundStreamBlockTag> output) {
boolean found = false; boolean found = false;
for (ContainerItem t : tags) { for (ContainerItem t : tags) {
if (t == head) { if (t == head) {
found = true; found = true;
((SoundStreamHeadTypeTag) head).setVirtualCharacterId(containerId); head.setVirtualCharacterId(containerId);
continue; continue;
} }
if (t instanceof Container) { if (t instanceof Container) {
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.SOUNDINFO; import com.jpexs.decompiler.flash.types.SOUNDINFO;
@@ -44,13 +46,25 @@ public class StartSound2Tag extends Tag {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos; OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, getVersion()); SWFOutputStream sos = new SWFOutputStream(os, getVersion());
/*try { try {
//sos.write sos.writeString(soundClassName);
} catch (IOException e) { sos.writeSOUNDINFO(soundInfo);
}*/ } catch (IOException e) {
throw new Error("This should never happen.", e);
}
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public StartSound2Tag(SWF swf) {
super(swf, ID, "StartSound2", null);
soundClassName = "NewSoundClass";
soundInfo = new SOUNDINFO();
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -56,6 +58,15 @@ public class StartSoundTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public StartSoundTag(SWF swf) {
super(swf, ID, "StartSound", null);
soundInfo = new SOUNDINFO();
}
/** /**
* Constructor * Constructor
* *
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -34,6 +36,16 @@ public class SymbolClassTag extends Tag {
public String[] names; public String[] names;
public static final int ID = 76; public static final int ID = 76;
/**
* Constructor
* @param swf
*/
public SymbolClassTag(SWF swf) {
super(swf, ID, "SymbolClass", null);
tags = new int[0];
names = new String[0];
}
public SymbolClassTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public SymbolClassTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "SymbolClass", data); super(sis.getSwf(), ID, "SymbolClass", data);
int numSymbols = sis.readUI16("numSymbols"); int numSymbols = sis.readUI16("numSymbols");
@@ -29,7 +29,7 @@ import com.jpexs.decompiler.flash.tags.gfx.DefineExternalSound;
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound; import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound;
import com.jpexs.decompiler.flash.tags.gfx.DefineGradientMap; import com.jpexs.decompiler.flash.tags.gfx.DefineGradientMap;
import com.jpexs.decompiler.flash.tags.gfx.DefineSubImage; import com.jpexs.decompiler.flash.tags.gfx.DefineSubImage;
import com.jpexs.decompiler.flash.tags.gfx.ExporterInfoTag; import com.jpexs.decompiler.flash.tags.gfx.ExporterInfo;
import com.jpexs.decompiler.flash.tags.gfx.FontTextureInfo; import com.jpexs.decompiler.flash.tags.gfx.FontTextureInfo;
import com.jpexs.decompiler.flash.timeline.Timelined; import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.decompiler.flash.types.annotations.Internal; import com.jpexs.decompiler.flash.types.annotations.Internal;
@@ -216,7 +216,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem,
DefineExternalStreamSound.ID, DefineExternalStreamSound.ID,
DefineGradientMap.ID, DefineGradientMap.ID,
DefineSubImage.ID, DefineSubImage.ID,
ExporterInfoTag.ID, ExporterInfo.ID,
FontTextureInfo.ID); FontTextureInfo.ID);
knownTagIds = tagIds; knownTagIds = tagIds;
} }
@@ -12,9 +12,11 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags; package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.BasicType;
@@ -58,6 +60,15 @@ public class VideoFrameTag extends Tag {
return baos.toByteArray(); return baos.toByteArray();
} }
/**
* Constructor
* @param swf
*/
public VideoFrameTag(SWF swf) {
super(swf, ID, "VideoFrame", null);
videoData = new byte[0];
}
/** /**
* Constructor * Constructor
* *
@@ -12,7 +12,8 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.decompiler.flash.tags.gfx; package com.jpexs.decompiler.flash.tags.gfx;
import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFInputStream;
@@ -30,7 +31,7 @@ import java.util.List;
* *
* @author JPEXS * @author JPEXS
*/ */
public class ExporterInfoTag extends Tag { public class ExporterInfo extends Tag {
public static final int ID = 1000; public static final int ID = 1000;
//Version (1.10 will be encoded as 0x10A) //Version (1.10 will be encoded as 0x10A)
@@ -87,7 +88,7 @@ public class ExporterInfoTag extends Tag {
* @param data * @param data
* @throws IOException * @throws IOException
*/ */
public ExporterInfoTag(SWFInputStream sis, ByteArrayRange data) throws IOException { public ExporterInfo(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, "ExporterInfo", data); super(sis.getSwf(), ID, "ExporterInfo", data);
this.version = sis.readUI16("version"); this.version = sis.readUI16("version");
if (this.version >= 0x10a) { if (this.version >= 0x10a) {
@@ -548,7 +548,7 @@ public class Timeline {
return true; return true;
} }
private boolean isSingleFrame(int frame) { public boolean isSingleFrame(int frame) {
Frame frameObj = frames.get(frame); Frame frameObj = frames.get(frame);
int maxDepth = getMaxDepthInternal(); int maxDepth = getMaxDepthInternal();
for (int i = 1; i <= maxDepth; i++) { for (int i = 1; i <= maxDepth; i++) {
@@ -41,6 +41,8 @@ public class SHAPE implements NeedsCharacters, Serializable {
public int numLineBits; public int numLineBits;
public List<SHAPERECORD> shapeRecords; public List<SHAPERECORD> shapeRecords;
private Shape cachedOutline;
@Override @Override
public void getNeededCharacters(Set<Integer> needed) { public void getNeededCharacters(Set<Integer> needed) {
for (SHAPERECORD r : shapeRecords) { for (SHAPERECORD r : shapeRecords) {
@@ -62,12 +64,17 @@ public class SHAPE implements NeedsCharacters, Serializable {
} }
public Shape getOutline() { public Shape getOutline() {
if (cachedOutline != null) {
return cachedOutline;
}
List<GeneralPath> paths = PathExporter.export(this); List<GeneralPath> paths = PathExporter.export(this);
Area area = new Area(); Area area = new Area();
for (GeneralPath path : paths) { for (GeneralPath path : paths) {
area.add(new Area(path)); area.add(new Area(path));
} }
cachedOutline = area;
return area; return area;
} }
@@ -12,7 +12,8 @@
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. */ * License along with this library.
*/
package com.jpexs.helpers; package com.jpexs.helpers;
import com.jpexs.helpers.streams.SeekableInputStream; import com.jpexs.helpers.streams.SeekableInputStream;
@@ -40,7 +41,7 @@ public class MemoryInputStream extends SeekableInputStream {
public MemoryInputStream(byte[] buffer, int startPos, int maxLength) throws IOException { public MemoryInputStream(byte[] buffer, int startPos, int maxLength) throws IOException {
this.buffer = buffer; this.buffer = buffer;
this.startPos = startPos; this.startPos = startPos;
if (startPos >= buffer.length) { if (startPos > buffer.length) {
throw new IOException("Invalid startPos"); throw new IOException("Invalid startPos");
} }
this.maxLength = maxLength; this.maxLength = maxLength;
@@ -159,12 +159,11 @@ public class ExportDialog extends AppDialog {
cnt.setLayout(new BorderLayout()); cnt.setLayout(new BorderLayout());
JPanel comboPanel = new JPanel(null); JPanel comboPanel = new JPanel(null);
combos = new JComboBox[optionNames.length]; combos = new JComboBox[optionNames.length];
JLabel[] labels = new JLabel[optionNames.length];
int labWidth = 0; int labWidth = 0;
for (int i = 0; i < optionNames.length; i++) { for (int i = 0; i < optionNames.length; i++) {
labels[i] = new JLabel(optionNames[i]); JLabel label = new JLabel(optionNames[i]);
if (labels[i].getPreferredSize().width > labWidth) { if (label.getPreferredSize().width > labWidth) {
labWidth = labels[i].getPreferredSize().width; labWidth = label.getPreferredSize().width;
} }
} }
String exportFormatsStr = Configuration.lastSelectedExportFormats.get(); String exportFormatsStr = Configuration.lastSelectedExportFormats.get();
@@ -406,7 +406,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
} }
@Override @Override
public void zoomToFit() { public double getZoomToFit() {
if (timelined instanceof BoundedTag) { if (timelined instanceof BoundedTag) {
RECT bounds = ((BoundedTag) timelined).getRect(new HashSet<BoundedTag>()); RECT bounds = ((BoundedTag) timelined).getRect(new HashSet<BoundedTag>());
double w1 = bounds.getWidth() / SWF.unitDivisor; double w1 = bounds.getWidth() / SWF.unitDivisor;
@@ -424,8 +424,10 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
} else { } else {
w = w2; w = w2;
} }
zoom = (double) w / (double) w1; return (double) w / (double) w1;
} }
return 1;
} }
public void setImage(byte[] data) { public void setImage(byte[] data) {
@@ -592,7 +594,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
img = image; img = image;
} }
if (drawable.getTimeline().isSingleFrame()) { if (drawable.getTimeline().isSingleFrame(frame)) {
SWF.putToCache(key, img); SWF.putToCache(key, img);
} }
} }
@@ -2610,6 +2610,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
} }
return new RECT(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE); return new RECT(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE);
} }
@Override
public int hashCode() {
return tag.hashCode();
}
}; };
} }
} }
@@ -207,7 +207,8 @@ public class SoundTagPlayer implements MediaDisplay {
} }
@Override @Override
public void zoomToFit() { public double getZoomToFit() {
return 1;
} }
@Override @Override
@@ -58,8 +58,9 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
} }
@Override @Override
public void zoomToFit() { public double getZoomToFit() {
//TODO //TODO
return 1;
} }
@Override @Override
@@ -53,7 +53,7 @@ public interface MediaDisplay {
public boolean zoomAvailable(); public boolean zoomAvailable();
public void zoomToFit(); public double getZoomToFit();
public double getZoom(); public double getZoom();
} }
@@ -316,8 +316,8 @@ public class PlayerControls extends JPanel implements ActionListener {
updateZoom(); updateZoom();
break; break;
case ACTION_ZOOMFIT: case ACTION_ZOOMFIT:
display.zoomToFit(); realZoom = display.getZoomToFit();
//updateZoom(); updateZoom();
break; break;
case ACTION_SNAPSHOT: case ACTION_SNAPSHOT:
putImageToClipBoard(display.printScreen()); putImageToClipBoard(display.printScreen());
@@ -0,0 +1,205 @@
/*
* Copyright (C) 2010-2014 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.tagtree;
import com.jpexs.decompiler.flash.tags.CSMTextSettingsTag;
import com.jpexs.decompiler.flash.tags.DebugIDTag;
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag;
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag;
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG4Tag;
import com.jpexs.decompiler.flash.tags.DefineBitsLossless2Tag;
import com.jpexs.decompiler.flash.tags.DefineBitsLosslessTag;
import com.jpexs.decompiler.flash.tags.DefineBitsTag;
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
import com.jpexs.decompiler.flash.tags.DefineButtonCxformTag;
import com.jpexs.decompiler.flash.tags.DefineButtonSoundTag;
import com.jpexs.decompiler.flash.tags.DefineButtonTag;
import com.jpexs.decompiler.flash.tags.DefineEditTextTag;
import com.jpexs.decompiler.flash.tags.DefineFont2Tag;
import com.jpexs.decompiler.flash.tags.DefineFont3Tag;
import com.jpexs.decompiler.flash.tags.DefineFont4Tag;
import com.jpexs.decompiler.flash.tags.DefineFontAlignZonesTag;
import com.jpexs.decompiler.flash.tags.DefineFontInfo2Tag;
import com.jpexs.decompiler.flash.tags.DefineFontInfoTag;
import com.jpexs.decompiler.flash.tags.DefineFontNameTag;
import com.jpexs.decompiler.flash.tags.DefineFontTag;
import com.jpexs.decompiler.flash.tags.DefineMorphShape2Tag;
import com.jpexs.decompiler.flash.tags.DefineMorphShapeTag;
import com.jpexs.decompiler.flash.tags.DefineScalingGridTag;
import com.jpexs.decompiler.flash.tags.DefineSceneAndFrameLabelDataTag;
import com.jpexs.decompiler.flash.tags.DefineShape2Tag;
import com.jpexs.decompiler.flash.tags.DefineShape3Tag;
import com.jpexs.decompiler.flash.tags.DefineShape4Tag;
import com.jpexs.decompiler.flash.tags.DefineShapeTag;
import com.jpexs.decompiler.flash.tags.DefineSoundTag;
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
import com.jpexs.decompiler.flash.tags.DefineText2Tag;
import com.jpexs.decompiler.flash.tags.DefineTextTag;
import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag;
import com.jpexs.decompiler.flash.tags.DoABCDefineTag;
import com.jpexs.decompiler.flash.tags.DoABCTag;
import com.jpexs.decompiler.flash.tags.DoActionTag;
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
import com.jpexs.decompiler.flash.tags.EnableDebugger2Tag;
import com.jpexs.decompiler.flash.tags.EnableDebuggerTag;
import com.jpexs.decompiler.flash.tags.EnableTelemetryTag;
import com.jpexs.decompiler.flash.tags.EndTag;
import com.jpexs.decompiler.flash.tags.ExportAssetsTag;
import com.jpexs.decompiler.flash.tags.FileAttributesTag;
import com.jpexs.decompiler.flash.tags.FrameLabelTag;
import com.jpexs.decompiler.flash.tags.ImportAssets2Tag;
import com.jpexs.decompiler.flash.tags.ImportAssetsTag;
import com.jpexs.decompiler.flash.tags.JPEGTablesTag;
import com.jpexs.decompiler.flash.tags.MetadataTag;
import com.jpexs.decompiler.flash.tags.PlaceObject2Tag;
import com.jpexs.decompiler.flash.tags.PlaceObject3Tag;
import com.jpexs.decompiler.flash.tags.PlaceObject4Tag;
import com.jpexs.decompiler.flash.tags.PlaceObjectTag;
import com.jpexs.decompiler.flash.tags.ProductInfoTag;
import com.jpexs.decompiler.flash.tags.ProtectTag;
import com.jpexs.decompiler.flash.tags.RemoveObject2Tag;
import com.jpexs.decompiler.flash.tags.RemoveObjectTag;
import com.jpexs.decompiler.flash.tags.ScriptLimitsTag;
import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
import com.jpexs.decompiler.flash.tags.SetTabIndexTag;
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
import com.jpexs.decompiler.flash.tags.SoundStreamBlockTag;
import com.jpexs.decompiler.flash.tags.SoundStreamHead2Tag;
import com.jpexs.decompiler.flash.tags.SoundStreamHeadTag;
import com.jpexs.decompiler.flash.tags.StartSound2Tag;
import com.jpexs.decompiler.flash.tags.StartSoundTag;
import com.jpexs.decompiler.flash.tags.SymbolClassTag;
import com.jpexs.decompiler.flash.tags.VideoFrameTag;
import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalGradient;
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalImage;
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalImage2;
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalSound;
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound;
import com.jpexs.decompiler.flash.tags.gfx.DefineGradientMap;
import com.jpexs.decompiler.flash.tags.gfx.DefineSubImage;
import com.jpexs.decompiler.flash.tags.gfx.ExporterInfo;
import com.jpexs.decompiler.flash.tags.gfx.FontTextureInfo;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author JPEXS
*/
public class TagIdClassMap {
private static final Map<Integer, Class> tagIdClassMap = new HashMap<>();
private static final Map<Class, Integer> classTagIdMap = new HashMap<>();
static {
addTag(CSMTextSettingsTag.ID, CSMTextSettingsTag.class);
addTag(DebugIDTag.ID, DebugIDTag.class);
addTag(DefineBinaryDataTag.ID, DefineBinaryDataTag.class);
addTag(DefineBitsJPEG2Tag.ID, DefineBitsJPEG2Tag.class);
addTag(DefineBitsJPEG3Tag.ID, DefineBitsJPEG3Tag.class);
addTag(DefineBitsJPEG4Tag.ID, DefineBitsJPEG4Tag.class);
addTag(DefineBitsLossless2Tag.ID, DefineBitsLossless2Tag.class);
addTag(DefineBitsLosslessTag.ID, DefineBitsLosslessTag.class);
addTag(DefineBitsTag.ID, DefineBitsTag.class);
addTag(DefineButton2Tag.ID, DefineButton2Tag.class);
addTag(DefineButtonCxformTag.ID, DefineButtonCxformTag.class);
addTag(DefineButtonSoundTag.ID, DefineButtonSoundTag.class);
addTag(DefineButtonTag.ID, DefineButtonTag.class);
addTag(DefineEditTextTag.ID, DefineEditTextTag.class);
addTag(DefineFont2Tag.ID, DefineFont2Tag.class);
addTag(DefineFont3Tag.ID, DefineFont3Tag.class);
addTag(DefineFont4Tag.ID, DefineFont4Tag.class);
addTag(DefineFontAlignZonesTag.ID, DefineFontAlignZonesTag.class);
addTag(DefineFontInfo2Tag.ID, DefineFontInfo2Tag.class);
addTag(DefineFontInfoTag.ID, DefineFontInfoTag.class);
addTag(DefineFontNameTag.ID, DefineFontNameTag.class);
addTag(DefineFontTag.ID, DefineFontTag.class);
addTag(DefineMorphShape2Tag.ID, DefineMorphShape2Tag.class);
addTag(DefineMorphShapeTag.ID, DefineMorphShapeTag.class);
addTag(DefineScalingGridTag.ID, DefineScalingGridTag.class);
addTag(DefineSceneAndFrameLabelDataTag.ID, DefineSceneAndFrameLabelDataTag.class);
addTag(DefineShape2Tag.ID, DefineShape2Tag.class);
addTag(DefineShape3Tag.ID, DefineShape3Tag.class);
addTag(DefineShape4Tag.ID, DefineShape4Tag.class);
addTag(DefineShapeTag.ID, DefineShapeTag.class);
addTag(DefineSoundTag.ID, DefineSoundTag.class);
addTag(DefineSpriteTag.ID, DefineSpriteTag.class);
addTag(DefineText2Tag.ID, DefineText2Tag.class);
addTag(DefineTextTag.ID, DefineTextTag.class);
addTag(DefineVideoStreamTag.ID, DefineVideoStreamTag.class);
addTag(DoABCDefineTag.ID, DoABCDefineTag.class);
addTag(DoABCTag.ID, DoABCTag.class);
addTag(DoActionTag.ID, DoActionTag.class);
addTag(DoInitActionTag.ID, DoInitActionTag.class);
addTag(EnableDebugger2Tag.ID, EnableDebugger2Tag.class);
addTag(EnableDebuggerTag.ID, EnableDebuggerTag.class);
addTag(EnableTelemetryTag.ID, EnableTelemetryTag.class);
addTag(EndTag.ID, EndTag.class);
addTag(ExportAssetsTag.ID, ExportAssetsTag.class);
addTag(FileAttributesTag.ID, FileAttributesTag.class);
addTag(FrameLabelTag.ID, FrameLabelTag.class);
addTag(ImportAssets2Tag.ID, ImportAssets2Tag.class);
addTag(ImportAssetsTag.ID, ImportAssetsTag.class);
addTag(JPEGTablesTag.ID, JPEGTablesTag.class);
addTag(MetadataTag.ID, MetadataTag.class);
addTag(PlaceObject2Tag.ID, PlaceObject2Tag.class);
addTag(PlaceObject3Tag.ID, PlaceObject3Tag.class);
addTag(PlaceObject4Tag.ID, PlaceObject4Tag.class);
addTag(PlaceObjectTag.ID, PlaceObjectTag.class);
addTag(ProductInfoTag.ID, ProductInfoTag.class);
addTag(ProtectTag.ID, ProtectTag.class);
addTag(RemoveObject2Tag.ID, RemoveObject2Tag.class);
addTag(RemoveObjectTag.ID, RemoveObjectTag.class);
addTag(ScriptLimitsTag.ID, ScriptLimitsTag.class);
addTag(SetBackgroundColorTag.ID, SetBackgroundColorTag.class);
addTag(SetTabIndexTag.ID, SetTabIndexTag.class);
addTag(ShowFrameTag.ID, ShowFrameTag.class);
addTag(SoundStreamBlockTag.ID, SoundStreamBlockTag.class);
addTag(SoundStreamHead2Tag.ID, SoundStreamHead2Tag.class);
addTag(SoundStreamHeadTag.ID, SoundStreamHeadTag.class);
addTag(StartSound2Tag.ID, StartSound2Tag.class);
addTag(StartSoundTag.ID, StartSoundTag.class);
addTag(SymbolClassTag.ID, SymbolClassTag.class);
addTag(VideoFrameTag.ID, VideoFrameTag.class);
addTag(DefineCompactedFont.ID, DefineCompactedFont.class);
addTag(DefineExternalGradient.ID, DefineExternalGradient.class);
addTag(DefineExternalImage.ID, DefineExternalImage.class);
addTag(DefineExternalImage2.ID, DefineExternalImage2.class);
addTag(DefineExternalSound.ID, DefineExternalSound.class);
addTag(DefineExternalStreamSound.ID, DefineExternalStreamSound.class);
addTag(DefineGradientMap.ID, DefineGradientMap.class);
addTag(DefineSubImage.ID, DefineSubImage.class);
addTag(ExporterInfo.ID, ExporterInfo.class);
addTag(FontTextureInfo.ID, FontTextureInfo.class);
}
private static void addTag(int tagId, Class cl) {
tagIdClassMap.put(tagId, cl);
classTagIdMap.put(cl, tagId);
}
public static Class getClassByTagId(int tagId) {
return tagIdClassMap.get(tagId);
}
public static Integer getTagIdByClass(Class cl) {
return classTagIdMap.get(cl);
}
}
@@ -25,6 +25,8 @@ import com.jpexs.decompiler.flash.gui.MainFrameRibbonMenu;
import com.jpexs.decompiler.flash.gui.MainPanel; import com.jpexs.decompiler.flash.gui.MainPanel;
import com.jpexs.decompiler.flash.gui.TreeNodeType; import com.jpexs.decompiler.flash.gui.TreeNodeType;
import com.jpexs.decompiler.flash.gui.View; import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.tags.CSMTextSettingsTag;
import com.jpexs.decompiler.flash.tags.DebugIDTag;
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag; import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag;
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag;
@@ -33,14 +35,22 @@ import com.jpexs.decompiler.flash.tags.DefineBitsLossless2Tag;
import com.jpexs.decompiler.flash.tags.DefineBitsLosslessTag; import com.jpexs.decompiler.flash.tags.DefineBitsLosslessTag;
import com.jpexs.decompiler.flash.tags.DefineBitsTag; import com.jpexs.decompiler.flash.tags.DefineBitsTag;
import com.jpexs.decompiler.flash.tags.DefineButton2Tag; import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
import com.jpexs.decompiler.flash.tags.DefineButtonCxformTag;
import com.jpexs.decompiler.flash.tags.DefineButtonSoundTag;
import com.jpexs.decompiler.flash.tags.DefineButtonTag; import com.jpexs.decompiler.flash.tags.DefineButtonTag;
import com.jpexs.decompiler.flash.tags.DefineEditTextTag; import com.jpexs.decompiler.flash.tags.DefineEditTextTag;
import com.jpexs.decompiler.flash.tags.DefineFont2Tag; import com.jpexs.decompiler.flash.tags.DefineFont2Tag;
import com.jpexs.decompiler.flash.tags.DefineFont3Tag; import com.jpexs.decompiler.flash.tags.DefineFont3Tag;
import com.jpexs.decompiler.flash.tags.DefineFont4Tag; import com.jpexs.decompiler.flash.tags.DefineFont4Tag;
import com.jpexs.decompiler.flash.tags.DefineFontAlignZonesTag;
import com.jpexs.decompiler.flash.tags.DefineFontInfo2Tag;
import com.jpexs.decompiler.flash.tags.DefineFontInfoTag;
import com.jpexs.decompiler.flash.tags.DefineFontNameTag;
import com.jpexs.decompiler.flash.tags.DefineFontTag; import com.jpexs.decompiler.flash.tags.DefineFontTag;
import com.jpexs.decompiler.flash.tags.DefineMorphShape2Tag; import com.jpexs.decompiler.flash.tags.DefineMorphShape2Tag;
import com.jpexs.decompiler.flash.tags.DefineMorphShapeTag; import com.jpexs.decompiler.flash.tags.DefineMorphShapeTag;
import com.jpexs.decompiler.flash.tags.DefineScalingGridTag;
import com.jpexs.decompiler.flash.tags.DefineSceneAndFrameLabelDataTag;
import com.jpexs.decompiler.flash.tags.DefineShape2Tag; import com.jpexs.decompiler.flash.tags.DefineShape2Tag;
import com.jpexs.decompiler.flash.tags.DefineShape3Tag; import com.jpexs.decompiler.flash.tags.DefineShape3Tag;
import com.jpexs.decompiler.flash.tags.DefineShape4Tag; import com.jpexs.decompiler.flash.tags.DefineShape4Tag;
@@ -50,10 +60,40 @@ import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
import com.jpexs.decompiler.flash.tags.DefineText2Tag; import com.jpexs.decompiler.flash.tags.DefineText2Tag;
import com.jpexs.decompiler.flash.tags.DefineTextTag; import com.jpexs.decompiler.flash.tags.DefineTextTag;
import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag; import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag;
import com.jpexs.decompiler.flash.tags.DoABCDefineTag;
import com.jpexs.decompiler.flash.tags.DoABCTag;
import com.jpexs.decompiler.flash.tags.DoActionTag;
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
import com.jpexs.decompiler.flash.tags.EnableDebugger2Tag;
import com.jpexs.decompiler.flash.tags.EnableDebuggerTag;
import com.jpexs.decompiler.flash.tags.EnableTelemetryTag;
import com.jpexs.decompiler.flash.tags.ExportAssetsTag;
import com.jpexs.decompiler.flash.tags.FileAttributesTag;
import com.jpexs.decompiler.flash.tags.FrameLabelTag;
import com.jpexs.decompiler.flash.tags.ImportAssets2Tag;
import com.jpexs.decompiler.flash.tags.ImportAssetsTag;
import com.jpexs.decompiler.flash.tags.JPEGTablesTag;
import com.jpexs.decompiler.flash.tags.MetadataTag;
import com.jpexs.decompiler.flash.tags.PlaceObject2Tag;
import com.jpexs.decompiler.flash.tags.PlaceObject3Tag;
import com.jpexs.decompiler.flash.tags.PlaceObject4Tag;
import com.jpexs.decompiler.flash.tags.PlaceObjectTag;
import com.jpexs.decompiler.flash.tags.ProductInfoTag;
import com.jpexs.decompiler.flash.tags.ProtectTag;
import com.jpexs.decompiler.flash.tags.RemoveObject2Tag;
import com.jpexs.decompiler.flash.tags.RemoveObjectTag;
import com.jpexs.decompiler.flash.tags.ScriptLimitsTag;
import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
import com.jpexs.decompiler.flash.tags.SetTabIndexTag;
import com.jpexs.decompiler.flash.tags.ShowFrameTag; import com.jpexs.decompiler.flash.tags.ShowFrameTag;
import com.jpexs.decompiler.flash.tags.SoundStreamBlockTag;
import com.jpexs.decompiler.flash.tags.SoundStreamHead2Tag; import com.jpexs.decompiler.flash.tags.SoundStreamHead2Tag;
import com.jpexs.decompiler.flash.tags.SoundStreamHeadTag; import com.jpexs.decompiler.flash.tags.SoundStreamHeadTag;
import com.jpexs.decompiler.flash.tags.StartSound2Tag;
import com.jpexs.decompiler.flash.tags.StartSoundTag;
import com.jpexs.decompiler.flash.tags.SymbolClassTag;
import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.VideoFrameTag;
import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.tags.base.ButtonTag; import com.jpexs.decompiler.flash.tags.base.ButtonTag;
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
@@ -69,6 +109,7 @@ import com.jpexs.decompiler.flash.timeline.AS3Package;
import com.jpexs.decompiler.flash.timeline.Frame; import com.jpexs.decompiler.flash.timeline.Frame;
import com.jpexs.decompiler.flash.timeline.FrameScript; import com.jpexs.decompiler.flash.timeline.FrameScript;
import com.jpexs.decompiler.flash.timeline.TagScript; import com.jpexs.decompiler.flash.timeline.TagScript;
import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.decompiler.flash.treeitems.AS3ClassTreeItem; import com.jpexs.decompiler.flash.treeitems.AS3ClassTreeItem;
import com.jpexs.decompiler.flash.treeitems.FolderItem; import com.jpexs.decompiler.flash.treeitems.FolderItem;
import com.jpexs.decompiler.flash.treeitems.HeaderItem; import com.jpexs.decompiler.flash.treeitems.HeaderItem;
@@ -308,66 +349,69 @@ public class TagTree extends JTree implements ActionListener {
return TreeNodeType.FOLDER; return TreeNodeType.FOLDER;
} }
public List<Class> getTreeItemClasses(String folderName, boolean gfx) { public List<Integer> getSwfFolderItemNestedTagIds(String folderName, boolean gfx) {
List<Class> ret = null; List<Integer> ret = null;
switch (folderName) { switch (folderName) {
case TagTreeModel.FOLDER_SHAPES: case TagTreeModel.FOLDER_SHAPES:
ret = Arrays.asList((Class) DefineShapeTag.class, DefineShape2Tag.class, DefineShape3Tag.class, DefineShape4Tag.class); ret = Arrays.asList(DefineShapeTag.ID, DefineShape2Tag.ID, DefineShape3Tag.ID, DefineShape4Tag.ID);
break; break;
case TagTreeModel.FOLDER_MORPHSHAPES: case TagTreeModel.FOLDER_MORPHSHAPES:
ret = Arrays.asList((Class) DefineMorphShapeTag.class, DefineMorphShape2Tag.class); ret = Arrays.asList(DefineMorphShapeTag.ID, DefineMorphShape2Tag.ID);
break; break;
case TagTreeModel.FOLDER_SPRITES: case TagTreeModel.FOLDER_SPRITES:
ret = Arrays.asList((Class) DefineSpriteTag.class); ret = Arrays.asList(DefineSpriteTag.ID);
break; break;
case TagTreeModel.FOLDER_TEXTS: case TagTreeModel.FOLDER_TEXTS:
ret = Arrays.asList((Class) DefineTextTag.class, DefineText2Tag.class, DefineEditTextTag.class); ret = Arrays.asList(DefineTextTag.ID, DefineText2Tag.ID, DefineEditTextTag.ID);
break; break;
case TagTreeModel.FOLDER_IMAGES: case TagTreeModel.FOLDER_IMAGES:
ret = Arrays.asList((Class) DefineBitsTag.class, DefineBitsJPEG2Tag.class, DefineBitsJPEG3Tag.class, DefineBitsJPEG4Tag.class, DefineBitsLosslessTag.class, DefineBitsLossless2Tag.class); ret = Arrays.asList(DefineBitsTag.ID, DefineBitsJPEG2Tag.ID, DefineBitsJPEG3Tag.ID, DefineBitsJPEG4Tag.ID, DefineBitsLosslessTag.ID, DefineBitsLossless2Tag.ID);
break; break;
case TagTreeModel.FOLDER_MOVIES: case TagTreeModel.FOLDER_MOVIES:
ret = Arrays.asList((Class) DefineVideoStreamTag.class); ret = Arrays.asList(DefineVideoStreamTag.ID);
break; break;
case TagTreeModel.FOLDER_SOUNDS: case TagTreeModel.FOLDER_SOUNDS:
ret = Arrays.asList((Class) DefineSoundTag.class, SoundStreamHeadTag.class, SoundStreamHead2Tag.class); ret = Arrays.asList(DefineSoundTag.ID);
break; break;
case TagTreeModel.FOLDER_BUTTONS: case TagTreeModel.FOLDER_BUTTONS:
ret = Arrays.asList((Class) DefineButtonTag.class, DefineButton2Tag.class); ret = Arrays.asList(DefineButtonTag.ID, DefineButton2Tag.ID);
break; break;
case TagTreeModel.FOLDER_FONTS: case TagTreeModel.FOLDER_FONTS:
ret = Arrays.asList((Class) DefineFontTag.class, DefineFont2Tag.class, DefineFont3Tag.class, DefineFont4Tag.class); ret = Arrays.asList(DefineFontTag.ID, DefineFont2Tag.ID, DefineFont3Tag.ID, DefineFont4Tag.ID);
if (gfx) { if (gfx) {
ret.add(DefineCompactedFont.class); ret.add(DefineCompactedFont.ID);
} }
break; break;
case TagTreeModel.FOLDER_BINARY_DATA: case TagTreeModel.FOLDER_BINARY_DATA:
ret = Arrays.asList((Class) DefineBinaryDataTag.class); ret = Arrays.asList(DefineBinaryDataTag.ID);
break; break;
case TagTreeModel.FOLDER_FRAMES: case TagTreeModel.FOLDER_FRAMES:
ret = new ArrayList<>(); ret = new ArrayList<>();
break; break;
case TagTreeModel.FOLDER_OTHERS: case TagTreeModel.FOLDER_OTHERS:
ret = new ArrayList<>(); ret = Arrays.asList(CSMTextSettingsTag.ID, DebugIDTag.ID, DefineButtonCxformTag.ID, DefineButtonSoundTag.ID,
DefineFontAlignZonesTag.ID, DefineFontInfoTag.ID, DefineFontInfo2Tag.ID, DefineFontNameTag.ID,
DefineScalingGridTag.ID, DefineSceneAndFrameLabelDataTag.ID,
DoABCDefineTag.ID, DoABCTag.ID, DoActionTag.ID, DoInitActionTag.ID,
EnableDebuggerTag.ID, EnableDebugger2Tag.ID, EnableTelemetryTag.ID,
ExportAssetsTag.ID, FileAttributesTag.ID, ImportAssetsTag.ID, ImportAssets2Tag.ID,
JPEGTablesTag.ID, MetadataTag.ID, ProductInfoTag.ID, ProtectTag.ID, ScriptLimitsTag.ID,
SetBackgroundColorTag.ID, SetTabIndexTag.ID, SymbolClassTag.ID);
break; break;
} }
return ret; return ret;
} }
JMenuItem expandRecursiveMenuItem; public List<Integer> getSpriteNestedTagIds() {
JMenuItem removeMenuItem; return Arrays.asList(PlaceObjectTag.ID, PlaceObject2Tag.ID, PlaceObject3Tag.ID, PlaceObject4Tag.ID,
JMenuItem removeWithDependenciesMenuItem; RemoveObjectTag.ID, RemoveObject2Tag.ID, ShowFrameTag.ID, FrameLabelTag.ID,
JMenuItem exportSelectionMenuItem; StartSoundTag.ID, StartSound2Tag.ID, VideoFrameTag.ID,
JMenuItem replaceSelectionMenuItem; SoundStreamBlockTag.ID, SoundStreamHeadTag.ID, SoundStreamHead2Tag.ID);
JMenuItem rawEditMenuItem; }
JMenuItem jumpToCharacterMenuItem;
JMenuItem closeSelectionMenuItem; public void createContextMenu(final List<SWFList> swfs) {
JMenu addTagMenu; final JPopupMenu contextPopupMenu = new JPopupMenu();
JMenu moveTagMenu;
JMenuItem openSWFInsideTagMenuItem;
public JPopupMenu contextPopupMenu;
public List<SWFList> swfs;
public void createContextMenu(final List<SWFList> swfs) { public void createContextMenu(final List<SWFList> swfs) {
this.swfs = swfs; this.swfs = swfs;
@@ -457,6 +501,108 @@ public class TagTree extends JTree implements ActionListener {
openSWFInsideTagMenuItem.setVisible(false); openSWFInsideTagMenuItem.setVisible(false);
if (paths.length == 1) { if (paths.length == 1) {
final TreeItem item = (TreeItem) paths[0].getLastPathComponent();
if (item instanceof ImageTag && ((ImageTag) item).importSupported()) {
replaceSelectionMenuItem.setVisible(true);
}
if (item instanceof DefineBinaryDataTag) {
replaceSelectionMenuItem.setVisible(true);
DefineBinaryDataTag bin = (DefineBinaryDataTag) item;
if (bin.binaryData.length > 8) {
String signature = new String(bin.binaryData, 0, 3, Utf8Helper.charset);
if (Arrays.asList(
"FWS", //Uncompressed Flash
"CWS", //ZLib compressed Flash
"ZWS", //LZMA compressed Flash
"GFX", //Uncompressed ScaleForm GFx
"CFX" //Compressed ScaleForm GFx
).contains(signature)) {
openSWFInsideTagMenuItem.setVisible(true);
}
}
}
if (item instanceof DefineSoundTag) {
replaceSelectionMenuItem.setVisible(true);
}
if (item instanceof SWF) {
closeSelectionMenuItem.setVisible(true);
}
List<Integer> allowedTagTypes = null;
if (item instanceof FolderItem) {
allowedTagTypes = getSwfFolderItemNestedTagIds(((FolderItem) item).getName(), item.getSwf().gfx);
} else if (item instanceof DefineSpriteTag) {
allowedTagTypes = getSpriteNestedTagIds();
}
addTagMenu.removeAll();
if (allowedTagTypes != null) {
for (Integer tagId : allowedTagTypes) {
final Class cl = TagIdClassMap.getClassByTagId(tagId);
JMenuItem tagItem = new JMenuItem(cl.getSimpleName());
tagItem.addActionListener(new ActionListener() {
@Override
@SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent ae) {
try {
SWF swf = item.getSwf();
Tag t = (Tag) cl.getDeclaredConstructor(SWF.class).newInstance(new Object[]{swf});
boolean isDefineSprite = item instanceof DefineSpriteTag;
Timelined timelined = isDefineSprite ? (DefineSpriteTag) item : swf;
t.setTimelined(timelined);
if (isDefineSprite) {
((DefineSpriteTag) item).subTags.add(t);
} else {
swf.tags.add(t);
}
timelined.getTimeline().reset();
swf.updateCharacters();
mainPanel.refreshTree();
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException ex) {
Logger.getLogger(TagTree.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
addTagMenu.add(tagItem);
}
addTagMenu.setVisible(true);
}
if (item instanceof Tag && swfs.size() > 1) {
final Tag tag = (Tag) item;
moveTagMenu.removeAll();
for (SWFList targetSwfList : swfs) {
for (final SWF targetSwf : targetSwfList) {
if (targetSwf != tag.getSwf()) {
JMenuItem swfItem = new JMenuItem(targetSwf.getShortFileName());
swfItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
tag.getSwf().tags.remove(tag);
tag.setSwf(targetSwf);
targetSwf.tags.add(tag);
mainPanel.refreshTree();
}
});
moveTagMenu.add(swfItem);
}
}
}
moveTagMenu.setVisible(true);
}
TreeModel model = getModel();
expandRecursiveMenuItem.setVisible(model.getChildCount(item) > 0);
jumpToCharacterMenuItem.setVisible(item instanceof CharacterIdTag && !(item instanceof CharacterTag));
rawEditMenuItem.setVisible(item instanceof Tag);
TreeItem item = (TreeItem) paths[0].getLastPathComponent(); TreeItem item = (TreeItem) paths[0].getLastPathComponent();
List<TreeItem> li = new ArrayList<>(); List<TreeItem> li = new ArrayList<>();
li.add(item); li.add(item);