format source code

This commit is contained in:
honfika@gmail.com
2015-07-04 20:51:26 +02:00
parent 6cafe970fb
commit fac67d5baa
24 changed files with 5853 additions and 5413 deletions

View File

@@ -60,6 +60,7 @@ public class AVM2LocalData extends BaseLocalData {
public Map<Integer, List<Integer>> finallyJumps;
public Map<Integer, Integer> ignoredSwitches;
public List<Integer> ignoredSwitches2;
public Integer scriptIndex;

View File

@@ -1,46 +1,45 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopIns;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.ScopeStack;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
import java.util.List;
/**
*
* @author JPEXS
*/
public class DeobfuscatePopIns extends PopIns {
public DeobfuscatePopIns() {
instructionName = "ffdec_deobfuscatepop";
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
stack.pop(); //Just ignore the value
}
}
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopIns;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.ScopeStack;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
import java.util.List;
/**
*
* @author JPEXS
*/
public class DeobfuscatePopIns extends PopIns {
public DeobfuscatePopIns() {
instructionName = "ffdec_deobfuscatepop";
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
stack.pop(); //Just ignore the value
}
}

View File

@@ -23,5 +23,4 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
public interface AlchemyTypeIns {
public static final String ALCHEMY_PACKAGE = "avm2.intrinsics.memory";
}

View File

@@ -39,6 +39,7 @@ import java.util.List;
public class AlchemyLoadAVM2Item extends AVM2Item {
private final char type;
private final int size;
private final GraphTargetItem ofs;

View File

@@ -39,6 +39,7 @@ import java.util.List;
public class AlchemyStoreAVM2Item extends AVM2Item {
private final char type;
private final int size;
private final GraphTargetItem ofs;
@@ -93,5 +94,4 @@ public class AlchemyStoreAVM2Item extends AVM2Item {
}
return toSourceMerge(localData, generator, ofs, ins(def));
}
}

View File

@@ -26,7 +26,6 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.CompilationException;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.SimpleValue;
import com.jpexs.decompiler.graph.SourceGenerator;
import com.jpexs.decompiler.graph.TypeItem;
import com.jpexs.decompiler.graph.model.IntegerValueTypeItem;
@@ -86,5 +85,4 @@ public class IntegerValueAVM2Item extends NumberValueAVM2Item implements Integer
public int intValue() {
return (int) (long) value;
}
}

View File

@@ -147,5 +147,4 @@ public class LocalRegAVM2Item extends AVM2Item {
}
return true;
}
}

View File

@@ -373,5 +373,4 @@ public class Multiname {
}
return true;
}
}

View File

@@ -102,5 +102,4 @@ public class DottedChain {
}
return true;
}
}

View File

@@ -7,5 +7,4 @@ import com.jpexs.decompiler.graph.model.BinaryOp;
* @author JPEXS
*/
public interface EqualsTypeItem extends BinaryOp {
}

View File

@@ -312,5 +312,4 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
public GraphTargetItem invert(GraphSourceItem src) {
return new NotItem(src, this);
}
}

View File

@@ -73,5 +73,4 @@ public class TranslateStack extends Stack<GraphTargetItem> {
}
return super.pop();
}
}

View File

@@ -31,37 +31,37 @@ import java.util.Objects;
* @author JPEXS
*/
public class TypeItem extends GraphTargetItem {
public static TypeItem BOOLEAN = new TypeItem("Boolean");
public static TypeItem STRING = new TypeItem("String");
public static TypeItem ARRAY = new TypeItem("Array");
public static UnboundedTypeItem UNBOUNDED = new UnboundedTypeItem();
public DottedChain fullTypeName;
public TypeItem(String s) {
this(s == null ? new DottedChain() : new DottedChain(s.split("\\.")));
}
public TypeItem(DottedChain fullTypeName) {
this(fullTypeName, new ArrayList<GraphTargetItem>());
}
public TypeItem(DottedChain fullTypeName, List<GraphTargetItem> subtypes) {
super(null, NOPRECEDENCE);
this.fullTypeName = fullTypeName;
}
@Override
public int hashCode() {
int hash = 7;
hash = 83 * hash + Objects.hashCode(this.fullTypeName);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
@@ -76,7 +76,7 @@ public class TypeItem extends GraphTargetItem {
}
return true;
}
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
if (localData.fullyQualifiedNames.contains(fullTypeName)) {
@@ -84,25 +84,25 @@ public class TypeItem extends GraphTargetItem {
} else {
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(localData.constantsAvm2 != null, fullTypeName.getLast()), HighlightSpecialType.TYPE_NAME, fullTypeName.toPrintableString());
}
return writer;
}
@Override
public GraphTargetItem returnType() {
return this;
}
@Override
public boolean hasReturnValue() {
return true;
}
@Override
public String toString() {
return fullTypeName.toString();
}
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return generator.generate(localData, this);

View File

@@ -105,5 +105,4 @@ public class DuplicateItem extends GraphTargetItem implements SimpleValue {
public boolean isSimpleValue() {
return ((value instanceof SimpleValue) && ((SimpleValue) value).isSimpleValue());
}
}

View File

@@ -74,5 +74,4 @@ public class FalseItem extends GraphTargetItem implements LogicalOpItem, SimpleV
public Object getResult() {
return Boolean.FALSE;
}
}

View File

@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.graph.model;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
@@ -55,5 +54,4 @@ public class GotoItem extends GraphTargetItem {
public Object getResult() {
return null;
}
}

View File

@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.graph.model;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
@@ -65,5 +64,4 @@ public class LabelItem extends GraphTargetItem {
public Object getResult() {
return null;
}
}

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library 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
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -81,5 +81,4 @@ public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted {
public GraphTargetItem invert(GraphSourceItem src) {
return value;
}
}

View File

@@ -53,5 +53,4 @@ public class PopItem extends GraphTargetItem {
public Object getResult() {
return new Null();
}
}

View File

@@ -63,5 +63,4 @@ public class PushItem extends GraphTargetItem {
public GraphTargetItem getThroughRegister() {
return value.getThroughRegister();
}
}

View File

@@ -75,5 +75,4 @@ public class TrueItem extends GraphTargetItem implements LogicalOpItem, SimpleVa
public Object getResult() {
return Boolean.TRUE;
}
}