mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 22:20:46 +00:00
Checkstyle fix
This commit is contained in:
@@ -728,50 +728,49 @@ public abstract class Action implements GraphSourceItem {
|
||||
}
|
||||
} else {
|
||||
//if (!(a instanceof ActionNop)) {
|
||||
String add = "";
|
||||
String add = "";
|
||||
//Flash player 4 does not allow more than 1 item in ActionPush, so I commented this out
|
||||
/*if ((a instanceof ActionPush) && lastPush) {
|
||||
writer.appendNoHilight(", ");
|
||||
((ActionPush) a).paramsToStringReplaced(list, importantOffsets, exportMode, writer);
|
||||
} else
|
||||
*/
|
||||
{
|
||||
if (lastPush) {
|
||||
writer.newLine();
|
||||
//lastPush = false;
|
||||
}
|
||||
{ */
|
||||
if (lastPush) {
|
||||
writer.newLine();
|
||||
//lastPush = false;
|
||||
}
|
||||
|
||||
writer.append("", offset, a.getFileOffset());
|
||||
writer.append("", offset, a.getFileOffset());
|
||||
|
||||
int fixBranch = -1;
|
||||
if (a instanceof ActionIf) {
|
||||
ActionIf aif = (ActionIf) a;
|
||||
if (aif.jumpUsed && !aif.ignoreUsed) {
|
||||
fixBranch = 0;
|
||||
}
|
||||
if (!aif.jumpUsed && aif.ignoreUsed) {
|
||||
fixBranch = 1;
|
||||
}
|
||||
int fixBranch = -1;
|
||||
if (a instanceof ActionIf) {
|
||||
ActionIf aif = (ActionIf) a;
|
||||
if (aif.jumpUsed && !aif.ignoreUsed) {
|
||||
fixBranch = 0;
|
||||
}
|
||||
|
||||
if (fixBranch > -1) {
|
||||
writer.appendNoHilight("FFDec_DeobfuscatePop");
|
||||
if (fixBranch == 0) { //jump
|
||||
writer.newLine();
|
||||
writer.appendNoHilight("Jump loc");
|
||||
writer.appendNoHilight(Helper.formatAddress(((ActionIf) a).getTargetAddress()));
|
||||
} else {
|
||||
//nojump, ignore
|
||||
}
|
||||
} else {
|
||||
a.getASMSourceReplaced(list, importantOffsets, exportMode, writer);
|
||||
}
|
||||
writer.appendNoHilight(a.isIgnored() ? "; ignored" : "");
|
||||
writer.appendNoHilight(add);
|
||||
if (!(a instanceof ActionPush)) {
|
||||
writer.newLine();
|
||||
if (!aif.jumpUsed && aif.ignoreUsed) {
|
||||
fixBranch = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (fixBranch > -1) {
|
||||
writer.appendNoHilight("FFDec_DeobfuscatePop");
|
||||
if (fixBranch == 0) { //jump
|
||||
writer.newLine();
|
||||
writer.appendNoHilight("Jump loc");
|
||||
writer.appendNoHilight(Helper.formatAddress(((ActionIf) a).getTargetAddress()));
|
||||
} else {
|
||||
//nojump, ignore
|
||||
}
|
||||
} else {
|
||||
a.getASMSourceReplaced(list, importantOffsets, exportMode, writer);
|
||||
}
|
||||
writer.appendNoHilight(a.isIgnored() ? "; ignored" : "");
|
||||
writer.appendNoHilight(add);
|
||||
if (!(a instanceof ActionPush)) {
|
||||
writer.newLine();
|
||||
}
|
||||
//}
|
||||
lastPush = a instanceof ActionPush;
|
||||
//}
|
||||
}
|
||||
@@ -985,8 +984,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
public List<GraphTargetItem> call() throws Exception {
|
||||
int staticOperation = 0;
|
||||
boolean insideDoInitAction = (asm instanceof DoInitActionTag);
|
||||
List<GraphTargetItem>
|
||||
tree = actionsToTree(uninitializedClassTraits, insideDoInitAction, false, new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path, charset);
|
||||
List<GraphTargetItem> tree = actionsToTree(uninitializedClassTraits, insideDoInitAction, false, new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path, charset);
|
||||
SWFDecompilerPlugin.fireActionTreeCreated(tree, swf);
|
||||
for (ActionTreeOperation treeOperation : treeOperations) {
|
||||
treeOperation.run(tree);
|
||||
@@ -1055,6 +1053,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
|
||||
/**
|
||||
* Converts list of actions to List of treeItems.
|
||||
*
|
||||
* @param uninitializedClassTraits Uninitialized class traits
|
||||
* @param insideDoInitAction Inside DoInitAction?
|
||||
* @param insideFunction Inside function?
|
||||
@@ -1237,7 +1236,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
loopip:
|
||||
while (ip <= end) {
|
||||
|
||||
long addr = ip2adr(actions, ip);
|
||||
long addr = ip2adr(actions, ip);
|
||||
if (ip > end) {
|
||||
break;
|
||||
}
|
||||
@@ -1248,7 +1247,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
if (Configuration.simplifyExpressions.get()) {
|
||||
stack.simplify();
|
||||
}
|
||||
Action action = actions.get(ip);
|
||||
Action action = actions.get(ip);
|
||||
if (action.isIgnored()) {
|
||||
ip++;
|
||||
continue;
|
||||
|
||||
+2
-2
@@ -705,7 +705,7 @@ public class FastActionList implements Collection<ActionItem> {
|
||||
}
|
||||
modified = false;
|
||||
ActionItem item = firstItem2;
|
||||
do {
|
||||
do {
|
||||
ActionItem next = item.next;
|
||||
//ActionItem alternativeNext = null;
|
||||
Action action = item.action;
|
||||
@@ -880,7 +880,7 @@ public class FastActionList implements Collection<ActionItem> {
|
||||
/**
|
||||
* Converts the list to an array.
|
||||
*
|
||||
* @param the array into which the elements of this collection are to be
|
||||
* @param a the array into which the elements of this collection are to be
|
||||
* stored, if it is big enough; otherwise, a new array of the same runtime
|
||||
* type is allocated for this purpose.
|
||||
* @param <T> Type
|
||||
|
||||
@@ -54,7 +54,6 @@ public class FSCommand2ActionItem extends ActionItem {
|
||||
*
|
||||
* @param instruction Instruction
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param command Command
|
||||
* @param arguments Arguments
|
||||
*/
|
||||
public FSCommand2ActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, List<GraphTargetItem> arguments) {
|
||||
|
||||
+6
-4
@@ -17,7 +17,6 @@
|
||||
package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.StringAddActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionGetURL;
|
||||
@@ -49,6 +48,7 @@ public class FSCommandActionItem extends ActionItem {
|
||||
* Parameter
|
||||
*/
|
||||
private final GraphTargetItem parameter;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -89,10 +89,12 @@ public class FSCommandActionItem extends ActionItem {
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
|
||||
String charset = asGenerator.getCharset();
|
||||
if ((command instanceof DirectValueActionItem)
|
||||
if ((command instanceof DirectValueActionItem)
|
||||
&& ((DirectValueActionItem) command).isString()
|
||||
&& (parameter == null ||
|
||||
((parameter instanceof DirectValueActionItem) && ((DirectValueActionItem) parameter).isString()))) {
|
||||
&& (
|
||||
parameter == null
|
||||
|| ((parameter instanceof DirectValueActionItem) && ((DirectValueActionItem) parameter).isString())
|
||||
)) {
|
||||
return toSourceMerge(localData, generator, new ActionGetURL("FSCommand:" + ((DirectValueActionItem) command).getAsString(), parameter == null ? "" : ((DirectValueActionItem) parameter).getAsString(), charset));
|
||||
}
|
||||
return toSourceMerge(localData, generator, new StringAddActionItem(null, null, asGenerator.pushConstTargetItem("FSCommand:"), command), parameter == null ? asGenerator.pushConstTargetItem("") : parameter, new ActionGetURL2(1/*GET*/, false, false, charset), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}, charset) : null);
|
||||
|
||||
+8
-5
@@ -126,7 +126,6 @@ import com.jpexs.decompiler.flash.action.model.operations.StringNeActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.SubtractActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.URShiftActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import static com.jpexs.decompiler.flash.action.parser.script.SymbolType.FSCOMMAND;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionIf;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
|
||||
@@ -253,6 +252,7 @@ public class ActionScript2Parser {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param swf Swf
|
||||
* @param targetSource Target source
|
||||
*/
|
||||
@@ -269,6 +269,7 @@ public class ActionScript2Parser {
|
||||
|
||||
/**
|
||||
* Parse SWF classes
|
||||
*
|
||||
* @param swf SWF
|
||||
*/
|
||||
private void parseSwfClasses(SWF swf) {
|
||||
@@ -598,7 +599,7 @@ public class ActionScript2Parser {
|
||||
s = lex();
|
||||
GraphTargetItem parameter = null;
|
||||
if (s.isType(SymbolType.COMMA)) {
|
||||
parameter = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval);
|
||||
parameter = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval);
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
@@ -1408,7 +1409,7 @@ public class ActionScript2Parser {
|
||||
}
|
||||
return new EmptyCommand();
|
||||
case DIRECTIVE:
|
||||
switch((String)s.value) {
|
||||
switch ((String) s.value) {
|
||||
case "strict":
|
||||
ret = new StrictModeActionItem(null, null, 1);
|
||||
break;
|
||||
@@ -2147,12 +2148,12 @@ public class ActionScript2Parser {
|
||||
}
|
||||
|
||||
private DirectValueActionItem pushConst(String s) throws IOException, ActionParseException {
|
||||
|
||||
|
||||
//ActionConstantPool was introduced in SWF 5
|
||||
if (swfVersion < 5) {
|
||||
return new DirectValueActionItem(null, null, 0, s, constantPool);
|
||||
}
|
||||
|
||||
|
||||
int index = constantPool.indexOf(s);
|
||||
if (index == -1) {
|
||||
if (ActionConstantPool.calculateSize(constantPool) + ActionConstantPool.calculateSize(s) <= 0xffff) {
|
||||
@@ -2175,6 +2176,7 @@ public class ActionScript2Parser {
|
||||
|
||||
/**
|
||||
* Convert a string to a high-level model.
|
||||
*
|
||||
* @param str The string to convert
|
||||
* @param constantPool The constant pool to use
|
||||
* @return The high-level model
|
||||
@@ -2481,6 +2483,7 @@ public class ActionScript2Parser {
|
||||
|
||||
/**
|
||||
* Converts a string to a list of actions.
|
||||
*
|
||||
* @param s The string to convert
|
||||
* @param charset Charset
|
||||
* @return List of actions
|
||||
|
||||
+29
-13
@@ -94,6 +94,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param swfVersion SWF version
|
||||
* @param constantPool Constant pool
|
||||
* @param charset Charset
|
||||
@@ -106,6 +107,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Generates unique ID.
|
||||
*
|
||||
* @return Unique ID
|
||||
*/
|
||||
public String uniqId() {
|
||||
@@ -115,6 +117,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Gets charset.
|
||||
*
|
||||
* @return Charset
|
||||
*/
|
||||
public String getCharset() {
|
||||
@@ -131,22 +134,23 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Converts list of GraphSourceItem to list of Action.
|
||||
*
|
||||
* @param items List of GraphSourceItem
|
||||
* @return List of Action
|
||||
*/
|
||||
public List<Action> toActionList(List<GraphSourceItem> items) {
|
||||
items = groupPushes(items);
|
||||
List<Action> ret = new ArrayList<>();
|
||||
for (GraphSourceItem s : items) {
|
||||
for (GraphSourceItem s : items) {
|
||||
if (s instanceof Action) {
|
||||
ret.add((Action) s);
|
||||
ret.add((Action) s);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private List<GraphSourceItem> groupPushes(List<GraphSourceItem> items) {
|
||||
|
||||
|
||||
//TODO: This should take in account important offsets (jumps)
|
||||
//And not group Pushes over different parts of code
|
||||
/*Like:
|
||||
@@ -157,9 +161,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
Push "C"
|
||||
|
||||
Should not be grouped to Push "A","B","C"
|
||||
*/
|
||||
|
||||
|
||||
*/
|
||||
return items;
|
||||
//Commented out for now...
|
||||
/*if (swfVersion <= 4) {
|
||||
@@ -223,10 +225,9 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
ifaif.setJumpOffset(onTrueLen);
|
||||
ActionJump ajmp = null;
|
||||
if (onFalse != null) {
|
||||
if (onTrueCmds.isEmpty() ||
|
||||
!((onTrueCmds.get(onTrueCmds.size() - 1) instanceof ContinueItem)
|
||||
|| (onTrueCmds.get(onTrueCmds.size() - 1) instanceof BreakItem))
|
||||
) {
|
||||
if (onTrueCmds.isEmpty()
|
||||
|| !((onTrueCmds.get(onTrueCmds.size() - 1) instanceof ContinueItem)
|
||||
|| (onTrueCmds.get(onTrueCmds.size() - 1) instanceof BreakItem))) {
|
||||
ajmp = new ActionJump(0, charset);
|
||||
ret.add(ajmp);
|
||||
onTrueLen += ajmp.getTotalActionLength();
|
||||
@@ -266,6 +267,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Gets register variables.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @return Register variables
|
||||
*/
|
||||
@@ -275,6 +277,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Sets register variables.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @param value Register variables
|
||||
*/
|
||||
@@ -284,6 +287,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Sets in function.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @param value Value
|
||||
*/
|
||||
@@ -293,6 +297,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Gets in function.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @return Value
|
||||
*/
|
||||
@@ -302,6 +307,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Checks if in method.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @return True if in method
|
||||
*/
|
||||
@@ -311,6 +317,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Sets in method.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @param value Value
|
||||
*/
|
||||
@@ -320,6 +327,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Gets for in level.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @return For in level
|
||||
*/
|
||||
@@ -329,6 +337,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Sets for in level.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @param value Value
|
||||
*/
|
||||
@@ -338,6 +347,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Gets temp register.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @return Temp register
|
||||
*/
|
||||
@@ -354,6 +364,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Releases temp register.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @param tmp Temp register
|
||||
*/
|
||||
@@ -467,6 +478,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Gets SWF version.
|
||||
*
|
||||
* @return SWF version
|
||||
*/
|
||||
public int getSwfVersion() {
|
||||
@@ -475,6 +487,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Gets constant pool.
|
||||
*
|
||||
* @return Constant pool
|
||||
*/
|
||||
public List<String> getConstantPool() {
|
||||
@@ -483,6 +496,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Gets Push constant item.
|
||||
*
|
||||
* @param s Constant
|
||||
* @return Push constant item
|
||||
*/
|
||||
@@ -497,6 +511,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Gets Push constant action.
|
||||
*
|
||||
* @param s Constant
|
||||
* @return Push constant action
|
||||
*/
|
||||
@@ -518,6 +533,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
|
||||
/**
|
||||
* Generates traits.
|
||||
*
|
||||
* @param localData Local data
|
||||
* @param isInterface Is interface
|
||||
* @param name Name
|
||||
@@ -1028,7 +1044,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
for (GraphTargetItem item : commands) {
|
||||
ret.addAll(item.toSourceIgnoreReturnValue(localData, this));
|
||||
}
|
||||
ret = groupPushes(ret);
|
||||
ret = groupPushes(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ public class ActionGetURL2 extends Action {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param sendVarsMethod Send variables method
|
||||
* @param loadVariablesFlag Load variables flag
|
||||
* @param loadTargetFlag Load target flag
|
||||
@@ -107,6 +108,7 @@ public class ActionGetURL2 extends Action {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param actionLength Action length
|
||||
* @param sis SWF input stream
|
||||
* @param charset Charset
|
||||
@@ -145,6 +147,7 @@ public class ActionGetURL2 extends Action {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param lexer Lexer
|
||||
* @param charset Charset
|
||||
* @throws IOException On I/O error
|
||||
@@ -219,10 +222,7 @@ public class ActionGetURL2 extends Action {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (loadVariablesFlag) {
|
||||
if (num != null) {
|
||||
output.add(new LoadVariablesNumActionItem(this, lineStartAction, urlString, num, sendVarsMethod));
|
||||
@@ -244,7 +244,7 @@ public class ActionGetURL2 extends Action {
|
||||
boolean doPrintAsBitmap = false;
|
||||
boolean doFSCommand = false;
|
||||
boolean doUnload = false;
|
||||
|
||||
|
||||
if (urlString.isCompileTime() && (urlString.getResult() instanceof String)) {
|
||||
String urlStr = (String) urlString.getResult();
|
||||
if ("".equals(urlStr)) {
|
||||
@@ -260,30 +260,30 @@ public class ActionGetURL2 extends Action {
|
||||
doFSCommand = true;
|
||||
}
|
||||
} else if (urlString instanceof StringAddActionItem) {
|
||||
StringAddActionItem sa = (StringAddActionItem) urlString;
|
||||
if (sa.leftSide.isCompileTime()) {
|
||||
Object res = sa.leftSide.getResult();
|
||||
if (res instanceof String) {
|
||||
String urlStr = (String) res;
|
||||
switch (urlStr) {
|
||||
case printPrefix:
|
||||
printType = sa.rightSide;
|
||||
doPrint = true;
|
||||
urlString = null;
|
||||
break;
|
||||
case printAsBitmapPrefix:
|
||||
printType = sa.rightSide;
|
||||
doPrintAsBitmap = true;
|
||||
urlString = null;
|
||||
break;
|
||||
case fscommandPrefix:
|
||||
urlString = sa.rightSide;
|
||||
doFSCommand = true;
|
||||
break;
|
||||
}
|
||||
StringAddActionItem sa = (StringAddActionItem) urlString;
|
||||
if (sa.leftSide.isCompileTime()) {
|
||||
Object res = sa.leftSide.getResult();
|
||||
if (res instanceof String) {
|
||||
String urlStr = (String) res;
|
||||
switch (urlStr) {
|
||||
case printPrefix:
|
||||
printType = sa.rightSide;
|
||||
doPrint = true;
|
||||
urlString = null;
|
||||
break;
|
||||
case printAsBitmapPrefix:
|
||||
printType = sa.rightSide;
|
||||
doPrintAsBitmap = true;
|
||||
urlString = null;
|
||||
break;
|
||||
case fscommandPrefix:
|
||||
urlString = sa.rightSide;
|
||||
doFSCommand = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num != null) {
|
||||
if (doUnload) {
|
||||
|
||||
Reference in New Issue
Block a user