diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/DisassemblyListener.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/DisassemblyListener.java index 9709c2d83..4b9b57721 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/DisassemblyListener.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/DisassemblyListener.java @@ -23,6 +23,8 @@ package com.jpexs.decompiler.flash; public interface DisassemblyListener { public void progressReading(long pos, long total); + public void progressToString(long pos, long total); + public void progressDeobfuscating(long pos, long total); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 4243fb827..457a8daa6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -573,7 +573,7 @@ public final class SWF implements TreeItem, Timelined { assignClassesToSymbols(); findFileAttributes(); findABCTags(); - + SWFDecompilerPlugin.fireSwfParsed(this); } else { boolean hasNonUnknownTag = false; @@ -1188,7 +1188,7 @@ public final class SWF implements TreeItem, Timelined { getASMs("", list, asms); return asms; } - + private static void getASMs(String path, List nodes, Map result) { for (TreeNode n : nodes) { String subPath = path + "/" + n.toString(); @@ -1206,7 +1206,7 @@ public final class SWF implements TreeItem, Timelined { getASMs(subPath, n.subNodes, result); } } - + public static void getTagsFromTreeNodes(List treeNodes, List result) { for (TreeNode treeNode : treeNodes) { TreeItem treeItem = treeNode.getItem(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java index ae959c6a3..eb70251d7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -572,7 +572,7 @@ public class ABC { System.out.println(""+t.toString()); } System.exit(0);*/ - + SWFDecompilerPlugin.fireAbcParsed(this, swf); } @@ -1178,7 +1178,7 @@ public class ABC { pack(); //removes old classes/methods ((Tag) parentTag).setModified(true); } - + public void pack() { for (int c = 0; c < instance_info.size(); c++) { if (instance_info.get(c).deleted) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 0b6922696..bda6b3af5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -854,7 +854,7 @@ public class AVM2Code implements Cloneable { ais.endDumpLevelUntil(diParent); } } - + code.addAll(codeMap.values()); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index 649c64255..3bbc231dd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -95,7 +95,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { public String toString() { StringBuilder s = new StringBuilder(); s.append(definition.instructionName); - if (operands != null) { + if (operands != null) { for (int i = 0; i < operands.length; i++) { s.append(" "); s.append(operands[i]); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index 38252c295..64dc0a09c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -1619,7 +1619,7 @@ public class AVM2SourceGenerator implements SourceGenerator { mbody.method_info = abc.addMethodInfo(mi); mi.setBody(mbody); - List mbodyCode = toInsList(src); + List mbodyCode = toInsList(src); mbody.setCode(new AVM2Code()); mbody.getCode().code = mbodyCode; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java index 44d7aa6e8..664443595 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java @@ -101,7 +101,6 @@ public abstract class AssignableAVM2Item extends AVM2Item { ret.add(ins(new KillIns(), register.getVal())); return ret; }*/ - public static List killTemp(SourceGeneratorLocalData localData, SourceGenerator generator, List> registers) { List ret = new ArrayList<>(); for (Reference register : registers) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java index 824f78fe9..607b11ab4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java @@ -758,7 +758,8 @@ public final class MethodInfoLexer { * * @return the next token * @exception java.io.IOException if any I/O-Error occurs - * @throws com.jpexs.decompiler.flash.abc.methodinfo_parser.MethodInfoParseException + * @throws + * com.jpexs.decompiler.flash.abc.methodinfo_parser.MethodInfoParseException */ public ParsedSymbol yylex() throws java.io.IOException, MethodInfoParseException { int zzInput; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index 565269dc6..abd640128 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -76,11 +76,11 @@ public class MethodBody implements Cloneable { } return code; } - + public void setCode(AVM2Code code) { this.code = code; } - + public List getExceptionEntries() { List ret = new ArrayList<>(); for (ABCException e : exceptions) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionList.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionList.java index d69609f0b..d82b8231c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionList.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionList.java @@ -139,8 +139,7 @@ public class ActionList extends ArrayList { } @Override - public void remove() - { + public void remove() { throw new UnsupportedOperationException(); } }; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/Matrix.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/Matrix.java index 1489cc15d..cabc54eaa 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/Matrix.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/Matrix.java @@ -102,18 +102,18 @@ public class Matrix { public Point transform(Point point) { return transform(point.x, point.y); } - - public Point deltaTransform(double x, double y){ + + public Point deltaTransform(double x, double y) { Point result = new Point( scaleX * x + rotateSkew1 * y, rotateSkew0 * x + scaleY * y); return result; } - + public Point deltaTransform(Point point) { return deltaTransform(point.x, point.y); } - + public java.awt.Point deltaTransform(java.awt.Point point) { Point p = deltaTransform(point.x, point.y); return new java.awt.Point((int) p.x, (int) p.y); @@ -245,48 +245,47 @@ public class Matrix { public String toString() { return "[Matrix scale:" + scaleX + "," + scaleY + ", rotate:" + rotateSkew0 + "," + rotateSkew1 + ", translate:" + translateX + "," + translateY + "]"; } - - public Matrix inverse(Matrix m){ - double a=m.scaleX; - double b=m.rotateSkew0; - double c=m.rotateSkew1; - double d=m.scaleY; - double tx=m.translateX; - double ty=m.translateY; - - double a2=d/(a*d-b*c); - double b2=-b/(a*d-b*c); - double c2=-c/(a*d-b*c); - double d2=a*(a*d-b*c); - double tx2=(c*ty-d*tx)/(a*d-b*c); - double ty2=-(a*ty-b*tx)/(a*d-b*c); - - Matrix ret=new Matrix(); - ret.scaleX = a2; - ret.rotateSkew0 = b2; - ret.rotateSkew1 = c2; - ret.scaleY = d2; - ret.translateX = tx2; - ret.translateY = ty2; - return ret; + + public Matrix inverse(Matrix m) { + double a = m.scaleX; + double b = m.rotateSkew0; + double c = m.rotateSkew1; + double d = m.scaleY; + double tx = m.translateX; + double ty = m.translateY; + + double a2 = d / (a * d - b * c); + double b2 = -b / (a * d - b * c); + double c2 = -c / (a * d - b * c); + double d2 = a * (a * d - b * c); + double tx2 = (c * ty - d * tx) / (a * d - b * c); + double ty2 = -(a * ty - b * tx) / (a * d - b * c); + + Matrix ret = new Matrix(); + ret.scaleX = a2; + ret.rotateSkew0 = b2; + ret.rotateSkew1 = c2; + ret.scaleY = d2; + ret.translateX = tx2; + ret.translateY = ty2; + return ret; } - - - public double getTotalSkewAngleX(){ - Point px = deltaTransform(new Point(0,1)); - return ((180/Math.PI) * Math.atan2(px.y, px.x) - 90); + + public double getTotalSkewAngleX() { + Point px = deltaTransform(new Point(0, 1)); + return ((180 / Math.PI) * Math.atan2(px.y, px.x) - 90); } - - public double getTotalSkewAngleY(){ - Point py = deltaTransform(new Point(1,0)); - return ((180/Math.PI) * Math.atan2(py.y, py.x)); + + public double getTotalSkewAngleY() { + Point py = deltaTransform(new Point(1, 0)); + return ((180 / Math.PI) * Math.atan2(py.y, py.x)); } - - public double getTotalScaleX(){ + + public double getTotalScaleX() { return Math.sqrt(scaleX * scaleX + rotateSkew0 * rotateSkew0); } - - public double getTotalScaleY(){ + + public double getTotalScaleY() { return Math.sqrt(rotateSkew1 * rotateSkew1 + scaleY * scaleY); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java index b2d37ddb0..985801212 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java @@ -34,6 +34,6 @@ public interface SWFDecompilerListener { void actionListParsed(ActionList actions, SWF swf); void abcParsed(ABC abc, SWF swf); - + void methodBodyParsed(MethodBody body, SWF swf); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerPlugin.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerPlugin.java index cec0156c1..07938b63d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerPlugin.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerPlugin.java @@ -79,7 +79,7 @@ public class SWFDecompilerPlugin { logger.log(Level.SEVERE, null, ex); } } - + public static byte[] fireProxyFileCatched(byte[] data) { byte[] result = null; for (SWFDecompilerListener listener : listeners) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ImageImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ImageImporter.java index 74c6eb2c7..630743d7a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ImageImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ImageImporter.java @@ -28,7 +28,7 @@ import java.io.IOException; * @author JPEXS */ public class ImageImporter extends TagImporter { - + public Tag importImage(ImageTag it, byte[] newData) throws IOException { if (it instanceof DefineBitsTag) { SWF swf = it.getSwf(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/TagImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/TagImporter.java index 30eea0f35..9d94208b5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/TagImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/TagImporter.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. */ - package com.jpexs.decompiler.flash.importers; /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java index e02ce4db2..e8fd8fb2a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java @@ -37,7 +37,7 @@ import java.util.List; * @author JPEXS */ public class DefineFontTag extends FontTag { - + @SWFType(BasicType.UI16) public int fontId; public List glyphShapeTable; @@ -46,22 +46,22 @@ public class DefineFontTag extends FontTag { @Internal private DefineFontInfo2Tag fontInfo2Tag = null; public static final int ID = 10; - + @Override public boolean isSmall() { return false; } - + @Override public double getGlyphAdvance(int glyphIndex) { return -1; } - + @Override public int getGlyphWidth(int glyphIndex) { return glyphShapeTable.get(glyphIndex).getBounds().getWidth(); } - + private void ensureFontInfo() { if (fontInfoTag == null) { for (Tag t : swf.tags) { @@ -80,7 +80,7 @@ public class DefineFontTag extends FontTag { } } } - + @Override public char glyphToChar(int glyphIndex) { ensureFontInfo(); @@ -92,7 +92,7 @@ public class DefineFontTag extends FontTag { return '?'; } } - + @Override public int charToGlyph(char c) { ensureFontInfo(); @@ -102,7 +102,7 @@ public class DefineFontTag extends FontTag { return fontInfoTag.codeTable.indexOf((int) c); } return -1; - + } /** @@ -147,7 +147,7 @@ public class DefineFontTag extends FontTag { int firstOffset = sis.readUI16("firstOffset"); int nGlyphs = firstOffset / 2; glyphShapeTable = new ArrayList<>(); - + for (int i = 1; i < nGlyphs; i++) { sis.readUI16("offset"); //offset } @@ -155,22 +155,22 @@ public class DefineFontTag extends FontTag { glyphShapeTable.add(sis.readSHAPE(1, false, "shape")); } } - + @Override public int getFontId() { return fontId; } - + @Override public List getGlyphShapeTable() { return glyphShapeTable; } - + @Override public int getCharacterId() { return fontId; } - + @Override public String getFontName() { ensureFontInfo(); @@ -182,7 +182,7 @@ public class DefineFontTag extends FontTag { } return null; } - + @Override public boolean isBold() { if (fontInfo2Tag != null) { @@ -193,7 +193,7 @@ public class DefineFontTag extends FontTag { } return false; } - + @Override public boolean isItalic() { if (fontInfo2Tag != null) { @@ -204,26 +204,26 @@ public class DefineFontTag extends FontTag { } return false; } - + @Override public boolean isSmallEditable() { return false; } - + @Override public boolean isBoldEditable() { return fontInfo2Tag != null || fontInfoTag != null; } - + @Override public boolean isItalicEditable() { return fontInfo2Tag != null || fontInfoTag != null; } - + @Override public void setSmall(boolean value) { } - + @Override public void setBold(boolean value) { if (fontInfo2Tag != null) { @@ -233,7 +233,7 @@ public class DefineFontTag extends FontTag { fontInfoTag.fontFlagsBold = value; } } - + @Override public void setItalic(boolean value) { if (fontInfo2Tag != null) { @@ -243,27 +243,27 @@ public class DefineFontTag extends FontTag { fontInfoTag.fontFlagsItalic = value; } } - + @Override public int getAscent() { return -1; } - + @Override public int getDescent() { return -1; } - + @Override public int getLeading() { return -1; } - + @Override public int getDivider() { return 1; } - + @Override public void addCharacter(char character, String fontName) { SHAPE shp = SHAPERECORD.systemFontCharacterToSHAPE(fontName, getFontStyle(), getDivider() * 1024, character); @@ -297,10 +297,10 @@ public class DefineFontTag extends FontTag { } else { glyphShapeTable.set(pos, shp); } - + setModified(true); } - + @Override public String getCharacters(List tags) { String ret = ""; @@ -317,7 +317,7 @@ public class DefineFontTag extends FontTag { } return ret; } - + @Override public int getGlyphKerningAdjustment(int glyphIndex, int nextGlyphIndex) { return 0; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index 4155b4652..062c8313e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -58,7 +58,7 @@ public class Timeline { public RECT displayRect; public int frameRate; public List tags; - public Map depthMaxFrame = new HashMap<>(); + public Map depthMaxFrame = new HashMap<>(); public int getMaxDepth() { int max_depth = 0; @@ -191,10 +191,10 @@ public class Timeline { frames.add(frame); } detectTweens(); - for(int d=1;d<=getMaxDepth();d++){ - for(int f=frames.size()-1;f>=0;f--){ - if(frames.get(f).layers.get(d) != null){ - depthMaxFrame.put(d, f+1); + for (int d = 1; d <= getMaxDepth(); d++) { + for (int f = frames.size() - 1; f >= 0; f--) { + if (frames.get(f).layers.get(d) != null) { + depthMaxFrame.put(d, f + 1); break; } } @@ -202,7 +202,7 @@ public class Timeline { } private boolean compare(int a, int b, int c, int tolerance) { - return Math.abs((b - a) - (c - b))=frames.size()?null:frames.get(f).layers.get(d); - - if(f= frames.size() ? null : frames.get(f).layers.get(d); + + if (f < frames.size() && ds != null && ds.characterId == characterId && ds.characterId != -1) { len++; - }else{ - if(characterId!=-1){ - List matrices=new ArrayList<>(); - for(int k=0;k matrices = new ArrayList<>(); + for (int k = 0; k < len; k++) { + matrices.add(frames.get(f - len + k).layers.get(d).matrix); } - List ranges=TweenDetector.detectRanges(matrices); - for(TweenRange r:ranges){ - System.out.println(""+r); - for(int t = r.startPosition;t<=r.endPosition;t++){ - frames.get(f-len+t).layers.get(d).motionTween = true; - frames.get(f-len+t).layers.get(d).key = false; + List ranges = TweenDetector.detectRanges(matrices); + for (TweenRange r : ranges) { + System.out.println("" + r); + for (int t = r.startPosition; t <= r.endPosition; t++) { + frames.get(f - len + t).layers.get(d).motionTween = true; + frames.get(f - len + t).layers.get(d).key = false; } frames.get(r.startPosition).layers.get(d).key = true; } } len = 1; } - characterId = ds==null?-1:ds.characterId; + characterId = ds == null ? -1 : ds.characterId; } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenDetector.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenDetector.java index 3aea640a2..700e0bd2d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenDetector.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenDetector.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash.timeline; import com.jpexs.decompiler.flash.types.MATRIX; @@ -22,67 +21,66 @@ import java.util.ArrayList; import java.util.List; /** - * + * * NOT WORKING STUB!!! FIXME * * @author JPEXS */ public class TweenDetector { - - + public static List detectRanges(List matrices) { //TODO: make this working :-( return new ArrayList<>(); /* - List ret = new ArrayList<>(); - double tolerance = 1; - int min = 3; - int startpos = 0; - Double last = null; - int i = min; - List translateX=new ArrayList<>(); - List translateY=new ArrayList<>(); - List scaleX=new ArrayList<>(); - List scaleY=new ArrayList<>(); - List rotateSkew0=new ArrayList<>(); - List rotateSkew1=new ArrayList<>(); + List ret = new ArrayList<>(); + double tolerance = 1; + int min = 3; + int startpos = 0; + Double last = null; + int i = min; + List translateX=new ArrayList<>(); + List translateY=new ArrayList<>(); + List scaleX=new ArrayList<>(); + List scaleY=new ArrayList<>(); + List rotateSkew0=new ArrayList<>(); + List rotateSkew1=new ArrayList<>(); - Set ms=new HashSet(); - ms.addAll(matrices); - if(ms.size()==1){ - return new ArrayList<>(); - } + Set ms=new HashSet(); + ms.addAll(matrices); + if(ms.size()==1){ + return new ArrayList<>(); + } - for(MATRIX n:matrices){ - //... - } + for(MATRIX n:matrices){ + //... + } - for (; startpos + i <= matrices.size() + 1; i++) { - double errTranslateX = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(translateX, startpos, i); - double errTranslateY = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(translateY, startpos, i); - double errScaleX = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(scaleX, startpos, i); - double errScaleY = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(scaleY, startpos, i); - double errRotateSkew0 = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(rotateSkew0, startpos, i); - double errRotateSkew1 = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(rotateSkew1, startpos, i); - double err = startpos + i > matrices.size()?Double.MAX_VALUE:(errTranslateX/20+errTranslateY/20+0.1*errScaleX+0.1*errScaleY+errRotateSkew0/360+errRotateSkew1/360); - if (err > tolerance) { - if (last == null) { - startpos++; - i = min - 1; - continue; - } - ret.add(new TweenRange(startpos, startpos+i-1-1)); - startpos = startpos + i -1; - i = min - 1; - last = null; - continue; - } - last = err; - } - return ret;*/ + for (; startpos + i <= matrices.size() + 1; i++) { + double errTranslateX = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(translateX, startpos, i); + double errTranslateY = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(translateY, startpos, i); + double errScaleX = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(scaleX, startpos, i); + double errScaleY = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(scaleY, startpos, i); + double errRotateSkew0 = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(rotateSkew0, startpos, i); + double errRotateSkew1 = startpos + i > matrices.size() ? Double.MAX_VALUE : getErrorLevel(rotateSkew1, startpos, i); + double err = startpos + i > matrices.size()?Double.MAX_VALUE:(errTranslateX/20+errTranslateY/20+0.1*errScaleX+0.1*errScaleY+errRotateSkew0/360+errRotateSkew1/360); + if (err > tolerance) { + if (last == null) { + startpos++; + i = min - 1; + continue; + } + ret.add(new TweenRange(startpos, startpos+i-1-1)); + startpos = startpos + i -1; + i = min - 1; + last = null; + continue; + } + last = err; + } + return ret;*/ } private static double getErrorLevel(List yValues, int start, int len) { @@ -96,7 +94,7 @@ public class TweenDetector { double ynew = a + b * (i - start); double ydelta = Math.abs(ynew - yorig); sumdelta += ydelta; - if(ydelta>maxdelta){ + if (ydelta > maxdelta) { maxdelta = ydelta; } } @@ -106,7 +104,7 @@ public class TweenDetector { private static double[] calc(List yValues, int start, int len) { List xValues = new ArrayList<>(); for (int i = 0; i < len; i++) { - xValues.add((double)i); + xValues.add((double) i); } yValues = yValues.subList(start, start + len); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenRange.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenRange.java index 1fcf5a34a..eef4836ce 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenRange.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenRange.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.flash.timeline; /** @@ -22,6 +21,7 @@ package com.jpexs.decompiler.flash.timeline; * @author JPEXS */ public class TweenRange { + public int startPosition; public int endPosition; @@ -32,6 +32,6 @@ public class TweenRange { @Override public String toString() { - return "["+startPosition+"-"+endPosition+"]"; - } + return "[" + startPosition + "-" + endPosition + "]"; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/MATRIX.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/MATRIX.java index c25aaa0fb..2c63db718 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/MATRIX.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/MATRIX.java @@ -221,6 +221,4 @@ public class MATRIX implements Serializable { return true; } - - } diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 663b653c3..ba329913e 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -1317,7 +1317,7 @@ public class CommandLineArgumentParser { SWF swf = new SWF(is, Configuration.parallelSpeedUp.get()); while (true) { String objectToReplace = args.remove(); - + if (objectToReplace.matches("\\d+")) { // replace character tag int characterId = 0; @@ -1395,13 +1395,13 @@ public class CommandLineArgumentParser { } } } - + if (!found) { System.err.println(objectToReplace + " is not reocginized as a CharacterId or a script name."); System.exit(1); } } - + if (args.isEmpty() || args.peek().startsWith("-")) { break; } @@ -1468,17 +1468,17 @@ public class CommandLineArgumentParser { public boolean missingString(String value) { return true; } - + @Override public boolean missingInt(long value) { return true; } - + @Override public boolean missingUInt(long value) { return true; } - + @Override public boolean missingDouble(double value) { return true; @@ -1498,7 +1498,7 @@ public class CommandLineArgumentParser { System.out.println("Replace AS3"); System.out.println("Warning: This feature is EXPERIMENTAL"); File swc = Configuration.getPlayerSWC(); - if(swc == null) { + if (swc == null) { final String adobePage = "http://www.adobe.com/support/flashplayer/downloads.html"; System.err.println("For ActionScript 3 direct editation, a library called \"PlayerGlobal.swc\" needs to be downloaded from Adobe homepage:"); System.err.println(adobePage); @@ -1517,7 +1517,7 @@ public class CommandLineArgumentParser { System.exit(1); } } - + private static void parseDumpSwf(Queue args) { if (args.isEmpty()) { badArguments(); diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index a67603dd0..f46b35b1d 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -877,8 +877,7 @@ public class Main { * @throws IOException */ public static void main(String[] args) throws IOException { - - + String pluginPath = Configuration.pluginPath.get(); if (pluginPath != null && !pluginPath.isEmpty()) { try { diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index ac80a7661..aa1352213 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -646,7 +646,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } return abcPanel; } - + private ActionPanel getActionPanel() { if (actionPanel == null) { actionPanel = new ActionPanel(this); @@ -654,7 +654,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } return actionPanel; } - + private void updateUi(final SWF swf) { mainFrame.setTitle(ApplicationInfo.applicationVerName + (Configuration.displayFileName.get() ? " - " + swf.getFileTitle() : "")); diff --git a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java index 4329bf26e..cb547cedb 100644 --- a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java @@ -160,8 +160,8 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe } if (selected) { //if (!(fl != null && (flNext == null || flNext.key))) { - g.setColor(selectedColor); - g.fillRect(f * TimelinePanel.FRAME_WIDTH + 1, d * TimelinePanel.FRAME_HEIGHT + 1, TimelinePanel.FRAME_WIDTH - 1, TimelinePanel.FRAME_HEIGHT - 1); + g.setColor(selectedColor); + g.fillRect(f * TimelinePanel.FRAME_WIDTH + 1, d * TimelinePanel.FRAME_HEIGHT + 1, TimelinePanel.FRAME_WIDTH - 1, TimelinePanel.FRAME_HEIGHT - 1); //} } @@ -169,11 +169,10 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe if (timeLine.depthMaxFrame.containsKey(d) && f < timeLine.depthMaxFrame.get(d)) { int draw_f = f; - - DepthState prev_ds = f<1?null:timeLine.frames.get(f-1).layers.get(d); - - - if (f==0 || prev_ds!=null) { + + DepthState prev_ds = f < 1 ? null : timeLine.frames.get(f - 1).layers.get(d); + + if (f == 0 || prev_ds != null) { draw_f = f; keyfound[d - start_d] = true; } else if (!keyfound[d - start_d]) { @@ -201,16 +200,14 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe g.setColor(borderColor); g.drawRect(draw_f * TimelinePanel.FRAME_WIDTH, d * TimelinePanel.FRAME_HEIGHT, num_frames * TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT); - if (selected) { g.setColor(selectedColor); g.fillRect(draw_f * TimelinePanel.FRAME_WIDTH, d * TimelinePanel.FRAME_HEIGHT, TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT); } - + g.setColor(keyColor); g.drawOval(draw_f * TimelinePanel.FRAME_WIDTH + TimelinePanel.FRAME_WIDTH / 4, d * TimelinePanel.FRAME_HEIGHT + TimelinePanel.FRAME_HEIGHT * 3 / 4 - TimelinePanel.FRAME_WIDTH / 2 / 2, TimelinePanel.FRAME_WIDTH / 2, TimelinePanel.FRAME_WIDTH / 2); - - + if (num_frames > 1) { if (cursor != null && cursor.y == d && cursor.x == f + num_frames - 1) { g.setColor(selectedColor);