Issue #45 Unicode character cannot save

Code formatting
This commit is contained in:
Jindra Petk
2013-03-30 16:43:26 +01:00
parent d3bd9b641d
commit be106cc34b
772 changed files with 84378 additions and 84353 deletions

View File

@@ -28,202 +28,202 @@ import javax.swing.JOptionPane;
public class Configuration {
private static final String CONFIG_NAME = "config.bin";
private static final String REPLACEMENTS_NAME = "replacements.cfg";
private static HashMap<String, Object> config = new HashMap<String, Object>();
private static final File unspecifiedFile = new File("unspecified");
private static File directory = unspecifiedFile;
private static final String CONFIG_NAME = "config.bin";
private static final String REPLACEMENTS_NAME = "replacements.cfg";
private static HashMap<String, Object> config = new HashMap<String, Object>();
private static final File unspecifiedFile = new File("unspecified");
private static File directory = unspecifiedFile;
private enum OSId {
private enum OSId {
WINDOWS, OSX, UNIX
}
WINDOWS, OSX, UNIX
}
private static OSId getOSId() {
PrivilegedAction<String> doGetOSName = new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty("os.name");
}
};
OSId id = OSId.UNIX;
String osName = AccessController.doPrivileged(doGetOSName);
if (osName != null) {
if (osName.toLowerCase().startsWith("mac os x")) {
id = OSId.OSX;
} else if (osName.contains("Windows")) {
id = OSId.WINDOWS;
}
}
return id;
}
private static OSId getOSId() {
PrivilegedAction<String> doGetOSName = new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty("os.name");
}
};
OSId id = OSId.UNIX;
String osName = AccessController.doPrivileged(doGetOSName);
if (osName != null) {
if (osName.toLowerCase().startsWith("mac os x")) {
id = OSId.OSX;
} else if (osName.contains("Windows")) {
id = OSId.WINDOWS;
}
}
return id;
}
public static String getASDecHome() {
if (directory == unspecifiedFile) {
directory = null;
String userHome = null;
try {
userHome = System.getProperty("user.home");
} catch (SecurityException ignore) {
}
if (userHome != null) {
String applicationId = Main.shortApplicationName;
OSId osId = getOSId();
if (osId == OSId.WINDOWS) {
File appDataDir = null;
try {
String appDataEV = System.getenv("APPDATA");
if ((appDataEV != null) && (appDataEV.length() > 0)) {
appDataDir = new File(appDataEV);
}
} catch (SecurityException ignore) {
}
String vendorId = Main.vendor;
if ((appDataDir != null) && appDataDir.isDirectory()) {
// ${APPDATA}\{vendorId}\${applicationId}
String path = vendorId + "\\" + applicationId + "\\";
directory = new File(appDataDir, path);
} else {
// ${userHome}\Application Data\${vendorId}\${applicationId}
String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\";
directory = new File(userHome, path);
}
} else if (osId == OSId.OSX) {
// ${userHome}/Library/Application Support/${applicationId}
String path = "Library/Application Support/" + applicationId + "/";
directory = new File(userHome, path);
public static String getASDecHome() {
if (directory == unspecifiedFile) {
directory = null;
String userHome = null;
try {
userHome = System.getProperty("user.home");
} catch (SecurityException ignore) {
}
if (userHome != null) {
String applicationId = Main.shortApplicationName;
OSId osId = getOSId();
if (osId == OSId.WINDOWS) {
File appDataDir = null;
try {
String appDataEV = System.getenv("APPDATA");
if ((appDataEV != null) && (appDataEV.length() > 0)) {
appDataDir = new File(appDataEV);
}
} catch (SecurityException ignore) {
}
String vendorId = Main.vendor;
if ((appDataDir != null) && appDataDir.isDirectory()) {
// ${APPDATA}\{vendorId}\${applicationId}
String path = vendorId + "\\" + applicationId + "\\";
directory = new File(appDataDir, path);
} else {
// ${userHome}\Application Data\${vendorId}\${applicationId}
String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\";
directory = new File(userHome, path);
}
} else if (osId == OSId.OSX) {
// ${userHome}/Library/Application Support/${applicationId}
String path = "Library/Application Support/" + applicationId + "/";
directory = new File(userHome, path);
} else {
// ${userHome}/.${applicationId}/
String path = "." + applicationId + "/";
directory = new File(userHome, path);
}
}
}
if (!directory.exists()) {
directory.mkdirs();
}
String ret = directory.getAbsolutePath();
if (!ret.endsWith(File.separator)) {
ret += File.separator;
}
return ret;
}
private static String getReplacementsFile() {
return getASDecHome() + REPLACEMENTS_NAME;
}
private static String getConfigFile() {
return getASDecHome() + CONFIG_NAME;
}
/**
* List of replacements
*/
public static java.util.List<Replacement> replacements = new ArrayList<Replacement>();
/**
* Saves replacements to file for future use
*/
private static void saveReplacements() {
try {
if (replacements.isEmpty()) {
File rf = new File(getReplacementsFile());
if (rf.exists()) {
rf.delete();
}
} else {
// ${userHome}/.${applicationId}/
String path = "." + applicationId + "/";
directory = new File(userHome, path);
File f = new File(getASDecHome());
if (!f.exists()) {
f.mkdir();
}
PrintWriter pw = new PrintWriter(new FileWriter(getReplacementsFile()));
for (Replacement r : replacements) {
pw.println(r.urlPattern);
pw.println(r.targetFile);
}
pw.close();
}
}
}
if(!directory.exists()){
directory.mkdirs();
}
String ret=directory.getAbsolutePath();
if(!ret.endsWith(File.separator)){
ret+=File.separator;
}
return ret;
}
} catch (IOException e) {
}
}
private static String getReplacementsFile() {
return getASDecHome() + REPLACEMENTS_NAME;
}
private static String getConfigFile() {
return getASDecHome() + CONFIG_NAME;
}
/**
* List of replacements
*/
public static java.util.List<Replacement> replacements = new ArrayList<Replacement>();
/**
* Saves replacements to file for future use
*/
private static void saveReplacements() {
try {
if (replacements.isEmpty()) {
File rf = new File(getReplacementsFile());
if (rf.exists()) {
rf.delete();
/**
* Load replacements from file
*/
private static void loadReplacements() {
replacements = new ArrayList<Replacement>();
try {
BufferedReader br = new BufferedReader(new FileReader(getReplacementsFile()));
String s;
while ((s = br.readLine()) != null) {
Replacement r = new Replacement(s, br.readLine());
replacements.add(r);
}
} else {
File f = new File(getASDecHome());
if (!f.exists()) {
f.mkdir();
br.close();
} catch (IOException e) {
}
}
public static Object getConfig(String cfg) {
return getConfig(cfg, null);
}
public static Object getConfig(String cfg, Object defaultValue) {
if (!config.containsKey(cfg)) {
return defaultValue;
}
return config.get(cfg);
}
public static Object setConfig(String cfg, Object value) {
return config.put(cfg, value);
}
public static void load() {
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(new FileInputStream(getConfigFile()));
config = (HashMap<String, Object>) ois.readObject();
} catch (FileNotFoundException ex) {
} catch (ClassNotFoundException cnf) {
} catch (IOException ex) {
} finally {
if (ois != null) {
try {
ois.close();
} catch (IOException ex1) {
//ignore
}
}
PrintWriter pw = new PrintWriter(new FileWriter(getReplacementsFile()));
for (Replacement r : replacements) {
pw.println(r.urlPattern);
pw.println(r.targetFile);
}
loadReplacements();
}
public static void save() {
File f = new File(getASDecHome());
if (!f.exists()) {
f.mkdir();
}
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(getConfigFile()));
oos.writeObject(config);
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Cannot save configuration.", "Error", JOptionPane.ERROR_MESSAGE);
Logger.getLogger(SWFInputStream.class.getName()).severe("Configuration directory is read only.");
} finally {
if (oos != null) {
try {
oos.close();
} catch (IOException ex1) {
//ignore
}
}
pw.close();
}
} catch (IOException e) {
}
}
}
saveReplacements();
}
/**
* Load replacements from file
*/
private static void loadReplacements() {
replacements = new ArrayList<Replacement>();
try {
BufferedReader br = new BufferedReader(new FileReader(getReplacementsFile()));
String s;
while ((s = br.readLine()) != null) {
Replacement r = new Replacement(s, br.readLine());
replacements.add(r);
}
br.close();
} catch (IOException e) {
}
}
public static Object getConfig(String cfg) {
return getConfig(cfg, null);
}
public static Object getConfig(String cfg, Object defaultValue) {
if (!config.containsKey(cfg)) {
return defaultValue;
}
return config.get(cfg);
}
public static Object setConfig(String cfg, Object value) {
return config.put(cfg, value);
}
public static void load() {
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(new FileInputStream(getConfigFile()));
config = (HashMap<String, Object>) ois.readObject();
} catch (FileNotFoundException ex) {
} catch (ClassNotFoundException cnf) {
} catch (IOException ex) {
} finally {
if (ois != null) {
try {
ois.close();
} catch (IOException ex1) {
//ignore
}
}
}
loadReplacements();
}
public static void save() {
File f = new File(getASDecHome());
if (!f.exists()) {
f.mkdir();
}
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(getConfigFile()));
oos.writeObject(config);
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Cannot save configuration.", "Error", JOptionPane.ERROR_MESSAGE);
Logger.getLogger(SWFInputStream.class.getName()).severe("Configuration directory is read only.");
} finally {
if (oos != null) {
try {
oos.close();
} catch (IOException ex1) {
//ignore
}
}
}
saveReplacements();
}
public static List<Replacement> getReplacements() {
return replacements;
}
public static List<Replacement> getReplacements() {
return replacements;
}
}

View File

@@ -22,5 +22,5 @@ package com.jpexs.decompiler.flash;
*/
public interface EventListener {
public void handleEvent(String event, Object data);
public void handleEvent(String event, Object data);
}

File diff suppressed because it is too large Load Diff

View File

@@ -22,5 +22,5 @@ package com.jpexs.decompiler.flash;
*/
public interface PercentListener {
public void percent(int p);
public void percent(int p);
}

View File

