mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-20 20:45:35 +00:00
FlashPlayer path modified to "lib/FlashPlayer.exe"
Source Formatting Few refactorings
This commit is contained in:
@@ -2411,24 +2411,24 @@ public class AVM2Code implements Serializable {
|
||||
public boolean skipUsed = false;
|
||||
}
|
||||
|
||||
private static int removeTraps(boolean secondPass, boolean useVisited,List localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, AVM2GraphSource code, int ip, int lastIp, List<Integer> visited,HashMap<GraphSourceItem, Decision> decisions) {
|
||||
private static int removeTraps(boolean secondPass, boolean useVisited, List localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, AVM2GraphSource code, int ip, int lastIp, List<Integer> visited, HashMap<GraphSourceItem, Decision> decisions) {
|
||||
boolean debugMode = false;
|
||||
int ret = 0;
|
||||
while ((ip > -1) && ip < code.size()) {
|
||||
if(useVisited && visited.contains(ip)){
|
||||
if (useVisited && visited.contains(ip)) {
|
||||
break;
|
||||
}
|
||||
if(!visited.contains(ip)){
|
||||
if (!visited.contains(ip)) {
|
||||
visited.add(ip);
|
||||
}
|
||||
lastIp = ip;
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
if(ins.isIgnored()){
|
||||
if (ins.isIgnored()) {
|
||||
ip++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (debugMode) {
|
||||
System.out.println((useVisited?"useV ":"")+"Visit " + ip + ": " + ins + " stack:" + Highlighting.stripHilights(stack.toString()));
|
||||
System.out.println((useVisited ? "useV " : "") + "Visit " + ip + ": " + ins + " stack:" + Highlighting.stripHilights(stack.toString()));
|
||||
}
|
||||
if ((ins instanceof AVM2Instruction) && (((AVM2Instruction) ins).definition instanceof NewFunctionIns)) {
|
||||
stack.push(new BooleanTreeItem(null, true));
|
||||
@@ -2454,7 +2454,7 @@ public class AVM2Code implements Serializable {
|
||||
Decision dec = new Decision();
|
||||
if (decisions.containsKey(ins)) {
|
||||
dec = decisions.get(ins);
|
||||
}else{
|
||||
} else {
|
||||
decisions.put(ins, dec);
|
||||
}
|
||||
if (condition) {
|
||||
@@ -2472,7 +2472,7 @@ public class AVM2Code implements Serializable {
|
||||
}
|
||||
}
|
||||
GraphTargetItem tar = stack.pop();
|
||||
if (secondPass && (dec.jumpUsed != dec.skipUsed)) {
|
||||
if (secondPass && (dec.jumpUsed != dec.skipUsed)) {
|
||||
for (GraphSourceItemPos pos : tar.getNeededSources()) {
|
||||
if (pos.item != ins) {
|
||||
pos.item.setIgnored(true);
|
||||
@@ -2480,7 +2480,7 @@ public class AVM2Code implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
ret += removeTraps(secondPass,useVisited, localData, stack, output, code, condition ? branches.get(0) : branches.get(1), ip, visited,decisions);
|
||||
ret += removeTraps(secondPass, useVisited, localData, stack, output, code, condition ? branches.get(0) : branches.get(1), ip, visited, decisions);
|
||||
} else {
|
||||
if (ins.isBranch() && (!ins.isJump())) {
|
||||
stack.pop();
|
||||
@@ -2489,7 +2489,7 @@ public class AVM2Code implements Serializable {
|
||||
for (int b : branches) {
|
||||
Stack<GraphTargetItem> brStack = (Stack<GraphTargetItem>) stack.clone();
|
||||
if (b >= 0) {
|
||||
ret += removeTraps(secondPass,useVisited||(!ins.isJump()), localData, brStack, output, code, b, ip, visited,decisions);
|
||||
ret += removeTraps(secondPass, useVisited || (!ins.isJump()), localData, brStack, output, code, b, ip, visited, decisions);
|
||||
} else {
|
||||
if (debugMode) {
|
||||
System.out.println("Negative branch:" + b);
|
||||
@@ -2508,8 +2508,8 @@ public class AVM2Code implements Serializable {
|
||||
}
|
||||
|
||||
public static int removeTraps(List localData, AVM2GraphSource code, int addr) {
|
||||
HashMap<GraphSourceItem, AVM2Code.Decision> decisions=new HashMap<GraphSourceItem, AVM2Code.Decision>();
|
||||
removeTraps(false,false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0,new ArrayList<Integer>(), decisions);
|
||||
return removeTraps(true,false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0,new ArrayList<Integer>(),decisions);
|
||||
HashMap<GraphSourceItem, AVM2Code.Decision> decisions = new HashMap<GraphSourceItem, AVM2Code.Decision>();
|
||||
removeTraps(false, false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0, new ArrayList<Integer>(), decisions);
|
||||
return removeTraps(true, false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0, new ArrayList<Integer>(), decisions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ 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.DecLocalTreeItem;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.treemodel.IntegerValueTreeItem;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.AddTreeItem;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.SubtractTreeItem;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
@@ -61,6 +60,6 @@ public class DecLocalIIns extends InstructionDefinition {
|
||||
int regIndex = ins.operands[0];
|
||||
output.add(new DecLocalTreeItem(ins, regIndex));
|
||||
localRegs.put(regIndex, new SubtractTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1))));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ public class IncLocalIns extends InstructionDefinition {
|
||||
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 IncLocalTreeItem(ins, regIndex));
|
||||
localRegs.put(regIndex, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1))));
|
||||
localRegs.put(regIndex, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,5 +33,5 @@ public class IncLocalTreeItem extends TreeItem {
|
||||
@Override
|
||||
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
return localRegName(localRegNames, regIndex) + hilight("++");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ package com.jpexs.decompiler.flash.action;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.parser.ASMParser;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParser;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.*;
|
||||
import com.jpexs.decompiler.flash.action.swf5.*;
|
||||
import com.jpexs.decompiler.flash.action.swf6.ActionEnumerate2;
|
||||
@@ -215,8 +215,8 @@ public class Action implements GraphSourceItem {
|
||||
* @throws ParseException When read object is not String
|
||||
*/
|
||||
protected String lexString(FlasmLexer lex) throws IOException, ParseException {
|
||||
ParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ParsedSymbol.TYPE_STRING) {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_STRING) {
|
||||
throw new ParseException("String expected", lex.yyline());
|
||||
}
|
||||
return (String) symb.value;
|
||||
@@ -230,8 +230,8 @@ public class Action implements GraphSourceItem {
|
||||
* @throws ParseException When read object is not Block startServer
|
||||
*/
|
||||
protected void lexBlockOpen(FlasmLexer lex) throws IOException, ParseException {
|
||||
ParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ParsedSymbol.TYPE_BLOCK_START) {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_BLOCK_START) {
|
||||
throw new ParseException("Block startServer ", lex.yyline());
|
||||
}
|
||||
}
|
||||
@@ -245,8 +245,8 @@ public class Action implements GraphSourceItem {
|
||||
* @throws ParseException When read object is not Identifier
|
||||
*/
|
||||
protected String lexIdentifier(FlasmLexer lex) throws IOException, ParseException {
|
||||
ParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ParsedSymbol.TYPE_IDENTIFIER) {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_IDENTIFIER) {
|
||||
throw new ParseException("Identifier expected", lex.yyline());
|
||||
}
|
||||
return (String) symb.value;
|
||||
@@ -261,8 +261,8 @@ public class Action implements GraphSourceItem {
|
||||
* @throws ParseException When read object is not long value
|
||||
*/
|
||||
protected long lexLong(FlasmLexer lex) throws IOException, ParseException {
|
||||
ParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ParsedSymbol.TYPE_INTEGER) {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_INTEGER) {
|
||||
throw new ParseException("Integer expected", lex.yyline());
|
||||
}
|
||||
return (Long) symb.value;
|
||||
@@ -277,8 +277,8 @@ public class Action implements GraphSourceItem {
|
||||
* @throws ParseException When read object is not boolean value
|
||||
*/
|
||||
protected boolean lexBoolean(FlasmLexer lex) throws IOException, ParseException {
|
||||
ParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ParsedSymbol.TYPE_BOOLEAN) {
|
||||
ASMParsedSymbol symb = lex.yylex();
|
||||
if (symb.type != ASMParsedSymbol.TYPE_BOOLEAN) {
|
||||
throw new ParseException("Boolean expected", lex.yyline());
|
||||
}
|
||||
return (Boolean) symb.value;
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.flashlite;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.StrictModeTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -20,8 +20,8 @@ import com.jpexs.decompiler.flash.Main;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.abc.gui.LineMarkedEditorPane;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraph;
|
||||
import com.jpexs.decompiler.flash.action.parser.ASMParser;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParser;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.gui.GraphFrame;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
@@ -118,7 +118,16 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
//com.jpexs.decompiler.flash.action.Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION);
|
||||
String s = com.jpexs.decompiler.flash.action.Action.actionsToSource(as, SWF.DEFAULT_VERSION);
|
||||
decompiledHilights = Highlighting.getInstrHighlights(s);
|
||||
decompiledEditor.setText(Highlighting.stripHilights(s));
|
||||
String stripped = Highlighting.stripHilights(s);
|
||||
/*try {
|
||||
ActionScriptParser.parse(stripped);
|
||||
} catch (ParseException ex) {
|
||||
JOptionPane.showMessageDialog(null, ex.getMessage());
|
||||
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}*/
|
||||
decompiledEditor.setText(stripped);
|
||||
}
|
||||
setEditMode(false);
|
||||
Main.stopWork();
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* 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.action.parser;
|
||||
package com.jpexs.decompiler.flash.action.parser.pcode;
|
||||
|
||||
public class ParsedSymbol {
|
||||
public class ASMParsedSymbol {
|
||||
|
||||
public int type;
|
||||
public Object value;
|
||||
@@ -38,12 +38,12 @@ public class ParsedSymbol {
|
||||
public static final int TYPE_EOL = 16;
|
||||
public static final int TYPE_CONSTANT_LITERAL = 17;
|
||||
|
||||
public ParsedSymbol(int type, Object value) {
|
||||
public ASMParsedSymbol(int type, Object value) {
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public ParsedSymbol(int type) {
|
||||
public ASMParsedSymbol(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,12 @@
|
||||
* 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.action.parser;
|
||||
package com.jpexs.decompiler.flash.action.parser.pcode;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.flashlite.ActionFSCommand2;
|
||||
import com.jpexs.decompiler.flash.action.flashlite.ActionStrictMode;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionNop;
|
||||
import com.jpexs.decompiler.flash.action.swf3.*;
|
||||
import com.jpexs.decompiler.flash.action.swf4.*;
|
||||
@@ -43,10 +44,10 @@ public class ASMParser {
|
||||
Stack<GraphSourceItemContainer> containers = new Stack<GraphSourceItemContainer>();
|
||||
HashMap<GraphSourceItemContainer, Integer> containerPos = new HashMap<GraphSourceItemContainer, Integer>();
|
||||
while (true) {
|
||||
ParsedSymbol symb = lexer.yylex();
|
||||
if (symb.type == ParsedSymbol.TYPE_LABEL) {
|
||||
ASMParsedSymbol symb = lexer.yylex();
|
||||
if (symb.type == ASMParsedSymbol.TYPE_LABEL) {
|
||||
labels.add(new Label((String) symb.value, address));
|
||||
} else if (symb.type == ParsedSymbol.TYPE_COMMENT) {
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_COMMENT) {
|
||||
if (!list.isEmpty()) {
|
||||
String cmt = (String) symb.value;
|
||||
if (cmt.equals("compileTime")) {
|
||||
@@ -56,7 +57,7 @@ public class ASMParser {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (symb.type == ParsedSymbol.TYPE_BLOCK_END) {
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_BLOCK_END) {
|
||||
if (containers.isEmpty()) {
|
||||
throw new ParseException("Block end without start", lexer.yyline());
|
||||
}
|
||||
@@ -66,7 +67,7 @@ public class ASMParser {
|
||||
if (!a.parseDivision(pos, address, lexer)) {
|
||||
containers.pop();
|
||||
}
|
||||
} else if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
String instructionName = ((String) symb.value).toLowerCase();
|
||||
Action a = null;
|
||||
if (instructionName.equals("GetURL".toLowerCase())) {
|
||||
@@ -298,8 +299,8 @@ public class ASMParser {
|
||||
if (a != null) {
|
||||
list.add(a);
|
||||
}
|
||||
} else if (symb.type == ParsedSymbol.TYPE_EOL) {
|
||||
} else if ((symb.type == ParsedSymbol.TYPE_BLOCK_END) || (symb.type == ParsedSymbol.TYPE_EOF)) {
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_EOL) {
|
||||
} else if ((symb.type == ASMParsedSymbol.TYPE_BLOCK_END) || (symb.type == ASMParsedSymbol.TYPE_EOF)) {
|
||||
return list;
|
||||
} else {
|
||||
throw new ParseException("Label or Instruction name expected, found:" + symb.type + " " + symb.value, lexer.yyline());
|
||||
@@ -1,8 +1,9 @@
|
||||
/* The following code was generated by JFlex 1.4.3 on 3.4.13 22:09 */
|
||||
/* The following code was generated by JFlex 1.4.3 on 7.4.13 15:38 */
|
||||
|
||||
/* Flash assembler language lexer specification */
|
||||
package com.jpexs.decompiler.flash.action.parser;
|
||||
package com.jpexs.decompiler.flash.action.parser.pcode;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
|
||||
import com.jpexs.decompiler.flash.action.swf4.Null;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
@@ -10,9 +11,9 @@ import com.jpexs.decompiler.flash.action.swf4.Undefined;
|
||||
|
||||
/**
|
||||
* This class is a scanner generated by
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3 on 3.4.13 22:09 from the
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3 on 7.4.13 15:38 from the
|
||||
* specification file
|
||||
* <tt>D:/Dokumenty/Programovani/JavaSE/FFDec/trunk/src/com/jpexs/decompiler/flash/action/parser/flasm.flex</tt>
|
||||
* <tt>D:/Dokumenty/Programovani/JavaSE/FFDec/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/flasm.flex</tt>
|
||||
*/
|
||||
public final class FlasmLexer {
|
||||
|
||||
@@ -722,7 +723,7 @@ public final class FlasmLexer {
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public ParsedSymbol yylex() throws java.io.IOException, ParseException {
|
||||
public ASMParsedSymbol yylex() throws java.io.IOException, ParseException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
|
||||
@@ -851,152 +852,152 @@ public final class FlasmLexer {
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 9: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_IDENTIFIER, yytext());
|
||||
}
|
||||
case 31:
|
||||
break;
|
||||
case 23: {
|
||||
string.append('\'');
|
||||
}
|
||||
case 31:
|
||||
break;
|
||||
case 25: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_BOOLEAN, Boolean.TRUE);
|
||||
}
|
||||
case 32:
|
||||
break;
|
||||
case 30: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_CONSTANT, new ConstantIndex(Integer.parseInt(yytext().substring(8))));
|
||||
}
|
||||
case 33:
|
||||
break;
|
||||
case 10: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_INTEGER, new Long(Long.parseLong((yytext()))));
|
||||
}
|
||||
case 34:
|
||||
break;
|
||||
case 7: {
|
||||
yybegin(YYINITIAL);
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_EOL);
|
||||
}
|
||||
case 35:
|
||||
break;
|
||||
case 19: {
|
||||
char val = (char) Integer.parseInt(yytext().substring(1), 8);
|
||||
string.append(val);
|
||||
}
|
||||
case 36:
|
||||
case 33:
|
||||
break;
|
||||
case 4: {
|
||||
string.append(yytext());
|
||||
}
|
||||
case 37:
|
||||
case 34:
|
||||
break;
|
||||
case 2: {
|
||||
yybegin(PARAMETERS);
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_INSTRUCTION_NAME, yytext());
|
||||
case 7: {
|
||||
yybegin(YYINITIAL);
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_EOL);
|
||||
}
|
||||
case 38:
|
||||
case 35:
|
||||
break;
|
||||
case 16: {
|
||||
string.append('\r');
|
||||
}
|
||||
case 39:
|
||||
case 36:
|
||||
break;
|
||||
case 12: {
|
||||
yybegin(STRING);
|
||||
string.setLength(0);
|
||||
}
|
||||
case 37:
|
||||
break;
|
||||
case 26: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_NULL, new Null());
|
||||
}
|
||||
case 38:
|
||||
break;
|
||||
case 3: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_BLOCK_END);
|
||||
}
|
||||
case 39:
|
||||
break;
|
||||
case 30: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_CONSTANT, new ConstantIndex(Integer.parseInt(yytext().substring(8))));
|
||||
}
|
||||
case 40:
|
||||
break;
|
||||
case 6: {
|
||||
yybegin(PARAMETERS);
|
||||
// length also includes the trailing quote
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_STRING, string.toString());
|
||||
}
|
||||
case 41:
|
||||
break;
|
||||
case 8: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_COMMENT, yytext().substring(1));
|
||||
}
|
||||
case 42:
|
||||
break;
|
||||
case 27: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_BOOLEAN, Boolean.FALSE);
|
||||
}
|
||||
case 43:
|
||||
break;
|
||||
case 22: {
|
||||
string.append('\b');
|
||||
}
|
||||
case 44:
|
||||
case 41:
|
||||
break;
|
||||
case 13: {
|
||||
String s = yytext();
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_LABEL, s.substring(0, s.length() - 1));
|
||||
case 9: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_IDENTIFIER, yytext());
|
||||
}
|
||||
case 45:
|
||||
case 42:
|
||||
break;
|
||||
case 5: {
|
||||
throw new ParseException("Unterminated string at end of line", yyline + 1);
|
||||
}
|
||||
case 46:
|
||||
case 43:
|
||||
break;
|
||||
case 11: {
|
||||
yybegin(YYINITIAL);
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_BLOCK_START);
|
||||
case 27: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_BOOLEAN, Boolean.FALSE);
|
||||
}
|
||||
case 47:
|
||||
case 44:
|
||||
break;
|
||||
case 24: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_FLOAT, new Double(Double.parseDouble((yytext()))));
|
||||
}
|
||||
case 45:
|
||||
break;
|
||||
case 15: {
|
||||
string.append('\t');
|
||||
}
|
||||
case 46:
|
||||
break;
|
||||
case 6: {
|
||||
yybegin(PARAMETERS);
|
||||
// length also includes the trailing quote
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_STRING, string.toString());
|
||||
}
|
||||
case 47:
|
||||
break;
|
||||
case 2: {
|
||||
yybegin(PARAMETERS);
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_INSTRUCTION_NAME, yytext());
|
||||
}
|
||||
case 48:
|
||||
break;
|
||||
case 28: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_REGISTER, new RegisterNumber(Integer.parseInt(yytext().substring(8))));
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_REGISTER, new RegisterNumber(Integer.parseInt(yytext().substring(8))));
|
||||
}
|
||||
case 49:
|
||||
break;
|
||||
case 24: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_FLOAT, new Double(Double.parseDouble((yytext()))));
|
||||
case 13: {
|
||||
String s = yytext();
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_LABEL, s.substring(0, s.length() - 1));
|
||||
}
|
||||
case 50:
|
||||
break;
|
||||
case 25: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_BOOLEAN, Boolean.TRUE);
|
||||
}
|
||||
case 51:
|
||||
break;
|
||||
case 26: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_NULL, new Null());
|
||||
}
|
||||
case 52:
|
||||
break;
|
||||
case 20: {
|
||||
string.append('\\');
|
||||
}
|
||||
case 53:
|
||||
case 51:
|
||||
break;
|
||||
case 14: {
|
||||
throw new ParseException("Illegal escape sequence \"" + yytext() + "\"", yyline + 1);
|
||||
}
|
||||
case 54:
|
||||
case 52:
|
||||
break;
|
||||
case 29: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_UNDEFINED, new Undefined());
|
||||
}
|
||||
case 53:
|
||||
break;
|
||||
case 18: {
|
||||
string.append('\n');
|
||||
}
|
||||
case 54:
|
||||
break;
|
||||
case 10: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_INTEGER, new Long(Long.parseLong((yytext()))));
|
||||
}
|
||||
case 55:
|
||||
break;
|
||||
case 3: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_BLOCK_END);
|
||||
}
|
||||
case 56:
|
||||
break;
|
||||
case 29: {
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_UNDEFINED, new Undefined());
|
||||
}
|
||||
case 57:
|
||||
break;
|
||||
case 17: {
|
||||
string.append('\f');
|
||||
}
|
||||
case 56:
|
||||
break;
|
||||
case 8: {
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_COMMENT, yytext().substring(1));
|
||||
}
|
||||
case 57:
|
||||
break;
|
||||
case 11: {
|
||||
yybegin(YYINITIAL);
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_BLOCK_START);
|
||||
}
|
||||
case 58:
|
||||
break;
|
||||
case 21: {
|
||||
@@ -1012,7 +1013,7 @@ public final class FlasmLexer {
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
{
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_EOF);
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_EOF);
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
@@ -14,7 +14,7 @@
|
||||
* 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.action.parser;
|
||||
package com.jpexs.decompiler.flash.action.parser.pcode;
|
||||
|
||||
public class Label {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* Flash assembler language lexer specification */
|
||||
|
||||
package com.jpexs.decompiler.flash.action.parser;
|
||||
package com.jpexs.decompiler.flash.action.parser.pcode;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
import com.jpexs.decompiler.flash.action.swf4.Undefined;
|
||||
@@ -16,7 +17,7 @@ import com.jpexs.decompiler.flash.action.swf4.Null;
|
||||
%char
|
||||
%line
|
||||
%column
|
||||
%type ParsedSymbol
|
||||
%type ASMParsedSymbol
|
||||
%throws ParseException
|
||||
|
||||
%{
|
||||
@@ -104,14 +105,14 @@ Constant= constant{PositiveNumberLiteral}
|
||||
|
||||
{Label} {
|
||||
String s=yytext();
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_LABEL,s.substring(0,s.length()-1));
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_LABEL,s.substring(0,s.length()-1));
|
||||
}
|
||||
|
||||
/* identifiers */
|
||||
{InstructionName} { yybegin(PARAMETERS);
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_INSTRUCTION_NAME,yytext());
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_INSTRUCTION_NAME,yytext());
|
||||
}
|
||||
{EndOfBlock} { return new ParsedSymbol(ParsedSymbol.TYPE_BLOCK_END); }
|
||||
{EndOfBlock} { return new ASMParsedSymbol(ASMParsedSymbol.TYPE_BLOCK_END); }
|
||||
}
|
||||
|
||||
<PARAMETERS> {
|
||||
@@ -123,20 +124,20 @@ Constant= constant{PositiveNumberLiteral}
|
||||
|
||||
/* numeric literals */
|
||||
|
||||
{NumberLiteral} { return new ParsedSymbol(ParsedSymbol.TYPE_INTEGER,new Long(Long.parseLong((yytext())))); }
|
||||
{FloatLiteral} { return new ParsedSymbol(ParsedSymbol.TYPE_FLOAT,new Double(Double.parseDouble((yytext())))); }
|
||||
{LineTerminator} {yybegin(YYINITIAL); return new ParsedSymbol(ParsedSymbol.TYPE_EOL); }
|
||||
{Comment} {return new ParsedSymbol(ParsedSymbol.TYPE_COMMENT,yytext().substring(1));}
|
||||
{StartOfBlock} { yybegin(YYINITIAL); return new ParsedSymbol(ParsedSymbol.TYPE_BLOCK_START); }
|
||||
{True} {return new ParsedSymbol(ParsedSymbol.TYPE_BOOLEAN,Boolean.TRUE);}
|
||||
{False} {return new ParsedSymbol(ParsedSymbol.TYPE_BOOLEAN,Boolean.FALSE);}
|
||||
{Null} {return new ParsedSymbol(ParsedSymbol.TYPE_NULL,new Null());}
|
||||
{Undefined} {return new ParsedSymbol(ParsedSymbol.TYPE_UNDEFINED,new Undefined());}
|
||||
{NumberLiteral} { return new ASMParsedSymbol(ASMParsedSymbol.TYPE_INTEGER,new Long(Long.parseLong((yytext())))); }
|
||||
{FloatLiteral} { return new ASMParsedSymbol(ASMParsedSymbol.TYPE_FLOAT,new Double(Double.parseDouble((yytext())))); }
|
||||
{LineTerminator} {yybegin(YYINITIAL); return new ASMParsedSymbol(ASMParsedSymbol.TYPE_EOL); }
|
||||
{Comment} {return new ASMParsedSymbol(ASMParsedSymbol.TYPE_COMMENT,yytext().substring(1));}
|
||||
{StartOfBlock} { yybegin(YYINITIAL); return new ASMParsedSymbol(ASMParsedSymbol.TYPE_BLOCK_START); }
|
||||
{True} {return new ASMParsedSymbol(ASMParsedSymbol.TYPE_BOOLEAN,Boolean.TRUE);}
|
||||
{False} {return new ASMParsedSymbol(ASMParsedSymbol.TYPE_BOOLEAN,Boolean.FALSE);}
|
||||
{Null} {return new ASMParsedSymbol(ASMParsedSymbol.TYPE_NULL,new Null());}
|
||||
{Undefined} {return new ASMParsedSymbol(ASMParsedSymbol.TYPE_UNDEFINED,new Undefined());}
|
||||
|
||||
{Register} { return new ParsedSymbol(ParsedSymbol.TYPE_REGISTER,new RegisterNumber(Integer.parseInt(yytext().substring(8)))); }
|
||||
{Constant} { return new ParsedSymbol(ParsedSymbol.TYPE_CONSTANT,new ConstantIndex(Integer.parseInt(yytext().substring(8)))); }
|
||||
{Register} { return new ASMParsedSymbol(ASMParsedSymbol.TYPE_REGISTER,new RegisterNumber(Integer.parseInt(yytext().substring(8)))); }
|
||||
{Constant} { return new ASMParsedSymbol(ASMParsedSymbol.TYPE_CONSTANT,new ConstantIndex(Integer.parseInt(yytext().substring(8)))); }
|
||||
|
||||
{Identifier} { return new ParsedSymbol(ParsedSymbol.TYPE_IDENTIFIER,yytext()); }
|
||||
{Identifier} { return new ASMParsedSymbol(ASMParsedSymbol.TYPE_IDENTIFIER,yytext()); }
|
||||
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ Constant= constant{PositiveNumberLiteral}
|
||||
\" {
|
||||
yybegin(PARAMETERS);
|
||||
// length also includes the trailing quote
|
||||
return new ParsedSymbol(ParsedSymbol.TYPE_STRING,string.toString());
|
||||
return new ASMParsedSymbol(ASMParsedSymbol.TYPE_STRING,string.toString());
|
||||
}
|
||||
|
||||
{StringCharacter}+ { string.append( yytext() ); }
|
||||
@@ -169,4 +170,4 @@ Constant= constant{PositiveNumberLiteral}
|
||||
|
||||
/* error fallback */
|
||||
.|\n { }
|
||||
<<EOF>> { return new ParsedSymbol(ParsedSymbol.TYPE_EOF); }
|
||||
<<EOF>> { return new ASMParsedSymbol(ASMParsedSymbol.TYPE_EOF); }
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.swf3;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.GetURLTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.swf3;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.GotoLabelTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.swf3;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.GotoFrameTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.swf3;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.SetTargetTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.swf3;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.WaitForFrameTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.GetURL2TreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.GotoFrame2TreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -20,8 +20,8 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraphSource;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSource;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
@@ -48,6 +48,11 @@ public class ActionIf extends Action {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public ActionIf(int offset) {
|
||||
super(0x9D, 2);
|
||||
setJumpOffset(offset);
|
||||
}
|
||||
|
||||
public ActionIf(SWFInputStream sis) throws IOException {
|
||||
super(0x9D, 2);
|
||||
setJumpOffset(sis.readSI16());
|
||||
|
||||
@@ -20,8 +20,8 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraphSource;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSource;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
|
||||
@@ -19,9 +19,9 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
@@ -142,6 +142,14 @@ public class ActionPush extends Action {
|
||||
return surroundWithAction(baos.toByteArray(), version);
|
||||
}
|
||||
|
||||
public ActionPush(Object... values) throws IOException, ParseException {
|
||||
super(0x96, 0);
|
||||
this.values = new ArrayList<Object>();
|
||||
for (Object o : values) {
|
||||
this.values.add(o);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionPush(FlasmLexer lexer, List<String> constantPool) throws IOException, ParseException {
|
||||
super(0x96, 0);
|
||||
this.constantPool = constantPool;
|
||||
@@ -149,9 +157,9 @@ public class ActionPush extends Action {
|
||||
int count = 0;
|
||||
loop:
|
||||
while (true) {
|
||||
ParsedSymbol symb = lexer.yylex();
|
||||
ASMParsedSymbol symb = lexer.yylex();
|
||||
switch (symb.type) {
|
||||
case ParsedSymbol.TYPE_STRING:
|
||||
case ASMParsedSymbol.TYPE_STRING:
|
||||
count++;
|
||||
if (constantPool.contains((String) symb.value)) {
|
||||
values.add(new ConstantIndex(constantPool.indexOf(symb.value), constantPool));
|
||||
@@ -159,24 +167,24 @@ public class ActionPush extends Action {
|
||||
values.add(symb.value);
|
||||
}
|
||||
break;
|
||||
case ParsedSymbol.TYPE_FLOAT:
|
||||
case ParsedSymbol.TYPE_NULL:
|
||||
case ParsedSymbol.TYPE_UNDEFINED:
|
||||
case ParsedSymbol.TYPE_REGISTER:
|
||||
case ParsedSymbol.TYPE_BOOLEAN:
|
||||
case ParsedSymbol.TYPE_INTEGER:
|
||||
case ParsedSymbol.TYPE_CONSTANT:
|
||||
case ASMParsedSymbol.TYPE_FLOAT:
|
||||
case ASMParsedSymbol.TYPE_NULL:
|
||||
case ASMParsedSymbol.TYPE_UNDEFINED:
|
||||
case ASMParsedSymbol.TYPE_REGISTER:
|
||||
case ASMParsedSymbol.TYPE_BOOLEAN:
|
||||
case ASMParsedSymbol.TYPE_INTEGER:
|
||||
case ASMParsedSymbol.TYPE_CONSTANT:
|
||||
count++;
|
||||
values.add(symb.value);
|
||||
break;
|
||||
case ParsedSymbol.TYPE_EOL:
|
||||
case ParsedSymbol.TYPE_EOF:
|
||||
case ASMParsedSymbol.TYPE_EOL:
|
||||
case ASMParsedSymbol.TYPE_EOF:
|
||||
if (count == 0) {
|
||||
throw new ParseException("Arguments expected", lexer.yyline());
|
||||
} else {
|
||||
break loop;
|
||||
}
|
||||
case ParsedSymbol.TYPE_COMMENT:
|
||||
case ASMParsedSymbol.TYPE_COMMENT:
|
||||
break;
|
||||
default:
|
||||
throw new ParseException("Arguments expected", lexer.yyline());
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.swf4;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.WaitForFrame2TreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -19,9 +19,9 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -47,8 +47,8 @@ public class ActionConstantPool extends Action {
|
||||
public ActionConstantPool(FlasmLexer lexer) throws IOException, ParseException {
|
||||
super(0x88, 0);
|
||||
while (true) {
|
||||
ParsedSymbol symb = lexer.yylex();
|
||||
if (symb.type == ParsedSymbol.TYPE_STRING) {
|
||||
ASMParsedSymbol symb = lexer.yylex();
|
||||
if (symb.type == ASMParsedSymbol.TYPE_STRING) {
|
||||
constantPool.add((String) symb.value);
|
||||
} else {
|
||||
lexer.yypushback(lexer.yylength());
|
||||
|
||||
@@ -20,9 +20,9 @@ import com.jpexs.decompiler.flash.ReReadableInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.Label;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.Label;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.FunctionTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
@@ -194,8 +194,6 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
return new HashMap<Integer, String>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void translateContainer(List<List<GraphTargetItem>> content, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
FunctionTreeItem fti = new FunctionTreeItem(this, functionName, paramNames, content.get(0), constantPool, 1);
|
||||
|
||||
@@ -19,8 +19,8 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.StoreRegisterTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemPos;
|
||||
@@ -35,6 +35,11 @@ public class ActionStoreRegister extends Action {
|
||||
|
||||
public int registerNumber;
|
||||
|
||||
public ActionStoreRegister(int registerNumber) {
|
||||
super(0x87, 1);
|
||||
this.registerNumber = registerNumber;
|
||||
}
|
||||
|
||||
public ActionStoreRegister(SWFInputStream sis) throws IOException {
|
||||
super(0x87, 1);
|
||||
registerNumber = sis.readUI8();
|
||||
|
||||
@@ -20,9 +20,9 @@ import com.jpexs.decompiler.flash.ReReadableInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.Label;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.Label;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.clauses.WithTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
@@ -121,7 +121,7 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
public long getHeaderSize() {
|
||||
return surroundWithAction(new byte[]{0, 0}, version).length;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, String> getRegNames() {
|
||||
return new HashMap<Integer, String>();
|
||||
|
||||
@@ -20,9 +20,9 @@ import com.jpexs.decompiler.flash.ReReadableInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.Label;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.Label;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.FunctionTreeItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
|
||||
@@ -58,6 +58,25 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
public List<String> constantPool;
|
||||
private long hdrSize;
|
||||
|
||||
public ActionDefineFunction2(String functionName, boolean preloadParentFlag, boolean preloadRootFlag, boolean suppressSuperFlag, boolean preloadSuperFlag, boolean suppressArgumentsFlag, boolean preloadArgumentsFlag, boolean suppressThisFlag, boolean preloadThisFlag, boolean preloadGlobalFlag, int registerCount, int codeSize, int version, List<String> paramNames, List<Integer> paramRegisters) {
|
||||
super(0x8E, 0);
|
||||
this.functionName = functionName;
|
||||
this.preloadParentFlag = preloadParentFlag;
|
||||
this.preloadRootFlag = preloadRootFlag;
|
||||
this.suppressSuperFlag = suppressSuperFlag;
|
||||
this.preloadSuperFlag = preloadSuperFlag;
|
||||
this.suppressArgumentsFlag = suppressArgumentsFlag;
|
||||
this.preloadArgumentsFlag = preloadArgumentsFlag;
|
||||
this.suppressThisFlag = suppressThisFlag;
|
||||
this.preloadThisFlag = preloadThisFlag;
|
||||
this.preloadGlobalFlag = preloadGlobalFlag;
|
||||
this.registerCount = registerCount;
|
||||
this.codeSize = codeSize;
|
||||
this.version = version;
|
||||
this.paramNames = paramNames;
|
||||
this.paramRegisters = paramRegisters;
|
||||
}
|
||||
|
||||
public ActionDefineFunction2(int actionLength, SWFInputStream sis, ReReadableInputStream rri, int version) throws IOException {
|
||||
super(0x8E, actionLength);
|
||||
long posBef = sis.getPos();
|
||||
@@ -284,7 +303,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, String> getRegNames(){
|
||||
public HashMap<Integer, String> getRegNames() {
|
||||
HashMap<Integer, String> funcRegNames = new HashMap<Integer, String>();
|
||||
for (int f = 0; f < paramNames.size(); f++) {
|
||||
int reg = paramRegisters.get(f);
|
||||
@@ -319,9 +338,9 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
}
|
||||
return funcRegNames;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void translateContainer(List<List<GraphTargetItem>> content, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
public void translateContainer(List<List<GraphTargetItem>> content, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
|
||||
FunctionTreeItem fti = new FunctionTreeItem(this, functionName, paramNames, content.get(0), constantPool, getFirstRegister());
|
||||
functions.put(functionName, fti);
|
||||
stack.push(fti);
|
||||
|
||||
@@ -20,7 +20,10 @@ import com.jpexs.decompiler.flash.ReReadableInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.parser.*;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.ASMParsedSymbol;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.Label;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.TreeItem;
|
||||
@@ -98,14 +101,14 @@ public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
super(0x8F, 0);
|
||||
this.version = version;
|
||||
|
||||
ParsedSymbol symb = lexer.yylex();
|
||||
if (symb.type == ParsedSymbol.TYPE_STRING) {
|
||||
ASMParsedSymbol symb = lexer.yylex();
|
||||
if (symb.type == ASMParsedSymbol.TYPE_STRING) {
|
||||
catchInRegisterFlag = false;
|
||||
catchName = (String) symb.value;
|
||||
} else if (symb.type == ParsedSymbol.TYPE_REGISTER) {
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_REGISTER) {
|
||||
catchRegister = (Integer) symb.value;
|
||||
catchInRegisterFlag = true;
|
||||
} else if (symb.type == ParsedSymbol.TYPE_BLOCK_START) {
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_BLOCK_START) {
|
||||
return;
|
||||
} else {
|
||||
throw new ParseException("Unknown symbol after Try", lexer.yyline());
|
||||
@@ -202,16 +205,16 @@ public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
@Override
|
||||
public boolean parseDivision(int pos, long addr, FlasmLexer lexer) {
|
||||
try {
|
||||
ParsedSymbol symb = lexer.yylex();
|
||||
ASMParsedSymbol symb = lexer.yylex();
|
||||
//catchBlockFlag = false;
|
||||
if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
if (symb.type == ASMParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
if (((String) symb.value).toLowerCase().equals("catch")) {
|
||||
trySize = addr - getAddress() - getHeaderSize();
|
||||
catchBlockFlag = true;
|
||||
lexBlockOpen(lexer);
|
||||
return true;
|
||||
}
|
||||
if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
if (symb.type == ASMParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
if (((String) symb.value).toLowerCase().equals("finally")) {
|
||||
if (catchBlockFlag) {
|
||||
catchSize = addr - getAddress() - getHeaderSize() - trySize;
|
||||
@@ -271,9 +274,9 @@ public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
public String toString() {
|
||||
return "Try";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, String> getRegNames(){
|
||||
public HashMap<Integer, String> getRegNames() {
|
||||
return new HashMap<Integer, String>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ public class SetMemberTreeItem extends TreeItem implements SetTypeTreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (!((objectName instanceof DirectValueTreeItem) && (((DirectValueTreeItem) objectName).value instanceof String))) {
|
||||
//if(!(functionName instanceof GetVariableTreeItem))
|
||||
return object.toString(constants) + "[" + stripQuotes(objectName, constants) + "]" + "=" + value.toString(constants);
|
||||
}
|
||||
return object.toString(constants) + "." + stripQuotes(objectName, constants) + "=" + value.toString(constants);
|
||||
}
|
||||
|
||||
|
||||
@@ -992,10 +992,9 @@ public class Graph {
|
||||
if (debugMode) {
|
||||
System.err.println("ONFALSE: (inside " + part + ")");
|
||||
}
|
||||
if((next == part.nextParts.get(0)) || (part.nextParts.get(0).path.equals(part.path) || part.nextParts.get(0).path.length() < part.path.length()))
|
||||
{
|
||||
onFalse=new ArrayList<GraphTargetItem>();
|
||||
}else{
|
||||
if ((next == part.nextParts.get(0)) || (part.nextParts.get(0).path.equals(part.path) || part.nextParts.get(0).path.length() < part.path.length())) {
|
||||
onFalse = new ArrayList<GraphTargetItem>();
|
||||
} else {
|
||||
onFalse = (printGraph(prepareBranchLocalData(localData), falseStack, allParts, part, part.nextParts.get(0), next == null ? stopPart : next, loops, forFinalCommands));
|
||||
}
|
||||
if (debugMode) {
|
||||
@@ -1009,13 +1008,13 @@ public class Graph {
|
||||
if (whileTrue) {
|
||||
retw = new ArrayList<GraphTargetItem>();
|
||||
retw.add(new IfItem(null, expr, onTrue, onFalse));
|
||||
|
||||
|
||||
List<GraphTargetItem> body = new ArrayList<GraphTargetItem>();
|
||||
if(next!=null){
|
||||
body=printGraph(prepareBranchLocalData(localData), stack, allParts, part,next, stopPart, loops, forFinalCommands);
|
||||
if (next != null) {
|
||||
body = printGraph(prepareBranchLocalData(localData), stack, allParts, part, next, stopPart, loops, forFinalCommands);
|
||||
}
|
||||
retw.addAll(body);
|
||||
|
||||
|
||||
retx.add(new WhileItem(null, whileTrueLoop, new TrueItem(null), retw));
|
||||
next = null;
|
||||
} else {
|
||||
@@ -1056,7 +1055,7 @@ public class Graph {
|
||||
if (doWhile) {
|
||||
loopBodyStart = next;
|
||||
}
|
||||
if(whileTrue){
|
||||
if (whileTrue) {
|
||||
loopBodyStart = part;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.jpexs.decompiler.flash.graph;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
@@ -20,6 +20,6 @@ public interface GraphSourceItemContainer {
|
||||
public boolean parseDivision(int pos, long addr, FlasmLexer lexer);
|
||||
|
||||
public HashMap<Integer, String> getRegNames();
|
||||
|
||||
|
||||
public void translateContainer(List<List<GraphTargetItem>> contents, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.awt.Graphics;
|
||||
import java.awt.Panel;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.JFrame;
|
||||
@@ -84,8 +83,7 @@ public class FlashPlayerPanel extends Panel {
|
||||
|
||||
SHELLEXECUTEINFO sei = new SHELLEXECUTEINFO();
|
||||
sei.fMask = 0x00000040;
|
||||
String path = new File(new File(".").getAbsolutePath()).getParentFile().getAbsolutePath();
|
||||
sei.lpFile = new WString(path + "\\lib\\FlashPlayer.exe");
|
||||
sei.lpFile = new WString("lib\\FlashPlayer.exe");
|
||||
sei.lpParameters = new WString(hwnd.getPointer().hashCode() + " " + hwndFrame.getPointer().hashCode());
|
||||
sei.nShow = WinUser.SW_NORMAL;
|
||||
Shell32.INSTANCE.ShellExecuteEx(sei);
|
||||
|
||||
Reference in New Issue
Block a user