From 1070c610059ff8c54712aabab0b86d9daefd2991 Mon Sep 17 00:00:00 2001 From: Honfika Date: Fri, 7 Feb 2014 22:49:01 +0100 Subject: [PATCH] added some reserved fields --- .../decompiler/flash/SWFInputStream.java | 36 +++++-------- .../decompiler/flash/SWFOutputStream.java | 18 +++---- .../flash/action/swf4/ActionGetURL2.java | 5 +- .../flash/action/swf4/ActionGotoFrame2.java | 5 +- .../action/swf7/ActionDefineFunction2.java | 5 +- .../flash/action/swf7/ActionTry.java | 7 +-- .../flash/configuration/Configuration.java | 10 ++-- .../decompiler/flash/gui/GenericTagPanel.java | 26 ++++----- .../gui/generictageditors/FloatEditor.java | 54 ------------------- .../gui/generictageditors/IntegerEditor.java | 54 ------------------- .../gui/generictageditors/LongEditor.java | 54 ------------------- .../{DoubleEditor.java => NumberEditor.java} | 20 +++++-- .../gui/generictageditors/ShortEditor.java | 54 ------------------- .../flash/tags/CSMTextSettingsTag.java | 15 ++++-- .../flash/tags/DefineButton2Tag.java | 8 ++- .../decompiler/flash/tags/DefineFont2Tag.java | 2 +- .../decompiler/flash/tags/DefineFont3Tag.java | 2 +- .../decompiler/flash/tags/DefineFont4Tag.java | 7 ++- .../flash/tags/DefineFontAlignZonesTag.java | 7 ++- .../flash/tags/DefineFontInfo2Tag.java | 7 ++- .../flash/tags/DefineFontInfoTag.java | 7 ++- .../flash/tags/DefineMorphShape2Tag.java | 7 ++- .../flash/tags/DefineShape4Tag.java | 5 +- .../flash/tags/DefineVideoStreamTag.java | 8 ++- .../flash/tags/ImportAssets2Tag.java | 13 +++-- .../flash/tags/SoundStreamHead2Tag.java | 8 ++- .../flash/tags/SoundStreamHeadTag.java | 7 ++- .../decompiler/flash/types/BUTTONRECORD.java | 3 ++ .../decompiler/flash/types/CLIPACTIONS.java | 5 ++ .../flash/types/CLIPEVENTFLAGS.java | 5 ++ .../decompiler/flash/types/LINESTYLE2.java | 3 ++ .../flash/types/MORPHLINESTYLE2.java | 3 ++ .../decompiler/flash/types/SOUNDINFO.java | 3 ++ .../flash/types/filters/BLURFILTER.java | 3 ++ .../types/filters/CONVOLUTIONFILTER.java | 3 ++ 35 files changed, 170 insertions(+), 309 deletions(-) delete mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/FloatEditor.java delete mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/IntegerEditor.java delete mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/LongEditor.java rename trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/{DoubleEditor.java => NumberEditor.java} (57%) delete mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/ShortEditor.java diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index f83cb2464..aae22682b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -1648,11 +1648,11 @@ public class SWFInputStream extends InputStream { ret.clipEventInitialize = readUB(1) == 1; ret.clipEventData = readUB(1) == 1; if (version >= 6) { - readUB(5); + ret.reserved = (int) readUB(5); ret.clipEventConstruct = readUB(1) == 1; ret.clipEventKeyPress = readUB(1) == 1; ret.clipEventDragOut = readUB(1) == 1; - readUB(8); + ret.reserved2 = (int) readUB(8); } return ret; } @@ -1682,7 +1682,7 @@ public class SWFInputStream extends InputStream { */ public CLIPACTIONS readCLIPACTIONS(SWF swf) throws IOException { CLIPACTIONS ret = new CLIPACTIONS(); - readUI16();//reserved + ret.reserved = readUI16(); ret.allEventFlags = readCLIPEVENTFLAGS(); CLIPACTIONRECORD cr; ret.clipActionRecords = new ArrayList<>(); @@ -1770,7 +1770,7 @@ public class SWFInputStream extends InputStream { } } ret.defaultColor = readRGBA(); - readUB(6);//reserved + ret.reserved = (int) readUB(6); ret.clamp = readUB(1) == 1; ret.preserveAlpha = readUB(1) == 1; return ret; @@ -1787,7 +1787,7 @@ public class SWFInputStream extends InputStream { ret.blurX = readFIXED(); ret.blurY = readFIXED(); ret.passes = (int) readUB(5); - readUB(3); //reserved + ret.reserved = (int) readUB(3); return ret; } @@ -1985,7 +1985,7 @@ public class SWFInputStream extends InputStream { */ public BUTTONRECORD readBUTTONRECORD(boolean inDefineButton2) throws IOException { BUTTONRECORD ret = new BUTTONRECORD(); - int res = (int) readUB(2); //reserved + ret.reserved = (int) readUB(2); ret.buttonHasBlendMode = readUB(1) == 1; ret.buttonHasFilterList = readUB(1) == 1; ret.buttonStateHitTest = readUB(1) == 1; @@ -1993,20 +1993,10 @@ public class SWFInputStream extends InputStream { ret.buttonStateOver = readUB(1) == 1; ret.buttonStateUp = readUB(1) == 1; - if (!ret.buttonHasBlendMode) { - if (!ret.buttonHasFilterList) { - if (!ret.buttonStateHitTest) { - if (!ret.buttonStateDown) { - if (!ret.buttonStateOver) { - if (!ret.buttonStateUp) { - if (res == 0) { - return null; - } - } - } - } - } - } + if (!ret.buttonHasBlendMode && !ret.buttonHasFilterList && + !ret.buttonStateHitTest && !ret.buttonStateDown && + !ret.buttonStateOver && !ret.buttonStateUp && ret.reserved == 0) { + return null; } ret.characterId = readUI16(); @@ -2208,7 +2198,7 @@ public class SWFInputStream extends InputStream { ret.noHScaleFlag = (int) readUB(1) == 1; ret.noVScaleFlag = (int) readUB(1) == 1; ret.pixelHintingFlag = (int) readUB(1) == 1; - readUB(5);//reserved + ret.reserved = (int) readUB(5); ret.noClose = (int) readUB(1) == 1; ret.endCapStyle = (int) readUB(2); if (ret.joinStyle == LINESTYLE2.MITER_JOIN) { @@ -2394,7 +2384,7 @@ public class SWFInputStream extends InputStream { */ public SOUNDINFO readSOUNDINFO() throws IOException { SOUNDINFO ret = new SOUNDINFO(); - readUB(2); + ret.reserved = (int) readUB(2); ret.syncStop = readUB(1) == 1; ret.syncNoMultiple = readUB(1) == 1; ret.hasEnvelope = readUB(1) == 1; @@ -2617,7 +2607,7 @@ public class SWFInputStream extends InputStream { ret.noHScaleFlag = (int) readUB(1) == 1; ret.noVScaleFlag = (int) readUB(1) == 1; ret.pixelHintingFlag = (int) readUB(1) == 1; - readUB(5);//reserved + ret.reserved = (int) readUB(5); ret.noClose = (int) readUB(1) == 1; ret.endCapStyle = (int) readUB(2); if (ret.joinStyle == LINESTYLE2.MITER_JOIN) { diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java index c1503fbc5..cb6858612 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java @@ -704,11 +704,11 @@ public class SWFOutputStream extends OutputStream { writeUB(1, value.clipEventInitialize ? 1 : 0); writeUB(1, value.clipEventData ? 1 : 0); if (version >= 6) { - writeUB(5, 0); + writeUB(5, value.reserved); writeUB(1, value.clipEventConstruct ? 1 : 0); writeUB(1, value.clipEventKeyPress ? 1 : 0); writeUB(1, value.clipEventDragOut ? 1 : 0); - writeUB(8, 0); + writeUB(8, value.reserved2); } } @@ -739,7 +739,7 @@ public class SWFOutputStream extends OutputStream { * @throws IOException */ public void writeCLIPACTIONS(CLIPACTIONS value) throws IOException { - writeUI16(0);//reserved + writeUI16(value.reserved); writeCLIPEVENTFLAGS(value.allEventFlags); for (CLIPACTIONRECORD car : value.clipActionRecords) { writeCLIPACTIONRECORD(car); @@ -818,7 +818,7 @@ public class SWFOutputStream extends OutputStream { } } writeRGBA(value.defaultColor); - writeUB(6, 0); //reserved + writeUB(6, value.reserved); writeUB(1, value.clamp ? 1 : 0); writeUB(1, value.preserveAlpha ? 1 : 0); } @@ -833,7 +833,7 @@ public class SWFOutputStream extends OutputStream { writeFIXED(value.blurX); writeFIXED(value.blurY); writeUB(5, value.passes); - writeUB(3, 0);//reserved + writeUB(3, value.reserved); } /** @@ -1014,7 +1014,7 @@ public class SWFOutputStream extends OutputStream { * @throws IOException */ public void writeBUTTONRECORD(BUTTONRECORD value, boolean inDefineButton2) throws IOException { - writeUB(2, 0);//reserved + writeUB(2, value.reserved); writeUB(1, value.buttonHasBlendMode ? 1 : 0); writeUB(1, value.buttonHasFilterList ? 1 : 0); writeUB(1, value.buttonStateHitTest ? 1 : 0); @@ -1220,7 +1220,7 @@ public class SWFOutputStream extends OutputStream { writeUB(1, value.noHScaleFlag ? 1 : 0); writeUB(1, value.noVScaleFlag ? 1 : 0); writeUB(1, value.pixelHintingFlag ? 1 : 0); - writeUB(5, 0);//reserved + writeUB(5, value.reserved); writeUB(1, value.noClose ? 1 : 0); writeUB(2, value.endCapStyle); if (value.joinStyle == LINESTYLE2.MITER_JOIN) { @@ -1374,7 +1374,7 @@ public class SWFOutputStream extends OutputStream { * @throws IOException */ public void writeSOUNDINFO(SOUNDINFO value) throws IOException { - writeUB(2, 0);//reserved + writeUB(2, value.reserved); writeUB(1, value.syncStop ? 1 : 0); writeUB(1, value.syncNoMultiple ? 1 : 0); writeUB(1, value.hasEnvelope ? 1 : 0); @@ -1580,7 +1580,7 @@ public class SWFOutputStream extends OutputStream { writeUB(1, value.noHScaleFlag ? 1 : 0); writeUB(1, value.noVScaleFlag ? 1 : 0); writeUB(1, value.pixelHintingFlag ? 1 : 0); - writeUB(5, 0);//reserved + writeUB(5, value.reserved); writeUB(1, value.noClose ? 1 : 0); writeUB(2, value.endCapStyle); if (value.joinStyle == LINESTYLE2.MITER_JOIN) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java index 013a65578..a3e5429db 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java @@ -48,6 +48,7 @@ public class ActionGetURL2 extends Action { public static final int POST = 2; public boolean loadTargetFlag; public boolean loadVariablesFlag; + public int reserved; public ActionGetURL2(int sendVarsMethod, boolean loadTargetFlag, boolean loadVariablesFlag) { super(0x9A, 1); @@ -60,7 +61,7 @@ public class ActionGetURL2 extends Action { super(0x9A, actionLength); loadVariablesFlag = sis.readUB(1) == 1; loadTargetFlag = sis.readUB(1) == 1; - sis.readUB(4); //reserved + reserved = (int) sis.readUB(4); sendVarsMethod = (int) sis.readUB(2); //This is first in documentation, which is WRONG! } @@ -76,7 +77,7 @@ public class ActionGetURL2 extends Action { try { sos.writeUB(1, loadVariablesFlag ? 1 : 0); sos.writeUB(1, loadTargetFlag ? 1 : 0); - sos.writeUB(4, 0); + sos.writeUB(4, reserved); sos.writeUB(2, sendVarsMethod); sos.close(); } catch (IOException e) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGotoFrame2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGotoFrame2.java index 898b7744a..f6aa53720 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGotoFrame2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGotoFrame2.java @@ -34,6 +34,7 @@ public class ActionGotoFrame2 extends Action { boolean sceneBiasFlag; boolean playFlag; public int sceneBias; + int reserved; public ActionGotoFrame2(boolean playFlag, boolean sceneBiasFlag, int sceneBias) { super(0x9F, 0); @@ -44,7 +45,7 @@ public class ActionGotoFrame2 extends Action { public ActionGotoFrame2(int actionLength, SWFInputStream sis) throws IOException { super(0x9F, actionLength); - sis.readUB(6); //reserved + reserved = (int) sis.readUB(6); sceneBiasFlag = sis.readUB(1) == 1; playFlag = sis.readUB(1) == 1; if (sceneBiasFlag) { @@ -57,7 +58,7 @@ public class ActionGotoFrame2 extends Action { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SWFOutputStream sos = new SWFOutputStream(baos, version); try { - sos.writeUB(6, 0); + sos.writeUB(6, reserved); sos.writeUB(1, sceneBiasFlag ? 1 : 0); sos.writeUB(1, playFlag ? 1 : 0); if (sceneBiasFlag) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java index 17f49fe8a..c9d24a9e4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java @@ -50,6 +50,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont public boolean preloadArgumentsFlag; public boolean suppressThisFlag; public boolean preloadThisFlag; + public int reserved; public boolean preloadGlobalFlag; public int registerCount; public int codeSize; @@ -92,7 +93,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont preloadArgumentsFlag = sis.readUB(1) == 1; suppressThisFlag = sis.readUB(1) == 1; preloadThisFlag = sis.readUB(1) == 1; - sis.readUB(7);//reserved + reserved = (int) sis.readUB(7); preloadGlobalFlag = sis.readUB(1) == 1; for (int i = 0; i < numParams; i++) { paramRegisters.add(sis.readUI8()); @@ -145,7 +146,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont sos.writeUB(1, preloadArgumentsFlag ? 1 : 0); sos.writeUB(1, suppressThisFlag ? 1 : 0); sos.writeUB(1, preloadThisFlag ? 1 : 0); - sos.writeUB(7, 0); + sos.writeUB(7, reserved); sos.writeUB(1, preloadGlobalFlag ? 1 : 0); for (int i = 0; i < paramNames.size(); i++) { sos.writeUI8(paramRegisters.get(i)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionTry.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionTry.java index f3805f330..4c8a48a78 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionTry.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionTry.java @@ -40,6 +40,7 @@ import java.util.Stack; public class ActionTry extends Action implements GraphSourceItemContainer { + public int reserved; public boolean catchInRegisterFlag; public boolean finallyBlockFlag; public boolean catchBlockFlag; @@ -66,8 +67,8 @@ public class ActionTry extends Action implements GraphSourceItemContainer { public ActionTry(int actionLength, SWFInputStream sis, int version) throws IOException { super(0x8F, actionLength); long startPos = sis.getPos(); - sis.readUB(5); this.version = version; + reserved = (int) sis.readUB(5); catchInRegisterFlag = sis.readUB(1) == 1; finallyBlockFlag = sis.readUB(1) == 1; catchBlockFlag = sis.readUB(1) == 1; @@ -91,7 +92,7 @@ public class ActionTry extends Action implements GraphSourceItemContainer { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SWFOutputStream sos = new SWFOutputStream(baos, version); try { - sos.writeUB(5, 0); + sos.writeUB(5, reserved); sos.writeUB(1, catchInRegisterFlag ? 1 : 0); sos.writeUB(1, finallyBlockFlag ? 1 : 0); sos.writeUB(1, catchBlockFlag ? 1 : 0); @@ -184,7 +185,7 @@ public class ActionTry extends Action implements GraphSourceItemContainer { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SWFOutputStream sos = new SWFOutputStream(baos, version); try { - sos.writeUB(5, 0); + sos.writeUB(5, reserved); sos.writeUB(1, catchInRegisterFlag ? 1 : 0); sos.writeUB(1, finallyBlockFlag ? 1 : 0); sos.writeUB(1, catchBlockFlag ? 1 : 0); diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java index f5d57775c..adceaa03b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -499,15 +499,15 @@ public class Configuration { public static Object getDefaultValue(Field field) { Object defaultValue = null; - ConfigurationDefaultBoolean aBool = (ConfigurationDefaultBoolean) field.getAnnotation(ConfigurationDefaultBoolean.class); + ConfigurationDefaultBoolean aBool = field.getAnnotation(ConfigurationDefaultBoolean.class); if (aBool != null) { defaultValue = aBool.value(); } - ConfigurationDefaultInt aInt = (ConfigurationDefaultInt) field.getAnnotation(ConfigurationDefaultInt.class); + ConfigurationDefaultInt aInt = field.getAnnotation(ConfigurationDefaultInt.class); if (aInt != null) { defaultValue = aInt.value(); } - ConfigurationDefaultString aString = (ConfigurationDefaultString) field.getAnnotation(ConfigurationDefaultString.class); + ConfigurationDefaultString aString = field.getAnnotation(ConfigurationDefaultString.class); if (aString != null) { defaultValue = aString.value(); } @@ -515,7 +515,7 @@ public class Configuration { } public static String getDescription(Field field) { - ConfigurationDescription a = (ConfigurationDescription) field.getAnnotation(ConfigurationDescription.class); + ConfigurationDescription a = field.getAnnotation(ConfigurationDescription.class); if (a != null) { return a.value(); } @@ -527,7 +527,7 @@ public class Configuration { Map result = new HashMap<>(); for (Field field : fields) { if (ConfigurationItem.class.isAssignableFrom(field.getType())) { - ConfigurationName annotation = (ConfigurationName) field.getAnnotation(ConfigurationName.class); + ConfigurationName annotation = field.getAnnotation(ConfigurationName.class); String name = annotation == null ? field.getName() : annotation.value(); result.put(name, field); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java index 300bd5309..8668600a0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java @@ -17,20 +17,18 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.gui.generictageditors.BooleanEditor; -import com.jpexs.decompiler.flash.gui.generictageditors.DoubleEditor; -import com.jpexs.decompiler.flash.gui.generictageditors.FloatEditor; import com.jpexs.decompiler.flash.gui.generictageditors.GenericTagEditor; -import com.jpexs.decompiler.flash.gui.generictageditors.IntegerEditor; -import com.jpexs.decompiler.flash.gui.generictageditors.LongEditor; -import com.jpexs.decompiler.flash.gui.generictageditors.ShortEditor; +import com.jpexs.decompiler.flash.gui.generictageditors.NumberEditor; import com.jpexs.decompiler.flash.gui.generictageditors.StringEditor; import com.jpexs.decompiler.flash.gui.helpers.SpringUtilities; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.tags.Tag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.RGB; import com.jpexs.decompiler.flash.types.ZONEDATA; import com.jpexs.decompiler.flash.types.ZONERECORD; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.awt.BorderLayout; import java.awt.Component; import java.lang.reflect.Field; @@ -152,16 +150,14 @@ public class GenericTagPanel extends JPanel { private int addEditor(String name, Object obj, Field field) throws IllegalArgumentException, IllegalAccessException { Component editor; Class type = field.getType(); - if (type.equals(int.class) || type.equals(Integer.class)) { - editor = new IntegerEditor(obj, field); - } else if (type.equals(short.class) || type.equals(Short.class)) { - editor = new ShortEditor(obj, field); - } else if (type.equals(long.class) || type.equals(Long.class)) { - editor = new LongEditor(obj, field); - } else if (type.equals(double.class) || type.equals(Double.class)) { - editor = new DoubleEditor(obj, field); - } else if (type.equals(float.class) || type.equals(Float.class)) { - editor = new FloatEditor(obj, field); + SWFType swfType = field.getAnnotation(SWFType.class); + BasicType basicType = swfType == null ? BasicType.NONE : swfType.value(); + if (type.equals(int.class) || type.equals(Integer.class) || + type.equals(short.class) || type.equals(Short.class) || + type.equals(long.class) || type.equals(Long.class) || + type.equals(double.class) || type.equals(Double.class) || + type.equals(float.class) || type.equals(Float.class)) { + editor = new NumberEditor(obj, field, basicType); } else if (type.equals(boolean.class) || type.equals(Boolean.class)) { editor = new BooleanEditor(obj, field); } else if (type.equals(String.class)) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/FloatEditor.java b/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/FloatEditor.java deleted file mode 100644 index 15abd3b4b..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/FloatEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.generictageditors; - -import java.awt.Color; -import java.lang.reflect.Field; -import javax.swing.JTextArea; - -/** - * - * @author JPEXS - */ -public class FloatEditor extends JTextArea implements GenericTagEditor { - - private final Object obj; - private final Field field; - - public FloatEditor(Object obj, Field field) { - setBackground(Color.white); - setSize(100, getSize().height); - setMaximumSize(getSize()); - setWrapStyleWord(true); - this.obj = obj; - this.field = field; - try { - setText(field.get(obj).toString()); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - } - - @Override - public void save() { - try { - field.set(obj, Float.parseFloat(getText())); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/IntegerEditor.java b/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/IntegerEditor.java deleted file mode 100644 index 2015d255d..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/IntegerEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.generictageditors; - -import java.awt.Color; -import java.lang.reflect.Field; -import javax.swing.JTextArea; - -/** - * - * @author JPEXS - */ -public class IntegerEditor extends JTextArea implements GenericTagEditor { - - private final Object obj; - private final Field field; - - public IntegerEditor(Object obj, Field field) { - setBackground(Color.white); - setSize(100, getSize().height); - setMaximumSize(getSize()); - setWrapStyleWord(true); - this.obj = obj; - this.field = field; - try { - setText(field.get(obj).toString()); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - } - - @Override - public void save() { - try { - field.set(obj, Integer.parseInt(getText())); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/LongEditor.java b/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/LongEditor.java deleted file mode 100644 index 01eb6e3de..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/LongEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.generictageditors; - -import java.awt.Color; -import java.lang.reflect.Field; -import javax.swing.JTextArea; - -/** - * - * @author JPEXS - */ -public class LongEditor extends JTextArea implements GenericTagEditor { - - private final Object obj; - private final Field field; - - public LongEditor(Object obj, Field field) { - setBackground(Color.white); - setSize(100, getSize().height); - setMaximumSize(getSize()); - setWrapStyleWord(true); - this.obj = obj; - this.field = field; - try { - setText(field.get(obj).toString()); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - } - - @Override - public void save() { - try { - field.set(obj, Long.parseLong(getText())); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/DoubleEditor.java b/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/NumberEditor.java similarity index 57% rename from trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/DoubleEditor.java rename to trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/NumberEditor.java index 8d537ef57..5749fe72f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/DoubleEditor.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/NumberEditor.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui.generictageditors; +import com.jpexs.decompiler.flash.types.BasicType; import java.awt.Color; import java.lang.reflect.Field; import javax.swing.JTextArea; @@ -24,18 +25,20 @@ import javax.swing.JTextArea; * * @author JPEXS */ -public class DoubleEditor extends JTextArea implements GenericTagEditor { +public class NumberEditor extends JTextArea implements GenericTagEditor { private final Object obj; private final Field field; + private final BasicType basicType; - public DoubleEditor(Object obj, Field field) { + public NumberEditor(Object obj, Field field, BasicType basicType) { setBackground(Color.white); setSize(100, getSize().height); setMaximumSize(getSize()); setWrapStyleWord(true); this.obj = obj; this.field = field; + this.basicType = basicType; try { setText(field.get(obj).toString()); } catch (IllegalArgumentException | IllegalAccessException ex) { @@ -46,7 +49,18 @@ public class DoubleEditor extends JTextArea implements GenericTagEditor { @Override public void save() { try { - field.set(obj, Double.parseDouble(getText())); + Class type = field.getType(); + if (type.equals(int.class) || type.equals(Integer.class)) { + field.set(obj, Integer.parseInt(getText())); + } else if (type.equals(short.class) || type.equals(Short.class)) { + field.set(obj, Short.parseShort(getText())); + } else if (type.equals(long.class) || type.equals(Long.class)) { + field.set(obj, Long.parseLong(getText())); + } else if (type.equals(double.class) || type.equals(Double.class)) { + field.set(obj, Double.parseDouble(getText())); + } else if (type.equals(float.class) || type.equals(Float.class)) { + field.set(obj, Float.parseFloat(getText())); + } } catch (IllegalArgumentException | IllegalAccessException ex) { // ignore } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/ShortEditor.java b/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/ShortEditor.java deleted file mode 100644 index a5c2599f2..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/gui/generictageditors/ShortEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.generictageditors; - -import java.awt.Color; -import java.lang.reflect.Field; -import javax.swing.JTextArea; - -/** - * - * @author JPEXS - */ -public class ShortEditor extends JTextArea implements GenericTagEditor { - - private final Object obj; - private final Field field; - - public ShortEditor(Object obj, Field field) { - setBackground(Color.white); - setSize(100, getSize().height); - setMaximumSize(getSize()); - setWrapStyleWord(true); - this.obj = obj; - this.field = field; - try { - setText(field.get(obj).toString()); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - } - - @Override - public void save() { - try { - field.set(obj, Short.parseShort(getText())); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java index 40b4fc628..cbe891931 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/CSMTextSettingsTag.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -42,12 +43,18 @@ public class CSMTextSettingsTag extends Tag { @SWFType(value = BasicType.UB, count = 3) public int gridFit; + @Reserved + public int reserved; + @SWFType(value = BasicType.FLOAT) //F32 = FLOAT public float thickness; @SWFType(value = BasicType.FLOAT) //F32 = FLOAT public float sharpness; + @Reserved + public int reserved2; + public static final int ID = 74; /** @@ -65,10 +72,10 @@ public class CSMTextSettingsTag extends Tag { sos.writeUI16(textID); sos.writeUB(2, useFlashType); sos.writeUB(3, gridFit); - sos.writeUB(3, 0); + sos.writeUB(3, reserved); sos.writeFLOAT(thickness); //F32 = FLOAT sos.writeFLOAT(sharpness); //F32 = FLOAT - sos.writeUI8(0); + sos.writeUI8(reserved2); } catch (IOException e) { } return baos.toByteArray(); @@ -89,10 +96,10 @@ public class CSMTextSettingsTag extends Tag { textID = sis.readUI16(); useFlashType = (int) sis.readUB(2); gridFit = (int) sis.readUB(3); - sis.readUB(3); //reserved + reserved = (int) sis.readUB(3); thickness = sis.readFLOAT(); //F32 = FLOAT sharpness = sis.readFLOAT(); //F32 = FLOAT - sis.readUI8(); //reserved + reserved2 = sis.readUI8(); //reserved } /** diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index 5dbb645b9..ef01d52db 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -34,6 +34,7 @@ import com.jpexs.decompiler.flash.types.BUTTONRECORD; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RECT; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.Cache; import com.jpexs.helpers.SerializableImage; @@ -65,6 +66,9 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded @SWFType(BasicType.UI16) public int buttonId; + @Reserved + public int reserved; + /** * Track as menu button */ @@ -102,7 +106,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded super(swf, ID, "DefineButton2", data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); buttonId = sis.readUI16(); - sis.readUB(7); //reserved + reserved = (int) sis.readUB(7); trackAsMenu = sis.readUB(1) == 1; int actionOffset = sis.readUI16(); characters = sis.readBUTTONRECORDList(true); @@ -133,7 +137,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded SWFOutputStream sos = new SWFOutputStream(os, version); try { sos.writeUI16(buttonId); - sos.writeUB(7, 0); //reserved + sos.writeUB(7, reserved); sos.writeUB(1, trackAsMenu ? 1 : 0); ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java index 9ba69a699..e5a9feecb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java @@ -62,7 +62,7 @@ public class DefineFont2Tag extends FontTag { public int numGlyphs; public List glyphShapeTable; - @SWFType(value = BasicType.UI16, alternateValue = BasicType.UI32, alternateCondition = "fontFlagsWideCodes") + @SWFType(value = BasicType.UI8, alternateValue = BasicType.UI16, alternateCondition = "fontFlagsWideCodes") public List codeTable; @SWFType(BasicType.UI16) diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java index 6d6e643f0..fb9230be4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java @@ -61,7 +61,7 @@ public class DefineFont3Tag extends FontTag { public List glyphShapeTable; - @SWFType(value = BasicType.UI16, alternateValue = BasicType.UI32, alternateCondition = "fontFlagsWideCodes") + @SWFType(value = BasicType.UI8, alternateValue = BasicType.UI16, alternateCondition = "fontFlagsWideCodes") public List codeTable; @SWFType(BasicType.UI16) diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java index c3128c437..87ae6be02 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont4Tag.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -32,6 +33,8 @@ public class DefineFont4Tag extends CharacterTag { @SWFType(BasicType.UI16) public int fontID; + @Reserved + public int reserved; public boolean fontFlagsHasFontData; public boolean fontFlagsItalic; public boolean fontFlagsBold; @@ -48,7 +51,7 @@ public class DefineFont4Tag extends CharacterTag { super(swf, ID, "DefineFont4", data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); fontID = sis.readUI16(); - sis.readUB(5); + reserved = (int) sis.readUB(5); fontFlagsHasFontData = sis.readUB(1) == 1; fontFlagsItalic = sis.readUB(1) == 1; fontFlagsBold = sis.readUB(1) == 1; @@ -69,7 +72,7 @@ public class DefineFont4Tag extends CharacterTag { SWFOutputStream sos = new SWFOutputStream(os, version); try { sos.writeUI16(fontID); - sos.writeUB(5, 0); + sos.writeUB(5, reserved); sos.writeUB(1, fontFlagsHasFontData ? 1 : 0); sos.writeUB(1, fontFlagsItalic ? 1 : 0); sos.writeUB(1, fontFlagsBold ? 1 : 0); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java index b7b390c74..cb31f5668 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontAlignZonesTag.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.ZONERECORD; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -35,6 +36,8 @@ public class DefineFontAlignZonesTag extends Tag { public int fontID; @SWFType(value = BasicType.UB, count = 2) public int CSMTableHint; + @Reserved + public int reserved; public List zoneTable; public static final int ID = 73; @@ -43,7 +46,7 @@ public class DefineFontAlignZonesTag extends Tag { SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); fontID = sis.readUI16(); CSMTableHint = (int) sis.readUB(2); - sis.readUB(6); + reserved = (int) sis.readUB(6); zoneTable = new ArrayList<>(); while (sis.available() > 0) { ZONERECORD zr = sis.readZONERECORD(); @@ -65,7 +68,7 @@ public class DefineFontAlignZonesTag extends Tag { try { sos.writeUI16(fontID); sos.writeUB(2, CSMTableHint); - sos.writeUB(6, 0); + sos.writeUB(6, reserved); for (ZONERECORD z : zoneTable) { sos.writeZONERECORD(z); } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java index 5305f31cb..5c07d11c3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfo2Tag.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.LANGCODE; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.utf8.Utf8Helper; import java.io.ByteArrayInputStream; @@ -40,6 +41,8 @@ public class DefineFontInfo2Tag extends Tag { @SWFType(BasicType.UI16) public int fontID; public String fontName; + @Reserved + public int reserved; public boolean fontFlagsSmallText; public boolean fontFlagsShiftJIS; public boolean fontFlagsANSI; @@ -67,7 +70,7 @@ public class DefineFontInfo2Tag extends Tag { byte[] fontNameBytes = Utf8Helper.getBytes(fontName); sos.writeUI8(fontNameBytes.length); sos.write(fontNameBytes); - sos.writeUB(2, 0); + sos.writeUB(2, reserved); sos.writeUB(1, fontFlagsSmallText ? 1 : 0); sos.writeUB(1, fontFlagsShiftJIS ? 1 : 0); sos.writeUB(1, fontFlagsANSI ? 1 : 0); @@ -101,7 +104,7 @@ public class DefineFontInfo2Tag extends Tag { } else { fontName = new String(sis.readBytesEx(fontNameLen)); } - sis.readUB(2);//reserved + reserved = (int) sis.readUB(2); fontFlagsSmallText = sis.readUB(1) == 1; fontFlagsShiftJIS = sis.readUB(1) == 1; fontFlagsANSI = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java index 0b217f0ba..7bfd226fd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFontInfoTag.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.utf8.Utf8Helper; import java.io.ByteArrayInputStream; @@ -39,6 +40,8 @@ public class DefineFontInfoTag extends Tag { @SWFType(BasicType.UI16) public int fontId; public String fontName; + @Reserved + public int reserved; public boolean fontFlagsSmallText; public boolean fontFlagsShiftJIS; public boolean fontFlagsANSI; @@ -65,7 +68,7 @@ public class DefineFontInfoTag extends Tag { byte[] fontNameBytes = Utf8Helper.getBytes(fontName); sos.writeUI8(fontNameBytes.length); sos.write(fontNameBytes); - sos.writeUB(2, 0); //reserved + sos.writeUB(2, reserved); sos.writeUB(1, fontFlagsSmallText ? 1 : 0); sos.writeUB(1, fontFlagsShiftJIS ? 1 : 0); sos.writeUB(1, fontFlagsANSI ? 1 : 0); @@ -103,7 +106,7 @@ public class DefineFontInfoTag extends Tag { } else { fontName = new String(sis.readBytesEx(fontNameLen)); } - sis.readUB(2); //reserved + reserved = (int) sis.readUB(2); fontFlagsSmallText = sis.readUB(1) == 1; fontFlagsShiftJIS = sis.readUB(1) == 1; fontFlagsANSI = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java index 0d90fffee..94ef8e1c7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java @@ -34,6 +34,7 @@ import com.jpexs.decompiler.flash.types.MORPHLINESTYLEARRAY; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPE; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord; import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord; @@ -65,6 +66,8 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo public RECT endBounds; public RECT startEdgeBounds; public RECT endEdgeBounds; + @Reserved + public int reserved; public boolean usesNonScalingStrokes; public boolean usesScalingStrokes; public MORPHFILLSTYLEARRAY morphFillStyles; @@ -114,7 +117,7 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo sos.writeRECT(endBounds); sos.writeRECT(startEdgeBounds); sos.writeRECT(endEdgeBounds); - sos.writeUB(6, 0); + sos.writeUB(6, reserved); sos.writeUB(1, usesNonScalingStrokes ? 1 : 0); sos.writeUB(1, usesScalingStrokes ? 1 : 0); ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); @@ -148,7 +151,7 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo endBounds = sis.readRECT(); startEdgeBounds = sis.readRECT(); endEdgeBounds = sis.readRECT(); - sis.readUB(6); //reserved + reserved = (int) sis.readUB(6); usesNonScalingStrokes = sis.readUB(1) == 1; usesScalingStrokes = sis.readUB(1) == 1; long offset = sis.readUI32(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java index c8a7100bc..a0b51e777 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; import java.io.ByteArrayInputStream; @@ -43,6 +44,8 @@ public class DefineShape4Tag extends CharacterTag implements BoundedTag, ShapeTa public int shapeId; public RECT shapeBounds; public RECT edgeBounds; + @Reserved + public int reserved; public boolean usesFillWindingRule; public boolean usesNonScalingStrokes; public boolean usesScalingStrokes; @@ -97,7 +100,7 @@ public class DefineShape4Tag extends CharacterTag implements BoundedTag, ShapeTa shapeId = sis.readUI16(); shapeBounds = sis.readRECT(); edgeBounds = sis.readRECT(); - sis.readUB(5); + reserved = (int) sis.readUB(5); usesFillWindingRule = sis.readUB(1) == 1; usesNonScalingStrokes = sis.readUB(1) == 1; usesScalingStrokes = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java index 88da7d3a0..0e2f24cb4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.RECT; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -50,6 +51,9 @@ public class DefineVideoStreamTag extends CharacterTag implements BoundedTag { @SWFType(BasicType.UI16) public int height; + @Reserved + public int reserved; + @SWFType(value = BasicType.UB, count = 3) public int videoFlagsDeblocking; @@ -85,7 +89,7 @@ public class DefineVideoStreamTag extends CharacterTag implements BoundedTag { sos.writeUI16(numFrames); sos.writeUI16(width); sos.writeUI16(height); - sos.writeUB(4, 0); + sos.writeUB(4, reserved); sos.writeUB(3, videoFlagsDeblocking); sos.writeUB(1, videoFlagsSmoothing ? 1 : 0); sos.writeUI8(codecID); @@ -109,7 +113,7 @@ public class DefineVideoStreamTag extends CharacterTag implements BoundedTag { numFrames = sis.readUI16(); width = sis.readUI16(); height = sis.readUI16(); - sis.readUB(4); + reserved = (int) sis.readUB(4); videoFlagsDeblocking = (int) sis.readUB(3); videoFlagsSmoothing = sis.readUB(1) == 1; codecID = sis.readUI8(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java index 73b77b47a..1d1122cd7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/ImportAssets2Tag.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.ImportTag; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -34,6 +35,10 @@ import java.util.HashMap; public class ImportAssets2Tag extends Tag implements ImportTag { public String url; + @Reserved + public int reserved1 = 1; + @Reserved + public int reserved2; /** * HashMap with assets */ @@ -53,8 +58,8 @@ public class ImportAssets2Tag extends Tag implements ImportTag { assets = new HashMap<>(); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); url = sis.readString(); - sis.readUI8();//reserved, must be 1 - sis.readUI8();//reserved, must be 0 + reserved1 = sis.readUI8();//reserved, must be 1 + reserved2 = sis.readUI8();//reserved, must be 0 int count = sis.readUI16(); for (int i = 0; i < count; i++) { int characterId = sis.readUI16(); @@ -76,8 +81,8 @@ public class ImportAssets2Tag extends Tag implements ImportTag { SWFOutputStream sos = new SWFOutputStream(os, version); try { sos.writeString(url); - sos.writeUI8(1); //reserved - sos.writeUI8(0); //reserved + sos.writeUI8(reserved1); + sos.writeUI8(reserved2); sos.writeUI16(assets.size()); for (int characterId : assets.keySet()) { sos.writeUI16(characterId); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java index c26e1fb6f..7d0811ef9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.Conditional; import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -37,6 +38,9 @@ import java.io.OutputStream; */ public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHeadTypeTag { + @Reserved + public int reserved; + @SWFType(value = BasicType.UB, count = 2) public int playBackSoundRate; @@ -101,7 +105,7 @@ public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHead OutputStream os = baos; SWFOutputStream sos = new SWFOutputStream(os, version); try { - sos.writeUB(4, 0);//reserved + sos.writeUB(4, reserved); sos.writeUB(2, playBackSoundRate); sos.writeUB(1, playBackSoundSize ? 1 : 0); sos.writeUB(1, playBackSoundType ? 1 : 0); @@ -130,7 +134,7 @@ public class SoundStreamHead2Tag extends CharacterTag implements SoundStreamHead public SoundStreamHead2Tag(SWF swf, byte[] data, int version, long pos) throws IOException { super(swf, ID, "SoundStreamHead2", data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); - sis.readUB(4);//reserved + reserved = (int) sis.readUB(4); playBackSoundRate = (int) sis.readUB(2); playBackSoundSize = sis.readUB(1) == 1; playBackSoundType = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java index 0cf9234a4..e9d999fb8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.Conditional; import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -37,6 +38,8 @@ import java.io.OutputStream; */ public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadTypeTag { + @Reserved + public int reserved; @SWFType(value = BasicType.UB, count = 2) public int playBackSoundRate; public boolean playBackSoundSize; @@ -93,7 +96,7 @@ public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadT OutputStream os = baos; SWFOutputStream sos = new SWFOutputStream(os, version); try { - sos.writeUB(4, 0);//reserved + sos.writeUB(4, reserved); sos.writeUB(2, playBackSoundRate); sos.writeUB(1, playBackSoundSize ? 1 : 0); sos.writeUB(1, playBackSoundType ? 1 : 0); @@ -121,7 +124,7 @@ public class SoundStreamHeadTag extends CharacterTag implements SoundStreamHeadT public SoundStreamHeadTag(SWF swf, byte[] data, int version, long pos) throws IOException { super(swf, ID, "SoundStreamHead", data, pos); SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version); - sis.readUB(4);//reserved + reserved = (int) sis.readUB(4); playBackSoundRate = (int) sis.readUB(2); playBackSoundSize = sis.readUB(1) == 1; playBackSoundType = sis.readUB(1) == 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java index 300ffa702..b8c81771a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/BUTTONRECORD.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.types; import com.jpexs.decompiler.flash.tags.DefineButton2Tag; import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.filters.FILTER; import java.util.List; @@ -29,6 +30,8 @@ import java.util.List; */ public class BUTTONRECORD { + @Reserved + public int reserved; /** * @since SWF 8 Has blend mode? */ diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONS.java b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONS.java index d4b456e56..109b7c337 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONS.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CLIPACTIONS.java @@ -16,6 +16,8 @@ */ package com.jpexs.decompiler.flash.types; +import com.jpexs.decompiler.flash.types.annotations.Reserved; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import java.util.ArrayList; import java.util.List; @@ -26,6 +28,9 @@ import java.util.List; */ public class CLIPACTIONS { + @Reserved + @SWFType(BasicType.UI16) + public int reserved; /** * All events used in these clip actions */ diff --git a/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java b/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java index c6ddd2d2a..ab7d5cd08 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/CLIPEVENTFLAGS.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.types; import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.helpers.Helper; import java.util.ArrayList; import java.util.List; @@ -99,6 +100,8 @@ public class CLIPEVENTFLAGS { * Data received event */ public boolean clipEventData; + @Reserved + public int reserved; /** * @since SWF 7 Construct event */ @@ -114,6 +117,8 @@ public class CLIPEVENTFLAGS { */ @Conditional(minSwfVersion = 6) public boolean clipEventDragOut = false; + @Reserved + public int reserved2; public String getHeader(int key, boolean asFileName) { String ret = ""; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE2.java b/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE2.java index 065ea1144..1ce2f5731 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE2.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/LINESTYLE2.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.types; import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; /** @@ -36,6 +37,8 @@ public class LINESTYLE2 extends LINESTYLE { public boolean noHScaleFlag; public boolean noVScaleFlag; public boolean pixelHintingFlag; + @Reserved + public int reserved; public boolean noClose; @SWFType(value = BasicType.UB, count = 2) public int endCapStyle; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE2.java b/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE2.java index 488594722..bb1ac3b33 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE2.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/MORPHLINESTYLE2.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.types; import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; /** @@ -40,6 +41,8 @@ public class MORPHLINESTYLE2 { public boolean noHScaleFlag; public boolean noVScaleFlag; public boolean pixelHintingFlag; + @Reserved + public int reserved; public boolean noClose; @SWFType(value = BasicType.UB, count = 2) diff --git a/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java b/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java index ed15aabd4..9d1a9e877 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/SOUNDINFO.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.types; import com.jpexs.decompiler.flash.types.annotations.Conditional; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; /** @@ -25,6 +26,8 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType; */ public class SOUNDINFO { + @Reserved + public int reserved; public boolean syncStop; public boolean syncNoMultiple; public boolean hasEnvelope; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/BLURFILTER.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/BLURFILTER.java index 2ba7ed0a9..a48af064f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/BLURFILTER.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/BLURFILTER.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.types.filters; import com.jpexs.decompiler.flash.types.BasicType; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; @@ -42,6 +43,8 @@ public class BLURFILTER extends FILTER { */ @SWFType(value = BasicType.UB, count = 5) public int passes; + @Reserved + public int reserved; public BLURFILTER() { super(1); diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/CONVOLUTIONFILTER.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/CONVOLUTIONFILTER.java index bad9a80fc..5f0857519 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/CONVOLUTIONFILTER.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/CONVOLUTIONFILTER.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.types.filters; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.RGBA; +import com.jpexs.decompiler.flash.types.annotations.Reserved; import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.SerializableImage; @@ -57,6 +58,8 @@ public class CONVOLUTIONFILTER extends FILTER { * Default color for pixels outside the image */ public RGBA defaultColor; + @Reserved + public int reserved; /** * Clamp mode */