From f219b493721316bfbbe5a8872853bcb09423d24b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 8 Aug 2024 13:41:09 +0200 Subject: [PATCH] More documentation. --- .../jpexs/decompiler/flash/AppResources.java | 7 + .../decompiler/flash/ApplicationInfo.java | 7 + .../jpexs/decompiler/flash/BaseLocalData.java | 6 + .../decompiler/flash/BinarySWFBundle.java | 2 +- .../com/jpexs/decompiler/flash/Bundle.java | 6 +- .../jpexs/decompiler/flash/abc/ClassPath.java | 11 - .../decompiler/flash/abc/avm2/AVM2Code.java | 61 +- .../flash/abc/avm2/AVM2ConstantPool.java | 7 +- .../flash/abc/avm2/AVM2Runtime.java | 9 +- .../deobfuscation/AVM2DeobfuscatorGetSet.java | 15 +- .../AVM2DeobfuscatorGroupParts.java | 10 +- .../deobfuscation/AVM2DeobfuscatorJumps.java | 9 +- .../AVM2DeobfuscatorRegisters.java | 16 +- .../AVM2DeobfuscatorRegistersOld.java | 14 +- .../deobfuscation/AVM2DeobfuscatorSimple.java | 13 +- .../AVM2DeobfuscatorSimpleOld.java | 14 +- .../AVM2DeobfuscatorZeroJumpsNullPushes.java | 15 +- .../exceptions/AVM2ExecutionException.java | 2 +- .../avm2/fastavm2/AVM2InstructionItem.java | 2 +- .../flash/abc/avm2/graph/AVM2Graph.java | 30 +- .../flash/abc/avm2/graph/AVM2GraphSource.java | 2 +- .../avm2/instructions/AVM2Instruction.java | 2 +- .../instructions/AVM2InstructionFlag.java | 24 + .../avm2/instructions/AVM2Instructions.java | 637 ++++++++++++++++++ .../instructions/alchemy/AlchemyTypeIns.java | 3 + .../avm2/instructions/types/CoerceAIns.java | 4 + .../abc/avm2/model/ApplyTypeAVM2Item.java | 6 + .../abc/avm2/parser/pcode/ASM3Parser.java | 59 ++ .../abc/avm2/parser/pcode/ParsedSymbol.java | 314 +++++++++ .../parser/script/AVM2SourceGenerator.java | 403 +++++++++++ .../parser/script/AssignableAVM2Item.java | 93 +++ .../abc/avm2/parser/script/BreakJumpIns.java | 8 + .../abc/avm2/parser/script/CallAVM2Item.java | 31 + .../abc/avm2/parser/script/ClassAVM2Item.java | 67 ++ .../abc/avm2/parser/script/ConstAVM2Item.java | 40 ++ .../script/ConstructSomethingAVM2Item.java | 11 + .../avm2/parser/script/ContinueJumpIns.java | 11 + .../script/ExceptionMarkAVM2Instruction.java | 11 + .../avm2/parser/script/ExceptionMarkIns.java | 4 + .../avm2/parser/script/FinallyJumpIns.java | 11 + .../avm2/parser/script/FunctionAVM2Item.java | 64 +- .../avm2/parser/script/GetterAVM2Item.java | 24 + .../parser/script/ImportedSlotConstItem.java | 15 + .../abc/avm2/parser/script/IndexAVM2Item.java | 32 + .../avm2/parser/script/InterfaceAVM2Item.java | 35 + .../abc/avm2/parser/script/LexBufferer.java | 7 + .../abc/avm2/parser/script/LexListener.java | 8 + .../avm2/parser/script/MethodAVM2Item.java | 48 +- .../abc/avm2/parser/script/NameAVM2Item.java | 108 +++ .../abc/avm2/parser/script/NamespaceItem.java | 56 ++ .../parser/script/NamespacedAVM2Item.java | 40 ++ .../avm2/parser/script/PackageAVM2Item.java | 15 + .../abc/avm2/parser/script/ParsedSymbol.java | 25 + .../avm2/parser/script/PropertyAVM2Item.java | 69 ++ .../avm2/parser/script/SetterAVM2Item.java | 24 + .../abc/avm2/parser/script/SlotAVM2Item.java | 36 + .../abc/avm2/parser/script/SymbolGroup.java | 43 +- .../abc/avm2/parser/script/SymbolType.java | 490 ++++++++++++-- .../parser/script/UnresolvedAVM2Item.java | 131 +++- .../abc/avm2/parser/script/XMLAVM2Item.java | 4 + .../avm2/parser/script/XMLFilterAVM2Item.java | 12 + .../methodinfoparser/MethodInfoParser.java | 23 + .../abc/methodinfoparser/ParsedSymbol.java | 82 +++ .../multinames/ClassNameMultinameUsage.java | 7 + .../multinames/ConstVarMultinameUsage.java | 11 + .../ConstVarNameMultinameUsage.java | 11 + .../ConstVarTypeMultinameUsage.java | 11 + .../multinames/MethodBodyMultinameUsage.java | 12 + .../multinames/MethodMultinameUsage.java | 20 + .../multinames/MethodNameMultinameUsage.java | 12 + .../MethodParamsMultinameUsage.java | 12 + .../MethodReturnTypeMultinameUsage.java | 12 + .../abc/usages/multinames/MultinameUsage.java | 29 + .../multinames/SuperClassMultinameUsage.java | 10 + .../SuperInterfaceMultinameUsage.java | 10 + .../multinames/TraitMultinameUsage.java | 58 ++ .../multinames/TypeNameMultinameUsage.java | 14 + .../deobfuscation/BrokenScriptDetector.java | 13 + .../action/parser/pcode/ASMParsedSymbol.java | 74 ++ .../flash/action/parser/pcode/ASMParser.java | 32 + .../flash/amf/amf3/Amf3InputStream.java | 105 ++- .../flash/amf/amf3/Amf3OutputStream.java | 68 ++ .../decompiler/flash/amf/amf3/Amf3Value.java | 22 + .../decompiler/flash/amf/amf3/ListMap.java | 5 + .../decompiler/flash/amf/amf3/ListSet.java | 8 + .../decompiler/flash/amf/amf3/Marker.java | 54 ++ .../amf/amf3/NoSerializerExistsException.java | 17 +- .../decompiler/flash/amf/amf3/Traits.java | 30 + .../amf3/UnsupportedValueTypeException.java | 16 + .../flash/amf/amf3/types/ArrayType.java | 58 ++ .../flash/amf/amf3/types/BasicType.java | 10 +- .../flash/amf/amf3/types/ByteArrayType.java | 8 + .../flash/amf/amf3/types/DateType.java | 16 + .../flash/amf/amf3/types/DictionaryType.java | 16 + .../flash/amf/amf3/types/ObjectType.java | 153 ++++- .../amf/amf3/types/VectorDoubleType.java | 5 + .../flash/amf/amf3/types/VectorIntType.java | 5 + .../amf/amf3/types/VectorObjectType.java | 9 + .../flash/amf/amf3/types/VectorUIntType.java | 5 + .../flash/amf/amf3/types/XmlDocType.java | 12 + .../flash/amf/amf3/types/XmlType.java | 15 + .../decompiler/flash/cache/AS2Cache.java | 44 ++ .../decompiler/flash/cache/AS3Cache.java | 33 + .../flash/configuration/Configuration.java | 6 + .../decompiler/flash/docs/As12PCodeDocs.java | 43 ++ .../decompiler/flash/docs/As3PCodeDocs.java | 53 ++ .../flash/docs/As3PCodeOtherDocs.java | 24 + .../decompiler/flash/docs/ParsedSymbol.java | 40 ++ .../decompiler/flash/ecma/ArrayType.java | 10 + .../decompiler/flash/ecma/EcmaScript.java | 165 +++++ .../jpexs/decompiler/flash/ecma/EcmaType.java | 28 + .../decompiler/flash/ecma/NotCompileTime.java | 6 + .../com/jpexs/decompiler/flash/ecma/Null.java | 6 + .../decompiler/flash/ecma/ObjectType.java | 39 ++ .../decompiler/flash/ecma/Undefined.java | 6 + .../flash/exporters/BinaryDataExporter.java | 29 + .../flash/exporters/BlendModeSetable.java | 4 + .../exporters/amf/amf3/Amf3Exporter.java | 32 +- .../exporters/modes/BinaryDataExportMode.java | 3 + .../exporters/modes/ButtonExportMode.java | 12 + .../flash/exporters/modes/ExeExportMode.java | 17 +- .../exporters/modes/Font4ExportMode.java | 4 +- .../flash/exporters/modes/FontExportMode.java | 6 + .../exporters/modes/FrameExportMode.java | 24 + .../exporters/modes/ImageExportMode.java | 15 + .../exporters/modes/MorphShapeExportMode.java | 19 + .../exporters/modes/MovieExportMode.java | 3 + .../exporters/modes/ScriptExportMode.java | 23 +- .../exporters/modes/ShapeExportMode.java | 15 + .../exporters/modes/SoundExportMode.java | 17 +- .../exporters/modes/SpriteExportMode.java | 24 + .../modes/SymbolClassExportMode.java | 3 + .../flash/exporters/modes/TextExportMode.java | 9 + .../morphshape/CanvasMorphShapeExporter.java | 118 +++- .../exporters/morphshape/CurvedMorphEdge.java | 33 + .../DefaultSVGMorphShapeExporter.java | 36 + .../exporters/morphshape/IMorphEdge.java | 45 ++ .../morphshape/IMorphShapeExporter.java | 115 ++++ .../morphshape/MorphShapeExporterBase.java | 41 ++ .../morphshape/SVGMorphShapeExporter.java | 39 ++ .../morphshape/StraightMorphEdge.java | 43 ++ .../exporters/script/AS2ScriptExporter.java | 29 + .../exporters/script/AS3ScriptExporter.java | 18 + .../flash/exporters/script/Dependency.java | 23 + .../exporters/script/DependencyParser.java | 41 ++ .../exporters/script/DependencyType.java | 17 +- .../flash/exporters/script/DotId.java | 29 + .../exporters/script/ExportPackTask.java | 13 + .../exporters/script/ExportScriptTask.java | 11 + .../exporters/script/LinkReportExporter.java | 14 +- .../script/PcodeGraphVizExporter.java | 20 + .../exporters/script/graphviz/Token.java | 32 + .../exporters/script/graphviz/TokenType.java | 96 ++- .../settings/BinaryDataExportSettings.java | 10 + .../settings/ButtonExportSettings.java | 14 + .../settings/Font4ExportSettings.java | 10 + .../settings/FontExportSettings.java | 10 + .../settings/FrameExportSettings.java | 18 + .../settings/ImageExportSettings.java | 10 + .../settings/MorphShapeExportSettings.java | 18 + .../settings/MovieExportSettings.java | 10 + .../settings/ScriptExportSettings.java | 36 + .../settings/ShapeExportSettings.java | 18 + .../settings/SoundExportSettings.java | 14 + .../settings/SpriteExportSettings.java | 14 + .../settings/SymbolClassExportSettings.java | 10 + .../settings/TextExportSettings.java | 18 + .../flash/exporters/shape/BitmapExporter.java | 22 + .../exporters/shape/CanvasShapeExporter.java | 143 +++- .../flash/exporters/shape/CurvedEdge.java | 19 + .../shape/DefaultSVGShapeExporter.java | 35 + .../flash/exporters/shape/IEdge.java | 38 ++ .../flash/exporters/shape/IShapeExporter.java | 93 +++ .../exporters/shape/MiterClipBasicStroke.java | 4 + .../flash/exporters/shape/PathExporter.java | 28 + .../exporters/shape/SVGShapeExporter.java | 40 ++ .../exporters/shape/ShapeExportData.java | 15 + .../exporters/shape/ShapeExporterBase.java | 19 + .../flash/exporters/shape/StraightEdge.java | 27 + .../exporters/swf/IndentedStringBuilder.java | 16 + .../flash/exporters/swf/SwfFile.java | 10 + .../swf/SwfFlashDevelopExporter.java | 15 + .../swf/SwfIntelliJIdeaExporter.java | 15 + .../flash/exporters/swf/SwfJavaExporter.java | 13 + .../flash/exporters/swf/SwfToExeExporter.java | 11 +- .../flash/exporters/swf/SwfToSwcExporter.java | 23 + .../flash/exporters/swf/SwfXmlExporter.java | 21 + .../flash/flexsdk/MxmlcAs3ScriptReplacer.java | 6 +- .../flash/flexsdk/MxmlcException.java | 8 + .../decompiler/flash/flexsdk/MxmlcRunner.java | 12 + .../jpexs/decompiler/flash/flv/AUDIODATA.java | 75 ++- .../com/jpexs/decompiler/flash/flv/DATA.java | 4 + .../decompiler/flash/flv/FLVInputStream.java | 97 ++- .../decompiler/flash/flv/FLVOutputStream.java | 77 ++- .../jpexs/decompiler/flash/flv/FLVTAG.java | 40 ++ .../decompiler/flash/flv/SCRIPTDATA.java | 35 + .../decompiler/flash/flv/SCRIPTDATADATE.java | 12 + .../flash/flv/SCRIPTDATAOBJECT.java | 11 + .../decompiler/flash/flv/SCRIPTDATAVALUE.java | 19 + .../flash/flv/SCRIPTDATAVARIABLE.java | 11 + .../decompiler/flash/flv/UnparsedDATA.java | 15 + .../jpexs/decompiler/flash/flv/VIDEODATA.java | 36 + .../decompiler/flash/gfx/GfxConvertor.java | 46 ++ .../decompiler/flash/gfx/TgaSupport.java | 3 + .../flash/harman/HarmanBinaryDataEncrypt.java | 22 + .../flash/harman/HarmanSwfEncrypt.java | 87 +++ .../decompiler/flash/helpers/BMPFile.java | 6 + .../flash/helpers/CodeFormatting.java | 102 ++- .../flash/helpers/FileTextWriter.java | 5 + .../decompiler/flash/helpers/FontHelper.java | 42 +- .../jpexs/decompiler/flash/helpers/Freed.java | 8 + .../helpers/GraphSourceItemPosition.java | 12 + .../flash/helpers/GraphTextWriter.java | 208 +++++- .../flash/helpers/HighlightedText.java | 34 + .../flash/helpers/HighlightedTextWriter.java | 29 + .../decompiler/flash/helpers/ImageHelper.java | 44 +- .../decompiler/flash/helpers/LazyObject.java | 3 + .../flash/helpers/LoopWithType.java | 15 + .../decompiler/flash/helpers/NulWriter.java | 29 + .../flash/helpers/SWFDecompilerPlugin.java | 61 ++ .../flash/helpers/StreamTextWriter.java | 5 + .../helpers/StringBuilderTextWriter.java | 5 + .../collections/FixItemCounterStack.java | 16 + .../flash/helpers/collections/MyEntry.java | 6 + .../flash/helpers/collections/MyMap.java | 3 + .../flash/helpers/collections/MySet.java | 3 + .../flash/helpers/hilight/HighlightData.java | 53 ++ .../helpers/hilight/HighlightSpecialType.java | 140 +++- .../flash/helpers/hilight/HighlightType.java | 21 +- .../flash/helpers/hilight/Highlighting.java | 98 ++- .../helpers/hilight/HighlightingList.java | 8 + .../flash/importers/AS2ScriptImporter.java | 23 + .../flash/importers/AS3ScriptImporter.java | 26 + .../importers/As3ScriptReplaceException.java | 16 + .../As3ScriptReplaceExceptionItem.java | 40 ++ .../importers/As3ScriptReplacerFactory.java | 24 + .../importers/As3ScriptReplacerInterface.java | 22 + .../flash/importers/BinaryDataImporter.java | 12 + .../importers/FFDecAs3ScriptReplacer.java | 8 + .../flash/importers/FontImporter.java | 6 + .../flash/importers/ImageImporter.java | 41 +- .../flash/importers/MorphShapeImporter.java | 6 + .../flash/importers/MovieImporter.java | 14 + .../flash/importers/ShapeImporter.java | 57 +- .../flash/importers/SoundImporter.java | 31 + .../flash/importers/SpriteImporter.java | 15 + .../flash/importers/SwfXmlImporter.java | 17 + .../flash/importers/SymbolClassImporter.java | 5 + .../TextImportResizeTextBoundsMode.java | 13 +- .../flash/importers/TextImporter.java | 39 +- .../importers/amf/amf3/Amf3Importer.java | 14 + .../amf/amf3/Amf3ParseException.java | 5 + .../morphshape/MorphShapeGenerator.java | 8 + .../morphshape/ShapeForMorphExporter.java | 25 + .../flash/importers/svg/CubicToQuad.java | 12 +- .../flash/importers/svg/SvgBitmapFill.java | 16 + .../flash/importers/svg/SvgColor.java | 25 + .../flash/importers/svg/SvgFill.java | 11 + .../flash/importers/svg/SvgGradient.java | 22 + .../flash/importers/svg/SvgGradientUnits.java | 10 +- .../flash/importers/svg/SvgImporter.java | 73 +- .../flash/importers/svg/SvgInterpolation.java | 9 +- .../flash/importers/svg/SvgLineCap.java | 13 +- .../flash/importers/svg/SvgLineJoin.java | 13 +- .../importers/svg/SvgLinearGradient.java | 12 + .../flash/importers/svg/SvgPathReader.java | 24 + .../importers/svg/SvgRadialGradient.java | 22 + .../flash/importers/svg/SvgSpreadMethod.java | 15 +- .../flash/importers/svg/SvgStop.java | 11 + .../flash/importers/svg/SvgStyle.java | 82 ++- .../flash/importers/svg/SvgStyleProperty.java | 27 + .../importers/svg/SvgTransparentFill.java | 3 + .../importers/svg/css/CssParseException.java | 7 + .../importers/svg/css/CssParsedSymbol.java | 22 + .../flash/importers/svg/css/CssParser.java | 47 +- .../importers/svg/css/CssSelectorToXPath.java | 13 + .../importers/svg/css/CssSymbolType.java | 84 +++ .../decompiler/flash/math/BezierEdge.java | 125 ++++ .../decompiler/flash/math/BezierUtils.java | 23 + .../decompiler/flash/math/Distances.java | 6 + .../decompiler/flash/math/Intersections.java | 73 ++ .../decompiler/flash/math/Polynomial.java | 32 + .../flash/tags/DefineBitsJPEG2Tag.java | 2 +- .../flash/tags/DefineBitsJPEG3Tag.java | 2 +- .../flash/tags/DefineBitsJPEG4Tag.java | 2 +- .../decompiler/flash/tags/DefineBitsTag.java | 2 +- .../com/jpexs/decompiler/flash/tags/Tag.java | 194 +++++- .../decompiler/flash/tags/base/ASMSource.java | 104 ++- .../flash/tags/base/BinaryDataInterface.java | 73 ++ .../flash/tags/base/ButtonAction.java | 17 +- .../decompiler/flash/tags/base/ButtonTag.java | 36 + .../flash/tags/base/CharacterTag.java | 49 +- .../tags/base/DisplayObjectCacheKey.java | 16 + .../flash/tags/base/FontInfoTag.java | 52 ++ .../decompiler/flash/tags/base/FontTag.java | 280 ++++++++ .../tags/base/HasSeparateAlphaChannel.java | 14 + .../decompiler/flash/tags/base/ImportTag.java | 12 + .../tags/base/MissingCharacterHandler.java | 11 + .../flash/tags/base/MorphShapeTag.java | 88 +++ .../flash/tags/base/PackedBinaryData.java | 10 + .../flash/tags/base/PlaceObjectTypeTag.java | 119 ++++ .../decompiler/flash/tags/base/RemoveTag.java | 7 + .../decompiler/flash/tags/base/ShapeTag.java | 41 ++ .../tags/base/SoundStreamHeadTypeTag.java | 11 + .../decompiler/flash/tags/base/SoundTag.java | 90 +++ .../flash/tags/base/StaticTextTag.java | 47 ++ .../flash/tags/base/SymbolClassTypeTag.java | 11 + .../decompiler/flash/tags/base/TextTag.java | 160 ++++- .../UnsupportedSamplingRateException.java | 13 + .../tags/dynamictext/CharacterWithStyle.java | 6 + .../tags/dynamictext/DynamicTextModel.java | 33 + .../tags/dynamictext/GlyphCharacter.java | 12 + .../flash/tags/dynamictext/Paragraph.java | 31 + .../tags/dynamictext/SameStyleTextRecord.java | 16 + .../flash/tags/dynamictext/TextStyle.java | 33 + .../flash/tags/dynamictext/Word.java | 29 + .../flash/tags/enums/ImageFormat.java | 25 +- .../flash/tags/enums/TextRenderMode.java | 13 +- .../decompiler/flash/timeline/AS2Package.java | 45 +- .../decompiler/flash/timeline/AS3Package.java | 70 +- .../jpexs/decompiler/flash/timeline/Clip.java | 5 + .../decompiler/flash/timeline/DepthState.java | 50 +- .../decompiler/flash/timeline/Timelined.java | 32 +- .../flash/treeitems/AS3ClassTreeItem.java | 11 +- .../flash/types/ALPHABITMAPDATA.java | 10 + .../flash/types/ALPHACOLORMAPDATA.java | 13 + .../jpexs/decompiler/flash/types/ARGB.java | 11 + .../decompiler/flash/types/BITMAPDATA.java | 13 + .../flash/types/BUTTONCONDACTION.java | 28 +- .../decompiler/flash/types/BUTTONRECORD.java | 25 +- .../decompiler/flash/types/BasicType.java | 48 ++ .../decompiler/flash/types/BlendMode.java | 62 ++ .../flash/types/CLIPACTIONRECORD.java | 152 +++-- .../decompiler/flash/types/CLIPACTIONS.java | 13 + .../flash/types/CLIPEVENTFLAGS.java | 52 +- .../decompiler/flash/types/COLORMAPDATA.java | 12 + .../jpexs/decompiler/flash/types/CXFORM.java | 7 + .../flash/types/CXFORMWITHALPHA.java | 14 + .../flash/types/ColorTransform.java | 78 +++ .../types/ConstantColorColorTransform.java | 2 +- .../flash/types/DynamicTextGlyphEntry.java | 6 + .../decompiler/flash/types/FILLSTYLE.java | 69 ++ .../flash/types/FILLSTYLEARRAY.java | 7 + .../decompiler/flash/types/FOCALGRADIENT.java | 3 + .../flash/types/FieldChangeObserver.java | 4 + .../decompiler/flash/types/GLYPHENTRY.java | 6 + .../decompiler/flash/types/GRADIENT.java | 41 ++ .../decompiler/flash/types/GRADRECORD.java | 22 + .../decompiler/flash/types/HasSwfAndTag.java | 6 +- .../decompiler/flash/types/ILINESTYLE.java | 10 +- .../decompiler/flash/types/KERNINGRECORD.java | 24 + .../decompiler/flash/types/LANGCODE.java | 11 + .../decompiler/flash/types/LINESTYLE.java | 10 + .../decompiler/flash/types/LINESTYLE2.java | 73 ++ .../flash/types/LINESTYLEARRAY.java | 10 + .../jpexs/decompiler/flash/types/MATRIX.java | 67 ++ .../flash/types/MORPHFILLSTYLE.java | 64 ++ .../flash/types/MORPHFILLSTYLEARRAY.java | 16 + .../flash/types/MORPHFOCALGRADIENT.java | 6 + .../decompiler/flash/types/MORPHGRADIENT.java | 24 +- .../flash/types/MORPHGRADRECORD.java | 20 + .../flash/types/MORPHLINESTYLE.java | 25 + .../flash/types/MORPHLINESTYLE2.java | 76 +++ .../flash/types/MORPHLINESTYLEARRAY.java | 22 + .../jpexs/decompiler/flash/types/PIX15.java | 9 + .../jpexs/decompiler/flash/types/PIX24.java | 9 + .../jpexs/decompiler/flash/types/RECT.java | 40 ++ .../com/jpexs/decompiler/flash/types/RGB.java | 40 ++ .../jpexs/decompiler/flash/types/RGBA.java | 38 ++ .../jpexs/decompiler/flash/types/SHAPE.java | 47 +- .../flash/types/SHAPEWITHSTYLE.java | 16 + .../decompiler/flash/types/SOUNDENVELOPE.java | 9 + .../decompiler/flash/types/SOUNDINFO.java | 33 + .../decompiler/flash/types/TEXTRECORD.java | 42 ++ .../decompiler/flash/types/ZONEDATA.java | 6 + .../decompiler/flash/types/ZONERECORD.java | 9 + .../parser/AnnotationParseException.java | 6 + .../parser/ConditionEvaluator.java | 13 + .../annotations/parser/ConditionToken.java | 12 + .../parser/ConditionTokenType.java | 18 + .../flash/types/filters/BLURFILTER.java | 6 + .../flash/types/filters/BlendComposite.java | 90 ++- .../flash/types/filters/FILTER.java | 55 ++ .../flash/types/sound/AdpcmDecoder.java | 4 + .../flash/types/sound/SoundDecoder.java | 22 + .../jpexs/decompiler/graph/model/AnyItem.java | 7 + .../src/com/jpexs/helpers/ByteArrayRange.java | 50 ++ .../src/com/jpexs/helpers/Cache.java | 53 ++ .../src/com/jpexs/helpers/Callback.java | 11 + .../com/jpexs/helpers/CancellableWorker.java | 37 + .../com/jpexs/helpers/ConcreteClasses.java | 4 + .../helpers/plugin/ClassFileManager.java | 18 +- .../com/sun/jna/platform/win32/Advapi32.java | 136 ++++ .../sun/jna/platform/win32/Advapi32Util.java | 58 ++ 394 files changed, 13018 insertions(+), 552 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppResources.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppResources.java index 75aed02cb..25da3bd46 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppResources.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppResources.java @@ -30,6 +30,13 @@ public class AppResources { */ private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("com.jpexs.decompiler.flash.locales.AppResources"); + /** + * Constructor. + */ + public AppResources() { + + } + /** * Translates a key * diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ApplicationInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ApplicationInfo.java index d57695e4b..b29ceeacf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ApplicationInfo.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ApplicationInfo.java @@ -131,6 +131,13 @@ public class ApplicationInfo { loadLibraryVersion(); } + /** + * Constructor. + */ + public ApplicationInfo() { + + } + /** * Loads library version */ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/BaseLocalData.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/BaseLocalData.java index 3389bce1d..898c7bb3f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/BaseLocalData.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/BaseLocalData.java @@ -43,4 +43,10 @@ public abstract class BaseLocalData { * Second pass data */ public SecondPassData secondPassData = null; + + /** + * Constructor. + */ + public BaseLocalData() { + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/BinarySWFBundle.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/BinarySWFBundle.java index 0db2225cb..b1d2a6270 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/BinarySWFBundle.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/BinarySWFBundle.java @@ -43,7 +43,7 @@ public class BinarySWFBundle implements Bundle { * @param is Input stream * @param noCheck Do not check * @param searchMode Search mode - * @throws IOException + * @throws IOException On I/O error */ public BinarySWFBundle(InputStream is, boolean noCheck, SearchMode searchMode) throws IOException { search = new SWFSearch(new SwfHeaderStreamSearch(is), noCheck, searchMode); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/Bundle.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/Bundle.java index 8e7386148..4e2237b44 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/Bundle.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/Bundle.java @@ -49,7 +49,7 @@ public interface Bundle { * * @param key Key * @return Openable file - * @throws IOException + * @throws IOException On I/O error */ public SeekableInputStream getOpenable(String key) throws IOException; @@ -57,7 +57,7 @@ public interface Bundle { * Gets all openable files in the bundle. * * @return Map from key to seekable input stream - * @throws IOException + * @throws IOException On I/O error */ public Map getAll() throws IOException; @@ -81,7 +81,7 @@ public interface Bundle { * @param key Key * @param is New input stream * @return True if the file was replaced, false otherwise - * @throws IOException + * @throws IOException On I/O error */ public boolean putOpenable(String key, InputStream is) throws IOException; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java index d00097dc7..faa386091 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java @@ -74,11 +74,6 @@ public class ClassPath implements Serializable { return packageStr.add(className, namespaceSuffix).toRawString(); } - /** - * Hash code - * - * @return Hash code - */ @Override public int hashCode() { int hash = 3; @@ -88,12 +83,6 @@ public class ClassPath implements Serializable { return hash; } - /** - * Equals - * - * @param obj - * @return True if equals - */ @Override public boolean equals(Object obj) { if (this == obj) { 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 ae0477971..634f9607c 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 @@ -913,7 +913,7 @@ public class AVM2Code implements Cloneable { * @param arguments Local registers values * @param constants Constant pool * @return Result of the execution - * @throws AVM2ExecutionException + * @throws AVM2ExecutionException On execution error */ public Object execute(HashMap arguments, AVM2ConstantPool constants) throws AVM2ExecutionException { return execute(arguments, constants, null); @@ -926,7 +926,7 @@ public class AVM2Code implements Cloneable { * @param constants Constant pool * @param runtimeInfo Runtime information * @return Result of the execution - * @throws AVM2ExecutionException + * @throws AVM2ExecutionException On execution error */ public Object execute(HashMap arguments, AVM2ConstantPool constants, AVM2RuntimeInfo runtimeInfo) throws AVM2ExecutionException { int pos = 0; @@ -1095,7 +1095,7 @@ public class AVM2Code implements Cloneable { * * @param ais ABC input stream * @param body Method body - * @throws IOException + * @throws IOException On I/O error */ public AVM2Code(ABCInputStream ais, MethodBody body) throws IOException { Map codeMap = new HashMap<>(); @@ -1632,7 +1632,7 @@ public class AVM2Code implements Cloneable { * * @param address Address * @return Instruction or null if not found - * @throws ConvertException + * @throws ConvertException On convert error */ public AVM2Instruction adr2ins(long address) throws ConvertException { int pos = adr2pos(address, false); @@ -1649,7 +1649,7 @@ public class AVM2Code implements Cloneable { * * @param address Address * @return Position - * @throws ConvertException + * @throws ConvertException On convert error */ public int adr2pos(long address) throws ConvertException { return adr2pos(address, false); @@ -1661,7 +1661,7 @@ public class AVM2Code implements Cloneable { * @param address Address * @param nearest Whether to find nearest position * @return Position - * @throws ConvertException + * @throws ConvertException On convert error */ public int adr2pos(long address, boolean nearest) throws ConvertException { int ret = adr2posNoEx(address); @@ -1809,12 +1809,43 @@ public class AVM2Code implements Cloneable { * * @param addr Current address * @return New address - * @throws ConvertException + * @throws ConvertException On convert error */ public long getAddrThroughJumpAndDebugLine(long addr) throws ConvertException { return pos2adr(getIpThroughJumpAndDebugLine(adr2pos(addr, true))); } + /** + * Converts to source output. + * @param switchParts Switch parts + * @param callStack Call stack + * @param abcIndex ABC indexing + * @param setLocalPosToGetLocalPos Set local position to get local position + * @param thisHasDefaultToPrimitive Whether this has default to primitive + * @param lineStartItem Line start item + * @param path Path + * @param part Part + * @param processJumps Whether to process jumps + * @param isStatic Whether is static + * @param scriptIndex Script index + * @param classIndex Class index + * @param localRegs Local registers + * @param stack Stack + * @param scopeStack Scope stack + * @param localScopeStack Local scope stack + * @param abc ABC + * @param body Method body + * @param start Start + * @param end End + * @param localRegNames Local register names + * @param localRegTypes Local register types + * @param fullyQualifiedNames Fully qualified names + * @param visited Visited + * @param localRegAssigmentIps Local register assignment IPs + * @return Convert output + * @throws ConvertException On convert error + * @throws InterruptedException On interrupt + */ public ConvertOutput toSourceOutput(Set switchParts, List callStack, AbcIndexing abcIndex, Map> setLocalPosToGetLocalPos, boolean thisHasDefaultToPrimitive, Reference lineStartItem, String path, GraphPart part, boolean processJumps, boolean isStatic, int scriptIndex, int classIndex, HashMap localRegs, TranslateStack stack, ScopeStack scopeStack, ScopeStack localScopeStack, ABC abc, MethodBody body, int start, int end, HashMap localRegNames, HashMap localRegTypes, List fullyQualifiedNames, boolean[] visited, HashMap localRegAssigmentIps) throws ConvertException, InterruptedException { boolean debugMode = DEBUG_MODE; if (debugMode) { @@ -2474,7 +2505,7 @@ public class AVM2Code implements Cloneable { * @param staticOperation Static operation * @param localRegAssigmentIps Local register assignment IPs * @return List of GraphTargetItems - * @throws InterruptedException + * @throws InterruptedException On interrupt */ public List toGraphTargetItems(List callStack, AbcIndexing abcIndex, boolean thisHasDefaultToPrimitive, ConvertData convertData, String path, int methodIndex, boolean isStatic, int scriptIndex, int classIndex, ABC abc, MethodBody body, HashMap localRegNames, ScopeStack scopeStack, int initializerType, List fullyQualifiedNames, Traits initTraits, int staticOperation, HashMap localRegAssigmentIps) throws InterruptedException { initToSource(); @@ -2755,7 +2786,7 @@ public class AVM2Code implements Cloneable { * * @param path Path * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ public void fixJumps(final String path, MethodBody body) throws InterruptedException { if (code.isEmpty()) { @@ -3014,7 +3045,7 @@ public class AVM2Code implements Cloneable { * @param isStatic True if static * @param path Path * @return 1 - * @throws InterruptedException + * @throws InterruptedException On interrupt */ public int removeTraps(Trait trait, int methodInfo, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException { SWFDecompilerPlugin.fireAvm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); @@ -3243,7 +3274,7 @@ public class AVM2Code implements Cloneable { * @param ip Position * @param lastIp Last position * @param refs Map from position to list of references - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private void visitCode(int ip, int lastIp, HashMap> refs) throws InterruptedException { Queue toVisit = new LinkedList<>(); @@ -3312,7 +3343,7 @@ public class AVM2Code implements Cloneable { * * @param body Method body * @return Map from position to list of references - * @throws InterruptedException + * @throws InterruptedException On interrupt */ public HashMap> visitCode(MethodBody body) throws InterruptedException { HashMap> refs = new HashMap<>(); @@ -3334,7 +3365,7 @@ public class AVM2Code implements Cloneable { * Remove instructions that are marked as ignored. * * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ public void removeIgnored(MethodBody body) throws InterruptedException { //System.err.println("removing ignored..."); @@ -3352,7 +3383,7 @@ public class AVM2Code implements Cloneable { * * @param body Method body * @return Number of removed instructions - * @throws InterruptedException + * @throws InterruptedException On interrupt */ public int removeDeadCode(MethodBody body) throws InterruptedException { return removeDeadCode(body, new Reference<>(-1)); @@ -3365,7 +3396,7 @@ public class AVM2Code implements Cloneable { * @param minChangedIpRef Minimum changed instruction position (as * reference) * @return Number of removed instructions - * @throws InterruptedException + * @throws InterruptedException On interrupt */ public int removeDeadCode(MethodBody body, Reference minChangedIpRef) throws InterruptedException { HashMap> refs = visitCode(body); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java index f63ec54ed..0f789a56f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java @@ -588,9 +588,9 @@ public class AVM2ConstantPool implements Cloneable { * Converts kind MULTINAME with one namespace to QNAME with that namespace * (must exist in the abc). Ignores others. * - * @param cpool - * @param index MULTINAME index - * @return QNAME index + * @param cpool Constant pool + * @param index Multiname index + * @return QName index */ public int convertToQname(AVM2ConstantPool cpool, int index) { Multiname mx = cpool.getMultiname(index); @@ -859,6 +859,7 @@ public class AVM2ConstantPool implements Cloneable { * @param kind Kind * @param name Name * @param index Sub index + * @param add Whether to add the namespace if it does not exist * @return Namespace id */ public int getNamespaceId(int kind, DottedChain name, int index, boolean add) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Runtime.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Runtime.java index a261c1eb4..efe88978e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Runtime.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Runtime.java @@ -23,5 +23,12 @@ package com.jpexs.decompiler.flash.abc.avm2; */ public enum AVM2Runtime { - UNKNOWN, ADOBE_FLASH + /** + * Unknown + */ + UNKNOWN, + /** + * Adobe Flash + */ + ADOBE_FLASH } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGetSet.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGetSet.java index 26c776712..aca8a6f13 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGetSet.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGetSet.java @@ -36,7 +36,6 @@ import com.jpexs.decompiler.flash.abc.avm2.model.UndefinedAVM2Item; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.helpers.SWFDecompilerAdapter; -import com.jpexs.decompiler.graph.Graph; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.NotCompileTimeItem; import com.jpexs.decompiler.graph.ScopeStack; @@ -70,6 +69,12 @@ public class AVM2DeobfuscatorGetSet extends SWFDecompilerAdapter { */ private final int executionLimit = 30000; + /** + * Constructor. + */ + public AVM2DeobfuscatorGetSet() { + } + /** * Remove obfuscation get sets * @@ -80,7 +85,7 @@ public class AVM2DeobfuscatorGetSet extends SWFDecompilerAdapter { * @param body Method body * @param inlineIns Inline instructions * @return True if removed - * @throws InterruptedException + * @throws InterruptedException On interrupt */ protected boolean removeObfuscationGetSets(int classIndex, boolean isStatic, int scriptIndex, ABC abc, MethodBody body, List inlineIns) throws InterruptedException { AVM2Code code = body.getCode(); @@ -124,7 +129,7 @@ public class AVM2DeobfuscatorGetSet extends SWFDecompilerAdapter { * * @param code AVM2 code * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ protected void removeUnreachableInstructions(AVM2Code code, MethodBody body) throws InterruptedException { code.removeDeadCode(body); @@ -186,7 +191,7 @@ public class AVM2DeobfuscatorGetSet extends SWFDecompilerAdapter { * @param localData AVM2 local data * @param idx Index * @param endIdx End index - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private void executeInstructions(MethodBody body, AVM2Code code, AVM2LocalData localData, int idx, int endIdx) throws InterruptedException { List output = new ArrayList<>(); @@ -283,7 +288,7 @@ public class AVM2DeobfuscatorGetSet extends SWFDecompilerAdapter { * @param trait Trait * @param methodInfo Method info * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGroupParts.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGroupParts.java index 8a497e052..7dcf7aa42 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGroupParts.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorGroupParts.java @@ -36,6 +36,14 @@ import java.util.Map; */ public class AVM2DeobfuscatorGroupParts extends SWFDecompilerAdapter { + /** + * Constructor. + */ + public AVM2DeobfuscatorGroupParts() { + + } + + /* blk_1 jump A @@ -112,7 +120,7 @@ C: blk_4 * @param trait Trait * @param methodInfo Method info * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorJumps.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorJumps.java index bcbabe2d9..f6108c49d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorJumps.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorJumps.java @@ -36,6 +36,13 @@ import java.util.Map; */ public class AVM2DeobfuscatorJumps extends SWFDecompilerAdapter { + /** + * Constructor. + */ + public AVM2DeobfuscatorJumps() { + + } + /** * Removes jumps/ifs targeting other jumps. * @@ -47,7 +54,7 @@ public class AVM2DeobfuscatorJumps extends SWFDecompilerAdapter { * @param trait Trait * @param methodInfo Method info * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java index a835bcbfd..8a38a6ce2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java @@ -63,6 +63,14 @@ import java.util.logging.Logger; */ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple { + + /** + * Constructor. + */ + public AVM2DeobfuscatorRegisters() { + + } + /** * Gets registers used in the code. * @@ -104,7 +112,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple { * @param trait Trait * @param methodInfo Method info * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException { @@ -186,7 +194,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple { * @param trait Trait * @param minfo Method info * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private void replaceSingleUseRegisters(Map singleRegisters, List setInss, int classIndex, boolean isStatic, int scriptIndex, ABC abc, AVM2ConstantPool cpool, Trait trait, MethodInfo minfo, MethodBody body) throws InterruptedException { AVM2Code code = body.getCode(); @@ -224,7 +232,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple { * @param ignoredRegisters Ignored registers * @param ignoredGets Ignored gets * @return first register id - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private int getFirstRegisterSetter(Reference assignment, MethodBody body, ABC abc, Set ignoredRegisters, Set ignoredGets) throws InterruptedException { AVM2Code code = body.getCode(); @@ -250,7 +258,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple { * @param ignored Ignored * @param ignoredGets Ignored gets * @return Register id - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private int visitCode(Reference assignment, Set visited, Stack stack, MethodBody body, ABC abc, AVM2Code code, int idx, int endIdx, Set ignored, Set ignoredGets) throws InterruptedException { LocalDataArea localData = new LocalDataArea(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegistersOld.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegistersOld.java index 6f1f09c56..f77c87098 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegistersOld.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegistersOld.java @@ -60,6 +60,14 @@ import java.util.Set; */ public class AVM2DeobfuscatorRegistersOld extends AVM2DeobfuscatorSimpleOld { + + /** + * Constructor. + */ + public AVM2DeobfuscatorRegistersOld() { + + } + /** * Gets all register ids. * @@ -101,7 +109,7 @@ public class AVM2DeobfuscatorRegistersOld extends AVM2DeobfuscatorSimpleOld { * @param trait Trait * @param methodInfo Method info * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException { @@ -182,7 +190,7 @@ public class AVM2DeobfuscatorRegistersOld extends AVM2DeobfuscatorSimpleOld { * @param ignoredRegisters Ignored registers * @param ignoredGets Ignored gets * @return Register id - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private int getFirstRegisterSetter(Reference assignment, int classIndex, boolean isStatic, int scriptIndex, ABC abc, MethodBody body, Set ignoredRegisters, Set ignoredGets) throws InterruptedException { AVM2Code code = body.getCode(); @@ -257,7 +265,7 @@ public class AVM2DeobfuscatorRegistersOld extends AVM2DeobfuscatorSimpleOld { * @param ignored Ignored * @param ignoredGets Ignored gets * @return Register id - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private int visitCode(Reference assignment, Set visited, TranslateStack stack, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, Set ignored, Set ignoredGets) throws InterruptedException { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java index e48d73833..9c1b686ef 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java @@ -95,6 +95,13 @@ public class AVM2DeobfuscatorSimple extends AVM2DeobfuscatorZeroJumpsNullPushes */ private final int executionLimit = 30000; + /** + * Constructor. + */ + public AVM2DeobfuscatorSimple() { + + } + /** * Removes obfuscation ifs. * @@ -105,7 +112,7 @@ public class AVM2DeobfuscatorSimple extends AVM2DeobfuscatorZeroJumpsNullPushes * @param body Method body * @param inlineIns Inline instruction * @return True if code was modified - * @throws InterruptedException + * @throws InterruptedException On interrupt */ protected boolean removeObfuscationIfs(int classIndex, boolean isStatic, int scriptIndex, ABC abc, MethodBody body, AVM2Instruction inlineIns) throws InterruptedException { AVM2Code code = body.getCode(); @@ -174,7 +181,7 @@ public class AVM2DeobfuscatorSimple extends AVM2DeobfuscatorZeroJumpsNullPushes * @param result Execution result * @param inlineIns Inline instruction * @return True if code was modified - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private boolean executeInstructions(Map staticRegs, MethodBody body, ABC abc, AVM2Code code, LocalDataArea localData, int idx, int endIdx, ExecutionResult result, AVM2Instruction inlineIns) throws InterruptedException { int instructionsProcessed = 0; @@ -398,7 +405,7 @@ public class AVM2DeobfuscatorSimple extends AVM2DeobfuscatorZeroJumpsNullPushes * @param trait Trait * @param methodInfo Method info * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java index 49f3a755b..7b6e5a9dc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java @@ -93,7 +93,6 @@ import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.ecma.Undefined; -import com.jpexs.decompiler.graph.Graph; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.NotCompileTimeItem; import com.jpexs.decompiler.graph.ScopeStack; @@ -130,6 +129,13 @@ public class AVM2DeobfuscatorSimpleOld extends AVM2DeobfuscatorZeroJumpsNullPush */ private final int executionLimit = 30000; + /** + * Constructor. + */ + public AVM2DeobfuscatorSimpleOld() { + + } + /** * Creates a push instruction from a graph target item. * @@ -170,7 +176,7 @@ public class AVM2DeobfuscatorSimpleOld extends AVM2DeobfuscatorZeroJumpsNullPush * @param body Method body * @param inlineIns Inline instructions * @return True if removed, false otherwise - * @throws InterruptedException + * @throws InterruptedException On interrupt */ protected boolean removeObfuscationIfs(int classIndex, boolean isStatic, int scriptIndex, ABC abc, MethodBody body, List inlineIns) throws InterruptedException { AVM2Code code = body.getCode(); @@ -289,7 +295,7 @@ public class AVM2DeobfuscatorSimpleOld extends AVM2DeobfuscatorZeroJumpsNullPush * @param jumpTargets Jump targets * @param minChangedIpRef Minimal changed IP reference * @return True if executed, false otherwise - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private boolean executeInstructions(Set importantOffsets, Map staticRegs, MethodBody body, ABC abc, AVM2Code code, AVM2LocalData localData, int idx, int endIdx, ExecutionResult result, List inlineIns, List jumpTargets, Reference minChangedIpRef) throws InterruptedException { List output = new ArrayList<>(); @@ -611,7 +617,7 @@ public class AVM2DeobfuscatorSimpleOld extends AVM2DeobfuscatorZeroJumpsNullPush * @param trait Trait * @param methodInfo Method info * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorZeroJumpsNullPushes.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorZeroJumpsNullPushes.java index 91d02f334..23898f4b1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorZeroJumpsNullPushes.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorZeroJumpsNullPushes.java @@ -47,13 +47,20 @@ import java.util.Set; */ public class AVM2DeobfuscatorZeroJumpsNullPushes extends SWFDecompilerAdapter { + /** + * Constructor. + */ + public AVM2DeobfuscatorZeroJumpsNullPushes() { + + } + /** * Removes zero jumps from the code. * * @param code AVM2 code * @param body Method body * @return True if any zero jumps were removed - * @throws InterruptedException + * @throws InterruptedException On interrupt */ protected boolean removeZeroJumps(AVM2Code code, MethodBody body) throws InterruptedException { return removeZeroJumps(code, body, new Reference<>(-1)); @@ -67,7 +74,7 @@ public class AVM2DeobfuscatorZeroJumpsNullPushes extends SWFDecompilerAdapter { * @param minChangedIpRef Reference to the minimum changed instruction * pointer * @return True if any zero jumps were removed - * @throws InterruptedException + * @throws InterruptedException On interrupt */ protected boolean removeZeroJumps(AVM2Code code, MethodBody body, Reference minChangedIpRef) throws InterruptedException { boolean result = false; @@ -119,7 +126,7 @@ public class AVM2DeobfuscatorZeroJumpsNullPushes extends SWFDecompilerAdapter { * @param code AVM2 code * @param body Method body * @return True if any null pushes were removed - * @throws InterruptedException + * @throws InterruptedException On interrupt */ protected boolean removeNullPushes(AVM2Code code, MethodBody body) throws InterruptedException { boolean result = false; @@ -180,7 +187,7 @@ public class AVM2DeobfuscatorZeroJumpsNullPushes extends SWFDecompilerAdapter { * @param trait Trait * @param methodInfo Method info * @param body Method body - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2ExecutionException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2ExecutionException.java index da3f41c1e..8a998b463 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2ExecutionException.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/exceptions/AVM2ExecutionException.java @@ -26,7 +26,7 @@ public class AVM2ExecutionException extends Exception { /** * Constructs new AVM2ExecutionException with the specified detail message. * - * @param message + * @param message The detail message */ public AVM2ExecutionException(String message) { super(message); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/fastavm2/AVM2InstructionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/fastavm2/AVM2InstructionItem.java index 2de314a19..edaf9201a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/fastavm2/AVM2InstructionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/fastavm2/AVM2InstructionItem.java @@ -216,7 +216,7 @@ public class AVM2InstructionItem { /** * Set container last instructions. * - * @param lastInstructions + * @param lastInstructions List of instruction items */ public void setContainerLastInstructions(List lastInstructions) { removeContainerLastInstructions(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index 24fc481d0..0b10a85e5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -239,7 +239,7 @@ public class AVM2Graph extends Graph { * @param path Path * @param allParts All parts * @param throwStates Throw states - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override protected void beforeGetLoops(BaseLocalData localData, String path, Set allParts, List throwStates) throws InterruptedException { @@ -276,7 +276,7 @@ public class AVM2Graph extends Graph { * @param localData Local data * @param path Path * @param allParts All parts - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override protected void afterGetLoops(BaseLocalData localData, String path, Set allParts) throws InterruptedException { @@ -288,7 +288,7 @@ public class AVM2Graph extends Graph { * * @param localData Local data * @param allParts All parts - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private void getIgnoredSwitches(AVM2LocalData localData, Set allParts) throws InterruptedException { @@ -736,7 +736,7 @@ public class AVM2Graph extends Graph { * @param localRegAssigmentIps Local register assignment IPs * @param thisHasDefaultToPrimitive This has default to primitive * @return List of graph target items - * @throws InterruptedException + * @throws InterruptedException On interrupt */ public static List translateViaGraph(SecondPassData secondPassData, List callStack, AbcIndexing abcIndex, String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap localRegs, ScopeStack scopeStack, HashMap localRegNames, HashMap localRegTypes, List fullyQualifiedNames, int staticOperation, HashMap localRegAssigmentIps, boolean thisHasDefaultToPrimitive) throws InterruptedException { ScopeStack localScopeStack = new ScopeStack(); @@ -1086,7 +1086,7 @@ public class AVM2Graph extends Graph { * @param path Path * @param recursionLevel Recursion level * @return True if try is found - * @throws InterruptedException + * @throws InterruptedException On interrupt */ private boolean checkTry(List currentRet, List foundGotos, Map> partCodes, Map partCodePos, Set visited, AVM2LocalData localData, GraphPart part, List stopPart, List stopPartKind, List loops, List throwStates, Set allParts, TranslateStack stack, int staticOperation, String path, int recursionLevel) throws InterruptedException { if (localData.parsedExceptions == null) { @@ -1647,7 +1647,7 @@ public class AVM2Graph extends Graph { * @param path Path * @param recursionLevel Recursion level * @return True to stop processing. False to continue. - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override protected boolean checkPartOutput(List currentRet, List foundGotos, @@ -1689,7 +1689,7 @@ public class AVM2Graph extends Graph { * @param path Path * @return List of GraphTargetItems to replace current output and stop * further processing. Null to continue. - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override protected List check(List currentRet, List foundGotos, @@ -2421,7 +2421,7 @@ public class AVM2Graph extends Graph { * @param level Level * @param localData Local data * @param path Path - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override protected void finalProcess(List list, int level, FinalProcessLocalData localData, String path) throws InterruptedException { @@ -2775,14 +2775,6 @@ public class AVM2Graph extends Graph { super.finalProcess(list, level, localData, path); } - /** - * Gets data for final process. - * - * @param localData - * @param loops - * @param throwStates - * @return - */ @Override protected FinalProcessLocalData getFinalData(BaseLocalData localData, List loops, List throwStates) { FinalProcessLocalData finalProcess = new AVM2FinalProcessLocalData(loops, ((AVM2LocalData) localData).localRegNames, ((AVM2LocalData) localData).setLocalPosToGetLocalPos); @@ -2790,12 +2782,6 @@ public class AVM2Graph extends Graph { return finalProcess; } - /** - * Prepares local data for branch. - * - * @param localData Local data - * @return Local data for a branch - */ @Override public AVM2LocalData prepareBranchLocalData(BaseLocalData localData) { AVM2LocalData aLocalData = (AVM2LocalData) localData; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java index 66579e84f..f5f790aa7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java @@ -197,7 +197,7 @@ public class AVM2GraphSource extends GraphSource { * @param staticOperation Unused * @param path Path * @return List of graph target items - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public List translatePart(Graph graph, GraphPart part, BaseLocalData localData, TranslateStack stack, int start, int end, int staticOperation, String path) throws InterruptedException { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index 75c0a783f..a26a118f4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -586,7 +586,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { * @param output Output list * @param staticOperation Unused * @param path Path - * @throws InterruptedException + * @throws InterruptedException On interrupt */ @Override public void translate(BaseLocalData localData, TranslateStack stack, List output, int staticOperation, String path) throws InterruptedException { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2InstructionFlag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2InstructionFlag.java index 657b77834..82d2cde29 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2InstructionFlag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2InstructionFlag.java @@ -22,12 +22,36 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions; * @author JPEXS */ public enum AVM2InstructionFlag { + /** + * Undocumented instruction + */ UNDOCUMENTED, + /** + * The stack handling is unknown + */ UNKNOWN_STACK, + /** + * Requires ES4 numerics minor version + */ ES4_NUMERICS_MINOR, + /** + * Requires Float major version + */ FLOAT_MAJOR, + /** + * Operands are unknown + */ UNKNOWN_OPERANDS, + /** + * Do not work in standard flash player + */ NO_FLASH_PLAYER, + /** + * Deprecated instruction + */ DEPRECATED, + /** + * Works with domain memory + */ DOMAIN_MEMORY } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instructions.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instructions.java index 0195cd91e..871ae0b53 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instructions.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instructions.java @@ -23,423 +23,1060 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions; */ public class AVM2Instructions { + /** + * Constructor. + */ + private AVM2Instructions() { + + } + + /** + * bkpt + */ public static final int Bkpt = 0x01; + /** + * nop + */ public static final int Nop = 0x02; + /** + * throw + */ public static final int Throw = 0x03; + /** + * getsuper + */ public static final int GetSuper = 0x04; + /** + * setsuper + */ public static final int SetSuper = 0x05; + /** + * dxns + */ public static final int DXNS = 0x06; + /** + * dxnslate + */ public static final int DXNSLate = 0x07; + /** + * kill + */ public static final int Kill = 0x08; + /** + * label + */ public static final int Label = 0x09; + /** + * lf32x4 + */ public static final int Lf32x4 = 0x0A; + /** + * sf32x4 + */ public static final int Sf32x4 = 0x0B; + /** + * ifnlt + */ public static final int IfNLt = 0x0C; + /** + * ifnle + */ public static final int IfNLe = 0x0D; + /** + * ifngt + */ public static final int IfNGt = 0x0E; + /** + * ifnge + */ public static final int IfNGe = 0x0F; + /** + * jump + */ public static final int Jump = 0x10; + /** + * iftrue + */ public static final int IfTrue = 0x11; + /** + * iffalse + */ public static final int IfFalse = 0x12; + /** + * ifeq + */ public static final int IfEq = 0x13; + /** + * ifne + */ public static final int IfNe = 0x14; + /** + * iflt + */ public static final int IfLt = 0x15; + /** + * ifle + */ public static final int IfLe = 0x16; + /** + * ifgt + */ public static final int IfGt = 0x17; + /** + * ifge + */ public static final int IfGe = 0x18; + /** + * ifstricteq + */ public static final int IfStrictEq = 0x19; + /** + * ifstrictne + */ public static final int IfStrictNe = 0x1A; + /** + * lookupswitch + */ public static final int LookupSwitch = 0x1B; + /** + * pushwith + */ public static final int PushWith = 0x1C; + /** + * popscope + */ public static final int PopScope = 0x1D; + /** + * nextname + */ public static final int NextName = 0x1E; + /** + * hasnext + */ public static final int HasNext = 0x1F; + /** + * pushnull + */ public static final int PushNull = 0x20; + /** + * pushundefined + */ public static final int PushUndefined = 0x21; + /** + * pushconstant + */ public static final int PushConstant = 0x22; + /** + * nextvalue + */ public static final int PushFloat = 0x22; + /** + * nextvalue + */ public static final int NextValue = 0x23; + /** + * pushbyte + */ public static final int PushByte = 0x24; + /** + * pushshort + */ public static final int PushShort = 0x25; + /** + * pushtrue + */ public static final int PushTrue = 0x26; + /** + * pushfalse + */ public static final int PushFalse = 0x27; + /** + * pushnan + */ public static final int PushNan = 0x28; + /** + * pop + */ public static final int Pop = 0x29; + /** + * dup + */ public static final int Dup = 0x2A; + /** + * swap + */ public static final int Swap = 0x2B; + /** + * pushstring + */ public static final int PushString = 0x2C; + /** + * pushint + */ public static final int PushInt = 0x2D; + /** + * pushuint + */ public static final int PushUInt = 0x2E; + /** + * pushdouble + */ public static final int PushDouble = 0x2F; + /** + * pushscope + */ public static final int PushScope = 0x30; + /** + * pushnamespace + */ public static final int PushNamespace = 0x31; + /** + * hasnext2 + */ public static final int HasNext2 = 0x32; + /** + * pushdecimal + */ public static final int PushDecimal = 0x33; + /** + * pushdnan + */ public static final int PushDNan = 0x34; + /** + * li8 + */ public static final int Li8 = 0x35; + /** + * li16 + */ public static final int Li16 = 0x36; + /** + * li32 + */ public static final int Li32 = 0x37; + /** + * lf32 + */ public static final int Lf32 = 0x38; + /** + * lf64 + */ public static final int Lf64 = 0x39; + /** + * si8 + */ public static final int Si8 = 0x3A; + /** + * si16 + */ public static final int Si16 = 0x3B; + /** + * si32 + */ public static final int Si32 = 0x3C; + /** + * sf32 + */ public static final int Sf32 = 0x3D; + /** + * sf64 + */ public static final int Sf64 = 0x3E; + /** + * newfunction + */ public static final int NewFunction = 0x40; + /** + * call + */ public static final int Call = 0x41; + /** + * construct + */ public static final int Construct = 0x42; + /** + * callmethod + */ public static final int CallMethod = 0x43; + /** + * callstatic + */ public static final int CallStatic = 0x44; + /** + * callsuper + */ public static final int CallSuper = 0x45; + /** + * callproperty + */ public static final int CallProperty = 0x46; + /** + * returnvoid + */ public static final int ReturnVoid = 0x47; + /** + * returnvalue + */ public static final int ReturnValue = 0x48; + /** + * constructsuper + */ public static final int ConstructSuper = 0x49; + /** + * constructprop + */ public static final int ConstructProp = 0x4A; + /** + * callproplex + */ public static final int CallSuperId = 0x4B; + /** + * callproplex + */ public static final int CallPropLex = 0x4C; + /** + * callinterface + */ public static final int CallInterface = 0x4D; + /** + * callsupervoid + */ public static final int CallSuperVoid = 0x4E; + /** + * callpropvoid + */ public static final int CallPropVoid = 0x4F; + /** + * sxi1 + */ public static final int Sxi1 = 0x50; + /** + * sxi8 + */ public static final int Sxi8 = 0x51; + /** + * sxi16 + */ public static final int Sxi16 = 0x52; + /** + * applytype + */ public static final int ApplyType = 0x53; + /** + * pushfloat4 + */ public static final int PushFloat4 = 0x54; + /** + * newobject + */ public static final int NewObject = 0x55; + /** + * newarray + */ public static final int NewArray = 0x56; + /** + * newactivation + */ public static final int NewActivation = 0x57; + /** + * newclass + */ public static final int NewClass = 0x58; + /** + * getdescendants + */ public static final int GetDescendants = 0x59; + /** + * newcatch + */ public static final int NewCatch = 0x5A; + /** + * deldescendants + */ public static final int DelDescendants = 0x5B; + /** + * findpropglobal + */ public static final int FindPropGlobal = 0x5C; + /** + * findpropstrict + */ public static final int FindPropertyStrict = 0x5D; + /** + * findproperty + */ public static final int FindProperty = 0x5E; + /** + * finddef + */ public static final int FindDef = 0x5F; + /** + * getlex + */ public static final int GetLex = 0x60; + /** + * setproperty + */ public static final int SetProperty = 0x61; + /** + * getlocal + */ public static final int GetLocal = 0x62; + /** + * setlocal + */ public static final int SetLocal = 0x63; + /** + * getglobalscope + */ public static final int GetGlobalScope = 0x64; + /** + * getscopeobject + */ public static final int GetScopeObject = 0x65; + /** + * getproperty + */ public static final int GetProperty = 0x66; + /** + * getouterscope + */ public static final int GetOuterScope = 0x67; + /** + * initproperty + */ public static final int InitProperty = 0x68; + /** + * setpropertylate + */ public static final int SetPropertyLate = 0x69; + /** + * deleteproperty + */ public static final int DeleteProperty = 0x6A; + /** + * deletepropertylate + */ public static final int DeletePropertyLate = 0x6B; + /** + * getslot + */ public static final int GetSlot = 0x6C; + /** + * setslot + */ public static final int SetSlot = 0x6D; + /** + * getglobalslot + */ public static final int GetGlobalSlot = 0x6E; + /** + * setglobalslot + */ public static final int SetGlobalSlot = 0x6F; + /** + * convert_s + */ public static final int ConvertS = 0x70; + /** + * esc_xelem + */ public static final int EscXElem = 0x71; + /** + * esc_xattr + */ public static final int EscXAttr = 0x72; + /** + * convert_i + */ public static final int ConvertI = 0x73; + /** + * convert_u + */ public static final int ConvertU = 0x74; + /** + * convert_d + */ public static final int ConvertD = 0x75; + /** + * convert_b + */ public static final int ConvertB = 0x76; + /** + * convert_o + */ public static final int ConvertO = 0x77; + /** + * checkfilter + */ public static final int CheckFilter = 0x78; + /** + * convert_m + */ public static final int ConvertM = 0x79; + /** + * convert_f + */ public static final int ConvertF = 0x79; + /** + * convert_mp + */ public static final int ConvertMP = 0x7A; + /** + * unplus + */ public static final int UnPlus = 0x7A; + /** + * convert_f4 + */ public static final int ConvertF4 = 0x7B; + /** + * coerce + */ public static final int Coerce = 0x80; + /** + * coerce_b + */ public static final int CoerceB = 0x81; + /** + * coerce_a + */ public static final int CoerceA = 0x82; + /** + * coerce_i + */ public static final int CoerceI = 0x83; + /** + * coerce_d + */ public static final int CoerceD = 0x84; + /** + * coerce_s + */ public static final int CoerceS = 0x85; + /** + * astype + */ public static final int AsType = 0x86; + /** + * astypelate + */ public static final int AsTypeLate = 0x87; + /** + * coerce_u + */ public static final int CoerceU = 0x88; + /** + * coerce_o + */ public static final int CoerceO = 0x89; + /** + * negate_p + */ public static final int NegateP = 0x8F; + /** + * negate + */ public static final int Negate = 0x90; + /** + * increment + */ public static final int Increment = 0x91; + /** + * inclocal + */ public static final int IncLocal = 0x92; + /** + * decrement + */ public static final int Decrement = 0x93; + /** + * declocal + */ public static final int DecLocal = 0x94; + /** + * typeof + */ public static final int TypeOf = 0x95; + /** + * not + */ public static final int Not = 0x96; + /** + * bitnot + */ public static final int BitNot = 0x97; + /** + * concat + */ public static final int Concat = 0x9A; + /** + * add_d + */ public static final int AddD = 0x9B; + /** + * increment_p + */ public static final int IncrementP = 0x9C; + /** + * inclocal_p + */ public static final int IncLocalP = 0x9D; + /** + * decrement_p + */ public static final int DecrementP = 0x9E; + /** + * declocal_p + */ public static final int DecLocalP = 0x9F; + /** + * add + */ public static final int Add = 0xA0; + /** + * subtract + */ public static final int Subtract = 0xA1; + /** + * multiply + */ public static final int Multiply = 0xA2; + /** + * divide + */ public static final int Divide = 0xA3; + /** + * modulo + */ public static final int Modulo = 0xA4; + /** + * lshift + */ public static final int LShift = 0xA5; + /** + * rshift + */ public static final int RShift = 0xA6; + /** + * urshift + */ public static final int URShift = 0xA7; + /** + * bitand + */ public static final int BitAnd = 0xA8; + /** + * bitor + */ public static final int BitOr = 0xA9; + /** + * bitxor + */ public static final int BitXor = 0xAA; + /** + * equals + */ public static final int Equals = 0xAB; + /** + * strictequals + */ public static final int StrictEquals = 0xAC; + /** + * lessthan + */ public static final int LessThan = 0xAD; + /** + * lessequals + */ public static final int LessEquals = 0xAE; + /** + * greaterthan + */ public static final int GreaterThan = 0xAF; + /** + * greaterequals + */ public static final int GreaterEquals = 0xB0; + /** + * instanceof + */ public static final int InstanceOf = 0xB1; + /** + * istype + */ public static final int IsType = 0xB2; + /** + * istypelate + */ public static final int IsTypeLate = 0xB3; + /** + * in + */ public static final int In = 0xB4; + /** + * add_p + */ public static final int AddP = 0xB5; + /** + * subtract_p + */ public static final int SubtractP = 0xB6; + /** + * multiply_p + */ public static final int MultiplyP = 0xB7; + /** + * divide_p + */ public static final int DivideP = 0xB8; + /** + * modulo_p + */ public static final int ModuloP = 0xB9; + /** + * increment_i + */ public static final int IncrementI = 0xC0; + /** + * decrement_i + */ public static final int DecrementI = 0xC1; + /** + * inclocal_i + */ public static final int IncLocalI = 0xC2; + /** + * declocal_i + */ public static final int DecLocalI = 0xC3; + /** + * negate_i + */ public static final int NegateI = 0xC4; + /** + * add_i + */ public static final int AddI = 0xC5; + /** + * subtract_i + */ public static final int SubtractI = 0xC6; + /** + * multiply_i + */ public static final int MultiplyI = 0xC7; + /** + * getlocal0 + */ public static final int GetLocal0 = 0xD0; + /** + * getlocal1 + */ public static final int GetLocal1 = 0xD1; + /** + * getlocal2 + */ public static final int GetLocal2 = 0xD2; + /** + * getlocal3 + */ public static final int GetLocal3 = 0xD3; + /** + * setlocal0 + */ public static final int SetLocal0 = 0xD4; + /** + * setlocal1 + */ public static final int SetLocal1 = 0xD5; + /** + * setlocal2 + */ public static final int SetLocal2 = 0xD6; + /** + * setlocal3 + */ public static final int SetLocal3 = 0xD7; + /** + * invalid + */ public static final int Invalid = 0xED; + /** + * abs_jump + */ public static final int AbsJump = 0xEE; + /** + * debug + */ public static final int Debug = 0xEF; + /** + * debugline + */ public static final int DebugLine = 0xF0; + /** + * debugfile + */ public static final int DebugFile = 0xF1; + /** + * bkptline + */ public static final int BkptLine = 0xF2; + /** + * timestamp + */ public static final int Timestamp = 0xF3; + /** + * verifypass + */ public static final int VerifyPass = 0xF5; + /** + * alloc + */ public static final int Alloc = 0xF6; + /** + * mark + */ public static final int Mark = 0xF7; + /** + * wb + */ public static final int Wb = 0xF8; + /** + * prologue + */ public static final int Prologue = 0xF9; + /** + * sendenter + */ public static final int SendEnter = 0xFA; + /** + * doubletoatom + */ public static final int DoubleToAtom = 0xFB; + /** + * sweep + */ public static final int Sweep = 0xFC; + /** + * codegenop + */ public static final int CodeGenOp = 0xFD; + /** + * verifyop + */ public static final int VerifyOp = 0xFE; + /** + * decode + */ public static final int Decode = 0xFF; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/AlchemyTypeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/AlchemyTypeIns.java index 1c02f2940..de7585a56 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/AlchemyTypeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/alchemy/AlchemyTypeIns.java @@ -25,5 +25,8 @@ import com.jpexs.decompiler.graph.DottedChain; */ public interface AlchemyTypeIns { + /** + * Alchemy package name + */ public static final DottedChain ALCHEMY_PACKAGE = new DottedChain(new String[]{"avm2", "intrinsics", "memory"}); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java index bea1d12df..ae9abf32b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java @@ -64,6 +64,10 @@ public class CoerceAIns extends InstructionDefinition implements CoerceOrConvert return 1; } + /** + * Get target type + * @return Target type + */ public String getTargetType() { return "*"; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ApplyTypeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ApplyTypeAVM2Item.java index b53320db0..408baeba5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ApplyTypeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ApplyTypeAVM2Item.java @@ -37,8 +37,14 @@ import java.util.Objects; */ public class ApplyTypeAVM2Item extends AVM2Item { + /** + * Object + */ public GraphTargetItem object; + /** + * Parameters + */ public List params; /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java index 208bc145e..fcf0661fe 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java @@ -61,6 +61,12 @@ import java.util.Stack; */ public class ASM3Parser { + /** + * Constructor. + */ + public ASM3Parser() { + } + private static class OffsetItem { public String label = ""; @@ -211,6 +217,16 @@ public class ASM3Parser { } + /** + * Parses a class. + * @param abc ABC + * @param reader Reader + * @param constants Constant pool + * @param tc Trait class + * @return True if parsed successfully + * @throws IOException On I/O error + * @throws AVM2ParseException On parse error + */ public static boolean parseClass(ABC abc, Reader reader, AVM2ConstantPool constants, TraitClass tc) throws IOException, AVM2ParseException { Flasm3Lexer lexer = new Flasm3Lexer(reader); return parseClass(abc, lexer, constants, tc); @@ -326,6 +342,16 @@ public class ASM3Parser { return true; } + /** + * Parses a slot or const. + * @param abc ABC + * @param reader Reader + * @param constants Constant pool + * @param tsc Trait slot/const + * @return True if parsed successfully + * @throws IOException On I/O error + * @throws AVM2ParseException On parse error + */ public static boolean parseSlotConst(ABC abc, Reader reader, AVM2ConstantPool constants, TraitSlotConst tsc) throws IOException, AVM2ParseException { Flasm3Lexer lexer = new Flasm3Lexer(reader); return parseSlotConst(abc, lexer, constants, tsc); @@ -579,6 +605,14 @@ public class ASM3Parser { return constants.getMultinameId(multiname, true); } + /** + * Parses value. + * @param constants Constant pool + * @param lexer Lexer + * @return Value kind + * @throws IOException On I/O error + * @throws AVM2ParseException On parse error + */ public static ValueKind parseValue(AVM2ConstantPool constants, Flasm3Lexer lexer) throws IOException, AVM2ParseException { ParsedSymbol type = lexer.lex(); ParsedSymbol value; @@ -735,10 +769,35 @@ public class ASM3Parser { return new ValueKind(value_index, value_kind); } + /** + * Parses code. + * @param abc ABC + * @param reader Reader + * @param trait Trait + * @param body Method body + * @param info Method info + * @return AVM2 code + * @throws IOException On I/O error + * @throws AVM2ParseException On parse error + * @throws InterruptedException On interrupt + */ public static AVM2Code parse(ABC abc, Reader reader, Trait trait, MethodBody body, MethodInfo info) throws IOException, AVM2ParseException, InterruptedException { return parse(abc, reader, trait, null, body, info); } + /** + * Parses code. + * @param abc ABC + * @param reader Reader + * @param trait Trait + * @param missingHandler Missing symbol handler + * @param body Method body + * @param info Method info + * @return AVM2 code + * @throws IOException On I/O error + * @throws AVM2ParseException On parse error + * @throws InterruptedException On interrupt + */ public static AVM2Code parse(ABC abc, Reader reader, Trait trait, MissingSymbolHandler missingHandler, MethodBody body, MethodInfo info) throws IOException, AVM2ParseException, InterruptedException { AVM2ConstantPool constants = abc.constants; AVM2Code code = new AVM2Code(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ParsedSymbol.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ParsedSymbol.java index 0b57ce9d4..cef8ef406 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ParsedSymbol.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ParsedSymbol.java @@ -23,210 +23,524 @@ package com.jpexs.decompiler.flash.abc.avm2.parser.pcode; */ public class ParsedSymbol { + /** + * Position + */ public int pos; + /** + * Type + */ public int type; + /** + * Value + */ public Object value; + /** + * Type: String + */ public static final int TYPE_STRING = 1; + /** + * Type: Multiname + */ public static final int TYPE_MULTINAME = 2; + /** + * Type: Instruction name + */ public static final int TYPE_INSTRUCTION_NAME = 3; + /** + * Type: Integer + */ public static final int TYPE_INTEGER = 4; + /** + * Type: Float + */ public static final int TYPE_FLOAT = 5; + /** + * Type: Identifier + */ public static final int TYPE_IDENTIFIER = 6; + /** + * Type: End of file + */ public static final int TYPE_EOF = 7; + /** + * Type: Label + */ public static final int TYPE_LABEL = 8; + /** + * Type: Comment + */ public static final int TYPE_COMMENT = 9; + /** + * Type: Exception start + */ public static final int TYPE_EXCEPTION_START = 10; + /** + * Type: Exception end + */ public static final int TYPE_EXCEPTION_END = 11; + /** + * Type: Exception target + */ public static final int TYPE_EXCEPTION_TARGET = 12; + /** + * Type: Keyword QName + */ public static final int TYPE_KEYWORD_QNAME = 13; + /** + * Type: Keyword QNameA + */ public static final int TYPE_KEYWORD_QNAMEA = 14; + /** + * Type: Keyword RTQName + */ public static final int TYPE_KEYWORD_RTQNAME = 15; + /** + * Type: Keyword RTQNameA + */ public static final int TYPE_KEYWORD_RTQNAMEA = 16; + /** + * Type: Keyword RTQNameL + */ public static final int TYPE_KEYWORD_RTQNAMEL = 17; + /** + * Type: Keyword RTQNameLA + */ public static final int TYPE_KEYWORD_RTQNAMELA = 18; + /** + * Type: Keyword Multiname + */ public static final int TYPE_KEYWORD_MULTINAME = 19; + /** + * Type: Keyword MultinameA + */ public static final int TYPE_KEYWORD_MULTINAMEA = 20; + /** + * Type: Keyword MultinameL + */ public static final int TYPE_KEYWORD_MULTINAMEL = 21; + /** + * Type: Keyword MultinameLA + */ public static final int TYPE_KEYWORD_MULTINAMELA = 22; + /** + * Type: Keyword Typename + */ public static final int TYPE_KEYWORD_TYPENAME = 23; + /** + * Type: Parent open + */ public static final int TYPE_PARENT_OPEN = 24; + /** + * Type: Parent close + */ public static final int TYPE_PARENT_CLOSE = 25; + /** + * Type: Comma + */ public static final int TYPE_COMMA = 26; + /** + * Type: Keyword null + */ public static final int TYPE_KEYWORD_NULL = 27; + /** + * Type: Bracket open + */ public static final int TYPE_BRACKET_OPEN = 28; + /** + * Type: Bracket close + */ public static final int TYPE_BRACKET_CLOSE = 29; + /** + * Type: Lower than + */ public static final int TYPE_LOWERTHAN = 30; + /** + * Type: Greater than + */ public static final int TYPE_GREATERTHAN = 31; + /** + * Type: Keyword Namespace + */ public static final int TYPE_KEYWORD_NAMESPACE = 32; + /** + * Type: Keyword PrivateNamespace + */ public static final int TYPE_KEYWORD_PRIVATENAMESPACE = 33; + /** + * Type: Keyword PackageNamespace + */ public static final int TYPE_KEYWORD_PACKAGENAMESPACE = 34; + /** + * Type: Keyword PackageInternalNs + */ public static final int TYPE_KEYWORD_PACKAGEINTERNALNS = 35; + /** + * Type: Keyword ProtectedNamespace + */ public static final int TYPE_KEYWORD_PROTECTEDNAMESPACE = 36; + /** + * Type: Keyword ExplicitNamespace + */ public static final int TYPE_KEYWORD_EXPLICITNAMESPACE = 37; + /** + * Type: Keyword StaticProtectedNs + */ public static final int TYPE_KEYWORD_STATICPROTECTEDNS = 38; + /** + * Type: Keyword try + */ public static final int TYPE_KEYWORD_TRY = 39; + /** + * Type: Keyword from + */ public static final int TYPE_KEYWORD_FROM = 40; + /** + * Type: Keyword to + */ public static final int TYPE_KEYWORD_TO = 41; + /** + * Type: Keyword target + */ public static final int TYPE_KEYWORD_TARGET = 42; + /** + * Type: Keyword type + */ public static final int TYPE_KEYWORD_TYPE = 43; + /** + * Type: Keyword name + */ public static final int TYPE_KEYWORD_NAME = 44; + /** + * Type: Keyword flag + */ public static final int TYPE_KEYWORD_FLAG = 45; + /** + * Type: Keyword NATIVE + */ public static final int TYPE_KEYWORD_NATIVE = 46; + /** + * Type: Keyword HAS_OPTIONAL + */ public static final int TYPE_KEYWORD_HAS_OPTIONAL = 47; + /** + * Type: Keyword HAS_PARAM_NAMES + */ public static final int TYPE_KEYWORD_HAS_PARAM_NAMES = 48; + /** + * Type: Keyword IGNORE_REST + */ public static final int TYPE_KEYWORD_IGNORE_REST = 49; + /** + * Type: Keyword NEED_ACTIVATION + */ public static final int TYPE_KEYWORD_NEED_ACTIVATION = 50; + /** + * Type: Keyword NEED_ARGUMENTS + */ public static final int TYPE_KEYWORD_NEED_ARGUMENTS = 51; + /** + * Type: Keyword NEED_REST + */ public static final int TYPE_KEYWORD_NEED_REST = 52; + + /** + * Type: Keyword SET_DXNS + */ public static final int TYPE_KEYWORD_SET_DXNS = 53; + /** + * Type: Keyword param + */ public static final int TYPE_KEYWORD_PARAM = 54; + /** + * Type: Keyword paramname + */ public static final int TYPE_KEYWORD_PARAMNAME = 55; + /** + * Type: Keyword optional + */ public static final int TYPE_KEYWORD_OPTIONAL = 56; + /** + * Type: Keyword returns + */ public static final int TYPE_KEYWORD_RETURNS = 57; + /** + * Type: Keyword body + */ public static final int TYPE_KEYWORD_BODY = 58; + /** + * Type: Keyword maxstack + */ public static final int TYPE_KEYWORD_MAXSTACK = 59; + /** + * Type: Keyword localcount + */ public static final int TYPE_KEYWORD_LOCALCOUNT = 60; + /** + * Type: Keyword initscopedepth + */ public static final int TYPE_KEYWORD_INITSCOPEDEPTH = 61; + /** + * Type: Keyword maxscopedepth + */ public static final int TYPE_KEYWORD_MAXSCOPEDEPTH = 62; + /** + * Type: Keyword code + */ public static final int TYPE_KEYWORD_CODE = 63; + /** + * Type: Keyword Integer + */ public static final int TYPE_KEYWORD_INTEGER = 64; + /** + * Type: Keyword UInteger + */ public static final int TYPE_KEYWORD_UINTEGER = 65; + /** + * Type: Keyword Double + */ public static final int TYPE_KEYWORD_DOUBLE = 66; + /** + * Type: Keyword Decimal + */ public static final int TYPE_KEYWORD_DECIMAL = 67; + /** + * Type: Keyword Utf8 + */ public static final int TYPE_KEYWORD_UTF8 = 68; + /** + * Type: Keyword True + */ public static final int TYPE_KEYWORD_TRUE = 69; + /** + * Type: Keyword False + */ public static final int TYPE_KEYWORD_FALSE = 70; + /** + * Type: Keyword Void + */ public static final int TYPE_KEYWORD_VOID = 71; + /** + * Type: Keyword trait + */ public static final int TYPE_KEYWORD_TRAIT = 72; + /** + * Type: Keyword slot + */ public static final int TYPE_KEYWORD_SLOT = 73; + /** + * Type: Keyword const + */ public static final int TYPE_KEYWORD_CONST = 74; + /** + * Type: Keyword method + */ public static final int TYPE_KEYWORD_METHOD = 75; + /** + * Type: Keyword getter + */ public static final int TYPE_KEYWORD_GETTER = 76; + /** + * Type: Keyword setter + */ public static final int TYPE_KEYWORD_SETTER = 77; + /** + * Type: Keyword class + */ public static final int TYPE_KEYWORD_CLASS = 78; + /** + * Type: Keyword function + */ public static final int TYPE_KEYWORD_FUNCTION = 79; + /** + * Type: Keyword disp_id + */ public static final int TYPE_KEYWORD_DISPID = 80; + /** + * Type: Keyword slot_id + */ public static final int TYPE_KEYWORD_SLOTID = 81; + /** + * Type: Keyword value + */ public static final int TYPE_KEYWORD_VALUE = 82; + /** + * Type: Keyword FINAL + */ public static final int TYPE_KEYWORD_FINAL = 83; + /** + * Type: Keyword METADATA + */ public static final int TYPE_KEYWORD_METADATA = 84; + /** + * Type: Keyword OVERRIDE + */ public static final int TYPE_KEYWORD_OVERRIDE = 85; + /** + * Type: Keyword metadata + */ public static final int TYPE_KEYWORD_METADATA_BLOCK = 86; + + /** + * Type: Keyword item + */ public static final int TYPE_KEYWORD_ITEM = 87; + + /** + * Type: Keyword end + */ public static final int TYPE_KEYWORD_END = 88; + /** + * Type: Keyword Unknown + */ public static final int TYPE_KEYWORD_UNKNOWN = 89; + /** + * Type: Keyword SEALED + */ public static final int TYPE_KEYWORD_SEALED = 90; + /** + * Type: Keyword INTERFACE + */ public static final int TYPE_KEYWORD_INTERFACE = 91; + /** + * Type: Keyword PROTECTEDNS + */ public static final int TYPE_KEYWORD_PROTECTEDNS = 92; + /** + * Type: Keyword NON_NULLABLE + */ public static final int TYPE_KEYWORD_NON_NULLABLE = 93; + /** + * Type: Keyword instance + */ public static final int TYPE_KEYWORD_INSTANCE = 94; + /** + * Type: Keyword extends + */ public static final int TYPE_KEYWORD_EXTENDS = 95; + /** + * Type: Keyword implements + */ public static final int TYPE_KEYWORD_IMPLEMENTS = 96; + /** + * Type: Keyword protectedns + */ public static final int TYPE_KEYWORD_PROTECTEDNS_BLOCK = 97; + /** + * Constructor. + * @param pos Position + * @param type Type + * @param value Value + */ public ParsedSymbol(int pos, int type, Object value) { this.pos = pos; this.type = type; this.value = value; } + /** + * Constructor. + * @param pos Position + * @param type Type + */ public ParsedSymbol(int pos, int type) { this.pos = pos; this.type = type; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index d12778d50..fd2f59d30 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -124,14 +124,29 @@ import java.util.regex.Pattern; */ public class AVM2SourceGenerator implements SourceGenerator { + /** + * ABC indexing + */ public final AbcIndexing abcIndex; + /** + * Mark - exception start + */ public static final int MARK_E_START = 0; + /** + * Mark - exception end + */ public static final int MARK_E_END = 1; + /** + * Mark - exception target + */ public static final int MARK_E_TARGET = 2; + /** + * Mark - exception finally part + */ public static final int MARK_E_FINALLYPART = 3; private static int currentFinId = 1; @@ -142,11 +157,23 @@ public class AVM2SourceGenerator implements SourceGenerator { private long uniqLast = 0; + /** + * Generate a new unique id + * @return Unique id + */ public String uniqId() { uniqLast++; return "" + uniqLast; } + /** + * Resolve type. + * @param localData Local data + * @param item Item + * @param abcIndex ABC indexing + * @return Type index + * @throws CompilationException On compilation error + */ public static int resolveType(SourceGeneratorLocalData localData, GraphTargetItem item, AbcIndexing abcIndex) throws CompilationException { int name_index = 0; GraphTargetItem typeItem = null; @@ -271,6 +298,11 @@ public class AVM2SourceGenerator implements SourceGenerator { return SWFInputStream.BYTE_ARRAY_EMPTY; } + /** + * Converts list of source items to list of instructions + * @param items List of source items + * @return List of instructions + */ public ArrayList toInsList(List items) { ArrayList ret = new ArrayList<>(); for (GraphSourceItem s : items) { @@ -373,6 +405,17 @@ public class AVM2SourceGenerator implements SourceGenerator { } } + /** + * Generate for (each) in loop. + * @param localData Local data + * @param loop Loop + * @param collection Collection + * @param assignable Assignable + * @param commands Commands + * @param each Each + * @return List of source items + * @throws CompilationException On compilation error + */ public List generateForIn(SourceGeneratorLocalData localData, Loop loop, GraphTargetItem collection, AssignableAVM2Item assignable, List commands, final boolean each) throws CompilationException { localData.openedLoops.add(loop.id); List ret = new ArrayList<>(); @@ -452,38 +495,83 @@ public class AVM2SourceGenerator implements SourceGenerator { return toInsList(command.toSource(localData, this)); } + /** + * Gets register variables. + * @param localData Local data + * @return Register variables + */ public HashMap getRegisterVars(SourceGeneratorLocalData localData) { return localData.registerVars; } + /** + * Sets register variables. + * @param localData Local data + * @param value Value + */ public void setRegisterVars(SourceGeneratorLocalData localData, HashMap value) { localData.registerVars = value; } + /** + * Sets in function. + * @param localData Local data + * @param value Value + */ public void setInFunction(SourceGeneratorLocalData localData, int value) { localData.inFunction = value; } + /** + * Gets in function. + * @param localData Local data + * @return In function + */ public int isInFunction(SourceGeneratorLocalData localData) { return localData.inFunction; } + /** + * Checks if in method. + * @param localData Local data + * @return True if in method + */ public boolean isInMethod(SourceGeneratorLocalData localData) { return localData.inMethod; } + /** + * Sets in method. + * @param localData Local data + * @param value Value + */ public void setInMethod(SourceGeneratorLocalData localData, boolean value) { localData.inMethod = value; } + /** + * Gets for in level. + * @param localData Local data + * @return For in level + */ public int getForInLevel(SourceGeneratorLocalData localData) { return localData.forInLevel; } + /** + * Sets for in level. + * @param localData Local data + * @param value Value + */ public void setForInLevel(SourceGeneratorLocalData localData, int value) { localData.forInLevel = value; } + /** + * Gets temp register. + * @param localData Local data + * @return Temp register + */ public int getTempRegister(SourceGeneratorLocalData localData) { HashMap registerVars = getRegisterVars(localData); int tmpReg = 0; @@ -496,6 +584,10 @@ public class AVM2SourceGenerator implements SourceGenerator { return tmpReg; } + /** + * Constructor. + * @param abc ABC + */ public AVM2SourceGenerator(AbcIndexing abc) { this.abcIndex = abc; } @@ -503,6 +595,33 @@ public class AVM2SourceGenerator implements SourceGenerator { /*public ABC getABC() { return abc; }*/ + + /** + * Generate class. + * @param importedClasses Imported classes + * @param cinitVariables Cinit variables + * @param cinitNeedsActivation Cinit needs activation + * @param cinit Cinit + * @param openedNamespaces Opened namespaces + * @param namespace Namespace + * @param initScope Init scope + * @param pkg Package + * @param classInfo Class info + * @param instanceInfo Instance info + * @param localData Local data + * @param isInterface Is interface + * @param baseClassName Base class name + * @param superName Super name + * @param extendsVal Extends value + * @param implementsStr Implements + * @param iinit Instance initializer + * @param iinitVariables Instance initializer variables + * @param iinitNeedsActivation Instance initializer needs activation + * @param traitItems Trait items + * @param class_index Class index + * @throws AVM2ParseException On parse error + * @throws CompilationException On compilation error + */ public void generateClass(List importedClasses, List cinitVariables, boolean cinitNeedsActivation, List cinit, List openedNamespaces, int namespace, int initScope, DottedChain pkg, ClassInfo classInfo, InstanceInfo instanceInfo, SourceGeneratorLocalData localData, boolean isInterface, String baseClassName, String superName, GraphTargetItem extendsVal, List implementsStr, GraphTargetItem iinit, List iinitVariables, boolean iinitNeedsActivation, List traitItems, Reference class_index) throws AVM2ParseException, CompilationException { localData.currentClassBaseName = baseClassName; localData.pkg = pkg; @@ -715,6 +834,20 @@ public class AVM2SourceGenerator implements SourceGenerator { } + /** + * Generates class. + * @param namespace Namespace + * @param ci Class info + * @param ii Instance info + * @param initScope Init scope + * @param pkg Package + * @param localData Local data + * @param cls Class + * @param class_index Class index + * @return Class index + * @throws AVM2ParseException On parse error + * @throws CompilationException On compilation error + */ public int generateClass(int namespace, ClassInfo ci, InstanceInfo ii, int initScope, DottedChain pkg, SourceGeneratorLocalData localData, AVM2Item cls, Reference class_index) throws AVM2ParseException, CompilationException { /*ClassInfo ci = new ClassInfo(); InstanceInfo ii = new InstanceInfo(); @@ -755,10 +888,23 @@ public class AVM2SourceGenerator implements SourceGenerator { return abcIndex.getSelectedAbc().instance_info.size() - 1; } + /** + * Gets trait name. + * @param namespace Namespace + * @param var Variable + * @return Multiname index + */ public int traitName(int namespace, String var) { return abcIndex.getSelectedAbc().constants.getMultinameId(Multiname.createQName(false, str(var), namespace), true); } + /** + * Gets type name. + * @param localData Local data + * @param type Type + * @return Multiname index + * @throws CompilationException On compilation error + */ public int typeName(SourceGeneratorLocalData localData, GraphTargetItem type) throws CompilationException { if (type.equals(TypeItem.UNBOUNDED)) { return 0; @@ -787,6 +933,11 @@ public class AVM2SourceGenerator implements SourceGenerator { }*/ } + /** + * Gets identifier from name. + * @param name Name + * @return Identifier + */ public int ident(GraphTargetItem name) { if (name instanceof NameAVM2Item) { return str(((NameAVM2Item) name).getVariableName()); @@ -794,14 +945,30 @@ public class AVM2SourceGenerator implements SourceGenerator { throw new RuntimeException("no ident"); //FIXME } + /** + * Gets namespace. + * @param nsKind Namespace kind + * @param name Name + * @return Namespace index + */ public int namespace(int nsKind, String name) { return abcIndex.getSelectedAbc().constants.getNamespaceId(nsKind, str(name), 0, true); } + /** + * Gets string + * @param name Name + * @return String index + */ public int str(String name) { return abcIndex.getSelectedAbc().constants.getStringId(name, true); } + /** + * Gets property name. + * @param name Name + * @return Multiname index + */ public int propertyName(GraphTargetItem name) { if (name instanceof NameAVM2Item) { NameAVM2Item va = (NameAVM2Item) name; @@ -810,6 +977,11 @@ public class AVM2SourceGenerator implements SourceGenerator { throw new RuntimeException("no prop"); //FIXME } + /** + * Gets free register. + * @param localData Local data + * @return Register + */ public int getFreeRegister(SourceGeneratorLocalData localData) { for (int i = 0;; i++) { if (!localData.registerVars.containsValue(i)) { @@ -819,6 +991,12 @@ public class AVM2SourceGenerator implements SourceGenerator { } } + /** + * Kills register. + * @param localData Local data + * @param i Register + * @return True if register was killed + */ public boolean killRegister(SourceGeneratorLocalData localData, int i) { String key = null; for (String k : localData.registerVars.keySet()) { @@ -834,6 +1012,32 @@ public class AVM2SourceGenerator implements SourceGenerator { return false; } + /** + * Gets method. + * @param isStatic Is static + * @param name_index Name index + * @param subMethod Sub method + * @param isInterface Is interface + * @param isNative Is native + * @param callStack Call stack + * @param pkg Package + * @param needsActivation Needs activation + * @param subvariables Subvariables + * @param initScope Init scope + * @param hasRest Has rest + * @param line Line + * @param classBaseName Class base name + * @param superType Super type + * @param constructor Constructor + * @param localData Local data + * @param paramTypes Parameter types + * @param paramNames Parameter names + * @param paramValues Parameter values + * @param body Body + * @param retType Return type + * @return Method index + * @throws CompilationException On compilation error + */ public int method(boolean isStatic, int name_index, boolean subMethod, boolean isInterface, boolean isNative, List callStack, DottedChain pkg, boolean needsActivation, List subvariables, int initScope, boolean hasRest, int line, String classBaseName, 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); @@ -1301,6 +1505,14 @@ public class AVM2SourceGenerator implements SourceGenerator { return mindex; } + /** + * Gets value kind. + * @param ns Namespace + * @param type Type + * @param val Value + * @param generatedNs Generated namespace + * @return Value kind + */ public ValueKind getValueKind(int ns, GraphTargetItem type, GraphTargetItem val, boolean generatedNs) { if (val instanceof BooleanAVM2Item) { @@ -1358,6 +1570,16 @@ public class AVM2SourceGenerator implements SourceGenerator { return ns.getCpoolIndex(abcIndex); } + /** + * Generates traits phase 2. + * @param importedClasses Imported classes + * @param pkg Package + * @param items Items + * @param traits Traits + * @param openedNamespaces Opened namespaces + * @param localData Local data + * @throws CompilationException On compilation error + */ public void generateTraitsPhase2(List importedClasses, DottedChain pkg, List items, Trait[] traits, List openedNamespaces, SourceGeneratorLocalData localData) throws CompilationException { for (int k = 0; k < items.size(); k++) { GraphTargetItem item = items.get(k); @@ -1407,6 +1629,13 @@ public class AVM2SourceGenerator implements SourceGenerator { } } + /** + * Generates traits phase 3. + * @param items Items + * @param traits Traits + * @param localData Local data + * @throws CompilationException On compilation error + */ public void generateTraitsPhase3(List items, Trait[] traits, SourceGeneratorLocalData localData) throws CompilationException { for (int k = 0; k < items.size(); k++) { GraphTargetItem item = items.get(k); @@ -1473,6 +1702,13 @@ public class AVM2SourceGenerator implements SourceGenerator { } } + /** + * Gets super interface name. + * @param localData Local data + * @param un Unresolved item + * @return Multiname index + * @throws CompilationException On compilation error + */ public int superIntName(SourceGeneratorLocalData localData, GraphTargetItem un) throws CompilationException { if (un instanceof UnresolvedAVM2Item) { ((UnresolvedAVM2Item) un).resolve(localData, localData.getFullClass(), null, new ArrayList<>(), new ArrayList<>(), abcIndex, new ArrayList<>(), new ArrayList<>()); @@ -1488,6 +1724,12 @@ public class AVM2SourceGenerator implements SourceGenerator { } + /** + * Generates metadata + * @param metadata Metadata + * @param abc ABC + * @return Metadata indices + */ public int[] generateMetadata(List>> metadata, ABC abc) { List retList = new ArrayList<>(); for (int i = 0; i < metadata.size(); i++) { @@ -1514,6 +1756,25 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } + /** + * Generates traits phase 4. + * @param importedClasses Imported classes + * @param openedNamespaces Opened namespaces + * @param methodInitScope Method init scope + * @param isInterface Is interface + * @param className Class name + * @param superName Super name + * @param generateStatic Generate static + * @param localData Local data + * @param items Items + * @param ts Traits + * @param traits Traits + * @param initScopes Init scopes + * @param class_index Class index + * @param isScriptTraits Is script traits + * @throws AVM2ParseException On parse error + * @throws CompilationException On compilation error + */ public void generateTraitsPhase4(List importedClasses, List openedNamespaces, int methodInitScope, boolean isInterface, String className, String superName, boolean generateStatic, SourceGeneratorLocalData localData, List items, Traits ts, Trait[] traits, Map initScopes, Reference class_index, boolean isScriptTraits) throws AVM2ParseException, CompilationException { //Note: Names must be generated first before accesed in inner subs @@ -1651,6 +1912,22 @@ public class AVM2SourceGenerator implements SourceGenerator { return abcIndex.getSelectedAbc().constants.getStringId(sb.toString(), true); } + /** + * Generates traits phase 1. + * @param importedClasses Imported classes + * @param openedNamespaces Opened namespaces + * @param className Class name + * @param superName Super name + * @param generateStatic Generate static + * @param localData Local data + * @param items Items + * @param ts Traits + * @param classIndex Class index + * @param isScriptTraits Is script traits + * @return Traits + * @throws AVM2ParseException On parse error + * @throws CompilationException On compilation error + */ public Trait[] generateTraitsPhase1(List importedClasses, List openedNamespaces, String className, String superName, boolean generateStatic, SourceGeneratorLocalData localData, List items, Traits ts, Reference classIndex, boolean isScriptTraits) throws AVM2ParseException, CompilationException { Trait[] traits = new Trait[items.size()]; int slot_id = 1; @@ -1801,6 +2078,17 @@ public class AVM2SourceGenerator implements SourceGenerator { return traits; } + /** + * Generates script info. + * @param scriptIndex Script index + * @param scriptInfo Script info + * @param allOpenedNamespaces All opened namespaces + * @param localData Local data + * @param commands Commands + * @param classPos Class position + * @throws AVM2ParseException On parse error + * @throws CompilationException On compilation error + */ public void generateScriptInfo(int scriptIndex, ScriptInfo scriptInfo, List> allOpenedNamespaces, SourceGeneratorLocalData localData, List commands, int classPos) throws AVM2ParseException, CompilationException { Reference class_index = new Reference<>(classPos); localData.currentScript = scriptInfo; @@ -1925,6 +2213,14 @@ public class AVM2SourceGenerator implements SourceGenerator { } + /** + * Parent names add names. + * @param abc ABC + * @param name_index Name index + * @param indices Indices + * @param names Names + * @param namespaces Namespaces + */ public static void parentNamesAddNames(AbcIndexing abc, int name_index, List indices, List names, List namespaces) { List cindices = new ArrayList<>(); @@ -1947,6 +2243,12 @@ public class AVM2SourceGenerator implements SourceGenerator { } } + /** + * Gets trait return type. + * @param abc ABC + * @param t Trait + * @return Trait return type + */ public static GraphTargetItem getTraitReturnType(AbcIndexing abc, Trait t) { if (t instanceof TraitSlotConst) { TraitSlotConst tsc = (TraitSlotConst) t; @@ -1974,6 +2276,28 @@ public class AVM2SourceGenerator implements SourceGenerator { return TypeItem.UNBOUNDED; } + /** + * Searches prototype chain. + * @param namespaceSuffix Namespace suffix + * @param otherNs Other namespaces + * @param privateNs Private namespace + * @param protectedNs Protected namespace + * @param instanceOnly Instance only + * @param abc ABC + * @param pkg Package + * @param obj Object + * @param propertyName Property name + * @param outName Out name + * @param outNs Out namespace + * @param outPropNs Out property namespace + * @param outPropNsKind Out property namespace kind + * @param outPropNsIndex Out property namespace index + * @param outPropType Out property type + * @param outPropValue Out property value + * @param outPropValueAbc Out property value ABC + * @param isType Is type + * @return True if found + */ public static boolean searchPrototypeChain(Integer namespaceSuffix, List otherNs, int privateNs, int protectedNs, boolean instanceOnly, AbcIndexing abc, DottedChain pkg, String obj, String propertyName, Reference outName, Reference outNs, Reference outPropNs, Reference outPropNsKind, Reference outPropNsIndex, Reference outPropType, Reference outPropValue, Reference outPropValueAbc, Reference isType) { // private and protected namespaces first so we find overriding functions before overridden functions if (namespaceSuffix != null) { @@ -2025,6 +2349,15 @@ public class AVM2SourceGenerator implements SourceGenerator { return false; } + /** + * Parent names. + * @param abc ABC + * @param name_index Name index + * @param indices Indices + * @param names Names + * @param namespaces Namespaces + * @param outABCs Out ABCs + */ public static void parentNames(AbcIndexing abc, int name_index, List indices, List names, List namespaces, List outABCs) { AbcIndexing.ClassIndex ci = abc.findClass(new TypeItem(abc.getSelectedAbc().constants.getMultiname(name_index).getNameWithNamespace(abc.getSelectedAbc().constants, true /*FIXME!!*/)), null, null/*FIXME?*/); while (ci != null) { @@ -2047,6 +2380,13 @@ public class AVM2SourceGenerator implements SourceGenerator { return GraphTargetItem.toSourceMerge(localData, this, ins(AVM2Instructions.PushTrue)); } + /** + * Generates GetDescendants. + * @param localData Local data + * @param item Item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, GetDescendantsAVM2Item item) throws CompilationException { AVM2ConstantPool constants = abcIndex.getSelectedAbc().constants; @@ -2096,6 +2436,13 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } + /** + * Generates XMLFilter. + * @param localData Local data + * @param item Item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, XMLFilterAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); final Reference counterReg = new Reference<>(0); @@ -2206,10 +2553,24 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } + /** + * Generates for each in loop. + * @param localData Local data + * @param item Loop item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, ForEachInAVM2Item item) throws CompilationException { return generateForIn(localData, item.loop, item.expression.collection, (AssignableAVM2Item) item.expression.object, item.commands, true); } + /** + * Generates for in loop. + * @param localData Local data + * @param item Loop item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, ForInAVM2Item item) throws CompilationException { return generateForIn(localData, item.loop, item.expression.collection, (AssignableAVM2Item) item.expression.object, item.commands, false); } @@ -2249,6 +2610,13 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } + /** + * Generates with statement. + * @param localData Local data + * @param item Item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, WithAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); @@ -2442,6 +2810,13 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } + /** + * Generates function. + * @param localData Local data + * @param item Item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, FunctionAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); int scope = 0; @@ -2464,6 +2839,13 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } + /** + * Generates try-catch-finally. + * @param localData Local data + * @param item Item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, TryAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); @@ -2822,6 +3204,13 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } + /** + * Generates return value. + * @param localData Local data + * @param item Item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, ReturnValueAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(item.value.toSource(localData, this)); @@ -2852,6 +3241,13 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } + /** + * Generates return void. + * @param localData Local data + * @param item Item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, ReturnVoidAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); if (!localData.finallyCatches.isEmpty()) { @@ -2878,6 +3274,13 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } + /** + * Generates throw. + * @param localData Local data + * @param item Item + * @return Source items + * @throws CompilationException On compilation error + */ public List generate(SourceGeneratorLocalData localData, ThrowAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(item.value.toSource(localData, this)); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java index 26f7684ad..5cf37a1f6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java @@ -37,8 +37,17 @@ import java.util.List; */ public abstract class AssignableAVM2Item extends AVM2Item { + /** + * Assigned value + */ protected GraphTargetItem assignedValue; + /** + * Makes coerced. + * @param assignedValue Assigned value + * @param targetType Target type + * @return Coerced value + */ protected GraphTargetItem makeCoerced(GraphTargetItem assignedValue, GraphTargetItem targetType) { if (assignedValue instanceof OrItem) { OrItem oi = (OrItem) assignedValue; @@ -48,27 +57,63 @@ public abstract class AssignableAVM2Item extends AVM2Item { return new CoerceAVM2Item(null, null, assignedValue, targetType); } + /** + * Constructor. + */ public AssignableAVM2Item() { this(null); } + /** + * Copis assignable. + * @return Copied assignable + */ public abstract AssignableAVM2Item copy(); + /** + * Constructor. + * @param storeValue Store value + */ public AssignableAVM2Item(GraphTargetItem storeValue) { super(null, null, PRECEDENCE_PRIMARY); this.assignedValue = storeValue; } + /** + * To source with change (post/pre increment, decrement). + * @param localData Local data + * @param generator Generator + * @param post Post + * @param decrement Decrement + * @param needsReturn Needs return + * @return Source change + * @throws CompilationException On compilation error + */ public abstract List toSourceChange(SourceGeneratorLocalData localData, SourceGenerator generator, boolean post, boolean decrement, boolean needsReturn) throws CompilationException; + /** + * Gets assigned value. + * @return Assigned value + */ public GraphTargetItem getAssignedValue() { return assignedValue; } + /** + * Sets assigned value. + * @param storeValue Store value + */ public void setAssignedValue(GraphTargetItem storeValue) { this.assignedValue = storeValue; } + /** + * Duplicated and set temp register. + * @param localData Local data + * @param generator Generator + * @param register Register + * @return Source + */ public static List dupSetTemp(SourceGeneratorLocalData localData, SourceGenerator generator, Reference register) { register.setVal(getFreeRegister(localData, generator)); List ret = new ArrayList<>(); @@ -77,6 +122,13 @@ public abstract class AssignableAVM2Item extends AVM2Item { return ret; } + /** + * Sets temp register. + * @param localData Local data + * @param generator Generator + * @param register Register + * @return Source + */ public static List setTemp(SourceGeneratorLocalData localData, SourceGenerator generator, Reference register) { register.setVal(getFreeRegister(localData, generator)); List ret = new ArrayList<>(); @@ -84,6 +136,13 @@ public abstract class AssignableAVM2Item extends AVM2Item { return ret; } + /** + * Gets temp register. + * @param localData Local data + * @param generator Generator + * @param register Register + * @return Source + */ public static List getTemp(SourceGeneratorLocalData localData, SourceGenerator generator, Reference register) { if (register.getVal() < 0) { return new ArrayList<>(); @@ -100,6 +159,14 @@ public abstract class AssignableAVM2Item extends AVM2Item { ret.add(ins(AVM2Instructions.Kill, register.getVal())); return ret; }*/ + + /** + * Kills temp register. + * @param localData Local data + * @param generator Generator + * @param registers Registers + * @return Source + */ public static List killTemp(SourceGeneratorLocalData localData, SourceGenerator generator, List> registers) { List ret = new ArrayList<>(); for (Reference register : registers) { @@ -113,6 +180,11 @@ public abstract class AssignableAVM2Item extends AVM2Item { return ret; } + /** + * Generate set local. + * @param regNumber Register number + * @return Instruction + */ public static AVM2Instruction generateSetLoc(int regNumber) { switch (regNumber) { case -1: @@ -130,6 +202,11 @@ public abstract class AssignableAVM2Item extends AVM2Item { } } + /** + * Generate get local. + * @param regNumber Register number + * @return Instruction + */ public static AVM2Instruction generateGetLoc(int regNumber) { switch (regNumber) { case -1: @@ -147,6 +224,12 @@ public abstract class AssignableAVM2Item extends AVM2Item { } } + /** + * Generate get slot. + * @param slotScope Slot scope + * @param slotNumber Slot number + * @return Source + */ public static List generateGetSlot(int slotScope, int slotNumber) { if (slotNumber == -1) { return null; @@ -157,6 +240,16 @@ public abstract class AssignableAVM2Item extends AVM2Item { return ret; } + /** + * Generate set slot. + * @param localData Local data + * @param generator Generator + * @param val Value + * @param slotScope Slot scope + * @param slotNumber Slot number + * @return Source + * @throws CompilationException On compilation error + */ public static List generateSetSlot(SourceGeneratorLocalData localData, SourceGenerator generator, GraphTargetItem val, int slotScope, int slotNumber) throws CompilationException { if (slotNumber == -1) { return null; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/BreakJumpIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/BreakJumpIns.java index 680bc18d0..e29503712 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/BreakJumpIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/BreakJumpIns.java @@ -27,10 +27,18 @@ public class BreakJumpIns extends JumpIns { private final long loopId; + /** + * Constructor. + * @param loopId Loop id + */ public BreakJumpIns(long loopId) { this.loopId = loopId; } + /** + * Gets loop id. + * @return Loop id + */ public long getLoopId() { return loopId; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java index 8ec80eb18..3b18cff9c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java @@ -42,16 +42,39 @@ import java.util.List; */ public class CallAVM2Item extends AVM2Item { + /** + * Name + */ public GraphTargetItem name; + /** + * Arguments + */ public List arguments; + /** + * Line + */ public int line; + /** + * Opened namespaces + */ public List openedNamespaces; + /** + * ABC indexing + */ private AbcIndexing abcIndex; + /** + * Constructor. + * @param openedNamespaces Opened namespaces + * @param line Line + * @param name Name + * @param arguments Arguments + * @param abcIndex ABC indexing + */ public CallAVM2Item(List openedNamespaces, int line, GraphTargetItem name, List arguments, AbcIndexing abcIndex) { super(null, null, NOPRECEDENCE); this.openedNamespaces = openedNamespaces; @@ -66,6 +89,14 @@ public class CallAVM2Item extends AVM2Item { return writer; } + /** + * Converts to source. + * @param localData Local data + * @param generator Generator + * @param needsReturn Needs return + * @return Source + * @throws CompilationException On compilation error + */ public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException { AVM2SourceGenerator g = (AVM2SourceGenerator) generator; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ClassAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ClassAVM2Item.java index 6e8fdd1c8..d5c25f5d1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ClassAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ClassAVM2Item.java @@ -36,36 +36,84 @@ import java.util.Map; */ public class ClassAVM2Item extends AVM2Item implements Block { + /** + * Traits + */ public List traits; + /** + * Extends + */ public GraphTargetItem extendsOp; + /** + * Implements + */ public List implementsOp; + /** + * Class base name + */ public String classBaseName; + /** + * Instance initializer + */ public GraphTargetItem iinit; + /** + * Is dynamic + */ public boolean isDynamic; + /** + * Is final + */ public boolean isFinal; + /** + * Opened namespaces + */ public List openedNamespaces; + /** + * Static initializer + */ public List staticInit; + /** + * Static initializer activation + */ public boolean cinitActivation; + /** + * Instance initializer activation + */ public boolean iinitActivation; + /** + * Static initializer variables + */ public List cinitVariables; + /** + * Imported classes + */ public List importedClasses; + /** + * Package + */ public NamespaceItem pkg; + /** + * Instance initializer variables + */ public List iinitVariables; + /** + * Metadata + */ public List>> metadata; @Override @@ -82,6 +130,25 @@ public class ClassAVM2Item extends AVM2Item implements Block { } + /** + * Constructor. + * @param metadata Metadata + * @param importedClasses Imported classes + * @param pkg Package + * @param openedNamespaces Opened namespaces + * @param isFinal Is final + * @param isDynamic Is dynamic + * @param className Class name + * @param extendsOp Extends + * @param implementsOp Implements + * @param cinit Static initializer + * @param staticInitActivation Static initializer activation + * @param cinitVariables Static initializer variables + * @param iinit Instance initializer + * @param iinitVariables Instance initializer variables + * @param traits Traits + * @param iinitActivation Instance initializer activation + */ public ClassAVM2Item(List>> metadata, List importedClasses, NamespaceItem pkg, List openedNamespaces, boolean isFinal, boolean isDynamic, String className, GraphTargetItem extendsOp, List implementsOp, List cinit, boolean staticInitActivation, List cinitVariables, GraphTargetItem iinit, List iinitVariables, List traits, boolean iinitActivation) { super(null, null, NOPRECEDENCE); this.metadata = metadata; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstAVM2Item.java index b1a9b58fa..1fee45689 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstAVM2Item.java @@ -30,26 +30,66 @@ import java.util.Map; */ public class ConstAVM2Item extends AVM2Item { + /** + * Is static + */ private final boolean isStatic; + /** + * Variable name + */ public String var; + /** + * Type + */ public GraphTargetItem type; + /** + * Custom namespace + */ public String customNamespace; + /** + * Metadata + */ public List>> metadata; + /** + * Line + */ public int line; + /** + * Package + */ public NamespaceItem pkg; + /** + * Generated namespace + */ public boolean generatedNs; + /** + * Check if is static + * @return Is static + */ public boolean isStatic() { return isStatic; } + /** + * Constructor. + * @param metadata Metadata + * @param pkg Package + * @param customNamespace Custom namespace + * @param isStatic Is static + * @param var Variable name + * @param type Type + * @param value Value + * @param line Line + * @param generatedNs Generated namespace + */ public ConstAVM2Item(List>> metadata, NamespaceItem pkg, String customNamespace, boolean isStatic, String var, GraphTargetItem type, GraphTargetItem value, int line, boolean generatedNs) { super(null, null, NOPRECEDENCE, value); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java index 0ec2bfcc0..57b8436a2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java @@ -33,8 +33,19 @@ import java.util.List; */ public class ConstructSomethingAVM2Item extends CallAVM2Item { + /** + * Opened namespaces + */ public List openedNamespaces; + /** + * Constructor. + * @param line Line + * @param openedNamespaces Opened namespaces + * @param name Name + * @param arguments Arguments + * @param abcIndex ABC index + */ public ConstructSomethingAVM2Item(int line, List openedNamespaces, GraphTargetItem name, List arguments, AbcIndexing abcIndex) { super(openedNamespaces, line, name, arguments, abcIndex); this.openedNamespaces = openedNamespaces; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ContinueJumpIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ContinueJumpIns.java index 29a775860..3c2237184 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ContinueJumpIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ContinueJumpIns.java @@ -25,12 +25,23 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns; */ public class ContinueJumpIns extends JumpIns { + /** + * Loop id + */ private final long loopId; + /** + * Constructor. + * @param loopId Loop id + */ public ContinueJumpIns(long loopId) { this.loopId = loopId; } + /** + * Gets loop id. + * @return Loop id + */ public long getLoopId() { return loopId; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ExceptionMarkAVM2Instruction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ExceptionMarkAVM2Instruction.java index 9e4118eaf..aa4b555e6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ExceptionMarkAVM2Instruction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ExceptionMarkAVM2Instruction.java @@ -26,10 +26,21 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; */ public class ExceptionMarkAVM2Instruction extends AVM2Instruction { + /** + * Mark type + */ public int markType; + /** + * Exception id + */ public int exceptionId; + /** + * Constructor. + * @param exceptionId Exception id + * @param markType Mark type + */ public ExceptionMarkAVM2Instruction(int exceptionId, int markType) { super(0, null, null); this.markType = markType; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ExceptionMarkIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ExceptionMarkIns.java index 6e21e77b8..76ee34dfb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ExceptionMarkIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ExceptionMarkIns.java @@ -27,6 +27,10 @@ public class ExceptionMarkIns extends InstructionDefinition { private static final ExceptionMarkIns instance = new ExceptionMarkIns(); + /** + * Gets the instance of this class. + * @return The instance of this class + */ public static final ExceptionMarkIns getInstance() { return instance; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FinallyJumpIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FinallyJumpIns.java index 012d76fb8..535c74d52 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FinallyJumpIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FinallyJumpIns.java @@ -25,12 +25,23 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns; */ public class FinallyJumpIns extends JumpIns { + /** + * Finally clause id + */ private final long finallyClauseId; + /** + * Constructor. + * @param finallyClauseId Finally clause id + */ public FinallyJumpIns(long finallyClauseId) { this.finallyClauseId = finallyClauseId; } + /** + * Gets clause id. + * @return Clause id + */ public long getClauseId() { return finallyClauseId; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java index 9000d2bba..68eee7470 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java @@ -35,37 +35,99 @@ import java.util.Map; * @author JPEXS */ public class FunctionAVM2Item extends AVM2Item { - + /** + * Calculated function name + */ public String calculatedFunctionName; + /** + * Function name + */ public String functionName; + /** + * Parameter names + */ public List paramNames; + /** + * Body + */ public List body; + /** + * Subvariables + */ public List subvariables; + /** + * Parameter types + */ public List paramTypes; + /** + * Parameter values + */ public List paramValues; + /** + * Return type + */ public GraphTargetItem retType; + /** + * Line + */ public int line; + /** + * Has rest + */ public boolean hasRest; + /** + * Needs activation + */ public boolean needsActivation; + /** + * Is interface + */ public boolean isInterface; + /** + * Is native + */ public boolean isNative; + /** + * Package + */ public NamespaceItem pkg; + /** + * Metadata + */ public List>> metadata; + /** + * Constructor. + * + * @param metadata Metadata + * @param pkg Package + * @param isInterface Is interface + * @param isNative Is native + * @param needsActivation Needs activation + * @param hasRest Has rest + * @param line Line + * @param functionName Function name + * @param paramTypes Parameter types + * @param paramNames Parameter names + * @param paramValues Parameter values + * @param body Body + * @param subvariables Subvariables + * @param retType Return type + */ public FunctionAVM2Item(List>> metadata, NamespaceItem pkg, boolean isInterface, boolean isNative, boolean needsActivation, boolean hasRest, int line, String functionName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { super(null, null, NOPRECEDENCE); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/GetterAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/GetterAVM2Item.java index c2b588e24..856ad05d4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/GetterAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/GetterAVM2Item.java @@ -27,6 +27,30 @@ import java.util.Map; */ public class GetterAVM2Item extends MethodAVM2Item { + /** + * Constructor. + * @param allOpenedNamespaces All opened namespaces + * @param outsidePackage Outside package + * @param isPrivate Is private + * @param metadata Metadata + * @param pkg Package + * @param isInterface Is interface + * @param isNative Is native + * @param customNamespace Custom namespace + * @param needsActivation Needs activation + * @param hasRest Has rest + * @param line Line + * @param override Override + * @param isFinal Is final + * @param isStatic Is static + * @param methodName Method name + * @param paramTypes Parameter types + * @param paramNames Parameter names + * @param paramValues Parameter values + * @param body Body + * @param subvariables Subvariables + * @param retType Return type + */ public GetterAVM2Item(List> allOpenedNamespaces, boolean outsidePackage, boolean isPrivate, List>> metadata, NamespaceItem pkg, boolean isInterface, boolean isNative, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, String methodName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { super(allOpenedNamespaces, outsidePackage, isPrivate, metadata, pkg, isInterface, isNative, customNamespace, needsActivation, hasRest, line, override, isFinal, isStatic, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ImportedSlotConstItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ImportedSlotConstItem.java index 3743c200d..ff4084a9d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ImportedSlotConstItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ImportedSlotConstItem.java @@ -39,8 +39,15 @@ import java.util.List; */ public class ImportedSlotConstItem extends AssignableAVM2Item { + /** + * Type + */ public TypeItem type; + /** + * Constructor. + * @param type Type + */ public ImportedSlotConstItem(TypeItem type) { this.type = type; } @@ -65,6 +72,14 @@ public class ImportedSlotConstItem extends AssignableAVM2Item { return new ImportedSlotConstItem(type); } + /** + * Converts to source. + * @param localData Local data + * @param generator Generator + * @param needsReturn Needs return + * @return Source + * @throws CompilationException On compilation error + */ public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException { int propertyId = ((AVM2SourceGenerator) generator).typeName(localData, type); Object obj = new FindPropertyAVM2Item(null, null, type); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/IndexAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/IndexAVM2Item.java index 7585aa256..837b0366b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/IndexAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/IndexAVM2Item.java @@ -40,14 +40,34 @@ import java.util.Objects; */ public class IndexAVM2Item extends AssignableAVM2Item { + /** + * Opened namespaces + */ private final List openedNamespaces; + /** + * Object + */ public GraphTargetItem object; + /** + * Index + */ public GraphTargetItem index; + /** + * Attribute + */ public boolean attr; + /** + * Constructor. + * @param attr Attribute + * @param object Object + * @param index Index + * @param storeValue Store value + * @param openedNamespaces Opened namespaces + */ public IndexAVM2Item(boolean attr, GraphTargetItem object, GraphTargetItem index, GraphTargetItem storeValue, List openedNamespaces) { super(storeValue); this.object = object; @@ -110,6 +130,18 @@ public class IndexAVM2Item extends AssignableAVM2Item { } + /** + * Convert to source. + * @param localData Local data + * @param generator Generator + * @param needsReturn Needs return + * @param call Call + * @param callargs Call arguments + * @param delete Delete + * @param construct Construct + * @return Source + * @throws CompilationException On compilation error + */ public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn, boolean call, List callargs, boolean delete, boolean construct) throws CompilationException { AVM2SourceGenerator g = (AVM2SourceGenerator) generator; int indexPropIndex = g.abcIndex.getSelectedAbc().constants.getMultinameId(Multiname.createMultinameL(attr, allNsSet(g.abcIndex)), true); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/InterfaceAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/InterfaceAVM2Item.java index 5703b7435..f240d09ba 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/InterfaceAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/InterfaceAVM2Item.java @@ -32,22 +32,57 @@ import java.util.Map; */ public class InterfaceAVM2Item extends AVM2Item { + /** + * Base name + */ public String baseName; + /** + * Super interfaces + */ public List superInterfaces; + /** + * Methods + */ public List methods; + /** + * Is final + */ public boolean isFinal; + /** + * Opened namespaces + */ public List openedNamespaces; + /** + * Package + */ public NamespaceItem pkg; + /** + * Imported classes + */ public List importedClasses; + /** + * Metadata + */ public List>> metadata; + /** + * Constructor. + * @param metadata Metadata + * @param importedClasses Imported classes + * @param pkg Package + * @param openedNamespaces Opened namespaces + * @param isFinal Is final + * @param name Name + * @param superInterfaces Super interfaces + * @param traits Traits + */ public InterfaceAVM2Item(List>> metadata, List importedClasses, NamespaceItem pkg, List openedNamespaces, boolean isFinal, String name, List superInterfaces, List traits) { super(null, null, NOPRECEDENCE); this.metadata = metadata; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/LexBufferer.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/LexBufferer.java index 7823041d0..acc99a8d2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/LexBufferer.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/LexBufferer.java @@ -27,6 +27,9 @@ import java.util.List; */ public class LexBufferer implements LexListener { + /** + * List of stored symbols + */ private final List items = new ArrayList<>(); @Override @@ -41,6 +44,10 @@ public class LexBufferer implements LexListener { } } + /** + * Pushes all stored symbols back to lexer + * @param lexer Lexer + */ public void pushAllBack(ActionScriptLexer lexer) { for (int i = items.size() - 1; i >= 0; i--) { lexer.pushback(items.get(i)); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/LexListener.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/LexListener.java index ac3ec96dd..ea33c19fd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/LexListener.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/LexListener.java @@ -23,7 +23,15 @@ package com.jpexs.decompiler.flash.abc.avm2.parser.script; */ public interface LexListener { + /** + * Called when a symbol is parsed. + * @param s Parsed symbol + */ public void onLex(ParsedSymbol s); + /** + * Called when a symbol is pushed back. + * @param s Parsed symbol + */ public void onPushBack(ParsedSymbol s); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/MethodAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/MethodAVM2Item.java index 359fcfe65..6c7990ba3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/MethodAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/MethodAVM2Item.java @@ -39,15 +39,48 @@ public class MethodAVM2Item extends FunctionAVM2Item { public final boolean outsidePackage; + /** + * Is private method. + * @return Is private method. + */ public boolean isPrivate() { return isPrivate; } + /** + * Custom namespace + */ public String customNamespace; + /** + * All opened namespaces + */ public List> allOpenedNamespaces; - //public boolean isInterface; + /** + * Constructor. + * @param allOpenedNamespaces All opened namespaces + * @param outsidePackage Is outside package + * @param isPrivate Is private + * @param metadata Metadata + * @param pkg Package + * @param isInterface Is interface + * @param isNative Is native + * @param customNamespace Custom namespace + * @param needsActivation Needs activation + * @param hasRest Has rest + * @param line Line + * @param override Override + * @param isFinal Is final + * @param isStatic Is static + * @param methodName Method name + * @param paramTypes Param types + * @param paramNames Param names + * @param paramValues Param values + * @param body Body + * @param subvariables Subvariables + * @param retType Return type + */ public MethodAVM2Item(List> allOpenedNamespaces, boolean outsidePackage, boolean isPrivate, List>> metadata, NamespaceItem pkg, boolean isInterface, boolean isNative, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, String methodName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { super(metadata, pkg, isInterface, isNative, needsActivation, hasRest, line, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType); this.outsidePackage = outsidePackage; @@ -57,17 +90,28 @@ public class MethodAVM2Item extends FunctionAVM2Item { this.isFinal = isFinal; this.isPrivate = isPrivate; this.customNamespace = customNamespace; - //this.isInterface = this.isInterface; } + /** + * Is override. + * @return Is override + */ public boolean isOverride() { return override; } + /** + * Is static. + * @return Is static + */ public boolean isStatic() { return isStatic; } + /** + * Is final. + * @return Is final + */ public boolean isFinal() { return isFinal; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java index 085e7b8c3..d71f32015 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java @@ -57,22 +57,37 @@ public class NameAVM2Item extends AssignableAVM2Item { private int nsKind = -1; + /** + * Opened namespaces + */ public List openedNamespaces; + /** + * Line + */ public int line; + /** + * Type + */ public GraphTargetItem type; private GraphTargetItem ns = null; private int regNumber = -1; + /** + * Unresolved + */ public boolean unresolved = false; private int slotNumber = -1; private int slotScope = 0; + /** + * Redirect + */ public GraphTargetItem redirect; private AbcIndexing abcIndex; @@ -89,66 +104,138 @@ public class NameAVM2Item extends AssignableAVM2Item { return c; } + /** + * Is attribute. + * @return Is attribute + */ public boolean isAttribute() { return attribute; } + /** + * Sets slot scope. + * @param slotScope Slot scope + */ public void setSlotScope(int slotScope) { this.slotScope = slotScope; } + /** + * Gets slot scope. + * @return Slot scope + */ public int getSlotScope() { return slotScope; } + /** + * Sets namespace. + * @param ns Namespace + */ public void setNs(GraphTargetItem ns) { this.ns = ns; } + /** + * Sets register number. + * @param regNumber Register number + */ public void setRegNumber(int regNumber) { this.regNumber = regNumber; } + /** + * Gets slot number. + * @return Slot number + */ public int getSlotNumber() { return slotNumber; } + /** + * Sets slot number. + * @param slotNumber Slot number + */ public void setSlotNumber(int slotNumber) { this.slotNumber = slotNumber; } + /** + * Gets register number. + * @return Register number + */ public int getRegNumber() { return regNumber; } + /** + * Gets namespace. + * @return Namespace + */ public GraphTargetItem getNs() { return ns; } + /** + * Appends name. + * @param name Name + */ public void appendName(String name) { this.variableName += "." + name; } + /** + * Sets definition. + * @param definition Definition + */ public void setDefinition(boolean definition) { this.definition = definition; } + /** + * Sets namespace kind. + * @param nsKind Namespace kind + */ public void setNsKind(int nsKind) { this.nsKind = nsKind; } + /** + * Gets namespace kind. + * @return Namespace kind + */ public int getNsKind() { return nsKind; } + /** + * Gets variable name. + * @return Variable name + */ public String getVariableName() { return variableName; } + /** + * Get namespace suffix. + * @return Namespace suffix + */ public String getNamespaceSuffix() { return namespaceSuffix; } + /** + * Constructor. + * @param type Type + * @param line Line + * @param attribute Is attribute + * @param variableName Variable name + * @param namespaceSuffix Namespace suffix + * @param storeValue Store value + * @param definition Is definition + * @param openedNamespaces Opened namespaces + * @param abcIndex ABC index + */ public NameAVM2Item(GraphTargetItem type, int line, boolean attribute, String variableName, String namespaceSuffix, GraphTargetItem storeValue, boolean definition, List openedNamespaces, AbcIndexing abcIndex) { super(storeValue); this.attribute = attribute; @@ -162,10 +249,18 @@ public class NameAVM2Item extends AssignableAVM2Item { this.abcIndex = abcIndex; } + /** + * Is definition. + * @return Is definition + */ public boolean isDefinition() { return definition; } + /** + * Gets store value. + * @return Store value + */ public GraphTargetItem getStoreValue() { return assignedValue; } @@ -175,6 +270,11 @@ public class NameAVM2Item extends AssignableAVM2Item { return writer; } + /** + * Gets default value for a type. + * @param type Type + * @return Default value + */ public static GraphTargetItem getDefaultValue(String type) { switch (type) { case "*": @@ -190,6 +290,14 @@ public class NameAVM2Item extends AssignableAVM2Item { } } + /** + * Generates coerce. + * @param localData Local data + * @param generator Generator + * @param ttype Target type + * @return Coerce instruction + * @throws CompilationException On compilation error + */ public static AVM2Instruction generateCoerce(SourceGeneratorLocalData localData, SourceGenerator generator, GraphTargetItem ttype) throws CompilationException { if (ttype instanceof UnresolvedAVM2Item) { ttype = ((UnresolvedAVM2Item) ttype).resolved; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespaceItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespaceItem.java index 8118aa256..041ef17ba 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespaceItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespaceItem.java @@ -35,28 +35,58 @@ import java.util.Objects; */ public class NamespaceItem { + /** + * Custom namespace. + */ public static final int KIND_NAMESPACE_CUSTOM = -2; + /** + * Name + */ public DottedChain name; + /** + * Kind + */ public int kind; + /** + * Namespace index + */ private int nsIndex = -1; + /** + * Force resolves namespace. + * @param abcIndex ABC indexing + */ public void forceResolve(AbcIndexing abcIndex) { nsIndex = abcIndex.getSelectedAbc().constants.getNamespaceId(kind, name, 0, true); } + /** + * Constructor. + * @param name Name + * @param kind Kind + */ public NamespaceItem(DottedChain name, int kind) { this.name = name; this.kind = kind; } + /** + * Constructor. + * @param name Name + * @param kind Kind + */ public NamespaceItem(String name, int kind) { this.name = DottedChain.parseWithSuffix(name); this.kind = kind; } + /** + * Constructor. + * @param nsIndex Namespace index + */ public NamespaceItem(int nsIndex) { this.nsIndex = nsIndex; } @@ -87,6 +117,15 @@ public class NamespaceItem { return (this.kind == other.kind); } + /** + * Resolves custom namespace. + * @param abcIndex ABC indexing + * @param importedClasses Imported classes + * @param pkg Package + * @param openedNamespaces Opened namespaces + * @param localData Local data + * @throws CompilationException On compilation error + */ public void resolveCustomNs(AbcIndexing abcIndex, List importedClasses, DottedChain pkg, List openedNamespaces, SourceGeneratorLocalData localData) throws CompilationException { if (nsIndex > -1) { //already resolved return; @@ -139,10 +178,20 @@ public class NamespaceItem { } } + /** + * Checks if namespace is resolved. + * @return True if namespace is resolved + */ public boolean isResolved() { return nsIndex > -1; } + /** + * Gets constant pool index. + * @param abcIndex ABC indexing + * @return Constant pool index + * @throws CompilationException On compilation error + */ public int getCpoolIndex(AbcIndexing abcIndex) throws CompilationException { if (nsIndex > -1) { return nsIndex; @@ -154,6 +203,13 @@ public class NamespaceItem { return nsIndex; } + /** + * Gets namespace set index. + * @param abcIndex ABC indexing + * @param namespaces Namespaces + * @return Namespace set index + * @throws CompilationException On compilation error + */ public static int getCpoolSetIndex(AbcIndexing abcIndex, List namespaces) throws CompilationException { int[] nssa = new int[namespaces.size()]; for (int i = 0; i < nssa.length; i++) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java index ceaebaf56..57ba88595 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java @@ -42,18 +42,46 @@ import java.util.Objects; */ public class NamespacedAVM2Item extends AssignableAVM2Item { + /** + * Namespace + */ public GraphTargetItem ns; + /** + * Name + */ public String name; + /** + * Name item + */ public GraphTargetItem nameItem; + /** + * Object + */ public GraphTargetItem obj; + /** + * Attribute + */ public boolean attr; + /** + * Opened namespaces + */ public List openedNamespaces; + /** + * Constructor. + * @param ns Namespace + * @param name Name + * @param nameItem Name item + * @param obj Object + * @param attr Attribute + * @param openedNamespaces Opened namespaces + * @param storeValue Store value + */ public NamespacedAVM2Item(GraphTargetItem ns, String name, GraphTargetItem nameItem, GraphTargetItem obj, boolean attr, List openedNamespaces, GraphTargetItem storeValue) { super(storeValue); this.ns = ns; @@ -150,6 +178,18 @@ public class NamespacedAVM2Item extends AssignableAVM2Item { return TypeItem.UNBOUNDED; } + /** + * Converts to source. + * @param localData Local data + * @param generator Generator + * @param needsReturn Needs return + * @param call Call + * @param callargs Call arguments + * @param delete Delete + * @param construct Construct + * @return Source + * @throws CompilationException On compilation error + */ public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn, boolean call, List callargs, boolean delete, boolean construct) throws CompilationException { AVM2SourceGenerator g = (AVM2SourceGenerator) generator; Reference ns_temp = new Reference<>(-1); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PackageAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PackageAVM2Item.java index 6db9ff2fc..dced1805a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PackageAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PackageAVM2Item.java @@ -32,12 +32,27 @@ import java.util.List; */ public class PackageAVM2Item extends AVM2Item { + /** + * Items + */ public List items; + /** + * Package name + */ public DottedChain packageName; + /** + * Imported classes + */ public List importedClasses = new ArrayList<>(); + /** + * Constructor. + * @param importedClasses Imported classes + * @param packageName Package name + * @param items Items + */ public PackageAVM2Item(List importedClasses, DottedChain packageName, List items) { super(null, null, NOPRECEDENCE); this.importedClasses = importedClasses; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ParsedSymbol.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ParsedSymbol.java index dc57dda1f..74b706ed9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ParsedSymbol.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ParsedSymbol.java @@ -23,18 +23,38 @@ package com.jpexs.decompiler.flash.abc.avm2.parser.script; */ public class ParsedSymbol { + /** + * Group + */ public SymbolGroup group; + /** + * Value + */ public Object value; + /** + * Type + */ public SymbolType type; + /** + * Constructor. + * @param group Group + * @param type Type + */ public ParsedSymbol(SymbolGroup group, SymbolType type) { this.group = group; this.type = type; this.value = null; } + /** + * Constructor. + * @param group Group + * @param type Type + * @param value Value + */ public ParsedSymbol(SymbolGroup group, SymbolType type, Object value) { this.group = group; this.type = type; @@ -46,6 +66,11 @@ public class ParsedSymbol { return group.toString() + " " + type.toString() + " " + (value != null ? value.toString() : ""); } + /** + * Check if type is in types. + * @param types Types + * @return True if type is in types + */ public boolean isType(Object... types) { for (Object t : types) { if (t instanceof SymbolGroup) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java index ec73bfab7..e3c7b48f7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java @@ -56,20 +56,44 @@ import java.util.logging.Logger; */ public class PropertyAVM2Item extends AssignableAVM2Item { + /** + * Attribute + */ public boolean attribute; + /** + * Property name + */ public String propertyName; + /** + * Object + */ public GraphTargetItem object; + /** + * ABC indexing + */ public AbcIndexing abcIndex; + /** + * Namespace suffix + */ public String namespaceSuffix; + /** + * Opened namespaces + */ private final List openedNamespaces; + /** + * Call stack + */ private final List callStack; + /** + * Scope stack + */ public List scopeStack = new ArrayList<>(); @Override @@ -78,6 +102,17 @@ public class PropertyAVM2Item extends AssignableAVM2Item { return p; } + /** + * Constructor. + * + * @param object Object + * @param attribute Attribute + * @param propertyName Property name + * @param namespaceSuffix Namespace suffix + * @param abcIndex ABC indexing + * @param openedNamespaces Opened namespaces + * @param callStack Call stack + */ public PropertyAVM2Item(GraphTargetItem object, boolean attribute, String propertyName, String namespaceSuffix, AbcIndexing abcIndex, List openedNamespaces, List callStack) { this.attribute = attribute; this.propertyName = propertyName; @@ -102,6 +137,18 @@ public class PropertyAVM2Item extends AssignableAVM2Item { return abc.getSelectedAbc().constants.getNamespaceSetId(nssa, true); } + /** + * Resolves property. + * @param mustExist Must exist + * @param localData Local data + * @param isType Is type + * @param objectType Object type + * @param propertyType Property type + * @param propertyIndex Property index + * @param propertyValue Property value + * @param propertyValueABC Property value ABC + * @throws CompilationException On compilation error + */ public void resolve(boolean mustExist, SourceGeneratorLocalData localData, Reference isType, Reference objectType, Reference propertyType, Reference propertyIndex, Reference propertyValue, Reference propertyValueABC) throws CompilationException { Integer namespaceSuffixInt = null; if (!"".equals(namespaceSuffix)) { @@ -365,6 +412,12 @@ public class PropertyAVM2Item extends AssignableAVM2Item { objectType.setVal(objType); } + /** + * Resolves property. + * @param localData Local data + * @return Property index + * @throws CompilationException On compilation error + */ public int resolveProperty(SourceGeneratorLocalData localData) throws CompilationException { Reference objType = new Reference<>(null); Reference propType = new Reference<>(null); @@ -395,6 +448,14 @@ public class PropertyAVM2Item extends AssignableAVM2Item { return null; } + /** + * Converts to source. + * @param localData Local data + * @param generator Source generator + * @param needsReturn Needs return + * @return Source + * @throws CompilationException On compilation error + */ public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException { Reference objType = new Reference<>(null); @@ -460,6 +521,14 @@ public class PropertyAVM2Item extends AssignableAVM2Item { return true; } + /** + * Resolves object. + * @param localData Local data + * @param generator Source generator + * @param mustExist Must exist + * @return Object + * @throws CompilationException On compilation error + */ public Object resolveObject(SourceGeneratorLocalData localData, SourceGenerator generator, boolean mustExist) throws CompilationException { Object obj = object; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SetterAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SetterAVM2Item.java index 6daa224a8..d32e98aa1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SetterAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SetterAVM2Item.java @@ -27,6 +27,30 @@ import java.util.Map; */ public class SetterAVM2Item extends MethodAVM2Item { + /** + * Constructor. + * @param allOpenedNamespaces All opened namespaces + * @param outsidePackage Is outside package + * @param isPrivate Is private + * @param metadata Metadata + * @param pkg Package + * @param isInterface Is interface + * @param isNative Is native + * @param customNamespace Custom namespace + * @param needsActivation Needs activation + * @param hasRest Has rest + * @param line Line + * @param override Override + * @param isFinal Is final + * @param isStatic Is static + * @param methodName Method name + * @param paramTypes Parameter types + * @param paramNames Parameter names + * @param paramValues Parameter values + * @param body Body + * @param subvariables Subvariables + * @param retType Return type + */ public SetterAVM2Item(List> allOpenedNamespaces, boolean outsidePackage, boolean isPrivate, List>> metadata, NamespaceItem pkg, boolean isInterface, boolean isNative, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, String methodName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { super(allOpenedNamespaces, outsidePackage, isPrivate, metadata, pkg, isInterface, isNative, customNamespace, needsActivation, hasRest, line, override, isFinal, isStatic, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SlotAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SlotAVM2Item.java index b0c18258b..ddc004359 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SlotAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SlotAVM2Item.java @@ -30,24 +30,60 @@ import java.util.Map; */ public class SlotAVM2Item extends AVM2Item { + /** + * Is static + */ private final boolean isStatic; + /** + * Variable + */ public String var; + /** + * Type + */ public GraphTargetItem type; + /** + * Custom namespace + */ public String customNamespace; + /** + * Line + */ public int line; + /** + * Metadata + */ public List>> metadata; + /** + * Package + */ public NamespaceItem pkg; + /** + * Is static. + * @return Is static + */ public boolean isStatic() { return isStatic; } + /** + * Constructor. + * @param metadata Metadata + * @param pkg Package + * @param customNamespace Custom namespace + * @param isStatic Is static + * @param var Variable + * @param type Type + * @param value Value + * @param line Line + */ public SlotAVM2Item(List>> metadata, NamespaceItem pkg, String customNamespace, boolean isStatic, String var, GraphTargetItem type, GraphTargetItem value, int line) { super(null, null, NOPRECEDENCE, value); this.metadata = metadata; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolGroup.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolGroup.java index 17bf94fe7..727f38b75 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolGroup.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolGroup.java @@ -23,19 +23,60 @@ package com.jpexs.decompiler.flash.abc.avm2.parser.script; */ public enum SymbolGroup { + /** + * Operator + */ OPERATOR, + /** + * Keyword + */ KEYWORD, + /** + * Separator + */ STRING, + /** + * Comment + */ COMMENT, + /** + * XML + */ XML, + /** + * Identifier + */ IDENTIFIER, + /** + * Integer + */ INTEGER, + /** + * Double + */ DOUBLE, + /** + * Type name + */ TYPENAME, + /** + * End of file + */ EOF, - //GLOBALFUNC, + /** + * Global constant + */ GLOBALCONST, + /** + * Preprocessor directive + */ PREPROCESSOR, + /** + * Regular expression + */ REGEXP, + /** + * Namespace suffix + */ NAMESPACESUFFIX } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolType.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolType.java index 69f4c1f47..7d6d6fe41 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolType.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolType.java @@ -24,196 +24,572 @@ import com.jpexs.decompiler.graph.GraphTargetItem; * @author JPEXS */ public enum SymbolType { - //Keywords + /** + * Keyword: break + */ BREAK, + /** + * Keyword: case + */ CASE, + /** + * Keyword: continue + */ CONTINUE, + /** + * Keyword: default + */ DEFAULT, + /** + * Keyword: do + */ DO, + /** + * Keyword: while + */ WHILE, + /** + * Keyword: else + */ ELSE, + /** + * Keyword: for + */ FOR, + /** + * Keyword: each + */ EACH, + /** + * Keyword: in + */ IN(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + /** + * Keyword: if + */ IF, + /** + * Keyword: return + */ RETURN, + /** + * Keyword: super + */ SUPER(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Keyword: switch + */ SWITCH, + /** + * Keyword: throw + */ THROW, + /** + * Keyword: try + */ TRY, + /** + * Keyword: catch + */ CATCH, + /** + * Keyword: finally + */ FINALLY, + /** + * Keyword: with + */ WITH, + /** + * Keyword: dynamic + */ DYNAMIC, + /** + * Keyword: internal + */ INTERNAL, + /** + * Keyword: override + */ OVERRIDE, + /** + * Keyword: private + */ PRIVATE, + /** + * Keyword: protected + */ PROTECTED, + /** + * Keyword: public + */ PUBLIC, + /** + * Keyword: static + */ STATIC, + /** + * Keyword: class + */ CLASS, + /** + * Keyword: const + */ CONST, + /** + * Keyword: extends + */ EXTENDS, + /** + * Keyword: function + */ FUNCTION(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Keyword: get + */ GET, + /** + * Keyword: implements + */ IMPLEMENTS, + /** + * Keyword: interface + */ INTERFACE, + /** + * Keyword: namespace + */ NAMESPACE, + /** + * Keyword: package + */ PACKAGE, + /** + * Keyword: set + */ SET, + /** + * Keyword: var + */ VAR, + /** + * Keyword: import + */ IMPORT, + /** + * Keyword: use + */ USE, + /** + * Keyword: false + */ FALSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Keyword: null + */ NULL(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Keyword: this + */ THIS(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Keyword: true + */ TRUE(GraphTargetItem.PRECEDENCE_PRIMARY, false), - //Operators + + /** + * Operator: ( + */ PARENT_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + + /** + * Operator: ) + */ PARENT_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + + /** + * Operator: { + */ CURLY_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + + /** + * Operator: } + */ CURLY_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + + /** + * Operator: [ + */ BRACKET_OPEN(GraphTargetItem.PRECEDENCE_PRIMARY, false), + + /** + * Operator: ] + */ BRACKET_CLOSE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + + /** + * Operator: ; + */ SEMICOLON, + + /** + * Operator: , + */ COMMA(GraphTargetItem.PRECEDENCE_COMMA, false), + + /** + * Operator: ... + */ REST, + + /** + * Operator: . + */ DOT(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Operator: = + */ ASSIGN(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: > + */ GREATER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + /** + * Operator: < + */ LOWER_THAN(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + /** + * Operator: ! + */ NOT(GraphTargetItem.PRECEDENCE_UNARY, false), + /** + * Operator: ~ + */ NEGATE(GraphTargetItem.PRECEDENCE_UNARY, false), + /** + * Operator: ? + */ TERNAR(GraphTargetItem.PRECEDENCE_CONDITIONAL, true, true), /*!! ternar !!!*/ + /** + * Operator: : + */ COLON(GraphTargetItem.PRECEDENCE_CONDITIONAL, false), /*!! ternar !!!*/ + /** + * Operator: == + */ EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true), + /** + * Operator: === + */ STRICT_EQUALS(GraphTargetItem.PRECEDENCE_EQUALITY, true), + /** + * Operator: <= + */ LOWER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + /** + * Operator: >= + */ GREATER_EQUAL(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + /** + * Operator: != + */ NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true), + /** + * Operator: !== + */ STRICT_NOT_EQUAL(GraphTargetItem.PRECEDENCE_EQUALITY, true), + /** + * Operator: && + */ AND(GraphTargetItem.PRECEDENCE_LOGICALAND, true), + /** + * Operator: || + */ OR(GraphTargetItem.PRECEDENCE_LOGICALOR, true), + /** + * Operator: ++ + */ INCREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false), //OR Unary + /** + * Operator: -- + */ DECREMENT(GraphTargetItem.PRECEDENCE_POSTFIX, false), //OR Unary + /** + * Operator: + + */ PLUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true), + /** + * Operator: - + */ MINUS(GraphTargetItem.PRECEDENCE_ADDITIVE, true), //OR Unary + /** + * Operator: * + */ MULTIPLY(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true), + /** + * Operator: / + */ DIVIDE(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true), + /** + * Operator: & + */ BITAND(GraphTargetItem.PRECEDENCE_BITWISEAND, true), + /** + * Operator: | + */ BITOR(GraphTargetItem.PRECEDENCE_BITWISEOR, true), + /** + * Operator: ^ + */ XOR(GraphTargetItem.PRECEDENCE_BITWISEXOR, true), + /** + * Operator: % + */ MODULO(GraphTargetItem.PRECEDENCE_MULTIPLICATIVE, true), + /** + * Operator: << + */ SHIFT_LEFT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + /** + * Operator: >> + */ SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + /** + * Operator: >>> + */ USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_BITWISESHIFT, true), + /** + * Operator: += + */ ASSIGN_PLUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: -= + */ ASSIGN_MINUS(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: *= + */ ASSIGN_MULTIPLY(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: /= + */ ASSIGN_DIVIDE(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: &= + */ ASSIGN_BITAND(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: |= + */ ASSIGN_BITOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: ^= + */ ASSIGN_XOR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: %= + */ ASSIGN_MODULO(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: <<= + */ ASSIGN_SHIFT_LEFT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: >>= + */ ASSIGN_SHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: >>>= + */ ASSIGN_USHIFT_RIGHT(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: &&= + */ ASSIGN_AND(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: ||= + */ ASSIGN_OR(GraphTargetItem.PRECEDENCE_ASSIGMENT, true, true), + /** + * Operator: as + */ AS(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + /** + * Operator: delete + */ DELETE(GraphTargetItem.PRECEDENCE_UNARY, false), + /** + * Operator: instanceof + */ INSTANCEOF(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + /** + * Operator: is + */ IS(GraphTargetItem.PRECEDENCE_RELATIONAL, true), + /** + * Operator: :: + */ NAMESPACE_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Operator: new + */ NEW(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Operator: typeof + */ TYPEOF(GraphTargetItem.PRECEDENCE_UNARY, false), + /** + * Operator: void + */ VOID, + /** + * Operator: @ + */ ATTRIBUTE, - //Other + /** + * Other: String + */ STRING(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Other: Comment + */ COMMENT, - //XML, + /** + * Other: Identifier + */ IDENTIFIER(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Other: Integer + */ INTEGER(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Other: Double + */ DOUBLE(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Other: Type name + */ TYPENAME(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Other: End of file + */ EOF, - //TRACE, - //GETURL, - //GOTOANDSTOP, - //NEXTFRAME, - //PLAY, - //PREVFRAME, - //TELLTARGET, - //STOP, - //STOPALLSOUNDS, - //TOGGLEHIGHQUALITY, - //ORD, - //CHR, - //DUPLICATEMOVIECLIP, - //STOPDRAG, - //GETTIMER, - //LOADVARIABLES, - //LOADMOVIE, - //GOTOANDPLAY, - //MBORD, - //MBCHR, - //MBLENGTH, - //MBSUBSTRING, - //RANDOM, - //REMOVEMOVIECLIP, - //STARTDRAG, - //SUBSTR, - //LENGTH, //string.length - INT(GraphTargetItem.PRECEDENCE_PRIMARY, false), - //TARGETPATH, + /** + * Other: Number op + */ NUMBER_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * Other: String op + */ STRING_OP(GraphTargetItem.PRECEDENCE_PRIMARY, false), - //IFFRAMELOADED, + /** + * Other: Infinity + */ INFINITY(GraphTargetItem.PRECEDENCE_PRIMARY, false), - //EVAL, + /** + * Other: undefined + */ UNDEFINED(GraphTargetItem.PRECEDENCE_PRIMARY, false), - //NEWLINE, + /** + * Other: NaN + */ NAN(GraphTargetItem.PRECEDENCE_PRIMARY, false), - //GETVERSION, - //CALL, - //LOADMOVIENUM, - //LOADVARIABLESNUM, - //PRINT, - //PRINTNUM, - //PRINTASBITMAP, - //PRINTASBITMAPNUM, - //UNLOADMOVIE, - //UNLOADMOVIENUM, + /** + * Keyword: final + */ FINAL, + /** + * XML: Start tag + */ XML_STARTTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // + /** + * XML: Finish variable tag + */ XML_FINISHVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // + /** + * XML: Start finish tag end + */ XML_STARTFINISHTAG_END(GraphTargetItem.PRECEDENCE_PRIMARY, false), // /> + /** + * XML: Comment + */ XML_COMMENT(GraphTargetItem.PRECEDENCE_PRIMARY, false), // + /** + * XML: CDATA + */ XML_CDATA(GraphTargetItem.PRECEDENCE_PRIMARY, false), // + /** + * XML: Processing instruction + */ XML_INSTR(GraphTargetItem.PRECEDENCE_PRIMARY, false), // - //XML_INSTR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // + /** + * XML: variable begin + */ XML_VAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // { + /** + * XML: attribute name + */ XML_ATTRIBUTENAME(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa= + /** + * XML: attribute value + */ XML_ATTRIBUTEVALUE(GraphTargetItem.PRECEDENCE_PRIMARY, false), // "vvv" + /** + * XML: text + */ XML_TEXT(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * XML: variable attribute name begin + */ XML_ATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {...}= + /** + * XML: variable attribute value end + */ XML_ATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa={ + /** + * XML: end + */ XML_END(GraphTargetItem.PRECEDENCE_PRIMARY, false), + /** + * XML: whitespace + */ XML_WHITESPACE(GraphTargetItem.PRECEDENCE_PRIMARY, false), //only when enabled - for example for XML - //XML_INSTRATTRNAMEVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // {...}= - // XML_INSTRATTRVALVAR_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // aaa={ - //XML_INSTRVARTAG_BEGIN(GraphTargetItem.PRECEDENCE_PRIMARY, false), // openedNamespaces; + /** + * Line + */ public int line; + /** + * Type + */ public GraphTargetItem type; - //private GraphTargetItem ns = null; + /** + * Resolved + */ public GraphTargetItem resolved; + /** + * Resolved root + */ public GraphTargetItem resolvedRoot; + /** + * Must be type + */ private final boolean mustBeType; + /** + * Imported classes + */ public List importedClasses; + /** + * Scope stack + */ public List scopeStack = new ArrayList<>(); + /** + * Subtypes + */ public List subtypes; + /** + * ABC index + */ private AbcIndexing abcIndex; @Override @@ -84,12 +113,20 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { return c; } + /** + * Sets slot scope. + * @param slotScope Slot scope + */ public void setSlotScope(int slotScope) { if (resolved instanceof NameAVM2Item) { ((NameAVM2Item) resolved).setSlotScope(slotScope); } } + /** + * Gets slot scope. + * @return Slot scope + */ public int getSlotScope() { if (resolved instanceof NameAVM2Item) { return ((NameAVM2Item) resolved).getSlotScope(); @@ -97,15 +134,20 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { return -1; } - /*public void setNs(GraphTargetItem ns) { - this.ns = ns; - }*/ + /** + * Sets reg number. + * @param regNumber Reg number + */ public void setRegNumber(int regNumber) { if (resolved instanceof NameAVM2Item) { ((NameAVM2Item) resolved).setRegNumber(regNumber); } } + /** + * Gets slot number. + * @return Slot number + */ public int getSlotNumber() { if (resolved instanceof NameAVM2Item) { return ((NameAVM2Item) resolved).getSlotNumber(); @@ -113,12 +155,20 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { return -1; } + /** + * Sets slot number. + * @param slotNumber Slot number + */ public void setSlotNumber(int slotNumber) { if (resolved instanceof NameAVM2Item) { ((NameAVM2Item) resolved).setSlotNumber(slotNumber); } } + /** + * Gets reg number. + * @return Reg number + */ public int getRegNumber() { if (resolved instanceof NameAVM2Item) { return ((NameAVM2Item) resolved).getRegNumber(); @@ -126,25 +176,36 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { return -1; } - /* - public GraphTargetItem getNs() { - return ns; - } + /** + * Appends name. + * @param name Name */ public void appendName(String name) { this.name = this.name.addWithSuffix(name); } + /** + * Sets definition. + * @param definition Definition + */ public void setDefinition(boolean definition) { if (resolved instanceof NameAVM2Item) { ((NameAVM2Item) resolved).setDefinition(definition); } } + /** + * Sets namespace kind. + * @param nsKind Namespace kind + */ public void setNsKind(int nsKind) { this.nsKind = nsKind; } + /** + * Gets namespace kind. + * @return Namespace kind + */ public int getNsKind() { return nsKind; } @@ -154,14 +215,34 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { this.assignedValue = storeValue; } + /** + * Gets variable name. + * @return Variable name + */ public DottedChain getVariableName() { return name; } + /** + * Sets variable name. + * @param name Variable name + */ public void setVariableName(DottedChain name) { this.name = name; } + /** + * Constructor. + * @param subtypes Subtypes + * @param importedClasses Imported classes + * @param mustBeType Must be type + * @param type Type + * @param line Line + * @param name Name + * @param storeValue Store value + * @param openedNamespaces Opened namespaces + * @param abcIndex ABC index + */ public UnresolvedAVM2Item(List subtypes, List importedClasses, boolean mustBeType, GraphTargetItem type, int line, DottedChain name, GraphTargetItem storeValue, List openedNamespaces, AbcIndexing abcIndex) { super(storeValue); this.name = name; @@ -175,6 +256,10 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { this.abcIndex = abcIndex; } + /** + * Checks if is definition. + * @return True if is definition + */ public boolean isDefinition() { if (resolved instanceof NameAVM2Item) { return ((NameAVM2Item) resolved).isDefinition(); @@ -182,6 +267,10 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { return false; } + /** + * Gets store value. + * @return Store value + */ public GraphTargetItem getStoreValue() { return assignedValue; } @@ -191,6 +280,11 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { return writer; } + /** + * Gets default value for type. + * @param type Type + * @return Default value + */ public static GraphTargetItem getDefaultValue(String type) { switch (type) { case "*": @@ -206,6 +300,14 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { } } + /** + * Generates coerce. + * @param localData Local data + * @param generator Generator + * @param type Type + * @return Coerce instruction + * @throws CompilationException On compilation error + */ public static AVM2Instruction generateCoerce(SourceGeneratorLocalData localData, SourceGenerator generator, GraphTargetItem type) throws CompilationException { AVM2Instruction ins; switch (type.toString()) { @@ -288,6 +390,19 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { throw new CompilationException("Cannot assign", line); } + /** + * Resolves. + * @param localData Local data + * @param currentClassFullName Current class full name + * @param thisType This type + * @param paramTypes Parameter types + * @param paramNames Parameter names + * @param abc ABC + * @param callStack Call stack + * @param variables Variables + * @return Resolved item + * @throws CompilationException On compilation error + */ public GraphTargetItem resolve(SourceGeneratorLocalData localData /*can be null!!!*/, String currentClassFullName, GraphTargetItem thisType, List paramTypes, List paramNames, AbcIndexing abc, List callStack, List variables) throws CompilationException { if (scopeStack.isEmpty()) { //Everything is multiname property in with command diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLAVM2Item.java index ba42cc825..3135dca70 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLAVM2Item.java @@ -39,6 +39,10 @@ import java.util.List; */ public class XMLAVM2Item extends AVM2Item { + /** + * Constructor. + * @param value Value + */ public XMLAVM2Item(GraphTargetItem value) { super(null, null, PRECEDENCE_PRIMARY, value); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLFilterAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLFilterAVM2Item.java index 9a045ecb2..0e7078ca5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLFilterAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/XMLFilterAVM2Item.java @@ -35,10 +35,22 @@ import java.util.List; */ public class XMLFilterAVM2Item extends AVM2Item { + /** + * Opened namespaces + */ public List openedNamespaces; + /** + * Object + */ public GraphTargetItem object; + /** + * Constructor. + * @param object Object + * @param value Value + * @param openedNamespaces Opened namespaces + */ public XMLFilterAVM2Item(GraphTargetItem object, GraphTargetItem value, List openedNamespaces) { super(null, null, NOPRECEDENCE, value); this.openedNamespaces = openedNamespaces; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfoparser/MethodInfoParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfoparser/MethodInfoParser.java index 2ea570c01..fd4519be3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfoparser/MethodInfoParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfoparser/MethodInfoParser.java @@ -33,6 +33,14 @@ import java.util.List; */ public class MethodInfoParser { + /** + * Parses slot const. + * @param text Text to parse + * @param trait Trait to update + * @param abc ABC file + * @return True if successful + * @throws MethodInfoParseException On parse error + */ public static boolean parseSlotConst(String text, TraitSlotConst trait, ABC abc) throws MethodInfoParseException { MethodInfoLexer lexer = new MethodInfoLexer(new java.io.InputStreamReader(new ByteArrayInputStream(text.getBytes()))); ParsedSymbol symb; @@ -123,6 +131,13 @@ public class MethodInfoParser { return true; } + /** + * Parses return type. + * @param text Text to parse + * @param update Method info to update + * @return True if successful + * @throws MethodInfoParseException On parse error + */ public static boolean parseReturnType(String text, MethodInfo update) throws MethodInfoParseException { MethodInfoLexer lexer = new MethodInfoLexer(new java.io.InputStreamReader(new ByteArrayInputStream(text.getBytes()))); ParsedSymbol symb; @@ -148,6 +163,14 @@ public class MethodInfoParser { return false; } + /** + * Parses parameters. + * @param text Text to parse + * @param update Method info to update + * @param abc ABC file + * @return True if successful + * @throws MethodInfoParseException On parse error + */ public static boolean parseParams(String text, MethodInfo update, ABC abc) throws MethodInfoParseException { MethodInfoLexer lexer = new MethodInfoLexer(new java.io.InputStreamReader(new ByteArrayInputStream(text.getBytes()))); List paramNames = new ArrayList<>(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfoparser/ParsedSymbol.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfoparser/ParsedSymbol.java index a4ab39698..f66e6408e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfoparser/ParsedSymbol.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfoparser/ParsedSymbol.java @@ -23,60 +23,142 @@ package com.jpexs.decompiler.flash.abc.methodinfoparser; */ public class ParsedSymbol { + /** + * Type + */ public int type; + /** + * Value + */ public Object value; + /** + * Type: Integer + */ public static final int TYPE_INTEGER = 1; + /** + * Type: Float + */ public static final int TYPE_FLOAT = 2; + /** + * Type: True + */ public static final int TYPE_TRUE = 3; + /** + * Type: False + */ public static final int TYPE_FALSE = 4; + /** + * Type: Null + */ public static final int TYPE_NULL = 5; + /** + * Type: Undefined + */ public static final int TYPE_UNDEFINED = 6; + /** + * Type: String + */ public static final int TYPE_STRING = 7; //8-12 namespace prefix + + /** + * Type: Private + */ public static final int TYPE_PRIVATE = 8; + /** + * Type: Package + */ public static final int TYPE_PACKAGE = 9; + /** + * Type: Internal + */ public static final int TYPE_INTERNAL = 10; + /** + * Type: Static + */ public static final int TYPE_STATIC = 11; + /** + * Type: Explicit + */ public static final int TYPE_EXPLICIT = 12; + /** + * Type: Protected + */ public static final int TYPE_PROTECTED = 13; + /** + * Type: Namespace + */ public static final int TYPE_NAMESPACE = 14; + /** + * Type: Colon + */ public static final int TYPE_COLON = 15; + /** + * Type: Comma + */ public static final int TYPE_COMMA = 16; + /** + * Type: Dots + */ public static final int TYPE_DOTS = 17; + /** + * Type: Multiname + */ public static final int TYPE_MULTINAME = 18; + /** + * Type: Identifier + */ public static final int TYPE_IDENTIFIER = 19; + /** + * Type: End of file + */ public static final int TYPE_EOF = 20; + /** + * Type: Star + */ public static final int TYPE_STAR = 21; + /** + * Type: Assign + */ public static final int TYPE_ASSIGN = 22; + /** + * Constructor. + * @param type Type + * @param value Value + */ public ParsedSymbol(int type, Object value) { this.type = type; this.value = value; } + /** + * Constructor. + * @param type Type + */ public ParsedSymbol(int type) { this.type = type; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ClassNameMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ClassNameMultinameUsage.java index 9dc76bebe..ee1b01f2c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ClassNameMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ClassNameMultinameUsage.java @@ -28,6 +28,13 @@ public class ClassNameMultinameUsage extends MultinameUsage implements Definitio private final int classIndex; + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param classIndex Class index + * @param scriptIndex Script index + */ public ClassNameMultinameUsage(ABC abc, int multinameIndex, int classIndex, int scriptIndex) { super(abc, multinameIndex, scriptIndex); this.classIndex = classIndex; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarMultinameUsage.java index 23ee8807c..a0073f63a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarMultinameUsage.java @@ -34,6 +34,17 @@ import java.util.ArrayList; */ public abstract class ConstVarMultinameUsage extends TraitMultinameUsage { + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + * @param classIndex Class index + * @param traitIndex Trait index + * @param traitsType Traits type + * @param traits Traits + * @param parentTraitIndex Parent trait index + */ public ConstVarMultinameUsage(ABC abc, int multinameIndex, int scriptIndex, int classIndex, int traitIndex, int traitsType, Traits traits, int parentTraitIndex) { super(abc, multinameIndex, scriptIndex, classIndex, traitIndex, traitsType, traits, parentTraitIndex); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarNameMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarNameMultinameUsage.java index 11bbe1277..b314107b0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarNameMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarNameMultinameUsage.java @@ -26,6 +26,17 @@ import com.jpexs.decompiler.flash.abc.types.traits.Traits; */ public class ConstVarNameMultinameUsage extends ConstVarMultinameUsage implements DefinitionUsage { + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + * @param classIndex Class index + * @param traitIndex Trait index + * @param traitsType Traits type + * @param traits Traits + * @param parentTraitIndex Parent trait index + */ public ConstVarNameMultinameUsage(ABC abc, int multinameIndex, int scriptIndex, int classIndex, int traitIndex, int traitsType, Traits traits, int parentTraitIndex) { super(abc, multinameIndex, scriptIndex, classIndex, traitIndex, traitsType, traits, parentTraitIndex); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarTypeMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarTypeMultinameUsage.java index 15fdbe64b..ae443fe79 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarTypeMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/ConstVarTypeMultinameUsage.java @@ -26,6 +26,17 @@ import com.jpexs.decompiler.flash.abc.types.traits.Traits; */ public class ConstVarTypeMultinameUsage extends ConstVarMultinameUsage { + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + * @param classIndex Class index + * @param traitIndex Trait index + * @param traitsType Traits type + * @param traits Traits + * @param parentTraitIndex Parent trait index + */ public ConstVarTypeMultinameUsage(ABC abc, int multinameIndex, int scriptIndex, int classIndex, int traitIndex, int traitsType, Traits traits, int parentTraitIndex) { super(abc, multinameIndex, scriptIndex, classIndex, traitIndex, traitsType, traits, parentTraitIndex); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodBodyMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodBodyMultinameUsage.java index 62cfd0b3c..b08f9223c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodBodyMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodBodyMultinameUsage.java @@ -26,6 +26,18 @@ import com.jpexs.decompiler.flash.abc.types.traits.Traits; */ public class MethodBodyMultinameUsage extends MethodMultinameUsage { + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + * @param classIndex Class index + * @param traitIndex Trait index + * @param traitsType Traits type + * @param isInitializer Is initializer + * @param traits Traits + * @param parentTraitIndex Parent trait index + */ public MethodBodyMultinameUsage(ABC abc, int multinameIndex, int scriptIndex, int classIndex, int traitIndex, int traitsType, boolean isInitializer, Traits traits, int parentTraitIndex) { super(abc, multinameIndex, scriptIndex, classIndex, traitIndex, traitsType, isInitializer, traits, parentTraitIndex); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodMultinameUsage.java index 129152a26..27334a05e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodMultinameUsage.java @@ -35,11 +35,27 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage { private boolean isInitializer; + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + * @param classIndex Class index + * @param traitIndex Trait index + * @param traitsType Traits type + * @param isInitializer Is initializer + * @param traits Traits + * @param parentTraitIndex Parent trait index + */ public MethodMultinameUsage(ABC abc, int multinameIndex, int scriptIndex, int classIndex, int traitIndex, int traitsType, boolean isInitializer, Traits traits, int parentTraitIndex) { super(abc, multinameIndex, scriptIndex, classIndex, traitIndex, traitsType, traits, parentTraitIndex); this.isInitializer = isInitializer; } + /** + * Is initializer. + * @return Is initializer + */ public boolean isInitializer() { return isInitializer; } @@ -123,6 +139,10 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage { return true; } + /** + * Is static. + * @return Is static + */ public boolean isStatic() { return traitsType == TRAITS_TYPE_CLASS; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodNameMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodNameMultinameUsage.java index ac827e1d0..821463426 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodNameMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodNameMultinameUsage.java @@ -26,6 +26,18 @@ import com.jpexs.decompiler.flash.abc.types.traits.Traits; */ public class MethodNameMultinameUsage extends MethodMultinameUsage implements DefinitionUsage { + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + * @param classIndex Class index + * @param traitIndex Trait index + * @param traitsType Traits type + * @param isInitializer Is initializer + * @param traits Traits + * @param parentTraitIndex Parent trait index + */ public MethodNameMultinameUsage(ABC abc, int multinameIndex, int scriptIndex, int classIndex, int traitIndex, int traitsType, boolean isInitializer, Traits traits, int parentTraitIndex) { super(abc, multinameIndex, scriptIndex, classIndex, traitIndex, traitsType, isInitializer, traits, parentTraitIndex); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodParamsMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodParamsMultinameUsage.java index 4e4e14ed1..193a1758a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodParamsMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodParamsMultinameUsage.java @@ -26,6 +26,18 @@ import com.jpexs.decompiler.flash.abc.types.traits.Traits; */ public class MethodParamsMultinameUsage extends MethodMultinameUsage { + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + * @param classIndex Class index + * @param traitIndex Trait index + * @param traitsType Traits type + * @param isInitializer Is initializer + * @param traits Traits + * @param parentTraitIndex Parent trait index + */ public MethodParamsMultinameUsage(ABC abc, int multinameIndex, int scriptIndex, int classIndex, int traitIndex, int traitsType, boolean isInitializer, Traits traits, int parentTraitIndex) { super(abc, multinameIndex, scriptIndex, classIndex, traitIndex, traitsType, isInitializer, traits, parentTraitIndex); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodReturnTypeMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodReturnTypeMultinameUsage.java index cd7152349..d20ea90ad 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodReturnTypeMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MethodReturnTypeMultinameUsage.java @@ -26,6 +26,18 @@ import com.jpexs.decompiler.flash.abc.types.traits.Traits; */ public class MethodReturnTypeMultinameUsage extends MethodMultinameUsage { + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + * @param classIndex Class index + * @param traitIndex Trait index + * @param traitsType Traits type + * @param isInitializer Is initializer + * @param traits Traits + * @param parentTraitIndex Parent trait index + */ public MethodReturnTypeMultinameUsage(ABC abc, int multinameIndex, int scriptIndex, int classIndex, int traitIndex, int traitsType, boolean isInitializer, Traits traits, int parentTraitIndex) { super(abc, multinameIndex, scriptIndex, classIndex, traitIndex, traitsType, isInitializer, traits, parentTraitIndex); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MultinameUsage.java index 1e78ba46f..615b07794 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/MultinameUsage.java @@ -30,12 +30,27 @@ import java.util.Objects; */ public abstract class MultinameUsage implements Usage { + /** + * ABC + */ protected final ABC abc; + /** + * Multiname index + */ private final int multinameIndex; + /** + * Script index + */ protected int scriptIndex; + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + */ public MultinameUsage(ABC abc, int multinameIndex, int scriptIndex) { this.abc = abc; this.multinameIndex = multinameIndex; @@ -43,6 +58,10 @@ public abstract class MultinameUsage implements Usage { } + /** + * Gets multiname index. + * @return Multiname index + */ public int getMultinameIndex() { return multinameIndex; } @@ -52,6 +71,11 @@ public abstract class MultinameUsage implements Usage { return abc; } + /** + * Checks if this multiname name is the same as other multiname name. + * @param other Other multiname usage + * @return True if names are the same + */ protected boolean sameMultinameName(MultinameUsage other) { Multiname thisM = abc.constants.getMultiname(multinameIndex); Multiname otherM = other.abc.constants.getMultiname(other.multinameIndex); @@ -126,6 +150,11 @@ public abstract class MultinameUsage implements Usage { return true; } + /** + * Checks if this multiname collides with other multiname. + * @param other Other multiname usage + * @return True if collides + */ public abstract boolean collides(MultinameUsage other); @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/SuperClassMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/SuperClassMultinameUsage.java index f799f5a55..0c90a1529 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/SuperClassMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/SuperClassMultinameUsage.java @@ -26,8 +26,18 @@ import com.jpexs.decompiler.flash.abc.types.InstanceInfo; */ public class SuperClassMultinameUsage extends MultinameUsage implements InsideClassMultinameUsageInterface { + /** + * Class index + */ private final int classIndex; + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param classIndex Class index + * @param scriptIndex Script index + */ public SuperClassMultinameUsage(ABC abc, int multinameIndex, int classIndex, int scriptIndex) { super(abc, multinameIndex, scriptIndex); this.classIndex = classIndex; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/SuperInterfaceMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/SuperInterfaceMultinameUsage.java index b8d24d524..315eafe59 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/SuperInterfaceMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/SuperInterfaceMultinameUsage.java @@ -26,8 +26,18 @@ import com.jpexs.decompiler.flash.abc.types.InstanceInfo; */ public class SuperInterfaceMultinameUsage extends MultinameUsage implements InsideClassMultinameUsageInterface { + /** + * Class index + */ private final int classIndex; + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param classIndex Class index + * @param scriptIndex Script index + */ public SuperInterfaceMultinameUsage(ABC abc, int multinameIndex, int classIndex, int scriptIndex) { super(abc, multinameIndex, scriptIndex); this.classIndex = classIndex; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/TraitMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/TraitMultinameUsage.java index fe5f218cd..03917057e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/TraitMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/TraitMultinameUsage.java @@ -29,24 +29,62 @@ import java.util.Objects; */ public abstract class TraitMultinameUsage extends MultinameUsage implements InsideClassMultinameUsageInterface { + /** + * Trait index + */ protected final int traitIndex; + /** + * Traits type - class + */ public static final int TRAITS_TYPE_CLASS = 1; + /** + * Traits type - instance + */ public static final int TRAITS_TYPE_INSTANCE = 2; + /** + * Traits type - script + */ public static final int TRAITS_TYPE_SCRIPT = 3; + /** + * Traits type + */ protected final int traitsType; + /** + * Class index + */ protected final int classIndex; + /** + * Script index + */ protected final int scriptIndex; + /** + * Traits + */ protected final Traits traits; + /** + * Parent trait index + */ protected final int parentTraitIndex; + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param scriptIndex Script index + * @param classIndex Class index + * @param traitIndex Trait index + * @param traitsType Traits type + * @param traits Traits + * @param parentTraitIndex Parent trait index + */ public TraitMultinameUsage(ABC abc, int multinameIndex, int scriptIndex, int classIndex, int traitIndex, int traitsType, Traits traits, int parentTraitIndex) { super(abc, multinameIndex, scriptIndex); this.scriptIndex = scriptIndex; @@ -126,22 +164,42 @@ public abstract class TraitMultinameUsage extends MultinameUsage implements Insi return classIndex; } + /** + * Gets trait index. + * @return Trait index + */ public int getTraitIndex() { return traitIndex; } + /** + * Gets traits type. + * @return Traits type + */ public int getTraitsType() { return traitsType; } + /** + * Gets class index. + * @return Class index + */ public int getScriptIndex() { return scriptIndex; } + /** + * Gets traits. + * @return Traits + */ public Traits getTraits() { return traits; } + /** + * Gets parent trait index. + * @return Parent trait index + */ public int getParentTraitIndex() { return parentTraitIndex; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/TypeNameMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/TypeNameMultinameUsage.java index 4eb3447f4..03cd7cfee 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/TypeNameMultinameUsage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/multinames/TypeNameMultinameUsage.java @@ -26,8 +26,18 @@ import java.util.ArrayList; */ public class TypeNameMultinameUsage extends MultinameUsage { + /** + * Type name index + */ protected int typename_index; + /** + * Constructor. + * @param abc ABC + * @param multinameIndex Multiname index + * @param typename_index Type name index + * @param scriptIndex Script index + */ public TypeNameMultinameUsage(ABC abc, int multinameIndex, int typename_index, int scriptIndex) { super(abc, multinameIndex, scriptIndex); this.typename_index = typename_index; @@ -71,6 +81,10 @@ public class TypeNameMultinameUsage extends MultinameUsage { return false; } + /** + * Get type name index. + * @return Type name index + */ public int getTypenameIndex() { return typename_index; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/BrokenScriptDetector.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/BrokenScriptDetector.java index d53535df8..dd3caa665 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/BrokenScriptDetector.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/BrokenScriptDetector.java @@ -23,6 +23,19 @@ package com.jpexs.decompiler.flash.action.deobfuscation; */ public class BrokenScriptDetector { + /** + * Constructor. + */ + public BrokenScriptDetector() { + + } + + /** + * Checks if the code is broken. + * + * @param code Code + * @return True if the code is broken + */ public boolean codeIsBroken(String code) { return code.contains("\u00A7\u00A7"); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParsedSymbol.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParsedSymbol.java index 853587ab5..251770cc3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParsedSymbol.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParsedSymbol.java @@ -23,54 +23,128 @@ package com.jpexs.decompiler.flash.action.parser.pcode; */ public class ASMParsedSymbol { + /** + * Position + */ public int pos; + /** + * Type + */ public int type; + /** + * Value + */ public Object value; + /** + * Type: String + */ public static final int TYPE_STRING = 1; + /** + * Type: Block end + */ public static final int TYPE_BLOCK_END = 2; + /** + * Type: Instruction name + */ public static final int TYPE_INSTRUCTION_NAME = 3; + /** + * Type: Integer + */ public static final int TYPE_INTEGER = 4; + /** + * Type: Float + */ public static final int TYPE_FLOAT = 5; + /** + * Type: Boolean + */ public static final int TYPE_BOOLEAN = 11; + /** + * Type: Identifier + */ public static final int TYPE_IDENTIFIER = 6; + /** + * Type: End of file + */ public static final int TYPE_EOF = 7; + /** + * Type: Label + */ public static final int TYPE_LABEL = 8; + /** + * Type: Comment + */ public static final int TYPE_COMMENT = 9; + /** + * Type: Block start + */ public static final int TYPE_BLOCK_START = 10; + /** + * Type: Register + */ public static final int TYPE_REGISTER = 12; + /** + * Type: Constant + */ public static final int TYPE_CONSTANT = 13; + /** + * Type: Null + */ public static final int TYPE_NULL = 14; + /** + * Type: Undefined + */ public static final int TYPE_UNDEFINED = 15; + /** + * Type: End of line + */ public static final int TYPE_EOL = 16; + /*** + * Type: Constant literal + */ public static final int TYPE_CONSTANT_LITERAL = 17; + /*** + * Type: Comma + */ public static final int TYPE_COMMA = 18; + /** + * Constructor. + * @param pos Position + * @param type Type + * @param value Value + */ public ASMParsedSymbol(int pos, int type, Object value) { this.pos = pos; this.type = type; this.value = value; } + /** + * Constructor. + * @param pos Position + * @param type Type + */ public ASMParsedSymbol(int pos, int type) { this.pos = pos; this.type = type; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java index 660096caf..1cf559f44 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java @@ -146,6 +146,12 @@ public class ASMParser { private static final Logger logger = Logger.getLogger(ASMParser.class.getName()); + /** + * Constructor. + */ + public ASMParser() { + } + private static Action parseAction(String instructionName, FlasmLexer lexer, List constantPool, int version, String charset) throws IOException, ActionParseException { Action a = null; if (instructionName.compareToIgnoreCase("GetURL") == 0) { @@ -398,6 +404,20 @@ public class ASMParser { } } + /** + * Parses ActionScript 1-2. + * @param ignoreNops Ignore NOPs + * @param labels Labels + * @param lineMap Line map + * @param address Address + * @param lexer Lexer + * @param constantPool Constant pool + * @param version Version + * @param charset Charset + * @return Action list + * @throws IOException On I/O error + * @throws ActionParseException On parse error + */ public static ActionList parse(boolean ignoreNops, List