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 4808369f1..2fb25658d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -1329,7 +1329,7 @@ public final class SWF implements TreeItem, Timelined { BufferedImage img0 = images.next(); out.addVideoTrack(VideoFormatKeys.ENCODING_AVI_PNG, 1, frameRate, img0.getWidth(), img0.getHeight(), 0, 0); try { - out.write(0,img0,1); + out.write(0, img0, 1); while (images.hasNext()) { out.write(0, images.next(), 1); } @@ -1389,7 +1389,7 @@ public final class SWF implements TreeItem, Timelined { fos.write(Utf8Helper.getBytes(((FontTag) ch).toHtmlCanvas(1))); fos.write(Utf8Helper.getBytes("}\r\n\r\n")); } else { - + if (ch instanceof ImageTag) { ImageTag image = (ImageTag) ch; String format = image.getImageFormat(); @@ -1412,7 +1412,7 @@ public final class SWF implements TreeItem, Timelined { if (ch instanceof DrawableTag) { fos.write(Utf8Helper.getBytes(((DrawableTag) ch).toHtmlCanvas(1))); } - fos.write(Utf8Helper.getBytes("}\r\n\r\n")); + fos.write(Utf8Helper.getBytes("}\r\n\r\n")); } } } @@ -1471,10 +1471,10 @@ public final class SWF implements TreeItem, Timelined { File f = new File(foutdir + File.separator + frame + ".svg"); try (FileOutputStream fos = new FileOutputStream(f)) { ExportRectangle rect = new ExportRectangle(ftim.displayRect); - rect.xMax*=settings.zoom; - rect.yMax*=settings.zoom; - rect.xMin*=settings.zoom; - rect.yMin*=settings.zoom; + rect.xMax *= settings.zoom; + rect.yMax *= settings.zoom; + rect.xMin *= settings.zoom; + rect.yMin *= settings.zoom; SVGExporter exporter = new SVGExporter(rect); if (fbackgroundColor != null) { exporter.setBackGroundColor(fbackgroundColor); @@ -1515,8 +1515,8 @@ public final class SWF implements TreeItem, Timelined { fos.write(Utf8Helper.getBytes("function " + currentName + "(ctx,ctrans,frame,ratio,time){\r\n")); fos.write(Utf8Helper.getBytes("\tctx.save();\r\n")); - fos.write(Utf8Helper.getBytes("\tctx.transform(1,0,0,1," + (-ftim.displayRect.Xmin*settings.zoom / unitDivisor) + "," + (-ftim.displayRect.Ymin*settings.zoom / unitDivisor) + ");\r\n")); - fos.write(Utf8Helper.getBytes(framesToHtmlCanvas(unitDivisor/settings.zoom, ftim, fframes, 0, null, 0, ftim.displayRect, new ColorTransform(), fbackgroundColor))); + fos.write(Utf8Helper.getBytes("\tctx.transform(1,0,0,1," + (-ftim.displayRect.Xmin * settings.zoom / unitDivisor) + "," + (-ftim.displayRect.Ymin * settings.zoom / unitDivisor) + ");\r\n")); + fos.write(Utf8Helper.getBytes(framesToHtmlCanvas(unitDivisor / settings.zoom, ftim, fframes, 0, null, 0, ftim.displayRect, new ColorTransform(), fbackgroundColor))); fos.write(Utf8Helper.getBytes("\tctx.restore();\r\n")); fos.write(Utf8Helper.getBytes("}\r\n\r\n")); @@ -1613,7 +1613,7 @@ public final class SWF implements TreeItem, Timelined { if (!hasNext()) { return null; } - return frameToImageGet(ftim, fframes.get(pos++), 0, null, 0, ftim.displayRect, new Matrix(), new ColorTransform(), fbackgroundColor, false,settings.zoom).getBufferedImage(); + return frameToImageGet(ftim, fframes.get(pos++), 0, null, 0, ftim.displayRect, new Matrix(), new ColorTransform(), fbackgroundColor, false, settings.zoom).getBufferedImage(); } }; @@ -2281,7 +2281,7 @@ public final class SWF implements TreeItem, Timelined { sb.append("\tswitch(frame){\r\n"); int maxDepth = timeline.getMaxDepth(); Stack clipDepths = new Stack<>(); - for (int frame:frames) { + for (int frame : frames) { sb.append("\t\tcase ").append(frame).append(":\r\n"); Frame frameObj = timeline.frames.get(frame); for (int i = 1; i <= maxDepth + 1; i++) { @@ -2591,7 +2591,7 @@ public final class SWF implements TreeItem, Timelined { } public static SerializableImage frameToImageGet(Timeline timeline, int frame, int time, DepthState stateUnderCursor, int mouseButton, RECT displayRect, Matrix transformation, ColorTransform colorTransform, Color backGroundColor, boolean useCache, double zoom) { - String key = "frame_" + frame + "_" + timeline.id + "_" + timeline.swf.hashCode()+"_"+zoom; + String key = "frame_" + frame + "_" + timeline.id + "_" + timeline.swf.hashCode() + "_" + zoom; SerializableImage image; if (useCache) { image = getFromCache(key); @@ -2605,8 +2605,8 @@ public final class SWF implements TreeItem, Timelined { } RECT rect = displayRect; - image = new SerializableImage((int) (rect.getWidth()*zoom / SWF.unitDivisor) + 1, - (int) (rect.getHeight()*zoom / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB); + image = new SerializableImage((int) (rect.getWidth() * zoom / SWF.unitDivisor) + 1, + (int) (rect.getHeight() * zoom / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB); if (backGroundColor == null) { image.fillTransparent(); } else { @@ -2637,7 +2637,7 @@ public final class SWF implements TreeItem, Timelined { } public static void frameToImage(Timeline timeline, int frame, int time, DepthState stateUnderCursor, int mouseButton, SerializableImage image, Matrix transformation, ColorTransform colorTransform) { - double unzoom = SWF.unitDivisor; + double unzoom = SWF.unitDivisor; if (timeline.frames.size() <= frame) { return; } @@ -2723,8 +2723,8 @@ public final class SWF implements TreeItem, Timelined { rect.yMax += deltaYMax * unzoom; } - rect.xMin -= 1*unzoom; - rect.yMin -= 1*unzoom; + rect.xMin -= 1 * unzoom; + rect.yMin -= 1 * unzoom; rect.xMin = Math.max(0, rect.xMin); rect.yMin = Math.max(0, rect.yMin); 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 d127d5407..46430a238 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 @@ -562,14 +562,14 @@ public class ABC { } loadNamespaceMap(); /*for(int i=0;i()); - } catch (InterruptedException ex) { - Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, null, ex); - } - System.out.println(""+t.toString()); + MethodBody bod=bodies.get(bodyIdxFromMethodIdx.get(script_info.get(i).init_index)); + GraphTextWriter t=new HilightedTextWriter(Configuration.getCodeFormatting(),false); + try { + bod.toString("script", ScriptExportMode.PCODE, this, null, constants, method_info, t, new ArrayList()); + } catch (InterruptedException ex) { + Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, null, ex); + } + System.out.println(""+t.toString()); } //System.exit(0);*/ @@ -656,14 +656,14 @@ public class ABC { aos.writeTraits(si.traits); } - aos.writeU30(bodies.size()); + aos.writeU30(bodies.size()); for (MethodBody mb : bodies) { aos.writeU30(mb.method_info); aos.writeU30(mb.max_stack); aos.writeU30(mb.max_regs); aos.writeU30(mb.init_scope_depth); aos.writeU30(mb.max_scope_depth); - byte[] codeBytes = mb.getCodeBytes(); + byte[] codeBytes = mb.getCodeBytes(); aos.writeU30(codeBytes.length); aos.write(codeBytes); aos.writeU30(mb.exceptions.length); @@ -1054,8 +1054,7 @@ public class ABC { } } - - public void addClass(ClassInfo ci, InstanceInfo ii,int index){ + public void addClass(ClassInfo ci, InstanceInfo ii, int index) { for (MethodBody b : bodies) { for (AVM2Instruction ins : b.getCode().code) { for (int i = 0; i < ins.definition.operands.length; i++) { @@ -1070,13 +1069,13 @@ public class ABC { for (ScriptInfo si : script_info) { addClassInTraits(si.traits, index); } - for (MethodBody b : bodies) { + for (MethodBody b : bodies) { addClassInTraits(b.traits, index); } - instance_info.add(index,ii); - class_info.add(index,ci); + instance_info.add(index, ii); + class_info.add(index, ci); } - + private void addClassInTraits(Traits traits, int index) { for (Trait t : traits.traits) { if (t instanceof TraitClass) { @@ -1089,7 +1088,7 @@ public class ABC { } } } - + public void removeClass(int index) { for (MethodBody b : bodies) { for (AVM2Instruction ins : b.getCode().code) { @@ -1105,7 +1104,7 @@ public class ABC { for (ScriptInfo si : script_info) { removeClassFromTraits(si.traits, index); } - for (MethodBody b : bodies) { + for (MethodBody b : bodies) { removeClassFromTraits(b.traits, index); } instance_info.remove(index); @@ -1210,17 +1209,16 @@ public class ABC { } boolean isDocumentClass = documentClass.equals(pack.getPath().toString()); - - ScriptInfo si=script_info.get(oldIndex); + ScriptInfo si = script_info.get(oldIndex); si.delete(this, true); int newClassIndex = instance_info.size(); - for(Trait t:si.traits.traits){ - if(t instanceof TraitClass){ - TraitClass tc=(TraitClass)t; - newClassIndex = tc.class_info+1; + for (Trait t : si.traits.traits) { + if (t instanceof TraitClass) { + TraitClass tc = (TraitClass) t; + newClassIndex = tc.class_info + 1; } } - ActionScriptParser.compile(as, this, new ArrayList(), isDocumentClass, scriptName,newClassIndex); + ActionScriptParser.compile(as, this, new ArrayList(), isDocumentClass, scriptName, newClassIndex); //Move newly added script to its position script_info.set(oldIndex, script_info.get(newIndex)); script_info.remove(newIndex); 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 6754aaedd..ff4cb6d1b 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 @@ -790,13 +790,13 @@ public class AVM2Code implements Cloneable { List addresses = new ArrayList<>(); long startPos = ais.getPosition(); addresses.add(startPos); - + while (!addresses.isEmpty()) { long address = addresses.remove(0); if (codeMap.containsKey(address)) { continue; } - if(address(), localData.callStack)); } - ret.add(ins(new NewFunctionIns(), method(true,false, localData.callStack, localData.pkg, item.needsActivation, item.subvariables, 0 /*Set later*/, item.hasRest, item.line, localData.currentClass, null, false, localData, item.paramTypes, item.paramNames, item.paramValues, item.body, item.retType))); + ret.add(ins(new NewFunctionIns(), method(true, false, localData.callStack, localData.pkg, item.needsActivation, item.subvariables, 0 /*Set later*/, item.hasRest, item.line, localData.currentClass, null, false, localData, item.paramTypes, item.paramNames, item.paramValues, item.body, item.retType))); if (!item.functionName.isEmpty()) { ret.add(ins(new DupIns())); ret.add(ins(new GetScopeObjectIns(), scope)); @@ -1169,7 +1169,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return abc; } - public void generateClass(List importedClasses, List sinitVariables, boolean staticNeedsActivation, List staticInit, List openedNamespaces, int namespace, int initScope, String pkg, ClassInfo classInfo, InstanceInfo instanceInfo, SourceGeneratorLocalData localData, boolean isInterface, String name, String superName, GraphTargetItem extendsVal, List implementsStr, GraphTargetItem constructor, List traitItems,Reference class_index) throws AVM2ParseException, CompilationException { + public void generateClass(List importedClasses, List sinitVariables, boolean staticNeedsActivation, List staticInit, List openedNamespaces, int namespace, int initScope, String pkg, ClassInfo classInfo, InstanceInfo instanceInfo, SourceGeneratorLocalData localData, boolean isInterface, String name, String superName, GraphTargetItem extendsVal, List implementsStr, GraphTargetItem constructor, List traitItems, Reference class_index) throws AVM2ParseException, CompilationException { localData.currentClass = name; localData.pkg = pkg; List ret = new ArrayList<>(); @@ -1178,24 +1178,24 @@ public class AVM2SourceGenerator implements SourceGenerator { } ParsedSymbol s = null; - instanceInfo.name_index = traitName(namespace, name); + instanceInfo.name_index = traitName(namespace, name); - Trait[] it = generateTraitsPhase1(name, superName, false, localData, traitItems, instanceInfo.instance_traits,class_index); - Trait[] st = generateTraitsPhase1(name, superName, true, localData, traitItems, classInfo.static_traits,class_index); + Trait[] it = generateTraitsPhase1(name, superName, false, localData, traitItems, instanceInfo.instance_traits, class_index); + Trait[] st = generateTraitsPhase1(name, superName, true, localData, traitItems, classInfo.static_traits, class_index); generateTraitsPhase2(importedClasses, pkg, traitItems, it, openedNamespaces, localData); generateTraitsPhase2(importedClasses, pkg, traitItems, st, openedNamespaces, localData); - generateTraitsPhase3(initScope, isInterface, name, superName, false, localData, traitItems, instanceInfo.instance_traits, it, new HashMap(),class_index); - generateTraitsPhase3(initScope, isInterface, name, superName, true, localData, traitItems, classInfo.static_traits, st, new HashMap(),class_index); + generateTraitsPhase3(initScope, isInterface, name, superName, false, localData, traitItems, instanceInfo.instance_traits, it, new HashMap(), class_index); + generateTraitsPhase3(initScope, isInterface, name, superName, true, localData, traitItems, classInfo.static_traits, st, new HashMap(), class_index); int init = 0; if (constructor == null || isInterface) { - instanceInfo.iinit_index = init = method(false,isInterface, new ArrayList(), pkg, false, new ArrayList(), initScope + 1, false, 0, isInterface ? null : name, extendsVal != null ? extendsVal.toString() : null, true, localData, new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList(), TypeItem.UNBOUNDED/*?? FIXME*/); + instanceInfo.iinit_index = init = method(false, isInterface, new ArrayList(), pkg, false, new ArrayList(), initScope + 1, false, 0, isInterface ? null : name, extendsVal != null ? extendsVal.toString() : null, true, localData, new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList(), TypeItem.UNBOUNDED/*?? FIXME*/); } else { MethodAVM2Item m = (MethodAVM2Item) constructor; - instanceInfo.iinit_index = init = method(false,false, new ArrayList(), pkg, m.needsActivation, m.subvariables, initScope + 1, m.hasRest, m.line, name, extendsVal != null ? extendsVal.toString() : null, true, localData, m.paramTypes, m.paramNames, m.paramValues, m.body, TypeItem.UNBOUNDED/*?? FIXME*/); + instanceInfo.iinit_index = init = method(false, false, new ArrayList(), pkg, m.needsActivation, m.subvariables, initScope + 1, m.hasRest, m.line, name, extendsVal != null ? extendsVal.toString() : null, true, localData, m.paramTypes, m.paramNames, m.paramValues, m.body, TypeItem.UNBOUNDED/*?? FIXME*/); } //Class initializer - int staticMi = method(false,false, new ArrayList(), pkg, staticNeedsActivation, sinitVariables, initScope + (implementsStr.isEmpty() ? 0 : 1), false, 0, isInterface ? null : name, superName, false, localData, new ArrayList(), new ArrayList(), new ArrayList(), staticInit, TypeItem.UNBOUNDED); + int staticMi = method(false, false, new ArrayList(), pkg, staticNeedsActivation, sinitVariables, initScope + (implementsStr.isEmpty() ? 0 : 1), false, 0, isInterface ? null : name, superName, false, localData, new ArrayList(), new ArrayList(), new ArrayList(), staticInit, TypeItem.UNBOUNDED); MethodBody sinitBody = abc.findBody(staticMi); List sinitcode = new ArrayList<>(); @@ -1280,7 +1280,7 @@ public class AVM2SourceGenerator implements SourceGenerator { */ if (cls instanceof ClassAVM2Item) { ClassAVM2Item cai = (ClassAVM2Item) cls; - generateClass(cai.importedClasses, cai.sinitVariables, cai.staticInitActivation, cai.staticInit, cai.openedNamespaces, namespace, initScope, pkg, ci, ii, localData, false, cai.className, cai.extendsOp == null ? "Object" : cai.extendsOp.toString(), cai.extendsOp, cai.implementsOp, cai.constructor, cai.traits,class_index); + generateClass(cai.importedClasses, cai.sinitVariables, cai.staticInitActivation, cai.staticInit, cai.openedNamespaces, namespace, initScope, pkg, ci, ii, localData, false, cai.className, cai.extendsOp == null ? "Object" : cai.extendsOp.toString(), cai.extendsOp, cai.implementsOp, cai.constructor, cai.traits, class_index); if (!cai.isDynamic) { ii.flags |= InstanceInfo.CLASS_SEALED; } @@ -1294,7 +1294,7 @@ public class AVM2SourceGenerator implements SourceGenerator { InterfaceAVM2Item iai = (InterfaceAVM2Item) cls; ii.flags |= InstanceInfo.CLASS_INTERFACE; ii.flags |= InstanceInfo.CLASS_SEALED; - generateClass(iai.importedClasses, new ArrayList(), false, new ArrayList(), iai.openedNamespaces, namespace, initScope, pkg, ci, ii, localData, true, iai.name, null, null, iai.superInterfaces, null, iai.methods,class_index); + generateClass(iai.importedClasses, new ArrayList(), false, new ArrayList(), iai.openedNamespaces, namespace, initScope, pkg, ci, ii, localData, true, iai.name, null, null, iai.superInterfaces, null, iai.methods, class_index); } return abc.instance_info.size() - 1; @@ -1376,7 +1376,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return false; } - public int method(boolean subMethod,boolean isInterface, List callStack, String pkg, boolean needsActivation, List subvariables, int initScope, boolean hasRest, int line, String className, String superType, boolean constructor, SourceGeneratorLocalData localData, List paramTypes, List paramNames, List paramValues, List body, GraphTargetItem retType) throws CompilationException { + public int method(boolean subMethod, boolean isInterface, List callStack, String pkg, boolean needsActivation, List subvariables, int initScope, boolean hasRest, int line, String className, String superType, boolean constructor, SourceGeneratorLocalData localData, List paramTypes, List paramNames, List paramValues, List body, GraphTargetItem retType) throws CompilationException { //Reference hasArgs = new Reference<>(Boolean.FALSE); //calcRegisters(localData,needsActivation,paramNames,subvariables,body, hasArgs); SourceGeneratorLocalData newlocalData = new SourceGeneratorLocalData(new HashMap(), 1, true, 0); @@ -1407,8 +1407,8 @@ public class AVM2SourceGenerator implements SourceGenerator { } } } - - for(int t=0;t()),true); + abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList()), true); if (((ClassAVM2Item) item).extendsOp != null) { instanceInfo.super_index = typeName(localData, ((ClassAVM2Item) item).extendsOp); @@ -1894,7 +1894,7 @@ public class AVM2SourceGenerator implements SourceGenerator { if (item instanceof InterfaceAVM2Item) { InstanceInfo instanceInfo = abc.instance_info.get(((TraitClass) traits[k]).class_info); instanceInfo.name_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(((InterfaceAVM2Item) item).name, true), - abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList()),true); + abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList()), true); instanceInfo.interfaces = new int[((InterfaceAVM2Item) item).superInterfaces.size()]; for (int i = 0; i < ((InterfaceAVM2Item) item).superInterfaces.size(); i++) { @@ -1920,7 +1920,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } - public void generateTraitsPhase3(int methodInitScope, boolean isInterface, String className, String superName, boolean generateStatic, SourceGeneratorLocalData localData, List items, Traits ts, Trait[] traits, Map initScopes,Reference class_index) throws AVM2ParseException, CompilationException { + public void generateTraitsPhase3(int methodInitScope, boolean isInterface, String className, String superName, boolean generateStatic, SourceGeneratorLocalData localData, List items, Traits ts, Trait[] traits, Map initScopes, Reference class_index) throws AVM2ParseException, CompilationException { //Note: Names must be generated first before accesed in inner subs for (int k = 0; k < items.size(); k++) { GraphTargetItem item = items.get(k); @@ -1928,21 +1928,21 @@ public class AVM2SourceGenerator implements SourceGenerator { continue; } if (item instanceof InterfaceAVM2Item) { - generateClass(((InterfaceAVM2Item) item).namespace, abc.class_info.get(((TraitClass) traits[k]).class_info), abc.instance_info.get(((TraitClass) traits[k]).class_info), initScopes.get(traits[k]), ((InterfaceAVM2Item) item).pkg, localData, (InterfaceAVM2Item) item,class_index); + generateClass(((InterfaceAVM2Item) item).namespace, abc.class_info.get(((TraitClass) traits[k]).class_info), abc.instance_info.get(((TraitClass) traits[k]).class_info), initScopes.get(traits[k]), ((InterfaceAVM2Item) item).pkg, localData, (InterfaceAVM2Item) item, class_index); } if (item instanceof ClassAVM2Item) { - generateClass(((ClassAVM2Item) item).namespace, abc.class_info.get(((TraitClass) traits[k]).class_info), abc.instance_info.get(((TraitClass) traits[k]).class_info), initScopes.get(traits[k]), ((ClassAVM2Item) item).pkg, localData, (ClassAVM2Item) item,class_index); + generateClass(((ClassAVM2Item) item).namespace, abc.class_info.get(((TraitClass) traits[k]).class_info), abc.instance_info.get(((TraitClass) traits[k]).class_info), initScopes.get(traits[k]), ((ClassAVM2Item) item).pkg, localData, (ClassAVM2Item) item, class_index); } if ((item instanceof MethodAVM2Item) || (item instanceof GetterAVM2Item) || (item instanceof SetterAVM2Item)) { MethodAVM2Item mai = (MethodAVM2Item) item; if (mai.isStatic() != generateStatic) { continue; } - ((TraitMethodGetterSetter) traits[k]).method_info = method(false,isInterface, new ArrayList(), mai.pkg, mai.needsActivation, mai.subvariables, methodInitScope + (mai.isStatic() ? 0 : 1), mai.hasRest, mai.line, className, superName, false, localData, mai.paramTypes, mai.paramNames, mai.paramValues, mai.body, mai.retType); + ((TraitMethodGetterSetter) traits[k]).method_info = method(false, isInterface, new ArrayList(), mai.pkg, mai.needsActivation, mai.subvariables, methodInitScope + (mai.isStatic() ? 0 : 1), mai.hasRest, mai.line, className, superName, false, localData, mai.paramTypes, mai.paramNames, mai.paramValues, mai.body, mai.retType); } else if (item instanceof FunctionAVM2Item) { FunctionAVM2Item fai = (FunctionAVM2Item) item; - ((TraitFunction) traits[k]).method_info = method(false,isInterface, new ArrayList(), fai.pkg, fai.needsActivation, fai.subvariables, methodInitScope, fai.hasRest, fai.line, className, superName, false, localData, fai.paramTypes, fai.paramNames, fai.paramValues, fai.body, fai.retType); + ((TraitFunction) traits[k]).method_info = method(false, isInterface, new ArrayList(), fai.pkg, fai.needsActivation, fai.subvariables, methodInitScope, fai.hasRest, fai.line, className, superName, false, localData, fai.paramTypes, fai.paramNames, fai.paramValues, fai.body, fai.retType); } } } @@ -1958,10 +1958,10 @@ public class AVM2SourceGenerator implements SourceGenerator { ClassInfo ci = new ClassInfo(); InstanceInfo ii = new InstanceInfo(); /*abc.class_info.add(ci); - abc.instance_info.add(ii);*/ + abc.instance_info.add(ii);*/ tc.class_info = classIndex.getVal(); abc.addClass(ci, ii, classIndex.getVal()); - classIndex.setVal(classIndex.getVal()+1); + classIndex.setVal(classIndex.getVal() + 1); ii.flags |= InstanceInfo.CLASS_INTERFACE; //tc.class_info = abc.instance_info.size() - 1; tc.kindType = Trait.TRAIT_CLASS; @@ -1976,10 +1976,10 @@ public class AVM2SourceGenerator implements SourceGenerator { ClassInfo ci = new ClassInfo(); InstanceInfo ii = new InstanceInfo(); /*abc.class_info.add(ci); - abc.instance_info.add(instanceInfo);*/ + abc.instance_info.add(instanceInfo);*/ tc.class_info = classIndex.getVal(); abc.addClass(ci, ii, classIndex.getVal()); - classIndex.setVal(classIndex.getVal()+1); + classIndex.setVal(classIndex.getVal() + 1); //tc.class_info = abc.instance_info.size() - 1; /*instanceInfo.name_index = abc.constants.addMultiname(new Multiname(Multiname.QNAME, abc.constants.getStringId(((ClassAVM2Item) item).className, true), @@ -2081,7 +2081,7 @@ public class AVM2SourceGenerator implements SourceGenerator { Reference class_index = new Reference<>(classPos); ScriptInfo si = new ScriptInfo(); localData.currentScript = si; - Trait[] traitArr = generateTraitsPhase1(null, null, false, localData, commands, si.traits,class_index); + Trait[] traitArr = generateTraitsPhase1(null, null, false, localData, commands, si.traits, class_index); generateTraitsPhase2(new ArrayList(), null/*FIXME*/, commands, traitArr, new ArrayList(), localData); MethodInfo mi = new MethodInfo(new int[0], 0, 0, 0, new ValueKind[0], new int[0]); MethodBody mb = new MethodBody(); @@ -2135,7 +2135,7 @@ public class AVM2SourceGenerator implements SourceGenerator { abc.addMethodBody(mb); si.init_index = mb.method_info; localData.pkg = null; //FIXME: pkg.packageName; - generateTraitsPhase3(1/*??*/, false, null, null, false, localData, commands, si.traits, traitArr, initScopes,class_index); + generateTraitsPhase3(1/*??*/, false, null, null, false, localData, commands, si.traits, traitArr, initScopes, class_index); return si; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java index f50f234ed..7ab71531b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java @@ -139,13 +139,13 @@ public class ActionScriptParser { return uniqLast; } - private List commands(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, List variables) throws IOException, AVM2ParseException { + private List commands(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, List variables) throws IOException, AVM2ParseException { List ret = new ArrayList<>(); if (debugMode) { System.out.println("commands:"); } GraphTargetItem cmd = null; - while ((cmd = command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)) != null) { + while ((cmd = command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)) != null) { ret.add(cmd); } if (debugMode) { @@ -154,7 +154,7 @@ public class ActionScriptParser { return ret; } - private GraphTargetItem type(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, List variables) throws IOException, AVM2ParseException { + private GraphTargetItem type(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, List variables) throws IOException, AVM2ParseException { ParsedSymbol s = lex(); if (s.type == SymbolType.MULTIPLY) { return new UnboundedTypeItem(); @@ -164,12 +164,12 @@ public class ActionScriptParser { lexer.pushback(s); } - GraphTargetItem t = name(thisType,pkg, needsActivation, true, openedNamespaces, null, false, false, variables, importedClasses); - t = applyType(thisType,pkg, needsActivation, importedClasses, openedNamespaces, t, new HashMap(), false, false, variables); + GraphTargetItem t = name(thisType, pkg, needsActivation, true, openedNamespaces, null, false, false, variables, importedClasses); + t = applyType(thisType, pkg, needsActivation, importedClasses, openedNamespaces, t, new HashMap(), false, false, variables); return t; } - private GraphTargetItem memberOrCall(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem newcmds, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { + private GraphTargetItem memberOrCall(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem newcmds, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { ParsedSymbol s = lex(); GraphTargetItem ret = newcmds; while (s.isType(SymbolType.DOT, SymbolType.PARENT_OPEN, SymbolType.BRACKET_OPEN, SymbolType.TYPENAME)) { @@ -178,10 +178,10 @@ public class ActionScriptParser { case DOT: case TYPENAME: lexer.pushback(s); - ret = member(thisType,pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); + ret = member(thisType, pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); break; case PARENT_OPEN: - ret = new CallAVM2Item(lexer.yyline(), ret, call(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); + ret = new CallAVM2Item(lexer.yyline(), ret, call(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); break; } @@ -206,13 +206,13 @@ public class ActionScriptParser { return ret; } - private GraphTargetItem applyType(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem obj, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { + private GraphTargetItem applyType(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem obj, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { GraphTargetItem ret = obj; ParsedSymbol s = lex(); if (s.type == SymbolType.TYPENAME) { List params = new ArrayList<>(); do { - params.add(expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + params.add(expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); s = lex(); } while (s.type == SymbolType.COMMA); if (s.type == SymbolType.USHIFT_RIGHT) { @@ -232,7 +232,7 @@ public class ActionScriptParser { return ret; } - private GraphTargetItem member(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem obj, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { + private GraphTargetItem member(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem obj, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { GraphTargetItem ret = obj; ParsedSymbol s = lex(); while (s.isType(SymbolType.DOT, SymbolType.BRACKET_OPEN, SymbolType.TYPENAME)) { @@ -251,10 +251,10 @@ public class ActionScriptParser { } if (s.type == SymbolType.TYPENAME) { lexer.pushback(s); - ret = applyType(thisType,pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); + ret = applyType(thisType, pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); s = lex(); } else if (s.type == SymbolType.BRACKET_OPEN) { - GraphTargetItem index = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem index = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.BRACKET_CLOSE); ret = new IndexAVM2Item(attr, ret, index, null, openedNamespaces); s = lex(); @@ -270,7 +270,7 @@ public class ActionScriptParser { variables.add((UnresolvedAVM2Item) ns); s = lex(); if (s.type == SymbolType.BRACKET_OPEN) { - propItem = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + propItem = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.BRACKET_CLOSE); propName = null; } else { @@ -293,7 +293,7 @@ public class ActionScriptParser { return ret; } - private GraphTargetItem name(TypeItem thisType,String pkg, Reference needsActivation, boolean typeOnly, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables, List importedClasses) throws IOException, AVM2ParseException { + private GraphTargetItem name(TypeItem thisType, String pkg, Reference needsActivation, boolean typeOnly, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables, List importedClasses) throws IOException, AVM2ParseException { ParsedSymbol s = lex(); String name = ""; if (s.type == SymbolType.ATTRIBUTE) { @@ -341,7 +341,7 @@ public class ActionScriptParser { if (s.type == SymbolType.IDENTIFIER) { nsprop = s.value.toString(); } else if (s.type == SymbolType.BRACKET_OPEN) { - nspropItem = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + nspropItem = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.BRACKET_CLOSE); } if (name.contains(".")) { @@ -394,7 +394,7 @@ public class ActionScriptParser { lexer.pushback(new ParsedSymbol(SymbolGroup.OPERATOR, SymbolType.ATTRIBUTE, "@")); lexer.pushback(new ParsedSymbol(SymbolGroup.OPERATOR, SymbolType.DOT, ".")); } - ret = member(thisType,pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); + ret = member(thisType, pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); } else { lexer.pushback(s); } @@ -439,7 +439,7 @@ public class ActionScriptParser { return ret; } - private List call(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { + private List call(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { List ret = new ArrayList<>(); //expected(SymbolType.PARENT_OPEN); //MUST BE HANDLED BY CALLER ParsedSymbol s = lex(); @@ -447,7 +447,7 @@ public class ActionScriptParser { if (s.type != SymbolType.COMMA) { lexer.pushback(s); } - ret.add(expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret.add(expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); s = lex(); expected(s, lexer.yyline(), SymbolType.COMMA, SymbolType.PARENT_CLOSE); } @@ -484,13 +484,13 @@ public class ActionScriptParser { s = lex(); if (!hasRest) { if (s.type == SymbolType.COLON) { - paramTypes.add(type(thisType,pkg, needsActivation, importedClasses, openedNamespaces, variables)); + paramTypes.add(type(thisType, pkg, needsActivation, importedClasses, openedNamespaces, variables)); s = lex(); } else { paramTypes.add(new UnboundedTypeItem()); } if (s.type == SymbolType.ASSIGN) { - paramValues.add(expression(thisType,pkg, new Reference<>(false), importedClasses, openedNamespaces, null, isMethod, isMethod, isMethod, variables)); + paramValues.add(expression(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, null, isMethod, isMethod, isMethod, variables)); s = lex(); } else { if (!paramValues.isEmpty()) { @@ -509,7 +509,7 @@ public class ActionScriptParser { s = lex(); GraphTargetItem retType; if (s.type == SymbolType.COLON) { - retType = type(thisType,pkg, needsActivation, importedClasses, openedNamespaces, variables); + retType = type(thisType, pkg, needsActivation, importedClasses, openedNamespaces, variables); } else { retType = new UnboundedTypeItem(); lexer.pushback(s); @@ -528,7 +528,7 @@ public class ActionScriptParser { Reference needsActivation2 = new Reference<>(false); if (!isInterface) { expectedType(SymbolType.CURLY_OPEN); - body = commands(thisType,pkg, needsActivation2, importedClasses, openedNamespaces, new Stack(), new HashMap(), new HashMap(), true, isMethod, 0, subvariables); + body = commands(thisType, pkg, needsActivation2, importedClasses, openedNamespaces, new Stack(), new HashMap(), new HashMap(), true, isMethod, 0, subvariables); expectedType(SymbolType.CURLY_CLOSE); } else { expectedType(SymbolType.SEMICOLON); @@ -575,7 +575,7 @@ public class ActionScriptParser { } if (inPkg || classNameStr != null) { if (s.type == SymbolType.CURLY_OPEN) { - staticInitializer.addAll(commands(thisType,pkg, sinitNeedsActivation, importedClasses, openedNamespaces, new Stack(), new HashMap(), new HashMap(), true, false, 0, sinitVariables)); + staticInitializer.addAll(commands(thisType, pkg, sinitNeedsActivation, importedClasses, openedNamespaces, new Stack(), new HashMap(), new HashMap(), true, false, 0, sinitVariables)); expectedType(SymbolType.CURLY_CLOSE); s = lex(); } @@ -671,13 +671,13 @@ public class ActionScriptParser { GraphTargetItem extendsTypeStr = null; s = lex(); if (s.type == SymbolType.EXTENDS) { - extendsTypeStr = type(thisType,pkg, new Reference<>(false), importedClasses, subNamespaces, new ArrayList()); + extendsTypeStr = type(thisType, pkg, new Reference<>(false), importedClasses, subNamespaces, new ArrayList()); s = lex(); } List implementsTypeStrs = new ArrayList<>(); if (s.type == SymbolType.IMPLEMENTS) { do { - GraphTargetItem implementsTypeStr = type(thisType,pkg, new Reference<>(false), importedClasses, subNamespaces, new ArrayList()); + GraphTargetItem implementsTypeStr = type(thisType, pkg, new Reference<>(false), importedClasses, subNamespaces, new ArrayList()); implementsTypeStrs.add(implementsTypeStr); s = lex(); } while (s.type == SymbolType.COMMA); @@ -711,7 +711,7 @@ public class ActionScriptParser { if (s.type == SymbolType.EXTENDS) { do { - GraphTargetItem intExtendsTypeStr = type(thisType,pkg, new Reference<>(false), importedClasses, openedNamespaces, new ArrayList()); + GraphTargetItem intExtendsTypeStr = type(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new ArrayList()); intExtendsTypeStrs.add(intExtendsTypeStr); s = lex(); } while (s.type == SymbolType.COMMA); @@ -845,7 +845,7 @@ public class ActionScriptParser { s = lex(); GraphTargetItem type = null; if (s.type == SymbolType.COLON) { - type = type(thisType,pkg, new Reference<>(false), importedClasses, openedNamespaces, new ArrayList()); + type = type(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new ArrayList()); s = lex(); } else { type = TypeItem.UNBOUNDED; @@ -854,7 +854,7 @@ public class ActionScriptParser { GraphTargetItem value = null; if (s.type == SymbolType.ASSIGN) { - value = expression(thisType,pkg, new Reference<>(false), importedClasses, openedNamespaces, new HashMap(), false, false, true, isStatic || isConst ? sinitVariables : constrVariables); + value = expression(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new HashMap(), false, false, true, isStatic || isConst ? sinitVariables : constrVariables); s = lex(); } GraphTargetItem tar; @@ -916,8 +916,8 @@ public class ActionScriptParser { //int publicNs = namespace; int protectedStaticNs = 0; - openedNamespaces.add(protectedNs = abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PROTECTED, abc.constants.getStringId(packageName == null ? (scriptName + "$0:"/*FIXME?*/ + classNameStr) : packageName.isEmpty() ? classNameStr : packageName + ":" + classNameStr, true)),0,true)); - openedNamespaces.add(protectedStaticNs = abc.constants.getNamespaceId(new Namespace(Namespace.KIND_STATIC_PROTECTED, abc.constants.getStringId(packageName == null || packageName.isEmpty() ? classNameStr : packageName + ":" + classNameStr, true)),0,true)); + openedNamespaces.add(protectedNs = abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PROTECTED, abc.constants.getStringId(packageName == null ? (scriptName + "$0:"/*FIXME?*/ + classNameStr) : packageName.isEmpty() ? classNameStr : packageName + ":" + classNameStr, true)), 0, true)); + openedNamespaces.add(protectedStaticNs = abc.constants.getNamespaceId(new Namespace(Namespace.KIND_STATIC_PROTECTED, abc.constants.getStringId(packageName == null || packageName.isEmpty() ? classNameStr : packageName + ":" + classNameStr, true)), 0, true)); if (extendsStr != null) { List indices = new ArrayList<>(); @@ -1041,7 +1041,7 @@ public class ActionScriptParser { } } - private List xmltag(TypeItem thisType,String pkg, Reference usesVars, List openedTags, Reference closedVarTags, Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { + private List xmltag(TypeItem thisType, String pkg, Reference usesVars, List openedTags, Reference closedVarTags, Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { ParsedSymbol s = null; List rets = new ArrayList<>(); //GraphTargetItem ret = null; @@ -1056,7 +1056,7 @@ public class ActionScriptParser { case XML_ATTRNAMEVAR_BEGIN: //add usesVars.setVal(true); addS(rets, sb); - rets.add(expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + rets.add(expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.CURLY_CLOSE); expectedType(SymbolType.ASSIGN); sb.append("="); @@ -1066,7 +1066,7 @@ public class ActionScriptParser { usesVars.setVal(true); sb.append("\""); addS(rets, sb); - rets.add(new EscapeXAttrAVM2Item(null, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables))); + rets.add(new EscapeXAttrAVM2Item(null, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables))); sb.append("\""); expectedType(SymbolType.CURLY_CLOSE); lexer.yybegin(ActionScriptLexer.XMLOPENTAG); @@ -1074,7 +1074,7 @@ public class ActionScriptParser { case XML_INSTRATTRNAMEVAR_BEGIN: //add usesVars.setVal(true); addS(rets, sb); - rets.add(expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + rets.add(expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.CURLY_CLOSE); expectedType(SymbolType.ASSIGN); sb.append("="); @@ -1084,7 +1084,7 @@ public class ActionScriptParser { usesVars.setVal(true); sb.append("\""); addS(rets, sb); - rets.add(new EscapeXAttrAVM2Item(null, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables))); + rets.add(new EscapeXAttrAVM2Item(null, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables))); sb.append("\""); expectedType(SymbolType.CURLY_CLOSE); lexer.yybegin(ActionScriptLexer.XMLOPENTAG); @@ -1092,7 +1092,7 @@ public class ActionScriptParser { case XML_VAR_BEGIN: //esc_xelem usesVars.setVal(true); addS(rets, sb); - rets.add(new EscapeXElemAVM2Item(null, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables))); + rets.add(new EscapeXElemAVM2Item(null, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables))); expectedType(SymbolType.CURLY_CLOSE); lexer.yybegin(ActionScriptLexer.XML); break; @@ -1102,7 +1102,7 @@ public class ActionScriptParser { sb.append(""); @@ -1113,14 +1113,14 @@ public class ActionScriptParser { //openedTags.add("*"); //ret = add(ret, ); - GraphTargetItem ex = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem ex = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.CURLY_CLOSE); lexer.yybegin(ActionScriptLexer.XMLOPENTAG); sub.add("*"); sb.append("<"); addS(rets, sb); rets.add(ex); - rets.addAll(xmltag(thisType,pkg, subusesvars, sub, subclose, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); + rets.addAll(xmltag(thisType, pkg, subusesvars, sub, subclose, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); closedVarTags.setVal(subclose.getVal() + subclose.getVal()); break; case XML_INSTRVARTAG_BEGIN: //add @@ -1128,13 +1128,13 @@ public class ActionScriptParser { addS(rets, sb); sb.append(" st = xmltag(thisType,pkg, subusesvars, sub, closedVarTags, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables); + List st = xmltag(thisType, pkg, subusesvars, sub, closedVarTags, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables); sb.append(s.value.toString()); addS(rets, sb); rets.addAll(st); @@ -1170,18 +1170,18 @@ public class ActionScriptParser { return rets; } - private GraphTargetItem xml(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { + private GraphTargetItem xml(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { List openedTags = new ArrayList<>(); int closedVarTags = 0; - GraphTargetItem ret = add(xmltag(thisType,pkg, new Reference<>(false), openedTags, new Reference<>(closedVarTags), needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); + GraphTargetItem ret = add(xmltag(thisType, pkg, new Reference<>(false), openedTags, new Reference<>(closedVarTags), needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); ret = new XMLAVM2Item(ret); lexer.yybegin(ActionScriptLexer.YYINITIAL); //TODO: Order of additions as in official compiler return ret; } - private GraphTargetItem command(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, boolean mustBeCommand, List variables) throws IOException, AVM2ParseException { + private GraphTargetItem command(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, boolean mustBeCommand, List variables) throws IOException, AVM2ParseException { LexBufferer buf = new LexBufferer(); lexer.addListener(buf); GraphTargetItem ret = null; @@ -1214,7 +1214,7 @@ public class ActionScriptParser { } else { expectedType(SymbolType.NAMESPACE); expectedType(SymbolType.ASSIGN); - GraphTargetItem ns = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem ns = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); ret = new DefaultXMLNamespace(null, ns); //TODO: use dxns for attribute namespaces instead of dxnslate } @@ -1224,20 +1224,20 @@ public class ActionScriptParser { switch (s.type) { case USE: expectedType(SymbolType.NAMESPACE); - GraphTargetItem ns = type(thisType,pkg, needsActivation, importedClasses, openedNamespaces, variables); + GraphTargetItem ns = type(thisType, pkg, needsActivation, importedClasses, openedNamespaces, variables); openedNamespaces.add(abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE /*FIXME?*/, abc.constants.getStringId(ns.toString(), true)), 0, true)); break; case WITH: needsActivation.setVal(true); expectedType(SymbolType.PARENT_OPEN); - GraphTargetItem wvar = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//(name(thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables)); + GraphTargetItem wvar = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//(name(thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables)); if (!isNameOrProp(wvar)) { throw new AVM2ParseException("Not a property or name", lexer.yyline()); } expectedType(SymbolType.PARENT_CLOSE); expectedType(SymbolType.CURLY_OPEN); List withVars = new ArrayList<>(); - List wcmd = commands(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, withVars); + List wcmd = commands(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, withVars); variables.addAll(withVars); for (AssignableAVM2Item a : withVars) { if (a instanceof UnresolvedAVM2Item) { @@ -1277,14 +1277,14 @@ public class ActionScriptParser { s = lex(); GraphTargetItem type; if (s.type == SymbolType.COLON) { - type = type(thisType,pkg, needsActivation, importedClasses, openedNamespaces, variables); + type = type(thisType, pkg, needsActivation, importedClasses, openedNamespaces, variables); s = lex(); } else { type = new UnboundedTypeItem(); } if (s.type == SymbolType.ASSIGN) { - GraphTargetItem varval = (expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + GraphTargetItem varval = (expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); ret = new NameAVM2Item(type, lexer.yyline(), varIdentifier, varval, true, openedNamespaces); variables.add((NameAVM2Item) ret); } else { @@ -1294,7 +1294,7 @@ public class ActionScriptParser { } break; case CURLY_OPEN: - ret = new BlockItem(null, commands(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables)); + ret = new BlockItem(null, commands(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables)); expectedType(SymbolType.CURLY_CLOSE); break; /*case INCREMENT: //preincrement @@ -1312,7 +1312,7 @@ public class ActionScriptParser { case SUPER: //constructor call ParsedSymbol ss2 = lex(); if (ss2.type == SymbolType.PARENT_OPEN) { - List args = call(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables); + List args = call(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables); ret = new ConstructSuperAVM2Item(null, new LocalRegAVM2Item(null, 0, null), args); } else {//no costructor call, but it could be calling parent methods... => handle in expression lexer.pushback(ss2); @@ -1321,16 +1321,16 @@ public class ActionScriptParser { break; case IF: expectedType(SymbolType.PARENT_OPEN); - GraphTargetItem ifExpr = (expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + GraphTargetItem ifExpr = (expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.PARENT_CLOSE); - GraphTargetItem onTrue = command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables); + GraphTargetItem onTrue = command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables); List onTrueList = new ArrayList<>(); onTrueList.add(onTrue); s = lex(); List onFalseList = null; if (s.type == SymbolType.ELSE) { onFalseList = new ArrayList<>(); - onFalseList.add(command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); + onFalseList.add(command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); } else { lexer.pushback(s); } @@ -1339,7 +1339,7 @@ public class ActionScriptParser { case WHILE: expectedType(SymbolType.PARENT_OPEN); List whileExpr = new ArrayList<>(); - whileExpr.add(commaExpression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables)); + whileExpr.add(commaExpression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables)); expectedType(SymbolType.PARENT_CLOSE); List whileBody = new ArrayList<>(); Loop wloop = new Loop(uniqId(), null, null); @@ -1347,7 +1347,7 @@ public class ActionScriptParser { loopLabels.put(wloop, loopLabel); } loops.push(wloop); - whileBody.add(command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); + whileBody.add(command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); ret = new WhileItem(null, wloop, whileExpr, whileBody); break; case DO: @@ -1357,7 +1357,7 @@ public class ActionScriptParser { if (loopLabel != null) { loopLabels.put(dloop, loopLabel); } - doBody.add(command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); + doBody.add(command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); expectedType(SymbolType.WHILE); expectedType(SymbolType.PARENT_OPEN); List doExpr = new ArrayList<>(); @@ -1376,11 +1376,11 @@ public class ActionScriptParser { s = lex(); } expected(s, lexer.yyline(), SymbolType.PARENT_OPEN); - GraphTargetItem firstCommand = command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, false, variables); + GraphTargetItem firstCommand = command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, false, variables); if (firstCommand instanceof NameAVM2Item) { NameAVM2Item nai = (NameAVM2Item) firstCommand; if (nai.isDefinition() && nai.getAssignedValue() == null) { - firstCommand = expressionRemainder(thisType,pkg, needsActivation, openedNamespaces, firstCommand, registerVars, inFunction, inMethod, true, variables, importedClasses); + firstCommand = expressionRemainder(thisType, pkg, needsActivation, openedNamespaces, firstCommand, registerVars, inFunction, inMethod, true, variables, importedClasses); } } InAVM2Item inexpr = null; @@ -1406,13 +1406,13 @@ public class ActionScriptParser { if (firstCommand != null) { //can be empty command forFirstCommands.add(firstCommand); } - forExpr = (expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + forExpr = (expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.SEMICOLON); - forFinalCommands.add(command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); + forFinalCommands.add(command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); } expectedType(SymbolType.PARENT_CLOSE); List forBody = new ArrayList<>(); - forBody.add(command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forin ? forinlevel + 1 : forinlevel, true, variables)); + forBody.add(command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forin ? forinlevel + 1 : forinlevel, true, variables)); if (forin) { if (each) { ret = new ForEachInAVM2Item(null, floop, inexpr, forBody); @@ -1431,7 +1431,7 @@ public class ActionScriptParser { loopLabels.put(sloop, loopLabel); } expectedType(SymbolType.PARENT_OPEN); - GraphTargetItem switchExpr = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem switchExpr = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.PARENT_CLOSE); expectedType(SymbolType.CURLY_OPEN); s = lex(); @@ -1452,7 +1452,7 @@ public class ActionScriptParser { while (s.type == SymbolType.CASE) { List caseExprs = new ArrayList<>(); while (s.type == SymbolType.CASE) { - GraphTargetItem curCaseExpr = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem curCaseExpr = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); caseExprs.add(curCaseExpr); expectedType(SymbolType.COLON); s = lex(); @@ -1461,14 +1461,14 @@ public class ActionScriptParser { } pos++; lexer.pushback(s); - List caseCmd = commands(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables); + List caseCmd = commands(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables); caseCmds.add(caseCmd); s = lex(); } List defCmd = new ArrayList<>(); if (s.type == SymbolType.DEFAULT) { expectedType(SymbolType.COLON); - defCmd = commands(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables); + defCmd = commands(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables); s = lexer.lex(); } expected(s, lexer.yyline(), SymbolType.CURLY_CLOSE); @@ -1533,7 +1533,7 @@ public class ActionScriptParser { ret = new ContinueItem(null, cloopId); break; case RETURN: - GraphTargetItem retexpr = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, true, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem retexpr = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, true, registerVars, inFunction, inMethod, true, variables); if (retexpr == null) { ret = new ReturnVoidAVM2Item(null); } else { @@ -1543,7 +1543,7 @@ public class ActionScriptParser { case TRY: needsActivation.setVal(true); List tryCommands = new ArrayList<>(); - tryCommands.add(command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); + tryCommands.add(command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); s = lex(); boolean found = false; List> catchCommands = new ArrayList<>(); @@ -1557,7 +1557,7 @@ public class ActionScriptParser { String enamestr = s.value.toString(); expectedType(SymbolType.COLON); - GraphTargetItem etype = type(thisType,pkg, needsActivation, importedClasses, openedNamespaces, variables); + GraphTargetItem etype = type(thisType, pkg, needsActivation, importedClasses, openedNamespaces, variables); NameAVM2Item e = new NameAVM2Item(etype, lexer.yyline(), enamestr, new ExceptionAVM2Item(null)/*?*/, true/*?*/, openedNamespaces); variables.add(e); catchExceptions.add(e); @@ -1566,7 +1566,7 @@ public class ActionScriptParser { expectedType(SymbolType.PARENT_CLOSE); List cc = new ArrayList<>(); List catchVars = new ArrayList<>(); - cc.add(command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, catchVars)); + cc.add(command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, catchVars)); catchesVars.add(catchVars); variables.addAll(catchVars); @@ -1612,7 +1612,7 @@ public class ActionScriptParser { List finallyCommands = null; if (s.type == SymbolType.FINALLY) { finallyCommands = new ArrayList<>(); - finallyCommands.add(command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); + finallyCommands.add(command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); found = true; s = lex(); } @@ -1626,7 +1626,7 @@ public class ActionScriptParser { ret = tai; break; case THROW: - ret = new ThrowAVM2Item(null, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret = new ThrowAVM2Item(null, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); break; default: GraphTargetItem valcmd = expressionCommands(s, registerVars, inFunction, inMethod, forinlevel, variables); @@ -1638,7 +1638,7 @@ public class ActionScriptParser { return null; } lexer.pushback(s); - ret = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + ret = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); if (debugMode) { System.out.println("/command"); } @@ -1650,7 +1650,7 @@ public class ActionScriptParser { lexer.removeListener(buf); if (ret == null) { //can be popped expression buf.pushAllBack(lexer); - ret = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + ret = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); } s = lex(); if ((s != null) && (s.type != SymbolType.SEMICOLON)) { @@ -1661,8 +1661,8 @@ public class ActionScriptParser { } - private GraphTargetItem expression(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables) throws IOException, AVM2ParseException { - return expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, allowRemainder, variables); + private GraphTargetItem expression(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables) throws IOException, AVM2ParseException { + return expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, allowRemainder, variables); } private GraphTargetItem fixPrecedence(GraphTargetItem expr) { @@ -1683,14 +1683,14 @@ public class ActionScriptParser { return ret; } - private GraphTargetItem expressionRemainder(TypeItem thisType,String pkg, Reference needsActivation, List openedNamespaces, GraphTargetItem expr, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables, List importedClasses) throws IOException, AVM2ParseException { + private GraphTargetItem expressionRemainder(TypeItem thisType, String pkg, Reference needsActivation, List openedNamespaces, GraphTargetItem expr, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables, List importedClasses) throws IOException, AVM2ParseException { GraphTargetItem ret = null; ParsedSymbol s = lex(); if (ret == null) { switch (s.type) { case AS: - GraphTargetItem type = type(thisType,pkg, needsActivation, importedClasses, openedNamespaces, variables); + GraphTargetItem type = type(thisType, pkg, needsActivation, importedClasses, openedNamespaces, variables); ret = new AsTypeAVM2Item(null, expr, type); allowRemainder = false; break; @@ -1702,7 +1702,7 @@ public class ActionScriptParser { break; case FILTER: needsActivation.setVal(true); - ret = new XMLFilterAVM2Item(expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables), openedNamespaces); + ret = new XMLFilterAVM2Item(expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables), openedNamespaces); expectedType(SymbolType.PARENT_CLOSE); allowRemainder = true; break; @@ -1729,52 +1729,52 @@ public class ActionScriptParser { } break;*/ case IN: - ret = new InAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret = new InAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); break; case TERNAR: - GraphTargetItem terOnTrue = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem terOnTrue = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.COLON); - GraphTargetItem terOnFalse = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem terOnFalse = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); ret = new TernarOpItem(null, expr, terOnTrue, terOnFalse); break; case SHIFT_LEFT: - ret = new LShiftAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new LShiftAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case SHIFT_RIGHT: - ret = new RShiftAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new RShiftAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case USHIFT_RIGHT: - ret = new URShiftAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new URShiftAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case BITAND: - ret = new BitAndAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new BitAndAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case BITOR: - ret = new BitOrAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new BitOrAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case DIVIDE: - ret = new DivideAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new DivideAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case MODULO: - ret = new ModuloAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new ModuloAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case EQUALS: - ret = new EqAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new EqAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case STRICT_EQUALS: - ret = new StrictEqAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new StrictEqAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case NOT_EQUAL: - ret = new NeqAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new NeqAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case STRICT_NOT_EQUAL: - ret = new StrictNeqAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new StrictNeqAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case LOWER_THAN: - ret = new LtAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new LtAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case LOWER_EQUAL: - ret = new LeAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new LeAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case GREATER_THAN: case XML_STARTVARTAG_BEGIN: @@ -1782,34 +1782,34 @@ public class ActionScriptParser { if (s.type != SymbolType.GREATER_THAN) { lexer.yypushbackstr(s.value.toString().substring(1)); //parse again as GREATER_THAN } - ret = new GtAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new GtAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case GREATER_EQUAL: - ret = new GeAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new GeAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case AND: - ret = new AndItem(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new AndItem(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case OR: - ret = new OrItem(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new OrItem(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case MINUS: - ret = new SubtractAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new SubtractAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case MULTIPLY: - ret = new MultiplyAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new MultiplyAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case PLUS: - ret = new AddAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new AddAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case XOR: - ret = new BitXorAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new BitXorAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case INSTANCEOF: - ret = new InstanceOfAVM2Item(null, expr, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new InstanceOfAVM2Item(null, expr, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case IS: - GraphTargetItem istype = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables);//type(thisType,pkg,needsActivation, importedClasses, openedNamespaces, variables); + GraphTargetItem istype = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables);//type(thisType,pkg,needsActivation, importedClasses, openedNamespaces, variables); ret = new IsTypeAVM2Item(null, expr, istype); allowRemainder = false; break; @@ -1825,7 +1825,7 @@ public class ActionScriptParser { case ASSIGN_SHIFT_RIGHT: case ASSIGN_USHIFT_RIGHT: case ASSIGN_XOR: - GraphTargetItem assigned = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem assigned = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); switch (s.type) { case ASSIGN: //assigned = assigned; @@ -1882,14 +1882,14 @@ public class ActionScriptParser { case BRACKET_OPEN: //member case PARENT_OPEN: //function call lexer.pushback(s); - ret = memberOrCall(thisType,pkg, needsActivation, importedClasses, openedNamespaces, expr, registerVars, inFunction, inMethod, variables); + ret = memberOrCall(thisType, pkg, needsActivation, importedClasses, openedNamespaces, expr, registerVars, inFunction, inMethod, variables); break; default: lexer.pushback(s); if (expr instanceof ParenthesisItem) { if (isType(((ParenthesisItem) expr).value)) { - GraphTargetItem expr2 = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem expr2 = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, true, variables); if (expr2 != null) { ret = new CoerceAVM2Item(null, ((ParenthesisItem) expr).value, expr2); } @@ -1930,7 +1930,7 @@ public class ActionScriptParser { return false; } - private int brackets(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, List ret, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { + private int brackets(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, List ret, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, AVM2ParseException { ParsedSymbol s = lex(); int arrCnt = 0; if (s.type == SymbolType.BRACKET_OPEN) { @@ -1941,7 +1941,7 @@ public class ActionScriptParser { lexer.pushback(s); } arrCnt++; - ret.add(expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret.add(expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); s = lex(); if (!s.isType(SymbolType.COMMA, SymbolType.BRACKET_CLOSE)) { expected(s, lexer.yyline(), SymbolType.COMMA, SymbolType.BRACKET_CLOSE); @@ -1954,12 +1954,12 @@ public class ActionScriptParser { return arrCnt; } - private GraphTargetItem commaExpression(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forInLevel, List variables) throws IOException, AVM2ParseException { + private GraphTargetItem commaExpression(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forInLevel, List variables) throws IOException, AVM2ParseException { GraphTargetItem cmd = null; List expr = new ArrayList<>(); ParsedSymbol s; do { - cmd = command(thisType,pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forInLevel, false, variables); + cmd = command(thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forInLevel, false, variables); if (cmd != null) { expr.add(cmd); } @@ -1967,7 +1967,7 @@ public class ActionScriptParser { } while (s.type == SymbolType.COMMA && cmd != null); lexer.pushback(s); if (cmd == null) { - expr.add(expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + expr.add(expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); } else { if (!cmd.hasReturnValue()) { throw new AVM2ParseException("Expression expected", lexer.yyline()); @@ -1976,7 +1976,7 @@ public class ActionScriptParser { return new CommaExpressionItem(null, expr); } - private GraphTargetItem expression(TypeItem thisType,String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, boolean allowEmpty, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables) throws IOException, AVM2ParseException { + private GraphTargetItem expression(TypeItem thisType, String pkg, Reference needsActivation, List importedClasses, List openedNamespaces, boolean allowEmpty, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables) throws IOException, AVM2ParseException { if (debugMode) { System.out.println("expression:"); } @@ -1987,7 +1987,7 @@ public class ActionScriptParser { switch (s.type) { case XML_STARTTAG_BEGIN: lexer.pushback(s); - ret = xml(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables); + ret = xml(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables); existsRemainder = true; break; case STRING: @@ -1995,7 +1995,7 @@ public class ActionScriptParser { existsRemainder = true; break; case NEGATE: - ret = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables); + ret = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables); ret = new NegAVM2Item(null, ret); existsRemainder = true; break; @@ -2009,7 +2009,7 @@ public class ActionScriptParser { existsRemainder = true; } else { lexer.pushback(s); - GraphTargetItem num = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem num = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); if (num instanceof IntegerValueAVM2Item) { ((IntegerValueAVM2Item) num).value = -((IntegerValueAVM2Item) num).value; ret = num; @@ -2027,7 +2027,7 @@ public class ActionScriptParser { } break; case TYPEOF: - ret = new TypeOfAVM2Item(null, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new TypeOfAVM2Item(null, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); existsRemainder = true; break; case TRUE: @@ -2059,7 +2059,7 @@ public class ActionScriptParser { GraphTargetItem n = new StringAVM2Item(null, s.value.toString()); //expression(thisType,pkg,needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables); expectedType(SymbolType.COLON); - GraphTargetItem v = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables); + GraphTargetItem v = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables); NameValuePair nv = new NameValuePair(n, v); nvs.add(nv); @@ -2069,14 +2069,14 @@ public class ActionScriptParser { } } ret = new NewObjectAVM2Item(null, nvs); - ret = memberOrCall(thisType,pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); + ret = memberOrCall(thisType, pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); break; case BRACKET_OPEN: //Array literal or just brackets lexer.pushback(s); List inBrackets = new ArrayList<>(); - int arrCnt = brackets(thisType,pkg, needsActivation, importedClasses, openedNamespaces, inBrackets, registerVars, inFunction, inMethod, variables); + int arrCnt = brackets(thisType, pkg, needsActivation, importedClasses, openedNamespaces, inBrackets, registerVars, inFunction, inMethod, variables); ret = new NewArrayAVM2Item(null, inBrackets); - ret = memberOrCall(thisType,pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); + ret = memberOrCall(thisType, pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); break; case FUNCTION: @@ -2107,7 +2107,7 @@ public class ActionScriptParser { existsRemainder = true; break; case DELETE: - GraphTargetItem varDel = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables); + GraphTargetItem varDel = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables); if (!isNameOrProp(varDel)) { throw new AVM2ParseException("Not a property or name", lexer.yyline()); } @@ -2115,7 +2115,7 @@ public class ActionScriptParser { break; case INCREMENT: case DECREMENT: //preincrement - GraphTargetItem varincdec = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false/*?*/, variables);//name(thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables); + GraphTargetItem varincdec = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false/*?*/, variables);//name(thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables); if (!isNameOrProp(varincdec)) { throw new AVM2ParseException("Not a property or name", lexer.yyline()); } @@ -2128,13 +2128,13 @@ public class ActionScriptParser { existsRemainder = true; break; case NOT: - ret = new NotItem(null, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new NotItem(null, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); existsRemainder = true; break; case PARENT_OPEN: - ret = new ParenthesisItem(null, expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret = new ParenthesisItem(null, expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.PARENT_CLOSE); - ret = memberOrCall(thisType,pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); + ret = memberOrCall(thisType, pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); existsRemainder = true; break; case NEW: @@ -2154,27 +2154,27 @@ public class ActionScriptParser { needsActivation.setVal(true); ret = function(pkg, false, needsActivation, importedClasses, 0/*?*/, thisType, openedNamespaces, ffname, false, variables); } else if (s.type == SymbolType.LOWER_THAN) { - GraphTargetItem subtype = type(thisType,pkg, needsActivation, importedClasses, openedNamespaces, variables); + GraphTargetItem subtype = type(thisType, pkg, needsActivation, importedClasses, openedNamespaces, variables); expectedType(SymbolType.GREATER_THAN); s = lex(); expected(s, lexer.yyline(), SymbolType.BRACKET_OPEN); lexer.pushback(s); List params = new ArrayList<>(); - brackets(thisType,pkg, needsActivation, importedClasses, openedNamespaces, params, registerVars, inFunction, inMethod, variables); + brackets(thisType, pkg, needsActivation, importedClasses, openedNamespaces, params, registerVars, inFunction, inMethod, variables); ret = new InitVectorAVM2Item(subtype, params, openedNamespaces); } else if (s.type == SymbolType.PARENT_OPEN) { - GraphTargetItem newvar = expression(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); - newvar = applyType(thisType,pkg, needsActivation, importedClasses, openedNamespaces, newvar, registerVars, inFunction, inMethod, variables); + GraphTargetItem newvar = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + newvar = applyType(thisType, pkg, needsActivation, importedClasses, openedNamespaces, newvar, registerVars, inFunction, inMethod, variables); expectedType(SymbolType.PARENT_CLOSE); expectedType(SymbolType.PARENT_OPEN); - ret = new ConstructSomethingAVM2Item(lexer.yyline(), openedNamespaces, newvar, call(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); + ret = new ConstructSomethingAVM2Item(lexer.yyline(), openedNamespaces, newvar, call(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); } else { lexer.pushback(s); - GraphTargetItem newvar = name(thisType,pkg, needsActivation, false /*?*/, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); - newvar = applyType(thisType,pkg, needsActivation, importedClasses, openedNamespaces, newvar, registerVars, inFunction, inMethod, variables); + GraphTargetItem newvar = name(thisType, pkg, needsActivation, false /*?*/, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); + newvar = applyType(thisType, pkg, needsActivation, importedClasses, openedNamespaces, newvar, registerVars, inFunction, inMethod, variables); expectedType(SymbolType.PARENT_OPEN); - ret = new ConstructSomethingAVM2Item(lexer.yyline(), openedNamespaces, newvar, call(thisType,pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); + ret = new ConstructSomethingAVM2Item(lexer.yyline(), openedNamespaces, newvar, call(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); } existsRemainder = true; break; @@ -2183,8 +2183,8 @@ public class ActionScriptParser { case SUPER: case ATTRIBUTE: lexer.pushback(s); - GraphTargetItem var = name(thisType,pkg, needsActivation, false, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); - var = memberOrCall(thisType,pkg, needsActivation, importedClasses, openedNamespaces, var, registerVars, inFunction, inMethod, variables); + GraphTargetItem var = name(thisType, pkg, needsActivation, false, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); + var = memberOrCall(thisType, pkg, needsActivation, importedClasses, openedNamespaces, var, registerVars, inFunction, inMethod, variables); ret = var; existsRemainder = true; break; @@ -2200,7 +2200,7 @@ public class ActionScriptParser { if (allowRemainder && existsRemainder) { GraphTargetItem rem = ret; do { - rem = expressionRemainder(thisType,pkg, needsActivation, openedNamespaces, rem, registerVars, inFunction, inMethod, assocRight, variables, importedClasses); + rem = expressionRemainder(thisType, pkg, needsActivation, openedNamespaces, rem, registerVars, inFunction, inMethod, assocRight, variables, importedClasses); if (rem != null) { ret = rem; } @@ -2323,12 +2323,12 @@ public class ActionScriptParser { SourceGeneratorLocalData localData = new SourceGeneratorLocalData( new HashMap(), 0, Boolean.FALSE, 0); localData.documentClass = documentClass; - abc.script_info.add(gen.generateScriptInfo(localData, items,classPos)); + abc.script_info.add(gen.generateScriptInfo(localData, items, classPos)); } public void addScript(String s, boolean documentClass, String fileName, int classPos) throws AVM2ParseException, IOException, CompilationException { List traits = scriptTraitsFromString(s, fileName); - addScriptFromTree(traits, documentClass,classPos); + addScriptFromTree(traits, documentClass, classPos); } public ActionScriptParser(ABC abc, List otherABCs) { @@ -2354,7 +2354,7 @@ public class ActionScriptParser { parABCs.addAll(playerABCs); parABCs.addAll(otherABCs); ActionScriptParser parser = new ActionScriptParser(abc, parABCs); - parser.addScript(src, documentClass, fileName,classPos); + parser.addScript(src, documentClass, fileName, classPos); } public static void compile(SWF swf, String src, String dst, int classPos) { @@ -2363,7 +2363,7 @@ public class ActionScriptParser { initPlayer(); ABC abc = new ABC(swf); ActionScriptParser parser = new ActionScriptParser(abc, playerABCs); - parser.addScript(new String(Helper.readFile(src), "UTF-8"), true, src,classPos); + parser.addScript(new String(Helper.readFile(src), "UTF-8"), true, src, classPos); abc.saveToStream(new FileOutputStream(new File(dst))); } catch (Exception ex) { Logger.getLogger(ActionScriptParser.class.getName()).log(Level.SEVERE, null, ex); 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 396813e15..54e772e22 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 @@ -61,19 +61,19 @@ public class MethodBody implements Cloneable { public transient List convertedItems; public transient Throwable convertException; - public synchronized void setCodeBytes(byte codeBytes[]){ + public synchronized void setCodeBytes(byte codeBytes[]) { this.codeBytes = codeBytes; this.code = null; } - + public synchronized byte[] getCodeBytes() { - if(code == null){ + if (code == null) { return codeBytes; - }else{ + } else { return code.getBytes(); } } - + public synchronized AVM2Code getCode() { if (code == null) { AVM2Code avm2Code; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java index e9b4d438a..11a47639e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java @@ -257,8 +257,7 @@ public class DirectValueActionItem extends ActionItem { @Override public String toString() { - return ""+getResult(); + return "" + getResult(); } - - + } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java index 76752e6e1..f4cef2f7c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java @@ -44,8 +44,6 @@ public class GetVariableActionItem extends ActionItem { return name.toString(); } - - @Override public List getAllSubItems() { List ret = new ArrayList<>(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index c8e91d32c..0ffd95b6f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -333,11 +333,10 @@ public class Configuration { @ConfigurationDefaultBoolean(false) @ConfigurationCategory("debug") public static final ConfigurationItem showMethodBodyId = null; - + @ConfigurationDefaultDouble(1.0) @ConfigurationName("export.zoom") public static final ConfigurationItem lastSelectedExportZoom = null; - public static final ConfigurationItem pluginPath = null; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultDouble.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultDouble.java index 3d868ca89..9c76ae745 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultDouble.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultDouble.java @@ -26,7 +26,7 @@ import java.lang.annotation.Target; */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) -public @interface ConfigurationDefaultDouble{ +public @interface ConfigurationDefaultDouble { double value(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java index 763e2131a..30b7afef9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java @@ -81,12 +81,12 @@ public class MorphShapeExporter { case SVG: try (FileOutputStream fos = new FileOutputStream(file)) { ExportRectangle rect = new ExportRectangle(mst.getRect(new HashSet())); - rect.xMax*=settings.zoom; - rect.yMax*=settings.zoom; - rect.xMin*=settings.zoom; - rect.yMin*=settings.zoom; + rect.xMax *= settings.zoom; + rect.yMax *= settings.zoom; + rect.xMin *= settings.zoom; + rect.yMin *= settings.zoom; SVGExporter exporter = new SVGExporter(rect); - mst.toSVG(exporter, -2, new CXFORMWITHALPHA(), 0,settings.zoom); + mst.toSVG(exporter, -2, new CXFORMWITHALPHA(), 0, settings.zoom); fos.write(Utf8Helper.getBytes(exporter.getSVG())); } break; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java index 39066bb21..18f054562 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java @@ -89,10 +89,10 @@ public class ShapeExporter { case SVG: try (FileOutputStream fos = new FileOutputStream(file)) { ExportRectangle rect = new ExportRectangle(st.getRect(new HashSet())); - rect.xMax*=settings.zoom; - rect.yMax*=settings.zoom; - rect.xMin*=settings.zoom; - rect.yMin*=settings.zoom; + rect.xMax *= settings.zoom; + rect.yMax *= settings.zoom; + rect.xMin *= settings.zoom; + rect.yMin *= settings.zoom; SVGExporter exporter = new SVGExporter(rect); st.toSVG(exporter, -2, new CXFORMWITHALPHA(), 0, settings.zoom); fos.write(Utf8Helper.getBytes(exporter.getSVG())); @@ -115,7 +115,7 @@ public class ShapeExporter { SHAPE shp = st.getShapes(); int deltaX = -shp.getBounds().Xmin; int deltaY = -shp.getBounds().Ymin; - CanvasShapeExporter cse = new CanvasShapeExporter(null, SWF.unitDivisor/settings.zoom, ((Tag) st).getSwf(), shp, new CXFORMWITHALPHA(), deltaX, deltaY); + CanvasShapeExporter cse = new CanvasShapeExporter(null, SWF.unitDivisor / settings.zoom, ((Tag) st).getSwf(), shp, new CXFORMWITHALPHA(), deltaX, deltaY); cse.export(); Set needed = new HashSet<>(); needed.add(st.getCharacterId()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/CanvasMorphShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/CanvasMorphShapeExporter.java index d35b54576..3803ca8c7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/CanvasMorphShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/CanvasMorphShapeExporter.java @@ -269,7 +269,7 @@ public class CanvasMorphShapeExporter extends MorphShapeExporterBase { finalizePath(); thickness /= SWF.unitDivisor; thicknessEnd /= SWF.unitDivisor; - strokeData += "\tvar scaleMode = \""+scaleMode+"\";\r\n"; + strokeData += "\tvar scaleMode = \"" + scaleMode + "\";\r\n"; if (color != null) { //for gradient line fill strokeData += "\tctx.strokeStyle=" + useRatioColor(color, colorEnd) + ";\r\n"; } @@ -389,8 +389,8 @@ public class CanvasMorphShapeExporter extends MorphShapeExporterBase { y += deltaY; x2 += deltaX; y2 += deltaY; - pathData += Helper.doubleStr(x/unitDivisor) + " " + Helper.doubleStr(x2/unitDivisor) + " " - + Helper.doubleStr(y/unitDivisor) + " " + Helper.doubleStr(y2/unitDivisor) + " "; + pathData += Helper.doubleStr(x / unitDivisor) + " " + Helper.doubleStr(x2 / unitDivisor) + " " + + Helper.doubleStr(y / unitDivisor) + " " + Helper.doubleStr(y2 / unitDivisor) + " "; } @Override @@ -403,8 +403,8 @@ public class CanvasMorphShapeExporter extends MorphShapeExporterBase { y += deltaY; x2 += deltaX; y2 += deltaY; - pathData += Helper.doubleStr(x/unitDivisor) + " " + Helper.doubleStr(x2/unitDivisor) + " " - + Helper.doubleStr(y/unitDivisor) + " " + Helper.doubleStr(y2/unitDivisor) + " "; + pathData += Helper.doubleStr(x / unitDivisor) + " " + Helper.doubleStr(x2 / unitDivisor) + " " + + Helper.doubleStr(y / unitDivisor) + " " + Helper.doubleStr(y2 / unitDivisor) + " "; } @Override @@ -423,15 +423,15 @@ public class CanvasMorphShapeExporter extends MorphShapeExporterBase { controlY2 += deltaY; anchorY2 += deltaY; - pathData += Helper.doubleStr(controlX/unitDivisor) + " " + Helper.doubleStr(controlX2/unitDivisor) + " " + - Helper.doubleStr(controlY/unitDivisor) + " " + Helper.doubleStr(controlY2/unitDivisor) + " " + - Helper.doubleStr(anchorX/unitDivisor) + " " + Helper.doubleStr(anchorX2/unitDivisor) + " " + - Helper.doubleStr(anchorY/unitDivisor) + " " + Helper.doubleStr(anchorY2/unitDivisor) + " "; + pathData += Helper.doubleStr(controlX / unitDivisor) + " " + Helper.doubleStr(controlX2 / unitDivisor) + " " + + Helper.doubleStr(controlY / unitDivisor) + " " + Helper.doubleStr(controlY2 / unitDivisor) + " " + + Helper.doubleStr(anchorX / unitDivisor) + " " + Helper.doubleStr(anchorX2 / unitDivisor) + " " + + Helper.doubleStr(anchorY / unitDivisor) + " " + Helper.doubleStr(anchorY2 / unitDivisor) + " "; } protected void finalizePath() { if (!"".equals(pathData)) { - shapeData+="\tvar pathData=\""+pathData.trim()+"\";\r\n"; + shapeData += "\tvar pathData=\"" + pathData.trim() + "\";\r\n"; String drawStroke = "\tdrawMorphPath(ctx,pathData,ratio,true,scaleMode);\r\n"; String drawFill = "\tdrawMorphPath(ctx,pathData,ratio,false);\r\n";; pathData = ""; @@ -501,7 +501,7 @@ public class CanvasMorphShapeExporter extends MorphShapeExporterBase { shapeData += fillData + pathData; } if (!"".equals(strokeData)) { - shapeData += drawStroke+"\r\n"; //"\tctx.stroke();\r\n"; + shapeData += drawStroke + "\r\n"; //"\tctx.stroke();\r\n"; } else if (lineFillData != null) { shapeData += lineFillData; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/DefaultSVGMorphShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/DefaultSVGMorphShapeExporter.java index a74ab9e97..b2f689fdc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/DefaultSVGMorphShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/DefaultSVGMorphShapeExporter.java @@ -100,7 +100,7 @@ public abstract class DefaultSVGMorphShapeExporter extends MorphShapeExporterBas public void moveTo(double x, double y, double x2, double y2) { currentDrawCommand = ""; pathData += "M" - + roundPixels20(x * zoom/ SWF.unitDivisor) + " " + + roundPixels20(x * zoom / SWF.unitDivisor) + " " + roundPixels20(y * zoom / SWF.unitDivisor) + " "; pathDataEnd += "M" + roundPixels20(x2 * zoom / SWF.unitDivisor) + " " diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/SVGMorphShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/SVGMorphShapeExporter.java index ac6f7c323..2b4831590 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/SVGMorphShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/morphshape/SVGMorphShapeExporter.java @@ -146,14 +146,14 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { pattern.setAttribute("height", "" + height); pattern.setAttribute("viewBox", "0 0 " + width + " " + height); if (matrix != null) { - matrix.rotateSkew0 *= zoom/SWF.unitDivisor; - matrix.rotateSkew1 *= zoom/SWF.unitDivisor; - matrix.scaleX *= zoom/SWF.unitDivisor; - matrix.scaleY *= zoom/SWF.unitDivisor; - matrixEnd.rotateSkew0 *= zoom/SWF.unitDivisor; - matrixEnd.rotateSkew1 *= zoom/SWF.unitDivisor; - matrixEnd.scaleX *= zoom/SWF.unitDivisor; - matrixEnd.scaleY *= zoom/SWF.unitDivisor; + matrix.rotateSkew0 *= zoom / SWF.unitDivisor; + matrix.rotateSkew1 *= zoom / SWF.unitDivisor; + matrix.scaleX *= zoom / SWF.unitDivisor; + matrix.scaleY *= zoom / SWF.unitDivisor; + matrixEnd.rotateSkew0 *= zoom / SWF.unitDivisor; + matrixEnd.rotateSkew1 *= zoom / SWF.unitDivisor; + matrixEnd.scaleX *= zoom / SWF.unitDivisor; + matrixEnd.scaleY *= zoom / SWF.unitDivisor; addMatrixAnimation(pattern, "patternTransform", matrix, matrixEnd); } Element imageElement = exporter.createElement("image"); @@ -169,8 +169,8 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { @Override public void lineStyle(double thickness, double thicknessEnd, RGB color, RGB colorEnd, boolean pixelHinting, String scaleMode, int startCaps, int endCaps, int joints, int miterLimit) { finalizePath(); - thickness *= zoom/SWF.unitDivisor; - thicknessEnd *= zoom/SWF.unitDivisor; + thickness *= zoom / SWF.unitDivisor; + thicknessEnd *= zoom / SWF.unitDivisor; path.setAttribute("fill", "none"); path.setAttribute("stroke", color.toHexRGB()); path.appendChild(createAnimateElement("stroke", color.toHexRGB(), colorEnd.toHexRGB())); @@ -255,7 +255,7 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { final int animationLength = 2; // todo final String animationLengthStr = animationLength + "s"; - element.setAttribute(attribute, matrix.getTransformationString(SWF.unitDivisor/zoom, 1)); + element.setAttribute(attribute, matrix.getTransformationString(SWF.unitDivisor / zoom, 1)); // QR decomposition double translateX = roundPixels400(matrix.translateX * zoom / SWF.unitDivisor); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java index 65f2a5afe..c4371c535 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java @@ -106,8 +106,7 @@ public class BitmapExporter extends ShapeExporterBase { * This outline is distorted by our AffineTransform relative to the * outline which would be given by the base stroke, but only in terms of * scaling (i.e. thickness of the lines), as translation and rotation - * are undone after the stro @Override -king. + * are undone after the stro @Override king. */ public Shape createStrokedShape(Shape s) { Shape sTrans = transform.createTransformedShape(s); @@ -130,7 +129,7 @@ king. private void exportTo(SerializableImage image, Matrix transformation) { this.image = image; - graphics = (Graphics2D) image.getGraphics(); + graphics = (Graphics2D) image.getGraphics(); AffineTransform at = transformation.toTransform(); at.preConcatenate(AffineTransform.getScaleInstance(1 / SWF.unitDivisor, 1 / SWF.unitDivisor)); unitDivisor = 1; @@ -362,7 +361,7 @@ king. joinStyle = BasicStroke.JOIN_ROUND; break; } - switch(scaleMode){ + switch (scaleMode) { case "VERTICAL": thickness *= graphics.getTransform().getScaleY(); break; @@ -379,9 +378,9 @@ king. lineStroke = new BasicStroke((float) thickness, capStyle, joinStyle); } //Do not scale strokes automatically: - try{ - lineStroke = new TransformedStroke(lineStroke,graphics.getTransform()); - }catch(NoninvertibleTransformException net){ + try { + lineStroke = new TransformedStroke(lineStroke, graphics.getTransform()); + } catch (NoninvertibleTransformException net) { //ignore } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/CanvasShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/CanvasShapeExporter.java index 669f26a7e..fcb1da57e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/CanvasShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/CanvasShapeExporter.java @@ -287,7 +287,7 @@ public class CanvasShapeExporter extends ShapeExporterBase { public void lineStyle(double thickness, RGB color, boolean pixelHinting, String scaleMode, int startCaps, int endCaps, int joints, int miterLimit) { finalizePath(); thickness /= SWF.unitDivisor; - strokeData += "\tvar scaleMode = \""+scaleMode+"\";\r\n"; + strokeData += "\tvar scaleMode = \"" + scaleMode + "\";\r\n"; if (color != null) { //gradient lines have no color strokeData += "\tctx.strokeStyle=" + color(color) + ";\r\n"; @@ -420,7 +420,7 @@ public class CanvasShapeExporter extends ShapeExporterBase { protected void finalizePath() { if (!"".equals(pathData)) { - shapeData+="\tvar pathData=\""+pathData.trim()+"\";\r\n"; + shapeData += "\tvar pathData=\"" + pathData.trim() + "\";\r\n"; String drawStroke = "\tdrawPath(ctx,pathData,true,scaleMode);\r\n"; String drawFill = "\tdrawPath(ctx,pathData,false);\r\n";; pathData = ""; @@ -490,7 +490,7 @@ public class CanvasShapeExporter extends ShapeExporterBase { shapeData += fillData + pathData; } if (!"".equals(strokeData)) { - shapeData += drawStroke +"\r\n"; + shapeData += drawStroke + "\r\n"; } else if (lineFillData != null) { shapeData += lineFillData; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java index 68f782516..976e8f82c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java @@ -144,7 +144,7 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter { pattern.setAttribute("height", "" + height); pattern.setAttribute("viewBox", "0 0 " + width + " " + height); if (matrix != null) { - pattern.setAttribute("patternTransform", matrix.getTransformationString(SWF.unitDivisor/zoom, SWF.unitDivisor/zoom)); + pattern.setAttribute("patternTransform", matrix.getTransformationString(SWF.unitDivisor / zoom, SWF.unitDivisor / zoom)); } Element imageElement = exporter.createElement("image"); imageElement.setAttribute("width", "" + width); @@ -159,7 +159,7 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter { @Override public void lineStyle(double thickness, RGB color, boolean pixelHinting, String scaleMode, int startCaps, int endCaps, int joints, int miterLimit) { finalizePath(); - thickness *= zoom/SWF.unitDivisor; + thickness *= zoom / SWF.unitDivisor; path.setAttribute("fill", "none"); path.setAttribute("stroke", color.toHexRGB()); path.setAttribute("stroke-width", Double.toString(thickness == 0 ? 1 : thickness)); @@ -254,7 +254,7 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter { gradient.setAttribute("color-interpolation", "linearRGB"); } if (matrix != null) { - gradient.setAttribute("gradientTransform", matrix.getTransformationString(SWF.unitDivisor/zoom, 1)); + gradient.setAttribute("gradientTransform", matrix.getTransformationString(SWF.unitDivisor / zoom, 1)); } for (int i = 0; i < gradientRecords.length; i++) { GRADRECORD record = gradientRecords[i]; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java index 1c0c8e5ef..b8444e775 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/MORPHGRADIENT.java @@ -39,7 +39,7 @@ public class MORPHGRADIENT implements Serializable { @Internal public int numGradients; - public MORPHGRADRECORD[] gradientRecords; + public MORPHGRADRECORD[] gradientRecords; public static RGBA morphColor(RGBA c1, RGBA c2, int ratio) { int r = (int) (c1.red + (c2.red - c1.red) * ratio / 65535.0 + 0.5); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index de19c8bee..db8839fda 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -2198,24 +2198,24 @@ public class XFLConverter { ret += ""; ret += ""; - String labelsLayer = convertLabelsLayer(spriteId, tags, timelineTags, backgroundColor); + String labelsLayer = convertLabelsLayer(spriteId, tags, timelineTags, backgroundColor); ret += labelsLayer; String scriptLayer = convertActionScriptLayer(spriteId, tags, timelineTags, backgroundColor); ret += scriptLayer; - + int index = 0; - - if(!labelsLayer.isEmpty()){ + + if (!labelsLayer.isEmpty()) { index++; } - - if(!scriptLayer.isEmpty()){ + + if (!scriptLayer.isEmpty()) { index++; - } + } int layerCount = getLayerCount(timelineTags); Stack parentLayers = new Stack<>(); - + for (int d = layerCount; d >= 1; d--, index++) { for (Tag t : timelineTags) { if (t instanceof PlaceObjectTypeTag) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/resource/canvas.js b/libsrc/ffdec_lib/src/com/jpexs/helpers/resource/canvas.js index f7f698c82..377f95986 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/resource/canvas.js +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/resource/canvas.js @@ -194,8 +194,8 @@ Filters.blur = function(canvas, ctx, hRadius, vRadius, iterations, mask, maskTyp var data = imgData.data; Filters._premultiply(data); for (var i = 0; i < iterations; i++) { - Filters._boxBlurHorizontal(data, mask, canvas.width, canvas.height, Math.floor(hRadius / 2),maskType); - Filters._boxBlurVertical(data, mask, canvas.width, canvas.height, Math.floor(vRadius / 2),maskType); + Filters._boxBlurHorizontal(data, mask, canvas.width, canvas.height, Math.floor(hRadius / 2), maskType); + Filters._boxBlurVertical(data, mask, canvas.width, canvas.height, Math.floor(vRadius / 2), maskType); } Filters._unpremultiply(data); @@ -259,7 +259,7 @@ Filters.gradientGlow = function(srcCanvas, src, blurX, blurY, angle, distance, c var angleRad = angle / 180 * Math.PI; var moveX = (distance * Math.cos(angleRad)); var moveY = (distance * Math.sin(angleRad)); - var srcPixels = src.getImageData(0, 0, width, height).data; + var srcPixels = src.getImageData(0, 0, width, height).data; var shadow = []; for (var i = 0; i < srcPixels.length; i += 4) { var alpha = srcPixels[i + 3]; @@ -288,7 +288,7 @@ Filters.gradientGlow = function(srcCanvas, src, blurX, blurY, angle, distance, c if (maskType != 0) { for (var i = 0; i < srcPixels.length; i += 4) { - if ((maskType == 1 && srcPixels[i + 3] == 0)||(maskType == 2 && srcPixels[i+3]==255)) { + if ((maskType == 1 && srcPixels[i + 3] == 0) || (maskType == 2 && srcPixels[i + 3] == 255)) { shadow[i] = 0; shadow[i + 1] = 0; shadow[i + 2] = 0; @@ -351,7 +351,7 @@ Filters.dropShadow = function(canvas, src, blurX, blurY, angle, distance, color, var retCanvas = createCanvas(canvas.width, canvas.height); Filters._setRGB(retCanvas.getContext("2d"), 0, 0, width, height, shadow); if (blurX > 0 || blurY > 0) { - retCanvas = Filters.blur(retCanvas, retCanvas.getContext("2d"), blurX, blurY, iterations, null,0); + retCanvas = Filters.blur(retCanvas, retCanvas.getContext("2d"), blurX, blurY, iterations, null, 0); } shadow = retCanvas.getContext("2d").getImageData(0, 0, width, height).data; @@ -475,7 +475,7 @@ Filters.gradientBevel = function(canvas, src, colors, ratios, blurX, blurY, stre retc.drawImage(shadowIm, 0, 0); retc.drawImage(hilightIm, 0, 0); - retImg = Filters.blur(retImg, retImg.getContext("2d"), blurX, blurY, iterations, srcPixels,maskType); + retImg = Filters.blur(retImg, retImg.getContext("2d"), blurX, blurY, iterations, srcPixels, maskType); var ret = retImg.getContext("2d").getImageData(0, 0, width, height).data; for (var i = 0; i < srcPixels.length; i += 4) { @@ -756,24 +756,24 @@ BlendModes.blendCanvas = function(src, dst, result, modeIndex) { }; -function concatMatrix(m1,m2) { - var result= [1,0,0,1,0,0]; - var scaleX = 0; - var rotateSkew0 = 1; - var rotateSkew1= 2; - var scaleY = 3; - var translateX = 4; - var translateY = 5; - - result[scaleX] = m2[scaleX] * m1[scaleX] + m2[rotateSkew1] * m1[rotateSkew0]; - result[rotateSkew0] = m2[rotateSkew0] * m1[scaleX] + m2[scaleY] * m1[rotateSkew0]; - result[rotateSkew1] = m2[scaleX] * m1[rotateSkew1] + m2[rotateSkew1] * m1[scaleY]; - result[scaleY] = m2[rotateSkew0] * m1[rotateSkew1] + m2[scaleY] * m1[scaleY]; - result[translateX] = m2[scaleX] * m1[translateX] + m2[rotateSkew1] * m1[translateY] + m2[translateX]; - result[translateY] = m2[rotateSkew0] * m1[translateX] + m2[scaleY] * m1[translateY] + m2[translateY]; +function concatMatrix(m1, m2) { + var result = [1, 0, 0, 1, 0, 0]; + var scaleX = 0; + var rotateSkew0 = 1; + var rotateSkew1 = 2; + var scaleY = 3; + var translateX = 4; + var translateY = 5; - return result; - } + result[scaleX] = m2[scaleX] * m1[scaleX] + m2[rotateSkew1] * m1[rotateSkew0]; + result[rotateSkew0] = m2[rotateSkew0] * m1[scaleX] + m2[scaleY] * m1[rotateSkew0]; + result[rotateSkew1] = m2[scaleX] * m1[rotateSkew1] + m2[rotateSkew1] * m1[scaleY]; + result[scaleY] = m2[rotateSkew0] * m1[rotateSkew1] + m2[scaleY] * m1[scaleY]; + result[translateX] = m2[scaleX] * m1[translateX] + m2[rotateSkew1] * m1[translateY] + m2[translateX]; + result[translateY] = m2[rotateSkew0] * m1[translateX] + m2[scaleY] * m1[translateY] + m2[translateY]; + + return result; +} var enhanceContext = function(context) { @@ -807,7 +807,7 @@ var enhanceContext = function(context) { super_.translate.call(this, x, y); }, transform: function(a, b, c, d, e, f) { - this._matrix = concatMatrix([a,b,c,d,e,f],this._matrix); + this._matrix = concatMatrix([a, b, c, d, e, f], this._matrix); super_.transform.call(this, a, b, c, d, e, f); }, setTransform: function(a, b, c, d, e, f) { @@ -819,11 +819,11 @@ var enhanceContext = function(context) { }, applyTransforms: function(m) { this.setTransform(m[0], m[1], m[2], m[3], m[4], m[5]) - }, - applyTransformToPoint: function(p){ + }, + applyTransformToPoint: function(p) { var ret = {}; - ret.x = this._matrix[0]*p.x + this._matrix[2]*p.y + this._matrix[4]; - ret.y = this._matrix[1]*p.x + this._matrix[3]*p.y + this._matrix[5]; + ret.x = this._matrix[0] * p.x + this._matrix[2] * p.y + this._matrix[4]; + ret.y = this._matrix[1] * p.x + this._matrix[3] * p.y + this._matrix[5]; return ret; }, __proto__: super_ @@ -971,43 +971,47 @@ function stopDrag(e) { } -function drawMorphPath(ctx, p, ratio, doStroke, scaleMode){ +function drawMorphPath(ctx, p, ratio, doStroke, scaleMode) { var parts = p.split(" "); var len = parts.length; - if(doStroke){ + if (doStroke) { for (var i = 0; i < len; i++) { - switch(parts[i]){ - case '': - break; + switch (parts[i]) { + case '': + break; case 'L': case 'M': case 'Q': break; default: - var k = ctx.applyTransformToPoint({x:parts[i],y:parts[i+2]}); parts[i] = k.x; parts[i+2] = k.y; - k = ctx.applyTransformToPoint({x:parts[i+1],y:parts[i+3]}); parts[i+1] = k.x; parts[i+3] = k.y; - i+=3; + var k = ctx.applyTransformToPoint({x: parts[i], y: parts[i + 2]}); + parts[i] = k.x; + parts[i + 2] = k.y; + k = ctx.applyTransformToPoint({x: parts[i + 1], y: parts[i + 3]}); + parts[i + 1] = k.x; + parts[i + 3] = k.y; + i += 3; } } - - switch(scaleMode){ + + switch (scaleMode) { case "NONE": break; case "NORMAL": - ctx.lineWidth*=20*Math.max(ctx._matrix[0],ctx._matrix[3]); + ctx.lineWidth *= 20 * Math.max(ctx._matrix[0], ctx._matrix[3]); break; case "VERTICAL": - ctx.lineWidth*=20*ctx._matrix[3]; + ctx.lineWidth *= 20 * ctx._matrix[3]; break; case "HORIZONTAL": - ctx.lineWidth*=20*ctx._matrix[0]; + ctx.lineWidth *= 20 * ctx._matrix[0]; break; } - - ctx.save(); - ctx.setTransform(1,0,0,1,0,0); - } - ctx.beginPath(); + + ctx.save(); + ctx.setTransform(1, 0, 0, 1, 0, 0); + } + ctx.beginPath(); var drawCommand = ""; for (var i = 0; i < len; i++) { switch (parts[i]) { @@ -1019,68 +1023,68 @@ function drawMorphPath(ctx, p, ratio, doStroke, scaleMode){ default: switch (drawCommand) { case 'L': - ctx.lineTo(useRatio(parts[i],parts[i+1],ratio), useRatio(parts[i + 2],parts[i + 3],ratio)); + ctx.lineTo(useRatio(parts[i], parts[i + 1], ratio), useRatio(parts[i + 2], parts[i + 3], ratio)); i += 3; break; case 'M': - ctx.moveTo(useRatio(parts[i],parts[i+1],ratio), useRatio(parts[i + 2],parts[i + 3],ratio)); + ctx.moveTo(useRatio(parts[i], parts[i + 1], ratio), useRatio(parts[i + 2], parts[i + 3], ratio)); i += 3; break; case 'Q': - ctx.quadraticCurveTo(useRatio(parts[i],parts[i+1],ratio),useRatio(parts[i+2],parts[i+3],ratio), - useRatio(parts[i+4],parts[i+5],ratio),useRatio(parts[i+6],parts[i+7],ratio)); + ctx.quadraticCurveTo(useRatio(parts[i], parts[i + 1], ratio), useRatio(parts[i + 2], parts[i + 3], ratio), + useRatio(parts[i + 4], parts[i + 5], ratio), useRatio(parts[i + 6], parts[i + 7], ratio)); i += 7; break; } break; } } - if(doStroke){ + if (doStroke) { ctx.stroke(); ctx.restore(); - } + } } -function useRatio(v1,v2,ratio){ - return v1*1+(v2-v1)*ratio/65535; +function useRatio(v1, v2, ratio) { + return v1 * 1 + (v2 - v1) * ratio / 65535; } -function drawPath(ctx, p, doStroke, scaleMode) { +function drawPath(ctx, p, doStroke, scaleMode) { var parts = p.split(" "); var len = parts.length; - if(doStroke){ + if (doStroke) { for (var i = 0; i < len; i++) { - switch(parts[i]){ - case 'L': + switch (parts[i]) { + case 'L': case 'M': case 'Q': break; default: - var k = ctx.applyTransformToPoint({x:parts[i],y:parts[i+1]}); + var k = ctx.applyTransformToPoint({x: parts[i], y: parts[i + 1]}); parts[i] = k.x; - parts[i+1] = k.y; - i++; + parts[i + 1] = k.y; + i++; } } - - switch(scaleMode){ + + switch (scaleMode) { case "NONE": break; case "NORMAL": - ctx.lineWidth*=20*Math.max(ctx._matrix[0],ctx._matrix[3]); + ctx.lineWidth *= 20 * Math.max(ctx._matrix[0], ctx._matrix[3]); break; case "VERTICAL": - ctx.lineWidth*=20*ctx._matrix[3]; + ctx.lineWidth *= 20 * ctx._matrix[3]; break; case "HORIZONTAL": - ctx.lineWidth*=20*ctx._matrix[0]; + ctx.lineWidth *= 20 * ctx._matrix[0]; break; } - - ctx.save(); - ctx.setTransform(1,0,0,1,0,0); - } - ctx.beginPath(); + + ctx.save(); + ctx.setTransform(1, 0, 0, 1, 0, 0); + } + ctx.beginPath(); var drawCommand = ""; for (var i = 0; i < len; i++) { switch (parts[i]) { @@ -1107,8 +1111,8 @@ function drawPath(ctx, p, doStroke, scaleMode) { break; } } - if(doStroke){ + if (doStroke) { ctx.stroke(); ctx.restore(); - } + } } \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index b83c54c3a..4b962c6b8 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -400,7 +400,7 @@ public class CommandLineArgumentParser { } else if (nextParam.equals("-replace")) { parseReplace(args); } else if (nextParam.equals("-as3compiler")) { - ActionScriptParser.compile(null /*?*/, args.remove(), args.remove(),0); + ActionScriptParser.compile(null /*?*/, args.remove(), args.remove(), 0); } else if (nextParam.equals("-help") || nextParam.equals("--help") || nextParam.equals("/?") || nextParam.equals("\\_") /* /? translates as this on windows */) { printHeader(); printCmdLineUsage(); @@ -890,9 +890,9 @@ public class CommandLineArgumentParser { System.out.println("Exporting images..."); new ImageExporter().exportImages(handler, outDir.getAbsolutePath() + File.separator + "images", extags, new ImageExportSettings(ImageExportMode.PNG_JPEG)); System.out.println("Exporting shapes..."); - new ShapeExporter().exportShapes(handler, outDir.getAbsolutePath() + File.separator + "shapes", extags, new ShapeExportSettings(ShapeExportMode.SVG,zoom)); + new ShapeExporter().exportShapes(handler, outDir.getAbsolutePath() + File.separator + "shapes", extags, new ShapeExportSettings(ShapeExportMode.SVG, zoom)); System.out.println("Exporting morphshapes..."); - new MorphShapeExporter().exportMorphShapes(handler, outDir.getAbsolutePath() + File.separator + "morphshapes", extags, new MorphShapeExportSettings(MorphShapeExportMode.SVG,zoom)); + new MorphShapeExporter().exportMorphShapes(handler, outDir.getAbsolutePath() + File.separator + "morphshapes", extags, new MorphShapeExportSettings(MorphShapeExportMode.SVG, zoom)); System.out.println("Exporting scripts..."); exfile.exportActionScript(handler, outDir.getAbsolutePath() + File.separator + "scripts", allExportMode, Configuration.parallelSpeedUp.get()); System.out.println("Exporting movies..."); @@ -921,12 +921,12 @@ public class CommandLineArgumentParser { break; case "shape": { System.out.println("Exporting shapes..."); - new ShapeExporter().exportShapes(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "shapes" : ""), extags, new ShapeExportSettings(enumFromStr(formats.get("shape"), ShapeExportMode.class),zoom)); + new ShapeExporter().exportShapes(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "shapes" : ""), extags, new ShapeExportSettings(enumFromStr(formats.get("shape"), ShapeExportMode.class), zoom)); } break; case "morphshape": { System.out.println("Exporting morphshapes..."); - new MorphShapeExporter().exportMorphShapes(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "morphshapes" : ""), extags, new MorphShapeExportSettings(enumFromStr(formats.get("morphshape"), MorphShapeExportMode.class),zoom)); + new MorphShapeExporter().exportMorphShapes(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "morphshapes" : ""), extags, new MorphShapeExportSettings(enumFromStr(formats.get("morphshape"), MorphShapeExportMode.class), zoom)); } break; case "script": { @@ -965,7 +965,7 @@ public class CommandLineArgumentParser { } } exfile.exportFrames(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "frames" : ""), 0, frames, - new FramesExportSettings(enumFromStr(formats.get("frame"), FramesExportMode.class),zoom)); + new FramesExportSettings(enumFromStr(formats.get("frame"), FramesExportMode.class), zoom)); } break; case "sound": { diff --git a/src/com/jpexs/decompiler/flash/gui/ExportDialog.java b/src/com/jpexs/decompiler/flash/gui/ExportDialog.java index 5d19e490d..b818514be 100644 --- a/src/com/jpexs/decompiler/flash/gui/ExportDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/ExportDialog.java @@ -103,7 +103,7 @@ public class ExportDialog extends AppDialog { FontExportMode.class, MorphShapeExportMode.class }; - + Class[] zoomClasses = { ShapeExportMode.class, TextExportMode.class, @@ -123,11 +123,10 @@ public class ExportDialog extends AppDialog { } return null; } - - public double getZoom(){ - return Double.parseDouble(zoomTextField.getText())/100; + + public double getZoom() { + return Double.parseDouble(zoomTextField.getText()) / 100; } - private void saveConfig() { String cfg = ""; @@ -141,8 +140,8 @@ public class ExportDialog extends AppDialog { } cfg += key; } - Configuration.lastSelectedExportZoom.set(Double.parseDouble(zoomTextField.getText())/100); - Configuration.lastSelectedExportFormats.set(cfg); + Configuration.lastSelectedExportZoom.set(Double.parseDouble(zoomTextField.getText()) / 100); + Configuration.lastSelectedExportFormats.set(cfg); } public ExportDialog(List exportables) { @@ -217,7 +216,7 @@ public class ExportDialog extends AppDialog { if (!exportableExists) { continue; } - if(Arrays.asList(zoomClasses).contains(c)){ + if (Arrays.asList(zoomClasses).contains(c)) { zoomable = true; } JLabel lab = new JLabel(translate(optionNames[i])); @@ -227,20 +226,20 @@ public class ExportDialog extends AppDialog { top += combos[i].getHeight(); } int zoomWidth = 50; - if(zoomable){ - top+=2; + if (zoomable) { + top += 2; JLabel zlab = new JLabel(translate("zoom")); - zlab.setBounds(10, top+4, zlab.getPreferredSize().width, zlab.getPreferredSize().height); + zlab.setBounds(10, top + 4, zlab.getPreferredSize().width, zlab.getPreferredSize().height); zoomTextField.setBounds(10 + labWidth + 10, top, zoomWidth, zoomTextField.getPreferredSize().height); JLabel pctLabel = new JLabel(translate("zoom.percent")); - pctLabel.setBounds(10 + labWidth + 10 + zoomWidth + 5, top+4, 20, pctLabel.getPreferredSize().height); - + pctLabel.setBounds(10 + labWidth + 10 + zoomWidth + 5, top + 4, 20, pctLabel.getPreferredSize().height); + comboPanel.add(zlab); comboPanel.add(zoomTextField); comboPanel.add(pctLabel); - top+=zoomTextField.getHeight(); + top += zoomTextField.getHeight(); } - + Dimension dim = new Dimension(10 + labWidth + 10 + comboWidth + 10, top + 10); comboPanel.setMinimumSize(dim); comboPanel.setPreferredSize(dim); @@ -251,10 +250,10 @@ public class ExportDialog extends AppDialog { okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - try{ + try { saveConfig(); - }catch(NumberFormatException nfe){ - JOptionPane.showMessageDialog(ExportDialog.this, translate("zoom.invalid"),AppStrings.translate("error"),JOptionPane.ERROR_MESSAGE); + } catch (NumberFormatException nfe) { + JOptionPane.showMessageDialog(ExportDialog.this, translate("zoom.invalid"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); zoomTextField.requestFocusInWindow(); return; } @@ -280,9 +279,9 @@ public class ExportDialog extends AppDialog { View.setWindowIcon(this); getRootPane().setDefaultButton(okButton); setModal(true); - String pct = ""+Configuration.lastSelectedExportZoom.get()*100; - if(pct.endsWith(".0")){ - pct = pct.substring(0,pct.length()-2); + String pct = "" + Configuration.lastSelectedExportZoom.get() * 100; + if (pct.endsWith(".0")) { + pct = pct.substring(0, pct.length() - 2); } zoomTextField.setText(pct); } diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index 06b4456c8..a483484af 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -68,8 +68,6 @@ import javax.swing.JPanel; public final class ImagePanel extends JPanel implements ActionListener, MediaDisplay { - - private Timelined timelined; private boolean stillFrame = false; private Timer timer; @@ -85,7 +83,6 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis private int time = 0; private int selectedDepth = -1; private double zoom = 1.0; - public void selectDepth(int depth) { if (depth != selectedDepth) { @@ -311,7 +308,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis iconPanel = new IconPanel(); //labelPan.add(label, new GridBagConstraints()); - add(iconPanel, BorderLayout.CENTER); + add(iconPanel, BorderLayout.CENTER); add(debugLabel, BorderLayout.NORTH); iconPanel.addMouseListener(new MouseAdapter() { @@ -393,16 +390,14 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis } @Override - public void zoom(double zoom){ + public void zoom(double zoom) { this.zoom = zoom; drawFrame(); } - - @Override public void actionPerformed(ActionEvent e) { - + } @Override @@ -410,8 +405,6 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis return iconPanel.getLastImage(); } - - @Override public void zoomToFit() { if (timelined instanceof BoundedTag) { @@ -432,7 +425,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis w = w2; } zoom = (double) w / (double) w1; - } + } } public void setImage(byte[] data) { @@ -452,10 +445,8 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis @Override public boolean zoomAvailable() { - return timelined!=null; + return timelined != null; } - - public synchronized void setTimelined(final Timelined drawable, final SWF swf, int frame) { pause(); @@ -764,6 +755,5 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis public double getZoom() { return zoom; } - - + } diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 94995061f..dfbd1ad7a 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -1090,9 +1090,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec ret.addAll(new ImageExporter().exportImages(handler, selFile + File.separator + "images", images, new ImageExportSettings(export.getValue(ImageExportMode.class)))); ret.addAll(new ShapeExporter().exportShapes(handler, selFile + File.separator + "shapes", shapes, - new ShapeExportSettings(export.getValue(ShapeExportMode.class),export.getZoom()))); + new ShapeExportSettings(export.getValue(ShapeExportMode.class), export.getZoom()))); ret.addAll(new MorphShapeExporter().exportMorphShapes(handler, selFile + File.separator + "morphshapes", morphshapes, - new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class),export.getZoom()))); + new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class), export.getZoom()))); ret.addAll(new TextExporter().exportTexts(handler, selFile + File.separator + "texts", texts, new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get(), export.getZoom()))); ret.addAll(new MovieExporter().exportMovies(handler, selFile + File.separator + "movies", movies, @@ -1106,7 +1106,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec for (Entry> entry : frames.entrySet()) { ret.addAll(swf.exportFrames(handler, selFile + File.separator + "frames", entry.getKey(), entry.getValue(), - new FramesExportSettings(export.getValue(FramesExportMode.class),export.getZoom()))); + new FramesExportSettings(export.getValue(FramesExportMode.class), export.getZoom()))); } List abcList = swf.abcList; if (abcPanel != null) { @@ -1675,11 +1675,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec swf.exportImages(errorHandler, selFile + File.separator + "images", new ImageExportSettings(export.getValue(ImageExportMode.class))); swf.exportShapes(errorHandler, selFile + File.separator + "shapes", - new ShapeExportSettings(export.getValue(ShapeExportMode.class),export.getZoom())); + new ShapeExportSettings(export.getValue(ShapeExportMode.class), export.getZoom())); swf.exportMorphShapes(errorHandler, selFile + File.separator + "morphshapes", - new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class),export.getZoom())); + new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class), export.getZoom())); swf.exportTexts(errorHandler, selFile + File.separator + "texts", - new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get(),export.getZoom())); + new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get(), export.getZoom())); swf.exportMovies(errorHandler, selFile + File.separator + "movies", new MovieExportSettings(export.getValue(MovieExportMode.class))); swf.exportSounds(errorHandler, selFile + File.separator + "sounds", @@ -1689,11 +1689,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec swf.exportFonts(errorHandler, selFile + File.separator + "fonts", new FontExportSettings(export.getValue(FontExportMode.class))); swf.exportFrames(errorHandler, selFile + File.separator + "frames", 0, null, - new FramesExportSettings(export.getValue(FramesExportMode.class),export.getZoom())); + new FramesExportSettings(export.getValue(FramesExportMode.class), export.getZoom())); for (CharacterTag c : swf.characters.values()) { if (c instanceof DefineSpriteTag) { swf.exportFrames(errorHandler, selFile + File.separator + "frames", c.getCharacterId(), null, - new FramesExportSettings(export.getValue(FramesExportMode.class),export.getZoom())); + new FramesExportSettings(export.getValue(FramesExportMode.class), export.getZoom())); } } swf.exportActionScript(errorHandler, selFile, exportMode, Configuration.parallelSpeedUp.get()); diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewImage.java b/src/com/jpexs/decompiler/flash/gui/PreviewImage.java index b08a851e8..a8ccd1ecd 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewImage.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewImage.java @@ -176,7 +176,7 @@ public class PreviewImage extends JPanel { if (treeItem instanceof FrameNodeItem) { FrameNodeItem fn = (FrameNodeItem) treeItem; RECT rect = swf.displayRect; - imgSrc = SWF.frameToImageGet(swf.getTimeline(), fn.getFrame() - 1, 0, null, 0, rect, new Matrix(), new ColorTransform(), null, true,1.0); + imgSrc = SWF.frameToImageGet(swf.getTimeline(), fn.getFrame() - 1, 0, null, 0, rect, new Matrix(), new ColorTransform(), null, true, 1.0); width = (imgSrc.getWidth()); height = (imgSrc.getHeight()); } else if (treeItem instanceof ImageTag) { diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 8ecb7968a..b41efc119 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -269,16 +269,15 @@ public class PreviewPanel extends JSplitPane implements ActionListener { flashPlayPanel.add(flashPanel, BorderLayout.CENTER); /*JPanel bottomPanel = new JPanel(new BorderLayout()); - JPanel buttonsPanel = new JPanel(new FlowLayout()); - JButton selectColorButton = new JButton(View.getIcon("color16")); - selectColorButton.addActionListener(mainPanel); - selectColorButton.setActionCommand(MainPanel.ACTION_SELECT_BKCOLOR); - selectColorButton.setToolTipText(AppStrings.translate("button.selectbkcolor.hint")); - buttonsPanel.add(selectColorButton); - bottomPanel.add(buttonsPanel, BorderLayout.EAST); - - flashPlayPanel.add(bottomPanel, BorderLayout.SOUTH);*/ + JPanel buttonsPanel = new JPanel(new FlowLayout()); + JButton selectColorButton = new JButton(View.getIcon("color16")); + selectColorButton.addActionListener(mainPanel); + selectColorButton.setActionCommand(MainPanel.ACTION_SELECT_BKCOLOR); + selectColorButton.setToolTipText(AppStrings.translate("button.selectbkcolor.hint")); + buttonsPanel.add(selectColorButton); + bottomPanel.add(buttonsPanel, BorderLayout.EAST); + flashPlayPanel.add(bottomPanel, BorderLayout.SOUTH);*/ JPanel flashPlayPanel2 = new JPanel(new BorderLayout()); flashPlayPanel2.add(flashPlayPanel, BorderLayout.CENTER); flashPlayPanel2.add(new PlayerControls(flashPanel), BorderLayout.SOUTH); diff --git a/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java b/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java index 54d22e73c..a74e13159 100644 --- a/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java +++ b/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java @@ -198,7 +198,7 @@ public class SoundTagPlayer implements MediaDisplay { @Override public void zoom(double zoom) { - + } @Override @@ -214,11 +214,7 @@ public class SoundTagPlayer implements MediaDisplay { public double getZoom() { return 0; } - - - - @Override public synchronized void gotoFrame(int frame) { pause(); @@ -249,7 +245,5 @@ public class SoundTagPlayer implements MediaDisplay { public BufferedImage printScreen() { return null; } - - } diff --git a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java index 24ba7ee38..ab8889f63 100644 --- a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java @@ -84,13 +84,13 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { private static final int CMD_SETVARIABLE = 13; private static final int CMD_CHECKCLICK = 14; private static final int CMD_ZOOM = 15; - + private static final int PIPE_TIMEOUT_MS = 1000; private int frameRate; public boolean specialPlayback = false; private boolean specialPlaying = false; private JPopupMenu rightClickMenu = null; - + private Timer rightClickTimer; @Override @@ -102,8 +102,6 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { public boolean zoomAvailable() { return true; } - - @Override public void zoomToFit() { @@ -115,37 +113,31 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { return 0; } - - - - - - - private synchronized int checkClick(Point ret) throws IOException{ - if(pipe!=null){ + private synchronized int checkClick(Point ret) throws IOException { + if (pipe != null) { writeToPipe(new byte[]{CMD_CHECKCLICK}); byte res[] = new byte[1]; readFromPipe(res); int button = res[0]; - if(button>0){ + if (button > 0) { res = new byte[4]; readFromPipe(res); ret.x = ((res[0] & 0xff) << 8) + (res[1] & 0xff); - ret.y = ((res[2] & 0xff) << 8) + (res[3] & 0xff); + ret.y = ((res[2] & 0xff) << 8) + (res[3] & 0xff); } return button; } return 0; } - + private double zoom = 1.0; - + @Override - public synchronized void zoom(double zoom){ - if(pipe!=null){ + public synchronized void zoom(double zoom) { + if (pipe != null) { try { - long zoomint = Math.round(100/(zoom/this.zoom)); - if(zoom==1.0){ + long zoomint = Math.round(100 / (zoom / this.zoom)); + if (zoom == 1.0) { zoomint = 0; } this.zoom = zoom; @@ -156,7 +148,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { } } } - + public synchronized String getVariable(String name) throws IOException { if (pipe != null) { writeToPipe(new byte[]{CMD_GETVARIABLE}); @@ -261,21 +253,21 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { public synchronized void setBackground(Color color) { try { writeToPipe(new byte[]{CMD_BGCOLOR}); - writeToPipe(new byte[]{(byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()}); - } catch (IOException ex) { + writeToPipe(new byte[]{(byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()}); + } catch (IOException ex) { } - + } - public void setRightClickMenu(JPopupMenu menu){ + public void setRightClickMenu(JPopupMenu menu) { rightClickMenu = menu; } - + public FlashPlayerPanel(Component frame) { if (!Platform.isWindows()) { throw new FlashUnsupportedException(); } - this.frame = frame; + this.frame = frame; //this.add(rightClickMenu); addComponentListener(new ComponentListener() { @Override @@ -349,7 +341,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { } public synchronized void stopSWF() { - if(rightClickTimer!=null){ + if (rightClickTimer != null) { rightClickTimer.cancel(); rightClickTimer = null; } @@ -362,17 +354,15 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { } @Override - public BufferedImage printScreen() { + public BufferedImage printScreen() { Point screenloc = getLocationOnScreen(); - try { + try { return new Robot().createScreenCapture(new Rectangle(screenloc.x, screenloc.y, getWidth(), getHeight())); } catch (AWTException ex) { return null; } } - - public synchronized void displaySWF(String flash, Color bgColor, int frameRate) { try { zoom = 1.0; @@ -395,8 +385,8 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { if (specialPlayback) { play(); } - if(rightClickTimer!=null){ - rightClickTimer.cancel(); + if (rightClickTimer != null) { + rightClickTimer.cancel(); } rightClickTimer = new Timer(); rightClickTimer.schedule(new TimerTask() { @@ -410,30 +400,30 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { @Override public void run() { - if(rightClickMenu!=null){ - if(button == 2){ + if (rightClickMenu != null) { + if (button == 2) { ShadowPopupFactory.uninstall(); rightClickMenu.show(FlashPlayerPanel.this, pt.x, pt.y); ShadowPopupFactory.install(); } - if(button == 1){ + if (button == 1) { rightClickMenu.setVisible(false); } } } - }); + }); } catch (IOException ex) { //ignore } } - }, 100,100); + }, 100, 100); } catch (IOException ex) { } } @Override public void close() throws IOException { - if(rightClickTimer!=null){ + if (rightClickTimer != null) { rightClickTimer.cancel(); rightClickTimer = null; } diff --git a/src/com/jpexs/decompiler/flash/gui/player/MediaDisplay.java b/src/com/jpexs/decompiler/flash/gui/player/MediaDisplay.java index 941d70e9a..c56c7e547 100644 --- a/src/com/jpexs/decompiler/flash/gui/player/MediaDisplay.java +++ b/src/com/jpexs/decompiler/flash/gui/player/MediaDisplay.java @@ -28,7 +28,7 @@ public interface MediaDisplay { public int getCurrentFrame(); public int getTotalFrames(); - + public void zoom(double zoom); public void pause(); @@ -46,14 +46,14 @@ public interface MediaDisplay { public int getFrameRate(); public boolean isLoaded(); - + public BufferedImage printScreen(); - + public boolean screenAvailable(); - + public boolean zoomAvailable(); - + public void zoomToFit(); - + public double getZoom(); } diff --git a/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java b/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java index 6221bf9c9..7e8d4a149 100644 --- a/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java +++ b/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java @@ -71,22 +71,22 @@ public class PlayerControls extends JPanel implements ActionListener { private final JLabel totalTimeLabel; private static final Icon pauseIcon = View.getIcon("pause16"); private static final Icon playIcon = View.getIcon("play16"); - + private final JLabel percentLabel = new JLabel("100%"); - private final JPanel zoomPanel; + private final JPanel zoomPanel; private final JPanel graphicControls; - private final JPanel playbackControls; + private final JPanel playbackControls; private double realZoom = 1.0; - + private final JButton zoomFitButton; - + public static final int ZOOM_DECADE_STEPS = 10; public static final double ZOOM_MULTIPLIER = Math.pow(10, 1.0 / ZOOM_DECADE_STEPS); - + public PlayerControls(MediaDisplay display) { - + setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - + graphicControls = new JPanel(new BorderLayout()); JPanel graphicButtonsPanel = new JPanel(new FlowLayout()); JButton selectColorButton = new JButton(View.getIcon("color16")); @@ -118,10 +118,10 @@ public class PlayerControls extends JPanel implements ActionListener { snapshotButton.addActionListener(this); snapshotButton.setActionCommand(ACTION_SNAPSHOT); snapshotButton.setToolTipText(AppStrings.translate("button.snapshot.hint")); - + zoomPanel = new JPanel(new FlowLayout()); //updateZoom(); - zoomPanel.add(percentLabel); + zoomPanel.add(percentLabel); zoomPanel.add(zoomInButton); zoomPanel.add(zoomOutButton); zoomPanel.add(zoomNoneButton); @@ -129,12 +129,12 @@ public class PlayerControls extends JPanel implements ActionListener { zoomPanel.add(selectColorButton); graphicButtonsPanel.add(zoomPanel); graphicButtonsPanel.add(snapshotButton); - graphicControls.add(graphicButtonsPanel,BorderLayout.EAST); - + graphicControls.add(graphicButtonsPanel, BorderLayout.EAST); + add(graphicControls); graphicControls.setVisible(display.screenAvailable()); - - playbackControls = new JPanel(); + + playbackControls = new JPanel(); this.display = display; JPanel controlPanel = new JPanel(new BorderLayout()); timeLabel = new JLabel("00:00.00"); @@ -213,10 +213,10 @@ public class PlayerControls extends JPanel implements ActionListener { View.execInEventDispatch(new Runnable() { @Override - public void run() { + public void run() { double zoom = display.getZoom(); - zoomFitButton.setVisible(zoom!=0.0); - percentLabel.setVisible(zoom!=0.0); + zoomFitButton.setVisible(zoom != 0.0); + percentLabel.setVisible(zoom != 0.0); zoomPanel.setVisible(display.zoomAvailable()); graphicControls.setVisible(display.screenAvailable()); int totalFrames = display.getTotalFrames(); @@ -265,7 +265,7 @@ public class PlayerControls extends JPanel implements ActionListener { BigDecimal bd = new BigDecimal(String.valueOf(realZoom)).setScale(lg, BigDecimal.ROUND_HALF_UP); return bd.doubleValue(); } - + private void updateZoom() { double pctzoom = roundZoom(realZoom * 100, 3); String r = "" + pctzoom; @@ -276,7 +276,7 @@ public class PlayerControls extends JPanel implements ActionListener { percentLabel.setText("" + r + "%"); display.zoom(zoom); } - + @Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { @@ -291,14 +291,14 @@ public class PlayerControls extends JPanel implements ActionListener { display.pause(); display.rewind(); break; - case ACTION_SELECT_BKCOLOR: + case ACTION_SELECT_BKCOLOR: View.execInEventDispatch(new Runnable() { @Override public void run() { Color newColor = JColorChooser.showDialog(null, AppStrings.translate("dialog.selectbkcolor.title"), View.swfBackgroundColor); if (newColor != null) { View.swfBackgroundColor = newColor; - display.setBackground(newColor); + display.setBackground(newColor); } } }); @@ -322,10 +322,9 @@ public class PlayerControls extends JPanel implements ActionListener { case ACTION_SNAPSHOT: putImageToClipBoard(display.printScreen()); break; - } + } } - - + private class TransferableImage implements Transferable { Image img; @@ -363,7 +362,7 @@ public class PlayerControls extends JPanel implements ActionListener { return false; } } - + private void putImageToClipBoard(BufferedImage img) { if (img == null) { return;