Merge origin/master

This commit is contained in:
Jindra Petřík
2015-11-21 19:13:06 +01:00
40 changed files with 1351 additions and 676 deletions
@@ -0,0 +1,75 @@
/*
* 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.helpers;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.action.ActionList;
import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.List;
/**
*
* @author JPEXS
*/
public class SWFDecompilerAdapter implements SWFDecompilerListener {
@Override
public byte[] proxyFileCatched(byte[] data) {
return null;
}
@Override
public void swfParsed(SWF swf) {
}
@Override
public void actionListParsed(ActionList actions, SWF swf) throws InterruptedException {
}
@Override
public void actionTreeCreated(List<GraphTargetItem> tree, SWF swf) throws InterruptedException {
}
@Override
public void abcParsed(ABC abc, SWF swf) {
}
@Override
public void methodBodyParsed(MethodBody body, SWF swf) {
}
/**
* This method is only called when deobfuscation is enabled and new
* deobfuscation mode is selected
*
* @param path
* @param classIndex
* @param isStatic
* @param scriptIndex
* @param abc
* @param trait
* @param methodInfo
* @param body
* @throws InterruptedException
*/
@Override
public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException {
}
}
@@ -42,6 +42,19 @@ public interface SWFDecompilerListener {
void methodBodyParsed(MethodBody body, SWF swf);
// this method is only called when deobfuscation is enabled and new deobfuscation mode is selected
/**
* this method is only called when deobfuscation is enabled and new
* deobfuscation mode is selected
*
* @param path
* @param classIndex
* @param isStatic
* @param scriptIndex
* @param abc
* @param trait
* @param methodInfo
* @param body
* @throws InterruptedException
*/
void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException;
}
@@ -0,0 +1,67 @@
/*
* 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.helpers.collections;
import java.util.Stack;
/**
*
* @author JPEXS
*/
public class FixItemCounterStack extends Stack<Object> {
private int fixItemCount = Integer.MAX_VALUE;
public FixItemCounterStack() {
}
public Object peek(int index) {
return super.get(size() - index);
}
@Override
public Object pop() {
Object result = super.pop();
int itemCount = size();
if (itemCount < fixItemCount) {
fixItemCount = itemCount;
}
return result;
}
@Override
public Object remove(int index) {
if (index < fixItemCount) {
fixItemCount = index;
}
return super.remove(index);
}
public boolean allItemsFixed() {
return size() <= fixItemCount;
}
public int getFixItemCount() {
return fixItemCount;
}
@Override
public void clear() {
fixItemCount = Integer.MAX_VALUE;
super.clear();
}
}