@@ -26,59 +26,59 @@ import java.io.InputStream;
*/
public class ReReadableInputStream extends InputStream {
InputStream is;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] converted;
int pos = 0;
int count = 0;
InputStream is;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] converted;
int pos = 0;
int count = 0;
public int getCount() {
return count;
}
public int getCount() {
return count;
}
public byte[] getAllRead() {
return baos.toByteArray();
}
public byte[] getAllRead() {
return baos.toByteArray();
}
public int getPos() {
return pos;
}
public int getPos() {
return pos;
}
public ReReadableInputStream(InputStream is) {
this.is = is;
}
public ReReadableInputStream(InputStream is) {
this.is = is;
}
public void setPos(int pos) throws IOException {
if (pos > count) {
this.pos = count;
skip(pos - count);
}
this.pos = pos;
}
public void setPos(int pos) throws IOException {
if (pos > count) {
this.pos = count;
skip(pos - count);
}
this.pos = pos;
}
@Override
public int read() throws IOException {
if (pos < count) {
if (converted == null) {
converted = baos.toByteArray();
}
int ret = converted[pos] & 0xff;
pos++;
return ret;
}
int i = is.read();
if (i > -1) {
baos.write(i);
count++;
}
pos++;
converted = null;
@Override
public int read() throws IOException {
if (pos < count) {
if (converted == null) {
converted = baos.toByteArray();
}
int ret = converted[pos] & 0xff;
pos++;
return ret;
}
int i = is.read();
if (i > -1) {
baos.write(i);
count++;
}
pos++;
converted = null;
return i;
}
return i;
}
@Override
public int available() throws IOException {
return (count + is.available()) - pos;
}
@Override
public int available() throws IOException {
return (count + is.available()) - pos;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -26,352 +26,354 @@ import java.util.List;
public class ABCInputStream extends InputStream {
private static final int CLASS_PROTECTED_NS = 8;
private static final int ATTR_METADATA = 4;
private InputStream is;
private long bytesRead = 0;
private ByteArrayOutputStream bufferOs = null;
public static boolean DEBUG_READ = false;
private static final int CLASS_PROTECTED_NS = 8;
private static final int ATTR_METADATA = 4;
private InputStream is;
private long bytesRead = 0;
private ByteArrayOutputStream bufferOs = null;
public static boolean DEBUG_READ = false;
public void startBuffer() {
bufferOs = new ByteArrayOutputStream();
}
public void startBuffer() {
bufferOs = new ByteArrayOutputStream();
}
public byte[] stopBuffer() {
if (bufferOs == null) {
return new byte[0];
}
byte ret[] = bufferOs.toByteArray();
bufferOs = null;
return ret;
}
public byte[] stopBuffer() {
if (bufferOs == null) {
return new byte[0];
}
byte ret[] = bufferOs.toByteArray();
bufferOs = null;
return ret;
}
public ABCInputStream(InputStream is) {
this.is = is;
}
public ABCInputStream(InputStream is) {
this.is = is;
}
@Override
public int read() throws IOException {
bytesRead++;
int i = is.read();
if (DEBUG_READ) {
System.out.println("Read:0x" + Integer.toHexString(i));
}
if (bufferOs != null) {
if (i != -1) {
bufferOs.write(i);
}
}
return i;
}
@Override
public int read() throws IOException {
bytesRead++;
int i = is.read();
if (DEBUG_READ) {
System.out.println("Read:0x" + Integer.toHexString(i));
}
if (bufferOs != null) {
if (i != -1) {
bufferOs.write(i);
}
}
return i;
}
@Override
public int read(byte[] b) throws IOException {
int currBytesRead = is.read(b);
bytesRead += currBytesRead;
if (DEBUG_READ) {
StringBuilder sb = new StringBuilder("Read[");
sb.append(currBytesRead);
sb.append('/');
sb.append(b.length);
sb.append("]: ");
for (int jj = 0; jj < currBytesRead; jj++) {
sb.append("0x");
sb.append(Integer.toHexString(b[jj]));
sb.append(' ');
}
System.out.println(sb.toString());
}
if (bufferOs != null) {
if (currBytesRead > 0) {
bufferOs.write(b, 0, currBytesRead);
}
}
return currBytesRead;
}
@Override
public int read(byte[] b) throws IOException {
int currBytesRead = is.read(b);
bytesRead += currBytesRead;
if (DEBUG_READ) {
StringBuilder sb = new StringBuilder("Read[");
sb.append(currBytesRead);
sb.append('/');
sb.append(b.length);
sb.append("]: ");
for (int jj = 0; jj < currBytesRead; jj++) {
sb.append("0x");
sb.append(Integer.toHexString(b[jj]));
sb.append(' ');
}
System.out.println(sb.toString());
}
if (bufferOs != null) {
if (currBytesRead > 0) {
bufferOs.write(b, 0, currBytesRead);
}
}
return currBytesRead;
}
;
;
public int readU8() throws IOException {
return read();
}
return read();
}
public int readU32() throws IOException {
int i;
int ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte;
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
byteCount++;
bytePos += 7;
} while (nextByte);
return ret;
}
public int readU32() throws IOException {
int i;
int ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte;
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
byteCount++;
bytePos += 7;
} while (nextByte);
return ret;
}
public int readU30() throws IOException {
return readU32();
}
public int readU30() throws IOException {
return readU32();
}
public int readS24() throws IOException {
int ret = (read()) + (read() << 8) + (read() << 16);
public int readS24() throws IOException {
int ret = (read()) + (read() << 8) + (read() << 16);
if ((ret >> 23) == 1) {
ret = ret | 0xff000000;
}
if ((ret >> 23) == 1) {
ret = ret | 0xff000000;
}
return ret;
}
return ret;
}
public int readU16() throws IOException {
return (read()) + (read() << 8);
}
public int readU16() throws IOException {
return (read()) + (read() << 8);
}
public long readS32() throws IOException {
int i;
long ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte;
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
byteCount++;
bytePos += 7;
if (bytePos == 35) {
if ((ret >> 31) == 1) {
ret = -(ret & 0x7fffffff);
public long readS32() throws IOException {
int i;
long ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte;
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
byteCount++;
bytePos += 7;
if (bytePos == 35) {
if ((ret >> 31) == 1) {
ret = -(ret & 0x7fffffff);
}
break;
}
break;
}
} while (nextByte);
return ret;
}
} while (nextByte);
return ret;
}
@Override
public int available() throws IOException {
return is.available();
}
@Override
public int available() throws IOException {
return is.available();
}
public final long readLong() throws IOException {
byte readBuffer[] = safeRead(8);
return (((long) readBuffer[7] << 56)
+ ((long) (readBuffer[6] & 255) << 48)
+ ((long) (readBuffer[5] & 255) << 40)
+ ((long) (readBuffer[4] & 255) << 32)
+ ((long) (readBuffer[3] & 255) << 24)
+ ((readBuffer[2] & 255) << 16)
+ ((readBuffer[1] & 255) << 8)
+ ((readBuffer[0] & 255)));
}
public final long readLong() throws IOException {
byte readBuffer[] = safeRead(8);
return (((long) readBuffer[7] << 56)
+ ((long) (readBuffer[6] & 255) << 48)
+ ((long) (readBuffer[5] & 255) << 40)
+ ((long) (readBuffer[4] & 255) << 32)
+ ((long) (readBuffer[3] & 255) << 24)
+ ((readBuffer[2] & 255) << 16)
+ ((readBuffer[1] & 255) << 8)
+ ((readBuffer[0] & 255)));
}
public double readDouble() throws IOException {
long el = readLong();
double ret = Double.longBitsToDouble(el);
return ret;
}
public double readDouble() throws IOException {
long el = readLong();
double ret = Double.longBitsToDouble(el);
return ret;
}
private byte[] safeRead(int count) throws IOException {
byte ret[] = new byte[count];
for (int i = 0; i < count; i++) {
ret[i] = (byte) read();
}
return ret;
}
private byte[] safeRead(int count) throws IOException {
byte ret[] = new byte[count];
for (int i = 0; i < count; i++) {
ret[i] = (byte) read();
}
return ret;
}
public Namespace readNamespace() throws IOException {
int kind = read();
int name_index = 0;
for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) {
if (Namespace.nameSpaceKinds[k] == kind) {
public Namespace readNamespace() throws IOException {
int kind = read();
int name_index = 0;
for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) {
if (Namespace.nameSpaceKinds[k] == kind) {
name_index = readU30();
break;
}
}
return new Namespace(kind, name_index);
}
public Multiname readMultiname() throws IOException {
int kind = readU8();
int namespace_index = -1;
int name_index = -1;
int namespace_set_index = -1;
int qname_index = -1;
List<Integer> params = new ArrayList<Integer>();
if ((kind == 7) || (kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA.
namespace_index = readU30();
name_index = readU30();
break;
}
}
return new Namespace(kind, name_index);
}
public Multiname readMultiname() throws IOException {
int kind = readU8();
int namespace_index = -1;
int name_index = -1;
int namespace_set_index = -1;
int qname_index = -1;
List<Integer> params = new ArrayList<Integer>();
if ((kind == 7) || (kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA.
namespace_index = readU30();
name_index = readU30();
} else if ((kind == 0xf) || (kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA
name_index = readU30();
} else if ((kind == 0x11) || (kind == 0x12))//kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA.
{
} else if ((kind == 9) || (kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA.
name_index = readU30();
namespace_set_index = readU30();
} else if ((kind == 0x1B) || (kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA
namespace_set_index = readU30();
} else if (kind == 0x1D) {
//Constant_TypeName
qname_index = readU30(); //Multiname index!!!
int paramsLength = readU30();
for (int i = 0; i < paramsLength; i++) {
params.add(readU30()); //multiname indices!
}
} else {
System.err.println("Unknown kind of Multiname:0x" + Integer.toHexString(kind));
System.exit(1);
}
return new Multiname(kind, name_index, namespace_index, namespace_set_index, qname_index, params);
}
public MethodInfo readMethodInfo() throws IOException {
int param_count = readU30();
int ret_type = readU30();
int param_types[] = new int[param_count];
for (int i = 0; i < param_count; i++) {
param_types[i] = readU30();
}
int name_index = readU30();
int flags = read();
//// 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional (16=ignore_rest, 32=explicit,) 64=setsdxns, 128=has_paramnames
ValueKind optional[] = new ValueKind[0];
if ((flags & 8) == 8) { //if has_optional
int optional_count = readU30();
optional = new ValueKind[optional_count];
for (int i = 0; i < optional_count; i++) {
optional[i] = new ValueKind(readU30(), read());
}
}
int param_names[] = new int[param_count];
if ((flags & 128) == 128) { //if has_paramnames
for (int i = 0; i < param_count; i++) {
param_names[i] = readU30();
}
}
return new MethodInfo(param_types, ret_type, name_index, flags, optional, param_names);
}
public Trait readTrait() throws IOException {
long pos = getPosition();
startBuffer();
int name_index = readU30();
int kind = read();
int kindType = 0xf & kind;
int kindFlags = kind >> 4;
Trait trait;
switch (kindType) {
case 0: //slot
case 6: //const
TraitSlotConst t1 = new TraitSlotConst();
t1.slot_id = readU30();
t1.type_index = readU30();
t1.value_index = readU30();
if (t1.value_index != 0) {
t1.value_kind = read();
} else if ((kind == 0xf) || (kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA
name_index = readU30();
} else if ((kind == 0x11) || (kind == 0x12))//kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA.
{
} else if ((kind == 9) || (kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA.
name_index = readU30();
namespace_set_index = readU30();
} else if ((kind == 0x1B) || (kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA
namespace_set_index = readU30();
} else if (kind == 0x1D) {
//Constant_TypeName
qname_index = readU30(); //Multiname index!!!
int paramsLength = readU30();
for (int i = 0; i < paramsLength; i++) {
params.add(readU30()); //multiname indices!
}
trait = t1;
break;
case 1: //method
case 2: //getter
case 3: //setter
TraitMethodGetterSetter t2 = new TraitMethodGetterSetter();
t2.disp_id = readU30();
t2.method_info = readU30();
trait = t2;
break;
case 4: //class
TraitClass t3 = new TraitClass();
t3.slot_id = readU30();
t3.class_info = readU30();
trait = t3;
break;
case 5: //function
TraitFunction t4 = new TraitFunction();
t4.slot_index = readU30();
t4.method_info = readU30();
trait = t4;
break;
default:
throw new IOException("Unknown trait kind:" + kind);
}
trait.fileOffset = pos;
trait.kindType = kindType;
trait.kindFlags = kindFlags;
trait.name_index = name_index;
if ((kindFlags & ATTR_METADATA) != 0) {
int metadata_count = readU30();
trait.metadata = new int[metadata_count];
for (int i = 0; i < metadata_count; i++) {
trait.metadata[i] = readU30();
}
}
trait.bytes = stopBuffer();
return trait;
}
} else {
System.err.println("Unknown kind of Multiname:0x" + Integer.toHexString(kind));
System.exit(1);
}
public Traits readTraits() throws IOException {
int count = readU30();
Traits traits = new Traits();
traits.traits = new Trait[count];
for (int i = 0; i < count; i++) {
traits.traits[i] = readTrait();
}
return traits;
}
return new Multiname(kind, name_index, namespace_index, namespace_set_index, qname_index, params);
}
public byte[] readBytes(int count) throws IOException {
byte ret[] = new byte[count];
for (int i = 0; i < count; i++) {
ret[i] = (byte) read();
}
return ret;
}
public MethodInfo readMethodInfo() throws IOException {
int param_count = readU30();
int ret_type = readU30();
int param_types[] = new int[param_count];
for (int i = 0; i < param_count; i++) {
param_types[i] = readU30();
}
int name_index = readU30();
int flags = read();
public Decimal readDecimal() throws IOException {
byte data[] = readBytes(16);
return new Decimal(data);
}
//// 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional (16=ignore_rest, 32=explicit,) 64=setsdxns, 128=has_paramnames
public InstanceInfo readInstanceInfo() throws IOException {
InstanceInfo ret = new InstanceInfo();
ret.name_index = readU30();
ret.super_index = readU30();
ret.flags = read();
if ((ret.flags & CLASS_PROTECTED_NS) != 0) {
ret.protectedNS = readU30();
}
int interfaces_count = readU30();
ret.interfaces = new int[interfaces_count];
for (int i = 0; i < interfaces_count; i++) {
ret.interfaces[i] = readU30();
}
ret.iinit_index = readU30();
ret.instance_traits = readTraits();
return ret;
}
ValueKind optional[] = new ValueKind[0];
if ((flags & 8) == 8) { //if has_optional
int optional_count = readU30();
optional = new ValueKind[optional_count];
for (int i = 0; i < optional_count; i++) {
optional[i] = new ValueKind(readU30(), read());
}
}
public String readString() throws IOException {
int length = readU30();
return new String(safeRead(length), "utf8");
}
int param_names[] = new int[param_count];
if ((flags & 128) == 128) { //if has_paramnames
for (int i = 0; i < param_count; i++) {
param_names[i] = readU30();
}
}
return new MethodInfo(param_types, ret_type, name_index, flags, optional, param_names);
}
public Trait readTrait() throws IOException {
long pos = getPosition();
startBuffer();
int name_index = readU30();
int kind = read();
int kindType = 0xf & kind;
int kindFlags = kind >> 4;
Trait trait;
switch (kindType) {
case 0: //slot
case 6: //const
TraitSlotConst t1 = new TraitSlotConst();
t1.slot_id = readU30();
t1.type_index = readU30();
t1.value_index = readU30();
if (t1.value_index != 0) {
t1.value_kind = read();
}
trait = t1;
break;
case 1: //method
case 2: //getter
case 3: //setter
TraitMethodGetterSetter t2 = new TraitMethodGetterSetter();
t2.disp_id = readU30();
t2.method_info = readU30();
trait = t2;
break;
case 4: //class
TraitClass t3 = new TraitClass();
t3.slot_id = readU30();
t3.class_info = readU30();
trait = t3;
break;
case 5: //function
TraitFunction t4 = new TraitFunction();
t4.slot_index = readU30();
t4.method_info = readU30();
trait = t4;
break;
default:
throw new IOException("Unknown trait kind:" + kind);
}
trait.fileOffset = pos;
trait.kindType = kindType;
trait.kindFlags = kindFlags;
trait.name_index = name_index;
if ((kindFlags & ATTR_METADATA) != 0) {
int metadata_count = readU30();
trait.metadata = new int[metadata_count];
for (int i = 0; i < metadata_count; i++) {
trait.metadata[i] = readU30();
}
}
trait.bytes = stopBuffer();
return trait;
}
public Traits readTraits() throws IOException {
int count = readU30();
Traits traits = new Traits();
traits.traits = new Trait[count];
for (int i = 0; i < count; i++) {
traits.traits[i] = readTrait();
}
return traits;
}
public byte[] readBytes(int count) throws IOException {
byte ret[] = new byte[count];
for (int i = 0; i < count; i++) {
ret[i] = (byte) read();
}
return ret;
}
public Decimal readDecimal() throws IOException {
byte data[] = readBytes(16);
return new Decimal(data);
}
public InstanceInfo readInstanceInfo() throws IOException {
InstanceInfo ret = new InstanceInfo();
ret.name_index = readU30();
ret.super_index = readU30();
ret.flags = read();
if ((ret.flags & CLASS_PROTECTED_NS) != 0) {
ret.protectedNS = readU30();
}
int interfaces_count = readU30();
ret.interfaces = new int[interfaces_count];
for (int i = 0; i < interfaces_count; i++) {
ret.interfaces[i] = readU30();
}
ret.iinit_index = readU30();
ret.instance_traits = readTraits();
return ret;
}
public String readString() throws IOException {
int length = readU30();
byte b[] = safeRead(length);
String r = new String(b, "UTF-8");
return r;
}
/*public void markStart(){
bytesRead=0;
}*/
public long getPosition() {
return bytesRead;
}
/*public void markStart(){
bytesRead=0;
}*/
public long getPosition() {
return bytesRead;
}
}

View File

@@ -23,249 +23,249 @@ import java.io.OutputStream;
public class ABCOutputStream extends OutputStream {
private OutputStream os;
private OutputStream os;
public ABCOutputStream(OutputStream os) {
this.os = os;
}
public ABCOutputStream(OutputStream os) {
this.os = os;
}
@Override
public void write(int b) throws IOException {
os.write(b);
}
@Override
public void write(int b) throws IOException {
os.write(b);
}
public void writeU30(long value) throws IOException {
writeS32(value);
/*boolean loop = true;
boolean underZero=value<0;
public void writeU30(long value) throws IOException {
writeS32(value);
/*boolean loop = true;
boolean underZero=value<0;
if(underZero){
value = value & 0xFFFFFFFF;
}else{
value = value & 0x7FFFFFFF;
}
do {
int ret = (int) (value & 0x7F);
if (value < 0x80) {
loop = false;
}
if (value > 0x7F) {
ret += 0x80;
}
write(ret);
value = value >> 7;
} while (loop);
*/
}
public void writeU32(long value) throws IOException {
boolean loop = true;
value = value & 0xFFFFFFFF;
do {
if(underZero){
value = value & 0xFFFFFFFF;
}else{
value = value & 0x7FFFFFFF;
}
do {
int ret = (int) (value & 0x7F);
if (value < 0x80) {
loop = false;
loop = false;
}
if (value > 0x7F) {
ret += 0x80;
ret += 0x80;
}
write(ret);
value = value >> 7;
} while (loop);
}
} while (loop);
*/
}
public void writeS24(long value) throws IOException {
int ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
ret = (int) (value & 0xff);
write(ret);
}
public void writeS32(long value) throws IOException {
boolean belowZero = value < 0;
/*if (belowZero) {
value = -value;
}*/
int bitcount = 0;
boolean loop = true;
//value = value & 0xFFFFFFFF;
do {
bitcount += 7;
int ret = (int) (value & 0x7F);
if (value < 0x80) {
if (belowZero) { //&& bitcount < 35
ret += 0x80;
} else {
loop = false;
public void writeU32(long value) throws IOException {
boolean loop = true;
value = value & 0xFFFFFFFF;
do {
int ret = (int) (value & 0x7F);
if (value < 0x80) {
loop = false;
}
} else {
ret += 0x80;
}
if (value > 0x7F) {
ret += 0x80;
}
write(ret);
value = value >> 7;
} while (loop);
}
if (bitcount == 35) {
ret = ret & 0xf;
}
write(ret);
if (bitcount == 35) {
break;
}
value = value >> 7;
} while (loop);
}
public void writeS24(long value) throws IOException {
int ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
ret = (int) (value & 0xff);
write(ret);
}
public void writeLong(long value) throws IOException {
byte writeBuffer[] = new byte[8];
writeBuffer[7] = (byte) (value >>> 56);
writeBuffer[6] = (byte) (value >>> 48);
writeBuffer[5] = (byte) (value >>> 40);
writeBuffer[4] = (byte) (value >>> 32);
writeBuffer[3] = (byte) (value >>> 24);
writeBuffer[2] = (byte) (value >>> 16);
writeBuffer[1] = (byte) (value >>> 8);
writeBuffer[0] = (byte) (value);
write(writeBuffer);
}
public void writeS32(long value) throws IOException {
boolean belowZero = value < 0;
/*if (belowZero) {
value = -value;
}*/
int bitcount = 0;
boolean loop = true;
//value = value & 0xFFFFFFFF;
do {
bitcount += 7;
int ret = (int) (value & 0x7F);
if (value < 0x80) {
if (belowZero) { //&& bitcount < 35
ret += 0x80;
} else {
loop = false;
}
} else {
ret += 0x80;
}
public void writeDouble(double value) throws IOException {
writeLong(Double.doubleToLongBits(value));
}
if (bitcount == 35) {
ret = ret & 0xf;
}
write(ret);
if (bitcount == 35) {
break;
}
value = value >> 7;
} while (loop);
}
public void writeU8(int value) throws IOException {
write(value);
}
public void writeLong(long value) throws IOException {
byte writeBuffer[] = new byte[8];
writeBuffer[7] = (byte) (value >>> 56);
writeBuffer[6] = (byte) (value >>> 48);
writeBuffer[5] = (byte) (value >>> 40);
writeBuffer[4] = (byte) (value >>> 32);
writeBuffer[3] = (byte) (value >>> 24);
writeBuffer[2] = (byte) (value >>> 16);
writeBuffer[1] = (byte) (value >>> 8);
writeBuffer[0] = (byte) (value);
write(writeBuffer);
}
public void writeU16(int value) throws IOException {
write(value & 0xff);
write((value >> 8) & 0xff);
}
public void writeDouble(double value) throws IOException {
writeLong(Double.doubleToLongBits(value));
}
public void writeString(String s) throws IOException {
byte sbytes[] = s.getBytes("utf8");
writeU30(sbytes.length);
write(sbytes);
}
public void writeU8(int value) throws IOException {
write(value);
}
public void writeNamespace(Namespace ns) throws IOException {
write(ns.kind);
for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) {
if (Namespace.nameSpaceKinds[k] == ns.kind) {
writeU30(ns.name_index);
break;
}
}
}
public void writeU16(int value) throws IOException {
write(value & 0xff);
write((value >> 8) & 0xff);
}
public void writeMultiname(Multiname m) throws IOException {
writeU8(m.kind);
if ((m.kind == 7) || (m.kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA.
writeU30(m.namespace_index);
writeU30(m.name_index);
}
if ((m.kind == 9) || (m.kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA.
writeU30(m.name_index);
writeU30(m.namespace_set_index);
}
if ((m.kind == 0xf) || (m.kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA
writeU30(m.name_index);
}
if ((m.kind == 0x1B) || (m.kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA
writeU30(m.namespace_set_index);
}
if (m.kind == 0x1D) {
writeU30(m.qname_index);
writeU30(m.params.size());
for (int i = 0; i < m.params.size(); i++) {
writeU30(m.params.get(i));
}
}
//kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA.
}
public void writeString(String s) throws IOException {
byte sbytes[] = s.getBytes("UTF-8");
writeU30(sbytes.length);
write(sbytes);
}
public void writeMethodInfo(MethodInfo mi) throws IOException {
writeU30(mi.param_types.length);
writeU30(mi.ret_type);
for (int i = 0; i < mi.param_types.length; i++) {
writeU30(mi.param_types[i]);
}
writeU30(mi.name_index);
write(mi.flags);
if ((mi.flags & 8) == 8) {
writeU30(mi.optional.length);
for (int i = 0; i < mi.optional.length; i++) {
writeU30(mi.optional[i].value_index);
write(mi.optional[i].value_kind);
}
}
public void writeNamespace(Namespace ns) throws IOException {
write(ns.kind);
for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) {
if (Namespace.nameSpaceKinds[k] == ns.kind) {
writeU30(ns.name_index);
break;
}
}
}
if ((mi.flags & 128) == 128) { //if has_paramnames
for (int i = 0; i < mi.paramNames.length; i++) {
writeU30(mi.paramNames[i]);
}
}
}
public void writeMultiname(Multiname m) throws IOException {
writeU8(m.kind);
if ((m.kind == 7) || (m.kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA.
writeU30(m.namespace_index);
writeU30(m.name_index);
}
if ((m.kind == 9) || (m.kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA.
writeU30(m.name_index);
writeU30(m.namespace_set_index);
}
if ((m.kind == 0xf) || (m.kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA
writeU30(m.name_index);
}
if ((m.kind == 0x1B) || (m.kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA
writeU30(m.namespace_set_index);
}
if (m.kind == 0x1D) {
writeU30(m.qname_index);
writeU30(m.params.size());
for (int i = 0; i < m.params.size(); i++) {
writeU30(m.params.get(i));
}
}
//kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA.
}
public void writeTrait(Trait t) throws IOException {
writeU30(t.name_index);
write((t.kindFlags << 4) + t.kindType);
if (t instanceof TraitSlotConst) {
TraitSlotConst t1 = (TraitSlotConst) t;
writeU30(t1.slot_id);
writeU30(t1.type_index);
writeU30(t1.value_index);
if (t1.value_index != 0) {
write(t1.value_kind);
}
}
if (t instanceof TraitMethodGetterSetter) {
TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t;
writeU30(t2.disp_id);
writeU30(t2.method_info);
}
if (t instanceof TraitClass) {
TraitClass t3 = (TraitClass) t;
writeU30(t3.slot_id);
writeU30(t3.class_info);
}
if (t instanceof TraitFunction) {
TraitFunction t4 = (TraitFunction) t;
writeU30(t4.slot_index);
writeU30(t4.method_info);
}
if ((t.kindFlags & 4) == 4) {
writeU30(t.metadata.length);
for (int i = 0; i < t.metadata.length; i++) {
writeU30(t.metadata[i]);
}
}
}
public void writeMethodInfo(MethodInfo mi) throws IOException {
writeU30(mi.param_types.length);
writeU30(mi.ret_type);
for (int i = 0; i < mi.param_types.length; i++) {
writeU30(mi.param_types[i]);
}
writeU30(mi.name_index);
write(mi.flags);
if ((mi.flags & 8) == 8) {
writeU30(mi.optional.length);
for (int i = 0; i < mi.optional.length; i++) {
writeU30(mi.optional[i].value_index);
write(mi.optional[i].value_kind);
}
}
public void writeTraits(Traits t) throws IOException {
writeU30(t.traits.length);
for (int i = 0; i < t.traits.length; i++) {
writeTrait(t.traits[i]);
}
}
if ((mi.flags & 128) == 128) { //if has_paramnames
for (int i = 0; i < mi.paramNames.length; i++) {
writeU30(mi.paramNames[i]);
}
}
}
public void writeInstanceInfo(InstanceInfo ii) throws IOException {
writeU30(ii.name_index);
writeU30(ii.super_index);
write(ii.flags);
if ((ii.flags & 8) == 8) {
writeU30(ii.protectedNS);
}
writeU30(ii.interfaces.length);
for (int i = 0; i < ii.interfaces.length; i++) {
writeU30(ii.interfaces[i]);
}
writeU30(ii.iinit_index);
writeTraits(ii.instance_traits);
}
public void writeTrait(Trait t) throws IOException {
writeU30(t.name_index);
write((t.kindFlags << 4) + t.kindType);
if (t instanceof TraitSlotConst) {
TraitSlotConst t1 = (TraitSlotConst) t;
writeU30(t1.slot_id);
writeU30(t1.type_index);
writeU30(t1.value_index);
if (t1.value_index != 0) {
write(t1.value_kind);
}
}
if (t instanceof TraitMethodGetterSetter) {
TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t;
writeU30(t2.disp_id);
writeU30(t2.method_info);
}
if (t instanceof TraitClass) {
TraitClass t3 = (TraitClass) t;
writeU30(t3.slot_id);
writeU30(t3.class_info);
}
if (t instanceof TraitFunction) {
TraitFunction t4 = (TraitFunction) t;
writeU30(t4.slot_index);
writeU30(t4.method_info);
}
if ((t.kindFlags & 4) == 4) {
writeU30(t.metadata.length);
for (int i = 0; i < t.metadata.length; i++) {
writeU30(t.metadata[i]);
}
}
}
public void writeDecimal(Decimal value) throws IOException {
write(value.data);
}
public void writeTraits(Traits t) throws IOException {
writeU30(t.traits.length);
for (int i = 0; i < t.traits.length; i++) {
writeTrait(t.traits[i]);
}
}
public void writeInstanceInfo(InstanceInfo ii) throws IOException {
writeU30(ii.name_index);
writeU30(ii.super_index);
write(ii.flags);
if ((ii.flags & 8) == 8) {
writeU30(ii.protectedNS);
}
writeU30(ii.interfaces.length);
for (int i = 0; i < ii.interfaces.length; i++) {
writeU30(ii.interfaces[i]);
}
writeU30(ii.iinit_index);
writeTraits(ii.instance_traits);
}
public void writeDecimal(Decimal value) throws IOException {
write(value.data);
}
}

View File

@@ -22,52 +22,52 @@ import java.io.OutputStream;
public class CopyOutputStream extends OutputStream {
private OutputStream os;
private InputStream is;
private long pos = 0;
private int TEMPSIZE = 5;
private int temp[] = new int[TEMPSIZE];
private int tempPos = 0;
public int ignoreFirst = 0;
private OutputStream os;
private InputStream is;
private long pos = 0;
private int TEMPSIZE = 5;
private int temp[] = new int[TEMPSIZE];
private int tempPos = 0;
public int ignoreFirst = 0;
public CopyOutputStream(OutputStream os, InputStream is) {
this.os = os;
this.is = is;
}
public CopyOutputStream(OutputStream os, InputStream is) {
this.os = os;
this.is = is;
}
@Override
public void write(int b) throws IOException {
temp[tempPos] = b;
tempPos = (tempPos + 1) % TEMPSIZE;
@Override
public void write(int b) throws IOException {
temp[tempPos] = b;
tempPos = (tempPos + 1) % TEMPSIZE;
pos++;
int r = is.read();
if ((b & 0xff) != r) {
if (ignoreFirst <= 0) {
os.flush();
pos++;
int r = is.read();
if ((b & 0xff) != r) {
if (ignoreFirst <= 0) {
os.flush();
boolean output = true;
boolean output = true;
if (output) {
System.out.println("Position: " + pos);
System.out.print("Last written:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.print("" + Integer.toHexString(temp[(tempPos + i) % TEMPSIZE]) + " ");
}
System.out.println("");
System.out.println("More expected:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.println("" + Integer.toHexString(is.read()));
}
if (output) {
System.out.println("Position: " + pos);
System.out.print("Last written:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.print("" + Integer.toHexString(temp[(tempPos + i) % TEMPSIZE]) + " ");
}
System.out.println("");
System.out.println("More expected:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.println("" + Integer.toHexString(is.read()));
}
System.out.println("");
System.out.println(Integer.toHexString(r) + " expected but " + Integer.toHexString(b) + " found");
System.out.println("");
System.out.println(Integer.toHexString(r) + " expected but " + Integer.toHexString(b) + " found");
}
throw new NotSameException(pos);
} else {
ignoreFirst--;
}
throw new NotSameException(pos);
} else {
ignoreFirst--;
}
}
os.write(b);
}
}
os.write(b);
}
}

View File

@@ -20,7 +20,7 @@ import com.jpexs.decompiler.flash.helpers.Helper;
public class NotSameException extends RuntimeException {
public NotSameException(long pos) {
super("Streams are not the same at pos " + Helper.formatHex((int) pos, 8));
}
public NotSameException(long pos) {
super("Streams are not the same at pos " + Helper.formatHex((int) pos, 8));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -25,32 +25,32 @@ import java.util.List;
*/
public class CodeStats {
public int maxstack = 0;
public int maxscope = 0;
public int maxlocal = 0;
public boolean has_set_dxns = false;
public boolean has_activation = false;
public InstructionStats instructionStats[];
public int maxstack = 0;
public int maxscope = 0;
public int maxlocal = 0;
public boolean has_set_dxns = false;
public boolean has_activation = false;
public InstructionStats instructionStats[];
public String toString(ABC abc, List<String> fullyQualifiedNames) {
String ret = "Stats: maxstack=" + maxstack + ", maxscope=" + maxscope + ", maxlocal=" + maxlocal + "\r\n";
int i = 0;
int ms = 0;
for (InstructionStats stats : instructionStats) {
int deltastack = stats.ins.definition.getStackDelta(stats.ins, abc);
if (stats.stackpos > ms) {
ms = stats.stackpos;
}
ret += "" + i + ":" + stats.stackpos + (deltastack >= 0 ? "+" + deltastack : deltastack) + "," + stats.scopepos + " " + stats.ins.toString(abc.constants, fullyQualifiedNames) + "\r\n";
i++;
}
return ret;
}
public String toString(ABC abc, List<String> fullyQualifiedNames) {
String ret = "Stats: maxstack=" + maxstack + ", maxscope=" + maxscope + ", maxlocal=" + maxlocal + "\r\n";
int i = 0;
int ms = 0;
for (InstructionStats stats : instructionStats) {
int deltastack = stats.ins.definition.getStackDelta(stats.ins, abc);
if (stats.stackpos > ms) {
ms = stats.stackpos;
}
ret += "" + i + ":" + stats.stackpos + (deltastack >= 0 ? "+" + deltastack : deltastack) + "," + stats.scopepos + " " + stats.ins.toString(abc.constants, fullyQualifiedNames) + "\r\n";
i++;
}
return ret;
}
public CodeStats(AVM2Code code) {
instructionStats = new InstructionStats[code.code.size()];
for (int i = 0; i < code.code.size(); i++) {
instructionStats[i] = new InstructionStats(code.code.get(i));
}
}
public CodeStats(AVM2Code code) {
instructionStats = new InstructionStats[code.code.size()];
for (int i = 0; i < code.code.size(); i++) {
instructionStats[i] = new InstructionStats(code.code.get(i));
}
}
}

View File

@@ -27,132 +27,132 @@ import java.util.Arrays;
public class ConstantPool {
public long constant_int[];
public long constant_uint[];
public double constant_double[];
/* Only for some minor versions */
public Decimal constant_decimal[];
public String constant_string[];
public Namespace constant_namespace[];
public NamespaceSet constant_namespace_set[];
public Multiname constant_multiname[];
public long constant_int[];
public long constant_uint[];
public double constant_double[];
/* Only for some minor versions */
public Decimal constant_decimal[];
public String constant_string[];
public Namespace constant_namespace[];
public NamespaceSet constant_namespace_set[];
public Multiname constant_multiname[];
public int addInt(long value) {
constant_int = Arrays.copyOf(constant_int, constant_int.length + 1);
constant_int[constant_int.length - 1] = value;
return constant_int.length - 1;
}
public int addInt(long value) {
constant_int = Arrays.copyOf(constant_int, constant_int.length + 1);
constant_int[constant_int.length - 1] = value;
return constant_int.length - 1;
}
public int addUInt(long value) {
constant_uint = Arrays.copyOf(constant_uint, constant_uint.length + 1);
constant_uint[constant_uint.length - 1] = value;
return constant_uint.length - 1;
}
public int addUInt(long value) {
constant_uint = Arrays.copyOf(constant_uint, constant_uint.length + 1);
constant_uint[constant_uint.length - 1] = value;
return constant_uint.length - 1;
}
public int addDouble(double value) {
constant_double = Arrays.copyOf(constant_double, constant_double.length + 1);
constant_double[constant_double.length - 1] = value;
return constant_double.length - 1;
}
public int addDouble(double value) {
constant_double = Arrays.copyOf(constant_double, constant_double.length + 1);
constant_double[constant_double.length - 1] = value;
return constant_double.length - 1;
}
public int addString(String value) {
constant_string = Arrays.copyOf(constant_string, constant_string.length + 1);
constant_string[constant_string.length - 1] = value;
return constant_string.length - 1;
}
public int addString(String value) {
constant_string = Arrays.copyOf(constant_string, constant_string.length + 1);
constant_string[constant_string.length - 1] = value;
return constant_string.length - 1;
}
public int getIntId(long value) {
for (int i = 1; i < constant_int.length; i++) {
if (constant_int[i] == value) {
return i;
}
}
return 0;
}
public int getIntId(long value) {
for (int i = 1; i < constant_int.length; i++) {
if (constant_int[i] == value) {
return i;
}
}
return 0;
}
public int getUIntId(long value) {
for (int i = 1; i < constant_uint.length; i++) {
if (constant_uint[i] == value) {
return i;
}
}
return 0;
}
public int getUIntId(long value) {
for (int i = 1; i < constant_uint.length; i++) {
if (constant_uint[i] == value) {
return i;
}
}
return 0;
}
public int getDoubleId(double value) {
for (int i = 1; i < constant_double.length; i++) {
if (constant_double[i] == value) {
return i;
}
}
return 0;
}
public int getDoubleId(double value) {
for (int i = 1; i < constant_double.length; i++) {
if (constant_double[i] == value) {
return i;
}
}
return 0;
}
public int getStringId(String s) {
for (int i = 1; i < constant_string.length; i++) {
if (constant_string[i].equals(s)) {
return i;
}
}
return 0;
}
public int getStringId(String s) {
for (int i = 1; i < constant_string.length; i++) {
if (constant_string[i].equals(s)) {
return i;
}
}
return 0;
}
public int forceGetStringId(String val) {
int id = getStringId(val);
if (id == 0) {
id = addString(val);
}
return id;
}
public int forceGetStringId(String val) {
int id = getStringId(val);
if (id == 0) {
id = addString(val);
}
return id;
}
public int forceGetIntId(long val) {
int id = getIntId(val);
if (id == 0) {
id = addInt(val);
}
return id;
}
public int forceGetIntId(long val) {
int id = getIntId(val);
if (id == 0) {
id = addInt(val);
}
return id;
}
public int forceGetUIntId(long val) {
int id = getUIntId(val);
if (id == 0) {
id = addUInt(val);
}
return id;
}
public int forceGetUIntId(long val) {
int id = getUIntId(val);
if (id == 0) {
id = addUInt(val);
}
return id;
}
public int forceGetDoubleId(double val) {
int id = getDoubleId(val);
if (id == 0) {
id = addDouble(val);
}
return id;
}
public int forceGetDoubleId(double val) {
int id = getDoubleId(val);
if (id == 0) {
id = addDouble(val);
}
return id;
}
public void dump(OutputStream os) {
PrintStream output = new PrintStream(os);
String s = "";
for (int i = 1; i < constant_int.length; i++) {
output.println("INT[" + i + "]=" + constant_int[i]);
}
for (int i = 1; i < constant_uint.length; i++) {
output.println("UINT[" + i + "]=" + constant_uint[i]);
}
for (int i = 1; i < constant_double.length; i++) {
output.println("Double[" + i + "]=" + constant_double[i]);
}
for (int i = 1; i < constant_string.length; i++) {
output.println("String[" + i + "]=" + constant_string[i]);
}
for (int i = 1; i < constant_namespace.length; i++) {
output.println("Namespace[" + i + "]=" + constant_namespace[i].toString(this));
}
for (int i = 1; i < constant_namespace_set.length; i++) {
output.println("NamespaceSet[" + i + "]=" + constant_namespace_set[i].toString(this));
}
public void dump(OutputStream os) {
PrintStream output = new PrintStream(os);
String s = "";
for (int i = 1; i < constant_int.length; i++) {
output.println("INT[" + i + "]=" + constant_int[i]);
}
for (int i = 1; i < constant_uint.length; i++) {
output.println("UINT[" + i + "]=" + constant_uint[i]);
}
for (int i = 1; i < constant_double.length; i++) {
output.println("Double[" + i + "]=" + constant_double[i]);
}
for (int i = 1; i < constant_string.length; i++) {
output.println("String[" + i + "]=" + constant_string[i]);
}
for (int i = 1; i < constant_namespace.length; i++) {
output.println("Namespace[" + i + "]=" + constant_namespace[i].toString(this));
}
for (int i = 1; i < constant_namespace_set.length; i++) {
output.println("NamespaceSet[" + i + "]=" + constant_namespace_set[i].toString(this));
}
for (int i = 1; i < constant_multiname.length; i++) {
output.println("Multiname[" + i + "]=" + constant_multiname[i].toString(this, new ArrayList<String>()));
}
}
for (int i = 1; i < constant_multiname.length; i++) {
output.println("Multiname[" + i + "]=" + constant_multiname[i].toString(this, new ArrayList<String>()));
}
}
}

View File

@@ -18,10 +18,10 @@ package com.jpexs.decompiler.flash.abc.avm2;
public class ConvertException extends RuntimeException {
public int line;
public int line;
public ConvertException(String s, int line) {
super(s + " on line " + line);
this.line = line;
}
public ConvertException(String s, int line) {
super(s + " on line " + line);
this.line = line;
}
}

View File

@@ -26,11 +26,11 @@ import java.util.Stack;
*/
public class ConvertOutput {
public Stack<GraphTargetItem> stack;
public List<GraphTargetItem> output;
public Stack<GraphTargetItem> stack;
public List<GraphTargetItem> output;
public ConvertOutput(Stack<GraphTargetItem> stack, List<GraphTargetItem> output) {
this.stack = stack;
this.output = output;
}
public ConvertOutput(Stack<GraphTargetItem> stack, List<GraphTargetItem> output) {
this.stack = stack;
this.output = output;
}
}

View File

@@ -24,12 +24,12 @@ 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 AVM2Instruction ins;
public boolean seen = false;
public int stackpos = 0;
public int scopepos = 0;
public AVM2Instruction ins;
public InstructionStats(AVM2Instruction ins) {
this.ins = ins;
}
public InstructionStats(AVM2Instruction ins) {
this.ins = ins;
}
}

View File

@@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2;
public class InvalidInstructionArguments extends RuntimeException {
public InvalidInstructionArguments() {
super("Invalid method arguments");
}
public InvalidInstructionArguments() {
super("Invalid method arguments");
}
}

View File

@@ -21,7 +21,7 @@ import java.util.Stack;
public class LocalDataArea {
public Stack operandStack = new Stack();
public Stack scopeStack = new Stack();
public HashMap localRegisters = new HashMap<Integer, Object>();
public Stack operandStack = new Stack();
public Stack scopeStack = new Stack();
public HashMap localRegisters = new HashMap<Integer, Object>();
}

View File

@@ -18,10 +18,10 @@ package com.jpexs.decompiler.flash.abc.avm2;
public class UnknownInstructionCode extends RuntimeException {
public int code;
public int code;
public UnknownInstructionCode(int code) {
super("Unknown instruction code: 0x" + Integer.toHexString(code));
this.code = code;
}
public UnknownInstructionCode(int code) {
super("Unknown instruction code: 0x" + Integer.toHexString(code));
this.code = code;
}
}

View File

@@ -22,18 +22,18 @@ import java.util.Stack;
public class UnknownJumpException extends RuntimeException {
public Stack stack;
public int ip;
public List<GraphTargetItem> output;
public Stack stack;
public int ip;
public List<GraphTargetItem> output;
public UnknownJumpException(Stack stack, int ip, List<GraphTargetItem> output) {
this.stack = stack;
this.ip = ip;
this.output = output;
}
public UnknownJumpException(Stack stack, int ip, List<GraphTargetItem> output) {
this.stack = stack;
this.ip = ip;
this.output = output;
}
@Override
public String toString() {
return "Unknown jump to " + ip;
}
@Override
public String toString() {
return "Unknown jump to " + ip;
}
}

View File

@@ -18,58 +18,58 @@ import java.util.Stack;
*/
public class AVM2GraphSource extends GraphSource {
private AVM2Code code;
boolean isStatic;
int classIndex;
HashMap<Integer, GraphTargetItem> localRegs;
Stack<GraphTargetItem> scopeStack;
ABC abc;
MethodBody body;
HashMap<Integer, String> localRegNames;
List<String> fullyQualifiedNames;
private AVM2Code code;
boolean isStatic;
int classIndex;
HashMap<Integer, GraphTargetItem> localRegs;
Stack<GraphTargetItem> scopeStack;
ABC abc;
MethodBody body;
HashMap<Integer, String> localRegNames;
List<String> fullyQualifiedNames;
public AVM2GraphSource(AVM2Code code, boolean isStatic, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> scopeStack, ABC abc, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
this.code = code;
this.isStatic = isStatic;
this.classIndex = classIndex;
this.localRegs = localRegs;
this.scopeStack = scopeStack;
this.abc = abc;
this.body = body;
this.localRegNames = localRegNames;
this.fullyQualifiedNames = fullyQualifiedNames;
}
public AVM2GraphSource(AVM2Code code, boolean isStatic, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> scopeStack, ABC abc, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
this.code = code;
this.isStatic = isStatic;
this.classIndex = classIndex;
this.localRegs = localRegs;
this.scopeStack = scopeStack;
this.abc = abc;
this.body = body;
this.localRegNames = localRegNames;
this.fullyQualifiedNames = fullyQualifiedNames;
}
@Override
public int size() {
return code.code.size();
}
@Override
public int size() {
return code.code.size();
}
@Override
public GraphSourceItem get(int pos) {
return code.code.get(pos);
}
@Override
public GraphSourceItem get(int pos) {
return code.code.get(pos);
}
@Override
public boolean isEmpty() {
return code.code.isEmpty();
}
@Override
public boolean isEmpty() {
return code.code.isEmpty();
}
@Override
public List<GraphTargetItem> translatePart(List localData, Stack<GraphTargetItem> stack, int start, int end) {
List<GraphTargetItem> ret = new ArrayList<GraphTargetItem>();
ConvertOutput co = code.toSourceOutput(false, isStatic, classIndex, localRegs, stack, (Stack<GraphTargetItem>) localData.get(AVM2Graph.DATA_SCOPESTACK), abc, abc.constants, abc.method_info, body, start, end, localRegNames, fullyQualifiedNames, new boolean[size()]);
ret.addAll(co.output);
return ret;
}
@Override
public List<GraphTargetItem> translatePart(List localData, Stack<GraphTargetItem> stack, int start, int end) {
List<GraphTargetItem> ret = new ArrayList<GraphTargetItem>();
ConvertOutput co = code.toSourceOutput(false, isStatic, classIndex, localRegs, stack, (Stack<GraphTargetItem>) localData.get(AVM2Graph.DATA_SCOPESTACK), abc, abc.constants, abc.method_info, body, start, end, localRegNames, fullyQualifiedNames, new boolean[size()]);
ret.addAll(co.output);
return ret;
}
@Override
public int adr2pos(long adr) {
return code.adr2pos(adr);
}
@Override
public int adr2pos(long adr) {
return code.adr2pos(adr);
}
@Override
public long pos2adr(int pos) {
return code.pos2adr(pos);
}
@Override
public long pos2adr(int pos) {
return code.pos2adr(pos);
}
}

View File

@@ -41,257 +41,257 @@ import java.util.Stack;
public class AVM2Instruction implements Serializable, GraphSourceItem {
public InstructionDefinition definition;
public int operands[];
public long offset;
public byte bytes[];
public String comment;
public boolean ignored = false;
public String labelname;
public long mappedOffset = -1;
public int changeJumpTo = -1;
public InstructionDefinition definition;
public int operands[];
public long offset;
public byte bytes[];
public String comment;
public boolean ignored = false;
public String labelname;
public long mappedOffset = -1;
public int changeJumpTo = -1;
public AVM2Instruction(long offset, InstructionDefinition definition, int[] operands, byte bytes[]) {
this.definition = definition;
this.operands = operands;
this.offset = offset;
this.bytes = bytes;
}
public AVM2Instruction(long offset, InstructionDefinition definition, int[] operands, byte bytes[]) {
this.definition = definition;
this.operands = operands;
this.offset = offset;
this.bytes = bytes;
}
public byte[] getBytes() {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
ABCOutputStream aos = new ABCOutputStream(bos);
aos.write(definition.instructionCode);
for (int i = 0; i < definition.operands.length; i++) {
int opt = definition.operands[i] & 0xff00;
switch (opt) {
case AVM2Code.OPT_S24:
aos.writeS24(operands[i]);
break;
case AVM2Code.OPT_U30:
aos.writeU30(operands[i]);
break;
case AVM2Code.OPT_U8:
aos.writeU8(operands[i]);
break;
case AVM2Code.OPT_BYTE:
aos.writeU8(0xff & operands[i]);
break;
case AVM2Code.OPT_CASE_OFFSETS:
public byte[] getBytes() {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
ABCOutputStream aos = new ABCOutputStream(bos);
aos.write(definition.instructionCode);
for (int i = 0; i < definition.operands.length; i++) {
int opt = definition.operands[i] & 0xff00;
switch (opt) {
case AVM2Code.OPT_S24:
aos.writeS24(operands[i]);
break;
case AVM2Code.OPT_U30:
aos.writeU30(operands[i]);
break;
case AVM2Code.OPT_U8:
aos.writeU8(operands[i]);
break;
case AVM2Code.OPT_BYTE:
aos.writeU8(0xff & operands[i]);
break;
case AVM2Code.OPT_CASE_OFFSETS:
aos.writeU30(operands[i]); //case count
for (int j = i + 1; j < operands.length; j++) {
aos.writeS24(operands[j]);
}
break;
aos.writeU30(operands[i]); //case count
for (int j = i + 1; j < operands.length; j++) {
aos.writeS24(operands[j]);
}
break;
}
}
}
} catch (IOException ex) {
//ignored
}
return bos.toByteArray();
}
} catch (IOException ex) {
//ignored
}
return bos.toByteArray();
}
@Override
public String toString() {
String s = definition.instructionName;
for (int i = 0; i < operands.length; i++) {
s += " " + operands[i];
}
return s;
}
@Override
public String toString() {
String s = definition.instructionName;
for (int i = 0; i < operands.length; i++) {
s += " " + operands[i];
}
return s;
}
public List<Long> getOffsets() {
List<Long> ret = new ArrayList<Long>();
String s = "";
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_OFFSET:
ret.add(offset + operands[i] + getBytes().length);
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
ret.add(offset + operands[i]);
break;
case AVM2Code.OPT_CASE_OFFSETS:
for (int j = i + 1; j < operands.length; j++) {
ret.add(offset + operands[j]);
}
break;
}
public List<Long> getOffsets() {
List<Long> ret = new ArrayList<Long>();
String s = "";
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_OFFSET:
ret.add(offset + operands[i] + getBytes().length);
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
ret.add(offset + operands[i]);
break;
case AVM2Code.OPT_CASE_OFFSETS:
for (int j = i + 1; j < operands.length; j++) {
ret.add(offset + operands[j]);
}
break;
}
}
return ret;
}
}
return ret;
}
public List getParamsAsList(ConstantPool constants) {
List s = new ArrayList();
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_MULTINAME_INDEX:
s.add(constants.constant_multiname[operands[i]]);
break;
case AVM2Code.DAT_STRING_INDEX:
s.add(constants.constant_string[operands[i]]);
break;
case AVM2Code.DAT_INT_INDEX:
s.add(new Long(constants.constant_int[operands[i]]));
break;
case AVM2Code.DAT_UINT_INDEX:
s.add(new Long(constants.constant_uint[operands[i]]));
break;
case AVM2Code.DAT_DOUBLE_INDEX:
s.add(new Double(constants.constant_double[operands[i]]));
break;
case AVM2Code.DAT_OFFSET:
s.add(new Long(offset + operands[i] + getBytes().length));
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
s.add(new Long(offset + operands[i]));
break;
case AVM2Code.OPT_CASE_OFFSETS:
s.add(new Long(operands[i]));
for (int j = i + 1; j < operands.length; j++) {
s.add(new Long(offset + operands[j]));
}
break;
default:
s.add(new Long(operands[i]));
}
public List getParamsAsList(ConstantPool constants) {
List s = new ArrayList();
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_MULTINAME_INDEX:
s.add(constants.constant_multiname[operands[i]]);
break;
case AVM2Code.DAT_STRING_INDEX:
s.add(constants.constant_string[operands[i]]);
break;
case AVM2Code.DAT_INT_INDEX:
s.add(new Long(constants.constant_int[operands[i]]));
break;
case AVM2Code.DAT_UINT_INDEX:
s.add(new Long(constants.constant_uint[operands[i]]));
break;
case AVM2Code.DAT_DOUBLE_INDEX:
s.add(new Double(constants.constant_double[operands[i]]));
break;
case AVM2Code.DAT_OFFSET:
s.add(new Long(offset + operands[i] + getBytes().length));
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
s.add(new Long(offset + operands[i]));
break;
case AVM2Code.OPT_CASE_OFFSETS:
s.add(new Long(operands[i]));
for (int j = i + 1; j < operands.length; j++) {
s.add(new Long(offset + operands[j]));
}
break;
default:
s.add(new Long(operands[i]));
}
}
return s;
}
}
return s;
}
public String getParams(ConstantPool constants, List<String> fullyQualifiedNames) {
String s = "";
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_MULTINAME_INDEX:
s += " m[" + operands[i] + "]\"" + Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants, fullyQualifiedNames)) + "\"";
break;
case AVM2Code.DAT_STRING_INDEX:
s += " \"" + Helper.escapeString(constants.constant_string[operands[i]]) + "\"";
break;
case AVM2Code.DAT_INT_INDEX:
s += " " + constants.constant_int[operands[i]] + "";
break;
case AVM2Code.DAT_UINT_INDEX:
s += " " + constants.constant_uint[operands[i]] + "";
break;
case AVM2Code.DAT_DOUBLE_INDEX:
s += " " + constants.constant_double[operands[i]] + "";
break;
case AVM2Code.DAT_OFFSET:
s += " ";
if (operands[i] > 0) {
//s += "+";
}//operands[i]
s += "ofs" + Helper.formatAddress(offset + operands[i] + getBytes().length) + "";
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
s += " ";
if (operands[i] > 0) {
//s += "+";
}//operands[i]
s += "ofs" + Helper.formatAddress(offset + operands[i]) + "";
break;
case AVM2Code.OPT_CASE_OFFSETS:
s += " " + operands[i];
for (int j = i + 1; j < operands.length; j++) {
s += " ";
if (operands[j] > 0) {
//s += "+";
}//operands[j]
s += "ofs" + Helper.formatAddress(offset + operands[j]) + "";
}
break;
default:
s += " " + operands[i];
}
public String getParams(ConstantPool constants, List<String> fullyQualifiedNames) {
String s = "";
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_MULTINAME_INDEX:
s += " m[" + operands[i] + "]\"" + Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants, fullyQualifiedNames)) + "\"";
break;
case AVM2Code.DAT_STRING_INDEX:
s += " \"" + Helper.escapeString(constants.constant_string[operands[i]]) + "\"";
break;
case AVM2Code.DAT_INT_INDEX:
s += " " + constants.constant_int[operands[i]] + "";
break;
case AVM2Code.DAT_UINT_INDEX:
s += " " + constants.constant_uint[operands[i]] + "";
break;
case AVM2Code.DAT_DOUBLE_INDEX:
s += " " + constants.constant_double[operands[i]] + "";
break;
case AVM2Code.DAT_OFFSET:
s += " ";
if (operands[i] > 0) {
//s += "+";
}//operands[i]
s += "ofs" + Helper.formatAddress(offset + operands[i] + getBytes().length) + "";
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
s += " ";
if (operands[i] > 0) {
//s += "+";
}//operands[i]
s += "ofs" + Helper.formatAddress(offset + operands[i]) + "";
break;
case AVM2Code.OPT_CASE_OFFSETS:
s += " " + operands[i];
for (int j = i + 1; j < operands.length; j++) {
s += " ";
if (operands[j] > 0) {
//s += "+";
}//operands[j]
s += "ofs" + Helper.formatAddress(offset + operands[j]) + "";
}
break;
default:
s += " " + operands[i];
}
}
return s;
}
}
return s;
}
public String getComment() {
if (ignored) {
return " ;ignored";
}
if ((comment == null) || comment.equals("")) {
return "";
}
return " ;" + comment;
}
public String getComment() {
if (ignored) {
return " ;ignored";
}
if ((comment == null) || comment.equals("")) {
return "";
}
return " ;" + comment;
}
@Override
public boolean isIgnored() {
return ignored;
}
@Override
public boolean isIgnored() {
return ignored;
}
public String toString(ConstantPool constants, List<String> fullyQualifiedNames) {
String s = Helper.formatAddress(offset) + " " + Helper.padSpaceRight(Helper.byteArrToString(getBytes()), 30) + definition.instructionName;
s += getParams(constants, fullyQualifiedNames) + getComment();
return s;
}
public String toString(ConstantPool constants, List<String> fullyQualifiedNames) {
String s = Helper.formatAddress(offset) + " " + Helper.padSpaceRight(Helper.byteArrToString(getBytes()), 30) + definition.instructionName;
s += getParams(constants, fullyQualifiedNames) + getComment();
return s;
}
public String toStringNoAddress(ConstantPool constants, List<String> fullyQualifiedNames) {
String s = definition.instructionName;
s += getParams(constants, fullyQualifiedNames) + getComment();
return s;
}
public List replaceWith;
public String toStringNoAddress(ConstantPool constants, List<String> fullyQualifiedNames) {
String s = definition.instructionName;
s += getParams(constants, fullyQualifiedNames) + getComment();
return s;
}
public List replaceWith;
@Override
public void translate(List localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output) {
definition.translate((Boolean) localData.get(0), (Integer) localData.get(1), (HashMap<Integer, GraphTargetItem>) localData.get(2), stack, (Stack<GraphTargetItem>) localData.get(3), (ConstantPool) localData.get(4), this, (MethodInfo[]) localData.get(5), output, (MethodBody) localData.get(6), (ABC) localData.get(7), (HashMap<Integer, String>) localData.get(8), (List<String>) localData.get(9));
}
@Override
public void translate(List localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output) {
definition.translate((Boolean) localData.get(0), (Integer) localData.get(1), (HashMap<Integer, GraphTargetItem>) localData.get(2), stack, (Stack<GraphTargetItem>) localData.get(3), (ConstantPool) localData.get(4), this, (MethodInfo[]) localData.get(5), output, (MethodBody) localData.get(6), (ABC) localData.get(7), (HashMap<Integer, String>) localData.get(8), (List<String>) localData.get(9));
}
@Override
public boolean isJump() {
return (definition instanceof JumpIns);
}
@Override
public boolean isJump() {
return (definition instanceof JumpIns);
}
@Override
public boolean isBranch() {
return (definition instanceof IfTypeIns) || (definition instanceof LookupSwitchIns);
}
@Override
public boolean isBranch() {
return (definition instanceof IfTypeIns) || (definition instanceof LookupSwitchIns);
}
@Override
public boolean isExit() {
return (definition instanceof ReturnValueIns) || (definition instanceof ReturnVoidIns) || (definition instanceof ThrowIns);
}
@Override
public boolean isExit() {
return (definition instanceof ReturnValueIns) || (definition instanceof ReturnVoidIns) || (definition instanceof ThrowIns);
}
@Override
public long getOffset() {
return mappedOffset > -1 ? mappedOffset : offset;
}
@Override
public long getOffset() {
return mappedOffset > -1 ? mappedOffset : offset;
}
@Override
public List<Integer> getBranches(GraphSource code) {
List<Integer> ret = new ArrayList<Integer>();
if (definition instanceof IfTypeIns) {
ret.add(code.adr2pos(offset + getBytes().length + operands[0]));
if (!(definition instanceof JumpIns)) {
ret.add(code.adr2pos(offset + getBytes().length));
}
}
if (definition instanceof LookupSwitchIns) {
ret.add(code.adr2pos(offset + operands[0]));
for (int k = 2; k < operands.length; k++) {
ret.add(code.adr2pos(offset + operands[k]));
}
}
return ret;
}
@Override
public List<Integer> getBranches(GraphSource code) {
List<Integer> ret = new ArrayList<Integer>();
if (definition instanceof IfTypeIns) {
ret.add(code.adr2pos(offset + getBytes().length + operands[0]));
if (!(definition instanceof JumpIns)) {
ret.add(code.adr2pos(offset + getBytes().length));
}
}
if (definition instanceof LookupSwitchIns) {
ret.add(code.adr2pos(offset + operands[0]));
for (int k = 2; k < operands.length; k++) {
ret.add(code.adr2pos(offset + operands[k]));
}
}
return ret;
}
@Override
public boolean ignoredLoops() {
return false;
}
@Override
public boolean ignoredLoops() {
return false;
}
@Override
public void setIgnored(boolean ignored) {
this.ignored = ignored;
}
@Override
public void setIgnored(boolean ignored) {
this.ignored = ignored;
}
}

