diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 96da9fe18..ccda3d9d8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -345,6 +345,7 @@ public final class SWF implements TreeItem { * @param listener * @param parallelRead Use parallel threads? * @param checkOnly Check only file validity + * @param skipTagReading * @throws IOException * @throws java.lang.InterruptedException */ @@ -439,7 +440,7 @@ public final class SWF implements TreeItem { } else { boolean hasNonUnknownTag = false; for (Tag tag : tags) { - if (tag.getData(version).length > 0 && Tag.getRequiredTags().contains(tag.getId())) { + if (tag.getData().length > 0 && Tag.getRequiredTags().contains(tag.getId())) { hasNonUnknownTag = true; } } @@ -1110,13 +1111,13 @@ public final class SWF implements TreeItem { if ((shead.getSoundFormat() == DefineSoundTag.FORMAT_ADPCM) && wave) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (int b = 0; b < blocks.size(); b++) { - byte[] data = blocks.get(b).getData(SWF.DEFAULT_VERSION); + byte[] data = blocks.get(b).getData(); baos.write(data); } createWavFromAdpcm(fos, shead.getSoundRate(), shead.getSoundSize(), shead.getSoundType(), baos.toByteArray()); } else if ((shead.getSoundFormat() == DefineSoundTag.FORMAT_MP3) && mp3) { for (int b = 0; b < blocks.size(); b++) { - byte[] data = blocks.get(b).getData(SWF.DEFAULT_VERSION); + byte[] data = blocks.get(b).getData(); fos.write(data, 4, data.length - 4); } } else { @@ -1125,7 +1126,7 @@ public final class SWF implements TreeItem { int ms = (int) (1000.0f / ((float) frameRate)); for (int b = 0; b < blocks.size(); b++) { - byte[] data = blocks.get(b).getData(SWF.DEFAULT_VERSION); + byte[] data = blocks.get(b).getData(); if (shead.getSoundFormat() == 2) { //MP3 data = Arrays.copyOfRange(data, 4, data.length); } @@ -1249,7 +1250,7 @@ public final class SWF implements TreeItem { if ((shead.getSoundFormat() == DefineSoundTag.FORMAT_ADPCM) && wave) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (int b = 0; b < blocks.size(); b++) { - byte data[] = blocks.get(b).getData(SWF.DEFAULT_VERSION); + byte data[] = blocks.get(b).getData(); baos.write(data); } final File file = new File(outdir + File.separator + id + ".wav"); @@ -1270,7 +1271,7 @@ public final class SWF implements TreeItem { public void run() throws IOException { try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) { for (int b = 0; b < blocks.size(); b++) { - byte data[] = blocks.get(b).getData(SWF.DEFAULT_VERSION); + byte data[] = blocks.get(b).getData(); os.write(data, 2, data.length - 2); } } @@ -1288,7 +1289,7 @@ public final class SWF implements TreeItem { int ms = (int) (1000.0f / ((float) frameRate)); for (int b = 0; b < blocks.size(); b++) { - byte data[] = blocks.get(b).getData(SWF.DEFAULT_VERSION); + byte data[] = blocks.get(b).getData(); if (shead.getSoundFormat() == 2) { //MP3 data = Arrays.copyOfRange(data, 4, data.length); } @@ -1330,7 +1331,7 @@ public final class SWF implements TreeItem { if ((videoStream.codecID == DefineVideoStreamTag.CODEC_VP6) || (videoStream.codecID == DefineVideoStreamTag.CODEC_VP6_ALPHA)) { - SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(tag.videoData), SWF.DEFAULT_VERSION); + SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(tag.videoData), version); if (videoStream.codecID == DefineVideoStreamTag.CODEC_VP6_ALPHA) { sis.readUI24(); //offsetToAlpha } @@ -1359,12 +1360,12 @@ public final class SWF implements TreeItem { } - SWFOutputStream sos = new SWFOutputStream(baos, SWF.DEFAULT_VERSION); + SWFOutputStream sos = new SWFOutputStream(baos, version); sos.writeUB(4, horizontalAdjustment); sos.writeUB(4, verticalAdjustment); } if (videoStream.codecID == DefineVideoStreamTag.CODEC_SORENSON_H263) { - SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(tag.videoData), SWF.DEFAULT_VERSION); + SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(tag.videoData), version); sis.readUB(17);//pictureStartCode sis.readUB(5); //version sis.readUB(8); //temporalReference @@ -1751,7 +1752,7 @@ public final class SWF implements TreeItem { private List> getVariables(List> variables, List functions, HashMap strings, HashMap usageType, ASMSource src, String path) throws InterruptedException { List> ret = new ArrayList<>(); - List actions = src.getActions(version); + List actions = src.getActions(); actionsMap.put(src, actions); getVariables(variables, functions, strings, usageType, new ActionGraphSource(actions, version, new HashMap(), new HashMap(), new HashMap()), 0, path); return ret; @@ -1875,7 +1876,7 @@ public final class SWF implements TreeItem { int staticOperation = Graph.SOP_USE_STATIC; //(Boolean) Configuration.getConfig("autoDeobfuscate", true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC; List dec; try { - dec = Action.actionsToTree(dia.getActions(version), version, staticOperation, ""/*FIXME*/); + dec = Action.actionsToTree(dia.getActions(), version, staticOperation, ""/*FIXME*/); } catch (EmptyStackException ex) { continue; } @@ -2059,7 +2060,7 @@ public final class SWF implements TreeItem { } for (ASMSource src : actionsMap.keySet()) { actionsMap.put(src, Action.removeNops(0, actionsMap.get(src), version, 0, ""/*FIXME path*/)); - src.setActions(actionsMap.get(src), version); + src.setActions(actionsMap.get(src)); } deobfuscation.deobfuscateInstanceNames(deobfuscated, renameType, tags, selected); return ret; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index c2fcd20d8..0a7293a48 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -790,7 +790,7 @@ public class SWFInputStream extends InputStream { sb.append(" len="); sb.append(Helper.formatInt((int) tag.getOrigDataLength(), 8)); sb.append(" "); - sb.append(Helper.bytesToHexString(64, tag.getData(version), 0)); + sb.append(Helper.bytesToHexString(64, tag.getData(), 0)); out.println(sb.toString()); // out.println(Utils.formatHex((int)tag.getPos(), 8) + ": " + Utils.indent(level, "") + Utils.format(tag.toString(), 25 - 2*level) + " tagId="+tag.getId()+" len="+tag.getOrigDataLength()+": "+Utils.bytesToHexString(64, tag.getData(version), 0)); if (tag.hasSubTags()) { @@ -951,7 +951,7 @@ public class SWFInputStream extends InputStream { public static Tag resolveTag(SWF swf, Tag tag, int version, int level, boolean parallel, boolean skipUnusualTags, boolean gfx) throws InterruptedException { Tag ret; - byte[] data = tag.getData(version); + byte[] data = tag.getData(); long pos = tag.getPos(); try { switch (tag.getId()) { @@ -1265,7 +1265,7 @@ public class SWFInputStream extends InputStream { byte[] data = readBytes((int) tagLength); Tag ret = new Tag(swf, tagID, "Unresolved", data, pos); ret.forceWriteAsLong = readLong; - byte[] dataNew = ret.getData(version); + byte[] dataNew = ret.getData(); int ignoreFirst = 0; for (int i = 0; i < data.length; i++) { diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java index cb6858612..5df7f8ae2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java @@ -454,7 +454,7 @@ public class SWFOutputStream extends OutputStream { * @throws IOException */ public void writeTag(Tag tag) throws IOException { - byte[] data = tag.getData(version); + byte[] data = tag.getData(); write(getTagHeader(tag, data, version)); write(data); } diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java b/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java index e4c0e671f..ffb08c3cf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFSearch.java @@ -34,7 +34,7 @@ import java.util.Set; public class SWFSearch { protected Searchable s; - private boolean noCheck; + private final boolean noCheck; private boolean processed = false; private final Set listeners = new HashSet<>(); private final Map swfStreams = new HashMap<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index e868b9a2e..cd84ec6bd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -52,7 +52,6 @@ import com.jpexs.decompiler.flash.abc.usages.MethodParamsMultinameUsage; import com.jpexs.decompiler.flash.abc.usages.MethodReturnTypeMultinameUsage; import com.jpexs.decompiler.flash.abc.usages.MultinameUsage; import com.jpexs.decompiler.flash.abc.usages.TypeNameMultinameUsage; -import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.helpers.collections.MyEntry; import com.jpexs.helpers.utf8.Utf8PrintWriter; import java.io.ByteArrayInputStream; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 33e456484..984efbe75 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -710,12 +710,11 @@ public class Action implements GraphSourceItem { * * @param asm * @param actions List of actions - * @param version SWF version * @param path * @param writer * @throws java.lang.InterruptedException */ - public static void actionsToSource(ASMSource asm, final List actions, final int version, final String path, GraphTextWriter writer) throws InterruptedException { + public static void actionsToSource(final ASMSource asm, final List actions, final String path, GraphTextWriter writer) throws InterruptedException { writer.suspendMeasure(); List tree = null; Throwable convertException = null; @@ -725,7 +724,7 @@ public class Action implements GraphSourceItem { @Override public List call() throws Exception { int staticOperation = Graph.SOP_USE_STATIC; //(Boolean) Configuration.getConfig("autoDeobfuscate", true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC; - List tree = actionsToTree(new HashMap(), new HashMap(), new HashMap(), actions, version, staticOperation, path); + List tree = actionsToTree(new HashMap(), new HashMap(), new HashMap(), actions, asm.getSwf().version, staticOperation, path); Graph.graphToString(tree, new NulWriter(), new LocalData()); return tree; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java index 0ee2fac15..f7aa985f9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java @@ -24,7 +24,6 @@ import com.jpexs.decompiler.flash.action.model.CallFunctionActionItem; import com.jpexs.decompiler.flash.action.model.CallMethodActionItem; import com.jpexs.decompiler.flash.action.model.CharToAsciiActionItem; import com.jpexs.decompiler.flash.action.model.CloneSpriteActionItem; -import com.jpexs.decompiler.flash.action.model.ConstantPool; import com.jpexs.decompiler.flash.action.model.DefineLocalActionItem; import com.jpexs.decompiler.flash.action.model.DeleteActionItem; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/BitmapExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/BitmapExporter.java index 143a2e056..4d105a9ad 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/BitmapExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/BitmapExporter.java @@ -42,7 +42,6 @@ import java.awt.Stroke; import java.awt.TexturePaint; import java.awt.geom.AffineTransform; import java.awt.geom.GeneralPath; -import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.List; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 600015356..2d13a1489 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -2718,7 +2718,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec List actions; DoActionTag doa; - doa = new DoActionTag(null, new byte[]{}, SWF.DEFAULT_VERSION, 0); + doa = new DoActionTag(null, new byte[]{}, swf.version, 0); actions = ASMParser.parse(0, 0, false, "ConstantPool \"_root\" \"my_sound\" \"Sound\" \"my_define_sound\" \"attachSound\"\n" + "Push \"_root\"\n" @@ -2733,8 +2733,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec + "Push \"attachSound\"\n" + "CallMethod\n" + "Pop\n" - + "Stop", SWF.DEFAULT_VERSION, false); - doa.setActions(actions, SWF.DEFAULT_VERSION); + + "Stop", swf.version, false); + doa.setActions(actions); sos2.writeTag(doa); sos2.writeTag(new ShowFrameTag(null)); @@ -2760,8 +2760,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec + "Push \"start\"\n" + "CallMethod\n" + "Pop\n" - + "Stop", SWF.DEFAULT_VERSION, false); - doa.setActions(actions, SWF.DEFAULT_VERSION); + + "Stop", swf.version, false); + doa.setActions(actions); sos2.writeTag(doa); sos2.writeTag(new ShowFrameTag(null)); @@ -2804,15 +2804,15 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec + "Push \"start\"\n" + "CallMethod\n" + "Pop\n" - + "Stop", SWF.DEFAULT_VERSION, false); - doa.setActions(actions, SWF.DEFAULT_VERSION); + + "Stop", swf.version, false); + doa.setActions(actions); sos2.writeTag(doa); sos2.writeTag(new ShowFrameTag(null)); actions = ASMParser.parse(0, 0, false, "StopSounds\n" - + "Stop", SWF.DEFAULT_VERSION, false); - doa.setActions(actions, SWF.DEFAULT_VERSION); + + "Stop", swf.version, false); + doa.setActions(actions); sos2.writeTag(doa); sos2.writeTag(new ShowFrameTag(null)); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index 800eac78c..12eb28b16 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -187,10 +187,10 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene private void cacheScript(ASMSource src, List actions) throws InterruptedException { if (!cache.contains(src)) { if (actions == null) { - actions = src.getActions(SWF.DEFAULT_VERSION); + actions = src.getActions(); } HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); - Action.actionsToSource(src, actions, SWF.DEFAULT_VERSION, src.toString()/*FIXME?*/, writer); + Action.actionsToSource(src, actions, src.toString()/*FIXME?*/, writer); List hilights = writer.instructionHilights; String srcNoHex = writer.toString(); cache.put(src, new CachedScript(srcNoHex, hilights)); @@ -311,7 +311,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene asm.addDisassemblyListener(listener); HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); try { - asm.getASMSource(SWF.DEFAULT_VERSION, exportMode, writer, lastCode); + asm.getASMSource(exportMode, writer, lastCode); } catch (InterruptedException ex) { Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex); } @@ -382,7 +382,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene } DisassemblyListener listener = getDisassemblyListener(); asm.addDisassemblyListener(listener); - List actions = asm.getActions(SWF.DEFAULT_VERSION); + List actions = asm.getActions(); lastCode = actions; asm.removeDisassemblyListener(listener); srcWithHex = null; @@ -725,7 +725,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene if (text.trim().startsWith("#hexdata")) { src.setActionBytes(Helper.getBytesFromHexaText(text)); } else { - src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION); + src.setActions(ASMParser.parse(0, src.getPos(), true, text, src.getSwf().version, false)); } setSource(this.src, false); View.showMessageDialog(this, AppStrings.translate("message.action.saved")); @@ -748,8 +748,8 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene case ACTION_SAVE_DECOMPILED: try { ActionScriptParser par = new ActionScriptParser(); - src.setActions(par.actionsFromString(decompiledEditor.getText()), SWF.DEFAULT_VERSION); - setSource(this.src, false); + src.setActions(par.actionsFromString(decompiledEditor.getText())); + setSource(src, false); View.showMessageDialog(this, AppStrings.translate("message.action.saved")); setDecompiledEditMode(false); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java index 8fddf521e..834951094 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java @@ -62,14 +62,13 @@ public class CSMTextSettingsTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(textID); sos.writeUB(2, useFlashType); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java index 79889f99d..afd9dac9f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DebugIDTag.java @@ -41,14 +41,13 @@ public class DebugIDTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.write(debugId); } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java index 256c7f231..1b8c4e1a5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java @@ -44,14 +44,13 @@ public class DefineBinaryDataTag extends CharacterTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(tag); sos.writeUI32(reserved); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java index b4bc0828a..ef41dd86f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java @@ -88,10 +88,10 @@ public class DefineBitsJPEG2Tag extends ImageTag implements AloneTag { } @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.write(imageData); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java index fca821346..ddbd861e0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java @@ -119,14 +119,13 @@ public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.writeUI32(imageData.length); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java index f3877c8f0..0ed517805 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java @@ -113,14 +113,13 @@ public class DefineBitsJPEG4Tag extends ImageTag implements AloneTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.writeUI32(imageData.length); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java index 3752ccb48..1994ac520 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java @@ -98,10 +98,10 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag { } } ByteArrayOutputStream bitmapDataOS = new ByteArrayOutputStream(); - SWFOutputStream sos = new SWFOutputStream(bitmapDataOS, SWF.DEFAULT_VERSION); + SWFOutputStream sos = new SWFOutputStream(bitmapDataOS, getVersion()); sos.writeALPHABITMAPDATA(bitmapData, bitmapFormat, bitmapWidth, bitmapHeight); ByteArrayOutputStream zlibOS = new ByteArrayOutputStream(); - SWFOutputStream sos2 = new SWFOutputStream(zlibOS, SWF.DEFAULT_VERSION); + SWFOutputStream sos2 = new SWFOutputStream(zlibOS, getVersion()); sos2.writeBytesZlib(bitmapDataOS.toByteArray()); zlibBitmapData = zlibOS.toByteArray(); decompressed = false; @@ -154,14 +154,13 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.writeUI8(bitmapFormat); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java index 7ce83be8c..ce9ac901c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java @@ -97,10 +97,10 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag { } } ByteArrayOutputStream bitmapDataOS = new ByteArrayOutputStream(); - SWFOutputStream sos = new SWFOutputStream(bitmapDataOS, SWF.DEFAULT_VERSION); + SWFOutputStream sos = new SWFOutputStream(bitmapDataOS, getVersion()); sos.writeBITMAPDATA(bitmapData, bitmapFormat, bitmapWidth, bitmapHeight); ByteArrayOutputStream zlibOS = new ByteArrayOutputStream(); - SWFOutputStream sos2 = new SWFOutputStream(zlibOS, SWF.DEFAULT_VERSION); + SWFOutputStream sos2 = new SWFOutputStream(zlibOS, getVersion()); sos2.writeBytesZlib(bitmapDataOS.toByteArray()); zlibBitmapData = zlibOS.toByteArray(); decompressed = false; @@ -197,14 +197,13 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.writeUI8(bitmapFormat); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java index 53698abdd..dc27a33e0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsTag.java @@ -83,7 +83,7 @@ public class DefineBitsTag extends ImageTag { getJPEGTables(tags); if ((jtt != null)) { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { - byte[] jttdata = jtt.getData(swf.version); + byte[] jttdata = jtt.getData(); if (jttdata.length != 0) { baos.write(jttdata, SWF.hasErrorHeader(jttdata) ? 4 : 0, jttdata.length - (SWF.hasErrorHeader(jttdata) ? 6 : 2)); baos.write(jpegData, SWF.hasErrorHeader(jpegData) ? 6 : 2, jpegData.length - (SWF.hasErrorHeader(jttdata) ? 6 : 2)); @@ -101,14 +101,13 @@ public class DefineBitsTag extends ImageTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.write(jpegData); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index a1ca80a1e..43a5e9cbc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -120,13 +120,12 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { if (Configuration.disableDangerous.get()) { - return super.getData(version); + return super.getData(); } ByteArrayInputStream bais = new ByteArrayInputStream(super.data); @@ -136,7 +135,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, bais); } - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(buttonId); sos.writeUB(7, reserved); @@ -146,14 +145,14 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded OutputStream os2 = baos2; byte[] origbrdata = null; if (Configuration.debugCopy.get()) { - SWFInputStream sis = new SWFInputStream(bais, version); + SWFInputStream sis = new SWFInputStream(bais, getVersion()); int len = sis.readUI16(); if (len != 0) { origbrdata = sis.readBytesEx(len - 2); os2 = new CopyOutputStream(os2, new ByteArrayInputStream(origbrdata)); } } - try (SWFOutputStream sos2 = new SWFOutputStream(os2, version)) { + try (SWFOutputStream sos2 = new SWFOutputStream(os2, getVersion())) { sos2.writeBUTTONRECORDList(characters, true); } byte[] brdata = baos2.toByteArray(); @@ -165,7 +164,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded } } if (Configuration.debugCopy.get()) { - sos = new SWFOutputStream(baos, version); + sos = new SWFOutputStream(baos, getVersion()); } if ((actions == null) || (actions.isEmpty())) { sos.writeUI16(0); @@ -174,7 +173,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded } sos.write(brdata); if (Configuration.debugCopy.get()) { - sos = new SWFOutputStream(new CopyOutputStream(baos, bais), version); + sos = new SWFOutputStream(new CopyOutputStream(baos, bais), getVersion()); } sos.writeBUTTONCONDACTIONList(actions); sos.close(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java index d8ccbd9e4..2003c71a5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonCxformTag.java @@ -42,14 +42,13 @@ public class DefineButtonCxformTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(buttonId); sos.writeCXFORM(buttonColorTransform); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java index 9588d5543..75599388a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonSoundTag.java @@ -67,14 +67,13 @@ public class DefineButtonSoundTag extends CharacterIdTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(buttonId); sos.writeUI16(buttonSoundChar0); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java index 81a11ac2e..ff2bfaa20 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java @@ -115,20 +115,19 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { if (Configuration.disableDangerous.get()) { - return super.getData(version); + return super.getData(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(buttonId); sos.writeBUTTONRECORDList(characters, false); @@ -143,18 +142,17 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT /** * Converts actions to ASM source * - * @param version SWF version * @param actions * @param writer * @return ASM source * @throws java.lang.InterruptedException */ @Override - public GraphTextWriter getASMSource(int version, ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { + public GraphTextWriter getASMSource(ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { if (actions == null) { - actions = getActions(version); + actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, null, version, exportMode, writer, getPos() + hdrSize, toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, getPos() + hdrSize, toString()/*FIXME?*/); } /** @@ -170,17 +168,16 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT /** * Returns actions associated with this object * - * @param version Version * @return List of actions * @throws java.lang.InterruptedException */ @Override - public List getActions(int version) throws InterruptedException { + public List getActions() throws InterruptedException { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int prevLength = 0; if (previousTag != null) { - byte[] prevData = previousTag.getData(version); + byte[] prevData = previousTag.getData(); baos.write(prevData); prevLength = prevData.length; } @@ -188,7 +185,7 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT MemoryInputStream rri = new MemoryInputStream(baos.toByteArray()); rri.seek(prevLength); - List list = ActionListReader.readActionListTimeout(listeners, getPos() + hdrSize - prevLength, rri, version, prevLength, -1, toString()/*FIXME?*/); + List list = ActionListReader.readActionListTimeout(listeners, getPos() + hdrSize - prevLength, rri, getVersion(), prevLength, -1, toString()/*FIXME?*/); return list; } catch (InterruptedException ex) { throw ex; @@ -199,8 +196,8 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT } @Override - public void setActions(List actions, int version) { - actionBytes = Action.actionsToBytes(actions, true, version); + public void setActions(List actions) { + actionBytes = Action.actionsToBytes(actions, true, swf.version); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 64e8752e6..a2eee7e47 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -488,14 +488,13 @@ public class DefineEditTextTag extends TextTag implements DrawableTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.writeRECT(bounds); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java index e5a9feecb..ea6c16098 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java @@ -109,13 +109,12 @@ public class DefineFont2Tag extends FontTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SWFOutputStream sos = new SWFOutputStream(baos, version); + SWFOutputStream sos = new SWFOutputStream(baos, getVersion()); try { sos.writeUI16(fontId); sos.writeUB(1, fontFlagsHasLayout ? 1 : 0); @@ -135,7 +134,7 @@ public class DefineFont2Tag extends FontTag { List offsetTable = new ArrayList<>(); ByteArrayOutputStream baosGlyphShapes = new ByteArrayOutputStream(); - SWFOutputStream sos3 = new SWFOutputStream(baosGlyphShapes, version); + SWFOutputStream sos3 = new SWFOutputStream(baosGlyphShapes, getVersion()); for (int i = 0; i < numGlyphs; i++) { offsetTable.add((glyphShapeTable.size() + 1/*CodeTableOffset*/) * (fontFlagsWideOffsets ? 4 : 2) + sos3.getPos()); sos3.writeSHAPE(glyphShapeTable.get(i), 1); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java index fb9230be4..29991c2d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java @@ -179,14 +179,13 @@ public class DefineFont3Tag extends FontTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); if (Configuration.debugCopy.get()) { sos = new SWFOutputStream(new CopyOutputStream(sos, new ByteArrayInputStream(data)), 10); } @@ -209,7 +208,7 @@ public class DefineFont3Tag extends FontTag { List offsetTable = new ArrayList<>(); ByteArrayOutputStream baosGlyphShapes = new ByteArrayOutputStream(); - SWFOutputStream sos3 = new SWFOutputStream(baosGlyphShapes, version); + SWFOutputStream sos3 = new SWFOutputStream(baosGlyphShapes, getVersion()); for (int i = 0; i < numGlyphs; i++) { offsetTable.add((glyphShapeTable.size() + 1/*CodeTableOffset*/) * (fontFlagsWideOffsets ? 4 : 2) + sos3.getPos()); sos3.writeSHAPE(glyphShapeTable.get(i), 1); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java index 8d4ec86a6..0b65c4a1d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java @@ -63,14 +63,13 @@ public class DefineFont4Tag extends CharacterTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(fontID); sos.writeUB(5, reserved); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java index be8d15c56..780570652 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java @@ -60,14 +60,13 @@ public class DefineFontAlignZonesTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(fontID); sos.writeUB(2, CSMTableHint); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java index b6e6097bd..ba74ecb51 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java @@ -58,14 +58,13 @@ public class DefineFontInfo2Tag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(fontID); byte[] fontNameBytes = Utf8Helper.getBytes(fontName); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java index 9bcf717d6..5747b9c10 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java @@ -56,14 +56,13 @@ public class DefineFontInfoTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(fontId); byte[] fontNameBytes = Utf8Helper.getBytes(fontName); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java index 21da55846..be056f762 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java @@ -109,19 +109,18 @@ public class DefineFontTag extends FontTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(fontId); ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); List offsetTable = new ArrayList<>(); - SWFOutputStream sos2 = new SWFOutputStream(baos2, version); + SWFOutputStream sos2 = new SWFOutputStream(baos2, getVersion()); for (SHAPE shape : glyphShapeTable) { offsetTable.add(glyphShapeTable.size() * 2 + (int) sos2.getPos()); sos2.writeSHAPE(shape, 1); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java index 031871a20..84f9560e8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java @@ -104,14 +104,13 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterId); sos.writeRECT(startBounds); @@ -122,7 +121,7 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo sos.writeUB(1, usesNonScalingStrokes ? 1 : 0); sos.writeUB(1, usesScalingStrokes ? 1 : 0); ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); - SWFOutputStream sos2 = new SWFOutputStream(baos2, version); + SWFOutputStream sos2 = new SWFOutputStream(baos2, getVersion()); sos2.writeMORPHFILLSTYLEARRAY(morphFillStyles, 2); sos2.writeMORPHLINESTYLEARRAY(morphLineStyles, 2); sos2.writeSHAPE(startEdges, 1); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java index e9351dcd3..b0a2335b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java @@ -86,20 +86,19 @@ public class DefineMorphShapeTag extends CharacterTag implements BoundedTag, Mor /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterId); sos.writeRECT(startBounds); sos.writeRECT(endBounds); ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); - SWFOutputStream sos2 = new SWFOutputStream(baos2, version); + SWFOutputStream sos2 = new SWFOutputStream(baos2, getVersion()); sos2.writeMORPHFILLSTYLEARRAY(morphFillStyles, 1); sos2.writeMORPHLINESTYLEARRAY(morphLineStyles, 1); sos2.writeSHAPE(startEdges, 1); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java index 7afb44a2e..536920e72 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java @@ -47,14 +47,13 @@ public class DefineScalingGridTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterId); sos.writeRECT(splitter); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java index bb52b92d5..ed5aea087 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSceneAndFrameLabelDataTag.java @@ -51,14 +51,13 @@ public class DefineSceneAndFrameLabelDataTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { int sceneCount = sceneOffsets.length; sos.writeEncodedU32(sceneCount); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java index 43692f327..fa771d47d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java @@ -77,13 +77,12 @@ public class DefineShapeTag extends CharacterTag implements ShapeTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SWFOutputStream sos = new SWFOutputStream(baos, version); + SWFOutputStream sos = new SWFOutputStream(baos, getVersion()); try { sos.writeUI16(shapeId); sos.writeRECT(shapeBounds); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java index 6a5d92e3b..0f38d8cf8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSoundTag.java @@ -68,14 +68,13 @@ public class DefineSoundTag extends CharacterTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(soundId); sos.writeUB(4, soundFormat); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index ca1bb24a1..2b619f006 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -211,20 +211,19 @@ public class DefineSpriteTag extends CharacterTag implements Container, BoundedT /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { if (Configuration.disableDangerous.get()) { - return super.getData(version); + return super.getData(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(spriteId); sos.writeUI16(frameCount); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 642984fca..439245294 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -424,14 +424,13 @@ public class DefineText2Tag extends TextTag implements DrawableTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.writeRECT(textBounds); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index a79fa839d..d60e3dea9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -434,14 +434,13 @@ public class DefineTextTag extends TextTag implements DrawableTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.writeRECT(textBounds); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java index ab41f97be..03cab36dc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java @@ -77,14 +77,13 @@ public class DefineVideoStreamTag extends CharacterTag implements BoundedTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterID); sos.writeUI16(numFrames); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java index 32152df9c..b20bbf9cf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java @@ -85,18 +85,17 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); OutputStream os = bos; if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } - try (SWFOutputStream sos = new SWFOutputStream(os, version)) { + try (SWFOutputStream sos = new SWFOutputStream(os, getVersion())) { sos.writeUI32(flags); sos.writeString(name); abc.saveToStream(sos); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java index 95a74b010..86980bb8d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java @@ -68,18 +68,17 @@ public class DoABCTag extends Tag implements ABCContainerTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); OutputStream os = bos; if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } - try (SWFOutputStream sos = new SWFOutputStream(os, version)) { + try (SWFOutputStream sos = new SWFOutputStream(os, getVersion())) { abc.saveToStream(sos); } return bos.toByteArray(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java index 4f81d605e..dbf9f5700 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoActionTag.java @@ -63,29 +63,27 @@ public class DoActionTag extends Tag implements ASMSource { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { return actionBytes;//Action.actionsToBytes(actions, true, version); } /** * Converts actions to ASM source * - * @param version SWF version * @param actions * @param writer * @return ASM source * @throws java.lang.InterruptedException */ @Override - public GraphTextWriter getASMSource(int version, ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { + public GraphTextWriter getASMSource(ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { if (actions == null) { - actions = getActions(version); + actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, null, version, exportMode, writer, getPos(), toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, getPos(), toString()/*FIXME?*/); } /** @@ -109,22 +107,22 @@ public class DoActionTag extends Tag implements ASMSource { } @Override - public List getActions(int version) throws InterruptedException { + public List getActions() throws InterruptedException { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int prevLength = 0; if (previousTag != null) { - byte[] prevData = previousTag.getData(version); + byte[] prevData = previousTag.getData(); baos.write(prevData); prevLength = prevData.length; - byte[] header = SWFOutputStream.getTagHeader(this, data, version); + byte[] header = SWFOutputStream.getTagHeader(this, data, getVersion()); baos.write(header); prevLength += header.length; } baos.write(actionBytes); MemoryInputStream rri = new MemoryInputStream(baos.toByteArray()); rri.seek(prevLength); - List list = ActionListReader.readActionListTimeout(listeners, getPos() - prevLength, rri, version, prevLength, -1, toString()/*FIXME?*/); + List list = ActionListReader.readActionListTimeout(listeners, getPos() - prevLength, rri, getVersion(), prevLength, -1, toString()/*FIXME?*/); return list; } catch (InterruptedException ex) { throw ex; @@ -135,8 +133,8 @@ public class DoActionTag extends Tag implements ASMSource { } @Override - public void setActions(List actions, int version) { - actionBytes = Action.actionsToBytes(actions, true, version); + public void setActions(List actions) { + actionBytes = Action.actionsToBytes(actions, true, swf.version); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index 1cf1a4609..4b9f99b11 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -74,13 +74,12 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SWFOutputStream sos = new SWFOutputStream(baos, version); + SWFOutputStream sos = new SWFOutputStream(baos, getVersion()); try { sos.writeUI16(spriteId); sos.write(actionBytes); @@ -104,40 +103,39 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { /** * Converts actions to ASM source * - * @param version SWF version * @param actions * @param writer * @return ASM source * @throws java.lang.InterruptedException */ @Override - public GraphTextWriter getASMSource(int version, ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { + public GraphTextWriter getASMSource(ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { if (actions == null) { - actions = getActions(version); + actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, null, version, exportMode, writer, getPos() + 2, toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, getPos() + 2, toString()/*FIXME?*/); } @Override - public List getActions(int version) throws InterruptedException { + public List getActions() throws InterruptedException { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int prevLength = 0; if (previousTag != null) { - byte[] prevData = previousTag.getData(version); + byte[] prevData = previousTag.getData(); baos.write(prevData); prevLength = prevData.length; baos.write(0); baos.write(0); prevLength += 2; - byte[] header = SWFOutputStream.getTagHeader(this, data, version); + byte[] header = SWFOutputStream.getTagHeader(this, data, getVersion()); baos.write(header); prevLength += header.length; } baos.write(actionBytes); MemoryInputStream rri = new MemoryInputStream(baos.toByteArray()); rri.seek(prevLength); - List list = ActionListReader.readActionListTimeout(listeners, getPos() + 2 - prevLength, rri, version, prevLength, -1, toString()/*FIXME?*/); + List list = ActionListReader.readActionListTimeout(listeners, getPos() + 2 - prevLength, rri, getVersion(), prevLength, -1, toString()/*FIXME?*/); return list; } catch (InterruptedException ex) { throw ex; @@ -148,8 +146,8 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { } @Override - public void setActions(List actions, int version) { - actionBytes = Action.actionsToBytes(actions, true, version); + public void setActions(List actions) { + actionBytes = Action.actionsToBytes(actions, true, swf.version); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java index ee9a274af..0aabef0fe 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java @@ -46,14 +46,13 @@ public class EnableDebugger2Tag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(reserved); sos.writeString(passwordHash); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java index fbda79cf9..48b8bb459 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java @@ -40,14 +40,13 @@ public class EnableDebuggerTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { if (passwordHash != null) { sos.writeString(passwordHash); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java index 81f076fa9..35c2d5bec 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java @@ -48,14 +48,13 @@ public class EnableTelemetryTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUB(16, reserved); if (passwordHash != null) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/EndTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/EndTag.java index b5415cb5f..47defbbc1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/EndTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/EndTag.java @@ -29,11 +29,10 @@ public class EndTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { return new byte[0]; } public static final int ID = 0; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java index 7589b63b3..478d7bd42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ExportAssetsTag.java @@ -79,14 +79,13 @@ public class ExportAssetsTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(tags.size()); for (int i = 0; i < tags.size(); i++) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java index 4f43a2de9..74eafa058 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java @@ -68,14 +68,13 @@ public class FileAttributesTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUB(1, reserved1 ? 1 : 0); //reserved sos.writeUB(1, useDirectBlit ? 1 : 0); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java index 0396bba74..7067b2431 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java @@ -52,14 +52,13 @@ public class FrameLabelTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeString(name); if (namedAnchor) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java index 60929136f..00102c2ea 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java @@ -86,14 +86,13 @@ public class ImportAssets2Tag extends Tag implements ImportTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeString(url); sos.writeUI8(reserved1); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssetsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssetsTag.java index 969dba358..e27a9c8bc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssetsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssetsTag.java @@ -77,14 +77,13 @@ public class ImportAssetsTag extends Tag implements ImportTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeString(url); sos.writeUI16(tags.size()); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/MetadataTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/MetadataTag.java index ce1992dbd..7869cca57 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/MetadataTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/MetadataTag.java @@ -43,14 +43,13 @@ public class MetadataTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeString(xmlMetadata); } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java index aca9efec3..0aa753c42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java @@ -142,20 +142,19 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { if (Configuration.disableDangerous.get()) { - return super.getData(version); + return super.getData(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUB(1, placeFlagHasClipActions ? 1 : 0); sos.writeUB(1, placeFlagHasClipDepth ? 1 : 0); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java index cd3442c24..648eb7c6f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java @@ -219,20 +219,19 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { if (Configuration.disableDangerous.get()) { - return super.getData(version); + return super.getData(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUB(1, placeFlagHasClipActions ? 1 : 0); sos.writeUB(1, placeFlagHasClipDepth ? 1 : 0); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java index a8fbd7a21..b52c762a3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject4Tag.java @@ -221,20 +221,19 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { if (Configuration.disableDangerous.get()) { - return super.getData(version); + return super.getData(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; if (Configuration.debugCopy.get()) { os = new CopyOutputStream(os, new ByteArrayInputStream(super.data)); } - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUB(1, placeFlagHasClipActions ? 1 : 0); sos.writeUB(1, placeFlagHasClipDepth ? 1 : 0); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java index abbb055b2..5edeea44a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObjectTag.java @@ -79,14 +79,13 @@ public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterId); sos.writeUI16(depth); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java index 7d9ce044c..a99d81ad0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ProductInfoTag.java @@ -76,10 +76,10 @@ public class ProductInfoTag extends Tag { } @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI32(productID); sos.writeUI32(edition); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java index 0a7a2bfb8..665e58e1e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ProtectTag.java @@ -40,14 +40,13 @@ public class ProtectTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { if (!"".equals(passwordHash)) { sos.writeString(passwordHash); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java index 24c2082ca..65ec59ac9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/RemoveObjectTag.java @@ -50,14 +50,13 @@ public class RemoveObjectTag extends CharacterIdTag implements RemoveTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterId); sos.writeUI16(depth); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java index 450b2defd..80e29019d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ScriptLimitsTag.java @@ -46,14 +46,13 @@ public class ScriptLimitsTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(maxRecursionDepth); sos.writeUI16(scriptTimeoutSeconds); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SetBackgroundColorTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SetBackgroundColorTag.java index 86a231f1f..f7184fb9e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SetBackgroundColorTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SetBackgroundColorTag.java @@ -41,9 +41,9 @@ public class SetBackgroundColorTag extends Tag { } @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SWFOutputStream sos = new SWFOutputStream(baos, version); + SWFOutputStream sos = new SWFOutputStream(baos, getVersion()); try { sos.writeRGB(backgroundColor); } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java index 20bdf4b8f..10d1d23a7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SetTabIndexTag.java @@ -48,14 +48,13 @@ public class SetTabIndexTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(depth); sos.writeUI16(tabIndex); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ShowFrameTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ShowFrameTag.java index 325381185..838d832ae 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ShowFrameTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ShowFrameTag.java @@ -65,12 +65,11 @@ public class ShowFrameTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { - return super.getData(version); + public byte[] getData() { + return super.getData(); } public static boolean isNestedTagType(int tagTypeId) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java index 2803e6f2e..5c9300129 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java @@ -97,14 +97,13 @@ public class SoundStreamHead2Tag extends CharacterIdTag implements SoundStreamHe /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUB(4, reserved); sos.writeUB(2, playBackSoundRate); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java index 6e74a9dc8..e1dabcf55 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java @@ -88,14 +88,13 @@ public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHea /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUB(4, reserved); sos.writeUB(2, playBackSoundRate); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/StartSound2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/StartSound2Tag.java index b6991b46d..80c937922 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/StartSound2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/StartSound2Tag.java @@ -39,14 +39,13 @@ public class StartSound2Tag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); /*try { //sos.write } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java index 382f8d96d..8b3b40fa2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/StartSoundTag.java @@ -42,14 +42,13 @@ public class StartSoundTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(soundId); sos.writeSOUNDINFO(soundInfo); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java index 0df081992..2899bcafc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SymbolClassTag.java @@ -53,14 +53,13 @@ public class SymbolClassTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { int numSymbols = tags.length; sos.writeUI16(numSymbols); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java index 0caa089e5..9b30975fd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java @@ -261,12 +261,18 @@ public class Tag implements NeedsCharacters, Exportable, ContainerItem, Serializ /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ - public byte[] getData(int version) { + public byte[] getData() { return data; } + + public int getVersion() { + if (swf == null) { + return SWF.DEFAULT_VERSION; + } + return swf.version; + } /** * Gets original read data diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/TagStub.java b/trunk/src/com/jpexs/decompiler/flash/tags/TagStub.java index 4fdd0d975..12fd63456 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/TagStub.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/TagStub.java @@ -36,14 +36,13 @@ public class TagStub extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); /*try { //sos.write } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java index 4b9865c90..806999f6d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/VideoFrameTag.java @@ -43,14 +43,13 @@ public class VideoFrameTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(streamID); sos.writeUI16(frameNum); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ASMSource.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ASMSource.java index e7ef64f22..7f2f5a3ea 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ASMSource.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ASMSource.java @@ -33,14 +33,13 @@ public interface ASMSource extends TreeItem { /** * Converts actions to ASM source * - * @param version SWF version * @param exportMode PCode or hex? * @param writer * @param actions * @return ASM source * @throws java.lang.InterruptedException */ - public GraphTextWriter getASMSource(int version, ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException; + public GraphTextWriter getASMSource(ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException; /** * Whether or not this object contains ASM source @@ -52,11 +51,10 @@ public interface ASMSource extends TreeItem { /** * Returns actions associated with this object * - * @param version Version * @return List of actions * @throws java.lang.InterruptedException */ - public List getActions(int version) throws InterruptedException; + public List getActions() throws InterruptedException; /** * Sets actions associated with this object @@ -64,7 +62,7 @@ public interface ASMSource extends TreeItem { * @param version Version * @param actions Action list */ - public void setActions(List actions, int version); + public void setActions(List actions); public byte[] getActionBytes(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java index 52adc3f8d..cbe672d83 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java @@ -71,14 +71,13 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(fontId); for (FontType ft : fonts) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalGradient.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalGradient.java index 49fcf9b0b..71b6f39cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalGradient.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalGradient.java @@ -44,14 +44,13 @@ public class DefineExternalGradient extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(gradientId); sos.writeUI16(bitmapsFormat); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage.java index 756bb289a..b675e780f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage.java @@ -45,14 +45,13 @@ public class DefineExternalImage extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterId); sos.writeUI16(bitmapFormat); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage2.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage2.java index 1354b5fec..56bfabfa9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage2.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalImage2.java @@ -47,14 +47,13 @@ public class DefineExternalImage2 extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI32(characterId); sos.writeUI16(bitmapFormat); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java index fc6a07a7d..bc3ebfa8b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java @@ -47,14 +47,13 @@ public class DefineExternalSound extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterId); sos.writeUI16(soundFormat); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java index eba17363f..c597e63ea 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java @@ -47,14 +47,13 @@ public class DefineExternalStreamSound extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(soundFormat); sos.writeUI16(bits); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineGradientMap.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineGradientMap.java index a183ebb0a..d97377a70 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineGradientMap.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineGradientMap.java @@ -38,14 +38,13 @@ public class DefineGradientMap extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(indices.length); for (int i = 0; i < indices.length; i++) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineSubImage.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineSubImage.java index 0b5a52039..1c93ec3c9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineSubImage.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineSubImage.java @@ -43,14 +43,13 @@ public class DefineSubImage extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI16(characterId); sos.writeUI16(imageCharacterId); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/ExporterInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/ExporterInfoTag.java index f4126af95..4128ebb8f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/ExporterInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/ExporterInfoTag.java @@ -52,11 +52,10 @@ public class ExporterInfoTag extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; SWFOutputStream sos = new SWFOutputStream(os, version); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java index 7a14f1769..a43c85b20 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java @@ -53,14 +53,13 @@ public class FontTextureInfo extends Tag { /** * Gets data bytes * - * @param version SWF version * @return Bytes of data */ @Override - public byte[] getData(int version) { + public byte[] getData() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; - SWFOutputStream sos = new SWFOutputStream(os, version); + SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUI32(textureID); sos.writeUI16(textureFormat); diff --git a/trunk/src/com/jpexs/decompiler/flash/treenodes/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/treenodes/TagNode.java index 4a9fe86cd..8270d9c52 100644 --- a/trunk/src/com/jpexs/decompiler/flash/treenodes/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/treenodes/TagNode.java @@ -145,12 +145,12 @@ public class TagNode extends ContainerNode { asm.getActionSourceSuffix(writer); } else if (exportMode != ExportMode.SOURCE) { asm.getActionSourcePrefix(writer); - asm.getASMSource(SWF.DEFAULT_VERSION, exportMode, writer, null); + asm.getASMSource(exportMode, writer, null); asm.getActionSourceSuffix(writer); } else { - List as = asm.getActions(SWF.DEFAULT_VERSION); - Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION); - Action.actionsToSource(asm, as, SWF.DEFAULT_VERSION, ""/*FIXME*/, writer); + List as = asm.getActions(); + Action.setActionsAddresses(as, 0, asm.getSwf().version); + Action.actionsToSource(asm, as, ""/*FIXME*/, writer); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java index b0ef5279c..36c16c77e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONCONDACTION.java @@ -159,18 +159,17 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, S /** * Converts actions to ASM source * - * @param version SWF version * @param actions * @param writer * @return ASM source * @throws java.lang.InterruptedException */ @Override - public GraphTextWriter getASMSource(int version, ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { + public GraphTextWriter getASMSource(ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { if (actions == null) { - actions = getActions(version); + actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, null, version, exportMode, writer, getPos() + 4, toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, getPos() + 4, toString()/*FIXME?*/); } /** @@ -186,14 +185,13 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, S /** * Returns actions associated with this object * - * @param version Version * @return List of actions * @throws java.lang.InterruptedException */ @Override - public List getActions(int version) throws InterruptedException { + public List getActions() throws InterruptedException { try { - List list = ActionListReader.readActionListTimeout(listeners, getPos() + 4, new MemoryInputStream(actionBytes), version, 0, -1, toString()/*FIXME?*/); + List list = ActionListReader.readActionListTimeout(listeners, getPos() + 4, new MemoryInputStream(actionBytes), swf.version, 0, -1, toString()/*FIXME?*/); return list; } catch (InterruptedException ex) { @@ -205,8 +203,8 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, S } @Override - public void setActions(List actions, int version) { - actionBytes = Action.actionsToBytes(actions, true, version); + public void setActions(List actions) { + actionBytes = Action.actionsToBytes(actions, true, swf.version); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java index f4ee2021a..390fb44ee 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java @@ -165,18 +165,17 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S /** * Converts actions to ASM source * - * @param version SWF version * @param actions * @param writer * @return ASM source * @throws java.lang.InterruptedException */ @Override - public GraphTextWriter getASMSource(int version, ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { + public GraphTextWriter getASMSource(ExportMode exportMode, GraphTextWriter writer, List actions) throws InterruptedException { if (actions == null) { - actions = getActions(version); + actions = getActions(); } - return Action.actionsToString(listeners, 0, actions, null, version, exportMode, writer, getPos() + hdrPos, toString()/*FIXME?*/); + return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, getPos() + hdrPos, toString()/*FIXME?*/); } /** @@ -190,9 +189,9 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S } @Override - public List getActions(int version) throws InterruptedException { + public List getActions() throws InterruptedException { try { - List list = ActionListReader.readActionListTimeout(listeners, getPos() + hdrPos, new MemoryInputStream(actionBytes), version, 0, -1, toString()/*FIXME?*/); + List list = ActionListReader.readActionListTimeout(listeners, getPos() + hdrPos, new MemoryInputStream(actionBytes), swf.version, 0, -1, toString()/*FIXME?*/); return list; } catch (InterruptedException ex) { throw ex; @@ -203,8 +202,8 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S } @Override - public void setActions(List actions, int version) { - actionBytes = Action.actionsToBytes(actions, true, version); + public void setActions(List actions) { + actionBytes = Action.actionsToBytes(actions, true, swf.version); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 107b45591..4c9506ac3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -1155,7 +1155,7 @@ public class XFLConverter { private static String convertActionScript(ASMSource as) { HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); try { - Action.actionsToSource(as, as.getActions(SWF.DEFAULT_VERSION), SWF.DEFAULT_VERSION, as.toString(), writer); + Action.actionsToSource(as, as.getActions(), as.toString(), writer); } catch (InterruptedException ex) { Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, null, ex); } @@ -1382,7 +1382,7 @@ public class XFLConverter { for (Tag t : tags) { if (found && (t instanceof SoundStreamBlockTag)) { SoundStreamBlockTag bl = (SoundStreamBlockTag) t; - soundData = bl.getData(SWF.DEFAULT_VERSION); + soundData = bl.getData(); break; } if (t == symbol) { @@ -1425,7 +1425,7 @@ public class XFLConverter { bits = 18; } if (soundFormat == DefineSoundTag.FORMAT_ADPCM) { - SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(soundData), SWF.DEFAULT_VERSION); + SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(soundData), swf.version); exportFormat = "wav"; try { int adpcmCodeSize = (int) sis.readUB(2); @@ -1440,7 +1440,7 @@ public class XFLConverter { format += 1; } format += 4; //quality best - SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(soundData), SWF.DEFAULT_VERSION); + SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(soundData), swf.version); try { sis.readSI16(); MP3FRAME frame = new MP3FRAME(sis); diff --git a/trunk/src/com/jpexs/helpers/SerializableImage.java b/trunk/src/com/jpexs/helpers/SerializableImage.java index b86ec6e07..03842f25e 100644 --- a/trunk/src/com/jpexs/helpers/SerializableImage.java +++ b/trunk/src/com/jpexs/helpers/SerializableImage.java @@ -21,7 +21,6 @@ import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.IndexColorModel; import java.awt.image.WritableRaster; -import java.io.File; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; diff --git a/trunk/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java b/trunk/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java index 8cc5c99a6..2c1b4e99c 100644 --- a/trunk/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java +++ b/trunk/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java @@ -62,10 +62,10 @@ public class ActionScript2AssemblerTest extends ActionStript2TestBase { DoActionTag doa = getFirstActionTag(); doa.setActionBytes(Action.actionsToBytes(actions, true, swf.version)); HilightedTextWriter writer = new HilightedTextWriter(new CodeFormatting(), false); - Action.actionsToSource(doa, doa.getActions(swf.version), swf.version, "", writer); + Action.actionsToSource(doa, doa.getActions(), "", writer); String actualResult = writer.toString(); writer = new HilightedTextWriter(new CodeFormatting(), false); - doa.getASMSource(swf.version, ExportMode.PCODE, writer, null); + doa.getASMSource(ExportMode.PCODE, writer, null); String decompiled = writer.toString(); assertEquals(actualResult.trim(), "ok = false;"); diff --git a/trunk/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java b/trunk/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java index 3886e09bd..154526ad5 100644 --- a/trunk/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java +++ b/trunk/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java @@ -79,7 +79,7 @@ public class ActionScript2DeobfuscatorTest extends ActionStript2TestBase { DoActionTag doa = getFirstActionTag(); doa.setActionBytes(Action.actionsToBytes(actions, true, swf.version)); HilightedTextWriter writer = new HilightedTextWriter(new CodeFormatting(), false); - Action.actionsToSource(doa, doa.getActions(swf.version), swf.version, "", writer); + Action.actionsToSource(doa, doa.getActions(), "", writer); String actualResult = writer.toString(); assertTrue(actualResult.contains("case \"c\":")); diff --git a/trunk/test/com/jpexs/decompiler/flash/ActionScript2Test.java b/trunk/test/com/jpexs/decompiler/flash/ActionScript2Test.java index 36dcad71b..d4b31d4b9 100644 --- a/trunk/test/com/jpexs/decompiler/flash/ActionScript2Test.java +++ b/trunk/test/com/jpexs/decompiler/flash/ActionScript2Test.java @@ -51,7 +51,7 @@ public class ActionScript2Test extends ActionStript2TestBase { assertNotNull(doa); HilightedTextWriter writer = new HilightedTextWriter(new CodeFormatting(), false); try { - Action.actionsToSource(doa, doa.getActions(swf.version), swf.version, "", writer); + Action.actionsToSource(doa, doa.getActions(), "", writer); } catch (InterruptedException ex) { fail(); } diff --git a/trunk/test/com/jpexs/decompiler/flash/RecompileTest.java b/trunk/test/com/jpexs/decompiler/flash/RecompileTest.java index 0e1c9b348..86621b931 100644 --- a/trunk/test/com/jpexs/decompiler/flash/RecompileTest.java +++ b/trunk/test/com/jpexs/decompiler/flash/RecompileTest.java @@ -63,4 +63,29 @@ public class RecompileTest { testRecompileOne(f.getName()); } } + + private void testAS2DirectEditingOne(String filename) { + try { + SWF swf = new SWF(new BufferedInputStream(new FileInputStream(TESTDATADIR + File.separator + filename)), false); + } catch (IOException | InterruptedException ex) { + fail(); + } + } + + @Test + public void testAS2DirectEditing() { + File dir = new File(TESTDATADIR); + if (!dir.exists()) { + return; + } + File[] files = dir.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.toLowerCase().endsWith(".swf"); + } + }); + for (File f : files) { + testAS2DirectEditingOne(f.getName()); + } + } } diff --git a/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java b/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java index bfdc47255..ad260acdf 100644 --- a/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java +++ b/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java @@ -55,7 +55,7 @@ public class AS2Generator { continue; } HilightedTextWriter writer = new HilightedTextWriter(new CodeFormatting(), false); - Action.actionsToSource(doa, doa.getActions(swf.version), swf.version, "", writer); + Action.actionsToSource(doa, doa.getActions(), "", writer); String src = writer.toString(); if (src.trim().isEmpty()) { doa = null;