AS3: alchemy separated

AS3: new undocumented opcodes
AS3: Switch fix
Error log blinking icon, locales
This commit is contained in:
Jindra Petk
2013-07-13 12:13:08 +02:00
parent 547add2a74
commit 3258ec4f07
28 changed files with 1049 additions and 89 deletions

View File

@@ -24,6 +24,19 @@ import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphSource;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Lf32Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Lf64Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Li16Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Li32Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Li8Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Sf32Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Sf64Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Si16Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Si32Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Si8Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Sxi16Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Sxi1Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Sxi8Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.*;
import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.*;
import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.EqualsIns;
@@ -96,6 +109,7 @@ public class AVM2Code implements Serializable {
public static final int DAT_DOUBLE_INDEX = OPT_U30 + 0x10;
public static final int DAT_DECIMAL_INDEX = OPT_U30 + 0x11;
public static final int DAT_CASE_BASEOFFSET = OPT_S24 + 0x12;
public static final int DAT_DECIMAL_PARAMS = OPT_U30 + 0x13;
public static InstructionDefinition instructionSet[] = new InstructionDefinition[]{
new AddIns(),
new InstructionDefinition(0x9b, "add_d", new int[]{}) {
@@ -105,7 +119,7 @@ public class AVM2Code implements Serializable {
}
},
new AddIIns(),
new InstructionDefinition(0xb5, "add_p", new int[]{AVM2Code.OPT_U30}),
new InstructionDefinition(0xb5, "add_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}),
new ApplyTypeIns(),
new AsTypeIns(),
new AsTypeLateIns(),
@@ -150,7 +164,7 @@ public class AVM2Code implements Serializable {
new ConvertUIns(),
new ConvertSIns(),
new InstructionDefinition(0x79, "convert_m", new int[]{}), //-1 +1
new InstructionDefinition(0x7a, "convert_m_p", new int[]{AVM2Code.OPT_U30 /*param (?)*/}) {
new InstructionDefinition(0x7a, "convert_m_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -177,7 +191,7 @@ public class AVM2Code implements Serializable {
}
},
new DivideIns(),
new InstructionDefinition(0xb8, "divide_p", new int[]{AVM2Code.OPT_U30}) {
new InstructionDefinition(0xb8, "divide_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; //?
@@ -264,10 +278,10 @@ public class AVM2Code implements Serializable {
new IncLocalIIns(),
new IncrementIns(),
new IncrementIIns(),
new InstructionDefinition(0x9c, "increment_p", new int[]{AVM2Code.OPT_U30 /*param*/}),
new InstructionDefinition(0x9d, "inclocal_p", new int[]{AVM2Code.OPT_U30 /*param*/, AVM2Code.DAT_REGISTER_INDEX}),
new InstructionDefinition(0x9e, "decrement_p", new int[]{AVM2Code.OPT_U30 /*param*/}),
new InstructionDefinition(0x9f, "declocal_p", new int[]{AVM2Code.OPT_U30 /*param*/, AVM2Code.DAT_REGISTER_INDEX}),
new InstructionDefinition(0x9c, "increment_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}),
new InstructionDefinition(0x9d, "inclocal_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS, AVM2Code.DAT_REGISTER_INDEX}),
new InstructionDefinition(0x9e, "decrement_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}),
new InstructionDefinition(0x9f, "declocal_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS, AVM2Code.DAT_REGISTER_INDEX}),
new InitPropertyIns(),
new InstanceOfIns(),
new IsTypeIns(),
@@ -280,7 +294,7 @@ public class AVM2Code implements Serializable {
new LookupSwitchIns(),
new LShiftIns(),
new ModuloIns(),
new InstructionDefinition(0xb9, "modulo_p", new int[]{AVM2Code.OPT_U30}) {
new InstructionDefinition(0xb9, "modulo_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; //?
@@ -288,7 +302,7 @@ public class AVM2Code implements Serializable {
},
new MultiplyIns(),
new MultiplyIIns(),
new InstructionDefinition(0xb7, "multiply_p", new int[]{AVM2Code.OPT_U30}) {
new InstructionDefinition(0xb7, "multiply_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; //?
@@ -296,7 +310,7 @@ public class AVM2Code implements Serializable {
},
new NegateIns(),
new NegateIIns(),
new InstructionDefinition(0x8f, "negate_p", new int[]{AVM2Code.OPT_U30 /* param */}) {
new InstructionDefinition(0x8f, "negate_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -377,7 +391,7 @@ public class AVM2Code implements Serializable {
new StrictEqualsIns(),
new SubtractIns(),
new SubtractIIns(),
new InstructionDefinition(0xb6, "subtract_p", new int[]{AVM2Code.OPT_U30}) {
new InstructionDefinition(0xb6, "subtract_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -393,7 +407,20 @@ public class AVM2Code implements Serializable {
new InstructionDefinition(0xf3, "timestamp", new int[]{}),
new TypeOfIns(),
new URShiftIns(),
new InstructionDefinition(0x35, "li8", new int[]{}) {
new Li8Ins(),
new Li16Ins(),
new Li32Ins(),
new Lf32Ins(),
new Lf64Ins(),
new Si8Ins(),
new Si16Ins(),
new Si32Ins(),
new Sf32Ins(),
new Sf64Ins(),
new Sxi1Ins(),
new Sxi8Ins(),
new Sxi16Ins(),
new InstructionDefinition(0xf5, "verifypass", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -404,7 +431,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x36, "li16", new int[]{}) {
new InstructionDefinition(0xf6, "alloc", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -415,7 +442,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x37, "li32", new int[]{}) {
new InstructionDefinition(0xf7, "mark", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -426,7 +453,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x38, "lf32", new int[]{}) {
new InstructionDefinition(0xf8, "wb", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -437,7 +464,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x39, "lf64", new int[]{}) {
new InstructionDefinition(0xf9, "prologue", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -448,7 +475,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x3A, "si8", new int[]{}) {
new InstructionDefinition(0xfa, "sendenter", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -459,7 +486,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x3B, "si16", new int[]{}) {
new InstructionDefinition(0xfb, "doubletoatom", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -470,7 +497,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x3C, "si32", new int[]{}) {
new InstructionDefinition(0xfc, "sweep", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -481,7 +508,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x3D, "sf32", new int[]{}) {
new InstructionDefinition(0xfd, "codegenop", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -492,7 +519,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x3E, "sf64", new int[]{}) {
new InstructionDefinition(0xfe, "verifyop", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -503,7 +530,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x50, "sxi1", new int[]{}) {
new InstructionDefinition(0xff, "decode", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -514,18 +541,7 @@ public class AVM2Code implements Serializable {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x51, "sxi8", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
}
},
new InstructionDefinition(0x52, "sxi16", new int[]{}) {
new InstructionDefinition(0xee, "abs_jump", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -545,7 +561,7 @@ public class AVM2Code implements Serializable {
InstructionDefinition result[] = new InstructionDefinition[256];
for (InstructionDefinition id : instructionSet) {
if (result[id.instructionCode] != null) {
System.out.println("Warning: Duplicate OPCODE for instruction " + result[id.instructionCode] + " " + id);
Logger.getLogger(AVM2Code.class.getName()).log(Level.WARNING, "Duplicate OPCODE for instruction {0} {1}", new Object[]{result[id.instructionCode], id});
}
result[id.instructionCode] = id;
}

View File

@@ -389,12 +389,14 @@ public class AVM2Graph extends Graph {
&& (stack.peek() instanceof StrictEqTreeItem)
&& (part.nextParts.get(0).getHeight() >= 2)
&& (this.code.code.get(this.code.fixIPAfterDebugLine(part.nextParts.get(0).start)).definition instanceof PushIntegerTypeIns)
&& (!part.nextParts.get(0).nextParts.isEmpty())
&& (this.code.code.get(part.nextParts.get(0).nextParts.get(0).end).definition instanceof LookupSwitchIns))
|| ((part.nextParts.size() == 2)
&& (!stack.isEmpty())
&& (stack.peek() instanceof StrictNeqTreeItem)
&& (part.nextParts.get(1).getHeight() >= 2)
&& (this.code.code.get(this.code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns)
&& (!part.nextParts.get(1).nextParts.isEmpty())
&& (this.code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) {
if (stack.peek() instanceof StrictEqTreeItem) {
@@ -479,14 +481,7 @@ public class AVM2Graph extends Graph {
List<List<GraphTargetItem>> caseCommands = new ArrayList<>();
GraphPart next = null;
List<GraphPart> loopContinues = getLoopsContinues(loops);
next = switchLoc.getNextPartPath(loopContinues);
if (next == null) {
next = switchLoc.getNextSuperPartPath(loopContinues);
}
GraphTargetItem ti = checkLoop(next, stopPart, loops);
next = getMostCommonPart(switchLoc.nextParts, loops);//getNextPartPath(loopContinues);
currentLoop = new Loop(loops.size(), null, next);
currentLoop.phase = 1;
loops.add(currentLoop);
@@ -526,8 +521,8 @@ public class AVM2Graph extends Graph {
List<GraphTargetItem> cc = new ArrayList<>();
List<GraphPart> stopPart2 = new ArrayList<>(stopPart);
for (int j = 0; j < caseBodies.size(); j++) {
if (j != i) {
stopPart2.add(caseBodies.get(i));
if (caseBodies.get(j) != caseBodies.get(i)) {
stopPart2.add(caseBodies.get(j));
}
}
if (hasDefault) {

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyLoadTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Lf32Ins extends InstructionDefinition {
public Lf32Ins() {
super(0x38, "lf32", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1 - 1;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
stack.push(new AlchemyLoadTreeItem(ins, ofs, instructionName));
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyLoadTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Lf64Ins extends InstructionDefinition {
public Lf64Ins() {
super(0x39, "lf64", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1 - 1;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
stack.push(new AlchemyLoadTreeItem(ins, ofs, instructionName));
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyLoadTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Li16Ins extends InstructionDefinition {
public Li16Ins() {
super(0x36, "li16", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1 - 1;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
stack.push(new AlchemyLoadTreeItem(ins, ofs, instructionName));
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyLoadTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Li32Ins extends InstructionDefinition {
public Li32Ins() {
super(0x37, "li32", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1 - 1;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
stack.push(new AlchemyLoadTreeItem(ins, ofs, instructionName));
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyLoadTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Li8Ins extends InstructionDefinition {
public Li8Ins() {
super(0x35, "li8", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1 - 1;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
stack.push(new AlchemyLoadTreeItem(ins, ofs, instructionName));
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyStoreTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Sf32Ins extends InstructionDefinition {
public Sf32Ins() {
super(0x3D, "sf32", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
GraphTargetItem value = stack.pop();
stack.push(new AlchemyStoreTreeItem(ins, value, ofs, instructionName));
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyStoreTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Sf64Ins extends InstructionDefinition {
public Sf64Ins() {
super(0x3E, "sf64", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
GraphTargetItem value = stack.pop();
stack.push(new AlchemyStoreTreeItem(ins, value, ofs, instructionName));
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyStoreTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Si16Ins extends InstructionDefinition {
public Si16Ins() {
super(0x3B, "si16", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
GraphTargetItem value = stack.pop();
stack.push(new AlchemyStoreTreeItem(ins, value, ofs, instructionName));
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyStoreTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Si32Ins extends InstructionDefinition {
public Si32Ins() {
super(0x3C, "si32", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
GraphTargetItem value = stack.pop();
stack.push(new AlchemyStoreTreeItem(ins, value, ofs, instructionName));
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemyStoreTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Si8Ins extends InstructionDefinition {
public Si8Ins() {
super(0x3A, "si8", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem ofs = stack.pop();
GraphTargetItem value = stack.pop();
stack.push(new AlchemyStoreTreeItem(ins, value, ofs, instructionName));
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemySignExtendTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Sxi16Ins extends InstructionDefinition {
public Sxi16Ins() {
super(0x52, "sxi_16", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1 - 1;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem value = stack.pop();
stack.push(new AlchemySignExtendTreeItem(ins, value, instructionName));
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemySignExtendTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Sxi1Ins extends InstructionDefinition {
public Sxi1Ins() {
super(0x50, "sxi_1", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1 - 1;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem value = stack.pop();
stack.push(new AlchemySignExtendTreeItem(ins, value, instructionName));
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.treemodel.AlchemySignExtendTreeItem;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class Sxi8Ins extends InstructionDefinition {
public Sxi8Ins() {
super(0x51, "sxi_8", new int[]{});
}
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1 - 1;
}
@Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0;
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path) {
GraphTargetItem value = stack.pop();
stack.push(new AlchemySignExtendTreeItem(ins, value, instructionName));
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.treemodel;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
/**
*
* @author JPEXS
*/
public class AlchemyLoadTreeItem extends TreeItem {
private String name;
private GraphTargetItem ofs;
public AlchemyLoadTreeItem(GraphSourceItem instruction, GraphTargetItem ofs, String name) {
super(instruction, PRECEDENCE_PRIMARY);
this.name = name;
this.ofs = ofs;
}
@Override
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return hilight("op_" + name + "(") + ofs.toString(constants, localRegNames, fullyQualifiedNames) + hilight(") /*Alchemy*/");
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.treemodel;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
/**
*
* @author JPEXS
*/
public class AlchemySignExtendTreeItem extends TreeItem {
private String name;
public AlchemySignExtendTreeItem(GraphSourceItem instruction, GraphTargetItem value, String name) {
super(instruction, PRECEDENCE_PRIMARY);
this.name = name;
this.value = value;
}
@Override
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return hilight("op_" + name + "(") + value.toString(constants, localRegNames, fullyQualifiedNames) + hilight(") /*Alchemy*/");
}
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.abc.avm2.treemodel;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import java.util.HashMap;
import java.util.List;
/**
*
* @author JPEXS
*/
public class AlchemyStoreTreeItem extends TreeItem {
private String name;
private GraphTargetItem ofs;
public AlchemyStoreTreeItem(GraphSourceItem instruction, GraphTargetItem value, GraphTargetItem ofs, String name) {
super(instruction, PRECEDENCE_PRIMARY);
this.name = name;
this.ofs = ofs;
this.value = value;
}
@Override
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return hilight("op_" + name + "(") + ofs.toString(constants, localRegNames, fullyQualifiedNames) + hilight(",") + value.toString(constants, localRegNames, fullyQualifiedNames) + hilight(") /*Alchemy*/");
}
}

View File

@@ -36,7 +36,7 @@ import java.util.logging.Logger;
public class MethodBody implements Cloneable, Serializable {
boolean debugMode = true;
boolean debugMode = false;
public int method_info;
public int max_stack;
public int max_regs;

View File

@@ -1366,6 +1366,9 @@ public class Graph {
if (currentLoop != null) {
currentLoop.phase = 0;
}
if (debugMode) {
System.err.println("Adding break");
}
ret.add(new BreakItem(null, el.id));
return ret;
}
@@ -1373,6 +1376,9 @@ public class Graph {
if (currentLoop != null) {
currentLoop.phase = 0;
}
if (debugMode) {
System.err.println("Adding precontinue");
}
ret.add(new ContinueItem(null, el.id));
return ret;
}
@@ -1380,6 +1386,9 @@ public class Graph {
if (currentLoop != null) {
currentLoop.phase = 0;
}
if (debugMode) {
System.err.println("Adding continue");
}
ret.add(new ContinueItem(null, el.id));
return ret;
}
@@ -1704,9 +1713,6 @@ public class Graph {
LoopItem li = loopItem;
boolean loopTypeFound = false;
boolean hasContinue = false;
processIfs(loopItem.commands);
checkContinueAtTheEnd(loopItem.commands, currentLoop);

View File

@@ -17,10 +17,14 @@
package com.jpexs.decompiler.flash.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.PrintWriter;
@@ -54,15 +58,17 @@ public class ErrorLogFrame extends AppFrame {
}
public ErrorLogFrame() {
setTitle("Log");
setSize(500, 400);
setTitle(translate("dialog.title"));
setSize(700, 400);
setBackground(Color.white);
View.centerScreen(this);
View.setWindowIcon(this);
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
Container cnt = getContentPane();
cnt.setLayout(new BorderLayout());
logView.setBackground(Color.white);
logView.setLayout(new ListLayout());
cnt.setBackground(Color.white);
cnt.add(new JScrollPane(logView));
handler = new Handler() {
@@ -79,44 +85,68 @@ public class ErrorLogFrame extends AppFrame {
public void close() throws SecurityException {
}
};
//setAlwaysOnTop(true);
}
public void log(Level level, String msg, String detail) {
if (detail == null) {
log(level, msg, (JComponent) null);
return;
}
final JTextArea detailTextArea = new JTextArea(detail);
detailTextArea.setEditable(false);
detailTextArea.setOpaque(false);
detailTextArea.setFont(new JLabel().getFont());
log(level, msg, detailTextArea);
}
private void log(Level level, String msg, final JComponent detail) {
private void log(final Level level, final String msg, final String detail) {
JPanel pan = new JPanel();
pan.setBackground(Color.white);
pan.setLayout(new ListLayout());
JComponent detailComponent;
if (detail == null) {
detailComponent = null;
} else {
final JTextArea detailTextArea = new JTextArea(detail);
detailTextArea.setEditable(false);
detailTextArea.setOpaque(false);
detailTextArea.setFont(new JLabel().getFont());
detailTextArea.setBackground(Color.white);
detailComponent = detailTextArea;
}
JPanel header = new JPanel();
header.setLayout(new BoxLayout(header, BoxLayout.X_AXIS));
header.setBackground(Color.white);
SimpleDateFormat format = new SimpleDateFormat("dd/MM/YYYY HH:mm:ss");
final String dateStr = format.format(new Date());
JToggleButton copyButton = new JToggleButton(View.getIcon("copy16"));
copyButton.setFocusPainted(false);
copyButton.setBorderPainted(false);
copyButton.setFocusable(false);
copyButton.setContentAreaFilled(false);
copyButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
copyButton.setMargin(new Insets(2, 2, 2, 2));
copyButton.setToolTipText(translate("copy"));
copyButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection stringSelection = new StringSelection(dateStr + " " + level.toString() + " " + msg + "\r\n" + detail);
clipboard.setContents(stringSelection, null);
}
});
final JToggleButton expandButton = new JToggleButton(View.getIcon("expand16"));
expandButton.setFocusPainted(false);
expandButton.setBorderPainted(false);
expandButton.setFocusable(false);
expandButton.setContentAreaFilled(false);
expandButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
expandButton.setMargin(new Insets(2, 2, 2, 2));
expandButton.setToolTipText(translate("details"));
final JScrollPane scrollPane;
if (detail != null) {
scrollPane = new JScrollPane(detail);
if (detailComponent != null) {
scrollPane = new JScrollPane(detailComponent);
scrollPane.setAlignmentX(0f);
scrollPane.setMinimumSize(new Dimension(getWidth(), 500));
} else {
scrollPane = null;
}
expandButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
if (detail != null) {
expandButton.setMargin(new Insets(2, 2, 2, 2));
if (detailComponent != null) {
expandButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -127,10 +157,10 @@ public class ErrorLogFrame extends AppFrame {
});
}
SimpleDateFormat format = new SimpleDateFormat("dd/MM/YYYY HH:mm:ss");
JLabel dateLabel = new JLabel(format.format(new Date()));
dateLabel.setPreferredSize(new Dimension(130, 25));
JLabel dateLabel = new JLabel(dateStr);
dateLabel.setPreferredSize(new Dimension(140, 25));
dateLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
header.add(dateLabel);
@@ -148,17 +178,16 @@ public class ErrorLogFrame extends AppFrame {
msgLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
header.add(msgLabel);
header.setAlignmentX(0f);
if (detail != null) {
if (detailComponent != null) {
header.add(expandButton);
}
header.add(copyButton);
pan.add(header);
if (detail != null) {
if (detailComponent != null) {
pan.add(scrollPane);
scrollPane.setVisible(false);
}
//pan.setPreferredSize(new Dimension(getWidth(), 30));
pan.setAlignmentX(0f);
//curGBConstraints.weighty = 1;
logView.add(pan);
revalidate();
repaint();

View File

@@ -767,7 +767,7 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection
errorNotificationButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
errorNotificationButton.setActionCommand("SHOWERRORLOG");
errorNotificationButton.addActionListener(this);
errorNotificationButton.setToolTipText("There are no errors in the log");
errorNotificationButton.setToolTipText(translate("errors.none"));
statusPanel.add(errorNotificationButton, BorderLayout.EAST);
@@ -1051,11 +1051,33 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection
Logger logger = Logger.getLogger("");
logger.addHandler(errorLogFrame.getHandler());
logger.addHandler(new Handler() {
private Timer timer = null;
private int pos = 0;
@Override
public void publish(LogRecord record) {
if (record.getLevel() == Level.SEVERE) {
errorNotificationButton.setIcon(View.getIcon("error16"));
errorNotificationButton.setToolTipText("There are ERRORS in the log");
errorNotificationButton.setToolTipText(translate("errors.present"));
if (timer != null) {
timer.cancel();
}
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
pos++;
if ((pos % 2) == 0) {
errorNotificationButton.setIcon(View.getIcon("error16"));
} else {
errorNotificationButton.setIcon(null);
errorNotificationButton.setSize(16, 16);
}
if (pos == 4) {
cancel();
}
}
}, 500, 500);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

View File

@@ -13,3 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
copy = Copy to clipboard
details = View details
dialog.title = Log

View File

@@ -0,0 +1,18 @@
# Copyright (C) 2013 JPEXS
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
copy = Zkop\u00edrovat do schr\u00e1nky
details = Zobrazit detaily
dialog.title = Log

View File

@@ -230,4 +230,7 @@ font.characters.add = Add characters:
value.unknown = ?
yes = yes
no = no
no = no
errors.present = There are ERRORS in the log. Click to view.
errors.none = There are no errors in the log

View File

@@ -230,4 +230,7 @@ font.characters.add = P\u0159idat znaky:
value.unknown = ?
yes = ano
no = ne
no = ne
errors.present = V logu jsou CHYBY. Klikn\u011bte pro zobrazen\u00ed.
errors.none = V logu nejsou \u017e\u00e1dn\u00e9 chyby

View File

@@ -16,16 +16,16 @@ public class ABCStreamTest {
@Test
public void testU30() {
try(ByteArrayOutputStream baos = new ByteArrayOutputStream();
ABCOutputStream aos = new ABCOutputStream(baos)) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ABCOutputStream aos = new ABCOutputStream(baos);) {
long number = 1531;
aos.writeU30(number);
aos.close();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ABCInputStream ais = new ABCInputStream(bais);
assertEquals(number, ais.readU30());
assertEquals(0, bais.available());
ais.close();
try (ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ABCInputStream ais = new ABCInputStream(bais);) {
assertEquals(number, ais.readU30());
assertEquals(0, bais.available());
}
} catch (IOException ex) {
fail();
}