mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-11 13:22:13 +00:00
#1597 Option to use old style lookupswitch in AS3 P-code
This commit is contained in:
@@ -348,8 +348,13 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
|
||||
s.append(Helper.formatAddress(address + operands[i]));
|
||||
break;
|
||||
case AVM2Code.OPT_CASE_OFFSETS:
|
||||
s.append(" [");
|
||||
boolean first = true;
|
||||
if (Configuration.useOldStyleLookupSwitchAs3PCode.get()) {
|
||||
s.append(" ");
|
||||
s.append(operands[i]);
|
||||
} else {
|
||||
s.append(" [");
|
||||
}
|
||||
boolean first = !Configuration.useOldStyleLookupSwitchAs3PCode.get();
|
||||
for (int j = i + 1; j < operands.length; j++) {
|
||||
if (!first) {
|
||||
s.append(", ");
|
||||
@@ -358,7 +363,9 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
|
||||
s.append("ofs");
|
||||
s.append(Helper.formatAddress(address + operands[j]));
|
||||
}
|
||||
s.append("]");
|
||||
if (!Configuration.useOldStyleLookupSwitchAs3PCode.get()) {
|
||||
s.append("]");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
s.append(" ");
|
||||
|
||||
@@ -1061,14 +1061,13 @@ public class ASM3Parser {
|
||||
while (parsedOperand.type == ParsedSymbol.TYPE_IDENTIFIER) {
|
||||
offsetItems.add(new CaseOffsetItem((String) parsedOperand.value, code.code.size(), i + (c + 1)));
|
||||
c++;
|
||||
parsedOperand = lexer.lex();
|
||||
parsedOperand = lexer.lex();
|
||||
if (parsedOperand.type == ParsedSymbol.TYPE_BRACKET_CLOSE) {
|
||||
break;
|
||||
}
|
||||
if (parsedOperand.type != ParsedSymbol.TYPE_COMMA) {
|
||||
throw new AVM2ParseException("Comma , expected", lexer.yyline());
|
||||
if (parsedOperand.type == ParsedSymbol.TYPE_COMMA) {
|
||||
parsedOperand = lexer.lex();
|
||||
}
|
||||
parsedOperand = lexer.lex();
|
||||
}
|
||||
if (parsedOperand.type != ParsedSymbol.TYPE_BRACKET_CLOSE) {
|
||||
throw new AVM2ParseException("Bracket close ] expected", lexer.yyline());
|
||||
@@ -1087,6 +1086,9 @@ public class ASM3Parser {
|
||||
|
||||
for (int c = 0; c <= patCount; c++) {
|
||||
parsedOperand = lexer.lex();
|
||||
if (parsedOperand.type == ParsedSymbol.TYPE_COMMA) {
|
||||
parsedOperand = lexer.lex();
|
||||
}
|
||||
if (parsedOperand.type == ParsedSymbol.TYPE_IDENTIFIER) {
|
||||
offsetItems.add(new CaseOffsetItem((String) parsedOperand.value, code.code.size(), i + (c + 1)));
|
||||
operandsList.add(0);
|
||||
|
||||
@@ -667,6 +667,10 @@ public final class Configuration {
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
@ConfigurationCategory("script")
|
||||
public static ConfigurationItem<Boolean> useOldStyleGetSetLocalsAs3PCode = null;
|
||||
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
@ConfigurationCategory("script")
|
||||
public static ConfigurationItem<Boolean> useOldStyleLookupSwitchAs3PCode = null;
|
||||
|
||||
private enum OSId {
|
||||
WINDOWS, OSX, UNIX
|
||||
|
||||
Reference in New Issue
Block a user