More documentation.

This commit is contained in:
Jindra Petřík
2024-08-08 19:27:14 +02:00
parent 5c1811582a
commit f219b49372
394 changed files with 13018 additions and 552 deletions
@@ -23,6 +23,19 @@ package com.jpexs.decompiler.flash.action.deobfuscation;
*/
public class BrokenScriptDetector {
/**
* Constructor.
*/
public BrokenScriptDetector() {
}
/**
* Checks if the code is broken.
*
* @param code Code
* @return True if the code is broken
*/
public boolean codeIsBroken(String code) {
return code.contains("\u00A7\u00A7");
}
@@ -23,54 +23,128 @@ package com.jpexs.decompiler.flash.action.parser.pcode;
*/
public class ASMParsedSymbol {
/**
* Position
*/
public int pos;
/**
* Type
*/
public int type;
/**
* Value
*/
public Object value;
/**
* Type: String
*/
public static final int TYPE_STRING = 1;
/**
* Type: Block end
*/
public static final int TYPE_BLOCK_END = 2;
/**
* Type: Instruction name
*/
public static final int TYPE_INSTRUCTION_NAME = 3;
/**
* Type: Integer
*/
public static final int TYPE_INTEGER = 4;
/**
* Type: Float
*/
public static final int TYPE_FLOAT = 5;
/**
* Type: Boolean
*/
public static final int TYPE_BOOLEAN = 11;
/**
* Type: Identifier
*/
public static final int TYPE_IDENTIFIER = 6;
/**
* Type: End of file
*/
public static final int TYPE_EOF = 7;
/**
* Type: Label
*/
public static final int TYPE_LABEL = 8;
/**
* Type: Comment
*/
public static final int TYPE_COMMENT = 9;
/**
* Type: Block start
*/
public static final int TYPE_BLOCK_START = 10;
/**
* Type: Register
*/
public static final int TYPE_REGISTER = 12;
/**
* Type: Constant
*/
public static final int TYPE_CONSTANT = 13;
/**
* Type: Null
*/
public static final int TYPE_NULL = 14;
/**
* Type: Undefined
*/
public static final int TYPE_UNDEFINED = 15;
/**
* Type: End of line
*/
public static final int TYPE_EOL = 16;
/***
* Type: Constant literal
*/
public static final int TYPE_CONSTANT_LITERAL = 17;
/***
* Type: Comma
*/
public static final int TYPE_COMMA = 18;
/**
* Constructor.
* @param pos Position
* @param type Type
* @param value Value
*/
public ASMParsedSymbol(int pos, int type, Object value) {
this.pos = pos;
this.type = type;
this.value = value;
}
/**
* Constructor.
* @param pos Position
* @param type Type
*/
public ASMParsedSymbol(int pos, int type) {
this.pos = pos;
this.type = type;
@@ -146,6 +146,12 @@ public class ASMParser {
private static final Logger logger = Logger.getLogger(ASMParser.class.getName());
/**
* Constructor.
*/
public ASMParser() {
}
private static Action parseAction(String instructionName, FlasmLexer lexer, List<String> constantPool, int version, String charset) throws IOException, ActionParseException {
Action a = null;
if (instructionName.compareToIgnoreCase("GetURL") == 0) {
@@ -398,6 +404,20 @@ public class ASMParser {
}
}
/**
* Parses ActionScript 1-2.
* @param ignoreNops Ignore NOPs
* @param labels Labels
* @param lineMap Line map
* @param address Address
* @param lexer Lexer
* @param constantPool Constant pool
* @param version Version
* @param charset Charset
* @return Action list
* @throws IOException On I/O error
* @throws ActionParseException On parse error
*/
public static ActionList parse(boolean ignoreNops, List<Label> labels, Map<Action, Integer> lineMap, long address, FlasmLexer lexer, List<String> constantPool, int version, String charset) throws IOException, ActionParseException {
ActionList list = new ActionList(charset);
Stack<GraphSourceItemContainer> containers = new Stack<>();
@@ -467,6 +487,18 @@ public class ASMParser {
}
}
/**
* Parses ActionScript 1-2.
* @param address Address
* @param ignoreNops Ignore NOPs
* @param source Source
* @param version Version
* @param throwOnError Throw on error
* @param charset Charset
* @return Action list
* @throws IOException On I/O error
* @throws ActionParseException On parse error
*/
public static ActionList parse(long address, boolean ignoreNops, String source, int version, boolean throwOnError, String charset) throws IOException, ActionParseException {
FlasmLexer lexer = new FlasmLexer(new StringReader(source));
List<Action> list = parseAllActions(lexer, version, charset);