View File

@@ -21,5 +21,5 @@ import java.util.Stack;
public interface IfTypeIns {
public abstract void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins);
public abstract void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins);
}

View File

@@ -32,93 +32,93 @@ import java.util.Stack;
public class InstructionDefinition implements Serializable {
protected String hilighOffset(String text, long offset) {
return Highlighting.hilighOffset(text, offset);
}
public int operands[];
public String instructionName = "";
public int instructionCode = 0;
protected String hilighOffset(String text, long offset) {
return Highlighting.hilighOffset(text, offset);
}
public int operands[];
public String instructionName = "";
public int instructionCode = 0;
public InstructionDefinition(int instructionCode, String instructionName, int operands[]) {
this.instructionCode = instructionCode;
this.instructionName = instructionName;
this.operands = operands;
}
public InstructionDefinition(int instructionCode, String instructionName, int operands[]) {
this.instructionCode = instructionCode;
this.instructionName = instructionName;
this.operands = operands;
}
@Override
public String toString() {
String s = instructionName;
for (int i = 0; i < operands.length; i++) {
if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) {
s += " U30";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) {
s += " U8";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) {
s += " BYTE";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) {
s += " S24";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) {
s += " U30 S24,[S24]...";
}
}
return s;
}
@Override
public String toString() {
String s = instructionName;
for (int i = 0; i < operands.length; i++) {
if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) {
s += " U30";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) {
s += " U8";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) {
s += " BYTE";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) {
s += " S24";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) {
s += " U30 S24,[S24]...";
}
}
return s;
}
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
throw new UnsupportedOperationException("Instruction " + instructionName + " not implemented");
}
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
throw new UnsupportedOperationException("Instruction " + instructionName + " not implemented");
}
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
}
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
}
protected FullMultinameTreeItem resolveMultiname(Stack<GraphTargetItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
GraphTargetItem ns = null;
GraphTargetItem name = null;
if (constants.constant_multiname[multinameIndex].needsName()) {
name = (GraphTargetItem) stack.pop();
}
if (constants.constant_multiname[multinameIndex].needsNs()) {
ns = (GraphTargetItem) stack.pop();
}
return new FullMultinameTreeItem(ins, multinameIndex, name, ns);
}
protected FullMultinameTreeItem resolveMultiname(Stack<GraphTargetItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
GraphTargetItem ns = null;
GraphTargetItem name = null;
if (constants.constant_multiname[multinameIndex].needsName()) {
name = (GraphTargetItem) stack.pop();
}
if (constants.constant_multiname[multinameIndex].needsNs()) {
ns = (GraphTargetItem) stack.pop();
}
return new FullMultinameTreeItem(ins, multinameIndex, name, ns);
}
protected int resolvedCount(ConstantPool constants, int multinameIndex) {
int pos = 0;
if (constants.constant_multiname[multinameIndex].needsNs()) {
pos++;
}
if (constants.constant_multiname[multinameIndex].needsName()) {
pos++;
}
return pos;
protected int resolvedCount(ConstantPool constants, int multinameIndex) {
int pos = 0;
if (constants.constant_multiname[multinameIndex].needsNs()) {
pos++;
}
if (constants.constant_multiname[multinameIndex].needsName()) {
pos++;
}
return pos;
}
}
protected String resolveMultinameNoPop(int pos, Stack<TreeItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins, List<String> fullyQualifiedNames) {
String ns = "";
String name;
if (constants.constant_multiname[multinameIndex].needsNs()) {
ns = "[" + stack.get(pos) + "]";
pos++;
}
if (constants.constant_multiname[multinameIndex].needsName()) {
name = stack.get(pos).toString();
} else {
name = hilighOffset(constants.constant_multiname[multinameIndex].getName(constants, fullyQualifiedNames), ins.offset);
}
return name + ns;
}
protected String resolveMultinameNoPop(int pos, Stack<TreeItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins, List<String> fullyQualifiedNames) {
String ns = "";
String name;
if (constants.constant_multiname[multinameIndex].needsNs()) {
ns = "[" + stack.get(pos) + "]";
pos++;
}
if (constants.constant_multiname[multinameIndex].needsName()) {
name = stack.get(pos).toString();
} else {
name = hilighOffset(constants.constant_multiname[multinameIndex].getName(constants, fullyQualifiedNames), ins.offset);
}
return name + ns;
}
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
}

