format code: blank lines

This commit is contained in:
2015-01-18 21:32:37 +01:00
parent 6ffcca82e7
commit ade56d45a2
640 changed files with 12702 additions and 3882 deletions
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
/**
@@ -22,8 +23,11 @@ package com.jpexs.decompiler.flash;
public interface AbortRetryIgnoreHandler {
public static int UNDEFINED = -1;
public static int ABORT = 0;
public static int RETRY = 1;
public static int IGNORE = 2;
public int handle(Throwable thrown);
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import java.util.ResourceBundle;
@@ -33,5 +34,4 @@ public class AppResources {
ResourceBundle b = ResourceBundle.getBundle(bundle);
return b.getString(key);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import java.io.IOException;
@@ -25,19 +26,33 @@ import java.util.Properties;
public class ApplicationInfo {
public static final String APPLICATION_NAME = "JPEXS Free Flash Decompiler";
public static final String SHORT_APPLICATION_NAME = "FFDec";
public static final String VENDOR = "JPEXS";
public static String version = "";
public static String revision = "";
public static int version_major = 4;
public static int version_minor = 0;
public static int version_release = 0;
public static int version_build = 0;
public static boolean nightly = false;
public static String applicationVerName;
public static String shortApplicationVerName;
public static final String PROJECT_PAGE = "http://www.free-decompiler.com/flash";
public static String updatePageStub = "http://www.free-decompiler.com/flash/update.html?currentVersion=";
public static String updatePage;
static {
@@ -67,5 +82,4 @@ public class ApplicationInfo {
updatePage = updatePageStub + version;
shortApplicationVerName = SHORT_APPLICATION_NAME + " v." + version;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
/**
@@ -20,5 +21,4 @@ package com.jpexs.decompiler.flash;
* @author JPEXS
*/
public abstract class BaseLocalData {
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import com.jpexs.decompiler.flash.abc.RenameType;
@@ -36,15 +37,21 @@ import java.util.regex.Pattern;
public class IdentifiersDeobfuscation {
private final Random rnd = new Random();
private final int DEFAULT_FOO_SIZE = 10;
public HashSet<String> allVariableNamesStr = new HashSet<>();
private final HashMap<String, Integer> typeCounts = new HashMap<>();
public static final String VALID_FIRST_CHARACTERS = "\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}_$";
public static final String VALID_NEXT_CHARACTERS = VALID_FIRST_CHARACTERS + "\\p{Nl}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}";
public static final Pattern IDENTIFIER_PATTERN = Pattern.compile("^[" + VALID_FIRST_CHARACTERS + "][" + VALID_NEXT_CHARACTERS + "]*$");
public static final String FOO_CHARACTERS = "bcdfghjklmnpqrstvwz";
public static final String FOO_JOIN_CHARACTERS = "aeiouy";
// http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000477.html
@@ -68,10 +75,11 @@ public class IdentifiersDeobfuscation {
"interface", "internal", "is", "new", "null", "package", "private", "protected", "public",
"return", "super", "switch", "this", "throw",
// is "to" really a keyword? documentation says yes, but I can create "to" variable...
// "to",
// "to",
"true", "try", "typeof", "use", "var",
"void", "while", "with"
};
//syntactic keywords - can be used as identifiers, but that have special meaning in certain contexts
public static final String[] syntacticKeywordsAS3 = {"each", "get", "set", "namespace", "include", "dynamic", "final", "native", "override", "static"};
@@ -290,6 +298,7 @@ public class IdentifiersDeobfuscation {
}
private static final Cache<String, String> as3NameCache = Cache.getInstance(false, "as3_ident");
private static final Cache<String, String> as2NameCache = Cache.getInstance(false, "as2_ident");
/**
@@ -1,23 +1,25 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
public abstract class ParseException extends Exception {
public long line;
public String text;
public ParseException(String text, long line) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import java.io.IOException;
@@ -24,7 +25,9 @@ import java.io.IOException;
public class RetryTask {
private final RunnableIOEx r;
private final AbortRetryIgnoreHandler handler;
public Object result;
public RetryTask(RunnableIOEx r, AbortRetryIgnoreHandler handler) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import java.io.IOException;
@@ -74,5 +75,4 @@ public class SWC extends ZippedSWFBundle {
public String getExtension() {
return "swc";
}
}
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -215,50 +215,63 @@ public final class SWF implements SWFContainerItem, Timelined {
* Default version of SWF file format
*/
public static final int DEFAULT_VERSION = 10;
/**
* Tags inside of file
*/
public List<Tag> tags = new ArrayList<>();
@Internal
public boolean hasEndTag;
/**
* ExportRectangle for the display
*/
public RECT displayRect;
/**
* Movie frame rate
*/
public int frameRate;
/**
* Number of frames in movie
*/
public int frameCount;
/**
* Version of SWF
*/
public int version;
/**
* Uncompressed size of the file
*/
@Internal
public long fileSize;
/**
* Used compression mode
*/
public SWFCompression compression = SWFCompression.NONE;
/**
* Compressed size of the file (LZMA)
*/
@Internal
public long compressedSize;
/**
* LZMA Properties
*/
public byte[] lzmaProperties;
@Internal
public byte[] uncompressedData;
@Internal
public byte[] originalUncompressedData;
/**
* ScaleForm GFx
*/
@@ -266,19 +279,27 @@ public final class SWF implements SWFContainerItem, Timelined {
@Internal
public SWFList swfList;
@Internal
public String file;
@Internal
public String fileTitle;
@Internal
private Map<Integer, CharacterTag> characters;
@Internal
private List<ABCContainerTag> abcList;
@Internal
private JPEGTablesTag jtt;
@Internal
public Map<Integer, String> sourceFontNamesMap = new HashMap<>();
public static final double unitDivisor = 20;
private static final Logger logger = Logger.getLogger(SWF.class.getName());
@Internal
@@ -286,25 +307,29 @@ public final class SWF implements SWFContainerItem, Timelined {
@Internal
public DumpInfoSwfNode dumpInfo;
@Internal
public DefineBinaryDataTag binaryData;
@Internal
private final HashMap<String, String> deobfuscated = new HashMap<>();
@Internal
private final IdentifiersDeobfuscation deobfuscation = new IdentifiersDeobfuscation();
@Internal
private static Cache<String, SerializableImage> frameCache = Cache.getInstance(false, "frame");
@Internal
private final Cache<ASMSource, CachedScript> as2Cache = Cache.getInstance(true, "as2");
@Internal
private final Cache<ScriptPack, CachedDecompilation> as3Cache = Cache.getInstance(true, "as3");
public void updateCharacters() {
characters = null;
}
public Map<Integer, CharacterTag> getCharacters() {
if (characters == null) {
synchronized (this) {
@@ -315,10 +340,10 @@ public final class SWF implements SWFContainerItem, Timelined {
}
}
}
return characters;
}
public CharacterTag getCharacter(int characterId) {
return getCharacters().get(characterId);
}
@@ -336,7 +361,7 @@ public final class SWF implements SWFContainerItem, Timelined {
return abcList;
}
public boolean isAS3() {
FileAttributesTag fileAttributes = getFileAttributes();
return (fileAttributes != null && fileAttributes.actionScript3) || (fileAttributes == null && !getAbcList().isEmpty());
@@ -348,7 +373,7 @@ public final class SWF implements SWFContainerItem, Timelined {
return (FileAttributesTag) t;
}
}
return null;
}
@@ -379,7 +404,7 @@ public final class SWF implements SWFContainerItem, Timelined {
return jtt;
}
public String getDocumentClass() {
for (Tag t : tags) {
if (t instanceof SymbolClassTag) {
@@ -391,10 +416,10 @@ public final class SWF implements SWFContainerItem, Timelined {
}
}
}
return null;
}
public void fixCharactersOrder(boolean checkAll) {
Set<Integer> addedCharacterIds = new HashSet<>();
Set<CharacterTag> movedTags = new HashSet<>();
@@ -638,7 +663,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
return false;
}
public void clearModified() {
for (Tag tag : tags) {
if (tag.isModified()) {
@@ -658,9 +683,9 @@ public final class SWF implements SWFContainerItem, Timelined {
}
public SWF() {
}
public SWF(InputStream is, boolean parallelRead) throws IOException, InterruptedException {
this(is, null, parallelRead, false);
}
@@ -920,7 +945,7 @@ public final class SWF implements SWFContainerItem, Timelined {
header.compression = SWFCompression.ZLIB;
break;
}
case 'Z': { // ZWS
case 'Z': { // ZWS
byte lzmaprop[] = new byte[9];
is.read(lzmaprop);
sis = new SWFInputStream(null, lzmaprop);
@@ -1025,14 +1050,23 @@ public final class SWF implements SWFContainerItem, Timelined {
private class ExportPackTask implements Callable<File> {
ScriptPack pack;
String directory;
ScriptExportMode exportMode;
ClassPath path;
AtomicInteger index;
int count;
boolean parallel;
AbortRetryIgnoreHandler handler;
long startTime;
long stopTime;
public ExportPackTask(AbortRetryIgnoreHandler handler, AtomicInteger index, int count, ClassPath path, ScriptPack pack, String directory, ScriptExportMode exportMode, boolean parallel) {
@@ -1178,7 +1212,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
}
}
private static void addASM(Map<String, ASMSource> asms, ASMSource asm, String path) {
String npath = path;
int ppos = 1;
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
@@ -22,5 +23,4 @@ import com.jpexs.decompiler.flash.treeitems.TreeItem;
* @author JPEXS
*/
public interface SWFContainerItem extends TreeItem {
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
/**
@@ -45,5 +46,4 @@ public class SWFHeader {
* ScaleForm GFx
*/
public boolean gfx = false;
}
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -293,11 +293,17 @@ import java.util.zip.InflaterInputStream;
public class SWFInputStream implements AutoCloseable {
private MemoryInputStream is;
private long startingPos;
private static final Logger logger = Logger.getLogger(SWFInputStream.class.getName());
private final List<ProgressListener> listeners = new ArrayList<>();
private long percentMax;
private SWF swf;
public DumpInfo dumpInfo;
public void addPercentListener(ProgressListener listener) {
@@ -848,7 +854,9 @@ public class SWFInputStream implements AutoCloseable {
endDumpLevel(result);
return result;
}
private int bitPos = 0;
private int tempByte = 0;
/**
@@ -1000,9 +1008,13 @@ public class SWFInputStream implements AutoCloseable {
private class TagResolutionTask implements Callable<Tag> {
private final TagStub tag;
private final DumpInfo dumpInfo;
private final int level;
private final boolean parallel;
private final boolean skipUnusualTags;
public TagResolutionTask(TagStub tag, DumpInfo dumpInfo, int level, boolean parallel, boolean skipUnusualTags) {
@@ -1244,7 +1256,7 @@ public class SWFInputStream implements AutoCloseable {
case 26:
ret = new PlaceObject2Tag(sis, data);
break;
//case 27:
//case 27:
case 28:
ret = new RemoveObject2Tag(sis, data);
break;
@@ -2893,7 +2905,7 @@ public class SWFInputStream implements AutoCloseable {
public MORPHGRADIENT readMORPHGRADIENT(String name) throws IOException {
MORPHGRADIENT ret = new MORPHGRADIENT();
newDumpLevel(name, "MORPHGRADIENT");
// Despite of documentation (UI8 1-8), there are two fields
// Despite of documentation (UI8 1-8), there are two fields
// spreadMode and interPolationMode which are same as in GRADIENT
ret.spreadMode = (int) readUB(2, "spreadMode");
ret.interPolationMode = (int) readUB(2, "interPolationMode");
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import com.jpexs.decompiler.flash.configuration.Configuration;
@@ -91,9 +92,13 @@ import java.util.zip.DeflaterOutputStream;
public class SWFOutputStream extends OutputStream {
private final OutputStream os;
private final int version;
private long pos = 0;
private int bitPos = 0;
private int tempByte = 0;
public long getPos() {
@@ -1551,7 +1556,7 @@ public class SWFOutputStream extends OutputStream {
* @throws IOException
*/
public void writeMORPHGRADIENT(MORPHGRADIENT value, int shapeNum) throws IOException {
// Despite of documentation (UI8 1-8), there are two fields
// Despite of documentation (UI8 1-8), there are two fields
// spreadMode and interPolationMode which are same as in GRADIENT
writeUB(2, value.spreadMode);
writeUB(2, value.interPolationMode);
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import com.jpexs.helpers.Helper;
@@ -34,10 +35,15 @@ import java.util.Set;
public class SWFSearch {
protected Searchable s;
private final boolean noCheck;
private final SearchMode searchMode;
private boolean processed = false;
private final Set<ProgressListener> listeners = new HashSet<>();
private final Map<Long, MemoryInputStream> swfStreams = new HashMap<>();
public SWFSearch(Searchable s, boolean noCheck, SearchMode searchMode) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import com.jpexs.helpers.Path;
@@ -29,7 +30,9 @@ import java.io.InputStream;
public class SWFSourceInfo {
private final InputStream inputStream;
private String file;
private final String fileTitle;
public SWFSourceInfo(InputStream inputStream, String file, String fileTitle) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import com.jpexs.decompiler.flash.abc.types.ABCException;
@@ -32,23 +33,38 @@ import java.util.Map;
public class SourceGeneratorLocalData implements Serializable {
public HashMap<String, Integer> registerVars;
public Integer inFunction;
public Boolean inMethod;
public Integer forInLevel;
// TODO: handle AVM2 separately
public List<ABCException> exceptions = new ArrayList<>();
public List<Integer> finallyCatches = new ArrayList<>();
public Map<Integer, Integer> finallyCounter = new HashMap<>();
public int finallyRegister = -1;
public String currentClass;
public int activationReg = 0;
public List<MethodBody> callStack = new ArrayList<>();
public Map<MethodBody, List<Integer>> traitUsages = new HashMap<>();
public String pkg = "";
public List<GraphTargetItem> scopeStack = new ArrayList<>();
public boolean documentClass;
public ScriptInfo currentScript;
public boolean subMethod = false;
public String getFullClass() {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import java.util.HashMap;
@@ -26,17 +27,30 @@ import java.util.Map;
public class Version {
public int versionId;
public String revision;
public String versionName;
public String longVersionName;
public String releaseDate;
public String appName;
public String appFullName;
public String updateLink;
public int major;
public int minor;
public int release;
public int build;
public boolean nightly;
public Map<String, List<String>> changes = new HashMap<>();
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash;
import com.jpexs.helpers.Helper;
@@ -37,7 +38,9 @@ import java.util.zip.ZipInputStream;
public class ZippedSWFBundle implements SWFBundle {
protected Set<String> keySet = new HashSet<>();
private final Map<String, SeekableInputStream> cachedSWFs = new HashMap<>();
protected ReReadableInputStream is;
public ZippedSWFBundle(InputStream is) {
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -75,20 +75,35 @@ import java.util.logging.Logger;
public class ABC {
public int major_version = 46;
public int minor_version = 16;
public AVM2ConstantPool constants = new AVM2ConstantPool();
public List<MethodInfo> method_info = new ArrayList<>();
public List<MetadataInfo> metadata_info = new ArrayList<>();
public List<InstanceInfo> instance_info = new ArrayList<>();
public List<ClassInfo> class_info = new ArrayList<>();
public List<ScriptInfo> script_info = new ArrayList<>();
public List<MethodBody> bodies = new ArrayList<>();
private Map<Integer, Integer> bodyIdxFromMethodIdx;
private long[] stringOffsets;
public static final int MINORwithDECIMAL = 17;
protected Set<EventListener> listeners = new HashSet<>();
private static final Logger logger = Logger.getLogger(ABC.class.getName());
private AVM2Deobfuscation deobfuscation;
@Internal
public ABCContainerTag parentTag;
@@ -109,7 +124,6 @@ public class ABC {
public SWF getSwf() {
return parentTag.getSwf();
}
public List<ABCContainerTag> getAbcTags() {
return getSwf().getAbcList();
@@ -258,7 +272,7 @@ public class ABC {
Set<Integer> stringUsages = getStringUsages();
Set<Integer> namespaceUsages = getNsStringUsages();
int strIndex = constants.getMultiname(multinameIndex).name_index;
if (stringUsages.contains(strIndex) || namespaceUsages.contains(strIndex)) { // name is used elsewhere as string literal
if (stringUsages.contains(strIndex) || namespaceUsages.contains(strIndex)) { // name is used elsewhere as string literal
strIndex = constants.getStringId(newname, true);
constants.getMultiname(multinameIndex).name_index = strIndex;
} else {
@@ -361,7 +375,7 @@ public class ABC {
}
if (constant_int_pool_count > 1) {
ais.newDumpLevel("integers", "integer[]");
for (int i = 1; i < constant_int_pool_count; i++) { // index 0 not used. Values 1..n-1
for (int i = 1; i < constant_int_pool_count; i++) { // index 0 not used. Values 1..n-1
constants.addInt(ais.readS32("int"));
}
ais.endDumpLevel();
@@ -560,9 +574,9 @@ public class ABC {
SWFDecompilerPlugin.fireMethodBodyParsed(mb, swf);
}
/*for(int i=0;i<script_count;i++){
MethodBody bod=bodies.get(bodyIdxFromMethodIdx.get(script_info.get(i).init_index));
MethodBody bod=bodies.get(bodyIdxFromMethodIdx.get(script_info.get(i).init_index));
GraphTextWriter t=new HighlightedTextWriter(Configuration.getCodeFormatting(),false);
try {
bod.toString("script", ScriptExportMode.PCODE, this, null, constants, method_info, t, new ArrayList<String>());
@@ -572,7 +586,6 @@ public class ABC {
System.out.println(""+t.toString());
}
//System.exit(0);*/
SWFDecompilerPlugin.fireAbcParsed(this, swf);
}
@@ -809,18 +822,18 @@ public class ABC {
}
namespaceMap = map;
}
return namespaceMap;
}
private AVM2Deobfuscation getDeobfuscation() {
if (deobfuscation == null) {
deobfuscation = new AVM2Deobfuscation(constants);
}
return deobfuscation;
}
private Map<Integer, Integer> getBodyIdxFromMethodIdx() {
if (bodyIdxFromMethodIdx == null) {
Map<Integer, Integer> map = new HashMap<>(bodies.size());
@@ -828,10 +841,10 @@ public class ABC {
MethodBody mb = bodies.get(i);
map.put(mb.method_info, i);
}
bodyIdxFromMethodIdx = map;
}
return bodyIdxFromMethodIdx;
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc;
import com.jpexs.decompiler.flash.EndOfStreamException;
@@ -39,10 +40,15 @@ import java.util.List;
public class ABCInputStream implements AutoCloseable {
private static final int CLASS_PROTECTED_NS = 8;
private static final int ATTR_METADATA = 4;
private final MemoryInputStream is;
private ByteArrayOutputStream bufferOs = null;
public static final boolean DEBUG_READ = false;
public DumpInfo dumpInfo;
public void startBuffer() {
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -35,22 +35,39 @@ import java.util.List;
public class AVM2LocalData extends BaseLocalData {
public Boolean isStatic;
public Integer classIndex;
public HashMap<Integer, GraphTargetItem> localRegs;
public ScopeStack scopeStack;
public AVM2ConstantPool constants;
public List<MethodInfo> methodInfo;
public MethodBody methodBody;
public ABC abc;
public HashMap<Integer, String> localRegNames;
public List<String> fullyQualifiedNames;
public ArrayList<ABCException> parsedExceptions;
public ArrayList<Integer> finallyJumps;
public ArrayList<Integer> ignoredSwitches;
public Integer scriptIndex;
public HashMap<Integer, Integer> localRegAssignmentIps;
public Integer ip;
public HashMap<Integer, List<Integer>> refs;
public AVM2Code code;
public AVM2LocalData() {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc;
import com.jpexs.decompiler.flash.helpers.HighlightedText;
@@ -27,10 +28,15 @@ import java.util.List;
public class CachedDecompilation implements Serializable {
public String text;
public List<Highlighting> traitHilights;
public List<Highlighting> classHilights;
public List<Highlighting> methodHilights;
public List<Highlighting> instructionHilights;
public List<Highlighting> specialHilights;
public List<Highlighting> getInstructionHighlights() {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc;
import java.util.Objects;
@@ -24,6 +25,7 @@ import java.util.Objects;
public class ClassPath {
public String packageStr;
public String className;
public ClassPath(String packageStr, String className) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc;
import java.io.IOException;
@@ -22,11 +23,17 @@ import java.io.OutputStream;
public class CopyOutputStream extends OutputStream {
private final OutputStream os;
private final InputStream is;
private long pos = 0;
private final int TEMPSIZE = 5;
private final int[] temp = new int[TEMPSIZE];
private int tempPos = 0;
public int ignoreFirst = 0;
public CopyOutputStream(OutputStream os, InputStream is) {
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -48,8 +48,11 @@ import java.util.logging.Logger;
public class ScriptPack extends AS3ClassTreeItem {
public final ABC abc;
public final int scriptIndex;
public final List<Integer> traitIndices;
private final ClassPath path;
@Override
@@ -228,5 +231,4 @@ public class ScriptPack extends AS3ClassTreeItem {
}
return true;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.EndOfStreamException;
@@ -253,34 +254,63 @@ import java.util.logging.Logger;
public class AVM2Code implements Cloneable {
private static final Logger logger = Logger.getLogger(AVM2Code.class.getName());
private static final boolean DEBUG_MODE = false;
public static int toSourceLimit = -1;
public List<AVM2Instruction> code = new ArrayList<>();
public static boolean DEBUG_REWRITE = false;
public static final int OPT_U30 = 0x100;
public static final int OPT_U8 = 0x200;
public static final int OPT_S24 = 0x300;
public static final int OPT_CASE_OFFSETS = 0x400;
public static final int OPT_BYTE = 0x500;
public static final int DAT_MULTINAME_INDEX = OPT_U30 + 0x01;
public static final int DAT_ARG_COUNT = OPT_U30 + 0x02;
public static final int DAT_METHOD_INDEX = OPT_U30 + 0x03;
public static final int DAT_STRING_INDEX = OPT_U30 + 0x04;
public static final int DAT_DEBUG_TYPE = OPT_U8 + 0x05;
public static final int DAT_REGISTER_INDEX = OPT_U8 + 0x06;
public static final int DAT_LINENUM = OPT_U30 + 0x07;
public static final int DAT_LOCAL_REG_INDEX = OPT_U30 + 0x08;
public static final int DAT_SLOT_INDEX = OPT_U30 + 0x09;
public static final int DAT_SLOT_SCOPE_INDEX = OPT_U30 + 0x0A;
public static final int DAT_OFFSET = OPT_S24 + 0x0B;
public static final int DAT_EXCEPTION_INDEX = OPT_U30 + 0x0C;
public static final int DAT_CLASS_INDEX = OPT_U30 + 0x0D;
public static final int DAT_INT_INDEX = OPT_U30 + 0x0E;
public static final int DAT_UINT_INDEX = OPT_U30 + 0x0F;
public static final int DAT_DOUBLE_INDEX = OPT_U30 + 0x10;
public static final int DAT_DECIMAL_INDEX = OPT_U30 + 0x11;
public static final int DAT_CASE_BASEOFFSET = OPT_S24 + 0x12;
public static final int DAT_DECIMAL_PARAMS = OPT_U30 + 0x13;
public static InstructionDefinition[] instructionSet = new InstructionDefinition[]{
new AddIns(),
new InstructionDefinition(0x9b, "add_d", new int[]{}) {
@@ -725,8 +755,9 @@ public class AVM2Code implements Cloneable {
}
};
// endoflist
public static InstructionDefinition[] instructionSetByCode = buildInstructionSetByCode();
public boolean hideTemporaryRegisters = true;
private static InstructionDefinition[] buildInstructionSetByCode() {
@@ -739,7 +770,9 @@ public class AVM2Code implements Cloneable {
}
return result;
}
public static final String IDENTOPEN = "/*IDENTOPEN*/";
public static final String IDENTCLOSE = "/*IDENTCLOSE*/";
public AVM2Code() {
@@ -1178,7 +1211,9 @@ public class AVM2Code implements Cloneable {
}
return writer;
}
private boolean cacheActual = false;
private List<Long> posCache;
private void buildCache() {
@@ -1213,8 +1248,11 @@ public class AVM2Code implements Cloneable {
public void invalidateCache() {
cacheActual = false;
}
private List<Integer> unknownJumps;
private List<Integer> ignoredIns;
boolean isCatched = false;
/**
@@ -1236,6 +1274,7 @@ public class AVM2Code implements Cloneable {
}
return false;
}
private int toSourceCount = 0;
public Map<Integer, String> getLocalRegNamesFromDebug(ABC abc) {
@@ -1623,6 +1662,7 @@ public class AVM2Code implements Cloneable {
private class Slot {
public GraphTargetItem scope;
public Multiname multiname;
public Slot(GraphTargetItem scope, Multiname multiname) {
@@ -1719,7 +1759,7 @@ public class AVM2Code implements Cloneable {
for(int reg:nowdeclaredRegs){
declaredRegisters[reg] = false;
}
for(Slot s:nowdeclaredSlots){
declaredSlots.remove(s);
}*/
@@ -1784,7 +1824,7 @@ public class AVM2Code implements Cloneable {
return list;
}
}
// Declarations
// Declarations
injectDeclarations(list, new boolean[regCount], new ArrayList<Slot>(), abc, body);
int lastPos = list.size() - 1;
@@ -2322,6 +2362,7 @@ public class AVM2Code implements Cloneable {
private static class ControlFlowTag {
public String name;
public int value;
public ControlFlowTag(String name, int value) {
@@ -2551,8 +2592,11 @@ public class AVM2Code implements Cloneable {
private static class Decision {
public boolean jumpUsed = false;
public boolean skipUsed = false;
public Set<Integer> casesUsed = new HashSet<>();
HashMap<Integer, GraphTargetItem> registers = new HashMap<>();
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.abc.types.Decimal;
@@ -28,14 +29,22 @@ import java.util.logging.Logger;
public class AVM2ConstantPool {
private static final Logger logger = Logger.getLogger(AVM2ConstantPool.class.getName());
public List<Long> constant_int = new ArrayList<>();
public List<Long> constant_uint = new ArrayList<>();
public List<Double> constant_double = new ArrayList<>();
/* Only for some minor versions */
public List<Decimal> constant_decimal = new ArrayList<>();
public List<String> constant_string = new ArrayList<>();
public List<Namespace> constant_namespace = new ArrayList<>();
public List<NamespaceSet> constant_namespace_set = new ArrayList<>();
public List<Multiname> constant_multiname = new ArrayList<>();
public synchronized int addInt(long value) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.abc.RenameType;
@@ -30,6 +31,7 @@ import java.util.regex.Pattern;
public class AVM2Deobfuscation {
private static final Random rnd = new Random();
private static final int DEFAULT_FOO_SIZE = 10;
public static final String[] reservedWords = {
@@ -38,13 +40,19 @@ public class AVM2Deobfuscation {
"interface", "internal", "is", "native", "new", "null", "override", "package", "private", "protected", "public",
"return", "set", "super", "switch", "this", "throw", "true", "try", "typeof", "use", "var", /*"void",*/ "while",
"with", "dynamic", "default", "final", "in", "static"};
public static final String VALID_FIRST_CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
public static final String VALID_NEXT_CHARACTERS = VALID_FIRST_CHARACTERS + "0123456789";
public static final String VALID_NS_CHARACTERS = ".:$";
public static final String FOO_CHARACTERS = "bcdfghjklmnpqrstvwz";
public static final String FOO_JOIN_CHARACTERS = "aeiouy";
private final AVM2ConstantPool constants;
private final Map<String, Integer> usageTypesCount = new HashMap<>();
public AVM2Deobfuscation(AVM2ConstantPool constants) {
@@ -241,5 +249,4 @@ public class AVM2Deobfuscation {
}
return strIndex;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -27,11 +28,17 @@ import java.util.List;
public class CodeStats {
public int maxstack = 0;
public int maxscope = 0;
public int maxlocal = 1;
public int initscope = 0;
public boolean has_set_dxns = false;
public boolean has_activation = false;
public InstructionStats[] instructionStats;
public GraphTextWriter toString(GraphTextWriter writer, ABC abc, List<String> fullyQualifiedNames) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.graph.GraphTargetItem;
@@ -26,6 +27,7 @@ import java.util.List;
public class ConvertOutput {
public TranslateStack stack;
public List<GraphTargetItem> output;
public ConvertOutput(TranslateStack stack, List<GraphTargetItem> output) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -24,10 +25,15 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
public class InstructionStats {
public boolean seen = false;
public int stackpos = 0;
public int scopepos = 0;
public int stackpos_after = 0;
public int scopepos_after = 0;
public AVM2Instruction ins;
public InstructionStats(AVM2Instruction ins) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2;
import java.util.HashMap;
@@ -21,6 +22,8 @@ import java.util.Stack;
public class LocalDataArea {
public Stack<Object> operandStack = new Stack<>();
public Stack<Object> scopeStack = new Stack<>();
public HashMap<Integer, Object> localRegisters = new HashMap<>();
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.graph.GraphTargetItem;
@@ -22,7 +23,9 @@ import java.util.List;
public class UnknownJumpException extends RuntimeException {
public TranslateStack stack;
public int ip;
public List<GraphTargetItem> output;
public UnknownJumpException(TranslateStack stack, int ip, List<GraphTargetItem> output) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.graph;
import com.jpexs.decompiler.flash.BaseLocalData;
@@ -80,7 +81,9 @@ import java.util.List;
public class AVM2Graph extends Graph {
private final AVM2Code avm2code;
private final ABC abc;
private final MethodBody body;
public AVM2Code getCode() {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.graph;
import com.jpexs.decompiler.flash.BaseLocalData;
@@ -38,16 +39,27 @@ import java.util.List;
public class AVM2GraphSource extends GraphSource {
private final AVM2Code code;
boolean isStatic;
int classIndex;
int scriptIndex;
HashMap<Integer, GraphTargetItem> localRegs;
ScopeStack scopeStack;
ABC abc;
MethodBody body;
HashMap<Integer, String> localRegNames;
List<String> fullyQualifiedNames;
HashMap<Integer, Integer> localRegAssigmentIps;
HashMap<Integer, List<Integer>> refs;
public AVM2Code getCode() {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.BaseLocalData;
@@ -42,11 +43,17 @@ import java.util.List;
public class AVM2Instruction implements Cloneable, GraphSourceItem {
public InstructionDefinition definition;
public int[] operands;
public long offset;
public String comment;
public boolean ignored = false;
public long mappedOffset = -1;
public int changeJumpTo = -1;
public AVM2Instruction(long offset, InstructionDefinition definition, int[] operands) {
@@ -277,6 +284,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
s += getParams(constants, fullyQualifiedNames) + getComment();
return s;
}
public List<Object> replaceWith;
@Override
@@ -354,6 +362,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
public void setFixBranch(int pos) {
this.fixedBranch = pos;
}
private int fixedBranch = -1;
public int getFixBranch() {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -44,7 +45,9 @@ public class InstructionDefinition implements Serializable {
public static final long serialVersionUID = 1L;
public int[] operands;
public String instructionName = "";
public int instructionCode = 0;
public InstructionDefinition(int instructionCode, String instructionName, int[] operands) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -47,5 +48,4 @@ public class GetLexIns extends InstructionDefinition {
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -48,5 +49,4 @@ public class HasNext2Ins extends InstructionDefinition {
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.IdentifiersDeobfuscation;
@@ -35,6 +36,7 @@ import java.util.List;
public abstract class AVM2Item extends GraphTargetItem {
public AVM2Instruction instruction;
public boolean hidden = false;
public AVM2Item(GraphSourceItem instruction, int precedence) {
@@ -147,5 +149,4 @@ public abstract class AVM2Item extends GraphTargetItem {
AVM2SourceGenerator g = (AVM2SourceGenerator) generator;
g.killRegister(localData, regNumber);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
@@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class AlchemyLoadAVM2Item extends AVM2Item {
private final String name;
private final GraphTargetItem ofs;
public AlchemyLoadAVM2Item(GraphSourceItem instruction, GraphTargetItem ofs, String name) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
@@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class AlchemyStoreAVM2Item extends AVM2Item {
private final String name;
private final GraphTargetItem ofs;
public AlchemyStoreAVM2Item(GraphSourceItem instruction, GraphTargetItem value, GraphTargetItem ofs, String name) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -31,6 +32,7 @@ import java.util.List;
public class ApplyTypeAVM2Item extends AVM2Item {
public GraphTargetItem object;
public List<GraphTargetItem> params;
public ApplyTypeAVM2Item(AVM2Instruction instruction, GraphTargetItem object, List<GraphTargetItem> params) {
@@ -83,5 +85,4 @@ public class ApplyTypeAVM2Item extends AVM2Item {
ins(new ApplyTypeIns(), params.size())
);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -25,7 +26,9 @@ import java.util.List;
public class CallAVM2Item extends AVM2Item {
public GraphTargetItem receiver;
public GraphTargetItem function;
public List<GraphTargetItem> arguments;
public CallAVM2Item(AVM2Instruction instruction, GraphTargetItem receiver, GraphTargetItem function, List<GraphTargetItem> arguments) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -25,7 +26,9 @@ import java.util.List;
public class CallMethodAVM2Item extends AVM2Item {
public GraphTargetItem receiver;
public String methodName;
public List<GraphTargetItem> arguments;
public CallMethodAVM2Item(AVM2Instruction instruction, GraphTargetItem receiver, String methodName, List<GraphTargetItem> arguments) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -31,8 +32,11 @@ import java.util.List;
public class CallPropertyAVM2Item extends AVM2Item {
public GraphTargetItem receiver;
public GraphTargetItem propertyName;
public List<GraphTargetItem> arguments;
public boolean isVoid;
public CallPropertyAVM2Item(AVM2Instruction instruction, boolean isVoid, GraphTargetItem receiver, GraphTargetItem propertyName, List<GraphTargetItem> arguments) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -25,7 +26,9 @@ import java.util.List;
public class CallStaticAVM2Item extends AVM2Item {
public GraphTargetItem receiver;
public String methodName;
public List<GraphTargetItem> arguments;
public CallStaticAVM2Item(AVM2Instruction instruction, GraphTargetItem receiver, String methodName, List<GraphTargetItem> arguments) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -25,8 +26,11 @@ import java.util.List;
public class CallSuperAVM2Item extends AVM2Item {
public GraphTargetItem receiver;
public GraphTargetItem multiname;
public List<GraphTargetItem> arguments;
public boolean isVoid;
public CallSuperAVM2Item(AVM2Instruction instruction, boolean isVoid, GraphTargetItem receiver, GraphTargetItem multiname, List<GraphTargetItem> arguments) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -136,5 +137,4 @@ public class CoerceAVM2Item extends AVM2Item {
}
return toSourceMerge(localData, generator, value, ins);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -24,6 +25,7 @@ import java.util.List;
public class ConstructAVM2Item extends AVM2Item {
public GraphTargetItem object;
public List<GraphTargetItem> args;
public ConstructAVM2Item(AVM2Instruction instruction, GraphTargetItem object, List<GraphTargetItem> args) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -25,7 +26,9 @@ import java.util.List;
public class ConstructPropAVM2Item extends AVM2Item {
public GraphTargetItem object;
public GraphTargetItem propertyName;
public List<GraphTargetItem> args;
public ConstructPropAVM2Item(AVM2Instruction instruction, GraphTargetItem object, GraphTargetItem propertyName, List<GraphTargetItem> args) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -30,6 +31,7 @@ import java.util.List;
public class ConstructSuperAVM2Item extends AVM2Item {
public GraphTargetItem object;
public List<GraphTargetItem> args;
public ConstructSuperAVM2Item(AVM2Instruction instruction, GraphTargetItem object, List<GraphTargetItem> args) {
@@ -71,5 +73,4 @@ public class ConstructSuperAVM2Item extends AVM2Item {
new AVM2Instruction(0, new ConstructSuperIns(), new int[]{args.size()})
);
}
}
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -61,5 +61,4 @@ public class DefaultXMLNamespace extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, ns, ins(new DXNSLateIns()));
}
}
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -60,5 +60,4 @@ public class EscapeXElemAVM2Item extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, value, ins(new EscXElemIns()));
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
@@ -28,7 +29,9 @@ import java.util.List;
public class FullMultinameAVM2Item extends AVM2Item {
public int multinameIndex;
public GraphTargetItem name;
public GraphTargetItem namespace;
public FullMultinameAVM2Item(AVM2Instruction instruction, int multinameIndex, GraphTargetItem name) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -30,8 +31,11 @@ import java.util.List;
public class GetDescendantsAVM2Item extends AVM2Item {
public GraphTargetItem object;
public GraphTargetItem multiname;
public List<Integer> openedNamespaces;
public String nameStr;
//constructor for compiler
@@ -69,5 +73,4 @@ public class GetDescendantsAVM2Item extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return ((AVM2SourceGenerator) generator).generate(localData, this);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -31,6 +32,7 @@ import java.util.List;
public class GetPropertyAVM2Item extends AVM2Item {
public GraphTargetItem object;
public GraphTargetItem propertyName;
public GetPropertyAVM2Item(AVM2Instruction instruction, GraphTargetItem object, GraphTargetItem propertyName) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -25,6 +26,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class GetSlotAVM2Item extends AVM2Item {
public Multiname slotName;
public GraphTargetItem scope;
public GetSlotAVM2Item(AVM2Instruction instruction, GraphTargetItem scope, Multiname slotName) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -24,6 +25,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class GetSuperAVM2Item extends AVM2Item {
public GraphTargetItem object;
public FullMultinameAVM2Item propertyName;
public GetSuperAVM2Item(AVM2Instruction instruction, GraphTargetItem object, FullMultinameAVM2Item propertyName) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class HasNextAVM2Item extends AVM2Item {
public GraphTargetItem object;
public GraphTargetItem collection;
public HasNextAVM2Item(AVM2Instruction instruction, GraphTargetItem object, GraphTargetItem collection) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -30,6 +31,7 @@ import java.util.List;
public class InAVM2Item extends AVM2Item {
public GraphTargetItem object;
public GraphTargetItem collection;
public InAVM2Item(AVM2Instruction instruction, GraphTargetItem object, GraphTargetItem collection) {
@@ -59,5 +61,4 @@ public class InAVM2Item extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, object, collection, ins(new InIns()));
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -25,6 +26,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class InitPropertyAVM2Item extends AVM2Item implements SetTypeAVM2Item, AssignmentAVM2Item {
public GraphTargetItem object;
public FullMultinameAVM2Item propertyName;
//public GraphTargetItem value;
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -45,7 +46,9 @@ import java.util.List;
public class InitVectorAVM2Item extends AVM2Item {
public GraphTargetItem subtype;
public List<GraphTargetItem> arguments;
List<Integer> openedNamespaces;
private int allNsSet(ABC abc) {
@@ -118,5 +121,4 @@ public class InitVectorAVM2Item extends AVM2Item {
}
return ret;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -37,8 +38,11 @@ import java.util.Set;
public class LocalRegAVM2Item extends AVM2Item {
public int regIndex;
public GraphTargetItem computedValue;
private final Object computedResult;
private boolean isCT = false;
public LocalRegAVM2Item(AVM2Instruction instruction, int regIndex, GraphTargetItem computedValue) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -64,5 +65,4 @@ public class NewArrayAVM2Item extends AVM2Item {
new AVM2Instruction(0, new NewArrayIns(), new int[]{values.size()})
);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -33,14 +34,23 @@ import java.util.List;
public class NewFunctionAVM2Item extends AVM2Item {
public String functionName;
public String path;
public boolean isStatic;
public int scriptIndex;
public int classIndex;
public ABC abc;
public List<String> fullyQualifiedNames;
public AVM2ConstantPool constants;
public List<MethodInfo> methodInfo;
public int methodIndex;
public NewFunctionAVM2Item(AVM2Instruction instruction, String functionName, String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, List<String> fullyQualifiedNames, AVM2ConstantPool constants, List<MethodInfo> methodInfo, int methodIndex) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -81,5 +82,4 @@ public class NewObjectAVM2Item extends AVM2Item {
new AVM2Instruction(0, new NewObjectIns(), new int[]{pairs.size()})
);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class NextNameAVM2Item extends AVM2Item {
GraphTargetItem index;
GraphTargetItem obj;
public NextNameAVM2Item(AVM2Instruction instruction, GraphTargetItem index, GraphTargetItem obj) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class NextValueAVM2Item extends AVM2Item {
GraphTargetItem index;
GraphTargetItem obj;
public NextValueAVM2Item(AVM2Instruction instruction, GraphTargetItem index, GraphTargetItem obj) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -73,5 +74,4 @@ public class PostIncrementAVM2Item extends AVM2Item implements AssignmentAVM2Ite
}
return new ArrayList<>(); //?
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -33,7 +34,9 @@ import java.util.List;
public class SetPropertyAVM2Item extends AVM2Item implements SetTypeAVM2Item, AssignmentAVM2Item {
public GraphTargetItem object;
public GraphTargetItem propertyName;
public GraphTargetItem value;
@Override
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -27,6 +28,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class SetSlotAVM2Item extends AVM2Item implements SetTypeAVM2Item, AssignmentAVM2Item {
public Multiname slotName;
//public GraphTargetItem value;
public GraphTargetItem scope;
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -26,6 +27,7 @@ public class SetSuperAVM2Item extends AVM2Item {
//public GraphTargetItem value;
public GraphTargetItem object;
public FullMultinameAVM2Item propertyName;
@Override
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -55,5 +56,4 @@ public class ThrowAVM2Item extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return ((AVM2SourceGenerator) generator).generate(localData, this);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -32,7 +33,9 @@ import java.util.List;
public class WithAVM2Item extends AVM2Item {
public GraphTargetItem scope;
public List<GraphTargetItem> items;
public List<AssignableAVM2Item> subvariables = new ArrayList<>();
public WithAVM2Item(AVM2Instruction instruction, GraphTargetItem scope, List<GraphTargetItem> items) {
@@ -79,5 +82,4 @@ public class WithAVM2Item extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return ((AVM2SourceGenerator) generator).generate(localData, this);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -54,5 +55,4 @@ public class WithObjectAVM2Item extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return scope.toSource(localData, generator);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.clauses;
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
@@ -34,6 +35,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class DeclarationAVM2Item extends AVM2Item {
public GraphTargetItem assignment;
public GraphTargetItem type;
public DeclarationAVM2Item(GraphTargetItem assignment, GraphTargetItem type) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.clauses;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -29,6 +30,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class FilterAVM2Item extends AVM2Item {
public GraphTargetItem expression;
public GraphTargetItem collection;
public FilterAVM2Item(AVM2Instruction instruction, GraphTargetItem collection, GraphTargetItem expression) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.clauses;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -39,7 +40,9 @@ import java.util.List;
public class ForEachInAVM2Item extends LoopItem implements Block {
public InAVM2Item expression;
public List<GraphTargetItem> commands;
private boolean labelUsed;
@Override
@@ -133,5 +136,4 @@ public class ForEachInAVM2Item extends LoopItem implements Block {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return ((AVM2SourceGenerator) generator).generate(localData, this);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.clauses;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -39,7 +40,9 @@ import java.util.List;
public class ForInAVM2Item extends LoopItem implements Block {
public InAVM2Item expression;
public List<GraphTargetItem> commands;
private boolean labelUsed;
@Override
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.clauses;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -38,10 +39,15 @@ import java.util.List;
public class TryAVM2Item extends AVM2Item implements Block {
public List<GraphTargetItem> tryCommands;
public List<ABCException> catchExceptions;
public List<NameAVM2Item> catchExceptions2;
public List<List<GraphTargetItem>> catchCommands;
public List<GraphTargetItem> finallyCommands;
public List<List<AssignableAVM2Item>> catchVariables = new ArrayList<>();
@Override
@@ -164,5 +170,4 @@ public class TryAVM2Item extends AVM2Item implements Block {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return ((AVM2SourceGenerator) generator).generate(localData, this);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -87,5 +88,4 @@ public class AddAVM2Item extends BinaryOpItem {
public GraphTargetItem returnType() {
return new UnboundedTypeItem();
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -36,6 +37,7 @@ import java.util.List;
public class DeletePropertyAVM2Item extends AVM2Item {
public GraphTargetItem object;
public GraphTargetItem propertyName;
private int line;
@@ -80,7 +82,7 @@ public class DeletePropertyAVM2Item extends AVM2Item {
return n.toSource(localData, generator, true, false, new ArrayList<GraphTargetItem>(), true, false);
}
throw new CompilationException("Not a property", line); //TODO: handle line better way
throw new CompilationException("Not a property", line); //TODO: handle line better way
}
@Override
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -49,5 +50,4 @@ public class LShiftAVM2Item extends BinaryOpItem {
public GraphTargetItem returnType() {
return new UnboundedTypeItem();
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -58,5 +59,4 @@ public class PreDecrementAVM2Item extends UnaryOpItem implements AssignmentAVM2I
public GraphTargetItem returnType() {
return value.returnType();
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.pcode;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
@@ -46,7 +47,9 @@ public class ASM3Parser {
private static class OffsetItem {
public String label = "";
public long insPosition;
public int insOperandIndex;
public OffsetItem(String label, long insOffset, int insOperandIndex) {
@@ -66,6 +69,7 @@ public class ASM3Parser {
private static class LabelItem {
public String label = "";
public int offset;
public LabelItem(String label, int offset) {
@@ -2,17 +2,17 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -43,7 +43,9 @@ public final class Flasm3Lexer {
* lexical states
*/
public static final int YYINITIAL = 0;
public static final int STRING = 2;
public static final int PARAMETERS = 4;
/**
@@ -2494,7 +2496,9 @@ public final class Flasm3Lexer {
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
@@ -2642,7 +2646,9 @@ public final class Flasm3Lexer {
/* user code: */
StringBuffer string = new StringBuffer();
boolean isMultiname = false;
long multinameId = 0;
/**
@@ -3607,5 +3613,4 @@ public final class Flasm3Lexer {
}
}
}
}
@@ -1,108 +1,195 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.pcode;
public class ParsedSymbol {
public int type;
public Object value;
public static final int TYPE_STRING = 1;
public static final int TYPE_MULTINAME = 2;
public static final int TYPE_INSTRUCTION_NAME = 3;
public static final int TYPE_INTEGER = 4;
public static final int TYPE_FLOAT = 5;
public static final int TYPE_IDENTIFIER = 6;
public static final int TYPE_EOF = 7;
public static final int TYPE_LABEL = 8;
public static final int TYPE_COMMENT = 9;
public static final int TYPE_EXCEPTION_START = 10;
public static final int TYPE_EXCEPTION_END = 11;
public static final int TYPE_EXCEPTION_TARGET = 12;
public static final int TYPE_KEYWORD_QNAME = 13;
public static final int TYPE_KEYWORD_QNAMEA = 14;
public static final int TYPE_KEYWORD_RTQNAME = 15;
public static final int TYPE_KEYWORD_RTQNAMEA = 16;
public static final int TYPE_KEYWORD_RTQNAMEL = 17;
public static final int TYPE_KEYWORD_RTQNAMELA = 18;
public static final int TYPE_KEYWORD_MULTINAME = 19;
public static final int TYPE_KEYWORD_MULTINAMEA = 20;
public static final int TYPE_KEYWORD_MULTINAMEL = 21;
public static final int TYPE_KEYWORD_MULTINAMELA = 22;
public static final int TYPE_KEYWORD_TYPENAME = 23;
public static final int TYPE_PARENT_OPEN = 24;
public static final int TYPE_PARENT_CLOSE = 25;
public static final int TYPE_COMMA = 26;
public static final int TYPE_KEYWORD_NULL = 27;
public static final int TYPE_BRACKET_OPEN = 28;
public static final int TYPE_BRACKET_CLOSE = 29;
public static final int TYPE_LOWERTHAN = 30;
public static final int TYPE_GREATERTHAN = 31;
public static final int TYPE_KEYWORD_NAMESPACE = 32;
public static final int TYPE_KEYWORD_PRIVATENAMESPACE = 33;
public static final int TYPE_KEYWORD_PACKAGENAMESPACE = 34;
public static final int TYPE_KEYWORD_PACKAGEINTERNALNS = 35;
public static final int TYPE_KEYWORD_PROTECTEDNAMESPACE = 36;
public static final int TYPE_KEYWORD_EXPLICITNAMESPACE = 37;
public static final int TYPE_KEYWORD_STATICPROTECTEDNS = 38;
public static final int TYPE_KEYWORD_TRY = 39;
public static final int TYPE_KEYWORD_FROM = 40;
public static final int TYPE_KEYWORD_TO = 41;
public static final int TYPE_KEYWORD_TARGET = 42;
public static final int TYPE_KEYWORD_TYPE = 43;
public static final int TYPE_KEYWORD_NAME = 44;
public static final int TYPE_KEYWORD_FLAG = 45;
public static final int TYPE_KEYWORD_EXPLICIT = 46;
public static final int TYPE_KEYWORD_HAS_OPTIONAL = 47;
public static final int TYPE_KEYWORD_HAS_PARAM_NAMES = 48;
public static final int TYPE_KEYWORD_IGNORE_REST = 49;
public static final int TYPE_KEYWORD_NEED_ACTIVATION = 50;
public static final int TYPE_KEYWORD_NEED_ARGUMENTS = 51;
public static final int TYPE_KEYWORD_NEED_REST = 52;
public static final int TYPE_KEYWORD_SET_DXNS = 53;
public static final int TYPE_KEYWORD_PARAM = 54;
public static final int TYPE_KEYWORD_PARAMNAME = 55;
public static final int TYPE_KEYWORD_OPTIONAL = 56;
public static final int TYPE_KEYWORD_RETURNS = 57;
public static final int TYPE_KEYWORD_BODY = 58;
public static final int TYPE_KEYWORD_MAXSTACK = 59;
public static final int TYPE_KEYWORD_LOCALCOUNT = 60;
public static final int TYPE_KEYWORD_INITSCOPEDEPTH = 61;
public static final int TYPE_KEYWORD_MAXSCOPEDEPTH = 62;
public static final int TYPE_KEYWORD_CODE = 63;
public static final int TYPE_KEYWORD_INTEGER = 64;
public static final int TYPE_KEYWORD_UINTEGER = 65;
public static final int TYPE_KEYWORD_DOUBLE = 66;
public static final int TYPE_KEYWORD_DECIMAL = 67;
public static final int TYPE_KEYWORD_UTF8 = 68;
public static final int TYPE_KEYWORD_TRUE = 69;
public static final int TYPE_KEYWORD_FALSE = 70;
public static final int TYPE_KEYWORD_UNDEFINED = 71;
public static final int TYPE_KEYWORD_TRAIT = 72;
public static final int TYPE_KEYWORD_SLOT = 73;
public static final int TYPE_KEYWORD_CONST = 74;
public static final int TYPE_KEYWORD_METHOD = 75;
public static final int TYPE_KEYWORD_GETTER = 76;
public static final int TYPE_KEYWORD_SETTER = 77;
public static final int TYPE_KEYWORD_CLASS = 78;
public static final int TYPE_KEYWORD_FUNCTION = 79;
public static final int TYPE_KEYWORD_DISPID = 80;
public static final int TYPE_KEYWORD_SLOTID = 81;
public static final int TYPE_KEYWORD_VALUE = 82;
public static final int TYPE_KEYWORD_FINAL = 83;
public static final int TYPE_KEYWORD_METADATA = 84;
public static final int TYPE_KEYWORD_OVERRIDE = 85;
public ParsedSymbol(int type, Object value) {
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -142,11 +142,15 @@ import java.util.logging.Logger;
public class AVM2SourceGenerator implements SourceGenerator {
public final ABC abc;
public List<ABC> allABCs;
public static final int MARK_E_START = 0;
public static final int MARK_E_END = 1;
public static final int MARK_E_TARGET = 2;
public static final int MARK_E_FINALLYPART = 3;
private AVM2Instruction ins(InstructionDefinition def, int... operands) {
@@ -249,7 +253,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
private List<GraphSourceItem> generateIf(SourceGeneratorLocalData localData, GraphTargetItem expression, List<GraphTargetItem> onTrueCmds, List<GraphTargetItem> onFalseCmds, boolean ternar) throws CompilationException {
List<GraphSourceItem> ret = new ArrayList<>();
//ret.addAll(notCondition(localData, expression));
//ret.addAll(notCondition(localData, expression));
List<AVM2Instruction> onTrue = null;
List<AVM2Instruction> onFalse = null;
if (ternar) {
@@ -594,6 +598,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
fixLoop(forBody, forBodyLen + forFinalCLen + forExprLen, forBodyLen, item.loop.id);
return ret;
}
private long uniqLast = 0;
public String uniqId() {
@@ -814,7 +819,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
}
//catchCmds.add(catchCmd);
//catchCmds.add(catchCmd);
preCatches.addAll(catchCmds.get(c));
catches.addAll(0, preCatches);
catches.add(0, new ExceptionMarkAVM2Instruction(currentExceptionIds.get(c), MARK_E_TARGET));
@@ -1322,7 +1327,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
if (!nameItem.subtypes.isEmpty()) { //It's vector => TypeName
List<Integer> params = new ArrayList<>();
for (GraphTargetItem p : nameItem.subtypes) {
for (GraphTargetItem p : nameItem.subtypes) {
params.add(typeName(localData, p));//abc.constants.getMultinameId(new Multiname(Multiname.QNAME, str(p), namespace(Namespace.KIND_PACKAGE, ppkg), 0, 0, new ArrayList<Integer>()), true));
}
int qname = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, str(name), namespace(Namespace.KIND_PACKAGE, pkg), 0, 0, new ArrayList<Integer>()), true);
@@ -1381,7 +1386,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
public int method(boolean subMethod, boolean isInterface, List<MethodBody> callStack, String pkg, boolean needsActivation, List<AssignableAVM2Item> subvariables, int initScope, boolean hasRest, int line, String className, String superType, boolean constructor, SourceGeneratorLocalData localData, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, GraphTargetItem retType) throws CompilationException {
//Reference<Boolean> hasArgs = new Reference<>(Boolean.FALSE);
//calcRegisters(localData,needsActivation,paramNames,subvariables,body, hasArgs);
//calcRegisters(localData,needsActivation,paramNames,subvariables,body, hasArgs);
SourceGeneratorLocalData newlocalData = new SourceGeneratorLocalData(new HashMap<String, Integer>(), 1, true, 0);
newlocalData.currentClass = className;
newlocalData.pkg = localData.pkg;
@@ -1598,7 +1603,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
mi.setFlagNeed_Arguments();
}
//No param names like in official
/*
/*
if (!paramNames.isEmpty()) {
mi.setFlagHas_paramnames();
}*/
@@ -2326,8 +2331,8 @@ public class AVM2SourceGenerator implements SourceGenerator {
parentNames(a, abcs, a.instance_info.get(i).super_index, indices, names, namespaces, outABCs);
}
/*parentNames(abc,allABCs,abc.constants.getMultinameId(
new Multiname(superName.kind,
abc.constants.getStringId(superName.getName(a.constants, new ArrayList<String>()),true),
new Multiname(superName.kind,
abc.constants.getStringId(superName.getName(a.constants, new ArrayList<String>()),true),
abc.constants.getNamespaceId(new Namespace(superName.getNamespace(a.constants).kind, abc.constants.getStringId(superName.getNamespace(a.constants).getName(a.constants),true)),0,true), 0, 0, new ArrayList<Integer>()), true),indices,names,namespaces,outABCs);*/
return;
}
@@ -2337,7 +2342,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
/* public void calcRegisters(Reference<Integer> activationReg, SourceGeneratorLocalData localData, boolean needsActivation, List<String> funParamNames,List<NameAVM2Item> funSubVariables,List<GraphTargetItem> funBody, Reference<Boolean> hasArguments) throws ParseException {
}*/
/*public int resolveType(String objType) {
if (objType.equals("*")) {
@@ -2461,5 +2466,4 @@ public class AVM2SourceGenerator implements SourceGenerator {
ret.add(ins(new PopIns()));
return ret;
}
}
@@ -2,17 +2,17 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -45,15 +45,25 @@ public final class ActionScriptLexer {
* lexical states
*/
public static final int YYINITIAL = 0;
public static final int STRING = 2;
public static final int CHARLITERAL = 4;
public static final int XMLOPENTAG = 6;
public static final int XMLOPENTAGATTRIB = 8;
public static final int XMLINSTROPENTAG = 10;
public static final int XMLINSTRATTRIB = 12;
public static final int XMLCDATA = 14;
public static final int XMLCOMMENT = 16;
public static final int XML = 18;
public static final int OIDENTIFIER = 20;
/**
@@ -864,7 +874,9 @@ public final class ActionScriptLexer {
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
@@ -2334,5 +2346,4 @@ public final class ActionScriptLexer {
}
}
}
}
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -125,10 +125,13 @@ import java.util.logging.Logger;
public class ActionScriptParser {
private long uniqLast = 0;
private final boolean debugMode = false;
private static final String AS3_NAMESPACE = "http://adobe.com/AS3/2006/builtin";
private final ABC abc;
private final List<ABC> otherABCs;
private static final List<ABC> playerABCs = new ArrayList<>();
@@ -305,7 +308,7 @@ public class ActionScriptParser {
boolean attrBracket = false;
while (s.isType(SymbolType.DOT)) {
name += s.value.toString(); //. or ::
name += s.value.toString(); //. or ::
s = lex();
if (s.type == SymbolType.ATTRIBUTE) {
name += "@";
@@ -932,7 +935,7 @@ public class ActionScriptParser {
GraphTargetItem ret = null;
switch (s.type) {
/*case INT:
expectedType(SymbolType.PARENT_OPEN);
expectedType(SymbolType.PARENT_OPEN);
ret = new ToIntegerAVM2Item(null, expression(thisType,pkg,needsActivation, importedClasses, openedNamespaces,openedNamespacesKinds,registerVars, inFunction, inMethod, true, variables));
expectedType(SymbolType.PARENT_CLOSE);
break;
@@ -1092,7 +1095,7 @@ public class ActionScriptParser {
addS(rets, sb);
lexer.yybegin(ActionScriptLexer.XML);
break;
case XML_STARTVARTAG_BEGIN: //add
case XML_STARTVARTAG_BEGIN: //add
//openedTags.add("*");
//ret = add(ret, );
@@ -1123,7 +1126,7 @@ public class ActionScriptParser {
rets.addAll(st);
closedVarTags.setVal(subclose.getVal() + subclose.getVal());
break;
/*case XML_STARTTAG_END:
/*case XML_STARTTAG_END:
sb.append(s.value.toString());
ret = addstr(ret,sb);
break;*/
@@ -1631,7 +1634,7 @@ public class ActionScriptParser {
System.out.println("/command");
}
lexer.removeListener(buf);
if (ret == null) { //can be popped expression
if (ret == null) { //can be popped expression
buf.pushAllBack(lexer);
ret = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);
}
@@ -2196,6 +2199,7 @@ public class ActionScriptParser {
}
private ActionScriptLexer lexer = null;
private List<String> constantPool;
private PackageAVM2Item parsePackage(List<Integer> openedNamespaces) throws IOException, AVM2ParseException, CompilationException {
@@ -2352,5 +2356,4 @@ public class ActionScriptParser {
}
System.exit(0);
}
}
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -48,7 +48,9 @@ import java.util.List;
public class CallAVM2Item extends AVM2Item {
public GraphTargetItem name;
public List<GraphTargetItem> arguments;
public int line;
public CallAVM2Item(int line, GraphTargetItem name, List<GraphTargetItem> arguments) {
@@ -137,12 +139,12 @@ public class CallAVM2Item extends AVM2Item {
if (obj == null) {
obj = new AVM2Instruction(0, new FindPropertyStrictIns(), new int[]{propIndex});
}
boolean isSuper = (obj instanceof NameAVM2Item) && "super".equals(((NameAVM2Item) obj).getVariableName());
InstructionDefinition insDef = isSuper ?
(needsReturn ? new CallSuperIns() : new CallSuperVoidIns()) :
(needsReturn ? new CallPropertyIns() : new CallPropVoidIns());
InstructionDefinition insDef = isSuper
? (needsReturn ? new CallSuperIns() : new CallSuperVoidIns())
: (needsReturn ? new CallPropertyIns() : new CallPropVoidIns());
return toSourceMerge(localData, generator, obj, arguments,
ins(insDef, propIndex, arguments.size())
);
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
@@ -28,18 +29,31 @@ import java.util.List;
public class ClassAVM2Item extends AVM2Item implements Block {
public List<GraphTargetItem> traits;
public GraphTargetItem extendsOp;
public List<GraphTargetItem> implementsOp;
public String className;
public GraphTargetItem constructor;
public int namespace;
public int protectedNs;
public boolean isDynamic;
public boolean isFinal;
public List<Integer> openedNamespaces;
public List<GraphTargetItem> staticInit;
public boolean staticInitActivation;
public List<AssignableAVM2Item> sinitVariables;
public List<String> importedClasses;
public String pkg;
@@ -97,5 +111,4 @@ public class ClassAVM2Item extends AVM2Item implements Block {
public GraphTargetItem returnType() {
return new UnboundedTypeItem(); //FIXME
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
@@ -27,11 +28,17 @@ import com.jpexs.decompiler.graph.model.LocalData;
public class ConstAVM2Item extends AVM2Item {
private final int namespace;
private final boolean isStatic;
public String var;
public GraphTargetItem type;
public String customNamespace;
public int line;
public String pkg;
public int getNamespace() {
@@ -68,5 +75,4 @@ public class ConstAVM2Item extends AVM2Item {
public boolean hasReturnValue() {
return true;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -95,5 +96,4 @@ public class ConstructSomethingAVM2Item extends CallAVM2Item {
}
return toSourceMerge(localData, generator, resname, arguments, ins(new ConstructIns(), arguments.size()));
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns;
@@ -32,5 +33,4 @@ public class ContinueJumpIns extends JumpIns {
public long getLoopId() {
return loopId;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -25,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
public class ExceptionMarkAVM2Instruction extends AVM2Instruction {
public int markType;
public int exceptionId;
public ExceptionMarkAVM2Instruction(int exceptionId, int markType) {
@@ -38,5 +40,4 @@ public class ExceptionMarkAVM2Instruction extends AVM2Instruction {
public byte[] getBytes() {
return new byte[0];
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -33,18 +34,31 @@ import java.util.List;
public class FunctionAVM2Item extends AVM2Item {
public String calculatedFunctionName;
public String functionName;
public int namespace;
public List<String> paramNames;
public List<GraphTargetItem> body;
public List<AssignableAVM2Item> subvariables;
public List<GraphTargetItem> paramTypes;
public List<GraphTargetItem> paramValues;
public GraphTargetItem retType;
public int line;
public boolean hasRest;
public boolean needsActivation;
public boolean isInterface;
public String pkg;
public FunctionAVM2Item(String pkg, boolean isInterface, boolean needsActivation, int namespace, boolean hasRest, int line, String functionName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
@@ -83,5 +97,4 @@ public class FunctionAVM2Item extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return ((AVM2SourceGenerator) generator).generate(localData, this);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.graph.GraphTargetItem;
@@ -27,5 +28,4 @@ public class GetterAVM2Item extends MethodAVM2Item {
public GetterAVM2Item(String pkg, boolean isInterface, String customNamespace, boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, List<AssignableAVM2Item> subvariables, GraphTargetItem retType) {
super(pkg, isInterface, customNamespace, needsActivation, hasRest, line, override, isFinal, isStatic, namespace, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -47,8 +48,11 @@ import java.util.List;
public class IndexAVM2Item extends AssignableAVM2Item {
private final List<Integer> openedNamespaces;
public GraphTargetItem object;
public GraphTargetItem index;
public boolean attr;
public IndexAVM2Item(boolean attr, GraphTargetItem object, GraphTargetItem index, GraphTargetItem storeValue, List<Integer> openedNamespaces) {
@@ -150,5 +154,4 @@ public class IndexAVM2Item extends AssignableAVM2Item {
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSource(localData, generator, false, false, new ArrayList<GraphTargetItem>(), false, false);
}
}

Some files were not shown because too many files have changed in this diff Show More