allow adding tag to main timeline

tagtree:remove unnecessary tree parameter 
binary export: use .swf extension for swf files
export:select export types fixed when inner swf is selected
debug menu:create new swf
check all tags when debugcopy is enabled
This commit is contained in:
honfika@gmail.com
2015-12-05 07:48:34 +01:00
parent 9a323a1355
commit 531e687821
9 changed files with 67 additions and 60 deletions

View File

@@ -956,7 +956,8 @@ public final class SWF implements SWFContainerItem, Timelined {
* Constructs an empty SWF
*/
public SWF() {
version = SWF.DEFAULT_VERSION;
displayRect = new RECT(0, 1, 0, 1);
}
/**
@@ -1099,7 +1100,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
}
getASMs(true); // Add scriptNames to ASMs
getASMs(true); // Add scriptNames to ASMs
}
@Override

View File

@@ -60,16 +60,18 @@ public class BinaryDataExporter {
int currentIndex = 1;
for (final Tag t : tags) {
if (t instanceof DefineBinaryDataTag) {
DefineBinaryDataTag bdt = (DefineBinaryDataTag) t;
if (evl != null) {
evl.handleExportingEvent("binarydata", currentIndex, count, t.getName());
}
int characterID = ((DefineBinaryDataTag) t).getCharacterId();
int characterID = bdt.getCharacterId();
final File file = new File(outdir + File.separator + characterID + ".bin");
String ext = bdt.innerSwf == null ? ".bin" : ".swf";
final File file = new File(outdir + File.separator + characterID + ext);
new RetryTask(() -> {
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
fos.write(((DefineBinaryDataTag) t).binaryData.getRangeData());
fos.write(bdt.binaryData.getRangeData());
}
}, handler).run();

View File

@@ -400,7 +400,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
* @throws IOException
*/
public void writeTag(SWFOutputStream sos) throws IOException {
if (isModified()) {
if (Configuration.debugCopy.get() || isModified()) {
byte[] newData = getData();
byte[] newHeaderData = getHeader(newData.length);
sos.write(newHeaderData);
@@ -463,16 +463,9 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
if (Configuration.debugCopy.get()) {
// todo: honfika: why only the following tags?
if (this instanceof DefineSpriteTag
|| this instanceof DefineButtonTag || this instanceof DefineButton2Tag
|| this instanceof DefineFont3Tag
|| this instanceof DoABCTag || this instanceof DoABC2Tag
|| this instanceof PlaceObject2Tag || this instanceof PlaceObject3Tag || this instanceof PlaceObject4Tag) {
byte[] originalData = getOriginalData();
if (originalData != null) {
os = new CopyOutputStream(os, new ByteArrayInputStream(getOriginalData()));
}
byte[] originalData = getOriginalData();
if (originalData != null) {
os = new CopyOutputStream(os, new ByteArrayInputStream(getOriginalData()));
}
}