View File

@@ -24,5 +24,5 @@ import java.util.Stack;
public interface SetTypeIns {
public abstract String getObject(Stack<TreeItem> stack, ABC abc, AVM2Instruction ins, List<TreeItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames);
public abstract String getObject(Stack<TreeItem> stack, ABC abc, AVM2Instruction ins, List<TreeItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames);
}

View File

@@ -22,7 +22,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions;
*/
public class TagInstruction extends InstructionDefinition {
public TagInstruction(String tagName) {
super(-1, tagName, new int[0]);
}
public TagInstruction(String tagName) {
super(-1, tagName, new int[0]);
}
}

View File

@@ -28,20 +28,20 @@ import java.util.Stack;
public class AddIIns extends AddIns {
public AddIIns() {
instructionName = "add_i";
instructionCode = 0xc5;
}
public AddIIns() {
instructionName = "add_i";
instructionCode = 0xc5;
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new AddTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new AddTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -30,41 +30,41 @@ import java.util.Stack;
public class AddIns extends InstructionDefinition {
public AddIns() {
super(0xa0, "add", new int[]{});
}
public AddIns() {
super(0xa0, "add", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() + ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() + ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
String s = o1.toString() + o2.toString();
lda.operandStack.push(s);
}
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() + ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() + ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
String s = o1.toString() + o2.toString();
lda.operandStack.push(s);
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new AddTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new AddTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -30,35 +30,35 @@ import java.util.Stack;
public class DecrementIIns extends InstructionDefinition {
public DecrementIIns() {
super(0xc1, "decrement_i", new int[]{});
}
public DecrementIIns() {
super(0xc1, "decrement_i", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new DecrementTreeItem(ins, (GraphTargetItem) stack.pop()));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new DecrementTreeItem(ins, (GraphTargetItem) stack.pop()));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
}

View File

@@ -30,35 +30,35 @@ import java.util.Stack;
public class DecrementIns extends InstructionDefinition {
public DecrementIns() {
super(0x93, "decrement", new int[]{});
}
public DecrementIns() {
super(0x93, "decrement", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new DecrementTreeItem(ins, (GraphTargetItem) stack.pop()));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new DecrementTreeItem(ins, (GraphTargetItem) stack.pop()));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
}

View File

@@ -30,40 +30,40 @@ import java.util.Stack;
public class DivideIns extends InstructionDefinition {
public DivideIns() {
super(0xa3, "divide", new int[]{});
}
public DivideIns() {
super(0xa3, "divide", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o2 = lda.operandStack.pop();
Object o1 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() / ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() / ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
throw new RuntimeException("Cannot divide");
}
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o2 = lda.operandStack.pop();
Object o1 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() / ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() / ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
throw new RuntimeException("Cannot divide");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new DivideTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new DivideTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,17 +29,17 @@ import java.util.Stack;
public class IncrementIIns extends InstructionDefinition {
public IncrementIIns() {
super(0xc0, "increment_i", new int[]{});
}
public IncrementIIns() {
super(0xc0, "increment_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new IncrementTreeItem(ins, (GraphTargetItem) stack.pop()));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new IncrementTreeItem(ins, (GraphTargetItem) stack.pop()));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
}

View File

@@ -29,17 +29,17 @@ import java.util.Stack;
public class IncrementIns extends InstructionDefinition {
public IncrementIns() {
super(0x91, "increment", new int[]{});
}
public IncrementIns() {
super(0x91, "increment", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new IncrementTreeItem(ins, (GraphTargetItem) stack.pop()));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new IncrementTreeItem(ins, (GraphTargetItem) stack.pop()));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
}

View File

@@ -30,32 +30,32 @@ import java.util.Stack;
public class ModuloIns extends InstructionDefinition {
public ModuloIns() {
super(0xa4, "modulo", new int[]{});
}
public ModuloIns() {
super(0xa4, "modulo", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o2).longValue() % ((Long) o1).longValue());
lda.operandStack.push(ret);
} else {
throw new RuntimeException("Cannot modulo");
}
}
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o2).longValue() % ((Long) o1).longValue());
lda.operandStack.push(ret);
} else {
throw new RuntimeException("Cannot modulo");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new ModuloTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new ModuloTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class MultiplyIIns extends InstructionDefinition {
public MultiplyIIns() {
super(0xc7, "multiply_i", new int[]{});
}
public MultiplyIIns() {
super(0xc7, "multiply_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new MultiplyTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new MultiplyTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -30,40 +30,40 @@ import java.util.Stack;
public class MultiplyIns extends InstructionDefinition {
public MultiplyIns() {
super(0xa2, "multiply", new int[]{});
}
public MultiplyIns() {
super(0xa2, "multiply", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() * ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() * ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() * ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() * ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
throw new RuntimeException("Cannot multiply");
}
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() * ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() * ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() * ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() * ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
throw new RuntimeException("Cannot multiply");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new MultiplyTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new MultiplyTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,18 +29,18 @@ import java.util.Stack;
public class NegateIIns extends InstructionDefinition {
public NegateIIns() {
super(0xc4, "negate_i", new int[]{});
}
public NegateIIns() {
super(0xc4, "negate_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v = (GraphTargetItem) stack.pop();
stack.push(new NegTreeItem(ins, v));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v = (GraphTargetItem) stack.pop();
stack.push(new NegTreeItem(ins, v));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
}

View File

@@ -29,18 +29,18 @@ import java.util.Stack;
public class NegateIns extends InstructionDefinition {
public NegateIns() {
super(0x90, "negate", new int[]{});
}
public NegateIns() {
super(0x90, "negate", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v = (GraphTargetItem) stack.pop();
stack.push(new NegTreeItem(ins, v));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v = (GraphTargetItem) stack.pop();
stack.push(new NegTreeItem(ins, v));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
}

View File

@@ -29,18 +29,18 @@ import java.util.Stack;
public class NotIns extends InstructionDefinition {
public NotIns() {
super(0x96, "not", new int[]{});
}
public NotIns() {
super(0x96, "not", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v = (GraphTargetItem) stack.pop();
stack.push(new NotItem(ins, v));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v = (GraphTargetItem) stack.pop();
stack.push(new NotItem(ins, v));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class SubtractIIns extends InstructionDefinition {
public SubtractIIns() {
super(0xc6, "subtract_i", new int[]{});
}
public SubtractIIns() {
super(0xc6, "subtract_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new SubtractTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new SubtractTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class SubtractIns extends InstructionDefinition {
public SubtractIns() {
super(0xa1, "subtract", new int[]{});
}
public SubtractIns() {
super(0xa1, "subtract", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new SubtractTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new SubtractTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -30,27 +30,27 @@ import java.util.Stack;
public class BitAndIns extends InstructionDefinition {
public BitAndIns() {
super(0xa8, "bitand", new int[]{});
}
public BitAndIns() {
super(0xa8, "bitand", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 & value2;
lda.operandStack.push(value3);
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 & value2;
lda.operandStack.push(value3);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new BitAndTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new BitAndTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -30,25 +30,25 @@ import java.util.Stack;
public class BitNotIns extends InstructionDefinition {
public BitNotIns() {
super(0x97, "bitnot", new int[]{});
}
public BitNotIns() {
super(0x97, "bitnot", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value = (Long) lda.operandStack.pop();
Long ret = new Long(-value.longValue());
lda.operandStack.push(ret);
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value = (Long) lda.operandStack.pop();
Long ret = new Long(-value.longValue());
lda.operandStack.push(ret);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v = (GraphTargetItem) stack.pop();
stack.push(new BitNotTreeItem(ins, v));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v = (GraphTargetItem) stack.pop();
stack.push(new BitNotTreeItem(ins, v));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
}

View File

@@ -30,27 +30,27 @@ import java.util.Stack;
public class BitOrIns extends InstructionDefinition {
public BitOrIns() {
super(0xa9, "bitor", new int[]{});
}
public BitOrIns() {
super(0xa9, "bitor", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 | value2;
lda.operandStack.push(value3);
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 | value2;
lda.operandStack.push(value3);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new BitOrTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new BitOrTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -30,27 +30,27 @@ import java.util.Stack;
public class BitXorIns extends InstructionDefinition {
public BitXorIns() {
super(0xaa, "bitxor", new int[]{});
}
public BitXorIns() {
super(0xaa, "bitxor", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 ^ value2;
lda.operandStack.push(value3);
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 ^ value2;
lda.operandStack.push(value3);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new BitXorTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new BitXorTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class LShiftIns extends InstructionDefinition {
public LShiftIns() {
super(0xa5, "lshift", new int[]{});
}
public LShiftIns() {
super(0xa5, "lshift", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LShiftTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LShiftTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class RShiftIns extends InstructionDefinition {
public RShiftIns() {
super(0xa6, "rshift", new int[]{});
}
public RShiftIns() {
super(0xa6, "rshift", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new RShiftTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new RShiftTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class URShiftIns extends InstructionDefinition {
public URShiftIns() {
super(0xa7, "urshift", new int[]{});
}
public URShiftIns() {
super(0xa7, "urshift", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new URShiftTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new URShiftTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -30,27 +30,27 @@ import java.util.Stack;
public class EqualsIns extends InstructionDefinition {
public EqualsIns() {
super(0xab, "equals", new int[]{});
}
public EqualsIns() {
super(0xab, "equals", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj1 = lda.operandStack.pop();
Object obj2 = lda.operandStack.pop();
Boolean res = obj1.equals(obj2);
lda.operandStack.push(res);
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj1 = lda.operandStack.pop();
Object obj2 = lda.operandStack.pop();
Boolean res = obj1.equals(obj2);
lda.operandStack.push(res);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class GreaterEqualsIns extends InstructionDefinition {
public GreaterEqualsIns() {
super(0xb0, "greaterequals", new int[]{});
}
public GreaterEqualsIns() {
super(0xb0, "greaterequals", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class GreaterThanIns extends InstructionDefinition {
public GreaterThanIns() {
super(0xaf, "greaterthan", new int[]{});
}
public GreaterThanIns() {
super(0xaf, "greaterthan", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class LessEqualsIns extends InstructionDefinition {
public LessEqualsIns() {
super(0xae, "lessequals", new int[]{});
}
public LessEqualsIns() {
super(0xae, "lessequals", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class LessThanIns extends InstructionDefinition {
public LessThanIns() {
super(0xad, "lessthan", new int[]{});
}
public LessThanIns() {
super(0xad, "lessthan", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class StrictEqualsIns extends InstructionDefinition {
public StrictEqualsIns() {
super(0xac, "strictequals", new int[]{});
}
public StrictEqualsIns() {
super(0xac, "strictequals", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1;
}
}

View File

@@ -41,78 +41,78 @@ import java.util.Stack;
public class ConstructIns extends InstructionDefinition {
public ConstructIns() {
super(0x42, "construct", new int[]{AVM2Code.DAT_ARG_COUNT});
}
public ConstructIns() {
super(0x42, "construct", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Cannot call constructor");
//call construct property of obj
//push new instance
}
public static boolean walkXML(GraphTargetItem item, List<GraphTargetItem> list) {
boolean ret = true;
if (item instanceof StringTreeItem) {
list.add(item);
} else if (item instanceof AddTreeItem) {
ret = ret && walkXML(((AddTreeItem) item).leftSide, list);
ret = ret && walkXML(((AddTreeItem) item).rightSide, list);
} else if ((item instanceof EscapeXElemTreeItem) || (item instanceof EscapeXAttrTreeItem)) {
list.add(item);
} else {
return false;
}
return ret;
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem obj = (GraphTargetItem) stack.pop();
FullMultinameTreeItem xmlMult = null;
boolean isXML = false;
if (obj instanceof GetPropertyTreeItem) {
GetPropertyTreeItem gpt = (GetPropertyTreeItem) obj;
if (gpt.object instanceof FindPropertyTreeItem) {
FindPropertyTreeItem fpt = (FindPropertyTreeItem) gpt.object;
xmlMult = fpt.propertyName;
isXML = xmlMult.isXML(constants, localRegNames, fullyQualifiedNames) && xmlMult.isXML(constants, localRegNames, fullyQualifiedNames);
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
}
if (obj instanceof GetLexTreeItem) {
GetLexTreeItem glt = (GetLexTreeItem) obj;
isXML = glt.propertyName.getName(constants, fullyQualifiedNames).equals("XML");
}
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Cannot call constructor");
//call construct property of obj
//push new instance
}
if (isXML) {
if (args.size() == 1) {
GraphTargetItem arg = args.get(0);
List<GraphTargetItem> xmlLines = new ArrayList<GraphTargetItem>();
if (walkXML(arg, xmlLines)) {
stack.push(new XMLTreeItem(ins, xmlLines));
return;
public static boolean walkXML(GraphTargetItem item, List<GraphTargetItem> list) {
boolean ret = true;
if (item instanceof StringTreeItem) {
list.add(item);
} else if (item instanceof AddTreeItem) {
ret = ret && walkXML(((AddTreeItem) item).leftSide, list);
ret = ret && walkXML(((AddTreeItem) item).rightSide, list);
} else if ((item instanceof EscapeXElemTreeItem) || (item instanceof EscapeXAttrTreeItem)) {
list.add(item);
} else {
return false;
}
return ret;
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem obj = (GraphTargetItem) stack.pop();
FullMultinameTreeItem xmlMult = null;
boolean isXML = false;
if (obj instanceof GetPropertyTreeItem) {
GetPropertyTreeItem gpt = (GetPropertyTreeItem) obj;
if (gpt.object instanceof FindPropertyTreeItem) {
FindPropertyTreeItem fpt = (FindPropertyTreeItem) gpt.object;
xmlMult = fpt.propertyName;
isXML = xmlMult.isXML(constants, localRegNames, fullyQualifiedNames) && xmlMult.isXML(constants, localRegNames, fullyQualifiedNames);
}
}
}
}
if (obj instanceof GetLexTreeItem) {
GetLexTreeItem glt = (GetLexTreeItem) obj;
isXML = glt.propertyName.getName(constants, fullyQualifiedNames).equals("XML");
}
stack.push(new ConstructTreeItem(ins, obj, args));
}
if (isXML) {
if (args.size() == 1) {
GraphTargetItem arg = args.get(0);
List<GraphTargetItem> xmlLines = new ArrayList<GraphTargetItem>();
if (walkXML(arg, xmlLines)) {
stack.push(new XMLTreeItem(ins, xmlLines));
return;
}
}
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] - 1 + 1;
}
stack.push(new ConstructTreeItem(ins, obj, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] - 1 + 1;
}
}

View File

@@ -34,60 +34,60 @@ import java.util.Stack;
public class ConstructPropIns extends InstructionDefinition {
public ConstructPropIns() {
super(0x4a, "constructprop", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
public ConstructPropIns() {
super(0x4a, "constructprop", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}*/
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
throw new RuntimeException("Cannot construct property");
//create property
//push new instance
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}*/
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
throw new RuntimeException("Cannot construct property");
//create property
//push new instance
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop();
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop();
if (multiname.isXML(constants, localRegNames, fullyQualifiedNames)) {
if (args.size() == 1) {
GraphTargetItem arg = args.get(0);
List<GraphTargetItem> xmlLines = new ArrayList<GraphTargetItem>();
if (ConstructIns.walkXML(arg, xmlLines)) {
stack.push(new XMLTreeItem(ins, xmlLines));
return;
if (multiname.isXML(constants, localRegNames, fullyQualifiedNames)) {
if (args.size() == 1) {
GraphTargetItem arg = args.get(0);
List<GraphTargetItem> xmlLines = new ArrayList<GraphTargetItem>();
if (ConstructIns.walkXML(arg, xmlLines)) {
stack.push(new XMLTreeItem(ins, xmlLines));
return;
}
}
}
}
}
stack.push(new ConstructPropTreeItem(ins, obj, multiname, args));
}
stack.push(new ConstructPropTreeItem(ins, obj, multiname, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
}

View File

@@ -32,36 +32,36 @@ import java.util.Stack;
public class ConstructSuperIns extends InstructionDefinition {
public ConstructSuperIns() {
super(0x49, "constructsuper", new int[]{AVM2Code.DAT_ARG_COUNT});
}
public ConstructSuperIns() {
super(0x49, "constructsuper", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Cannot call super constructor");
//call construct property of obj
//do not push anything
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Cannot call super constructor");
//call construct property of obj
//do not push anything
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem obj = (GraphTargetItem) stack.pop();
output.add(new ConstructSuperTreeItem(ins, obj, args));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem obj = (GraphTargetItem) stack.pop();
output.add(new ConstructSuperTreeItem(ins, obj, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] - 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] - 1;
}
}

View File

@@ -29,17 +29,17 @@ import java.util.Stack;
public class NewActivationIns extends InstructionDefinition {
public NewActivationIns() {
super(0x57, "newactivation", new int[]{});
}
public NewActivationIns() {
super(0x57, "newactivation", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new NewActivationTreeItem(ins));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new NewActivationTreeItem(ins));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
}

View File

@@ -31,22 +31,22 @@ import java.util.Stack;
public class NewArrayIns extends InstructionDefinition {
public NewArrayIns() {
super(0x56, "newarray", new int[]{AVM2Code.DAT_ARG_COUNT});
}
public NewArrayIns() {
super(0x56, "newarray", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
stack.push(new NewArrayTreeItem(ins, args));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
stack.push(new NewArrayTreeItem(ins, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] + 1;
}
}

View File

@@ -30,18 +30,18 @@ import java.util.Stack;
public class NewCatchIns extends InstructionDefinition {
public NewCatchIns() {
super(0x5a, "newcatch", new int[]{AVM2Code.DAT_EXCEPTION_INDEX});
}
public NewCatchIns() {
super(0x5a, "newcatch", new int[]{AVM2Code.DAT_EXCEPTION_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int exInfo = ins.operands[0];
stack.push(new ExceptionTreeItem(body.exceptions[exInfo]));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int exInfo = ins.operands[0];
stack.push(new ExceptionTreeItem(body.exceptions[exInfo]));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
}

View File

@@ -31,19 +31,19 @@ import java.util.Stack;
public class NewClassIns extends InstructionDefinition {
public NewClassIns() {
super(0x58, "newclass", new int[]{AVM2Code.DAT_CLASS_INDEX});
}
public NewClassIns() {
super(0x58, "newclass", new int[]{AVM2Code.DAT_CLASS_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int clsIndex = ins.operands[0];
String baseType = stack.pop().toString(Helper.toList(constants, localRegNames, fullyQualifiedNames));
stack.push(new UnparsedTreeItem(ins, "new " + abc.constants.constant_multiname[abc.instance_info[clsIndex].name_index].getName(constants, fullyQualifiedNames) + ".class extends " + baseType));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int clsIndex = ins.operands[0];
String baseType = stack.pop().toString(Helper.toList(constants, localRegNames, fullyQualifiedNames));
stack.push(new UnparsedTreeItem(ins, "new " + abc.constants.constant_multiname[abc.instance_info[clsIndex].name_index].getName(constants, fullyQualifiedNames) + ".class extends " + baseType));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1;
}
}

View File

@@ -34,30 +34,30 @@ import java.util.logging.Logger;
public class NewFunctionIns extends InstructionDefinition {
public NewFunctionIns() {
super(0x40, "newfunction", new int[]{AVM2Code.DAT_METHOD_INDEX});
}
public NewFunctionIns() {
super(0x40, "newfunction", new int[]{AVM2Code.DAT_METHOD_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int methodIndex = ins.operands[0];
MethodBody mybody = abc.findBody(methodIndex);
String bodyStr = "";
String paramStr = "";
if (mybody != null) {
try{
bodyStr = Highlighting.hilighMethodEnd() + mybody.toString("", false, isStatic, classIndex, abc, constants, method_info, new Stack<GraphTargetItem>()/*scopeStack*/, false, true, fullyQualifiedNames, null) + Highlighting.hilighMethodBegin(body.method_info);
}catch(Exception ex){
Logger.getLogger(NewFunctionIns.class.getName()).log(Level.SEVERE, "error during newfunction", ex);
}
paramStr = method_info[methodIndex].getParamStr(constants, mybody, abc, fullyQualifiedNames);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int methodIndex = ins.operands[0];
MethodBody mybody = abc.findBody(methodIndex);
String bodyStr = "";
String paramStr = "";
if (mybody != null) {
try {
bodyStr = Highlighting.hilighMethodEnd() + mybody.toString("", false, isStatic, classIndex, abc, constants, method_info, new Stack<GraphTargetItem>()/*scopeStack*/, false, true, fullyQualifiedNames, null) + Highlighting.hilighMethodBegin(body.method_info);
} catch (Exception ex) {
Logger.getLogger(NewFunctionIns.class.getName()).log(Level.SEVERE, "error during newfunction", ex);
}
paramStr = method_info[methodIndex].getParamStr(constants, mybody, abc, fullyQualifiedNames);
}
stack.push(new NewFunctionTreeItem(ins, "", paramStr, method_info[methodIndex].getReturnTypeStr(constants, fullyQualifiedNames), bodyStr));
}
stack.push(new NewFunctionTreeItem(ins, "", paramStr, method_info[methodIndex].getReturnTypeStr(constants, fullyQualifiedNames), bodyStr));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
}

View File

@@ -32,24 +32,24 @@ import java.util.Stack;
public class NewObjectIns extends InstructionDefinition {
public NewObjectIns() {
super(0x55, "newobject", new int[]{AVM2Code.DAT_ARG_COUNT});
}
public NewObjectIns() {
super(0x55, "newobject", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<NameValuePair> args = new ArrayList<NameValuePair>();
for (int a = 0; a < argCount; a++) {
GraphTargetItem value = (GraphTargetItem) stack.pop();
GraphTargetItem name = (GraphTargetItem) stack.pop();
args.add(0, new NameValuePair(name, value));
}
stack.push(new NewObjectTreeItem(ins, args));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<NameValuePair> args = new ArrayList<NameValuePair>();
for (int a = 0; a < argCount; a++) {
GraphTargetItem value = (GraphTargetItem) stack.pop();
GraphTargetItem name = (GraphTargetItem) stack.pop();
args.add(0, new NameValuePair(name, value));
}
stack.push(new NewObjectTreeItem(ins, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] * 2 + 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] * 2 + 1;
}
}

View File

@@ -21,7 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
public class DebugFileIns extends InstructionDefinition {
public DebugFileIns() {
super(0xf1, "debugfile", new int[]{AVM2Code.DAT_STRING_INDEX});
}
public DebugFileIns() {
super(0xf1, "debugfile", new int[]{AVM2Code.DAT_STRING_INDEX});
}
}

View File

@@ -21,7 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
public class DebugIns extends InstructionDefinition {
public DebugIns() {
super(0xef, "debug", new int[]{AVM2Code.DAT_DEBUG_TYPE, AVM2Code.DAT_STRING_INDEX, AVM2Code.DAT_REGISTER_INDEX, AVM2Code.OPT_U30});
}
public DebugIns() {
super(0xef, "debug", new int[]{AVM2Code.DAT_DEBUG_TYPE, AVM2Code.DAT_STRING_INDEX, AVM2Code.DAT_REGISTER_INDEX, AVM2Code.OPT_U30});
}
}

View File

@@ -21,7 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
public class DebugLineIns extends InstructionDefinition {
public DebugLineIns() {
super(0xf0, "debugline", new int[]{AVM2Code.DAT_LINENUM});
}
public DebugLineIns() {
super(0xf0, "debugline", new int[]{AVM2Code.DAT_LINENUM});
}
}

View File

@@ -32,37 +32,37 @@ import java.util.Stack;
public class CallIns extends InstructionDefinition {
public CallIns() {
super(0x41, "call", new int[]{AVM2Code.DAT_ARG_COUNT});
}
public CallIns() {
super(0x41, "call", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
Object function = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown function");
//push(result)
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
Object function = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown function");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
GraphTargetItem function = (GraphTargetItem) stack.pop();
stack.push(new CallTreeItem(ins, receiver, function, args));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
GraphTargetItem function = (GraphTargetItem) stack.pop();
stack.push(new CallTreeItem(ins, receiver, function, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1 - ins.operands[0];
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1 - ins.operands[0];
}
}

View File

@@ -32,38 +32,38 @@ import java.util.Stack;
public class CallMethodIns extends InstructionDefinition {
public CallMethodIns() {
super(0x43, "callmethod", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
}
public CallMethodIns() {
super(0x43, "callmethod", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown method");
//push(result)
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown method");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int methodIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
String methodName = method_info[methodIndex].getName(constants);
stack.push(new CallMethodTreeItem(ins, receiver, methodName, args));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int methodIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
String methodName = method_info[methodIndex].getName(constants);
stack.push(new CallMethodTreeItem(ins, receiver, methodName, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1 - ins.operands[1];
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1 - ins.operands[1];
}
}

View File

@@ -30,35 +30,35 @@ import java.util.Stack;
public class CallPropLexIns extends CallPropertyIns {
public CallPropLexIns() {
instructionName = "callproplex";
instructionCode = 0x4c;
}
public CallPropLexIns() {
instructionName = "callproplex";
instructionCode = 0x4c;
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args));
}
stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
}

View File

@@ -33,52 +33,52 @@ import java.util.Stack;
public class CallPropVoidIns extends InstructionDefinition {
public CallPropVoidIns() {
super(0x4f, "callpropvoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
public CallPropVoidIns() {
super(0x4f, "callpropvoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
//same as callproperty
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
//same as callproperty
/*
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown property");
//do not push anything
}
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown property");
//do not push anything
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
output.add(new CallPropertyTreeItem(ins, true, receiver, multiname, args));
}
output.add(new CallPropertyTreeItem(ins, true, receiver, multiname, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
}

View File

@@ -33,50 +33,50 @@ import java.util.Stack;
public class CallPropertyIns extends InstructionDefinition {
public CallPropertyIns() {
super(0x46, "callproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
public CallPropertyIns() {
super(0x46, "callproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown property");
//push(result)
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown property");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args));
}
stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
}

View File

@@ -32,38 +32,38 @@ import java.util.Stack;
public class CallStaticIns extends InstructionDefinition {
public CallStaticIns() {
super(0x44, "callstatic", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
}
public CallStaticIns() {
super(0x44, "callstatic", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown static method");
//push(result)
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown static method");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int methodIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
String methodName = method_info[methodIndex].getName(constants);
stack.push(new CallStaticTreeItem(ins, receiver, methodName, args));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int methodIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
String methodName = method_info[methodIndex].getName(constants);
stack.push(new CallStaticTreeItem(ins, receiver, methodName, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1 - ins.operands[1];
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1 - ins.operands[1];
}
}

View File

@@ -33,49 +33,49 @@ import java.util.Stack;
public class CallSuperIns extends InstructionDefinition {
public CallSuperIns() {
super(0x45, "callsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
public CallSuperIns() {
super(0x45, "callsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown super method");
//push(result)
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown super method");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
stack.push(new CallSuperTreeItem(ins, false, receiver, multiname, args));
}
stack.push(new CallSuperTreeItem(ins, false, receiver, multiname, args));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
}

View File

@@ -33,50 +33,50 @@ import java.util.Stack;
public class CallSuperVoidIns extends InstructionDefinition {
public CallSuperVoidIns() {
super(0x4e, "callsupervoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
public CallSuperVoidIns() {
super(0x4e, "callsupervoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown super method");
//do not push anything
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown super method");
//do not push anything
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<GraphTargetItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop();
output.add(new CallSuperTreeItem(ins, true, receiver, multiname, args));
output.add(new CallSuperTreeItem(ins, true, receiver, multiname, args));
}
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1;
int multinameIndex = ins.operands[0];
if (abc.constants.constant_multiname[multinameIndex].needsName()) {
ret--;
}
if (abc.constants.constant_multiname[multinameIndex].needsNs()) {
ret--;
}
return ret;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfEqIns extends InstructionDefinition implements IfTypeIns {
public IfEqIns() {
super(0x13, "ifeq", new int[]{AVM2Code.DAT_OFFSET});
}
public IfEqIns() {
super(0x13, "ifeq", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new NeqTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new NeqTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -31,24 +31,24 @@ import java.util.Stack;
public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
public IfFalseIns() {
super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET});
}
public IfFalseIns() {
super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new NotItem(ins, v1));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new NotItem(ins, v1));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
//String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")");
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
//String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")");
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfGeIns extends InstructionDefinition implements IfTypeIns {
public IfGeIns() {
super(0x18, "ifge", new int[]{AVM2Code.DAT_OFFSET});
}
public IfGeIns() {
super(0x18, "ifge", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfGtIns extends InstructionDefinition implements IfTypeIns {
public IfGtIns() {
super(0x17, "ifgt", new int[]{AVM2Code.DAT_OFFSET});
}
public IfGtIns() {
super(0x17, "ifgt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfLeIns extends InstructionDefinition implements IfTypeIns {
public IfLeIns() {
super(0x16, "ifle", new int[]{AVM2Code.DAT_OFFSET});
}
public IfLeIns() {
super(0x16, "ifle", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfLtIns extends InstructionDefinition implements IfTypeIns {
public IfLtIns() {
super(0x15, "iflt", new int[]{AVM2Code.DAT_OFFSET});
}
public IfLtIns() {
super(0x15, "iflt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfNGeIns extends InstructionDefinition implements IfTypeIns {
public IfNGeIns() {
super(0x0f, "ifnge", new int[]{AVM2Code.DAT_OFFSET});
}
public IfNGeIns() {
super(0x0f, "ifnge", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfNGtIns extends InstructionDefinition implements IfTypeIns {
public IfNGtIns() {
super(0x0e, "ifngt", new int[]{AVM2Code.DAT_OFFSET});
}
public IfNGtIns() {
super(0x0e, "ifngt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfNLeIns extends InstructionDefinition implements IfTypeIns {
public IfNLeIns() {
super(0x0d, "ifnle", new int[]{AVM2Code.DAT_OFFSET});
}
public IfNLeIns() {
super(0x0d, "ifnle", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfNLtIns extends InstructionDefinition implements IfTypeIns {
public IfNLtIns() {
super(0x0c, "ifnlt", new int[]{AVM2Code.DAT_OFFSET});
}
public IfNLtIns() {
super(0x0c, "ifnlt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfNeIns extends InstructionDefinition implements IfTypeIns {
public IfNeIns() {
super(0x14, "ifne", new int[]{AVM2Code.DAT_OFFSET});
}
public IfNeIns() {
super(0x14, "ifne", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new NeqTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new NeqTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns {
public IfStrictEqIns() {
super(0x19, "ifstricteq", new int[]{AVM2Code.DAT_OFFSET});
}
public IfStrictEqIns() {
super(0x19, "ifstricteq", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictNeqTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictNeqTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -32,26 +32,26 @@ import java.util.Stack;
public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns {
public IfStrictNeIns() {
super(0x1A, "ifstrictne", new int[]{AVM2Code.DAT_OFFSET});
}
public IfStrictNeIns() {
super(0x1A, "ifstrictne", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictNeqTreeItem(ins, v1, v2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictNeqTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
}

View File

@@ -31,24 +31,24 @@ import java.util.Stack;
public class IfTrueIns extends InstructionDefinition implements IfTypeIns {
public IfTrueIns() {
super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET});
}
public IfTrueIns() {
super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
//String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")");
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
//String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")");
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new NotItem(ins, v1));
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v1 = (GraphTargetItem) stack.pop();
stack.push(new NotItem(ins, v1));
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1;
}
}

View File

@@ -30,16 +30,16 @@ import java.util.Stack;
public class JumpIns extends InstructionDefinition implements IfTypeIns {
public JumpIns() {
super(0x10, "jump", new int[]{AVM2Code.DAT_OFFSET});
}
public JumpIns() {
super(0x10, "jump", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new BooleanTreeItem(ins, Boolean.TRUE));// + ins.operands[0]);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new BooleanTreeItem(ins, Boolean.TRUE));// + ins.operands[0]);
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
}
@Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
}
}

View File

@@ -29,19 +29,19 @@ import java.util.Stack;
public class LookupSwitchIns extends InstructionDefinition {
public LookupSwitchIns() {
super(0x1b, "lookupswitch", new int[]{AVM2Code.DAT_CASE_BASEOFFSET, AVM2Code.OPT_CASE_OFFSETS});
}
public LookupSwitchIns() {
super(0x1b, "lookupswitch", new int[]{AVM2Code.DAT_CASE_BASEOFFSET, AVM2Code.OPT_CASE_OFFSETS});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int defaultOffset = ins.operands[0];
int caseCount = ins.operands[1];
//stack.push("switch(...)");
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int defaultOffset = ins.operands[0];
int caseCount = ins.operands[1];
//stack.push("switch(...)");
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1;
}
}

View File

@@ -30,32 +30,32 @@ import java.util.Stack;
public class DecLocalIIns extends InstructionDefinition {
public DecLocalIIns() {
super(0xc3, "declocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
public DecLocalIIns() {
super(0xc3, "declocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.put(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.put(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int regIndex = ins.operands[0];
output.add(new DecLocalTreeItem(ins, regIndex));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int regIndex = ins.operands[0];
output.add(new DecLocalTreeItem(ins, regIndex));
}
}

View File

@@ -30,32 +30,32 @@ import java.util.Stack;
public class DecLocalIns extends InstructionDefinition {
public DecLocalIns() {
super(0x94, "declocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
public DecLocalIns() {
super(0x94, "declocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.put(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.put(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int regIndex = ins.operands[0];
output.add(new DecLocalTreeItem(ins, regIndex));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int regIndex = ins.operands[0];
output.add(new DecLocalTreeItem(ins, regIndex));
}
}

View File

@@ -31,31 +31,31 @@ import java.util.Stack;
public class GetLocal0Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal0Ins() {
super(0xd0, "getlocal_0", new int[]{});
}
public GetLocal0Ins() {
super(0xd0, "getlocal_0", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
lda.operandStack.push(lda.localRegisters.get(0));
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
lda.operandStack.push(lda.localRegisters.get(0));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
if (isStatic) {
stack.push(new ClassTreeItem(abc.instance_info[classIndex].getName(constants)));
} else {
stack.push(new ThisTreeItem(abc.instance_info[classIndex].getName(constants)));
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
if (isStatic) {
stack.push(new ClassTreeItem(abc.instance_info[classIndex].getName(constants)));
} else {
stack.push(new ThisTreeItem(abc.instance_info[classIndex].getName(constants)));
}
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 0;
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 0;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
}

View File

@@ -30,27 +30,27 @@ import java.util.Stack;
public class GetLocal1Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal1Ins() {
super(0xd1, "getlocal_1", new int[]{});
}
public GetLocal1Ins() {
super(0xd1, "getlocal_1", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
lda.operandStack.push(lda.localRegisters.get(1));
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
lda.operandStack.push(lda.localRegisters.get(1));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new LocalRegTreeItem(ins, 1, localRegs.get(1)));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new LocalRegTreeItem(ins, 1, localRegs.get(1)));
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 1;
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
}

View File

@@ -30,27 +30,27 @@ import java.util.Stack;
public class GetLocal2Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal2Ins() {
super(0xd2, "getlocal_2", new int[]{});
}
public GetLocal2Ins() {
super(0xd2, "getlocal_2", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
lda.operandStack.push(lda.localRegisters.get(2));
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
lda.operandStack.push(lda.localRegisters.get(2));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new LocalRegTreeItem(ins, 2, localRegs.get(2)));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new LocalRegTreeItem(ins, 2, localRegs.get(2)));
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 2;
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 2;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
}

View File

@@ -30,27 +30,27 @@ import java.util.Stack;
public class GetLocal3Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal3Ins() {
super(0xd3, "getlocal_3", new int[]{});
}
public GetLocal3Ins() {
super(0xd3, "getlocal_3", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
lda.operandStack.push(lda.localRegisters.get(3));
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
lda.operandStack.push(lda.localRegisters.get(3));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new LocalRegTreeItem(ins, 3, localRegs.get(3)));
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
stack.push(new LocalRegTreeItem(ins, 3, localRegs.get(3)));
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 3;
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 3;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1;
}
}

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